reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
SdpMediaLine.hxx
Go to the documentation of this file.
1#if !defined(SdpMediaLine_hxx)
2#define SdpMediaLine_hxx
3
4#include "Sdp.hxx"
5#include "SdpCodec.hxx"
6#include "SdpCandidate.hxx"
8#include <set>
9
10namespace sdpcontainer
11{
12
14{
15public:
16
17 typedef enum
18 {
21 MEDIA_TYPE_AUDIO, // "audio" - RFC4566
22 MEDIA_TYPE_VIDEO, // "video" - RFC4566
23 MEDIA_TYPE_TEXT, // "text" - RFC4566
24 MEDIA_TYPE_APPLICATION, // "application" - RFC4566
25 MEDIA_TYPE_MESSAGE // "message" - RFC4566
27 static const char* SdpMediaTypeString[];
28
58 typedef enum
59 {
62 PROTOCOL_TYPE_UDP, // "udp" - RFC 4566
63 PROTOCOL_TYPE_RTP_AVP, // "RTP/AVP" - RFC 3551, RFC 4566
64 PROTOCOL_TYPE_RTP_AVPF, // "RTP/AVPF" - RFC4585
65 PROTOCOL_TYPE_RTP_SAVP, // "RTP/SAVP" - RFC 3711
66 PROTOCOL_TYPE_RTP_SAVPF, // "RTP/SAVPF" - RFC 5124
67 PROTOCOL_TYPE_TCP, // "TCP" - RFC 4145
68 PROTOCOL_TYPE_TCP_RTP_AVP, // "TCP/RTP/AVP" - RFC 4571
69 PROTOCOL_TYPE_TCP_TLS, // "TCP/TLS" - RFC 4572
70 PROTOCOL_TYPE_UDP_TLS, // "UDP/TLS" - RFC 5764
71 PROTOCOL_TYPE_DCCP_TLS, // "DCCP/TLS" - RFC 5764
72 PROTOCOL_TYPE_DCCP_TLS_RTP_SAVP, // "DCCP/TLS/RTP/SAVP" - RFC 5764
73 PROTOCOL_TYPE_UDP_TLS_RTP_SAVP, // "UDP/TLS/RTP/SAVP" - RFC 5764, RFC 7345
74 PROTOCOL_TYPE_UDP_TLS_RTP_SAVPF, // "UDP/TLS/RTP/SAVPF" - RFC 5764, RFC 7345
75 PROTOCOL_TYPE_TCP_TLS_RTP_SAVP // "TCP/TLS/RTP/SAVP" - RFC 5764
77 static const char* SdpTransportProtocolTypeString[];
78
80 {
81 public:
84 const char * address = 0,
85 unsigned int port = 0,
86 unsigned int multicastIpV4Ttl=0) :
87 mNetType(netType), mAddressType(addressType), mAddress(address), mPort(port), mMulticastIpV4Ttl(multicastIpV4Ttl) {}
89 mNetType(rhs.mNetType), mAddressType(rhs.mAddressType), mAddress(rhs.mAddress), mPort(rhs.mPort), mMulticastIpV4Ttl(rhs.mMulticastIpV4Ttl) {}
90
92 Sdp::SdpNetType getNetType() const { return mNetType; }
93
95 Sdp::SdpAddressType getAddressType() const { return mAddressType; }
96
97 void setAddress(const char * address) { mAddress = address; }
98 const resip::Data& getAddress() const { return mAddress; }
99
100 void setPort(unsigned int port) { mPort = port; }
101 unsigned int getPort() const { return mPort; }
102
103 void setMulticastIpV4Ttl(unsigned int multicastIpV4Ttl) { mMulticastIpV4Ttl = multicastIpV4Ttl; }
104 unsigned int getMulticastIpV4Ttl() const { return mMulticastIpV4Ttl; }
105
106 private:
107 Sdp::SdpNetType mNetType;
108 Sdp::SdpAddressType mAddressType;
109 resip::Data mAddress;
110 unsigned int mPort;
111 unsigned int mMulticastIpV4Ttl;
112 };
113
114 typedef enum
115 {
117 ENCRYPTION_METHOD_CLEAR, // "clear" - RFC4566
118 ENCRYPTION_METHOD_BASE64, // "base64" - RFC4566
119 ENCRYPTION_METHOD_URI, // "uri" - RFC4566
120 ENCRYPTION_METHOD_PROMPT // "prompt" - RFC4566
122 static const char* SdpEncryptionMethodString[];
123
124 typedef enum
125 {
127 DIRECTION_TYPE_SENDRECV, // "sendrecv" - RFC4566
128 DIRECTION_TYPE_SENDONLY, // "sendonly" - RFC4566
129 DIRECTION_TYPE_RECVONLY, // "recvonly" - RFC4566
130 DIRECTION_TYPE_INACTIVE // "inactive" - RFC4566
132 static const char* SdpDirectionTypeString[];
133
134 typedef enum
135 {
137 ORIENTATION_TYPE_PORTRAIT, // "portrait" - RFC 4566
138 ORIENTATION_TYPE_LANDSCAPE,// "landscape" - RFC 4566
139 ORIENTATION_TYPE_SEASCAPE // "seascape" - RFC 4566
141 static const char* SdpOrientationTypeString[];
142
143 typedef enum
144 {
146 TCP_SETUP_ATTRIBUTE_ACTIVE, // "active" - RFC4145
147 TCP_SETUP_ATTRIBUTE_PASSIVE, // "passive" - RFC4145
148 TCP_SETUP_ATTRIBUTE_ACTPASS, // "actpass" - RFC4145
149 TCP_SETUP_ATTRIBUTE_HOLDCONN // "holdconn" - RFC4145
151 static const char* SdpTcpSetupAttributeString[];
152
160
174 static const char* SdpCryptoSuiteTypeString[];
175
176 typedef enum
177 {
179 CRYPTO_KEY_METHOD_INLINE // "inline" - RFC4568
181 static const char* SdpCryptoKeyMethodString[];
182
190
192 {
193 public:
195 {
196 public:
198 mKeyMethod(keyMethod), mKeyValue(keyValue), mSrtpLifetime(srtpLifetime), mSrtpMkiValue(srtpMkiValue), mSrtpMkiLength(srtpMkiLength) {}
200 mKeyMethod(rhs.mKeyMethod), mKeyValue(rhs.mKeyValue), mSrtpLifetime(rhs.mSrtpLifetime), mSrtpMkiValue(rhs.mSrtpMkiValue), mSrtpMkiLength(rhs.mSrtpMkiLength) {}
201
203 SdpCryptoKeyMethod getKeyMethod() const { return mKeyMethod; }
204
205 void setKeyValue(const char * keyValue) { mKeyValue = keyValue; }
206 const resip::Data& getKeyValue() const { return mKeyValue; }
207
208 void setSrtpLifetime(unsigned int srtpLifetime) { mSrtpLifetime = srtpLifetime; }
209 unsigned int getSrtpLifetime() const { return mSrtpLifetime; }
210
211 void setSrtpMkiValue(unsigned int srtpMkiValue) { mSrtpMkiValue = srtpMkiValue; }
212 unsigned int getSrtpMkiValue() const { return mSrtpMkiValue; }
213
214 void setSrtpMkiLength(unsigned int srtpMkiLength) { mSrtpMkiLength = srtpMkiLength; }
215 unsigned int getSrtpMkiLength() const { return mSrtpMkiLength; }
216
217 private:
218 SdpCryptoKeyMethod mKeyMethod;
219 resip::Data mKeyValue; // srtp key-salt or generic key-info
220 unsigned int mSrtpLifetime;
221 unsigned int mSrtpMkiValue;
222 unsigned int mSrtpMkiLength;
223 };
224
225 SdpCrypto() : mTag(0), mSuite(SdpMediaLine::CRYPTO_SUITE_TYPE_NONE), mSrtpKdr(0), mEncryptedSrtp(1), mEncryptedSrtcp(1),
226 mAuthenticatedSrtp(1), mSrtpFecOrder(SdpMediaLine::CRYPTO_SRTP_FEC_ORDER_FEC_SRTP), mSrtpWsh(0) {}
229
230 typedef std::list<SdpCryptoKeyParam> CryptoKeyParamList;
231 typedef std::list<resip::Data> GenericSessionParamList;
232
234
235 void setTag(unsigned int tag) { mTag = tag; }
236 unsigned int getTag() const { return mTag; }
237
239 SdpCryptoSuiteType getSuite() const { return mSuite; }
240
243 void addCryptoKeyParam(const SdpCryptoKeyParam& keyParam) { mCryptoKeyParams.push_back(keyParam); }
244 void clearCryptoKeyParams() { mCryptoKeyParams.clear(); }
245 const CryptoKeyParamList& getCryptoKeyParams() const { return mCryptoKeyParams; }
246
247 void setSrtpKdr(unsigned int srtpKdr) { mSrtpKdr = srtpKdr; }
248 unsigned int getSrtpKdr() const { return mSrtpKdr; }
249
250 void setEncryptedSrtp(bool encryptedSrtp) { mEncryptedSrtp = encryptedSrtp; }
251 bool getEncryptedSrtp() const { return mEncryptedSrtp; }
252
253 void setEncryptedSrtcp(bool encryptedSrtcp) { mEncryptedSrtcp = encryptedSrtcp; }
254 bool getEncryptedSrtcp() const { return mEncryptedSrtcp; }
255
256 void setAuthenticatedSrtp(bool authenticatedSrtp) { mAuthenticatedSrtp = authenticatedSrtp; }
257 bool getAuthenticatedSrtp() const { return mAuthenticatedSrtp; }
258
260 SdpCryptoSrtpFecOrderType getSrtpFecOrder() const { return mSrtpFecOrder; }
261 static SdpCryptoSrtpFecOrderType getSrtpFecOrderFromString(const char * order);
262
263 void setSrtpFecKey(SdpCryptoKeyMethod keyMethod, const char * keyValue, unsigned int srtpLifetime=0, unsigned int srtpMkiValue=0, unsigned int srtpMkiLength=0)
264 { mSrtpFecKey.setKeyMethod(keyMethod); mSrtpFecKey.setKeyValue(keyValue); mSrtpFecKey.setSrtpLifetime(srtpLifetime);
265 mSrtpFecKey.setSrtpMkiValue(srtpMkiValue); mSrtpFecKey.setSrtpMkiLength(srtpMkiLength); }
266 const SdpCryptoKeyParam& getSrtpFecKey() const { return mSrtpFecKey; }
267
268 void setSrtpWsh(unsigned int srtpWsh) { mSrtpWsh = srtpWsh; }
269 unsigned int getSrtpWsh() const { return mSrtpWsh; }
270
271 void addGenericSessionParam(const char * sessionParam) { mGenericSessionParams.push_back(sessionParam); }
272 void clearGenericSessionParams() { mGenericSessionParams.clear(); }
273 const GenericSessionParamList& getGenericSessionParams() const { return mGenericSessionParams; }
274
275 private:
276 unsigned int mTag;
277 SdpCryptoSuiteType mSuite;
278 CryptoKeyParamList mCryptoKeyParams;
279 unsigned int mSrtpKdr;
280 bool mEncryptedSrtp;
281 bool mEncryptedSrtcp;
282 bool mAuthenticatedSrtp;
283 SdpCryptoSrtpFecOrderType mSrtpFecOrder;
284 SdpCryptoKeyParam mSrtpFecKey;
285 unsigned int mSrtpWsh;
286 GenericSessionParamList mGenericSessionParams;
287 };
288
289 typedef enum
290 {
292 FINGERPRINT_HASH_FUNC_SHA_1, // "sha-1" - RFC4572
293 FINGERPRINT_HASH_FUNC_SHA_224, // "sha-224" - RFC4572
294 FINGERPRINT_HASH_FUNC_SHA_256, // "sha-256" - RFC4572
295 FINGERPRINT_HASH_FUNC_SHA_384, // "sha-384" - RFC4572
296 FINGERPRINT_HASH_FUNC_SHA_512, // "sha-512" - RFC4572
297 FINGERPRINT_HASH_FUNC_MD5, // "md5" - RFC4572
298 FINGERPRINT_HASH_FUNC_MD2 // "md2" - RFC4572
301
308
309 typedef enum
310 {
312 PRECONDITION_TYPE_QOS // "qos" - RFC3312
314 static const char* SdpPreConditionTypeString[];
315
316 typedef enum
317 {
318 PRECONDITION_STRENGTH_MANDATORY, // "mandatory" - RFC3312
319 PRECONDITION_STRENGTH_OPTIONAL, // "optional" - RFC3312
320 PRECONDITION_STRENGTH_NONE, // "none" - RFC3312
321 PRECONDITION_STRENGTH_FAILURE, // "failure" - RFC3312
322 PRECONDITION_STRENGTH_UNKNWOWN // "unknown" - RFC3312
325
326 typedef enum
327 {
329 PRECONDITION_STATUS_E2E, // "e2e" - RFC3312
330 PRECONDITION_STATUS_LOCAL, // "local" - RFC3312
331 PRECONDITION_STATUS_REMOTE, // "remote" - RFC3312
334
335 typedef enum
336 {
337 PRECONDITION_DIRECTION_NONE, // "none" - RFC3312
338 PRECONDITION_DIRECTION_SEND, // "send" - RFC3312
339 PRECONDITION_DIRECTION_RECV, // "recv" - RFC3312
340 PRECONDITION_DIRECTION_SENDRECV, // "sendrecv" - RFC3312
343
345 {
346 public:
348 mType(type), mStatus(status), mDirection(direction) {}
350 mType(rhs.mType), mStatus(rhs.mStatus), mDirection(rhs.mDirection) {}
351
352 void setType(SdpPreConditionType type) { mType = type; }
353 SdpPreConditionType getType() const { return mType; }
354
355 void setStatus(SdpPreConditionStatusType status) { mStatus = status; }
356 SdpPreConditionStatusType getStatus() const { return mStatus; }
357
359 SdpPreConditionDirectionType getDirection() const { return mDirection; }
360
361 private:
365 };
366
381
383 {
384 public:
385 SdpRemoteCandidate(unsigned int componentId, const char * connectionAddress, unsigned int port) :
386 mComponentId(componentId), mConnectionAddress(connectionAddress), mPort(port) {}
388 mComponentId(rhs.mComponentId), mConnectionAddress(rhs.mConnectionAddress), mPort(rhs.mPort) {}
389
390 void setComponentId(unsigned int componentId) { mComponentId = componentId; }
391 unsigned int getComponentId() const { return mComponentId; }
392
393 void setConnectionAddress(const char * connectionAddress) { mConnectionAddress = connectionAddress; }
394 const resip::Data& getConnectionAddress() const { return mConnectionAddress; }
395
396 void setPort(unsigned int port) { mPort = port; }
397 unsigned int getPort() const { return mPort; }
398
399 private:
400 unsigned int mComponentId;
401 resip::Data mConnectionAddress;
402 unsigned int mPort;
403 };
404
406 {
407 public:
409 mId(id), mType(type) {}
412 void setId(unsigned int id) { mId = id; }
413 const unsigned int getId() const { return mId; }
414
415 void setType(SdpTransportProtocolType type) { mType = type; }
416 SdpTransportProtocolType getType() const { return mType; }
417
418 private:
419 unsigned int mId;
421 };
422
424 {
425 public:
427 {
428 public:
429 ConfigIdItem(unsigned id, bool optional=false) : mId(id), mOptional(optional) {}
430 ConfigIdItem(const ConfigIdItem& rhs) : mId(rhs.mId), mOptional(rhs.mOptional) {}
431
432 void setId(unsigned int id) { mId = id; }
433 const unsigned int getId() const { return mId; }
434
435 void setOptional(bool optional) { mOptional = optional; }
436 const bool getOptional() const { return mOptional; }
437
438 private:
439 unsigned int mId;
440 bool mOptional;
441 };
442
444 mId(id), mDeleteMediaAttributes(deleteMediaAttributes), mDeleteSessionAttributes(deleteSessionAttributes), mTransportId(transportId) {}
446 mId(rhs.mId), mDeleteMediaAttributes(rhs.mDeleteMediaAttributes), mDeleteSessionAttributes(rhs.mDeleteSessionAttributes),
447 mTransportId(rhs.mTransportId), mAttributeIdList(rhs.mAttributeIdList) {}
448
449 typedef std::list<ConfigIdItem> ConfigIdList;
450
451 void setId(unsigned int id) { mId = id; }
452 const unsigned int getId() const { return mId; }
453
455 const bool getDeleteMediaAttributes() const { return mDeleteMediaAttributes; }
456
458 const bool getDeleteSessionAttributes() const { return mDeleteSessionAttributes; }
459
460 void setTransportId(unsigned int transportId) { mTransportId = transportId; }
461 const unsigned int getTransportId() const { return mTransportId; }
462
463 void addAttributeId(unsigned int id, bool optional) { addAttributeId(ConfigIdItem(id, optional)); }
464 void addAttributeId(const ConfigIdItem& configIdItem) { mAttributeIdList.push_back(configIdItem); }
465 void clearAttributeIds() { mAttributeIdList.clear(); }
466 const ConfigIdList& getAttributeIds() const { return mAttributeIdList; }
467
468 private:
469 unsigned int mId;
470 bool mDeleteMediaAttributes;
471 bool mDeleteSessionAttributes;
472 unsigned int mTransportId;
473 ConfigIdList mAttributeIdList;
474 };
475
476 SdpMediaLine();
478 virtual ~SdpMediaLine();
479
481
483 void setMediaType(const resip::Data& mediaTypeString) { mMediaType = getMediaTypeFromString(mediaTypeString.c_str()); mMediaTypeString = mediaTypeString;}
486
487 void addCodec(const SdpCodec& codec) { mCodecs.push_back(codec); }
488 void clearCodecs() { mCodecs.clear(); }
489
490 void setTitle(const char * title) { mTitle = title; }
491
492 void addConnection(Sdp::SdpNetType netType, Sdp::SdpAddressType addressType, const char * address, unsigned int port, unsigned int multicastIpV4Ttl=0)
494 void addConnection(const SdpConnection& connection) { mConnections.push_back(connection); }
495 void clearConnections() { mConnections.clear(); }
496
497 void addRtcpConnection(Sdp::SdpNetType netType, Sdp::SdpAddressType addressType, const char * address, unsigned int port, unsigned int multicastIpV4Ttl=0)
499 void addRtcpConnection(const SdpConnection& connection) { mRtcpConnections.push_back(connection); }
500 void clearRtcpConnections() { mRtcpConnections.clear(); }
501
503 void addBandwidth(const Sdp::SdpBandwidth& sdpBandwidth) { mBandwidths.push_back(sdpBandwidth); }
504 void clearBandwidths() { mBandwidths.clear(); }
505
506 void setEncryptionKey(SdpEncryptionMethod method, const char * key) { mEncryptionMethod = method; mEncryptionKey = key; }
508 void setPacketTime(unsigned int packetTime) { mPacketTime = packetTime; }
509 void setMaxPacketTime(unsigned int maxPacketTime) { mMaxPacketTime = maxPacketTime; }
511 void setDescriptionLanguage(const char * descriptionLanguage) { mDescriptionLanguage = descriptionLanguage; }
512 void setLanguage(const char * language) { mLanguage = language; }
513 void setFrameRate(unsigned int frameRate) { mFrameRate = frameRate; }
514 void setQuality(unsigned int quality) { mQuality = quality; }
515
518
519 // void addCryptoSettings(unsigned int tag, SdpCryptoSuiteType suite, SdpCryptoKeyMethod keyMethod, const char * keyValue) { addCryptoSettings(new SdpCrypto(tag, suite, keyMethod, keyValue)); }
520 void addCryptoSettings(const SdpCrypto& crypto) { mCryptos.push_back(crypto); }
521 void clearCryptoSettings() { mCryptos.clear(); }
522
524 void setKeyManagementProtocol(SdpKeyManagementProtocolType protocol, const char* data) { mKeyManagementProtocol = protocol; mKeyManagementData = data; }
525
528 void addPreConditionCurrentStatus(const SdpPreCondition& preCondition) { mPreConditionCurrentStatus.push_back(preCondition); }
529 void clearPreConditionCurrentStatus() { mPreConditionCurrentStatus.clear(); }
530
533 void addPreConditionConfirmStatus(const SdpPreCondition& preCondition) { mPreConditionConfirmStatus.push_back(preCondition); }
534 void clearPreConditionConfirmStatus() { mPreConditionConfirmStatus.clear(); }
535
539 void clearPreConditionDesiredStatus() { mPreConditionDesiredStatus.clear(); }
540
541 void setMaximumPacketRate(double maximumPacketRate) { mMaximumPacketRate = maximumPacketRate; }
542 void setLabel(const char * label) { mLabel = label; }
543 void setIdentificationTag(const char * identificationTag) { mIdentificationTag = identificationTag; }
544
545 void setIceUserFrag(const char * iceUserFrag) { mIceUserFrag = iceUserFrag; }
546 void setIcePassword(const char * icePassword) { mIcePassword = icePassword; }
547 void setRtcpMuxEnabled(bool enabled) { mRtcpMuxEnabled = enabled; }
548
550 void addRemoteCandidate(const SdpRemoteCandidate& remoteCandidate) { mRemoteCandidates.push_back(remoteCandidate); }
551 void clearRemoteCandidates() { mRemoteCandidates.clear(); }
552
553 // Note: Candidates should be added after m/c line and rtcp information is set, so that the in-use candidate
554 // can be properly tagged and CandidatePresents flag can be properly set
556 void addCandidate(const char * foundation, unsigned int id, SdpCandidate::SdpCandidateTransportType transport,
557 uint64_t priority, const char * connectionAddress, unsigned int port,
559 unsigned int relatedPort = 0);
560 void clearCandidates() { mCandidates.clear(); mRtpCandidatePresent = false; mRtcpCandidatePresent = false; }
561
564 void addCandidatePair(const SdpCandidatePair& sdpCandidatePair) { mCandidatePairs.insert(sdpCandidatePair); }
565 void clearCandidatePairs() { mCandidatePairs.clear(); }
566
567 void addPotentialMediaView(const SdpMediaLine& potentialMediaView) { mPotentialMediaViews.push_back(potentialMediaView); }
568 void clearPotentialMediaViews() { mPotentialMediaViews.clear(); }
569
570 void setPotentialMediaViewString(const char *potentialMediaViewString) { mPotentialMediaViewString = potentialMediaViewString; }
571
573
574 typedef std::list<SdpCodec> CodecList;
575 typedef std::list<SdpConnection> ConnectionList;
576 typedef std::list<SdpCrypto> CryptoList;
577 typedef std::list<SdpPreCondition> SdpPreConditionList;
578 typedef std::list<SdpPreConditionDesiredStatus> SdpPreConditionDesiredStatusList;
579 typedef std::list<SdpRemoteCandidate> SdpRemoteCandidateList;
580 typedef std::set<SdpCandidate> SdpCandidateList;
581 typedef std::set<SdpCandidatePair> SdpCandidatePairList;
582 typedef std::list<SdpMediaLine> SdpMediaLineList;
583
584 const SdpMediaType getMediaType() const { return mMediaType; }
585 const resip::Data& getMediaTypeString() const { return mMediaTypeString; }
586 static SdpMediaType getMediaTypeFromString(const char * type);
587 const SdpTransportProtocolType getTransportProtocolType() const { return mTransportProtocolType; }
588 const resip::Data& getTransportProtocolTypeString() const { return mTransportProtocolTypeString; }
590 const CodecList& getCodecs() const { return mCodecs; }
591 const resip::Data& getTitle() const { return mTitle; }
592 const ConnectionList& getConnections() const { return mConnections; }
593 const ConnectionList& getRtcpConnections() const { return mRtcpConnections; }
594 const Sdp::BandwidthList& getBandwidths() const { return mBandwidths; }
595 SdpEncryptionMethod getEncryptionMethod() const { return mEncryptionMethod; }
596 const resip::Data& getEncryptionKey() const { return mEncryptionKey; }
597 SdpDirectionType getDirection() const { return mDirection; }
598 unsigned int getPacketTime() const { return mPacketTime; }
599 unsigned int getMaxPacketTime() const { return mMaxPacketTime; }
600 SdpOrientationType getOrientation() const { return mOrientation; }
601 static SdpOrientationType getOrientationTypeFromString(const char * type);
602 const resip::Data& getDescriptionLanguage() const { return mDescriptionLanguage; }
603 const resip::Data& getLanguage() const { return mLanguage; }
604 unsigned int getFrameRate() const { return mFrameRate; }
605 unsigned int getQuality() const { return mQuality; }
606 SdpTcpSetupAttribute getTcpSetupAttribute() const { return mTcpSetupAttribute; }
608 SdpTcpConnectionAttribute getTcpConnectionAttribute() const { return mTcpConnectionAttribute; }
610 const CryptoList& getCryptos() const { return mCryptos; }
611 static SdpCryptoSuiteType getCryptoSuiteTypeFromString(const char * type);
612 static SdpCryptoKeyMethod getCryptoKeyMethodFromString(const char * type);
613 SdpFingerPrintHashFuncType getFingerPrintHashFunction() const { return mFingerPrintHashFunction; }
615 const resip::Data& getFingerPrint() const { return mFingerPrint; }
616 SdpKeyManagementProtocolType getKeyManagementProtocol() const { return mKeyManagementProtocol; }
618 const resip::Data& getKeyManagementData() const { return mKeyManagementData; }
619 const SdpPreConditionList& getPreConditionCurrentStatus() const { return mPreConditionCurrentStatus; }
620 const SdpPreConditionList& getPreConditionConfirmStatus() const { return mPreConditionConfirmStatus; }
621 const SdpPreConditionDesiredStatusList& getPreConditionDesiredStatus() const { return mPreConditionDesiredStatus; }
622 static SdpPreConditionType getPreConditionTypeFromString(const char * type);
626 double getMaximumPacketRate() const { return mMaximumPacketRate; }
627 const resip::Data& getLabel() const { return mLabel; }
628 const resip::Data& getIdentificationTag() const { return mIdentificationTag; }
629 const resip::Data& getIceUserFrag() const { return mIceUserFrag; }
630 const resip::Data& getIcePassword() const { return mIcePassword; }
631 const SdpRemoteCandidateList& getRemoteCandidates() const { return mRemoteCandidates; }
632 const SdpCandidateList& getCandidates() const { return mCandidates; }
633
634 const bool isRtcpEnabled() const { return mRtcpConnections.size() > 0; }
635 const bool isRtpCandidatePresent() const { return mRtpCandidatePresent; }
636 const bool isRtcpCandidatePresent() const { return mRtcpCandidatePresent; }
637 const bool isIceSupported() const { return mRtpCandidatePresent && (!isRtcpEnabled() || mRtcpCandidatePresent); }
638 const bool isRtcpMuxEnabled() const { return mRtcpMuxEnabled; }
639
640 // TODO: In g++ std::set members are const and cannot be modified, need to update to a new STL type
641 const SdpCandidatePairList& getCandidatePairs() const { return mCandidatePairs; }
642 SdpCandidatePairList& getCandidatePairs() { return mCandidatePairs; } // non-const version for manipulation
643
644 const SdpMediaLineList& getPotentialMediaViews() const { return mPotentialMediaViews; }
645 SdpMediaLineList& getPotentialMediaViews() { return mPotentialMediaViews; }
646 const resip::Data& getPotentialMediaViewString() const { return mPotentialMediaViewString; }
647
648private:
649 // m= Note: port is stored in each connection
650 SdpMediaType mMediaType;
651 resip::Data mMediaTypeString;
652 SdpTransportProtocolType mTransportProtocolType;
653 resip::Data mTransportProtocolTypeString;
654 CodecList mCodecs;
655
656 // i=
657 resip::Data mTitle;
658
659 // c=
660 ConnectionList mConnections; // includes port from m- line
661 ConnectionList mRtcpConnections; // a=rtcp <port> [<nettype> <addrtype> <connection addr>] - RFC3605
662
663 // b=
664 Sdp::BandwidthList mBandwidths;
665
666 // k=
667 SdpEncryptionMethod mEncryptionMethod;
668 resip::Data mEncryptionKey;
669
670 // a= media level attributes (including defaults copied from session level attributes)
671 SdpDirectionType mDirection; // a=sendrecv, a=sendonly, a=recvonly, a=inactive - RFC4566
672 unsigned int mPacketTime; // a=ptime:<packet time> in ms - RFC4566
673 unsigned int mMaxPacketTime; // a=maxptime:<maximum packet time> in ms - RFC4566
674 SdpOrientationType mOrientation; // a=orient:<orientation> - RFC4566
675 resip::Data mDescriptionLanguage; // a=sdplang:<language tag> - RFC4566
676 resip::Data mLanguage; // a=lang:<language tag> - RFC4566
677 unsigned int mFrameRate; // a=framerate:<frame rate> in video frames/sec - RFC4566
678 unsigned int mQuality; // a=quality:<quality> 0-10 for vidoe (0 is worst, 10 is best) - RFC4566
679
680 SdpTcpSetupAttribute mTcpSetupAttribute;// a=setup:<setup attribute> - RFC4145
681 SdpTcpConnectionAttribute mTcpConnectionAttribute; // a=connection:<conn attribute> - RFC4145
682
683 CryptoList mCryptos; // a=crypto:<tag> <crypto-suite> <key method>:<keyvalud> [<session-params>] - RFC4568
684
685 SdpFingerPrintHashFuncType mFingerPrintHashFunction; // a=fingerprint:<hash func> <fingerprint> - RFC4572
686 resip::Data mFingerPrint;
687
688 SdpKeyManagementProtocolType mKeyManagementProtocol; // a=key-mgmt:<protocol id> <key mgmt data> - RFC4567
689 resip::Data mKeyManagementData;
690
691 SdpPreConditionList mPreConditionCurrentStatus; // a=curr:<pre cond type> <status type> <direction tag> - RFC3312
692 SdpPreConditionList mPreConditionConfirmStatus; // a=conf:<pre cond type> <status type> <direction tag> - RFC3312 - are multiple allowed?
693 SdpPreConditionDesiredStatusList mPreConditionDesiredStatus; // a=des:<pre cond type> <strength tag> <status type> <direction tag> - RFC3312
694
695 double mMaximumPacketRate; // a=maxprate:<packetrate> in packets/s - RFC3890
696 resip::Data mLabel; // a=label:<label> - RFC4574
697 resip::Data mIdentificationTag; // a=mid:<id tag> - RFC3388
698
699 // Ice settings
700 resip::Data mIceUserFrag; // a=ice-ufrag:<ufrag> (min 4 characters) - draft-ietf-mmusic-ice-12
701 resip::Data mIcePassword; // a=ice-pwd:<password> (min 22 characters) - draft-ietf-mmusic-ice-12
702 SdpRemoteCandidateList mRemoteCandidates; // a=remote-candidates:<component id> <connection address> <port> ... - draft-ietf-mmusic-ice-12
703 SdpCandidateList mCandidates; // a=candidate:<foundation> <component id> <transport> <qvalue> <connection address>
704 // <port> [<candidate type>] [<relay addr>] [<relay port>]
705 // [<ext attrib name> <ext attrib value>] - draft-ietf-mmusic-ice-12
706 bool mRtpCandidatePresent;
707 bool mRtcpCandidatePresent;
708 SdpCandidatePairList mCandidatePairs;
709 bool mRtcpMuxEnabled;
710
711 // SDP Capabilities Negotiation
712 SdpMediaLineList mPotentialMediaViews; // List of Potential Media Configurations
713 resip::Data mPotentialMediaViewString; // string that would be used in a=acfg attribute of an answer using this potential view
714
716};
717
719
720} // namespace
721
722#endif
723
724/* ====================================================================
725
726 Copyright (c) 2026, SIP Spectrum, Inc. https://www.sipspectrum.com
727 Copyright (c) 2007-2008, Plantronics, Inc.
728 All rights reserved.
729
730 Redistribution and use in source and binary forms, with or without
731 modification, are permitted provided that the following conditions are
732 met:
733
734 1. Redistributions of source code must retain the above copyright
735 notice, this list of conditions and the following disclaimer.
736
737 2. Redistributions in binary form must reproduce the above copyright
738 notice, this list of conditions and the following disclaimer in the
739 documentation and/or other materials provided with the distribution.
740
741 3. Neither the name of Plantronics nor the names of its contributors
742 may be used to endorse or promote products derived from this
743 software without specific prior written permission.
744
745 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
746 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
747 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
748 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
749 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
750 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
751 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
752 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
753 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
754 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
755 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
756
757 ==================================================================== */
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
const resip::Data & getAddress() const
void setAddressType(Sdp::SdpAddressType addressType)
SdpConnection(const SdpConnection &rhs)
void setNetType(Sdp::SdpNetType netType)
void setMulticastIpV4Ttl(unsigned int multicastIpV4Ttl)
SdpConnection(Sdp::SdpNetType netType=Sdp::NET_TYPE_NONE, Sdp::SdpAddressType addressType=Sdp::ADDRESS_TYPE_NONE, const char *address=0, unsigned int port=0, unsigned int multicastIpV4Ttl=0)
Sdp::SdpAddressType getAddressType() const
SdpCryptoKeyParam(SdpCryptoKeyMethod keyMethod=SdpMediaLine::CRYPTO_KEY_METHOD_NONE, const char *keyValue=0, unsigned int srtpLifetime=0, unsigned int srtpMkiValue=0, unsigned int srtpMkiLength=0)
SdpCryptoSrtpFecOrderType getSrtpFecOrder() const
SdpCryptoSuiteType getSuite() const
void setSrtpKdr(unsigned int srtpKdr)
const SdpCryptoKeyParam & getSrtpFecKey() const
const CryptoKeyParamList & getCryptoKeyParams() const
void setSrtpWsh(unsigned int srtpWsh)
void setSuite(SdpCryptoSuiteType suite)
void addCryptoKeyParam(SdpCryptoKeyMethod keyMethod, const char *keyValue, unsigned int srtpLifetime=0, unsigned int srtpMkiValue=0, unsigned int srtpMkiLength=0)
void setEncryptedSrtcp(bool encryptedSrtcp)
void setSrtpFecKey(SdpCryptoKeyMethod keyMethod, const char *keyValue, unsigned int srtpLifetime=0, unsigned int srtpMkiValue=0, unsigned int srtpMkiLength=0)
static SdpCryptoSrtpFecOrderType getSrtpFecOrderFromString(const char *order)
const GenericSessionParamList & getGenericSessionParams() const
void addGenericSessionParam(const char *sessionParam)
void setEncryptedSrtp(bool encryptedSrtp)
void addCryptoKeyParam(const SdpCryptoKeyParam &keyParam)
void setAuthenticatedSrtp(bool authenticatedSrtp)
std::list< resip::Data > GenericSessionParamList
void setSrtpFecOrder(SdpCryptoSrtpFecOrderType srtpFecOrder)
std::list< SdpCryptoKeyParam > CryptoKeyParamList
SdpCrypto & operator=(const SdpCrypto &rhs)
SdpPotentialConfiguration(unsigned int id, bool deleteMediaAttributes, bool deleteSessionAttributes, unsigned int transportId)
void setDeleteMediaAttributes(bool deleteMediaAttributes)
void addAttributeId(const ConfigIdItem &configIdItem)
SdpPotentialConfiguration(const SdpPotentialConfiguration &rhs)
void addAttributeId(unsigned int id, bool optional)
void setDeleteSessionAttributes(bool deleteSessionAttributes)
void setStrength(SdpPreConditionStrengthType strength)
SdpPreConditionDesiredStatus(const SdpPreConditionDesiredStatus &rhs)
SdpPreConditionDesiredStatus(SdpPreConditionType type, SdpPreConditionStrengthType strength, SdpPreConditionStatusType status, SdpPreConditionDirectionType direction)
void setType(SdpPreConditionType type)
void setStatus(SdpPreConditionStatusType status)
SdpPreCondition(SdpPreConditionType type, SdpPreConditionStatusType status, SdpPreConditionDirectionType direction)
SdpPreCondition(const SdpPreCondition &rhs)
SdpPreConditionStatusType getStatus() const
SdpPreConditionDirectionType getDirection() const
void setDirection(SdpPreConditionDirectionType direction)
SdpRemoteCandidate(const SdpRemoteCandidate &rhs)
const resip::Data & getConnectionAddress() const
void setComponentId(unsigned int componentId)
SdpRemoteCandidate(unsigned int componentId, const char *connectionAddress, unsigned int port)
void setConnectionAddress(const char *connectionAddress)
SdpTransportProtocolCapabilities(unsigned int id, SdpTransportProtocolType type)
SdpTransportProtocolCapabilities(const SdpTransportProtocolCapabilities &rhs)
SdpDirectionType getDirection() const
static const char * SdpPreConditionStrengthTypeString[]
static SdpCryptoSuiteType getCryptoSuiteTypeFromString(const char *type)
static SdpTcpSetupAttribute getTcpSetupAttributeFromString(const char *attrib)
void addCodec(const SdpCodec &codec)
static const char * SdpTcpSetupAttributeString[]
void addPreConditionCurrentStatus(const SdpPreCondition &preCondition)
unsigned int getFrameRate() const
void setRtcpMuxEnabled(bool enabled)
SdpOrientationType getOrientation() const
static const char * SdpPreConditionStatusTypeString[]
const resip::Data & getFingerPrint() const
void setMaximumPacketRate(double maximumPacketRate)
void setLabel(const char *label)
const SdpCandidateList & getCandidates() const
static SdpPreConditionStatusType getPreConditionStatusTypeFromString(const char *type)
const resip::Data & getPotentialMediaViewString() const
void setTitle(const char *title)
void addBandwidth(const Sdp::SdpBandwidth &sdpBandwidth)
SdpTransportProtocolType
Transport protocol identifiers for the SDP "m=" line (proto field).
static const char * SdpPreConditionTypeString[]
std::list< SdpCrypto > CryptoList
static const char * SdpOrientationTypeString[]
void addConnection(const SdpConnection &connection)
std::set< SdpCandidate > SdpCandidateList
static SdpKeyManagementProtocolType getKeyManagementProtocolTypeFromString(const char *type)
unsigned int getPacketTime() const
void addCryptoSettings(const SdpCrypto &crypto)
unsigned int getMaxPacketTime() const
const resip::Data & getDescriptionLanguage() const
const bool isRtcpCandidatePresent() const
SdpCandidatePairList & getCandidatePairs()
const bool isRtcpEnabled() const
void addPreConditionDesiredStatus(const SdpPreConditionDesiredStatus &preConditionDesiredStatus)
static SdpCryptoKeyMethod getCryptoKeyMethodFromString(const char *type)
void setIdentificationTag(const char *identificationTag)
std::list< SdpPreCondition > SdpPreConditionList
const CryptoList & getCryptos() const
static SdpTransportProtocolType getTransportProtocolTypeFromString(const char *type)
static const char * SdpFingerPrintHashFuncTypeString[]
const resip::Data & getIcePassword() const
SdpTcpSetupAttribute getTcpSetupAttribute() const
std::list< SdpMediaLine > SdpMediaLineList
static const char * SdpCryptoSuiteTypeString[]
static const char * SdpEncryptionMethodString[]
void addRtcpConnection(Sdp::SdpNetType netType, Sdp::SdpAddressType addressType, const char *address, unsigned int port, unsigned int multicastIpV4Ttl=0)
const resip::Data & getEncryptionKey() const
SdpMediaLine & operator=(const SdpMediaLine &rhs)
void setPacketTime(unsigned int packetTime)
static SdpPreConditionType getPreConditionTypeFromString(const char *type)
void setOrientation(SdpOrientationType orientation)
std::list< SdpCodec > CodecList
void setTransportProtocolType(const resip::Data &transportProtocolTypeString)
static const char * SdpDirectionTypeString[]
static const char * SdpCryptoSrtpFecOrderTypeString[]
void setFrameRate(unsigned int frameRate)
static SdpOrientationType getOrientationTypeFromString(const char *type)
const SdpTransportProtocolType getTransportProtocolType() const
const Sdp::BandwidthList & getBandwidths() const
void addRemoteCandidate(unsigned int componentId, const char *connectionAddress, unsigned int port)
void addBandwidth(Sdp::SdpBandwidthType type, unsigned int bandwidth)
const SdpCandidatePairList & getCandidatePairs() const
void addPreConditionDesiredStatus(SdpPreConditionType type, SdpPreConditionStrengthType strength, SdpPreConditionStatusType status, SdpPreConditionDirectionType direction)
const SdpPreConditionList & getPreConditionCurrentStatus() const
SdpFingerPrintHashFuncType getFingerPrintHashFunction() const
double getMaximumPacketRate() const
void setQuality(unsigned int quality)
const SdpMediaLineList & getPotentialMediaViews() const
static SdpFingerPrintHashFuncType getFingerPrintHashFuncTypeFromString(const char *type)
const bool isRtcpMuxEnabled() const
static SdpPreConditionDirectionType getPreConditionDirectionTypeFromString(const char *type)
void addConnection(Sdp::SdpNetType netType, Sdp::SdpAddressType addressType, const char *address, unsigned int port, unsigned int multicastIpV4Ttl=0)
void setDescriptionLanguage(const char *descriptionLanguage)
const resip::Data & getIceUserFrag() const
void addRemoteCandidate(const SdpRemoteCandidate &remoteCandidate)
void addRtcpConnection(const SdpConnection &connection)
void setLanguage(const char *language)
void setKeyManagementProtocol(SdpKeyManagementProtocolType protocol, const char *data)
void setTcpSetupAttribute(SdpTcpSetupAttribute tcpSetupAttribute)
void setTcpConnectionAttribute(SdpTcpConnectionAttribute tcpConnectionAttribute)
SdpTcpConnectionAttribute getTcpConnectionAttribute() const
void setMediaType(const resip::Data &mediaTypeString)
void setDirection(SdpDirectionType direction)
static SdpTcpConnectionAttribute getTcpConnectionAttributeFromString(const char *attrib)
void addPreConditionConfirmStatus(SdpPreConditionType type, SdpPreConditionStatusType status, SdpPreConditionDirectionType direction)
void setIceUserFrag(const char *iceUserFrag)
void setMaxPacketTime(unsigned int maxPacketTime)
const bool isIceSupported() const
void toString(resip::Data &sdpMediaLineString) const
void setPotentialMediaViewString(const char *potentialMediaViewString)
const SdpMediaType getMediaType() const
void addPotentialMediaView(const SdpMediaLine &potentialMediaView)
std::list< SdpRemoteCandidate > SdpRemoteCandidateList
const ConnectionList & getRtcpConnections() const
void setTransportProtocolType(SdpTransportProtocolType transportProtocolType)
static const char * SdpTcpConnectionAttributeString[]
static const char * SdpCryptoKeyMethodString[]
void addPreConditionConfirmStatus(const SdpPreCondition &preCondition)
std::set< SdpCandidatePair > SdpCandidatePairList
SdpKeyManagementProtocolType getKeyManagementProtocol() const
void addCandidate(SdpCandidate &candidate)
static const char * SdpMediaTypeString[]
const SdpRemoteCandidateList & getRemoteCandidates() const
const resip::Data & getKeyManagementData() const
const SdpPreConditionDesiredStatusList & getPreConditionDesiredStatus() const
static SdpPreConditionStrengthType getPreConditionStrengthTypeFromString(const char *type)
const resip::Data & getLabel() const
friend EncodeStream & operator<<(EncodeStream &strm, const SdpMediaLine &)
static const char * SdpTransportProtocolTypeString[]
static const char * SdpPreConditionDirectionTypeString[]
void setEncryptionKey(SdpEncryptionMethod method, const char *key)
const bool isRtpCandidatePresent() const
void addPreConditionCurrentStatus(SdpPreConditionType type, SdpPreConditionStatusType status, SdpPreConditionDirectionType direction)
const CodecList & getCodecs() const
const resip::Data & getTitle() const
const resip::Data & getLanguage() const
std::list< SdpConnection > ConnectionList
void addCandidatePair(const SdpCandidate &localCandidate, const SdpCandidate &remoteCandidate, SdpCandidatePair::SdpCandidatePairOffererType offerer)
const resip::Data & getMediaTypeString() const
SdpMediaLineList & getPotentialMediaViews()
static const char * SdpKeyManagementProtocolTypeString[]
const SdpPreConditionList & getPreConditionConfirmStatus() const
void addCandidatePair(const SdpCandidatePair &sdpCandidatePair)
const resip::Data & getTransportProtocolTypeString() const
const resip::Data & getIdentificationTag() const
void setFingerPrint(SdpFingerPrintHashFuncType fingerPrintHashFunction, const char *fingerPrint)
void setIcePassword(const char *icePassword)
unsigned int getQuality() const
static SdpMediaType getMediaTypeFromString(const char *type)
std::list< SdpPreConditionDesiredStatus > SdpPreConditionDesiredStatusList
void setMediaType(SdpMediaType mediaType)
const ConnectionList & getConnections() const
SdpEncryptionMethod getEncryptionMethod() const
std::list< SdpBandwidth > BandwidthList
Definition Sdp.hxx:270
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