This file is indexed.

/usr/include/recon/sdp/SdpMediaLine.hxx is in librecon-1.10-dev 1:1.10.1-2ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
#if !defined(SdpMediaLine_hxx)
#define SdpMediaLine_hxx

#include "Sdp.hxx"
#include "SdpCodec.hxx"
#include "SdpCandidate.hxx"
#include "SdpCandidatePair.hxx"
#include <set>

namespace sdpcontainer
{

class SdpMediaLine
{
public:

   typedef enum 
   {
      MEDIA_TYPE_NONE,
      MEDIA_TYPE_UNKNOWN,
      MEDIA_TYPE_AUDIO,          // "audio" - RFC4566
      MEDIA_TYPE_VIDEO,          // "video" - RFC4566
      MEDIA_TYPE_TEXT,           // "text" - RFC4566
      MEDIA_TYPE_APPLICATION,    // "application" - RFC4566
      MEDIA_TYPE_MESSAGE         // "message" - RFC4566
   } SdpMediaType;
   static const char* SdpMediaTypeString[];

   typedef enum 
   {
      PROTOCOL_TYPE_NONE,
      PROTOCOL_TYPE_UNKNOWN,
      PROTOCOL_TYPE_UDP,         // "udp" - RFC4566
      PROTOCOL_TYPE_RTP_AVP,     // "RTP/AVP" - RFC4566
      PROTOCOL_TYPE_RTP_SAVP,    // "RTP/SAVP" - RFC4566
      PROTOCOL_TYPE_RTP_SAVPF,   // "RTP/SAVPF" - RFC3711
      PROTOCOL_TYPE_TCP,         // "TCP" - RFC4145
      PROTOCOL_TYPE_TCP_RTP_AVP, // "TCP/RTP/AVP" - RFC4571
      PROTOCOL_TYPE_TCP_TLS,     // "TCP/TLS" - RFC4572
      PROTOCOL_TYPE_UDP_TLS,     // "UDP/TLS" - draft-fischl-mmusic-sdp-dtls-04
      PROTOCOL_TYPE_DCCP_TLS,    // "DCCP/TLS" - draft-fischl-mmusic-sdp-dtls-04
      PROTOCOL_TYPE_DCCP_TLS_RTP_SAVP, // "DCCP/TLS/RTP/SAVP" - draft-fischl-mmusic-sdp-dtls-04
      PROTOCOL_TYPE_UDP_TLS_RTP_SAVP,  // "UDP/TLS/RTP/SAVP" - draft-fischl-mmusic-sdp-dtls-04
      PROTOCOL_TYPE_TCP_TLS_RTP_SAVP   // "TCP/TLS/RTP/SAVP" - draft-fischl-mmusic-sdp-dtls-04
   } SdpTransportProtocolType;     
   static const char* SdpTransportProtocolTypeString[];

   class SdpConnection 
   {
   public:
      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) :
         mNetType(netType), mAddressType(addressType), mAddress(address), mPort(port), mMulticastIpV4Ttl(multicastIpV4Ttl) {}
      SdpConnection(const SdpConnection& rhs) :
         mNetType(rhs.mNetType), mAddressType(rhs.mAddressType), mAddress(rhs.mAddress), mPort(rhs.mPort), mMulticastIpV4Ttl(rhs.mMulticastIpV4Ttl) {}

      void setNetType(Sdp::SdpNetType netType) { mNetType = netType; }
      Sdp::SdpNetType getNetType() const { return mNetType; }

      void setAddressType(Sdp::SdpAddressType addressType) { mAddressType = addressType; }
      Sdp::SdpAddressType getAddressType() const { return mAddressType; }

      void setAddress(const char * address) { mAddress = address; }
      const resip::Data& getAddress() const { return mAddress; }

      void setPort(unsigned int port) { mPort = port; }
      unsigned int getPort() const { return mPort; }

      void setMulticastIpV4Ttl(unsigned int multicastIpV4Ttl) { mMulticastIpV4Ttl = multicastIpV4Ttl; }
      unsigned int getMulticastIpV4Ttl() const { return mMulticastIpV4Ttl; }

   private:
      Sdp::SdpNetType      mNetType;
      Sdp::SdpAddressType  mAddressType;
      resip::Data          mAddress;
      unsigned int         mPort;
      unsigned int         mMulticastIpV4Ttl;
   };

   typedef enum 
   {
      ENCRYPTION_METHOD_NONE,
      ENCRYPTION_METHOD_CLEAR,   // "clear" - RFC4566
      ENCRYPTION_METHOD_BASE64,  // "base64" - RFC4566
      ENCRYPTION_METHOD_URI,     // "uri" - RFC4566
      ENCRYPTION_METHOD_PROMPT   // "prompt" - RFC4566
   } SdpEncryptionMethod;
   static const char* SdpEncryptionMethodString[];

   typedef enum 
   {
      DIRECTION_TYPE_NONE,
      DIRECTION_TYPE_SENDRECV,   // "sendrecv" - RFC4566
      DIRECTION_TYPE_SENDONLY,   // "sendonly" - RFC4566
      DIRECTION_TYPE_RECVONLY,   // "recvonly" - RFC4566
      DIRECTION_TYPE_INACTIVE    // "inactive" - RFC4566
   } SdpDirectionType;
   static const char* SdpDirectionTypeString[];

