reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
resip::MultipartMixedContents Class Reference

SIP body type for holding Multipart-Mixed body contents (MIME content-type multipart/mixed). More...

#include <MultipartMixedContents.hxx>

Inheritance diagram for resip::MultipartMixedContents:
[legend]

Classes

class  Exception
 Thrown when there is an error parsing a multi-part mixed contents envelope. More...
 

Public Types

typedef std::vector< Contents * > Parts
 

Public Member Functions

 MultipartMixedContents ()
 
 MultipartMixedContents (const Mime &contentType)
 
 MultipartMixedContents (const HeaderFieldValue &hfv, const Mime &contentType)
 
 MultipartMixedContents (const MultipartMixedContents &rhs)
 
virtual ~MultipartMixedContents ()
 
MultipartMixedContents & operator= (const MultipartMixedContents &rhs)
 
virtual Contents * clone () const
 duplicate an MultipartMixedContents object
 
virtual EncodeStream & encodeParsed (EncodeStream &str) const
 
virtual void parse (ParseBuffer &pb)
 
Parts & parts ()
 
const Parts & parts () const
 
Data getRawFirstPart () const
 The first body part exactly as it arrived: header block, the empty line, and the body.
 
void setBoundary (const Data &boundary)
 
- Public Member Functions inherited from resip::Contents
 Contents (const HeaderFieldValue &headerFieldValue, const Mime &contentsType)
 pass Mime instance for parameters
 
 Contents (const Mime &contentsType)
 Create a contents with a given mime type.
 
 Contents (const Contents &rhs)
 Copy constructor.
 
 Contents (const Contents &rhs, HeaderFieldValue::CopyPaddingEnum e)
 
 Contents (const HeaderFieldValue &headerFieldValue, HeaderFieldValue::CopyPaddingEnum e, const Mime &contentsType)
 
virtual ~Contents ()
 
Contents & operator= (const Contents &rhs)
 Assignment operator.
 
void preParseHeaders (ParseBuffer &pb)
 Preforms preparsing on the headers stored in the ParseBuffer pb.
 
EncodeStream & encodeHeaders (EncodeStream &str) const
 encodes headers to an output stream
 
virtual Contents * getContents ()
 access to wrapped contents (signed, encrypted)
 
Contents * getContents (const Mime &)
 
virtual Data getBodyData () const
 
const Mime & getType () const
 getter for mime type of message
 
bool exists (const HeaderBase &headerType) const
 checks to see if a header is present
 
void remove (const HeaderBase &headerType)
 removes a header if it is present
 
bool exists (const MIME_Header &headerType) const
 checks to see if a MIME header exists
 
void remove (const MIME_Header &headerType)
 removes a MIME header if it is present
 
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 exist.
 
H_ContentType::Type & header (const H_ContentType &headerType)
 returns the value of the Content-Type header
 
const H_ContentDisposition::Type & header (const H_ContentDisposition &headerType) const
 returns the value of the Content-Disposition header Throws an Contents::Exception if the header doesn't exist.
 
H_ContentDisposition::Type & header (const H_ContentDisposition &headerType)
 returns the value of the Content-Disposition header
 
const H_ContentTransferEncoding::Type & header (const H_ContentTransferEncoding &headerType) const
 returns the value of the Content-Transfer-Encoding header Throws an Contents::Exception if the header doesn't exist.
 
H_ContentTransferEncoding::Type & header (const H_ContentTransferEncoding &headerType)
 returns the value of the Content-Transfer-Encoding header
 
const H_ContentLanguages::Type & header (const H_ContentLanguages &headerType) const
 returns the value of the Content-Languages header Throws an Contents::Exception if the header doesn't exist.
 
H_ContentLanguages::Type & header (const H_ContentLanguages &headerType)
 returns the value of the Content-Languages header
 
const H_ContentID::Type & header (const H_ContentID &headerType) const
 returns the value of the Content-ID MIME header Throws an Contents::Exception if the header doesn't exist.
 
