\section{mm\_\-parse.c File Reference} \label{mm__parse_8c}\index{mm_parse.c@{mm\_\-parse.c}} {\tt \#include $<$sys/types.h$>$}\par {\tt \#include $<$sys/stat.h$>$}\par {\tt \#include $<$stdio.h$>$}\par {\tt \#include $<$stdlib.h$>$}\par {\tt \#include $<$unistd.h$>$}\par {\tt \#include $<$fcntl.h$>$}\par {\tt \#include $<$string.h$>$}\par {\tt \#include $<$ctype.h$>$}\par {\tt \#include $<$assert.h$>$}\par {\tt \#include \char`\"{}mm\_\-internal.h\char`\"{}}\par {\tt \#include \char`\"{}mm\_\-util.h\char`\"{}}\par {\tt \#include \char`\"{}mimeparser.h\char`\"{}}\par {\tt \#include \char`\"{}mimeparser.tab.h\char`\"{}}\par \subsection*{Functions} \begin{CompactItemize} \item void {\bf PARSER\_\-initialize} (MM\_\-CTX $\ast$, int) \item void \textbf{PARSER\_\-setbuffer} (const char $\ast$)\label{mm__parse_8c_92d7d8e20b6def16fcf2649e0d88651f} \item void \textbf{PARSER\_\-setfp} (FILE $\ast$)\label{mm__parse_8c_04446354e4248226578b90007d728a7b} \item int {\bf mm\_\-parse\_\-mem} (MM\_\-CTX $\ast$ctx, const char $\ast$text, int parsemode, int flags) \item int {\bf mm\_\-parse\_\-file} (MM\_\-CTX $\ast$ctx, const char $\ast$filename, int parsemode, int flags) \end{CompactItemize} \subsection{Detailed Description} Functions to parse MIME messages \subsection{Function Documentation} \index{mm_parse.c@{mm\_\-parse.c}!mm_parse_file@{mm\_\-parse\_\-file}} \index{mm_parse_file@{mm\_\-parse\_\-file}!mm_parse.c@{mm\_\-parse.c}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-parse\_\-file (MM\_\-CTX $\ast$ {\em ctx}, const char $\ast$ {\em filename}, int {\em parsemode}, int {\em flags})}\label{mm__parse_8c_cc9f623682b05f330c46e72e4e9d66cc} Parses a file into a Mini\-MIME context \begin{Desc} \item[Parameters:] \begin{description} \item[{\em ctx}]A valid Mini\-MIME context object \item[{\em filename}]The name of the file to parse \item[{\em parsemode}]The parsemode \item[{\em flags}]The flags to pass to the parser \end{description} \end{Desc} \begin{Desc} \item[Returns:]0 on success or -1 on failure \end{Desc} \begin{Desc} \item[Note:]Sets mm\_\-errno if an error occurs\end{Desc} This function parses a MIME message, stored in the filesystem according to the parseflags and stores the results in the Mini\-MIME context specified by ctx. The following modes can be used to specify how the message should be parsed: \begin{itemize} \item MM\_\-PARSE\_\-STRICT: Do not tolerate MIME violations\item MM\_\-PARSE\_\-LOOSE: Tolerate as much MIME violations as possible\end{itemize} The context needs to be initialized before using \doxyref{mm\_\-context\_\-new()}{p.}{group__context_g919fd41f85534d9c87c256857faa2610} and may be freed using \doxyref{mm\_\-context\_\-free()}{p.}{group__context_g76392d5269e9ef340c2f5f8336f7193b}. \index{mm_parse.c@{mm\_\-parse.c}!mm_parse_mem@{mm\_\-parse\_\-mem}} \index{mm_parse_mem@{mm\_\-parse\_\-mem}!mm_parse.c@{mm\_\-parse.c}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-parse\_\-mem (MM\_\-CTX $\ast$ {\em ctx}, const char $\ast$ {\em text}, int {\em parsemode}, int {\em flags})}\label{mm__parse_8c_58c960b6017f13d4e4ec5f09b3c38495} Parses a NUL-terminated string into a Mini\-MIME context \begin{Desc} \item[Parameters:] \begin{description} \item[{\em ctx}]A valid Mini\-MIME context object \item[{\em text}]The NUL-terminated string to parse \item[{\em parsemode}]The parsemode \item[{\em flags}]The flags to pass to the parser \end{description} \end{Desc} \begin{Desc} \item[Returns:]0 on success or -1 on failure \end{Desc} \begin{Desc} \item[Note:]Sets mm\_\-errno if an error occurs\end{Desc} This function parses a MIME message, stored in the memory region pointed to by text (must be NUL-terminated) according to the parseflags and stores the results in the Mini\-MIME context specified by ctx. The following modes can be used to specify how the message should be parsed: \begin{itemize} \item MM\_\-PARSE\_\-STRICT: Do not tolerate MIME violations\item MM\_\-PARSE\_\-LOOSE: Tolerate as much MIME violations as possible\end{itemize} The context needs to be initialized before using \doxyref{mm\_\-context\_\-new()}{p.}{group__context_g919fd41f85534d9c87c256857faa2610} and may be freed using \doxyref{mm\_\-context\_\-free()}{p.}{group__context_g76392d5269e9ef340c2f5f8336f7193b}. \index{mm_parse.c@{mm\_\-parse.c}!PARSER_initialize@{PARSER\_\-initialize}} \index{PARSER_initialize@{PARSER\_\-initialize}!mm_parse.c@{mm\_\-parse.c}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void PARSER\_\-initialize (MM\_\-CTX $\ast$ {\em newctx}, int {\em mode})}\label{mm__parse_8c_187cf71c0f6c2da1384823e3f20aa1a2} Initializes the parser engine.