   typedef enum 
   {
      ORIENTATION_TYPE_NONE,
      ORIENTATION_TYPE_PORTRAIT, // "portrait" - RFC 4566
      ORIENTATION_TYPE_LANDSCAPE,// "landscape" - RFC 4566
      ORIENTATION_TYPE_SEASCAPE  // "seascape" - RFC 4566
   } SdpOrientationType;
   static const char* SdpOrientationTypeString[];

   typedef enum 
   {
      TCP_SETUP_ATTRIBUTE_NONE,
      TCP_SETUP_ATTRIBUTE_ACTIVE,  // "active" - RFC4145
      TCP_SETUP_ATTRIBUTE_PASSIVE, // "passive" - RFC4145
      TCP_SETUP_ATTRIBUTE_ACTPASS, // "actpass" - RFC4145
      TCP_SETUP_ATTRIBUTE_HOLDCONN // "holdconn" - RFC4145
   } SdpTcpSetupAttribute;
   static const char* SdpTcpSetupAttributeString[];

   typedef enum 
   {
      TCP_CONNECTION_ATTRIBUTE_NONE,
      TCP_CONNECTION_ATTRIBUTE_NEW,      // "new" - RFC4145
      TCP_CONNECTION_ATTRIBUTE_EXISTING  // "existing" - RFC4145
   } SdpTcpConnectionAttribute;
   static const char* SdpTcpConnectionAttributeString[];

   typedef enum 
   {
      CRYPTO_SUITE_TYPE_NONE,
      CRYPTO_SUITE_TYPE_AES_CM_128_HMAC_SHA1_80,   // "AES_CM_128_HMAC_SHA1_80" - RFC4568
      CRYPTO_SUITE_TYPE_AES_CM_128_HMAC_SHA1_32,   // "AES_CM_128_HMAC_SHA1_32" - RFC4568
      CRYPTO_SUITE_TYPE_F8_128_HMAC_SHA1_80        // "F8_128_HMAC_SHA1_80" - RFC4568
   } SdpCryptoSuiteType;
   static const char* SdpCryptoSuiteTypeString[];

   typedef enum 
   {
      CRYPTO_KEY_METHOD_NONE,
      CRYPTO_KEY_METHOD_INLINE  // "inline" - RFC4568
   } SdpCryptoKeyMethod;
   static const char* SdpCryptoKeyMethodString[];

   typedef enum
   {
      CRYPTO_SRTP_FEC_ORDER_NONE,
      CRYPTO_SRTP_FEC_ORDER_FEC_SRTP,              // "FEC_SRTP" - RFC 4568
      CRYPTO_SRTP_FEC_ORDER_SRTP_FEC               // "SRTP_FEC" - RFC 2568
   } SdpCryptoSrtpFecOrderType;
   static const char* SdpCryptoSrtpFecOrderTypeString[];

   class SdpCrypto 
   {
   public:
      class SdpCryptoKeyParam 
      {
      public:
         SdpCryptoKeyParam(SdpCryptoKeyMethod keyMethod=SdpMediaLine::CRYPTO_KEY_METHOD_NONE, const char * keyValue=0, unsigned int srtpLifetime=0, unsigned int srtpMkiValue=0, unsigned int srtpMkiLength=0) :
            mKeyMethod(keyMethod), mKeyValue(keyValue), mSrtpLifetime(srtpLifetime), mSrtpMkiValue(srtpMkiValue), mSrtpMkiLength(srtpMkiLength) {}
         SdpCryptoKeyParam(const SdpCryptoKeyParam& rhs) :
            mKeyMethod(rhs.mKeyMethod), mKeyValue(rhs.mKeyValue), mSrtpLifetime(rhs.mSrtpLifetime), mSrtpMkiValue(rhs.mSrtpMkiValue), mSrtpMkiLength(rhs.mSrtpMkiLength) {}

         void setKeyMethod(SdpCryptoKeyMethod keyMethod) { mKeyMethod = keyMethod; }
         SdpCryptoKeyMethod getKeyMethod() const { return mKeyMethod; }

         void setKeyValue(const char * keyValue) { mKeyValue = keyValue; }
         const resip::Data& getKeyValue() const { return mKeyValue; }

         void setSrtpLifetime(unsigned int srtpLifetime) { mSrtpLifetime = srtpLifetime; }
         unsigned int getSrtpLifetime() const { return mSrtpLifetime; }

         void setSrtpMkiValue(unsigned int srtpMkiValue) { mSrtpMkiValue = srtpMkiValue; }
         unsigned int getSrtpMkiValue() const { return mSrtpMkiValue; }

         void setSrtpMkiLength(unsigned int srtpMkiLength) { mSrtpMkiLength = srtpMkiLength; }
         unsigned int getSrtpMkiLength() const { return mSrtpMkiLength; }

      private:
         SdpCryptoKeyMethod mKeyMethod;
         resip::Data        mKeyValue;  // srtp key-salt or generic key-info
         unsigned int       mSrtpLifetime;
         unsigned int       mSrtpMkiValue;
         unsigned int       mSrtpMkiLength;
      };

      SdpCrypto() : mTag(0), mSuite(SdpMediaLine::CRYPTO_SUITE_TYPE_NONE), mSrtpKdr(0), mEncryptedSrtp(1), mEncryptedSrtcp(1),
         mAuthenticatedSrtp(1), mSrtpFecOrder(SdpMediaLine::CRYPTO_SRTP_FEC_ORDER_FEC_SRTP), mSrtpWsh(0) {}
      SdpCrypto(const SdpCrypto& rSdpCandidatePair);
      ~SdpCrypto() { }

