mm_parse.c File Reference

#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>
#include "mm_internal.h"
#include "mm_util.h"
#include "mimeparser.h"
#include "mimeparser.tab.h"

Functions

void PARSER_initialize (MM_CTX *, int)
void PARSER_setbuffer (const char *)
void PARSER_setfp (FILE *)
int mm_parse_mem (MM_CTX *ctx, const char *text, int parsemode, int flags)
int mm_parse_file (MM_CTX *ctx, const char *filename, int parsemode, int flags)

Detailed Description

Functions to parse MIME messages

Function Documentation

int mm_parse_file ( MM_CTX *  ctx,
const char *  filename,
int  parsemode,
int  flags 
)

Parses a file into a MiniMIME context

Parameters:
ctx A valid MiniMIME context object
filename The name of the file to parse
parsemode The parsemode
flags The flags to pass to the parser
Returns:
0 on success or -1 on failure
Note:
Sets mm_errno if an error occurs
This function parses a MIME message, stored in the filesystem according to the parseflags and stores the results in the MiniMIME context specified by ctx.

The following modes can be used to specify how the message should be parsed:

The context needs to be initialized before using mm_context_new() and may be freed using mm_context_free().

int mm_parse_mem ( MM_CTX *  ctx,
const char *  text,
int  parsemode,
int  flags 
)

Parses a NUL-terminated string into a MiniMIME context

Parameters:
ctx A valid MiniMIME context object
text The NUL-terminated string to parse
parsemode The parsemode
flags The flags to pass to the parser
Returns:
0 on success or -1 on failure
Note:
Sets mm_errno if an error occurs
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 MiniMIME context specified by ctx.

The following modes can be used to specify how the message should be parsed:

The context needs to be initialized before using mm_context_new() and may be freed using mm_context_free().

void PARSER_initialize ( MM_CTX *  newctx,
int  mode 
)

Initializes the parser engine.


Generated on Thu Mar 29 17:59:08 2007 for MiniMIME by  doxygen 1.5.1