From 1fbcd104ad71120e9d8c83c3dbd30abc7307de22 Mon Sep 17 00:00:00 2001 From: Adam Roach Date: Wed, 17 Sep 2014 20:31:52 -0700 Subject: [PATCH] Making some attributes into lists --- media/webrtc/signaling/src/sdp/SdpAttribute.h | 28 +++++++-------- .../signaling/src/sdp/SdpAttributeList.h | 35 +++++++++++-------- 2 files changed, 35 insertions(+), 28 deletions(-) diff --git a/media/webrtc/signaling/src/sdp/SdpAttribute.h b/media/webrtc/signaling/src/sdp/SdpAttribute.h index b2e8993a8fe0d..6e87e2100e89e 100644 --- a/media/webrtc/signaling/src/sdp/SdpAttribute.h +++ b/media/webrtc/signaling/src/sdp/SdpAttribute.h @@ -87,10 +87,10 @@ class SdpAttribute // [SP rel-port] // *(SP extension-att-name SP // extension-att-value) -class SdpCandidateAttribute : public SdpAttribute +class SdpCandidateAttributeList : public SdpAttribute { public: - SdpCandidateAttribute() : + SdpCandidateAttributeList() : SdpAttribute(kCandidateAttribute, "candidate") {} }; @@ -130,10 +130,10 @@ class SdpConnectionAttribute : public SdpAttribute // SP = // // DIGIT = -class SdpExtmapAttribute : public SdpAttribute +class SdpExtmapAttributeList : public SdpAttribute { public: - SdpExtmapAttribute() : + SdpExtmapAttributeList() : SdpAttribute(kExtmapAttribute, "extmap") {} }; @@ -161,10 +161,10 @@ class SdpFingerprintAttribute : public SdpAttribute // RFC4566, RFC5576 // a=fmtp: -class SdpFmtpAttribute : public SdpAttribute +class SdpFmtpAttributeList : public SdpAttribute { public: - SdpFmtpAttribute() : + SdpFmtpAttributeList() : SdpAttribute(kFmtpAttribute, "fmtp") {} }; @@ -274,10 +274,10 @@ class SdpIdentityAttribute : public SdpAttribute // qvalue = ( "0" "." 1*2DIGIT ) // / ( "1" "." 1*2("0") ) // ; Values between 0.00 and 1.00 -class SdpImageattrAttribute : public SdpAttribute +class SdpImageattrAttributeList : public SdpAttribute { public: - SdpImageattrAttribute() : + SdpImageattrAttributeList() : SdpAttribute(kImageattrAttribute, "imageattr") {} }; @@ -341,19 +341,19 @@ class SdpRtcpAttribute : public SdpAttribute // / SP "app" [SP byte-string] // / SP token [SP byte-string] // / ; empty -class SdpRtcpFbAttribute : public SdpAttribute +class SdpRtcpFbAttributeList : public SdpAttribute { public: - SdpRtcpFbAttribute() : + SdpRtcpFbAttributeList() : SdpAttribute(kRtcpFbAttribute, "rtcp-fb") {} }; // RFC4566 // a=rtpmap: / [/] -class SdpRtpmapAttribute : public SdpAttribute +class SdpRtpmapAttributeList : public SdpAttribute { public: - SdpRtpmapAttribute() : + SdpRtpmapAttributeList() : SdpAttribute(kRtpmapAttribute, "rtpmap") {} }; @@ -366,10 +366,10 @@ class SdpRtpmapAttribute : public SdpAttribute // streams = "streams" EQUALS 1*DIGIT" // (draft-07 appears to have done something really funky here, but I // don't beleive it). -class SdpSctpmapAttribute : public SdpAttribute +class SdpSctpmapAttributeList : public SdpAttribute { public: - SdpSctpmapAttribute() : + SdpSctpmapAttributeList() : SdpAttribute(kSctpmapAttribute, "sctpmap") {} }; diff --git a/media/webrtc/signaling/src/sdp/SdpAttributeList.h b/media/webrtc/signaling/src/sdp/SdpAttributeList.h index c72def019c6c3..400170dba4e5e 100644 --- a/media/webrtc/signaling/src/sdp/SdpAttributeList.h +++ b/media/webrtc/signaling/src/sdp/SdpAttributeList.h @@ -24,32 +24,39 @@ class SdpAttributeList virtual bool HasAttribute(AttributeType type) const = 0; virtual const SdpAttribute& GetAttribute(AttributeType type, size_t index = 0) const = 0; - virtual const SdpCandidateAttribute& GetCandidate() const = 0; virtual const SdpConnectionAttribute& GetConnection() const = 0; - virtual const SdpExtmapAttribute& GetExtmap() const = 0; virtual const SdpFingerprintAttribute& GetFingerprint() const = 0; - virtual const SdpFmtpAttribute& GetFmtp() const = 0; virtual const SdpGroupAttribute& GetGroup() const = 0; virtual const SdpIceOptionsAttribute& GetIceOptions() const = 0; - virtual const std::string& GetIcePwd() const = 0; - virtual const std::string& GetIceUfrag() const = 0; virtual const SdpIdentityAttribute& GetIdentity() const = 0; - virtual const SdpImageattrAttribute& GetImageattr() const = 0; - virtual const std::string& GetLabel() const = 0; - virtual uint32_t GetMaxprate() const = 0; - virtual uint32_t GetMaxptime() const = 0; - virtual const std::string& GetMid() const = 0; virtual const SdpMsidAttribute& GetMsid() const = 0; - virtual uint32_t GetPtime() const = 0; virtual const SdpRtcpAttribute& GetRtcp() const = 0; - virtual const SdpRtcpFbAttribute& GetRtcpFb() const = 0; virtual const SdpRemoteCandidatesAttribute& GetRemoteCandidates() const = 0; - virtual const SdpRtpmapAttribute& GetRtpmap() const = 0; - virtual const SdpSctpmapAttribute& GetSctpmap() const = 0; virtual const SdpSetupAttribute& GetSetup() const = 0; virtual const SdpSsrcAttribute& GetSsrc() const = 0; virtual const SdpSsrcGroupAttribute& GetSsrcGroup() const = 0; + // These attributes can appear multiple times, so the returned + // classes actually represent a collection of values. + virtual const SdpCandidateAttributeList& GetCandidate() const = 0; + virtual const SdpExtmapAttributeList& GetExtmap() const = 0; + virtual const SdpFmtpAttributeList& GetFmtp() const = 0; + virtual const SdpImageattrAttributeList& GetImageattr() const = 0; + virtual const SdpRtcpFbAttributeList& GetRtcpFb() const = 0; + virtual const SdpRtpmapAttributeList& GetRtpmap() const = 0; + virtual const SdpSctpmapAttributeList& GetSctpmap() const = 0; + + // These attributes are effectively simple types, so we'll make life + // easy by just returning their value. + virtual const std::string& GetIcePwd() const = 0; + virtual const std::string& GetIceUfrag() const = 0; + virtual const std::string& GetLabel() const = 0; + virtual unsigned int GetMaxprate() const = 0; + virtual unsigned int GetMaxptime() const = 0; + virtual const std::string& GetMid() const = 0; + virtual unsigned int GetPtime() const = 0; + + // The setter takes an attribute of any type, and Does The Right Thing™ virtual void SetAttribute(const SdpAttribute &) = 0; };