      typedef std::list<SdpCryptoKeyParam> CryptoKeyParamList;
      typedef std::list<resip::Data> GenericSessionParamList;

      SdpCrypto& operator=(const SdpCrypto& rhs);

      void setTag(unsigned int tag) { mTag = tag; }
      unsigned int getTag() const { return mTag; }

      void setSuite(SdpCryptoSuiteType suite) { mSuite = suite; }
      SdpCryptoSuiteType getSuite() const { return mSuite; }

      void addCryptoKeyParam(SdpCryptoKeyMethod keyMethod, const char * keyValue, unsigned int srtpLifetime=0, unsigned int srtpMkiValue=0, unsigned int srtpMkiLength=0)
      { addCryptoKeyParam(SdpCryptoKeyParam(keyMethod, keyValue, srtpLifetime, srtpMkiValue, srtpMkiLength)); }
      void addCryptoKeyParam(const SdpCryptoKeyParam& keyParam) { mCryptoKeyParams.push_back(keyParam); }
      void clearCryptoKeyParams() { mCryptoKeyParams.clear(); }
      const CryptoKeyParamList& getCryptoKeyParams() const { return mCryptoKeyParams; }

      void setSrtpKdr(unsigned int srtpKdr) { mSrtpKdr = srtpKdr; }
      unsigned int getSrtpKdr() const { return mSrtpKdr; }

      void setEncryptedSrtp(bool encryptedSrtp) { mEncryptedSrtp = encryptedSrtp; }
      bool getEncryptedSrtp() const { return mEncryptedSrtp; }

      void setEncryptedSrtcp(bool encryptedSrtcp) { mEncryptedSrtcp = encryptedSrtcp; }
      bool getEncryptedSrtcp() const { return mEncryptedSrtcp; }

      void setAuthenticatedSrtp(bool authenticatedSrtp) { mAuthenticatedSrtp = authenticatedSrtp; }
      bool getAuthenticatedSrtp() const { return mAuthenticatedSrtp; }

      void setSrtpFecOrder(SdpCryptoSrtpFecOrderType srtpFecOrder) { mSrtpFecOrder = srtpFecOrder; }
      SdpCryptoSrtpFecOrderType getSrtpFecOrder() const { return mSrtpFecOrder; }
      static SdpCryptoSrtpFecOrderType getSrtpFecOrderFromString(const char * order);

      void setSrtpFecKey(SdpCryptoKeyMethod keyMethod, const char * keyValue, unsigned int srtpLifetime=0, unsigned int srtpMkiValue=0, unsigned int srtpMkiLength=0) 
      { mSrtpFecKey.setKeyMethod(keyMethod); mSrtpFecKey.setKeyValue(keyValue); mSrtpFecKey.setSrtpLifetime(srtpLifetime); 
        mSrtpFecKey.setSrtpMkiValue(srtpMkiValue); mSrtpFecKey.setSrtpMkiLength(srtpMkiLength); }
      const SdpCryptoKeyParam& getSrtpFecKey() const { return mSrtpFecKey; }

      void setSrtpWsh(unsigned int srtpWsh) { mSrtpWsh = srtpWsh; }
      unsigned int getSrtpWsh() const { return mSrtpWsh; }

      void addGenericSessionParam(const char * sessionParam) { mGenericSessionParams.push_back(sessionParam); }
      void clearGenericSessionParams() { mGenericSessionParams.clear(); }
      const GenericSessionParamList& getGenericSessionParams() const { return mGenericSessionParams; }

   private:
      unsigned int       mTag;         
      SdpCryptoSuiteType mSuite;
      CryptoKeyParamList mCryptoKeyParams;
      unsigned int       mSrtpKdr;
      bool               mEncryptedSrtp;
      bool               mEncryptedSrtcp;
      bool               mAuthenticatedSrtp;
      SdpCryptoSrtpFecOrderType mSrtpFecOrder;
      SdpCryptoKeyParam  mSrtpFecKey;
      unsigned int       mSrtpWsh;
      GenericSessionParamList mGenericSessionParams; 
   };

   typedef enum 
   {
      FINGERPRINT_HASH_FUNC_NONE,
      FINGERPRINT_HASH_FUNC_SHA_1,        // "sha-1" - RFC4572
      FINGERPRINT_HASH_FUNC_SHA_224,      // "sha-224" - RFC4572
      FINGERPRINT_HASH_FUNC_SHA_256,      // "sha-256" - RFC4572
      FINGERPRINT_HASH_FUNC_SHA_384,      // "sha-384" - RFC4572
      FINGERPRINT_HASH_FUNC_SHA_512,      // "sha-512" - RFC4572
      FINGERPRINT_HASH_FUNC_MD5,          // "md5" - RFC4572
      FINGERPRINT_HASH_FUNC_MD2           // "md2" - RFC4572
   } SdpFingerPrintHashFuncType;
   static const char* SdpFingerPrintHashFuncTypeString[];

   typedef enum 
   {
      KEYMANAGEMENT_PROTOCOL_NONE,
      KEYMANAGEMENT_PROTOCOL_MIKEY        // 'mikey' - RFC4567
   } SdpKeyManagementProtocolType;
   static const char* SdpKeyManagementProtocolTypeString[];

