1#if defined(HAVE_CONFIG_H)
16#define RESIPROCATE_SUBSYSTEM Subsystem::CONTENTS
73 vector<Contents*>::const_iterator j;
76 const vector<Contents*>&
list = rhs.mContents;
78 for ( j =
list.begin();
82 mContents.push_back( (*j)->clone() );
87MultipartMixedContents::setBoundary()
94MultipartMixedContents::setBoundary(
const Data& boundary)
106 return mRawFirstPart;
112 for (vector<Contents*>::iterator i = mContents.begin();
113 i != mContents.end(); ++i)
119 mRawFirstPart =
Data();
140 mRawFirstPart =
Data();
145 for (vector<Contents*>::const_iterator i = rhs.mContents.begin();
146 i != rhs.mContents.end(); ++i)
148 mContents.push_back( (*i)->clone() );
163 static Mime type(
"multipart",
"mixed");
173 boundary += boundaryToken;
179 for (vector<Contents*>::const_iterator i = mContents.begin();
180 i != mContents.end(); ++i)
191 (*i)->encodeHeaders(str);
211 throw Exception(
"Multipart nesting too deep", __FILE__, __LINE__);
219 boundary += boundaryToken;
223 boundaryNoCRLF += boundaryToken;
231 bool firstPartSeen =
false;
232 mRawFirstPart =
Data();
240 throw Exception(
"Invalid line ending, missing CR",__FILE__,__LINE__);
245 throw Exception(
"Invalid line ending, missing LF",__FILE__,__LINE__);
251 const char* headerStart = pb.
position();
257 pb.
reset(headerStart);
267 const char* typeStart = pb.
position();
276 contentType.
parse(subPb);
290 pb.
data(tmp, bodyStart);
293 firstPartSeen =
true;
309 nested->mDepth = mDepth + 1;
312 ParseBuffer headersPb(headerStart, bodyStart-4-headerStart);
313 mContents.back()->preParseHeaders(headersPb);
#define resip_assert(x)
This file needs to work for both C and C++ code.
Base class for all SIP body types.
Contents & operator=(const Contents &rhs)
Assignment operator.
static Contents * createContents(const Mime &contentType, const Data &contents)
factory method to create a Contents object from a mime type and a payload
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
@ Share
The Data instance will use the buffer in a read-only mode.
int replace(const Data &match, const Data &target, int max=INT_MAX)
Replaces up to max occurrences of the bytes match with target.
static const PreallocateType Preallocate
used only to disambiguate constructors
size_type size() const noexcept
Returns the number of bytes in this Data.
Represents the "media-type" element in the RFC 3261 grammar.
virtual void parse(ParseBuffer &pb)
bool exists(const Param< Mime > ¶mType) const
const Data & param(const ExtensionParameter ¶m) const
Const accessor for non-natively-supported parameter types.
Thrown when there is an error parsing a multi-part mixed contents envelope.
SIP body type for holding Multipart-Mixed body contents (MIME content-type multipart/mixed).
static constexpr unsigned int MaxNestingDepth
parse() fails (Exception) a body nested more than this many multipart levels below the outermost one.
Data getRawFirstPart() const
The first body part exactly as it arrived: header block, the empty line, and the body.
virtual Contents * clone() const
duplicate an MultipartMixedContents object
virtual void parse(ParseBuffer &pb)
static const Mime & getStaticType()
virtual EncodeStream & encodeParsed(EncodeStream &str) const
void setBoundary(const Data &boundary)
virtual ~MultipartMixedContents()
MultipartMixedContents & operator=(const MultipartMixedContents &rhs)
Provides string-parsing functionality with protection from buffer overflow.
CurrentPosition skipWhitespace()
CurrentPosition skipToChars(const char *cs)
CurrentPosition skipToChar(char c)
CurrentPosition position() const
void reset(const char *pos)
void assertNotEof() const
CurrentPosition skipN(size_t count)
CurrentPosition skipChar()
CurrentPosition skipToTermCRLF()
void data(Data &data, const char *start) const
make the passed in data share memory with the buffer (uses Data::Share)
static Data getRandomHex(unsigned int numBytes)
static const char * COLON
static const char * DASHDASH
static const char * CRLFCRLF
dcm! – add UnusedChecking(_enum) below;