reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
TrickleIceContents.cxx
Go to the documentation of this file.
1#if defined(HAVE_CONFIG_H)
2#include "config.h"
3#endif
4
10#include "rutil/Logger.hxx"
13
14#define RESIPROCATE_SUBSYSTEM resip::Subsystem::SDP
15
16using namespace resip;
17using namespace std;
18
19//const TrickleIceContents TrickleIceContents::Empty;
20
21bool
23{
25 (void)factory;
26 return true;
27}
28
32
34 : Contents(hfv, contentTypes)
35{
36}
37
39 : Contents(rhs)
40{
41 *this = rhs;
42}
43
47
50{
51 if (this != &rhs)
52 {
54 mMedia = rhs.mMedia;
55 mAttributeHelper = rhs.mAttributeHelper;
56
57 /*for (MediumContainer::iterator i=mMedia.begin(); i != mMedia.end(); ++i)
58 {
59 i->setSession(this);
60 }*/
61 }
62 return *this;
63}
64
67{
68 return new TrickleIceContents(*this);
69}
70
73{
74 mAttributeHelper.encode(s);
75 for (SdpContents::Session::MediumContainer::const_iterator i = mMedia.begin();
76 i != mMedia.end(); ++i)
77 {
78 i->encode(s);
79 }
80 return s;
81}
82
83void
85{
86 mMedia.push_back(medium);
87 // mMedia.back().setSession(this);
88}
89
90void
92{
93 mAttributeHelper.addAttribute(key, value);
94}
95
96const list<Data>&
98{
100 if (mAttributeHelper.exists(key))
101 {
102 return mAttributeHelper.getValues(key);
103 }
104 //if (!mSession)
105 {
106 resip_assert(false);
107 static list<Data> error;
108 return error;
109 }
110 //return mSession->getValues(key);
111}
112
113void
115{
116 mAttributeHelper.parse(pb);
117
118 while (!pb.eof() && *pb.position() == 'm')
119 {
121 mMedia.back().parse(pb);
122 }
123}
124
125const Mime&
127{
128 static Mime type("application", "trickle-ice-sdpfrag");
129 return type;
130}
131
132/* ====================================================================
133 *
134 * Copyright (c) 2022, Daniel Pocock, https://danielpocock.com
135 * Copyright (c) 2022, Software Freedom Institute LLC, https://softwarefreedom.institute
136 *
137 * Redistribution and use in source and binary forms, with or without
138 * modification, are permitted provided that the following conditions
139 * are met:
140 *
141 * 1. Redistributions of source code must retain the above copyright
142 * notice, this list of conditions and the following disclaimer.
143 *
144 * 2. Redistributions in binary form must reproduce the above copyright
145 * notice, this list of conditions and the following disclaimer in
146 * the documentation and/or other materials provided with the
147 * distribution.
148 *
149 * 3. Neither the name of the author(s) nor the names of any contributors
150 * may be used to endorse or promote products derived from this software
151 * without specific prior written permission.
152 *
153 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
154 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
155 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
156 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
157 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
158 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
159 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
160 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
161 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
162 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
163 * SUCH DAMAGE.
164 *
165 * ====================================================================
166 *
167 *
168 */
169
#define resip_assert(x)
This file needs to work for both C and C++ code.
const std::list< Data > & getValues(const Data &key) const
EncodeStream & encode(EncodeStream &s) const
void addAttribute(const Data &key, const Data &value=Data::Empty)
bool exists(const Data &key) const
void parse(ParseBuffer &pb)
Base class for all SIP body types.
Definition Contents.hxx:51
Contents & operator=(const Contents &rhs)
Assignment operator.
Definition Contents.cxx:71
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
void checkParsed() const
Represents the "media-type" element in the RFC 3261 grammar.
Definition Mime.hxx:20
Provides string-parsing functionality with protection from buffer overflow.
CurrentPosition position() const
process m= (media announcement) blocks
virtual Contents * clone() const override
duplicate an TrickleIceContents object
void addMedium(const SdpContents::Session::Medium &medium)
static const Mime & getStaticType()
virtual void parse(ParseBuffer &pb) override
const std::list< Data > & getValues(const Data &key) const
virtual EncodeStream & encodeParsed(EncodeStream &str) const override
TrickleIceContents & operator=(const TrickleIceContents &rhs)
void addAttribute(const Data &key, const Data &value=Data::Empty)
dcm! – add UnusedChecking(_enum) below;
#define EncodeStream