   typedef enum 
   {
      PRECONDITION_TYPE_NONE,
      PRECONDITION_TYPE_QOS               // "qos" - RFC3312
   } SdpPreConditionType;
   static const char* SdpPreConditionTypeString[];

   typedef enum 
   {
      PRECONDITION_STRENGTH_MANDATORY,    // "mandatory" - RFC3312
      PRECONDITION_STRENGTH_OPTIONAL,     // "optional" - RFC3312
      PRECONDITION_STRENGTH_NONE,         // "none" - RFC3312
      PRECONDITION_STRENGTH_FAILURE,      // "failure" - RFC3312
      PRECONDITION_STRENGTH_UNKNWOWN      // "unknown" - RFC3312
   } SdpPreConditionStrengthType;
   static const char* SdpPreConditionStrengthTypeString[];

   typedef enum 
   {
      PRECONDITION_STATUS_NONE,
      PRECONDITION_STATUS_E2E,            // "e2e" - RFC3312
      PRECONDITION_STATUS_LOCAL,          // "local" - RFC3312
      PRECONDITION_STATUS_REMOTE,         // "remote" - RFC3312
   } SdpPreConditionStatusType;
   static const char* SdpPreConditionStatusTypeString[];

   typedef enum 
   {
      PRECONDITION_DIRECTION_NONE,        // "none" - RFC3312
      PRECONDITION_DIRECTION_SEND,        // "send" - RFC3312
      PRECONDITION_DIRECTION_RECV,        // "recv" - RFC3312
      PRECONDITION_DIRECTION_SENDRECV,    // "sendrecv" - RFC3312
   } SdpPreConditionDirectionType;
   static const char* SdpPreConditionDirectionTypeString[];

   class SdpPreCondition 
   {
   public:
      SdpPreCondition(SdpPreConditionType type, SdpPreConditionStatusType status, SdpPreConditionDirectionType direction) :
             mType(type), mStatus(status), mDirection(direction) {}
      SdpPreCondition(const SdpPreCondition& rhs) :
             mType(rhs.mType), mStatus(rhs.mStatus), mDirection(rhs.mDirection) {}

      void setType(SdpPreConditionType type) { mType = type; }
      SdpPreConditionType getType() const { return mType; }

      void setStatus(SdpPreConditionStatusType status) { mStatus = status; }
      SdpPreConditionStatusType getStatus() const { return mStatus; }

      void setDirection(SdpPreConditionDirectionType direction) { mDirection = direction; }
      SdpPreConditionDirectionType getDirection() const { return mDirection; }

   private:
      SdpPreConditionType          mType;
      SdpPreConditionStatusType    mStatus;
      SdpPreConditionDirectionType mDirection;
   };

   class SdpPreConditionDesiredStatus : public SdpPreCondition
   {
   public:
      SdpPreConditionDesiredStatus(SdpPreConditionType type, SdpPreConditionStrengthType strength, SdpPreConditionStatusType status, SdpPreConditionDirectionType direction) :
         SdpPreCondition(type, status, direction), mStrength(strength) {}
      SdpPreConditionDesiredStatus(const SdpPreConditionDesiredStatus& rhs) :
         SdpPreCondition(rhs), mStrength(rhs.mStrength) {}

      void setStrength(SdpPreConditionStrengthType strength) { mStrength = strength; }
      SdpPreConditionStrengthType getStrength() const { return mStrength; }

   private:
      SdpPreConditionStrengthType  mStrength;
   };

   class SdpRemoteCandidate 
   {
   public:
      SdpRemoteCandidate(unsigned int componentId, const char * connectionAddress, unsigned int port) :
         mComponentId(componentId), mConnectionAddress(connectionAddress), mPort(port) {}
      SdpRemoteCandidate(const SdpRemoteCandidate& rhs) :
         mComponentId(rhs.mComponentId), mConnectionAddress(rhs.mConnectionAddress), mPort(rhs.mPort) {}

      void setComponentId(unsigned int componentId) { mComponentId = componentId; }
      unsigned int getComponentId() const { return mComponentId; }

      void setConnectionAddress(const char * connectionAddress) { mConnectionAddress = connectionAddress; }
      const resip::Data& getConnectionAddress() const { return mConnectionAddress; }

      void setPort(unsigned int port) { mPort = port; }
      unsigned int getPort() const { return mPort; }

   private:
      unsigned int   mComponentId;
      resip::Data    mConnectionAddress;
      unsigned int   mPort;
   };

   class SdpTransportProtocolCapabilities 
   {
   public:
      SdpTransportProtocolCapabilities(unsigned int id, SdpTransportProtocolType type) :
         mId(id), mType(type) {}
      SdpTransportProtocolCapabilities(const SdpTransportProtocolCapabilities& rhs) :
         mId(rhs.mId), mType(rhs.mType) {}
      void setId(unsigned int id) { mId = id; }
      const unsigned int getId() const { return mId; }

      void setType(SdpTransportProtocolType type) { mType = type; }
      SdpTransportProtocolType getType() const { return mType; }

   private:
      unsigned int mId;
      SdpTransportProtocolType mType;
   };

   class SdpPotentialConfiguration 
   {
   public:
      class ConfigIdItem 
      {
      public:
         ConfigIdItem(unsigned id, bool optional=false) : mId(id), mOptional(optional) {}
         ConfigIdItem(const ConfigIdItem& rhs) : mId(rhs.mId), mOptional(rhs.mOptional) {}

