From e98a464f1f56fffb138b48ec5edb66bfb08e2ce3 Mon Sep 17 00:00:00 2001 From: Adam Roach Date: Wed, 17 Sep 2014 15:35:27 -0700 Subject: [PATCH 1/3] Virtual is my friend --- media/webrtc/signaling/src/sdp/Sdp.h | 27 +- media/webrtc/signaling/src/sdp/SdpAttribute.h | 324 +++++++++++++++--- media/webrtc/signaling/src/sdp/SdpEnum.h | 72 ++-- 3 files changed, 321 insertions(+), 102 deletions(-) diff --git a/media/webrtc/signaling/src/sdp/Sdp.h b/media/webrtc/signaling/src/sdp/Sdp.h index 8289b8cf49fbb..e959fa8733094 100644 --- a/media/webrtc/signaling/src/sdp/Sdp.h +++ b/media/webrtc/signaling/src/sdp/Sdp.h @@ -25,18 +25,17 @@ class Sdp public: Sdp(); - unsigned int GetVersion() const = 0; virtual SdpOriginator GetOriginator() const = 0; - // Note: connection information is always retrieved from media sections virtual std::string GetSessionName() const = 0; - virtual Maybe GetBandwidth(const std::string& type) const = 0; + // Note: connection information is always retrieved from media sections + virtual std::string GetBandwidth(std::string type) const = 0; - const SdpAttributeList &GetAttributeList() const; - SdpAttributeList &GetAttributeList(); + virtual const SdpAttributeList &GetAttributeList() const = 0; + virtual SdpAttributeList &GetAttributeList() = 0; - uint16_t GetMediaSectionCount() const; - const SdpMediaSection &GetMediaSection(uint16_t level) const; - SdpMediaSection &GetMediaSection(uint16_t level); + virtual uint16_t GetMediaSectionCount() const = 0; + virtual const SdpMediaSection &GetMediaSection(uint16_t level) const = 0; + virtual SdpMediaSection &GetMediaSection(uint16_t level) = 0; protected: virtual ~Sdp() {}; @@ -45,12 +44,12 @@ class Sdp class SdpOrigin { public: - std::string GetUsername() const; - uint64_t GetSessionId() const; - uint64_t GetSessionVersion() const; - sdp::NetType GetNetType() const; - sdp::AddrType GetAddrType() const; - std::string GetAddress() const; + virtual std::string GetUsername() const = 0; + virtual uint64_t GetSessionId() const = 0; + virtual uint64_t GetSessionVersion() const = 0; + virtual sdp::NetType GetNetType() const = 0; + virtual sdp::AddrType GetAddrType() const = 0; + virtual std::string GetAddress() const = 0; }; } diff --git a/media/webrtc/signaling/src/sdp/SdpAttribute.h b/media/webrtc/signaling/src/sdp/SdpAttribute.h index 6ee71aa0f93f1..14529439bce24 100644 --- a/media/webrtc/signaling/src/sdp/SdpAttribute.h +++ b/media/webrtc/signaling/src/sdp/SdpAttribute.h @@ -6,6 +6,7 @@ #define _SDP_ATTRIBUTE_H_ #include "mozilla/UniquePtr.h" +#include "mozilla/Attributes.h" #include "signaling/src/sdp/SdpEnum.h" @@ -14,13 +15,14 @@ namespace mozilla { class SdpAttribute { public: - sdp::AttributeType GetType () const; - std::string GetTypeName() const; + virtual sdp::AttributeType GetType () const = 0; + virtual std::string GetTypeName() const = 0; protected: - virtual ~SdpAttribute(); + virtual ~SdpAttribute() {} }; + // RFC5245 // candidate-attribute = "candidate" ":" foundation SP component-id SP // transport SP @@ -32,15 +34,43 @@ class SdpAttribute // [SP rel-port] // *(SP extension-att-name SP // extension-att-value) -class SdpCandidateAttribute +class SdpCandidateAttribute : public SdpAttribute { +public: + virtual sdp::AttributeType GetType() const MOZ_OVERRIDE + { + return sdp::kCandidateAttribute; + } + + virtual std::string GetTypeName() const MOZ_OVERRIDE + { + return "candidate"; + } }; // RFC4145 // connection-attr = "a=connection:" conn-value // conn-value = "new" / "existing" -class SdpConnectionAttribute +class SdpConnectionAttribute : public SdpAttribute { +public: + SdpConnectionAttribute(ConnValue value) : mValue(value) {} + + virtual sdp::AttributeType GetType() const MOZ_OVERRIDE + { + return sdp::kConnectionAttribute; + } + + virtual std::string GetTypeName() const MOZ_OVERRIDE + { + return "connection"; + } + + enum ConnValue { + kNew, + kExisting + } mValue; + }; // RFC5285 @@ -61,8 +91,18 @@ class SdpConnectionAttribute // SP = // // DIGIT = -class SdpExtmapAttribute +class SdpExtmapAttribute : public SdpAttribute { +public: + virtual sdp::AttributeType GetType() const MOZ_OVERRIDE + { + return sdp::kExtmapAttribute; + } + + virtual std::string GetTypeName() const MOZ_OVERRIDE + { + return "extmap"; + } }; @@ -80,14 +120,34 @@ class SdpExtmapAttribute // ; by colons. // // UHEX = DIGIT / %x41-46 ; A-F uppercase -class SdpFingerprintAttribute +class SdpFingerprintAttribute : public SdpAttribute { +public: + virtual sdp::AttributeType GetType() const MOZ_OVERRIDE + { + return sdp::kFingerprintAttribute; + } + + virtual std::string GetTypeName() const MOZ_OVERRIDE + { + return "fingerprint"; + } }; // RFC4566, RFC5576 // a=fmtp: -class SdpFmtpAttribute +class SdpFmtpAttribute : public SdpAttribute { +public: + virtual sdp::AttributeType GetType() const MOZ_OVERRIDE + { + return sdp::kFmtpAttribute; + } + + virtual std::string GetTypeName() const MOZ_OVERRIDE + { + return "fmtp"; + } }; // RFC5888 @@ -95,16 +155,36 @@ class SdpFmtpAttribute // *(SP identification-tag) // semantics = "LS" / "FID" / semantics-extension // semantics-extension = token -class SdpGroupAttribute +class SdpGroupAttribute : public SdpAttribute { +public: + virtual sdp::AttributeType GetType() const MOZ_OVERRIDE + { + return sdp::kGroupAttribute; + } + + virtual std::string GetTypeName() const MOZ_OVERRIDE + { + return "group"; + } }; // RFC5245 // ice-options = "ice-options" ":" ice-option-tag // 0*(SP ice-option-tag) // ice-option-tag = 1*ice-char -class SdpIceOptionsAttribute +class SdpIceOptionsAttribute : public SdpAttribute { +public: + virtual sdp::AttributeType GetType() const MOZ_OVERRIDE + { + return sdp::kGroupAttribute; + } + + virtual std::string GetTypeName() const MOZ_OVERRIDE + { + return "group"; + } }; // draft-ietf-rtcweb-security-arch @@ -117,8 +197,18 @@ class SdpIceOptionsAttribute // extension-att-name = token // extension-att-value = 1*(%x01-09 / %x0b-0c / %x0e-3a / %x3c-ff) // ; byte-string from [RFC4566] omitting ";" -class SdpIdentityAttribute +class SdpIdentityAttribute : public SdpAttribute { +public: + virtual sdp::AttributeType GetType() const MOZ_OVERRIDE + { + return sdp::kIdentityAttribute; + } + + virtual std::string GetTypeName() const MOZ_OVERRIDE + { + return "identity"; + } }; // RFC6236 @@ -187,31 +277,71 @@ class SdpIdentityAttribute // qvalue = ( "0" "." 1*2DIGIT ) // / ( "1" "." 1*2("0") ) // ; Values between 0.00 and 1.00 -class SdpImageattrAttribute +class SdpImageattrAttribute : public SdpAttribute { +public: + virtual sdp::AttributeType GetType() const MOZ_OVERRIDE + { + return sdp::kImageattrAttribute; + } + + virtual std::string GetTypeName() const MOZ_OVERRIDE + { + return "imageattr"; + } }; // draft-ietf-mmusic-msid // msid-attr = "msid:" identifier [ SP appdata ] // identifier = 1*64token-char ; see RFC 4566 // appdata = 1*64token-char ; see RFC 4566 -class SdpMsidAttribute +class SdpMsidAttribute : public SdpAttribute { +public: + virtual sdp::AttributeType GetType() const MOZ_OVERRIDE + { + return sdp::kMsidAttribute; + } + + virtual std::string GetTypeName() const MOZ_OVERRIDE + { + return "msid"; + } }; // RFC5245 // remote-candidate-att = "remote-candidates" ":" remote-candidate // 0*(SP remote-candidate) // remote-candidate = component-ID SP connection-address SP port -class SdpRemoteCandidatesAttribute +class SdpRemoteCandidatesAttribute : public SdpAttribute { +public: + virtual sdp::AttributeType GetType() const MOZ_OVERRIDE + { + return sdp::kRemoteCandidates; + } + + virtual std::string GetTypeName() const MOZ_OVERRIDE + { + return "remote-candidates"; + } }; // RFC3605 // rtcp-attribute = "a=rtcp:" port [nettype space addrtype space // connection-address] CRLF -class SdpRtcpAttribute +class SdpRtcpAttribute : public SdpAttribute { +public: + virtual sdp::AttributeType GetType() const MOZ_OVERRIDE + { + return sdp::kRtcpAttribute; + } + + virtual std::string GetTypeName() const MOZ_OVERRIDE + { + return "rtcp"; + } }; // RFC4585 @@ -242,14 +372,34 @@ class SdpRtcpAttribute // / SP "app" [SP byte-string] // / SP token [SP byte-string] // / ; empty -class SdpRtcpFbAttribute +class SdpRtcpFbAttribute : public SdpAttribute { +public: + virtual sdp::AttributeType GetType() const MOZ_OVERRIDE + { + return sdp::kRtcpFbAttribute; + } + + virtual std::string GetTypeName() const MOZ_OVERRIDE + { + return "rtcp-fb"; + } }; // RFC4566 // a=rtpmap: / [/] -class SdpRtpmapAttribute +class SdpRtpmapAttribute : public SdpAttribute { +public: + virtual sdp::AttributeType GetType() const MOZ_OVERRIDE + { + return sdp::kRtpmapAttribute; + } + + virtual std::string GetTypeName() const MOZ_OVERRIDE + { + return "rtpmap"; + } }; // draft-ietf-mmusic-sctp-sdp-06 @@ -261,15 +411,35 @@ class SdpRtpmapAttribute // streams = "streams" EQUALS 1*DIGIT" // (draft-07 appears to have done something really funky here, but I // don't beleive it). -class SdpSctpmapAttribute +class SdpSctpmapAttribute : public SdpAttribute { +public: + virtual sdp::AttributeType GetType() const MOZ_OVERRIDE + { + return sdp::kSctpmapAttribute; + } + + virtual std::string GetTypeName() const MOZ_OVERRIDE + { + return "sctpmap"; + } }; // RFC4145 // setup-attr = "a=setup:" role // role = "active" / "passive" / "actpass" / "holdconn" -class SdpSetupAttribute +class SdpSetupAttribute : public SdpAttribute { +public: + virtual sdp::AttributeType GetType() const MOZ_OVERRIDE + { + return sdp::kSetupAttribute; + } + + virtual std::string GetTypeName() const MOZ_OVERRIDE + { + return "setup"; + } }; // RFC5576 @@ -278,8 +448,18 @@ class SdpSetupAttribute // ; (It is the content of "a=" lines.) // // ssrc-id = integer ; 0 .. 2**32 - 1 -class SdpSsrcAttribute +class SdpSsrcAttribute : public SdpAttribute { +public: + virtual sdp::AttributeType GetType() const MOZ_OVERRIDE + { + return sdp::kSsrcAttribute; + } + + virtual std::string GetTypeName() const MOZ_OVERRIDE + { + return "ssrc"; + } }; // RFC5576 @@ -288,44 +468,84 @@ class SdpSsrcAttribute // semantics = "FEC" / "FID" / token // // ssrc-id = integer ; 0 .. 2**32 - 1 -class SdpSsrcGroupAttribute +class SdpSsrcGroupAttribute : public SdpAttribute +{ +public: + virtual sdp::AttributeType GetType() const MOZ_OVERRIDE + { + return sdp::kSsrcAttribute; + } + + virtual std::string GetTypeName() const MOZ_OVERRIDE + { + return "ssrc"; + } +}; + +// Used for any other kind of attribute not otherwise specialized +class SdpOtherAttribute : public SdpAttribute { +public: + SdpOtherAttribute(std::string typeName, std::string value = "") : + mTypeName(typeName), mValue(value) {} + + virtual sdp::AttributeType GetType() const MOZ_OVERRIDE + { + return sdp::kOtherAttribute; + } + + virtual std::string GetTypeName() const MOZ_OVERRIDE + { + return mTypeName; + } + + std::string const getValue() + { + return mValue; + } + +private: + std::string mTypeName; + std::string mValue; }; class SdpAttributeList { public: - unsigned int CountAttributes(SdpAttributeType type); - bool HasAttribute(SdpAttributeType type); - - UniquePtr GetAttribute(sdp::AttributeType type); - - UniquePtr GetCandidate(); - UniquePtr GetConnection(); - UniquePtr GetExtmap(); - UniquePtr GetFingerprint(); - UniquePtr GetFmtp(); - UniquePtr GetGroup(); - UniquePtr GetIceOptions(); - std::string GetIcePwd(); - std::string GetIceUfrag(); - UniquePtr GetIdentity(); - UniquePtr GetImageattr(); - std::string GetLabel(); - unsigned int GetMaxprate(); - unsigned int GetMaxptime(); - std::string GetMid(); - UniquePtr GetMsid(); - unsigned int GetPtime(); - UniquePtr GetRtcp(); - UniquePtr GetRtcpFb(); - UniquePtr GetRemoteCandidates(); - UniquePtr GetRtpmap(); - UniquePtr GetSctpmap(); - UniquePtr GetSetup(); - UniquePtr GetSsrc(); - UniquePtr GetSsrcGroup(); -} + virtual unsigned int CountAttributes(SdpAttributeType type) const = 0; + virtual bool HasAttribute(SdpAttributeType type) const = 0; + + virtual UniquePtr + GetAttribute(sdp::AttributeType type) const = 0; + + virtual UniquePtr GetCandidate() const = 0; + virtual UniquePtr GetConnection() const = 0; + virtual UniquePtr GetExtmap() const = 0; + virtual UniquePtr GetFingerprint() const = 0; + virtual UniquePtr GetFmtp() const = 0; + virtual UniquePtr GetGroup() const = 0; + virtual UniquePtr GetIceOptions() const = 0; + virtual std::string GetIcePwd() const = 0; + virtual std::string GetIceUfrag() const = 0; + virtual UniquePtr GetIdentity() const = 0; + virtual UniquePtr GetImageattr() const = 0; + virtual std::string GetLabel() const = 0; + virtual unsigned int GetMaxprate() const = 0; + virtual unsigned int GetMaxptime() const = 0; + virtual std::string GetMid() const = 0; + virtual UniquePtr GetMsid() const = 0; + virtual unsigned int GetPtime() const = 0; + virtual UniquePtr GetRtcp() const = 0; + virtual UniquePtr GetRtcpFb() const = 0; + virtual UniquePtr GetRemoteCandidates() const = 0; + virtual UniquePtr GetRtpmap() const = 0; + virtual UniquePtr GetSctpmap() const = 0; + virtual UniquePtr GetSetup() const = 0; + virtual UniquePtr GetSsrc() const = 0; + virtual UniquePtr GetSsrcGroup() const = 0; + + virtual SetAttribute(const SdpAttribute &) = 0; +}; } diff --git a/media/webrtc/signaling/src/sdp/SdpEnum.h b/media/webrtc/signaling/src/sdp/SdpEnum.h index f85b43b26031f..2aa89329b2c95 100644 --- a/media/webrtc/signaling/src/sdp/SdpEnum.h +++ b/media/webrtc/signaling/src/sdp/SdpEnum.h @@ -65,42 +65,42 @@ enum Protocol { }; enum AttributeType { - kBundleOnly, - kCandidate, - kConnection, - kDtlsFingerprint, - kExtmap, - kFingerprint, - kFmtp, - kGroup, - kIceLite, - kIceMismatch, - kIceOptions, - kIcePwd, - kIceUfrag, - kIdentity, - kImageattr, - kInactive, - kLabel, - kMaxprate, - kMaxptime, - kMid, - kMsid, - kPtime, - kRecvonly, - kRemoteCandidates, - kRtcp, - kRtcpFb, - kRtcpMux, - kRtcpRsize, - kRtpmap, - kSctpmap, - kSendonly, - kSendrecv, - kSetup, - kSsrc, - kSsrcGroup, - kOther + kBundleOnlyAttribute, + kCandidateAttribute, + kConnectionAttribute, + kDtlsFingerprintAttribute, + kExtmapAttribute, + kFingerprintAttribute, + kFmtpAttribute, + kGroupAttribute, + kIceLiteAttribute, + kIceMismatchAttribute, + kIceOptionsAttribute, + kIcePwdAttribute, + kIceUfragAttribute, + kIdentityAttribute, + kImageattrAttribute, + kInactiveAttribute, + kLabelAttribute, + kMaxprateAttribute, + kMaxptimeAttribute, + kMidAttribute, + kMsidAttribute, + kPtimeAttribute, + kRecvonlyAttribute, + kRemoteCandidatesAttribute, + kRtcpAttribute, + kRtcpFbAttribute, + kRtcpMuxAttribute, + kRtcpRsizeAttribute, + kRtpmapAttribute, + kSctpmapAttribute, + kSendonlyAttribute, + kSendrecvAttribute, + kSetupAttribute, + kSsrcAttribute, + kSsrcGroupAttribute, + kOtherAttribute }; } From 5d4b84ee61843e7add17b1d462b2b2c4aebe4868 Mon Sep 17 00:00:00 2001 From: Martin Thomson Date: Wed, 17 Sep 2014 15:41:17 -0700 Subject: [PATCH 2/3] Working on errors --- media/webrtc/signaling/src/sdp/Sdp.h | 2 +- media/webrtc/signaling/src/sdp/SdpEnum.h | 4 +- .../signaling/src/sdp/SdpMediaSection.h | 2 +- media/webrtc/signaling/src/sdp/SipccSdp.cpp | 4 +- media/webrtc/signaling/src/sdp/SipccSdp.h | 37 ++- .../signaling/src/sdp/SipccSdpAttributeList.h | 28 ++ .../src/sdp/SipccSdpMediaSection.cpp | 20 +- .../signaling/src/sdp/SipccSdpMediaSection.h | 13 +- .../signaling/src/sdp/SipccSdpParser.cpp | 21 +- .../webrtc/signaling/src/sdp/SipccSdpParser.h | 5 +- media/webrtc/signaling/src/sdp/sipcc/sdp.h | 6 +- .../signaling/src/sdp/sipcc/sdp_config.c | 10 +- .../webrtc/signaling/src/sdp/sipcc/sdp_main.c | 5 +- .../signaling/src/sdp/sipcc/sdp_utils.c | 289 +++++++++--------- 14 files changed, 248 insertions(+), 198 deletions(-) create mode 100644 media/webrtc/signaling/src/sdp/SipccSdpAttributeList.h diff --git a/media/webrtc/signaling/src/sdp/Sdp.h b/media/webrtc/signaling/src/sdp/Sdp.h index e959fa8733094..34143469983b5 100644 --- a/media/webrtc/signaling/src/sdp/Sdp.h +++ b/media/webrtc/signaling/src/sdp/Sdp.h @@ -25,7 +25,7 @@ class Sdp public: Sdp(); - virtual SdpOriginator GetOriginator() const = 0; + virtual SdpOrigin GetOriginator() const = 0; virtual std::string GetSessionName() const = 0; // Note: connection information is always retrieved from media sections virtual std::string GetBandwidth(std::string type) const = 0; diff --git a/media/webrtc/signaling/src/sdp/SdpEnum.h b/media/webrtc/signaling/src/sdp/SdpEnum.h index 2aa89329b2c95..c446bedc7e9fd 100644 --- a/media/webrtc/signaling/src/sdp/SdpEnum.h +++ b/media/webrtc/signaling/src/sdp/SdpEnum.h @@ -23,7 +23,7 @@ enum MediaType { kText, kApplication, kMessage, - kUnknown + kUnknownMediaType }; enum Protocol { @@ -61,7 +61,7 @@ enum Protocol { kTcpTlsMrcpv2, // TCP/TLS/MRCPv2 [RFC6787] kPstn, // PSTN [RFC7195] kUdpTlsUdptl, // UDP/TLS/UDPTL [RFC7345] - kUnknown + kUnknownProtocol }; enum AttributeType { diff --git a/media/webrtc/signaling/src/sdp/SdpMediaSection.h b/media/webrtc/signaling/src/sdp/SdpMediaSection.h index 81953b9097638..7e12b510c781a 100644 --- a/media/webrtc/signaling/src/sdp/SdpMediaSection.h +++ b/media/webrtc/signaling/src/sdp/SdpMediaSection.h @@ -18,7 +18,7 @@ class SdpMediaSection sdp::MediaType GetMediaType() const; unsigned int GetPort() const; unsigned int GetPortCount() const; - sdp::Protocol GetProtocol const; + sdp::Protocol GetProtocol() const; SdpConnection GetConnection() const; SdpBandwidth GetBandwidth() const; // optional, may repeat std::vector GetFormats() const; diff --git a/media/webrtc/signaling/src/sdp/SipccSdp.cpp b/media/webrtc/signaling/src/sdp/SipccSdp.cpp index 96f8b95402ecf..34287ac4aff70 100644 --- a/media/webrtc/signaling/src/sdp/SipccSdp.cpp +++ b/media/webrtc/signaling/src/sdp/SipccSdp.cpp @@ -9,18 +9,16 @@ namespace mozilla { const SdpMediaSection & SipccSdp::GetMediaSection(uint16_t level) const { - BuildMediaSections(); return mMediaSections[level]; } SdpMediaSection & SipccSdp::GetMediaSection(uint16_t level) { - BuildMediaSections(); return mMediaSections[level]; } void -SipccSdp::BuildMediaSections() { +SipccSdp::Load() { if (!mMediaSections.empty()) { return; } diff --git a/media/webrtc/signaling/src/sdp/SipccSdp.h b/media/webrtc/signaling/src/sdp/SipccSdp.h index 1bb4d6c7f24d6..5878b5563e120 100644 --- a/media/webrtc/signaling/src/sdp/SipccSdp.h +++ b/media/webrtc/signaling/src/sdp/SipccSdp.h @@ -6,12 +6,15 @@ #define _sdp_h_ #include -#include "Attributes.h" -#include "UniquePtr.h" +#include "mozilla/Attributes.h" +#include "mozilla/UniquePtr.h" #include "signaling/src/sdp/Sdp.h" #include "signaling/src/sdp/SipccSdpMediaSection.h" +#include "signaling/src/sdp/SipccSdpAttributeList.h" +extern "C" { #include "signaling/src/sdp/sipcc/sdp.h" +} namespace mozilla { @@ -20,17 +23,39 @@ class SipccSdpParser; class SipccSdp MOZ_FINAL : public Sdp { friend class SipccSdpParser; - ~SipccSdp() - { +public: + ~SipccSdp() { sdp_free_description(mSdp); } + + const SdpAttributeList& GetAttributeList() const { + return mAttributeList; + } + SdpAttributeList& GetAttributeList() { + return mAttributeList; + } + + const SdpMediaSection &GetMediaSection(uint16_t level) const { + if (level >= mMediaSections.length()) { + MOZ_CRASH(); + } + return mMediaSections[level]; + } + SdpMediaSection &GetMediaSection(uint16_t level) { + if (level >= mMediaSections.length()) { + MOZ_CRASH(); + } + return mMediaSections[level]; + } + private: SipccSdp(sdp_t* sdp) : mSdp(sdp) {} - void BuildMediaSections(); + void Load(); sdp_t *mSdp; - std::vector mMediaLines; + std::vector mMediaSections; + SipccSdpAttributeList mAttributeList; }; } // namespace mozilla diff --git a/media/webrtc/signaling/src/sdp/SipccSdpAttributeList.h b/media/webrtc/signaling/src/sdp/SipccSdpAttributeList.h new file mode 100644 index 0000000000000..fe4323d17074f --- /dev/null +++ b/media/webrtc/signaling/src/sdp/SipccSdpAttributeList.h @@ -0,0 +1,28 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef _SIPCCSDPATTRIBUTELIST_H_ +#define _SIPCCSDPATTRIBUTELIST_H_ + +#include "signaling/src/sdp/SdpAttributeList.h" +extern "C" { +#include "signaling/src/sdp/sipcc/sdp.h" +} + +namespace mozilla { + +class SipccSdpMediaSection; + +class SipccSdpAttributeList : public SdpAttributeList +{ + friend class SipccSdpMediaSection; +public: +private: + SipccSdpAttributeList(sdp_t* sdp, uint16_t level) + : mSdp(sdp), mLevel(level) {} +}; + +} + +#endif diff --git a/media/webrtc/signaling/src/sdp/SipccSdpMediaSection.cpp b/media/webrtc/signaling/src/sdp/SipccSdpMediaSection.cpp index e199e6191263b..0a301b555e468 100644 --- a/media/webrtc/signaling/src/sdp/SipccSdpMediaSection.cpp +++ b/media/webrtc/signaling/src/sdp/SipccSdpMediaSection.cpp @@ -6,34 +6,28 @@ namespace mozilla { -sdp::MediaType -SipccSdpMediaSection::GetMediaType() const -{ - return *mMediaType; -} - void SipccSdpMediaSection::Load() { switch (sdp_get_media_type(mSdp, mLevel)) { case SDP_MEDIA_AUDIO: - mMediaType = kAudio; + mMediaType = sdp::kAudio; break; case SDP_MEDIA_VIDEO: - mMediaType = kVideo; + mMediaType = sdp::kVideo; break; case SDP_MEDIA_APPLICATION: - mMediaType = kApplication; + mMediaType = sdp::kApplication; break; case SDP_MEDIA_TEXT: - mMediaType = kText; + mMediaType = sdp::kText; break; case SDP_MEDIA_DATA: - mMediaType = kMessage; + mMediaType = sdp::kMessage; break; default: // TODO: log this - mMediaType = kUnknown; + mMediaType = sdp::kUnknownMediaType; break; } @@ -43,7 +37,7 @@ SipccSdpMediaSection::Load() switch (sdp_get_media_transport(mSdp, mLevel)) { // TODO add right protocols to sipcc default: - mProtocol = kUnknown; + mProtocol = sdp::kUnknownProtocol; } } diff --git a/media/webrtc/signaling/src/sdp/SipccSdpMediaSection.h b/media/webrtc/signaling/src/sdp/SipccSdpMediaSection.h index 3524209fa06d5..f062ea658b32d 100644 --- a/media/webrtc/signaling/src/sdp/SipccSdpMediaSection.h +++ b/media/webrtc/signaling/src/sdp/SipccSdpMediaSection.h @@ -5,15 +5,26 @@ #ifndef _SIPCCSDPMEDIASECTION_H_ #define _SIPCCSDPMEDIASECTION_H_ +#include "mozilla/Attributes.h" +#include "signaling/src/sdp/SdpMediaSection.h" +extern "C" { #include "signaling/src/sdp/sipcc/sdp.h" +} namespace mozilla { class SipccSdp; -class SipccSdpMediaSection : public SdpMediaSection +class SipccSdpMediaSection MOZ_FINAL : public SdpMediaSection { friend class SipccSdp; +public: + virtual sdp::MediaType + GetMediaType() const MOZ_OVERRIDE + { + return mMediaType; + } + private: SipccSdpMediaSection(sdp_t* sdp, uint16_t level) : mSdp(sdp), mLevel(level) {} diff --git a/media/webrtc/signaling/src/sdp/SipccSdpParser.cpp b/media/webrtc/signaling/src/sdp/SipccSdpParser.cpp index e5e95779459b4..cf7890aab6282 100644 --- a/media/webrtc/signaling/src/sdp/SipccSdpParser.cpp +++ b/media/webrtc/signaling/src/sdp/SipccSdpParser.cpp @@ -5,7 +5,9 @@ #include "signaling/src/sdp/SipccSdpParser.h" #include +extern "C" { #include "signaling/src/sdp/sipcc/sdp.h" +} namespace mozilla { @@ -22,9 +24,12 @@ SipccSdpParser::Parse(const std::string& sdpText) sdp_t *sdp = sdp_init_description(sipcc_config); if (sdp) { - sdp_result_e result = sdp_parse(sdp, &sdpText.c_str(), &sdpText.length()); + const char* rawString = sdpText.c_str() + sdp_result_e result = sdp_parse(sdp, &rawString, sdpText.length()); if (result == SDP_SUCCESS) { - return UniquePtr(new SipccSdp(sdp)); + SipccSdp* sipccSdp = new SipccSdp(sdp); + sipccSdp->Load(); + return UniquePtr(sipccSdp); } sdp_free_description(sdp); @@ -45,19 +50,11 @@ extern "C" { void sipcc_sdp_parser_error_handler(void *context, uint32_t line, const char *message) { - SipccSdpParser* parser = static_cast(context); - std::string err(message) + SipccSdpParser* parser = static_cast(context); + std::string err(message); parser->AddParseError(line, err); } } -void -SipccSdpParser::DumpToStream(std::ostream& output) const -{ - for (auto e = mErrors.begin(); e != mErrors.end(); ++e) { - output << e.first() << ": " << e.second() << endl; - } -} - } // namespace diff --git a/media/webrtc/signaling/src/sdp/SipccSdpParser.h b/media/webrtc/signaling/src/sdp/SipccSdpParser.h index a9adb3181e881..33f766f445d4d 100644 --- a/media/webrtc/signaling/src/sdp/SipccSdpParser.h +++ b/media/webrtc/signaling/src/sdp/SipccSdpParser.h @@ -7,9 +7,8 @@ #include #include -#include -#include "UniquePtr.h" +#include "mozilla/UniquePtr.h" #include "signaling/src/sdp/Sdp.h" @@ -36,8 +35,6 @@ class SipccSdpParser const std::vector >& GetParseErrors() const { return mErrors; } - void DumpToStream(std::ostream& output) const; - private: std::vector > mErrors; }; diff --git a/media/webrtc/signaling/src/sdp/sipcc/sdp.h b/media/webrtc/signaling/src/sdp/sipcc/sdp.h index 3b6853449f5d5..2c6bc3162ab38 100644 --- a/media/webrtc/signaling/src/sdp/sipcc/sdp.h +++ b/media/webrtc/signaling/src/sdp/sipcc/sdp.h @@ -1088,7 +1088,7 @@ typedef struct { /* Prototypes */ /* sdp_config.c */ -extern void *sdp_init_config(void); +extern sdp_conf_options_t *sdp_init_config(void); extern void sdp_appl_debug(void *config_p, sdp_debug_e debug_type, tinybool debug_flag); extern void sdp_require_version(void *config_p, tinybool version_required); @@ -1108,10 +1108,10 @@ extern void sdp_allow_choose(void *config_p, sdp_choose_param_e param, tinybool choose_allowed); /* sdp_main.c */ -extern sdp_t *sdp_init_description(const char *peerconnection, void *config_p); +extern sdp_t *sdp_init_description(sdp_conf_options_t *config_p); extern void sdp_debug(sdp_t *sdp_ptr, sdp_debug_e debug_type, tinybool debug_flag); extern void sdp_set_string_debug(sdp_t *sdp_ptr, const char *debug_str); -extern sdp_result_e sdp_parse(sdp_t *sdp_ptr, char **bufp, u16 len); +extern sdp_result_e sdp_parse(sdp_t *sdp_ptr, char **bufp, size_t len); extern sdp_result_e sdp_build(sdp_t *sdp_ptr, flex_string *fs); extern sdp_result_e sdp_free_description(sdp_t *sdp_ptr); extern void sdp_parse_error(sdp_t *sdp, const char *format, ...); diff --git a/media/webrtc/signaling/src/sdp/sipcc/sdp_config.c b/media/webrtc/signaling/src/sdp/sipcc/sdp_config.c index a6d4c4539f2b5..febe5ade156f6 100644 --- a/media/webrtc/signaling/src/sdp/sipcc/sdp_config.c +++ b/media/webrtc/signaling/src/sdp/sipcc/sdp_config.c @@ -41,7 +41,7 @@ tinybool sdp_verify_conf_ptr (sdp_conf_options_t *conf_p) * Parameters: None. * Returns: A handle for the configuration as a void ptr. */ -void *sdp_init_config () +sdp_conf_options_t *sdp_init_config () { int i; sdp_conf_options_t *conf_p; @@ -199,7 +199,7 @@ void sdp_require_timespec (void *config_p, tinybool timespec_required) * Returns: Nothing. */ void sdp_media_supported (void *config_p, sdp_media_e media_type, - tinybool media_supported) + tinybool media_supported) { sdp_conf_options_t *conf_p = (sdp_conf_options_t *)config_p; @@ -223,7 +223,7 @@ void sdp_media_supported (void *config_p, sdp_media_e media_type, * Returns: Nothing. */ void sdp_nettype_supported (void *config_p, sdp_nettype_e nettype, - tinybool nettype_supported) + tinybool nettype_supported) { sdp_conf_options_t *conf_p = (sdp_conf_options_t *)config_p; @@ -247,7 +247,7 @@ void sdp_nettype_supported (void *config_p, sdp_nettype_e nettype, * Returns: Nothing. */ void sdp_addrtype_supported (void *config_p, sdp_addrtype_e addrtype, - tinybool addrtype_supported) + tinybool addrtype_supported) { sdp_conf_options_t *conf_p = (sdp_conf_options_t *)config_p; @@ -271,7 +271,7 @@ void sdp_addrtype_supported (void *config_p, sdp_addrtype_e addrtype, * Returns: Nothing. */ void sdp_transport_supported (void *config_p, sdp_transport_e transport, - tinybool transport_supported) + tinybool transport_supported) { sdp_conf_options_t *conf_p = (sdp_conf_options_t *)config_p; diff --git a/media/webrtc/signaling/src/sdp/sipcc/sdp_main.c b/media/webrtc/signaling/src/sdp/sipcc/sdp_main.c index 3fa2257c0e182..355c932956d22 100644 --- a/media/webrtc/signaling/src/sdp/sipcc/sdp_main.c +++ b/media/webrtc/signaling/src/sdp/sipcc/sdp_main.c @@ -795,11 +795,10 @@ inline tinybool sdp_verify_sdp_ptr (sdp_t *sdp_p) * Parameters: config_p The config handle returned by sdp_init_config * Returns: A handle for a new SDP structure as a void ptr. */ -sdp_t *sdp_init_description (const char *peerconnection, void *config_p) +sdp_t *sdp_init_description (sdp_conf_options_t *conf_p) { int i; sdp_t *sdp_p; - sdp_conf_options_t *conf_p = (sdp_conf_options_t *)config_p; if (sdp_verify_conf_ptr(conf_p) == FALSE) { return (NULL); @@ -959,7 +958,7 @@ sdp_result_e sdp_validate_sdp (sdp_t *sdp_p) * if not, what type of error was encountered. The * information from the parse is stored in the sdp_p structure. */ -sdp_result_e sdp_parse (sdp_t *sdp_p, char **bufp, u16 len) +sdp_result_e sdp_parse (sdp_t *sdp_p, char **bufp, size_t len) { u8 i; u16 cur_level = SDP_SESSION_LEVEL; diff --git a/media/webrtc/signaling/src/sdp/sipcc/sdp_utils.c b/media/webrtc/signaling/src/sdp/sipcc/sdp_utils.c index ff8cc177b3a71..2165dd213a431 100644 --- a/media/webrtc/signaling/src/sdp/sipcc/sdp_utils.c +++ b/media/webrtc/signaling/src/sdp/sipcc/sdp_utils.c @@ -4,6 +4,7 @@ #include #include +#include #include "sdp_os_defs.h" #include "sdp.h" #include "sdp_private.h" @@ -141,7 +142,7 @@ verify_sdescriptions_mki (char *buf, char *mkiVal, u16 *mkiLen) char *ptr, mkiValBuf[SDP_SRTP_MAX_MKI_SIZE_BYTES], - mkiLenBuf[MKI_BUF_LEN]; + mkiLenBuf[MKI_BUF_LEN]; int idx = 0; unsigned long strtoul_result; char *strtoul_end; @@ -155,17 +156,17 @@ verify_sdescriptions_mki (char *buf, char *mkiVal, u16 *mkiLen) /* scan until we reach a non-digit or colon */ while (*ptr) { if (*ptr == ':') { - /* terminate the MKI value */ - mkiValBuf[idx] = 0; - ptr++; - break; - } else if ((isdigit((int) *ptr) && (idx < SDP_SRTP_MAX_MKI_SIZE_BYTES-1))) { - mkiValBuf[idx++] = *ptr; - } else { - return FALSE; - } - - ptr++; + /* terminate the MKI value */ + mkiValBuf[idx] = 0; + ptr++; + break; + } else if ((isdigit((int) *ptr) && (idx < SDP_SRTP_MAX_MKI_SIZE_BYTES-1))) { + mkiValBuf[idx++] = *ptr; + } else { + return FALSE; + } + + ptr++; } /* there has to be a mki length */ @@ -178,12 +179,12 @@ verify_sdescriptions_mki (char *buf, char *mkiVal, u16 *mkiLen) /* verify the mki length (max 3 digits) */ while (*ptr) { if (isdigit((int) *ptr) && (idx < 3)) { - mkiLenBuf[idx++] = *ptr; - } else { - return FALSE; - } + mkiLenBuf[idx++] = *ptr; + } else { + return FALSE; + } - ptr++; + ptr++; } mkiLenBuf[idx] = 0; @@ -231,21 +232,21 @@ verify_sdescriptions_lifetime (char *buf) while (*ptr) { if (*ptr == '^') { - if (tokenFound) { - /* make sure we don't have multiple ^ */ + if (tokenFound) { + /* make sure we don't have multiple ^ */ return FALSE; } else { tokenFound = TRUE; /* Lifetime is in power of 2 format, make sure first and second - * chars are 2^ - */ + * chars are 2^ + */ if (buf[0] != '2' || buf[1] != '^') { - return FALSE; + return FALSE; } } } else if (!isdigit((int) *ptr)) { - return FALSE; + return FALSE; } ptr++; @@ -255,8 +256,8 @@ verify_sdescriptions_lifetime (char *buf) /* Make sure if the format is 2^ that there is a number after the ^. */ if (tokenFound) { if (strlen(buf) <= 2) { - return FALSE; - } + return FALSE; + } } return TRUE; @@ -301,11 +302,11 @@ char *sdp_findchar (const char *ptr, char *char_list) int i; for (;*ptr != '\0'; ptr++) { - for (i=0; char_list[i] != '\0'; i++) { - if (*ptr == char_list[i]) { - return ((char *)ptr); - } - } + for (i=0; char_list[i] != '\0'; i++) { + if (*ptr == char_list[i]) { + return ((char *)ptr); + } + } } return ((char *)ptr); } @@ -547,16 +548,16 @@ static const int star_strlen = sizeof(star_string) - 1; #define CHAR_IS_WHITESPACE(_test_char) \ ((((_test_char)==' ')||((_test_char)=='\t'))?1:0) -#define SKIP_WHITESPACE(_cptr, _max_cptr) \ - while ((_cptr)<=(_max_cptr)) { \ - if (!CHAR_IS_WHITESPACE(*(_cptr))) break; \ - (_cptr)++; \ +#define SKIP_WHITESPACE(_cptr, _max_cptr) \ + while ((_cptr)<=(_max_cptr)) { \ + if (!CHAR_IS_WHITESPACE(*(_cptr))) break; \ + (_cptr)++; \ } -#define FIND_WHITESPACE(_cptr, _max_cptr) \ - while ((_cptr)<=(_max_cptr)) { \ - if (CHAR_IS_WHITESPACE(*(_cptr))) break; \ - (_cptr)++; \ +#define FIND_WHITESPACE(_cptr, _max_cptr) \ + while ((_cptr)<=(_max_cptr)) { \ + if (CHAR_IS_WHITESPACE(*(_cptr))) break; \ + (_cptr)++; \ } /* Function: sdp_crypto_debug @@ -582,59 +583,59 @@ void sdp_crypto_debug (char *buffer, ulong length_bytes) * Where is the data to elide (filter). */ for (start=current=buffer; - current<=last-MIN_CRYPTO_STRING_SIZE_BYTES; - current++) { - if ((*current == 'x') || (*current == 'X')) { - result = cpr_strncasecmp(current, crypto_string, crypto_strlen); - if (!result) { - current += crypto_strlen; - if (current > last) break; - - /* Skip over crypto suite name */ - FIND_WHITESPACE(current, last); - - /* Skip over whitespace */ - SKIP_WHITESPACE(current, last); - - /* identify inline keyword */ - result = cpr_strncasecmp(current, inline_string, inline_strlen); - if (!result) { - int star_count = 0; - - current += inline_strlen; - if (current > last) break; - - sdp_dump_buffer(start, current - start); - - /* Hide sensitive key/salt data */ - while (current<=last) { - if (*current == '|' || *current == '\n') { - /* Done, print the stars */ - while (star_count > star_strlen) { - /* - * This code is only for the case where - * too much base64 data was supplied - */ - sdp_dump_buffer((char*)star_string, star_strlen); - star_count -= star_strlen; - } - sdp_dump_buffer((char*)star_string, star_count); - break; - } else { - star_count++; - current++; - } - } - /* Update start pointer */ - start=current; - } - } - } + current<=last-MIN_CRYPTO_STRING_SIZE_BYTES; + current++) { + if ((*current == 'x') || (*current == 'X')) { + result = cpr_strncasecmp(current, crypto_string, crypto_strlen); + if (!result) { + current += crypto_strlen; + if (current > last) break; + + /* Skip over crypto suite name */ + FIND_WHITESPACE(current, last); + + /* Skip over whitespace */ + SKIP_WHITESPACE(current, last); + + /* identify inline keyword */ + result = cpr_strncasecmp(current, inline_string, inline_strlen); + if (!result) { + int star_count = 0; + + current += inline_strlen; + if (current > last) break; + + sdp_dump_buffer(start, current - start); + + /* Hide sensitive key/salt data */ + while (current<=last) { + if (*current == '|' || *current == '\n') { + /* Done, print the stars */ + while (star_count > star_strlen) { + /* + * This code is only for the case where + * too much base64 data was supplied + */ + sdp_dump_buffer((char*)star_string, star_strlen); + star_count -= star_strlen; + } + sdp_dump_buffer((char*)star_string, star_count); + break; + } else { + star_count++; + current++; + } + } + /* Update start pointer */ + start=current; + } + } + } } if (last > start) { - /* Display remainder of buffer */ - sdp_dump_buffer(start, last - start); + /* Display remainder of buffer */ + sdp_dump_buffer(start, last - start); } } @@ -661,46 +662,46 @@ char * sdp_debug_msg_filter (char *buffer, ulong length_bytes) int result; SDP_PRINT("\n%s:%d: Eliding sensitive data from debug output", - __FILE__, __LINE__); + __FILE__, __LINE__); /* * For SRTP Master Key/Salt has the form: * X-crypto: inline:|| * Where is the data to elide (filter). */ for (current=buffer; - current<=last-MIN_CRYPTO_STRING_SIZE_BYTES; - current++) { - if ((*current == 'x') || (*current == 'X')) { - result = cpr_strncasecmp(current, crypto_string, crypto_strlen); - if (!result) { - current += crypto_strlen; - if (current > last) break; - - /* Skip over crypto suite name */ - FIND_WHITESPACE(current, last); - - /* Skip over whitespace */ - SKIP_WHITESPACE(current, last); - - /* identify inline keyword */ - result = cpr_strncasecmp(current, inline_string, inline_strlen); - if (!result) { - current += inline_strlen; - if (current > last) break; - - /* Hide sensitive key/salt data */ - while (current<=last) { - if (*current == '|' || *current == '\n') { - /* Done */ - break; - } else { - *current = '*'; - current++; - } - } - } - } - } + current<=last-MIN_CRYPTO_STRING_SIZE_BYTES; + current++) { + if ((*current == 'x') || (*current == 'X')) { + result = cpr_strncasecmp(current, crypto_string, crypto_strlen); + if (!result) { + current += crypto_strlen; + if (current > last) break; + + /* Skip over crypto suite name */ + FIND_WHITESPACE(current, last); + + /* Skip over whitespace */ + SKIP_WHITESPACE(current, last); + + /* identify inline keyword */ + result = cpr_strncasecmp(current, inline_string, inline_strlen); + if (!result) { + current += inline_strlen; + if (current > last) break; + + /* Hide sensitive key/salt data */ + while (current<=last) { + if (*current == '|' || *current == '\n') { + /* Done */ + break; + } else { + *current = '*'; + current++; + } + } + } + } + } } return buffer; @@ -741,28 +742,28 @@ tinybool sdp_checkrange (sdp_t *sdp_p, char *num, ulong *u_val) if (*endP == '\0') { if (l_val > 4294967295UL) { - if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) { - CSFLogError(logTag, "%s ERROR: Parameter value: %s is greater than 4294967295", - sdp_p->debug_str, num); - } - return FALSE; - } - - if (l_val == 4294967295UL) { - /* - * On certain platforms where ULONG_MAX is equivalent to - * 4294967295, strtoul will return ULONG_MAX even if the the - * value of the string is greater than 4294967295. To detect - * that scenario we make an explicit check here. - */ - if (strcmp("4294967295", num)) { - if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) { - CSFLogError(logTag, "%s ERROR: Parameter value: %s is greater than 4294967295", - sdp_p->debug_str, num); - } - return FALSE; - } - } + if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) { + CSFLogError(logTag, "%s ERROR: Parameter value: %s is greater than 4294967295", + sdp_p->debug_str, num); + } + return FALSE; + } + + if (l_val == 4294967295UL) { + /* + * On certain platforms where ULONG_MAX is equivalent to + * 4294967295, strtoul will return ULONG_MAX even if the the + * value of the string is greater than 4294967295. To detect + * that scenario we make an explicit check here. + */ + if (strcmp("4294967295", num)) { + if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) { + CSFLogError(logTag, "%s ERROR: Parameter value: %s is greater than 4294967295", + sdp_p->debug_str, num); + } + return FALSE; + } + } } *u_val = l_val; return TRUE; From b60d84f7198b1f42c1e25712212b0380ca84955e Mon Sep 17 00:00:00 2001 From: Martin Thomson Date: Wed, 17 Sep 2014 15:50:30 -0700 Subject: [PATCH 3/3] Moving attribute lists around --- media/webrtc/signaling/signaling.gyp | 2 + media/webrtc/signaling/src/sdp/Sdp.h | 2 +- media/webrtc/signaling/src/sdp/SdpAttribute.h | 42 +------------- .../signaling/src/sdp/SdpAttributeList.h | 56 +++++++++++++++++++ 4 files changed, 61 insertions(+), 41 deletions(-) create mode 100644 media/webrtc/signaling/src/sdp/SdpAttributeList.h diff --git a/media/webrtc/signaling/signaling.gyp b/media/webrtc/signaling/signaling.gyp index af7c55cc55aef..d4a14c59cf703 100644 --- a/media/webrtc/signaling/signaling.gyp +++ b/media/webrtc/signaling/signaling.gyp @@ -132,9 +132,11 @@ './src/sdp/Sdp.h', './src/sdp/SdpAttribute.h', + './src/sdp/SdpAttributeList.h', './src/sdp/SdpEnum.h', './src/sdp/SdpMediaSection.h', './src/sdp/SipccSdp.h', + './src/sdp/SipccSdpAttributeList.h', './src/sdp/SipccSdpMediaSection.h', './src/sdp/SipccSdpParser.h', './src/sdp/SipccSdp.cpp', diff --git a/media/webrtc/signaling/src/sdp/Sdp.h b/media/webrtc/signaling/src/sdp/Sdp.h index 34143469983b5..a919bf8dc4e04 100644 --- a/media/webrtc/signaling/src/sdp/Sdp.h +++ b/media/webrtc/signaling/src/sdp/Sdp.h @@ -25,7 +25,7 @@ class Sdp public: Sdp(); - virtual SdpOrigin GetOriginator() const = 0; + virtual SdpOrigin GetOrigin() const = 0; virtual std::string GetSessionName() const = 0; // Note: connection information is always retrieved from media sections virtual std::string GetBandwidth(std::string type) const = 0; diff --git a/media/webrtc/signaling/src/sdp/SdpAttribute.h b/media/webrtc/signaling/src/sdp/SdpAttribute.h index 14529439bce24..df15250b84d76 100644 --- a/media/webrtc/signaling/src/sdp/SdpAttribute.h +++ b/media/webrtc/signaling/src/sdp/SdpAttribute.h @@ -2,8 +2,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef _SDP_ATTRIBUTE_H_ -#define _SDP_ATTRIBUTE_H_ +#ifndef _SDPATTRIBUTE_H_ +#define _SDPATTRIBUTE_H_ #include "mozilla/UniquePtr.h" #include "mozilla/Attributes.h" @@ -509,44 +509,6 @@ class SdpOtherAttribute : public SdpAttribute std::string mValue; }; -class SdpAttributeList -{ -public: - virtual unsigned int CountAttributes(SdpAttributeType type) const = 0; - virtual bool HasAttribute(SdpAttributeType type) const = 0; - - virtual UniquePtr - GetAttribute(sdp::AttributeType type) const = 0; - - virtual UniquePtr GetCandidate() const = 0; - virtual UniquePtr GetConnection() const = 0; - virtual UniquePtr GetExtmap() const = 0; - virtual UniquePtr GetFingerprint() const = 0; - virtual UniquePtr GetFmtp() const = 0; - virtual UniquePtr GetGroup() const = 0; - virtual UniquePtr GetIceOptions() const = 0; - virtual std::string GetIcePwd() const = 0; - virtual std::string GetIceUfrag() const = 0; - virtual UniquePtr GetIdentity() const = 0; - virtual UniquePtr GetImageattr() const = 0; - virtual std::string GetLabel() const = 0; - virtual unsigned int GetMaxprate() const = 0; - virtual unsigned int GetMaxptime() const = 0; - virtual std::string GetMid() const = 0; - virtual UniquePtr GetMsid() const = 0; - virtual unsigned int GetPtime() const = 0; - virtual UniquePtr GetRtcp() const = 0; - virtual UniquePtr GetRtcpFb() const = 0; - virtual UniquePtr GetRemoteCandidates() const = 0; - virtual UniquePtr GetRtpmap() const = 0; - virtual UniquePtr GetSctpmap() const = 0; - virtual UniquePtr GetSetup() const = 0; - virtual UniquePtr GetSsrc() const = 0; - virtual UniquePtr GetSsrcGroup() const = 0; - - virtual SetAttribute(const SdpAttribute &) = 0; -}; - } #endif diff --git a/media/webrtc/signaling/src/sdp/SdpAttributeList.h b/media/webrtc/signaling/src/sdp/SdpAttributeList.h new file mode 100644 index 0000000000000..60417be4af923 --- /dev/null +++ b/media/webrtc/signaling/src/sdp/SdpAttributeList.h @@ -0,0 +1,56 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef _SDPATTRIBUTELIST_H_ +#define _SDPATTRIBUTELIST_H_ + +#include "mozilla/UniquePtr.h" +#include "mozilla/Attributes.h" + +#include "signaling/src/sdp/SdpEnum.h" +#include "signaling/src/sdp/SdpAttribute.h" + +namespace mozilla { + +class SdpAttributeList +{ +public: + virtual unsigned int CountAttributes(SdpAttributeType type) const = 0; + virtual bool HasAttribute(SdpAttributeType type) const = 0; + + virtual UniquePtr + GetAttribute(sdp::AttributeType type) const = 0; + + virtual UniquePtr GetCandidate() const = 0; + virtual UniquePtr GetConnection() const = 0; + virtual UniquePtr GetExtmap() const = 0; + virtual UniquePtr GetFingerprint() const = 0; + virtual UniquePtr GetFmtp() const = 0; + virtual UniquePtr GetGroup() const = 0; + virtual UniquePtr GetIceOptions() const = 0; + virtual std::string GetIcePwd() const = 0; + virtual std::string GetIceUfrag() const = 0; + virtual UniquePtr GetIdentity() const = 0; + virtual UniquePtr GetImageattr() const = 0; + virtual std::string GetLabel() const = 0; + virtual unsigned int GetMaxprate() const = 0; + virtual unsigned int GetMaxptime() const = 0; + virtual std::string GetMid() const = 0; + virtual UniquePtr GetMsid() const = 0; + virtual unsigned int GetPtime() const = 0; + virtual UniquePtr GetRtcp() const = 0; + virtual UniquePtr GetRtcpFb() const = 0; + virtual UniquePtr GetRemoteCandidates() const = 0; + virtual UniquePtr GetRtpmap() const = 0; + virtual UniquePtr GetSctpmap() const = 0; + virtual UniquePtr GetSetup() const = 0; + virtual UniquePtr GetSsrc() const = 0; + virtual UniquePtr GetSsrcGroup() const = 0; + + virtual SetAttribute(const SdpAttribute &) = 0; +}; + +} + +#endif