reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
SdpCandidate.hxx
Go to the documentation of this file.
1#if !defined(SdpCandidate_hxx)
2#define SdpCandidate_hxx
3
4#include "rutil/compat.hxx"
5#include "rutil/Data.hxx"
6#include <list>
7
8namespace sdpcontainer
9{
10
12{
13public:
14
15 typedef enum
16 {
18 CANDIDATE_TRANSPORT_TYPE_UDP, // "udp" - draft-ietf-mmusic-ice-12
19 CANDIDATE_TRANSPORT_TYPE_TCP_SO, // "tcp-so" - TCP simultaneous-open - draft-ietf-mmusic-ice-tcp-02
20 CANDIDATE_TRANSPORT_TYPE_TCP_ACT, // "tcp-act" - TCP active - draft-ietf-mmusic-ice-tcp-02
21 CANDIDATE_TRANSPORT_TYPE_TCP_PASS, // "tcp-pass" - TCP passive - draft-ietf-mmusic-ice-tcp-02
22 CANDIDATE_TRANSPORT_TYPE_TLS_SO, // "tls-so" - TCP simultaneous-open - draft-ietf-mmusic-ice-tcp-02
23 CANDIDATE_TRANSPORT_TYPE_TLS_ACT, // "tls-act" - TCP active - draft-ietf-mmusic-ice-tcp-02
24 CANDIDATE_TRANSPORT_TYPE_TLS_PASS // "tls-pass" - TCP passive - draft-ietf-mmusic-ice-tcp-02
26 static const char* SdpCandidateTransportTypeString[];
27
28 typedef enum
29 {
31 CANDIDATE_TYPE_HOST, // "host" - draft-ietf-mmusic-ice-12
32 CANDIDATE_TYPE_SRFLX, // "srflx" - server reflexive - draft-ietf-mmusic-ice-12
33 CANDIDATE_TYPE_PRFLX, // "prflx" - peer reflexive - draft-ietf-mmusic-ice-12
34 CANDIDATE_TYPE_RELAY, // "relay" - draft-ietf-mmusic-ice-12
36 static const char* SdpCandidateTypeString[];
37
39 {
40 public:
41 SdpCandidateExtensionAttribute(const char * name, const char * value) : mName(name), mValue(value) {}
43
44 bool operator==(const SdpCandidateExtensionAttribute& rhs) const { return mName == rhs.mName && mValue == rhs.mValue; }
45
46 void setName(const char * name) { mName = name; }
47 const resip::Data& getName() const { return mName; }
48
49 void setValue(const char * value) { mValue = value; }
50 const resip::Data& getValue() const { return mValue; }
51
52 private:
53 resip::Data mName;
54 resip::Data mValue;
55 };
56
57 SdpCandidate(const char * foundation = 0,
58 unsigned int id = 0,
60 uint64_t priority = 0,
61 const char * connectionAddress = 0,
62 unsigned int port = 0,
64 const char * relatedAddress = 0,
65 unsigned int relatedPort = 0,
66 bool inUse = false);
67
69
70 virtual ~SdpCandidate();
71
72 typedef std::list<SdpCandidateExtensionAttribute> SdpCandidateExtensionAttributeList;
73
75 bool operator<(const SdpCandidate& rhs) const;
76 bool operator==(const SdpCandidate& rhs) const;
77 bool operator!=(const SdpCandidate& rhs) const;
78
79 void setFoundation(const char * foundation) { mFoundation = foundation; }
80 void setId(unsigned int id) { mId = id; }
81 void setTransport(SdpCandidateTransportType transport) { mTransport = transport; }
82 void setPriority(uint64_t priority) { mPriority = priority; }
83 void setConnectionAddress(const char * connectionAddress) { mConnectionAddress = connectionAddress; }
84 void setPort(unsigned int port) { mPort = port; }
86 void setRelatedAddress(const char * relatedAddress) { mRelatedAddress = relatedAddress; }
87 void setRelatedPort(unsigned int relatedPort) { mRelatedPort = relatedPort; }
88
89 void addExtensionAttribute(const char * name, const char * value) { addExtensionAttribute(SdpCandidateExtensionAttribute(name, value)); }
91 void clearExtensionAttributes() { mExtensionAttributes.clear(); }
92
93 void setInUse(bool inUse) { mInUse = inUse; }
94
96
97 const resip::Data& getFoundation() const { return mFoundation; }
98 unsigned int getId() const { return mId; }
99 SdpCandidateTransportType getTransport() const { return mTransport; }
101 uint64_t getPriority() const { return mPriority; }
102 const resip::Data& getConnectionAddress() const { return mConnectionAddress; }
103 unsigned int getPort() const { return mPort; }
104 SdpCandidateType getCandidateType() const { return mCandidateType; }
105 static SdpCandidateType getCandidateTypeFromString(const char * type);
106 const resip::Data& getRelatedAddress() const { return mRelatedAddress; }
107 unsigned int getRelatedPort() const { return mRelatedPort; }
108 const SdpCandidateExtensionAttributeList& getExtensionAttributes() const { return mExtensionAttributes; }
109 bool isInUse() const { return mInUse; }
110
111private:
112 resip::Data mFoundation;
113 unsigned int mId;
114 SdpCandidateTransportType mTransport;
115 uint64_t mPriority;
116 resip::Data mConnectionAddress;
117 unsigned int mPort;
118 SdpCandidateType mCandidateType;
119 resip::Data mRelatedAddress;
120 unsigned int mRelatedPort;
121 SdpCandidateExtensionAttributeList mExtensionAttributes;
122
123 bool mInUse;
124
126};
127
129
130} // namespace
131
132#endif
133
134/* ====================================================================
135
136 Copyright (c) 2007-2008, Plantronics, Inc.
137 All rights reserved.
138
139 Redistribution and use in source and binary forms, with or without
140 modification, are permitted provided that the following conditions are
141 met:
142
143 1. Redistributions of source code must retain the above copyright
144 notice, this list of conditions and the following disclaimer.
145
146 2. Redistributions in binary form must reproduce the above copyright
147 notice, this list of conditions and the following disclaimer in the
148 documentation and/or other materials provided with the distribution.
149
150 3. Neither the name of Plantronics nor the names of its contributors
151 may be used to endorse or promote products derived from this
152 software without specific prior written permission.
153
154 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
155 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
156 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
157 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
158 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
159 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
160 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
161 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
162 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
163 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
164 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
165
166 ==================================================================== */
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
bool operator==(const SdpCandidateExtensionAttribute &rhs) const
SdpCandidateExtensionAttribute(const char *name, const char *value)
SdpCandidateExtensionAttribute(const SdpCandidateExtensionAttribute &rhs)
SdpCandidateType getCandidateType() const
const resip::Data & getConnectionAddress() const
const resip::Data & getRelatedAddress() const
void setFoundation(const char *foundation)
void setRelatedPort(unsigned int relatedPort)
unsigned int getId() const
void setCandidateType(SdpCandidateType candidateType)
unsigned int getRelatedPort() const
const SdpCandidateExtensionAttributeList & getExtensionAttributes() const
void setTransport(SdpCandidateTransportType transport)
void setPort(unsigned int port)
SdpCandidate & operator=(const SdpCandidate &rhs)
void addExtensionAttribute(const char *name, const char *value)
void setPriority(uint64_t priority)
static SdpCandidateType getCandidateTypeFromString(const char *type)
const resip::Data & getFoundation() const
static const char * SdpCandidateTypeString[]
void setRelatedAddress(const char *relatedAddress)
void setId(unsigned int id)
bool operator<(const SdpCandidate &rhs) const
std::list< SdpCandidateExtensionAttribute > SdpCandidateExtensionAttributeList
unsigned int getPort() const
static SdpCandidateTransportType getCandidateTransportTypeFromString(const char *type)
friend EncodeStream & operator<<(EncodeStream &strm, const SdpCandidate &)
static const char * SdpCandidateTransportTypeString[]
bool operator!=(const SdpCandidate &rhs) const
bool operator==(const SdpCandidate &rhs) const
void setConnectionAddress(const char *connectionAddress)
void addExtensionAttribute(const SdpCandidateExtensionAttribute &sdpCandidateExtensionAttribute)
SdpCandidateTransportType getTransport() const
void toString(resip::Data &sdpCandidateString) const
This file is used to handle compatibility fixes/tweaks so reSIProcate can function on multiple platfo...
EncodeStream & operator<<(EncodeStream &strm, const Sdp &)
Definition Sdp.cxx:304
#define EncodeStream
unsigned __int64 uint64_t
Definition stdint.h:95
void list()
Definition userAdmin.cxx:66