         void setId(unsigned int id) { mId = id; }
         const unsigned int getId() const { return mId; }

         void setOptional(bool optional) { mOptional = optional; }
         const bool getOptional() const { return mOptional; }

      private:
         unsigned int mId;
         bool mOptional;
      };

      SdpPotentialConfiguration(unsigned int id, bool deleteMediaAttributes, bool deleteSessionAttributes, unsigned int transportId) : 
         mId(id), mDeleteMediaAttributes(deleteMediaAttributes), mDeleteSessionAttributes(deleteSessionAttributes), mTransportId(transportId) {}
      SdpPotentialConfiguration(const SdpPotentialConfiguration& rhs) :
         mId(rhs.mId), mDeleteMediaAttributes(rhs.mDeleteMediaAttributes), mDeleteSessionAttributes(rhs.mDeleteSessionAttributes),
         mTransportId(rhs.mTransportId), mAttributeIdList(rhs.mAttributeIdList)  {}

      typedef std::list<ConfigIdItem> ConfigIdList;

      void setId(unsigned int id) { mId = id; }
      const unsigned int getId() const { return mId; }

      void setDeleteMediaAttributes(bool deleteMediaAttributes) { mDeleteMediaAttributes = deleteMediaAttributes; }
      const bool getDeleteMediaAttributes() const { return mDeleteMediaAttributes; }

      void setDeleteSessionAttributes(bool deleteSessionAttributes) { mDeleteSessionAttributes = deleteSessionAttributes; }
      const bool getDeleteSessionAttributes() const { return mDeleteSessionAttributes; }

      void setTransportId(unsigned int transportId) { mTransportId = transportId; }
      const unsigned int getTransportId() const { return mTransportId; }

      void addAttributeId(unsigned int id, bool optional) { addAttributeId(ConfigIdItem(id, optional)); }
      void addAttributeId(const ConfigIdItem& configIdItem) { mAttributeIdList.push_back(configIdItem); }
      void clearAttributeIds() { mAttributeIdList.clear(); }
      const ConfigIdList& getAttributeIds() const { return mAttributeIdList; }

   private:
      unsigned int mId;
      bool mDeleteMediaAttributes;
      bool mDeleteSessionAttributes;
      unsigned int mTransportId;
      ConfigIdList mAttributeIdList;
   };

   SdpMediaLine();
   SdpMediaLine(const SdpMediaLine& rSdpMediaLine);
   virtual ~SdpMediaLine();

   SdpMediaLine& operator=(const SdpMediaLine& rhs);

   void setMediaType(SdpMediaType mediaType) { mMediaType = mediaType; mMediaTypeString = SdpMediaLine::SdpMediaTypeString[mediaType];}
   void setMediaType(const resip::Data& mediaTypeString) { mMediaType = getMediaTypeFromString(mediaTypeString.c_str()); mMediaTypeString = mediaTypeString;} 
   void setTransportProtocolType(SdpTransportProtocolType transportProtocolType) { mTransportProtocolType = transportProtocolType; mTransportProtocolTypeString = SdpMediaLine::SdpTransportProtocolTypeString[transportProtocolType]; }
   void setTransportProtocolType(const resip::Data& transportProtocolTypeString) { mTransportProtocolType = getTransportProtocolTypeFromString(transportProtocolTypeString.c_str()); mTransportProtocolTypeString = transportProtocolTypeString; }

   void addCodec(const SdpCodec& codec) { mCodecs.push_back(codec); }
   void clearCodecs() { mCodecs.clear(); }

   void setTitle(const char * title) { mTitle = title; }

   void addConnection(Sdp::SdpNetType netType, Sdp::SdpAddressType addressType, const char * address, unsigned int port, unsigned int multicastIpV4Ttl=0) 
        { addConnection(SdpConnection(netType, addressType, address, port, multicastIpV4Ttl)); }
   void addConnection(const SdpConnection& connection) { mConnections.push_back(connection); }
   void clearConnections() { mConnections.clear(); }

   void addRtcpConnection(Sdp::SdpNetType netType, Sdp::SdpAddressType addressType, const char * address, unsigned int port, unsigned int multicastIpV4Ttl=0) 
        { addRtcpConnection(SdpConnection(netType, addressType, address, port, multicastIpV4Ttl)); }
   void addRtcpConnection(const SdpConnection& connection) { mRtcpConnections.push_back(connection); }
   void clearRtcpConnections() { mRtcpConnections.clear(); }

   void addBandwidth(Sdp::SdpBandwidthType type, unsigned int bandwidth) { addBandwidth(Sdp::SdpBandwidth(type, bandwidth)); }
   void addBandwidth(const Sdp::SdpBandwidth& sdpBandwidth) { mBandwidths.push_back(sdpBandwidth); }
   void clearBandwidths() { mBandwidths.clear(); }

