3#if defined(HAVE_CONFIG_H)
17#define RESIPROCATE_SUBSYSTEM Subsystem::CONTENTS
23 const Mime& contentType)
50 const Mime& contentsType)
149 const Data& contents)
194 case Headers::ContentType :
198 case Headers::ContentDisposition :
202 case Headers::ContentTransferEncoding :
206 case Headers::ContentLanguage :
210 default :
return false;
236 case Headers::ContentDisposition :
242 case Headers::ContentLanguage :
248 case Headers::ContentTransferEncoding :
279const H_ContentType::Type&
291const H_ContentDisposition::Type&
298 "Contents::header(const H_ContentDisposition& headerType) _const_ "
299 "without first calling exists(), and the header does not exist. Our"
300 " behavior in this scenario is to implicitly create the header(using const_cast!); "
301 "this is probably not what you want, but it is either this or "
302 "assert/throw an exception. Since this has been the behavior for "
303 "so long, we are not throwing here, _yet_. You need to fix your "
304 "code, before we _do_ start throwing. This is why const-correctness"
305 " should never be made a TODO item </rant>");
312H_ContentDisposition::Type&
323const H_ContentTransferEncoding::Type&
330 "Contents::header(const H_ContentTransferEncoding& headerType) _const_ "
331 "without first calling exists(), and the header does not exist. Our"
332 " behavior in this scenario is to implicitly create the header(using const_cast!); "
333 "this is probably not what you want, but it is either this or "
334 "assert/throw an exception. Since this has been the behavior for "
335 "so long, we are not throwing here, _yet_. You need to fix your "
336 "code, before we _do_ start throwing. This is why const-correctness"
337 " should never be made a TODO item </rant>");
344H_ContentTransferEncoding::Type&
355const H_ContentLanguages::Type&
362 "Contents::header(const H_ContentLanguages& headerType) _const_ "
363 "without first calling exists(), and the header does not exist. Our"
364 " behavior in this scenario is to implicitly create the header(using const_cast!); "
365 "this is probably not what you want, but it is either this or "
366 "assert/throw an exception. Since this has been the behavior for "
367 "so long, we are not throwing here, _yet_. You need to fix your "
368 "code, before we _do_ start throwing. This is why const-correctness"
369 " should never be made a TODO item </rant>");
371 ncthis->
mLanguages =
new H_ContentLanguages::Type;
376H_ContentLanguages::Type&
394 "Contents::header(const H_ContentDescription& headerType) _const_ "
395 "without first calling exists(), and the header does not exist. Our"
396 " behavior in this scenario is to implicitly create the header(using const_cast!); "
397 "this is probably not what you want, but it is either this or "
398 "assert/throw an exception. Since this has been the behavior for "
399 "so long, we are not throwing here, _yet_. You need to fix your "
400 "code, before we _do_ start throwing. This is why const-correctness"
401 " should never be made a TODO item </rant>");
426 "Contents::header(const H_ContentID& headerType) _const_ "
427 "without first calling exists(), and the header does not exist. Our"
428 " behavior in this scenario is to implicitly create the header(using const_cast!); "
429 "this is probably not what you want, but it is either this or "
430 "assert/throw an exception. Since this has been the behavior for "
431 "so long, we are not throwing here, _yet_. You need to fix your "
432 "code, before we _do_ start throwing. This is why const-correctness"
433 " should never be made a TODO item </rant>");
467 pb.
data(headerName, anchor);
479 case Headers::ContentType :
484 case Headers::ContentDisposition :
490 case Headers::ContentTransferEncoding :
497 case Headers::ContentLanguage :
514 H_ContentLanguages::Type::value_type tmp;
572 std::cerr <<
"Unknown MIME Content- header: " << headerName << std::endl;
573 ErrLog(<<
"Unknown MIME Content- header: " << headerName);
582 ErrLog( <<
"Some problem parsing contents: " << e );
601 if (
exists(h_ContentDisposition))
609 if (
exists(h_ContentLanguages))
614 size_t size =
header(h_ContentLanguages).size();
616 for (H_ContentLanguages::Type::const_iterator
617 i =
header(h_ContentLanguages).begin();
618 i !=
header(h_ContentLanguages).end(); ++i)
static const Data errorContextData("Contents")
#define resip_assert(x)
This file needs to work for both C and C++ code.
static HashMap< Mime, ContentsFactoryBase * > & getFactoryMap()
Base class for all SIP body types.
void addBuffer(char *buf)
bool exists(const HeaderBase &headerType) const
checks to see if a header is present
virtual Data getBodyData() const
Contents(const HeaderFieldValue &headerFieldValue, const Mime &contentsType)
pass Mime instance for parameters
H_ContentDescription::Type * mDescription
std::vector< char * > mBufferList
const H_ContentType::Type & header(const H_ContentType &headerType) const
returns the value of the Content-Type header Throws an Contents::Exception if the header doesn't exis...
EncodeStream & encodeHeaders(EncodeStream &str) const
encodes headers to an output stream
Contents & operator=(const Contents &rhs)
Assignment operator.
H_ContentLanguages::Type * mLanguages
static Contents * createContents(const Mime &contentType, const Data &contents)
factory method to create a Contents object from a mime type and a payload
H_ContentTransferEncoding::Type * mTransferEncoding
void preParseHeaders(ParseBuffer &pb)
Preforms preparsing on the headers stored in the ParseBuffer pb.
H_ContentDisposition::Type * mDisposition
void remove(const HeaderBase &headerType)
removes a header if it is present
virtual const Data & errorContext() const
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
size_type size() const noexcept
Returns the number of bytes in this Data.
static Data from(const T &x)
Converts from arbitrary other type to Data.
const char * data() const noexcept
Returns a pointer to the contents of this Data.
Used to accumlate data written to the stream in a DigestBuffer and convert the data to Digest.
Data getHex()
Calls flush() on itself and returns the Digest data in hex format.
Content-ID MIME header identifier class.
Content-ID MIME header identifier class.
The base-class for all lazily-parsed SIP grammar elements.
EncodeStream & encode(EncodeStream &str) const
Encodes this element to a stream, in the fashion it should be represented on the wire.
LazyParser & operator=(const LazyParser &rhs)
Represents the "media-type" element in the RFC 3261 grammar.
SIP body type for holding Octet contents (MIME content-type application/octet-stream).
Provides string-parsing functionality with protection from buffer overflow.
CurrentPosition skipLWS()
CurrentPosition skipWhitespace()
CurrentPosition position() const
CurrentPosition skipToOneOf(const char *cs)
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)
const char * skipToEndQuote(char quote='"')
static const char * Whitespace
BaseException used to indicate parse failures.
Represents the "header-value" element in the RFC 3261 grammar (ie, an unknown header field value).
virtual void parse(ParseBuffer &pb)
static const char * RPAREN
static const char * LPAREN
static const char * SPACE
static const char * COLON
static const char * COMMA
static const char * PERIOD
Represents the "token" element in the RFC 3261 grammar.
virtual void parse(ParseBuffer &pb)
dcm! – add UnusedChecking(_enum) below;
bool isEqualNoCase(const Data &left, const Data &right)
H_ContentDescription h_ContentDescription
bool operator==(const char *lhs, const Data &rhs)
bool operator!=(const Data &lhs, const Data &rhs)