SdpAttributeList.h (3627B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 5 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef _SDPATTRIBUTELIST_H_ 8 #define _SDPATTRIBUTELIST_H_ 9 10 #include "sdp/SdpAttribute.h" 11 12 namespace mozilla { 13 14 class SdpAttributeList { 15 public: 16 virtual ~SdpAttributeList() {} 17 typedef SdpAttribute::AttributeType AttributeType; 18 19 // Avoid default params on virtual functions 20 bool HasAttribute(AttributeType type) const { 21 return HasAttribute(type, true); 22 } 23 24 const SdpAttribute* GetAttribute(AttributeType type) const { 25 return GetAttribute(type, true); 26 } 27 28 virtual bool HasAttribute(AttributeType type, bool sessionFallback) const = 0; 29 virtual const SdpAttribute* GetAttribute(AttributeType type, 30 bool sessionFallback) const = 0; 31 // The setter takes an attribute of any type, and takes ownership 32 virtual void SetAttribute(SdpAttribute* attr) = 0; 33 virtual void RemoveAttribute(AttributeType type) = 0; 34 virtual void Clear() = 0; 35 virtual uint32_t Count() const = 0; 36 37 virtual const SdpConnectionAttribute& GetConnection() const = 0; 38 virtual const SdpOptionsAttribute& GetIceOptions() const = 0; 39 virtual const SdpRtcpAttribute& GetRtcp() const = 0; 40 virtual const SdpRemoteCandidatesAttribute& GetRemoteCandidates() const = 0; 41 virtual const SdpSetupAttribute& GetSetup() const = 0; 42 virtual const SdpDtlsMessageAttribute& GetDtlsMessage() const = 0; 43 44 // These attributes can appear multiple times, so the returned 45 // classes actually represent a collection of values. 46 virtual const std::vector<std::string>& GetCandidate() const = 0; 47 virtual const SdpExtmapAttributeList& GetExtmap() const = 0; 48 virtual const SdpFingerprintAttributeList& GetFingerprint() const = 0; 49 virtual const SdpFmtpAttributeList& GetFmtp() const = 0; 50 virtual const SdpGroupAttributeList& GetGroup() const = 0; 51 virtual const SdpImageattrAttributeList& GetImageattr() const = 0; 52 virtual const SdpSimulcastAttribute& GetSimulcast() const = 0; 53 virtual const SdpMsidAttributeList& GetMsid() const = 0; 54 virtual const SdpMsidSemanticAttributeList& GetMsidSemantic() const = 0; 55 virtual const SdpRidAttributeList& GetRid() const = 0; 56 virtual const SdpRtcpFbAttributeList& GetRtcpFb() const = 0; 57 virtual const SdpRtpmapAttributeList& GetRtpmap() const = 0; 58 virtual const SdpSctpmapAttributeList& GetSctpmap() const = 0; 59 virtual uint32_t GetSctpPort() const = 0; 60 virtual uint32_t GetMaxMessageSize() const = 0; 61 virtual const SdpSsrcAttributeList& GetSsrc() const = 0; 62 virtual const SdpSsrcGroupAttributeList& GetSsrcGroup() const = 0; 63 64 // These attributes are effectively simple types, so we'll make life 65 // easy by just returning their value. 66 virtual const std::string& GetIcePwd() const = 0; 67 virtual const std::string& GetIceUfrag() const = 0; 68 virtual const std::string& GetIdentity() const = 0; 69 virtual const std::string& GetLabel() const = 0; 70 virtual unsigned int GetMaxptime() const = 0; 71 virtual const std::string& GetMid() const = 0; 72 virtual unsigned int GetPtime() const = 0; 73 74 // This is "special", because it's multiple things 75 virtual SdpDirectionAttribute::Direction GetDirection() const = 0; 76 77 virtual void Serialize(std::ostream&) const = 0; 78 }; 79 80 inline std::ostream& operator<<(std::ostream& os, const SdpAttributeList& al) { 81 al.Serialize(os); 82 return os; 83 } 84 85 } // namespace mozilla 86 87 #endif