   void setEncryptionKey(SdpEncryptionMethod method, const char * key) { mEncryptionMethod = method; mEncryptionKey = key; }
   void setDirection(SdpDirectionType direction) { mDirection = direction; }
   void setPacketTime(unsigned int packetTime) { mPacketTime = packetTime; }
   void setMaxPacketTime(unsigned int maxPacketTime) { mMaxPacketTime = maxPacketTime; }
   void setOrientation(SdpOrientationType orientation) { mOrientation = orientation; }
   void setDescriptionLanguage(const char * descriptionLanguage) { mDescriptionLanguage = descriptionLanguage; }
   void setLanguage(const char * language) { mLanguage = language; }
   void setFrameRate(unsigned int frameRate) { mFrameRate = frameRate; }
   void setQuality(unsigned int quality) { mQuality = quality; }

   void setTcpSetupAttribute(SdpTcpSetupAttribute tcpSetupAttribute) { mTcpSetupAttribute = tcpSetupAttribute; }
   void setTcpConnectionAttribute(SdpTcpConnectionAttribute tcpConnectionAttribute) { mTcpConnectionAttribute = tcpConnectionAttribute; }

//   void addCryptoSettings(unsigned int tag, SdpCryptoSuiteType suite, SdpCryptoKeyMethod keyMethod, const char * keyValue) { addCryptoSettings(new SdpCrypto(tag, suite, keyMethod, keyValue)); }
   void addCryptoSettings(const SdpCrypto& crypto) { mCryptos.push_back(crypto); }
   void clearCryptoSettings() { mCryptos.clear(); }

   void setFingerPrint(SdpFingerPrintHashFuncType fingerPrintHashFunction, const char * fingerPrint) { mFingerPrintHashFunction = fingerPrintHashFunction; mFingerPrint = fingerPrint; }
   void setKeyManagementProtocol(SdpKeyManagementProtocolType protocol, const char* data) { mKeyManagementProtocol = protocol; mKeyManagementData = data; }

   void addPreConditionCurrentStatus(SdpPreConditionType type, SdpPreConditionStatusType status, SdpPreConditionDirectionType direction) 
        { addPreConditionCurrentStatus(SdpPreCondition(type, status, direction)); }
   void addPreConditionCurrentStatus(const SdpPreCondition& preCondition) { mPreConditionCurrentStatus.push_back(preCondition); }
   void clearPreConditionCurrentStatus() { mPreConditionCurrentStatus.clear(); }

   void addPreConditionConfirmStatus(SdpPreConditionType type, SdpPreConditionStatusType status, SdpPreConditionDirectionType direction) 
        { addPreConditionConfirmStatus(SdpPreCondition(type, status, direction)); }
   void addPreConditionConfirmStatus(const SdpPreCondition& preCondition) { mPreConditionConfirmStatus.push_back(preCondition); }
   void clearPreConditionConfirmStatus() { mPreConditionConfirmStatus.clear(); }

   void addPreConditionDesiredStatus(SdpPreConditionType type, SdpPreConditionStrengthType strength, SdpPreConditionStatusType status, SdpPreConditionDirectionType direction) 
        { addPreConditionDesiredStatus(SdpPreConditionDesiredStatus(type, strength, status, direction)); }
   void addPreConditionDesiredStatus(const SdpPreConditionDesiredStatus& preConditionDesiredStatus) { mPreConditionDesiredStatus.push_back(preConditionDesiredStatus); }
   void clearPreConditionDesiredStatus() { mPreConditionDesiredStatus.clear(); }

   void setMaximumPacketRate(double maximumPacketRate) { mMaximumPacketRate = maximumPacketRate; }
   void setLabel(const char * label) { mLabel = label; }
   void setIdentificationTag(const char * identificationTag) { mIdentificationTag = identificationTag; }

   void setIceUserFrag(const char * iceUserFrag) { mIceUserFrag = iceUserFrag; }
   void setIcePassword(const char * icePassword) { mIcePassword = icePassword; }

   void addRemoteCandidate(unsigned int componentId, const char * connectionAddress, unsigned int port) { addRemoteCandidate(SdpRemoteCandidate(componentId, connectionAddress, port)); }
   void addRemoteCandidate(const SdpRemoteCandidate& remoteCandidate) { mRemoteCandidates.push_back(remoteCandidate); }
   void clearRemoteCandidates() { mRemoteCandidates.clear(); }

   // Note:  Candidates should be added after m/c line and rtcp information is set, so that the in-use candidate 
   //        can be properly tagged and CandidatePresents flag can be properly set
   void addCandidate(SdpCandidate& candidate);
   void addCandidate(const char * foundation, unsigned int id, SdpCandidate::SdpCandidateTransportType transport, 
                     UInt64 priority, const char * connectionAddress, unsigned int port, 
                     SdpCandidate::SdpCandidateType candidateType, const char * relatedAddress = 0, 
                     unsigned int relatedPort = 0);
   void clearCandidates() { mCandidates.clear(); mRtpCandidatePresent = false; mRtcpCandidatePresent = false; }

   void addCandidatePair(const SdpCandidate& localCandidate, const SdpCandidate& remoteCandidate, SdpCandidatePair::SdpCandidatePairOffererType offerer)
        { addCandidatePair(SdpCandidatePair(localCandidate, remoteCandidate, offerer)); }
   void addCandidatePair(const SdpCandidatePair& sdpCandidatePair) { mCandidatePairs.insert(sdpCandidatePair); }
   void clearCandidatePairs() { mCandidatePairs.clear(); }

   void addPotentialMediaView(const SdpMediaLine& potentialMediaView) { mPotentialMediaViews.push_back(potentialMediaView); }
   void clearPotentialMediaViews() { mPotentialMediaViews.clear(); }

