LLMimeParser::Impl Class Reference

Implementation details of the mime parser class. More...

List of all members.

Public Member Functions

 Impl ()
void reset ()
bool parseIndex (std::istream &istr, S32 limit, const std::string &separator, bool is_subpart, LLMimeIndex &index)
 Parse a mime entity to find the index information.

Protected Types

enum  { LINE_BUFFER_LENGTH = 1024 }

Protected Member Functions

bool parseHeaders (std::istream &istr, S32 limit, LLSD &headers)
 parse the headers.
std::string findSeparator (std::string multipart_content_type)
 Figure out the separator string from a content type header.
void scanPastSeparator (std::istream &istr, S32 limit, const std::string &separator)
 Scan through istr past the separator.
void scanPastContent (std::istream &istr, S32 limit, LLSD headers, const std::string separator)
 Scan through istr past the content of the current mime part.
bool eatCRLF (std::istream &istr)
 Eat CRLF.
bool continueParse () const

Protected Attributes

S32 mScanCount
bool mContinue
bool mError
char mBuffer [LINE_BUFFER_LENGTH]


Detailed Description

Implementation details of the mime parser class.

LLMimeParser

See also:
LLMimeParser

Definition at line 228 of file llmime.cpp.


Member Enumeration Documentation

anonymous enum [protected]

Enumerator:
LINE_BUFFER_LENGTH 

Definition at line 320 of file llmime.cpp.


Constructor & Destructor Documentation

LLMimeParser::Impl::Impl (  ) 

Definition at line 332 of file llmime.cpp.

References reset().

Here is the call graph for this function:


Member Function Documentation

void LLMimeParser::Impl::reset (  ) 

Definition at line 337 of file llmime.cpp.

References mBuffer, mContinue, mError, and mScanCount.

Referenced by Impl(), and LLMimeParser::reset().

Here is the caller graph for this function:

bool LLMimeParser::Impl::parseIndex ( std::istream &  istr,
S32  limit,
const std::string &  separator,
bool  is_subpart,
LLMimeIndex index 
)

Parse a mime entity to find the index information.

This method will scan the istr until a single complete mime entity is read, an EOF, or limit bytes have been scanned. The istr will be modified by this parsing, so pass in a temporary stream or rewind/reset the stream after this call.

Parameters:
istr An istream which contains a mime entity.
limit The maximum number of bytes to scan.
separator The multipart separator if it is known.
is_subpart Set true if parsing a multipart sub part.
index[out] The parsed output.
Returns:
Returns true if an index was parsed and no errors occurred.

Definition at line 345 of file llmime.cpp.

References LLSD::asString(), LLMimeIndex::attachSubPart(), CONTENT_TYPE(), continueParse(), findSeparator(), LLMimeIndex::isMultipart(), mError, mScanCount, parseHeaders(), scanPastContent(), and scanPastSeparator().

Referenced by LLMimeParser::parseIndex().

Here is the call graph for this function:

Here is the caller graph for this function:

bool LLMimeParser::Impl::parseHeaders ( std::istream &  istr,
S32  limit,
LLSD headers 
) [protected]

parse the headers.

At the end of a successful parse, mScanCount will be at the start of the content.

Parameters:
istr The input stream.
limit maximum number of bytes to process
headers[out] A map of the headers found.
Returns:
Returns true if the parse was successful.

Definition at line 384 of file llmime.cpp.

References LLStringBase< char >::compareInsensitive(), continueParse(), indra::ipc::tokenstream::EOF, LLSD::isUndefined(), KNOWN_HEADER, KNOWN_HEADER_COUNT, LINE_BUFFER_LENGTH, llmin(), mBuffer, mContinue, mError, mScanCount, and S32.

Referenced by parseIndex().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string LLMimeParser::Impl::findSeparator ( std::string  multipart_content_type  )  [protected]

Figure out the separator string from a content type header.

Parameters:
multipart_content_type The content type value from the headers.
Returns:
Returns the separator string.

Definition at line 456 of file llmime.cpp.

References BOUNDARY(), END_OF_CONTENT_PARAMETER(), and mError.

Referenced by parseIndex().

Here is the call graph for this function:

Here is the caller graph for this function:

void LLMimeParser::Impl::scanPastSeparator ( std::istream &  istr,
S32  limit,
const std::string &  separator 
) [protected]

Scan through istr past the separator.

Parameters:
istr The input stream.
limit Maximum number of bytes to scan.
separator The multipart separator.

Definition at line 491 of file llmime.cpp.

References LLStringBase< char >::compareStrings(), continueParse(), indra::ipc::tokenstream::EOF, LINE_BUFFER_LENGTH, llmin(), mBuffer, mContinue, mError, mScanCount, S32, and SEPARATOR_PREFIX().

Referenced by parseIndex().

Here is the call graph for this function:

Here is the caller graph for this function:

void LLMimeParser::Impl::scanPastContent ( std::istream &  istr,
S32  limit,
LLSD  headers,
const std::string  separator 
) [protected]

Scan through istr past the content of the current mime part.

Parameters:
istr The input stream.
limit Maximum number of bytes to scan.
headers The headers for this mime part.
separator The multipart separator if known.

Definition at line 535 of file llmime.cpp.

References LLSD::asInteger(), CONTENT_LENGTH(), eatCRLF(), LLSD::has(), llmin(), mContinue, mError, mScanCount, and S32.

Referenced by parseIndex().

Here is the call graph for this function:

Here is the caller graph for this function:

bool LLMimeParser::Impl::eatCRLF ( std::istream &  istr  )  [protected]

Eat CRLF.

This method has no concept of the limit, so ensure you have at least 2 characters left to eat before hitting the limit. This method will increment mScanCount as it goes.

Parameters:
istr The input stream.
Returns:
Returns true if CRLF was found and consumed off of istr.

Definition at line 564 of file llmime.cpp.

References mScanCount.

Referenced by scanPastContent().

Here is the caller graph for this function:

bool LLMimeParser::Impl::continueParse (  )  const [inline, protected]

Definition at line 317 of file llmime.cpp.

Referenced by parseHeaders(), parseIndex(), and scanPastSeparator().

Here is the caller graph for this function:


Member Data Documentation

Definition at line 326 of file llmime.cpp.

Referenced by eatCRLF(), parseHeaders(), parseIndex(), reset(), scanPastContent(), and scanPastSeparator().

Definition at line 327 of file llmime.cpp.

Referenced by parseHeaders(), reset(), scanPastContent(), and scanPastSeparator().

bool LLMimeParser::Impl::mError [protected]

char LLMimeParser::Impl::mBuffer[LINE_BUFFER_LENGTH] [protected]

Definition at line 329 of file llmime.cpp.

Referenced by parseHeaders(), reset(), and scanPastSeparator().


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

Generated on Fri May 16 08:53:44 2008 for SecondLife by  doxygen 1.5.5