reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
SdpContents.hxx
Go to the documentation of this file.
1#if !defined(RESIP_SDPCONTENTS_HXX)
2#define RESIP_SDPCONTENTS_HXX
3
4#include <functional>
5#include <vector>
6#include <list>
7#include <iosfwd>
8#include <map>
9#include <memory>
10
12#include "resip/stack/Uri.hxx"
13#include "rutil/Data.hxx"
14#include "rutil/HashMap.hxx"
16
17namespace resip
18{
19
20class SdpContents;
21
22class TrickleIceContents;
23
25{
26 public:
29 static constexpr size_t MaxParsedAttributeNames = 256;
30
34
35 bool exists(const Data& key) const;
36 const std::list<Data>& getValues(const Data& key) const;
38 void parse(ParseBuffer& pb);
39 void addAttribute(const Data& key, const Data& value = Data::Empty);
40 void clearAttribute(const Data& key);
41 private:
42 std::list<std::pair<Data, Data> > mAttributeList; // used to ensure attribute ordering on encode
43 // Attribute names come from the remote party's SDP. With a plain HashMap a sender
44 // could pick names that all hash alike, so that parsing one large body takes
45 // quadratic time; the keyed hash prevents that (see KeyedDataHash).
46 HashMap< Data, std::list<Data>, KeyedDataHash > mAttributes;
47};
48
58class SdpContents : public Contents
59{
60 public:
62 typedef enum {IP4=1, IP6} AddrType;
63 static const SdpContents Empty;
64
65 class Session;
66
71 class Session
72 {
73 public:
74 class Medium;
75
79 class Codec
80 {
81 public:
82 Codec() : mName(), mRate(0), mPayloadType(-1) {}
83
94 Codec(const Data& name, unsigned long rate, const Data& parameters = Data::Empty, const Data& encodingParameters = Data::Empty);
95
105 Codec(const Data& name, int payloadType, int rate=8000);
106 Codec(const Codec& rhs);
107 Codec& operator=(const Codec& codec);
108
109 void parse(ParseBuffer& pb,
110 const SdpContents::Session::Medium& medium,
111 int payLoadType);
113
117 const Data& getName() const;
121 int getRate() const;
122
126 int payloadType() const {return mPayloadType;}
130 int& payloadType() {return mPayloadType;}
131
135 const Data& parameters() const {return mParameters;}
139 Data& parameters() {return mParameters;}
140
144 const Data& encodingParameters() const {return mEncodingParameters;}
148 Data& encodingParameters() {return mEncodingParameters;}
149
150 static const Codec ULaw_8000;
151 static const Codec GSM_8000;
152 static const Codec G723_8000;
153 static const Codec ALaw_8000;
154 static const Codec G722_8000;
155 static const Codec CN;
156 static const Codec G729_8000;
157 static const Codec H263;
158
159 static const Codec TelephoneEvent;
160 static const Codec FrfDialedDigit;
161
162 typedef HashMap<int, Codec> CodecMap;
163 // "static" payload types as defined in RFC 3551.
164 // Maps payload type (number) to Codec definition.
165 static CodecMap& getStaticCodecs();
166
167 friend bool operator==(const Codec&, const Codec&);
168
169 private:
170 Data mName;
171 unsigned long mRate;
172 int mPayloadType;
173 Data mParameters; // Format parameters
174 Data mEncodingParameters;
175
176 static std::unique_ptr<CodecMap> sStaticCodecs;
177 static bool sStaticCodecsCreated;
179 };
180
183 class Origin
184 {
185 public:
195 Origin(const Data& user,
196 const uint64_t& sessionId,
197 const uint64_t& version,
198 AddrType addr,
199 const Data& address);
200 Origin(const Origin& rhs);
201 Origin& operator=(const Origin& rhs);
202
203 void parse(ParseBuffer& pb);
205
209 const uint64_t& getSessionId() const {return mSessionId;}
213 uint64_t& getSessionId() { return mSessionId; }
214
218 const uint64_t& getVersion() const {return mVersion;}
222 uint64_t& getVersion() { return mVersion; }
226 const Data& user() const {return mUser;}
230 Data& user() {return mUser;}
231
236 AddrType getAddressType() const {return mAddrType;}
241 const Data& getAddress() const {return mAddress;}
242
248 void setAddress(const Data& host, AddrType type = IP4);
249
250 private:
251 Origin();
252
253 Data mUser;
254 uint64_t mSessionId;
255 uint64_t mVersion;
256 AddrType mAddrType;
257 Data mAddress;
258
259 friend class Session;
260 };
261
265 class Email
266 {
267 public:
274 Email(const Data& address,
275 const Data& freeText);
276
277 Email(const Email& rhs);
278 Email& operator=(const Email& rhs);
279
280 void parse(ParseBuffer& pb);
282
287 const Data& getAddress() const {return mAddress;}
292 const Data& getFreeText() const {return mFreeText;}
293
294 private:
295 Email() {}
296
297 Data mAddress;
298 Data mFreeText;
299
300 friend class Session;
301 };
302
306 class Phone
307 {
308 public:
315 Phone(const Data& number,
316 const Data& freeText);
317 Phone(const Phone& rhs);
318 Phone& operator=(const Phone& rhs);
319
320 void parse(ParseBuffer& pb);
322
323
328 const Data& getNumber() const {return mNumber;}
333 const Data& getFreeText() const {return mFreeText;}
334
335 private:
336 Phone() {}
337
338 Data mNumber;
339 Data mFreeText;
340
341 friend class Session;
342 };
343
350 {
351 public:
359 Connection(AddrType addType,
360 const Data& address,
361 unsigned long ttl = 0);
362 Connection(const Connection& rhs);
363 Connection& operator=(const Connection& rhs);
364
365 void parse(ParseBuffer& pb);
367
372 AddrType getAddressType() const {return mAddrType;}
373
378 const Data& getAddress() const {return mAddress;}
379
385 void setAddress(const Data& host, AddrType type = IP4);
386 unsigned long ttl() const {return mTTL;}
387 unsigned long& ttl() {return mTTL;}
388
389 private:
390 Connection();
391
392 AddrType mAddrType;
393 Data mAddress;
394 unsigned long mTTL;
395
396 friend class Session;
397 friend class Medium;
398 };
399
404 {
405 public:
412 Bandwidth(const Data& modifier,
413 unsigned long kbPerSecond);
414 Bandwidth(const Bandwidth& rhs);
415 Bandwidth& operator=(const Bandwidth& rhs);
416
417 void parse(ParseBuffer& pb);
419
424 const Data& modifier() const {return mModifier;}
429 Data modifier() {return mModifier;}
434 unsigned long kbPerSecond() const {return mKbPerSecond;}
439 unsigned long& kbPerSecond() {return mKbPerSecond;}
440
441 private:
442 Bandwidth() {}
443 Data mModifier;
444 unsigned long mKbPerSecond;
445
446 friend class Session;
447 friend class Medium;
448 };
449
453 class Time
454 {
455 public:
465 Time(unsigned long start,
466 unsigned long stop);
467 Time(const Time& rhs);
468 Time& operator=(const Time& rhs);
469
470 void parse(ParseBuffer& pb);
472
476 class Repeat
477 {
478 public:
479 Repeat(unsigned long interval,
480 unsigned long duration,
481 std::list<int> offsets);
482 void parse(ParseBuffer& pb);
484
485 unsigned long getInterval() const {return mInterval;}
486 unsigned long getDuration() const {return mDuration;}
487 const std::list<int> getOffsets() const {return mOffsets;}
488
489 private:
490 Repeat() {}
491 unsigned long mInterval;
492 unsigned long mDuration;
493 std::list<int> mOffsets;
494
495 friend class Time;
496 };
497
498 void addRepeat(const Repeat& repeat);
499
504 unsigned long getStart() const {return mStart;}
509 unsigned long getStop() const {return mStop;}
510 const std::list<Repeat>& getRepeats() const {return mRepeats;}
511
512 private:
513 Time() {}
514 unsigned long mStart;
515 unsigned long mStop;
516 std::list<Repeat> mRepeats;
517
518 friend class Session;
519 };
520
527 {
528 public:
533 {
534 public:
535 Adjustment(unsigned long time,
536 int offset);
537 Adjustment(const Adjustment& rhs);
538 Adjustment& operator=(const Adjustment& rhs);
539
540 unsigned long time;
542 };
543
544 Timezones();
545 Timezones(const Timezones& rhs);
546 Timezones& operator=(const Timezones& rhs);
547
548 void parse(ParseBuffer& pb);
550
551 void addAdjustment(const Adjustment& adjusment);
552 const std::list<Adjustment>& getAdjustments() const {return mAdjustments; }
553 private:
554 std::list<Adjustment> mAdjustments;
555 };
556
561 {
562 public:
565 const Data& key);
566 Encryption(const Encryption& rhs);
567 Encryption& operator=(const Encryption& rhs);
568
569
570 void parse(ParseBuffer& pb);
572
573 const KeyType& getMethod() const {return mMethod;}
574 const KeyType& method() const {return mMethod;}
575 KeyType& method() {return mMethod;}
576 const Data& getKey() const {return mKey;}
577 const Data& key() const {return mKey;}
578 Data& key() {return mKey;}
579
580 Encryption();
581 private:
582 KeyType mMethod;
583 Data mKey;
584 };
585
586 class Direction;
587 typedef std::vector<std::reference_wrapper<const SdpContents::Session::Direction>> DirectionList;
588
590 {
591 public:
592 static const Direction INACTIVE;
593 static const Direction SENDONLY;
594 static const Direction RECVONLY;
595 static const Direction SENDRECV;
596
597 const std::reference_wrapper<const Direction> cref;
598
599 const Data& name() const { return mName; }
600 typedef std::pair<Data, std::reference_wrapper<const SdpContents::Session::Direction>> Tuple;
601 const Tuple tuple() const
602 {
603 return Tuple(name(), cref);
604 }
605
606 static bool valid(const Data& name) { return directions.find(name) != directions.end(); }
607 static const Direction& get(const Data& name) { return directions.find(name)->second; }
608
609 bool send() const { return mSend; }
610 bool recv() const { return mRecv; }
611
615
616 bool operator==(const Direction& d) const { return &d == this || d.mName == mName; }
617 bool operator<(const Direction& d) const { return mName < d.mName; }
618
619 private:
620 Direction(const Data& name, bool send, bool recv)
621 : cref(std::ref(*this)), mName(name), mSend(send), mRecv(recv) {};
622 Direction(const Direction& d) = delete;
623 void operator=(const Direction& d) = delete;
624
625 Data mName;
626 bool mSend;
627 bool mRecv;
628
629 static const std::map<Tuple::first_type, Tuple::second_type> directions;
630 };
631
635 class Medium
636 {
637 public:
638 Medium();
639 Medium(const Medium& rhs);
650 Medium(const Data& name,
651 unsigned long port,
652 unsigned long multicast,
653 const Data& protocol);
654 Medium& operator=(const Medium& rhs);
655
656 void parse(ParseBuffer& pb);
658
666 void addFormat(const Data& format);
677 void setBandwidth(const Bandwidth& bandwidth);
678 void addBandwidth(const Bandwidth& bandwidth);
685 void addAttribute(const Data& key, const Data& value = Data::Empty);
686
691 const Data& name() const {return mName;}
696 Data& name() {return mName;}
701 int port() const {return mPort;}
706 unsigned long& port() {return mPort;}
712 void setPort(int port);
719 int firstRtcpPort() const
720 {
721 return exists("rtcp") ? getValues("rtcp").front().convertInt() : port()+1;
722 }
727 int multicast() const {return mMulticast;}
732 unsigned long& multicast() {return mMulticast;}
737 const Data& protocol() const {return mProtocol;}
742 Data& protocol() {return mProtocol;}
743
744 // preferred codec/format interface
745 typedef std::list<Codec> CodecContainer;
752 const CodecContainer& codecs() const;
754
756 void clearCodecs();
762 void addCodec(const Codec& codec);
763
772 const std::list<Data>& getFormats() const {return mFormats;}
773
778 const Data& information() const {return mInformation;}
783 Data& information() {return mInformation;}
788 const std::list<Bandwidth>& bandwidths() const {return mBandwidths;}
789 std::list<Bandwidth>& bandwidths() {return mBandwidths;}
790
797 const std::list<Connection> getConnections() const;
802 const std::list<Connection>& getMediumConnections() const {return mConnections;}
803 std::list<Connection>& getMediumConnections() {return mConnections;}
804 const Encryption& getEncryption() const {return mEncryption;}
805 const Encryption& encryption() const {return mEncryption;}
806 Encryption& encryption() {return mEncryption;}
813 bool exists(const Data& key) const;
821 const std::list<Data>& getValues(const Data& key) const;
830 std::list<Data> getMergedValues(const Data& key) const;
836 void clearAttribute(const Data& key);
837
838 // Search through this mediums codecs to find and return the first match from the passed in list
839 // Note: The codecList item that matched the codec from the medium is passed back via pMatchingCodec
840 // if a non-NULL pointer is passed in. The codec returned if from this medium.
841 const Codec& findFirstMatchingCodecs(const CodecContainer& codecs, Codec* pMatchingCodec = 0) const;
842 // Search through this mediums codecs to find and return the first match from the passed in medium
843 // Note: The passed in medium's codec that matched the codec from this medium is passed back
844 // via pMatchingCodec if a non-NULL pointer is passed in. The codec returned if from this medium.
845 const Codec& findFirstMatchingCodecs(const Medium& medium, Codec* pMatchingCodec = 0) const;
846
852
858
859 const Direction& getDirection() const;
860 const Direction& getDirection(const Direction& sessionDefault) const;
861
862 private:
863 void setSession(Session* session);
864 Session* mSession;
865
866 Data mName;
867 unsigned long mPort;
868 unsigned long mMulticast;
869 Data mProtocol;
870 std::list<Data> mFormats;
871 CodecContainer mCodecs;
872 Data mTransport;
873 Data mInformation;
874 std::list<Connection> mConnections;
875 std::list<Bandwidth> mBandwidths;
876 Encryption mEncryption;
877 AttributeHelper mAttributeHelper;
878
879 bool mRtpMapDone;
880 typedef HashMap<int, Codec> RtpMap;
881 RtpMap mRtpMap;
882
883 friend class Session;
884 };
885
895 Session(int version,
896 const Origin& origin,
897 const Data& name);
898
899 Session() : mVersion(0) {}
900 Session(const Session& rhs);
901 Session& operator=(const Session& rhs);
902
903 void parse(ParseBuffer& pb);
905
910 int version() const {return mVersion;}
915 int& version() {return mVersion;}
920 const Origin& origin() const {return mOrigin;}
925 Origin& origin() {return mOrigin;}
930 const Data& name() const {return mName;}
935 Data& name() {return mName;}
940 const Data& information() const {return mInformation;}
945 Data& information() {return mInformation;}
950 const Uri& uri() const {return mUri;}
955 Uri& uri() {return mUri;}
960 const std::list<Email>& getEmails() const {return mEmails;}
965 const std::list<Phone>& getPhones() const {return mPhones;}
970 const Connection& connection() const {return mConnection;}
975 Connection& connection() {return mConnection;} // !dlb! optional?
980 bool isConnection() const { return mConnection.mAddress != Data::Empty; }
985 const std::list<Bandwidth>& bandwidths() const {return mBandwidths;}
990 std::list<Bandwidth>& bandwidths() {return mBandwidths;}
995 const std::list<Time>& getTimes() const {return mTimes;}
1000 std::list<Time>& getTimes() {return mTimes;}
1001 const Timezones& getTimezones() const {return mTimezones;}
1002 const Encryption& getEncryption() const {return mEncryption;}
1003 const Encryption& encryption() const {return mEncryption;}
1004 Encryption& encryption() {return mEncryption;}
1005 typedef std::list<Medium> MediumContainer;
1010 const MediumContainer& media() const {return mMedia;}
1015 MediumContainer& media() {return mMedia;}
1020 std::list<std::reference_wrapper<Medium>> getMediaByType(const Data& type);
1021
1027 void addEmail(const Email& email);
1033 void addPhone(const Phone& phone);
1039 void addBandwidth(const Bandwidth& bandwidth);
1045 void addTime(const Time& t);
1051 void addMedium(const Medium& medium);
1055 void clearMedium() { mMedia.clear(); }
1061 void clearAttribute(const Data& key);
1068 void addAttribute(const Data& key, const Data& value = Data::Empty);
1075 bool exists(const Data& key) const;
1082 const std::list<Data>& getValues(const Data& key) const;
1083
1084 const Direction& getDirection() const;
1090 const Direction& getDirection(const std::set<Data> types,
1091 const std::set<Data> protocolTypes) const;
1092
1099 std::set<Data> getMediaStreamLabels() const;
1104 bool isWebRTC() const;
1105
1109 bool isTrickleIceSupported() const;
1118 void transformCOMedia(const Data& setupDirection = "active", const Data& cOMediaAttribute = "setup");
1124 void transformLocalHold(bool holding);
1129 const Medium* getMediumByMid(const Data& mid) const;
1136 std::shared_ptr<TrickleIceContents> makeIceFragment(const Data& fragment,
1137 unsigned int lineIndex, const Data& mid);
1138
1139 private:
1140 int mVersion;
1141 Origin mOrigin;
1142 Data mName;
1143 MediumContainer mMedia;
1144
1145 // applies to all Media where unspecified
1146 Data mInformation;
1147 Uri mUri;
1148 std::list<Email> mEmails;
1149 std::list<Phone> mPhones;
1150 Connection mConnection;
1151 std::list<Bandwidth> mBandwidths;
1152 std::list<Time> mTimes;
1153 Timezones mTimezones;
1154 Encryption mEncryption;
1155 AttributeHelper mAttributeHelper;
1156
1157 friend class SdpContents;
1158 };
1159
1160 SdpContents();
1161 SdpContents(const HeaderFieldValue& hfv, const Mime& contentTypes);
1162 virtual ~SdpContents();
1163
1164 // !nash! there is no need for overriding copy ctor as every members gets copied
1165 //SdpContents(const SdpContents& rhs);
1167
1172 virtual Contents* clone() const;
1173
1178 Session& session() {checkParsed(); return mSession;}
1179 const Session& session() const {checkParsed(); return mSession;}
1180
1181 virtual EncodeStream& encodeParsed(EncodeStream& str) const;
1182 virtual void parse(ParseBuffer& pb);
1183 static const Mime& getStaticType() ;
1184
1185 static bool init();
1186
1187 private:
1188 SdpContents(const Data& data, const Mime& contentTypes);
1189 Session mSession;
1190};
1191
1193
1194// Silence compiler warning for invokeSdpContentsInit defined, but not used
1195static inline void foo(){if(0){(void) invokeSdpContentsInit;}};
1196
1198
1203
1205
1206void skipEol(ParseBuffer& pb);
1207
1208}
1209
1210#endif
1211
1212/* ====================================================================
1213 * The Vovida Software License, Version 1.0
1214 *
1215 * Copyright (c) 2026, SIP Spectrum, Inc. https://www.sipspectrum.com
1216 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
1217 *
1218 * Redistribution and use in source and binary forms, with or without
1219 * modification, are permitted provided that the following conditions
1220 * are met:
1221 *
1222 * 1. Redistributions of source code must retain the above copyright
1223 * notice, this list of conditions and the following disclaimer.
1224 *
1225 * 2. Redistributions in binary form must reproduce the above copyright
1226 * notice, this list of conditions and the following disclaimer in
1227 * the documentation and/or other materials provided with the
1228 * distribution.
1229 *
1230 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
1231 * and "Vovida Open Communication Application Library (VOCAL)" must
1232 * not be used to endorse or promote products derived from this
1233 * software without prior written permission. For written
1234 * permission, please contact vocal@vovida.org.
1235 *
1236 * 4. Products derived from this software may not be called "VOCAL", nor
1237 * may "VOCAL" appear in their name, without prior written
1238 * permission of Vovida Networks, Inc.
1239 *
1240 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
1241 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1242 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
1243 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
1244 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
1245 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
1246 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
1247 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
1248 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
1249 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1250 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
1251 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
1252 * DAMAGE.
1253 *
1254 * ====================================================================
1255 *
1256 * This software consists of voluntary contributions made by Vovida
1257 * Networks, Inc. and many individuals on behalf of Vovida Networks,
1258 * Inc. For more information on Vovida Networks, Inc., please see
1259 * <http://www.vovida.org/>.
1260 *
1261 */
Wraps your platform's implementation of hash_map, hash_multimap, and hash_set.
static const struct nv types[]
Definition adig.c:80
static constexpr size_t MaxParsedAttributeNames
parse() fails a section with more distinct attribute names than this
RESIP_HeapCount(AttributeHelper)
void clearAttribute(const Data &key)
const std::list< Data > & getValues(const Data &key) const
EncodeStream & encode(EncodeStream &s) const
AttributeHelper & operator=(const AttributeHelper &rhs)
void addAttribute(const Data &key, const Data &value=Data::Empty)
bool exists(const Data &key) const
void parse(ParseBuffer &pb)
Connection implements, via sockets, ConnectionBase for managed connections.
Base class for all SIP body types.
Definition Contents.hxx:51
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
static const Data Empty
Constant that represents a zero-length data.
Definition Data.hxx:882
void checkParsed() const
Represents the "media-type" element in the RFC 3261 grammar.
Definition Mime.hxx:20
Provides string-parsing functionality with protection from buffer overflow.
Process optional b= (bandwidth) lines in SDP.
Bandwidth & operator=(const Bandwidth &rhs)
Data modifier()
returns the modifier string
unsigned long kbPerSecond() const
returns the number of kilobits/second maximum bandwidth
unsigned long & kbPerSecond()
returns the number of kilobits/second maximum bandwidth
EncodeStream & encode(EncodeStream &) const
const Data & modifier() const
returns the modifier string
parameters for a specific codec are stored in this class.
const Data & encodingParameters() const
returns the encoding parameters associated with this codec
Codec & operator=(const Codec &codec)
void assignFormatParameters(const SdpContents::Session::Medium &medium)
const Data & parameters() const
returns the parameters associated with this codec
int & payloadType()
returns the RTP payload type associated with this codec.
friend EncodeStream & operator<<(EncodeStream &, const Codec &)
void parse(ParseBuffer &pb, const SdpContents::Session::Medium &medium, int payLoadType)
const Data & getName() const
returns the name of the codec.
Data & parameters()
returns the parameters associated with this codec
Data & encodingParameters()
returns the encoding parameters associated with this codec
int payloadType() const
returns the RTP payload type associated with this codec.
friend bool operator==(const Codec &, const Codec &)
int getRate() const
returns the name of the codec.
Process c= (connection) lines in SDP.
const Data & getAddress() const
returns the connection address
void setAddress(const Data &host, AddrType type=IP4)
set the address for the connection
EncodeStream & encode(EncodeStream &) const
Connection & operator=(const Connection &rhs)
AddrType getAddressType() const
returns the connection address type
bool operator==(const Direction &d) const
static bool valid(const Data &name)
const std::reference_wrapper< const Direction > cref
bool operator<(const Direction &d) const
static const Direction & get(const Data &name)
std::pair< Data, std::reference_wrapper< const SdpContents::Session::Direction > > Tuple
process e= (email) lines in the SDP
const Data & getFreeText() const
returns the string describing the email address
EncodeStream & encode(EncodeStream &) const
Email & operator=(const Email &rhs)
const Data & getAddress() const
returns the email address
process k= (encryption key) line
EncodeStream & encode(EncodeStream &) const
Encryption & operator=(const Encryption &rhs)
process m= (media announcement) blocks
const Codec & findTelephoneEventPayloadCodec() const
finds the telephone-event codec
Medium & operator=(const Medium &rhs)
const std::list< Connection > getConnections() const
get a list of Connection objects, including the Session's c= line.
unsigned long & multicast()
get the number of transport port pairs
const std::list< Connection > & getMediumConnections() const
get a list of Connection objects from the m= section.
const Codec & findFirstMatchingCodecs(const CodecContainer &codecs, Codec *pMatchingCodec=0) const
void addBandwidth(const Bandwidth &bandwidth)
void setConnection(const Connection &connection)
set the media connection line.
int firstRtcpPort() const
get the value of the first specified RTCP port or if no rtcp: attribute found, the default port() val...
void addAttribute(const Data &key, const Data &value=Data::Empty)
add a media attribute line
const std::list< Data > & getValues(const Data &key) const
get the attribute values corresponding to the key - returns the attributes set on this medium,...
EncodeStream & encode(EncodeStream &) const
bool exists(const Data &key) const
tests if an a= key is present in the media section
void addConnection(const Connection &connection)
add a media connection line.
void setBandwidth(const Bandwidth &bandwidth)
const Encryption & encryption() const
int port() const
return the base port
const std::list< Data > & getFormats() const
return a list of codec formats
void addCodec(const Codec &codec)
add a codec to the m= line
std::list< Connection > & getMediumConnections()
void addFormat(const Data &format)
add a format identifier to the m= line
unsigned long & port()
return the base port
void setPort(int port)
change the base port
std::list< Data > getMergedValues(const Data &key) const
get the attribute values corresponding to the key - returns both the attributes set on this medium,...
const CodecContainer & codecs() const
preferred codec/format interface
const Encryption & getEncryption() const
const std::list< Bandwidth > & bandwidths() const
get a list of bandwidth lines
Data & name()
return the media type
void clearCodecs()
remove all codecs from SDP
Data & protocol()
return the transport protocol
int multicast() const
get the number of transport port pairs
const Data & information() const
get optional i= (information) line contents
const Direction & getDirection() const
std::list< Bandwidth > & bandwidths()
const Data & protocol() const
return the transport protocol
const Data & name() const
return the media type
int findTelephoneEventPayloadType() const
finds the telephone-event payload type
void clearAttribute(const Data &key)
erase all attributes for a given key
Data & information()
get optional i= (information) line contents
processes o= lines in SDP
EncodeStream & encode(EncodeStream &) const
void setAddress(const Data &host, AddrType type=IP4)
set the address for the session
const uint64_t & getVersion() const
returns the session version
uint64_t & getSessionId()
returns the session ID
const Data & getAddress() const
returns the session address type
const uint64_t & getSessionId() const
returns the session ID
uint64_t & getVersion()
returns the session version
const Data & user() const
returns the user string for the session
Data & user()
returns the user string for the session
AddrType getAddressType() const
returns the session address type
Origin & operator=(const Origin &rhs)
process p= (phone number) lines in the SDP
const Data & getNumber() const
return the phone number
const Data & getFreeText() const
return text string describing the phone number
EncodeStream & encode(EncodeStream &) const
Phone & operator=(const Phone &rhs)
const std::list< int > getOffsets() const
EncodeStream & encode(EncodeStream &) const
Process t= (start/stop time) lines in SDP.
const std::list< Repeat > & getRepeats() const
unsigned long getStart() const
return the start time
Time & operator=(const Time &rhs)
unsigned long getStop() const
return the stop time
void addRepeat(const Repeat &repeat)
EncodeStream & encode(EncodeStream &) const
specify the time at which a timezone shift will occur and the offset, in seconds
Adjustment & operator=(const Adjustment &rhs)
process z= (timezone) lines
void addAdjustment(const Adjustment &adjusment)
EncodeStream & encode(EncodeStream &) const
Timezones & operator=(const Timezones &rhs)
const std::list< Adjustment > & getAdjustments() const
Provides an interface to read and modify SDP bodies.
const std::list< Bandwidth > & bandwidths() const
return session Bandwidth lines
const std::list< Time > & getTimes() const
return session Time lines
void addMedium(const Medium &medium)
add an m= (Medium) section to session
Origin & origin()
return session Origin line
void addPhone(const Phone &phone)
add a p= (phone number) line to session
void addTime(const Time &t)
add a t= (Time) line to session
std::list< Medium > MediumContainer
const Timezones & getTimezones() const
Data & name()
return session name
std::shared_ptr< TrickleIceContents > makeIceFragment(const Data &fragment, unsigned int lineIndex, const Data &mid)
based on the original SDP in this instances of SdpContents, find the relevant ICE and m= line(s),...
const std::list< Phone > & getPhones() const
return session Phone number list
const Data & information() const
return session Information
std::list< std::reference_wrapper< Medium > > getMediaByType(const Data &type)
return session Media lines filtered by type
const Direction & getDirection() const
const std::list< Email > & getEmails() const
return session Email list
int version() const
return session version
std::list< Time > & getTimes()
return session Time lines
void parse(ParseBuffer &pb)
int & version()
return session version
const Encryption & getEncryption() const
DirectionList getNetDirections(const SdpContents &remote) const
const Origin & origin() const
return session Origin line
Session & operator=(const Session &rhs)
const std::list< Data > & getValues(const Data &key) const
get the attribute values corresponding to the key
std::vector< std::reference_wrapper< const SdpContents::Session::Direction > > DirectionList
const Data & name() const
return session name
bool isConnection() const
check if a c= line is present for the session
bool isWebRTC() const
determine if the SDP appears to conform to WebRTC
Uri & uri()
return session Uri
Connection & connection()
return session Connection
void addBandwidth(const Bandwidth &bandwidth)
add a b= (Bandwidth) line to session
MediumContainer & media()
return session Media lines
std::set< Data > getMediaStreamLabels() const
retrieve label (RFC 4574) attributes in a set
void transformLocalHold(bool holding)
change the direction attributes as if the peer who created the SDP is on hold or not
const Connection & connection() const
return session Connection
const Medium * getMediumByMid(const Data &mid) const
find the Medium with given mid value
EncodeStream & encode(EncodeStream &) const
void clearAttribute(const Data &key)
erase all attributes for a given key
void addEmail(const Email &email)
add an e= (email) line to session
bool exists(const Data &key) const
tests if an a= key is present in the session
bool isTrickleIceSupported() const
determine if ice-options:trickle is present
const Encryption & encryption() const
const MediumContainer & media() const
return session Media lines
Data & information()
return session Information
void clearMedium()
remove all Medium sections from session
DirectionList getDirections() const
void transformCOMedia(const Data &setupDirection="active", const Data &cOMediaAttribute="setup")
apply RFC 4145 COMEDIA transform
const Uri & uri() const
return session Uri
void addAttribute(const Data &key, const Data &value=Data::Empty)
add a session attribute line
std::list< Bandwidth > & bandwidths()
return session Bandwidth lines
Provides an interface to process and generate SDP bodies (MIME content-type application/sdp).
const Session & session() const
virtual EncodeStream & encodeParsed(EncodeStream &str) const
static bool init()
virtual void parse(ParseBuffer &pb)
static const SdpContents Empty
virtual Contents * clone() const
duplicate an SdpContents object
RESIP_HeapCount(SdpContents)
static const Mime & getStaticType()
Session & session()
get the parsed SDP
SdpContents & operator=(const SdpContents &rhs)
Represents the "SIP-URI" and "SIPS-URI" elements in the RFC 3261 grammar.
Definition Uri.hxx:22
dcm! – add UnusedChecking(_enum) below;
SdpContents::Session::Codec Codec
unsigned long long uint64_t
Definition Stun.hxx:39
static bool invokeSdpContentsInit
static void foo()
void skipEol(ParseBuffer &pb)
EncodeStream & operator<<(EncodeStream &strm, const BaseException &e)
bool operator==(const char *lhs, const Data &rhs)
Definition Data.hxx:1197
bool operator!=(const Data &lhs, const Data &rhs)
Definition Data.hxx:1187
#define EncodeStream
Hasher for hash containers keyed by data received from the network, e.g.
Definition Data.hxx:1284
void list()
Definition userAdmin.cxx:66