   void setPotentialMediaViewString(const char *potentialMediaViewString) { mPotentialMediaViewString = potentialMediaViewString; }

   void toString(resip::Data& sdpMediaLineString) const;

   typedef std::list<SdpCodec> CodecList;
   typedef std::list<SdpConnection> ConnectionList;
   typedef std::list<SdpCrypto> CryptoList;
   typedef std::list<SdpPreCondition> SdpPreConditionList;
   typedef std::list<SdpPreConditionDesiredStatus> SdpPreConditionDesiredStatusList;
   typedef std::list<SdpRemoteCandidate> SdpRemoteCandidateList;
   typedef std::set<SdpCandidate> SdpCandidateList;
   typedef std::set<SdpCandidatePair> SdpCandidatePairList;
   typedef std::list<SdpMediaLine> SdpMediaLineList;
         
   const SdpMediaType getMediaType() const { return mMediaType; }
   const resip::Data& getMediaTypeString() const { return mMediaTypeString; }
   static SdpMediaType getMediaTypeFromString(const char * type);
   const SdpTransportProtocolType getTransportProtocolType() const { return mTransportProtocolType; }
   const resip::Data& getTransportProtocolTypeString() const { return mTransportProtocolTypeString; }
   static SdpTransportProtocolType getTransportProtocolTypeFromString(const char * type);
   const CodecList& getCodecs() const { return mCodecs; }
   const resip::Data& getTitle() const  { return mTitle; }
   const ConnectionList& getConnections() const { return mConnections; }
   const ConnectionList& getRtcpConnections() const { return mRtcpConnections; }
   const Sdp::BandwidthList& getBandwidths() const { return mBandwidths; }
   SdpEncryptionMethod getEncryptionMethod() const { return mEncryptionMethod; }
   const resip::Data& getEncryptionKey() const { return mEncryptionKey; }   
   SdpDirectionType getDirection() const { return mDirection; }
   unsigned int getPacketTime() const { return mPacketTime; }
   unsigned int getMaxPacketTime() const { return mMaxPacketTime; }
   SdpOrientationType getOrientation() const { return mOrientation; }
   static SdpOrientationType getOrientationTypeFromString(const char * type);
   const resip::Data& getDescriptionLanguage() const { return mDescriptionLanguage; }
   const resip::Data& getLanguage() const { return mLanguage; }
   unsigned int getFrameRate() const { return mFrameRate; }
   unsigned int getQuality() const { return mQuality; }
   SdpTcpSetupAttribute getTcpSetupAttribute() const { return mTcpSetupAttribute; }
   static SdpTcpSetupAttribute getTcpSetupAttributeFromString(const char * attrib);
   SdpTcpConnectionAttribute getTcpConnectionAttribute() const { return mTcpConnectionAttribute; }
   static SdpTcpConnectionAttribute getTcpConnectionAttributeFromString(const char * attrib);
   const CryptoList& getCryptos() const { return mCryptos; }
   static SdpCryptoSuiteType getCryptoSuiteTypeFromString(const char * type);
   static SdpCryptoKeyMethod getCryptoKeyMethodFromString(const char * type);
   SdpFingerPrintHashFuncType getFingerPrintHashFunction() const { return mFingerPrintHashFunction; }
   static SdpFingerPrintHashFuncType getFingerPrintHashFuncTypeFromString(const char * type);
   const resip::Data& getFingerPrint() const { return mFingerPrint; }
   SdpKeyManagementProtocolType getKeyManagementProtocol() const { return mKeyManagementProtocol; }
   static SdpKeyManagementProtocolType getKeyManagementProtocolTypeFromString(const char * type);
   const resip::Data& getKeyManagementData() const { return mKeyManagementData; }
   const SdpPreConditionList& getPreConditionCurrentStatus() const { return mPreConditionCurrentStatus; }
   const SdpPreConditionList& getPreConditionConfirmStatus() const { return mPreConditionConfirmStatus; }
   const SdpPreConditionDesiredStatusList& getPreConditionDesiredStatus() const { return mPreConditionDesiredStatus; }
   static SdpPreConditionType getPreConditionTypeFromString(const char * type);
   static SdpPreConditionStatusType getPreConditionStatusTypeFromString(const char * type);
   static SdpPreConditionDirectionType getPreConditionDirectionTypeFromString(const char * type);
   static SdpPreConditionStrengthType getPreConditionStrengthTypeFromString(const char * type);
   double getMaximumPacketRate() const { return mMaximumPacketRate; }
   const resip::Data& getLabel() const { return mLabel; }
   const resip::Data& getIdentificationTag() const { return mIdentificationTag; }
   const resip::Data& getIceUserFrag() const { return mIceUserFrag; }
   const resip::Data& getIcePassword() const { return mIcePassword; }
   const SdpRemoteCandidateList& getRemoteCandidates() const { return mRemoteCandidates; }
   const SdpCandidateList& getCandidates() const { return mCandidates; }

   const bool isRtcpEnabled() const { return mRtcpConnections.size() > 0; }
   const bool isRtpCandidatePresent() const { return mRtpCandidatePresent; }
   const bool isRtcpCandidatePresent() const { return mRtcpCandidatePresent; }
   const bool isIceSupported() const { return  mRtpCandidatePresent && (!isRtcpEnabled() || mRtcpCandidatePresent); }