H_ContentID::Type & header (const H_ContentID &headerType)
 returns the value of the Content-ID MIME header
 
const H_ContentDescription::Type & header (const H_ContentDescription &headerType) const
 returns the Content-Description MIME header Throws an Contents::Exception if the header doesn't exist.
 
H_ContentDescription::Type & header (const H_ContentDescription &headerType)
 returns the Content-Description MIME header
 
int & version ()
 returns the major version of MIME used by the contents
 
int & minorVersion ()
 returns the minor version of MIME used by the contents
 
void addBuffer (char *buf)
 
- Public Member Functions inherited from resip::LazyParser
 LazyParser (const HeaderFieldValue &headerFieldValue)
 
 LazyParser (const char *buf, int length)
 
 LazyParser (const HeaderFieldValue &headerFieldValue, HeaderFieldValue::CopyPaddingEnum e)
 
 LazyParser (const LazyParser &rhs)
 
 LazyParser (const LazyParser &rhs, HeaderFieldValue::CopyPaddingEnum e)
 
LazyParser & operator= (const LazyParser &rhs)
 
virtual ~LazyParser ()
 
EncodeStream & encode (EncodeStream &str) const
 Encodes this element to a stream, in the fashion it should be represented on the wire.
 
bool isParsed () const
 Returns true iff a parse has been attempted.
 
HeaderFieldValue & getHeaderField ()
 
void checkParsed () const
 
void checkParsed ()
 
void doParse () const
 
void markDirty () const
 
bool isWellFormed () const
 Returns true iff this element was parsed successfully, according to the implementation of parse().
 

Static Public Member Functions

static const Mime & getStaticType ()
 
static bool init ()
 
- Static Public Member Functions inherited from resip::Contents
static Contents * createContents (const Mime &contentType, const Data &contents)
 factory method to create a Contents object from a mime type and a payload
 

Static Public Attributes

static constexpr unsigned int MaxNestingDepth = 32
 parse() fails (Exception) a body nested more than this many multipart levels below the outermost one.
 

Protected Member Functions

void clear ()
 
- Protected Member Functions inherited from resip::Contents
void clear ()
 
void init ()
 
void init (const Contents &orig)
 
void freeMem ()
 
virtual const Data & errorContext () const
 
- Protected Member Functions inherited from resip::LazyParser
 LazyParser ()
 
void clear ()
 

Additional Inherited Members

- Protected Attributes inherited from resip::Contents
Mime mType
 
H_ContentDisposition::Type * mDisposition
 
H_ContentTransferEncoding::Type * mTransferEncoding
 
H_ContentLanguages::Type * mLanguages
 
Token * mId
 
H_ContentDescription::Type * mDescription
 
StringCategory * mLength
 
int mVersion
 
int mMinorVersion
 
std::vector< char * > mBufferList
 

Detailed Description

SIP body type for holding Multipart-Mixed body contents (MIME content-type multipart/mixed).

Definition at line 19 of file MultipartMixedContents.hxx.

Member Typedef Documentation

◆ Parts

Definition at line 39 of file MultipartMixedContents.hxx.

Constructor & Destructor Documentation

◆ MultipartMixedContents() [1/4]

MultipartMixedContents::MultipartMixedContents ( )

Definition at line 26 of file MultipartMixedContents.cxx.

◆ MultipartMixedContents() [2/4]

MultipartMixedContents::MultipartMixedContents ( const Mime &  contentType)
explicit

Definition at line 35 of file MultipartMixedContents.cxx.

◆ MultipartMixedContents() [3/4]

MultipartMixedContents::MultipartMixedContents ( const HeaderFieldValue &  hfv,
const Mime &  contentType 
)

Definition at line 47 of file MultipartMixedContents.cxx.

◆ MultipartMixedContents() [4/4]

MultipartMixedContents::MultipartMixedContents ( const MultipartMixedContents &  rhs)

Definition at line 67 of file MultipartMixedContents.cxx.

