/src/resiprocate/resip/stack/TrickleIceContents.hxx
Line | Count | Source |
1 | | #if !defined(RESIP_TRICKLEICECONTENTS_HXX) |
2 | | #define RESIP_TRICKLEICECONTENTS_HXX |
3 | | |
4 | | #include "resip/stack/Contents.hxx" |
5 | | #include "resip/stack/SdpContents.hxx" |
6 | | #include "rutil/Data.hxx" |
7 | | #include "rutil/HashMap.hxx" |
8 | | #include "rutil/ParseBuffer.hxx" |
9 | | #include "rutil/XMLCursor.hxx" |
10 | | |
11 | | namespace resip |
12 | | { |
13 | | |
14 | | /* Provides a way to handle the application/trickle-ice-sdpfrag |
15 | | content-type from SIP INFO messages. |
16 | | Attempts to adhere to the IETF RFC 8840 |
17 | | https://datatracker.ietf.org/doc/html/rfc8840 |
18 | | */ |
19 | | |
20 | | class TrickleIceContents : public Contents |
21 | | { |
22 | | |
23 | | public: |
24 | | |
25 | | TrickleIceContents(); |
26 | | TrickleIceContents(const HeaderFieldValue& hfv, const Mime& contentTypes); |
27 | | TrickleIceContents(const TrickleIceContents& rhs); |
28 | | virtual ~TrickleIceContents(); |
29 | | |
30 | | TrickleIceContents& operator=(const TrickleIceContents& rhs); |
31 | | |
32 | | /** @brief duplicate an TrickleIceContents object |
33 | | * |
34 | | * @return pointer to a new TrickleIceContents object |
35 | | **/ |
36 | | virtual Contents* clone() const override; |
37 | | |
38 | | virtual EncodeStream& encodeParsed(EncodeStream& str) const override; |
39 | | virtual void parse(ParseBuffer& pb) override; |
40 | | static const Mime& getStaticType(); |
41 | | |
42 | | void addAttribute(const Data& key, const Data& value = Data::Empty); |
43 | | void addMedium(const SdpContents::Session::Medium& medium); |
44 | | |
45 | | static bool init(); |
46 | | |
47 | 0 | const SdpContents::Session::MediumContainer& media() const {checkParsed(); return mMedia;} |
48 | | |
49 | | const std::list<Data>& getValues(const Data& key) const; |
50 | | |
51 | | private: |
52 | | AttributeHelper mAttributeHelper; |
53 | | SdpContents::Session::MediumContainer mMedia; |
54 | | }; |
55 | | |
56 | | static bool invokeTrickleIceContentsInit = TrickleIceContents::init(); |
57 | | |
58 | | } |
59 | | |
60 | | |
61 | | #endif |
62 | | |
63 | | /* ==================================================================== |
64 | | * |
65 | | * Copyright (c) 2022, Daniel Pocock, https://danielpocock.com |
66 | | * Copyright (c) 2022, Software Freedom Institute LLC, https://softwarefreedom.institute |
67 | | * |
68 | | * Redistribution and use in source and binary forms, with or without |
69 | | * modification, are permitted provided that the following conditions |
70 | | * are met: |
71 | | * |
72 | | * 1. Redistributions of source code must retain the above copyright |
73 | | * notice, this list of conditions and the following disclaimer. |
74 | | * |
75 | | * 2. Redistributions in binary form must reproduce the above copyright |
76 | | * notice, this list of conditions and the following disclaimer in |
77 | | * the documentation and/or other materials provided with the |
78 | | * distribution. |
79 | | * |
80 | | * 3. Neither the name of the author(s) nor the names of any contributors |
81 | | * may be used to endorse or promote products derived from this software |
82 | | * without specific prior written permission. |
83 | | * |
84 | | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND |
85 | | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
86 | | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
87 | | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE |
88 | | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
89 | | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
90 | | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
91 | | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
92 | | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
93 | | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
94 | | * SUCH DAMAGE. |
95 | | * |
96 | | * ==================================================================== |
97 | | * |
98 | | * |
99 | | */ |
100 | | |