   // TODO:  In g++ std::set members are const and cannot be modified, need to update to a new STL type
   const SdpCandidatePairList& getCandidatePairs() const { return mCandidatePairs; }
   SdpCandidatePairList& getCandidatePairs() { return mCandidatePairs; }  // non-const version for manipulation

   const SdpMediaLineList& getPotentialMediaViews() const { return mPotentialMediaViews; }
   const resip::Data& getPotentialMediaViewString() const { return mPotentialMediaViewString; }

private:
   // m=  Note:  port is stored in each connection
   SdpMediaType   mMediaType;
   resip::Data    mMediaTypeString;
   SdpTransportProtocolType mTransportProtocolType;
   resip::Data    mTransportProtocolTypeString;
   CodecList      mCodecs;

   // i=
   resip::Data    mTitle;

   // c=
   ConnectionList mConnections;           // includes port from m- line
   ConnectionList mRtcpConnections;       // a=rtcp <port> [<nettype> <addrtype> <connection addr>] - RFC3605

   // b=
   Sdp::BandwidthList mBandwidths;

   // k=
   SdpEncryptionMethod  mEncryptionMethod;
   resip::Data    mEncryptionKey;

   // a= media level attributes (including defaults copied from session level attributes)
   SdpDirectionType mDirection;           // a=sendrecv, a=sendonly, a=recvonly, a=inactive - RFC4566
   unsigned int   mPacketTime;            // a=ptime:<packet time> in ms - RFC4566
   unsigned int   mMaxPacketTime;         // a=maxptime:<maximum packet time> in ms - RFC4566
   SdpOrientationType mOrientation;       // a=orient:<orientation> - RFC4566
   resip::Data    mDescriptionLanguage;   // a=sdplang:<language tag> - RFC4566
   resip::Data    mLanguage;              // a=lang:<language tag> - RFC4566
   unsigned int   mFrameRate;             // a=framerate:<frame rate> in video frames/sec - RFC4566
   unsigned int   mQuality;               // a=quality:<quality> 0-10 for vidoe (0 is worst, 10 is best) - RFC4566

   SdpTcpSetupAttribute mTcpSetupAttribute;// a=setup:<setup attribute> - RFC4145
   SdpTcpConnectionAttribute mTcpConnectionAttribute; // a=connection:<conn attribute> - RFC4145

   CryptoList     mCryptos;               // a=crypto:<tag> <crypto-suite> <key method>:<keyvalud> [<session-params>] - RFC4568

   SdpFingerPrintHashFuncType mFingerPrintHashFunction; // a=fingerprint:<hash func> <fingerprint> - RFC4572
   resip::Data      mFingerPrint;

   SdpKeyManagementProtocolType mKeyManagementProtocol; // a=key-mgmt:<protocol id> <key mgmt data> - RFC4567   
   resip::Data      mKeyManagementData;

   SdpPreConditionList mPreConditionCurrentStatus; // a=curr:<pre cond type> <status type> <direction tag> - RFC3312
   SdpPreConditionList mPreConditionConfirmStatus; // a=conf:<pre cond type> <status type> <direction tag> - RFC3312 - are multiple allowed?
   SdpPreConditionDesiredStatusList mPreConditionDesiredStatus; // a=des:<pre cond type> <strength tag> <status type> <direction tag> - RFC3312

   double         mMaximumPacketRate;     // a=maxprate:<packetrate> in packets/s - RFC3890
   resip::Data    mLabel;                 // a=label:<label> - RFC4574
   resip::Data    mIdentificationTag;     // a=mid:<id tag> - RFC3388

   // Ice settings
   resip::Data      mIceUserFrag;         // a=ice-ufrag:<ufrag> (min 4 characters) - draft-ietf-mmusic-ice-12
   resip::Data      mIcePassword;         // a=ice-pwd:<password> (min 22 characters) - draft-ietf-mmusic-ice-12
   SdpRemoteCandidateList mRemoteCandidates;    // a=remote-candidates:<component id> <connection address> <port> ... - draft-ietf-mmusic-ice-12
   SdpCandidateList mCandidates;          // a=candidate:<foundation> <component id> <transport> <qvalue> <connection address> 
                                          //             <port> [<candidate type>] [<relay addr>] [<relay port>] 
                                          //             [<ext attrib name> <ext attrib value>] - draft-ietf-mmusic-ice-12
   bool           mRtpCandidatePresent;  
   bool           mRtcpCandidatePresent;
   SdpCandidatePairList mCandidatePairs;       

   // SDP Capabilities Negotiation
   SdpMediaLineList mPotentialMediaViews; // List of Potential Media Configurations
   resip::Data mPotentialMediaViewString; // string that would be used in a=acfg attribute of an answer using this potential view

   friend EncodeStream& operator<<(EncodeStream& strm, const SdpMediaLine& );
};

EncodeStream& operator<<(EncodeStream& strm, const SdpMediaLine& );

} // namespace

#endif  

/* ====================================================================

 Copyright (c) 2007-2008, Plantronics, Inc.
 All rights reserved.

 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are 
 met:

 1. Redistributions of source code must retain the above copyright 
    notice, this list of conditions and the following disclaimer. 

 2. Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in the
    documentation and/or other materials provided with the distribution. 

 3. Neither the name of Plantronics nor the names of its contributors 
    may be used to endorse or promote products derived from this 
    software without specific prior written permission. 

 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

 ==================================================================== */