◆ ~MultipartMixedContents()

MultipartMixedContents::~MultipartMixedContents ( )
virtual

Definition at line 122 of file MultipartMixedContents.cxx.

Member Function Documentation

◆ clear()

void MultipartMixedContents::clear ( )
protected

Definition at line 110 of file MultipartMixedContents.cxx.

◆ clone()

Contents * MultipartMixedContents::clone ( ) const
virtual

duplicate an MultipartMixedContents object

Returns
pointer to a new MultipartMixedContents object

Implements resip::Contents.

Reimplemented in resip::MultipartAlternativeContents, resip::MultipartRelatedContents, and resip::MultipartSignedContents.

Definition at line 155 of file MultipartMixedContents.cxx.

◆ encodeParsed()

EncodeStream & MultipartMixedContents::encodeParsed ( EncodeStream &  str) const
virtual

Implements resip::LazyParser.

Definition at line 168 of file MultipartMixedContents.cxx.

◆ getRawFirstPart()

Data MultipartMixedContents::getRawFirstPart ( ) const

The first body part exactly as it arrived: header block, the empty line, and the body.

The CRLF in front of the following boundary is not included, since RFC 2046 section 5.1.1 counts it as part of the delimiter.

RFC 1847 requires the signature of a multipart/signed body to cover these bytes rather than a re-encoding of the parsed part, so BaseSecurity::checkSignature() needs them. Only the first part is kept, because that is the part the signature covers.

What is kept internally is a view into the buffer this object was parsed from, so parsing an ordinary multipart body costs nothing extra. What this function hands back is a self contained copy of it, returned by value so that it stays usable after a later call to parts(); a reference into the object would go empty under the caller.

Empty when the bytes are not available: for an object that was built locally rather than parsed, and after mutable access through parts().

Whether a copy has a record depends on when it was taken. The copy constructor does not carry the view over, since it points into the buffer of the original, but it also does not force the original to parse. Copying a body that is still unparsed leaves a copy that is unparsed as well, holding a deep copy of the buffer, and the first access parses that buffer and establishes a view into it. Copying a body that was already parsed leaves a copy with the parts and no view, because nothing parses a second time.

Definition at line 100 of file MultipartMixedContents.cxx.

◆ getStaticType()

const Mime & MultipartMixedContents::getStaticType ( )
static

Definition at line 161 of file MultipartMixedContents.cxx.

◆ init()

bool MultipartMixedContents::init ( )
static

Definition at line 19 of file MultipartMixedContents.cxx.

◆ operator=()

MultipartMixedContents & MultipartMixedContents::operator= ( const MultipartMixedContents &  rhs)

Definition at line 128 of file MultipartMixedContents.cxx.

◆ parse()

void MultipartMixedContents::parse ( ParseBuffer &  pb)
virtual

Implements resip::LazyParser.

Definition at line 204 of file MultipartMixedContents.cxx.

◆ parts() [1/2]

Parts & resip::MultipartMixedContents::parts ( )
inline

Definition at line 48 of file MultipartMixedContents.hxx.

◆ parts() [2/2]

const Parts & resip::MultipartMixedContents::parts ( ) const
inline

Definition at line 49 of file MultipartMixedContents.hxx.

◆ setBoundary()

void MultipartMixedContents::setBoundary ( const Data &  boundary)

Definition at line 94 of file MultipartMixedContents.cxx.

Member Data Documentation

◆ MaxNestingDepth

constexpr unsigned int resip::MultipartMixedContents::MaxNestingDepth = 32
staticconstexpr

parse() fails (Exception) a body nested more than this many multipart levels below the outermost one.

Each level costs a stack frame in anything that walks the tree (Helper::getSdp(), copying, destruction), so the depth of the tree that can be built has to be bounded. Real bodies (multipart/signed wrapping multipart/mixed, etc.) nest only a handful of levels.

Definition at line 90 of file MultipartMixedContents.hxx.


The documentation for this class was generated from the following files: