dect
/
asterisk
Archived
13
0
Fork 0

Merged revisions 60603 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r60603 | russell | 2007-04-06 15:58:43 -0500 (Fri, 06 Apr 2007) | 13 lines

To be able to achieve the things that we would like to achieve with the
Asterisk GUI project, we need a fully functional HTTP interface with access
to the Asterisk manager interface.  One of the things that was intended to be
a part of this system, but was never actually implemented, was the ability for
the GUI to be able to upload files to Asterisk.  So, this commit adds this in
the most minimally invasive way that we could come up with.

A lot of work on minimime was done by Steve Murphy.  He fixed a lot of bugs in
the parser, and updated it to be thread-safe.  The ability to check
permissions of active manager sessions was added by Dwayne Hubbard.  Then,
hacking this all together and do doing the modifications necessary to the HTTP
interface was done by me.

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@60604 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
russell 2007-04-06 21:16:38 +00:00
parent fb1d21c4f2
commit fe453b5ef2
139 changed files with 23447 additions and 8 deletions

View File

@ -12,7 +12,9 @@
#
ifneq ($(findstring MALLOC_DEBUG,$(MENUSELECT_CFLAGS)),)
ifeq ($(findstring astmm.h,$(ASTCFLAGS)),)
ASTCFLAGS+=-include $(ASTTOPDIR)/include/asterisk/astmm.h
endif
endif
ifeq ($(findstring LOADABLE_MODULES,$(MENUSELECT_CFLAGS)),)

View File

@ -48,3 +48,16 @@ bindaddr=127.0.0.1
; To produce a certificate you can e.g. use openssl
; openssl req -new -x509 -days 365 -nodes -out /tmp/foo.pem -keyout /tmp/foo.pem
;
;prefix=asterisk
; The post_mappings section maps URLs to real paths on the filesystem. If a
; POST is done from within an authenticated manager session to one of the
; configured POST mappings, then any files in the POST will be placed in the
; configured directory.
;
;[post_mappings]
;
; In this example, if the prefix option is set to "asterisk", then using the
; POST URL: /asterisk/uploads will put files in /var/lib/asterisk/uploads/.
;uploads = /var/lib/asterisk/uploads/
;

6
configure vendored
View File

@ -1,5 +1,5 @@
#! /bin/sh
# From configure.ac Revision: 58948 .
# From configure.ac Revision: 59203 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.60.
#
@ -16007,7 +16007,9 @@ done
for ac_func in asprintf atexit bzero dup2 endpwent floor ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap pow putenv re_comp regcomp rint select setenv socket sqrt strcasecmp strcasestr strchr strcspn strdup strerror strncasecmp strndup strnlen strrchr strsep strspn strstr strtol strtoq unsetenv utime vasprintf
for ac_func in asprintf atexit bzero dup2 endpwent floor ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap pow putenv re_comp regcomp rint select setenv socket sqrt strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtol strtoq unsetenv utime vasprintf
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
{ echo "$as_me:$LINENO: checking for $ac_func" >&5

View File

@ -275,7 +275,7 @@ AC_FUNC_STRNLEN
AC_FUNC_STRTOD
AC_FUNC_UTIME_NULL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([asprintf atexit bzero dup2 endpwent floor ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap pow putenv re_comp regcomp rint select setenv socket sqrt strcasecmp strcasestr strchr strcspn strdup strerror strncasecmp strndup strnlen strrchr strsep strspn strstr strtol strtoq unsetenv utime vasprintf])
AC_CHECK_FUNCS([asprintf atexit bzero dup2 endpwent floor ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap pow putenv re_comp regcomp rint select setenv socket sqrt strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtol strtoq unsetenv utime vasprintf])
# https support (in main/http.c) uses funopen on BSD systems,
# fopencookie on linux

View File

@ -462,6 +462,12 @@
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strlcat' function. */
#undef HAVE_STRLCAT
/* Define to 1 if you have the `strlcpy' function. */
#undef HAVE_STRLCPY
/* Define to 1 if you have the `strncasecmp' function. */
#undef HAVE_STRNCASECMP

View File

@ -61,6 +61,14 @@ int unsetenv(const char *name);
int vasprintf(char **strp, const char *fmt, va_list ap);
#endif
#ifndef HAVE_STRLCAT
size_t strlcat(char *dst, const char *src, size_t siz);
#endif
#ifndef HAVE_STRLCPY
size_t strlcpy(char *dst, const char *src, size_t siz);
#endif
#ifdef SOLARIS
#define __BEGIN_DECLS
#define __END_DECLS

View File

@ -134,6 +134,22 @@ int ast_manager_register2(
*/
int ast_manager_unregister( char *action );
/*!
* \brief Verify a session's read permissions against a permission mask.
* \param ident session identity
* \param perm permission mask to verify
* \returns 1 if the session has the permission mask capabilities, otherwise 0
*/
int astman_verify_session_readpermissions(unsigned long ident, int perm);
/*!
* \brief Verify a session's write permissions against a permission mask.
* \param ident session identity
* \param perm permission mask to verify
* \returns 1 if the session has the permission mask capabilities, otherwise 0
*/
int astman_verify_session_writepermissions(unsigned long ident, int perm);
/*! External routines may send asterisk manager events this way */
/*! \param category Event category, matches manager authorization
\param event Event name

View File

@ -133,7 +133,10 @@ else
H323LDLIBS=
endif
asterisk: $(OBJS) editline/libedit.a db1-ast/libdb1.a $(AST_EMBED_LDSCRIPTS)
minimime/libmmime.a:
@cd minimime && $(MAKE) libmmime.a
asterisk: $(OBJS) editline/libedit.a db1-ast/libdb1.a minimime/libmmime.a $(AST_EMBED_LDSCRIPTS)
@$(CC) -c -o buildinfo.o $(ASTCFLAGS) buildinfo.c
$(ECHO_PREFIX) echo " [LD] $^ -> $@"
$(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(ASTLDFLAGS) $(H323LDFLAGS) $^ buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(H323LDLIBS)
@ -145,3 +148,6 @@ clean::
@if [ -f editline/Makefile ]; then $(MAKE) -C editline distclean ; fi
@$(MAKE) -C db1-ast clean
@$(MAKE) -C stdtime clean
@$(MAKE) -C minimime clean
.PHONY: minimime/libmmime.a

View File

@ -21,8 +21,9 @@
* \brief http server for AMI access
*
* \author Mark Spencer <markster@digium.com>
* This program implements a tiny http server supporting the "get" method
* only and was inspired by micro-httpd by Jef Poskanzer
*
* This program implements a tiny http server
* and was inspired by micro-httpd by Jef Poskanzer
*
* \ref AstHTTP - AMI over the http protocol
*/
@ -47,6 +48,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <fcntl.h>
#include <pthread.h>
#include "minimime/mm.h"
#include "asterisk/cli.h"
#include "asterisk/http.h"
#include "asterisk/utils.h"
@ -55,6 +58,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/config.h"
#include "asterisk/stringfields.h"
#include "asterisk/version.h"
#include "asterisk/manager.h"
#define MAX_PREFIX 80
#define DEFAULT_PREFIX "/asterisk"
@ -93,6 +97,14 @@ static struct server_args https_desc = {
static AST_RWLIST_HEAD_STATIC(uris, ast_http_uri); /*!< list of supported handlers */
struct ast_http_post_mapping {
AST_RWLIST_ENTRY(ast_http_post_mapping) entry;
char *from;
char *to;
};
static AST_RWLIST_HEAD_STATIC(post_mappings, ast_http_post_mapping);
/* all valid URIs must be prepended by the string in prefix. */
static char prefix[MAX_PREFIX];
static int enablestatic;
@ -329,6 +341,225 @@ void ast_http_uri_unlink(struct ast_http_uri *urih)
AST_RWLIST_UNLOCK(&uris);
}
/*! \note This assumes that the post_mappings list is locked */
static struct ast_http_post_mapping *find_post_mapping(const char *uri)
{
struct ast_http_post_mapping *post_map;
if (!ast_strlen_zero(prefix) && strncmp(prefix, uri, strlen(prefix))) {
ast_log(LOG_DEBUG, "URI %s does not have prefix %s\n", uri, prefix);
return NULL;
}
uri += strlen(prefix);
if (*uri == '/')
uri++;
AST_RWLIST_TRAVERSE(&post_mappings, post_map, entry) {
if (!strcmp(uri, post_map->from))
return post_map;
}
return NULL;
}
static int get_filename(struct mm_mimepart *part, char *fn, size_t fn_len)
{
const char *filename;
filename = mm_content_getdispositionparambyname(part->type, "filename");
if (ast_strlen_zero(filename))
return -1;
ast_copy_string(fn, filename, fn_len);
return 0;
}
static void post_raw(struct mm_mimepart *part, const char *post_dir, const char *fn)
{
char filename[PATH_MAX];
FILE *f;
const char *body;
size_t body_len;
snprintf(filename, sizeof(filename), "%s/%s", post_dir, fn);
if (option_debug)
ast_log(LOG_DEBUG, "Posting raw data to %s\n", filename);
if (!(f = fopen(filename, "w"))) {
ast_log(LOG_WARNING, "Unable to open %s for writing file from a POST!\n", filename);
return;
}
if (!(body = mm_mimepart_getbody(part, 0))) {
if (option_debug)
ast_log(LOG_DEBUG, "Couldn't get the mimepart body\n");
fclose(f);
return;
}
body_len = mm_mimepart_getlength(part);
if (option_debug)
ast_log(LOG_DEBUG, "Body length is %ld\n", body_len);
fwrite(body, 1, body_len, f);
fclose(f);
}
static struct ast_str *handle_post(struct server_instance *ser, char *uri,
int *status, char **title, int *contentlength, struct ast_variable *headers,
struct ast_variable *cookies)
{
char buf;
FILE *f;
size_t res;
struct ast_variable *var;
int content_len = 0;
MM_CTX *ctx;
int mm_res, i;
struct ast_http_post_mapping *post_map;
const char *post_dir;
unsigned long ident = 0;
for (var = cookies; var; var = var->next) {
if (strcasecmp(var->name, "mansession_id"))
continue;
if (sscanf(var->value, "%lx", &ident) != 1) {
*status = 400;
*title = ast_strdup("Bad Request");
return ast_http_error(400, "Bad Request", NULL, "The was an error parsing the request.");
}
if (!astman_verify_session_writepermissions(ident, EVENT_FLAG_CONFIG)) {
*status = 401;
*title = ast_strdup("Unauthorized");
return ast_http_error(401, "Unauthorized", NULL, "You are not authorized to make this request.");
}
break;
}
if (!var) {
*status = 401;
*title = ast_strdup("Unauthorized");
return ast_http_error(401, "Unauthorized", NULL, "You are not authorized to make this request.");
}
if (!(f = tmpfile()))
return NULL;
for (var = headers; var; var = var->next) {
if (!strcasecmp(var->name, "Content-Length")) {
if ((sscanf(var->value, "%u", &content_len)) != 1) {
ast_log(LOG_ERROR, "Invalid Content-Length in POST request!\n");
fclose(f);
return NULL;
}
if (option_debug)
ast_log(LOG_DEBUG, "Got a Content-Length of %d\n", content_len);
} else if (!strcasecmp(var->name, "Content-Type"))
fprintf(f, "Content-Type: %s\r\n\r\n", var->value);
}
while ((res = fread(&buf, 1, 1, ser->f))) {
fwrite(&buf, 1, 1, f);
content_len--;
if (!content_len)
break;
}
if (fseek(f, SEEK_SET, 0)) {
if (option_debug)
ast_log(LOG_DEBUG, "Failed to seek temp file back to beginning.\n");
fclose(f);
return NULL;
}
AST_RWLIST_RDLOCK(&post_mappings);
if (!(post_map = find_post_mapping(uri))) {
if (option_debug)
ast_log(LOG_DEBUG, "%s is not a valid URI for POST\n", uri);
AST_RWLIST_UNLOCK(&post_mappings);
fclose(f);
*status = 404;
*title = ast_strdup("Not Found");
return ast_http_error(404, "Not Found", NULL, "The requested URL was not found on this server.");
}
post_dir = ast_strdupa(post_map->to);
post_map = NULL;
AST_RWLIST_UNLOCK(&post_mappings);
if (option_debug)
ast_log(LOG_DEBUG, "Going to post files to dir %s\n", post_dir);
if (!(ctx = mm_context_new())) {
fclose(f);
return NULL;
}
mm_res = mm_parse_fileptr(ctx, f, MM_PARSE_LOOSE, 0);
fclose(f);
if (mm_res == -1) {
ast_log(LOG_ERROR, "Error parsing MIME data\n");
mm_context_free(ctx);
*status = 400;
*title = ast_strdup("Bad Request");
return ast_http_error(400, "Bad Request", NULL, "The was an error parsing the request.");
}
mm_res = mm_context_countparts(ctx);
if (!mm_res) {
ast_log(LOG_ERROR, "Invalid MIME data, found no parts!\n");
mm_context_free(ctx);
*status = 400;
*title = ast_strdup("Bad Request");
return ast_http_error(400, "Bad Request", NULL, "The was an error parsing the request.");
}
if (option_debug) {
if (mm_context_iscomposite(ctx))
ast_log(LOG_DEBUG, "Found %d MIME parts\n", mm_res - 1);
else
ast_log(LOG_DEBUG, "We have a flat (not multi-part) message\n");
}
for (i = 1; i < mm_res; i++) {
struct mm_mimepart *part;
char fn[PATH_MAX];
if (!(part = mm_context_getpart(ctx, i))) {
if (option_debug)
ast_log(LOG_DEBUG, "Failed to get mime part num %d\n", i);
continue;
}
if (get_filename(part, fn, sizeof(fn))) {
if (option_debug)
ast_log(LOG_DEBUG, "Failed to retrieve a filename for part num %d\n", i);
continue;
}
if (!part->type) {
if (option_debug)
ast_log(LOG_DEBUG, "This part has no content struct?\n");
continue;
}
/* XXX This assumes the MIME part body is not encoded! */
post_raw(part, post_dir, fn);
}
mm_context_free(ctx);
*status = 200;
*title = ast_strdup("OK");
return ast_http_error(200, "OK", NULL, "File successfully uploaded.");
}
static struct ast_str *handle_uri(struct sockaddr_in *sin, char *uri, int *status, char **title, int *contentlength, struct ast_variable **cookies)
{
char *c;
@ -520,7 +751,7 @@ static void *httpd_helper_thread(void *data)
char buf[4096];
char cookie[4096];
struct server_instance *ser = data;
struct ast_variable *var, *prev=NULL, *vars=NULL;
struct ast_variable *var, *prev=NULL, *vars=NULL, *headers = NULL;
char *uri, *title=NULL;
int status = 200, contentlength = 0;
struct ast_str *out = NULL;
@ -549,8 +780,23 @@ static void *httpd_helper_thread(void *data)
ast_trim_blanks(cookie);
if (ast_strlen_zero(cookie))
break;
if (strncasecmp(cookie, "Cookie: ", 8))
if (strncasecmp(cookie, "Cookie: ", 8)) {
char *name, *value;
value = ast_strdupa(cookie);
name = strsep(&value, ":");
if (!value)
continue;
value = ast_skip_blanks(value);
if (ast_strlen_zero(value))
continue;
var = ast_variable_new(name, value);
if (!var)
continue;
var->next = headers;
headers = var;
continue;
}
/* TODO - The cookie parsing code below seems to work
in IE6 and FireFox 1.5. However, it is not entirely
@ -596,6 +842,8 @@ static void *httpd_helper_thread(void *data)
if (!*uri)
out = ast_http_error(400, "Bad Request", NULL, "Invalid Request");
else if (!strcasecmp(buf, "post"))
out = handle_post(ser, uri, &status, &title, &contentlength, headers, vars);
else if (strcasecmp(buf, "get"))
out = ast_http_error(501, "Not Implemented", NULL,
"Attempt to use unimplemented / unsupported method");
@ -851,6 +1099,47 @@ static void add_redirect(const char *value)
AST_RWLIST_UNLOCK(&uri_redirects);
}
static void destroy_post_mapping(struct ast_http_post_mapping *post_map)
{
if (post_map->from)
free(post_map->from);
if (post_map->to)
free(post_map->to);
free(post_map);
}
static void destroy_post_mappings(void)
{
struct ast_http_post_mapping *post_map;
AST_RWLIST_WRLOCK(&post_mappings);
while ((post_map = AST_RWLIST_REMOVE_HEAD(&post_mappings, entry)))
destroy_post_mapping(post_map);
AST_RWLIST_UNLOCK(&post_mappings);
}
static void add_post_mapping(const char *from, const char *to)
{
struct ast_http_post_mapping *post_map;
if (!(post_map = ast_calloc(1, sizeof(*post_map))))
return;
if (!(post_map->from = ast_strdup(from))) {
destroy_post_mapping(post_map);
return;
}
if (!(post_map->to = ast_strdup(to))) {
destroy_post_mapping(post_map);
return;
}
AST_RWLIST_WRLOCK(&post_mappings);
AST_RWLIST_INSERT_TAIL(&post_mappings, post_map, entry);
AST_RWLIST_UNLOCK(&post_mappings);
}
static int __ast_http_load(int reload)
{
struct ast_config *cfg;
@ -869,6 +1158,7 @@ static int __ast_http_load(int reload)
memset(&https_desc.sin, 0, sizeof(https_desc.sin));
https_desc.sin.sin_port = htons(8089);
strcpy(newprefix, DEFAULT_PREFIX);
http_tls_cfg.enabled = 0;
@ -884,6 +1174,8 @@ static int __ast_http_load(int reload)
free(redirect);
AST_RWLIST_UNLOCK(&uri_redirects);
destroy_post_mappings();
cfg = ast_config_load("http.conf");
if (cfg) {
v = ast_variable_browse(cfg, "general");
@ -931,6 +1223,10 @@ static int __ast_http_load(int reload)
ast_log(LOG_WARNING, "Ignoring unknown option '%s' in http.conf\n", v->name);
}
}
for (v = ast_variable_browse(cfg, "post_mappings"); v; v = v->next)
add_post_mapping(v->name, v->value);
ast_config_destroy(cfg);
}
if (!have_sslbindaddr)
@ -943,6 +1239,7 @@ static int __ast_http_load(int reload)
server_start(&http_desc);
if (ssl_setup(https_desc.tls_cfg))
server_start(&https_desc);
return 0;
}
@ -950,6 +1247,7 @@ static int handle_show_http(int fd, int argc, char *argv[])
{
struct ast_http_uri *urih;
struct http_uri_redirect *redirect;
struct ast_http_post_mapping *post_map;
if (argc != 3)
return RESULT_SHOWUSAGE;
@ -986,6 +1284,14 @@ static int handle_show_http(int fd, int argc, char *argv[])
ast_cli(fd, " None.\n");
AST_RWLIST_UNLOCK(&uri_redirects);
ast_cli(fd, "\nPOST mappings:\n");
AST_RWLIST_RDLOCK(&post_mappings);
AST_LIST_TRAVERSE(&post_mappings, post_map, entry)
ast_cli(fd, "%s/%s => %s\n", prefix, post_map->from, post_map->to);
ast_cli(fd, "%s\n", AST_LIST_EMPTY(&post_mappings) ? "None.\n" : "");
AST_RWLIST_UNLOCK(&post_mappings);
return RESULT_SUCCESS;
}
@ -1006,8 +1312,12 @@ static struct ast_cli_entry cli_http[] = {
int ast_http_init(void)
{
mm_library_init();
mm_codec_registerdefaultcodecs();
ast_http_uri_link(&statusuri);
ast_http_uri_link(&staticuri);
ast_cli_register_multiple(cli_http, sizeof(cli_http) / sizeof(struct ast_cli_entry));
return __ast_http_load(0);
}

View File

@ -2592,6 +2592,44 @@ static struct mansession *find_session(unsigned long ident)
return s;
}
int astman_verify_session_readpermissions(unsigned long ident, int perm)
{
int result = 0;
struct mansession *s;
AST_LIST_LOCK(&sessions);
AST_LIST_TRAVERSE(&sessions, s, list) {
ast_mutex_lock(&s->__lock);
if ((s->managerid == ident) && (s->readperm & perm)) {
result = 1;
ast_mutex_unlock(&s->__lock);
break;
}
ast_mutex_unlock(&s->__lock);
}
AST_LIST_UNLOCK(&sessions);
return result;
}
int astman_verify_session_writepermissions(unsigned long ident, int perm)
{
int result = 0;
struct mansession *s;
AST_LIST_LOCK(&sessions);
AST_LIST_TRAVERSE(&sessions, s, list) {
ast_mutex_lock(&s->__lock);
if ((s->managerid == ident) && (s->writeperm & perm)) {
result = 1;
ast_mutex_unlock(&s->__lock);
break;
}
ast_mutex_unlock(&s->__lock);
}
AST_LIST_UNLOCK(&sessions);
return result;
}
/*
* convert to xml with various conversion:
* mode & 1 -> lowercase;

4
main/minimime/.cvsignore Normal file
View File

@ -0,0 +1,4 @@
minimime
*.so.*
*.o
*.swp

1098
main/minimime/Doxyfile Normal file

File diff suppressed because it is too large Load Diff

7
main/minimime/Make.conf Normal file
View File

@ -0,0 +1,7 @@
CC=gcc
PREFIX=/usr
LIBNAME=libmmime.so.0.0
HAVE_STRLCAT=
HAVE_STRLCPY=
INSTALL=/usr/bin/install
HAVE_DEBUG=1

60
main/minimime/Makefile Normal file
View File

@ -0,0 +1,60 @@
#
# Asterisk -- A telephony toolkit for Linux.
#
# Makefile for resource modules
#
# Copyright (C) 2007, Digium, Inc.
#
# This program is free software, distributed under the terms of
# the GNU General Public License
#
-include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/menuselect.makedeps
include $(ASTTOPDIR)/Makefile.moddir_rules
LIBMMIME:=libmmime.a
MM_SRCS= \
mimeparser.tab.c \
mimeparser.yy.c \
mm_init.c \
mm_base64.c \
mm_codecs.c \
mm_contenttype.c \
mm_context.c \
mm_envelope.c \
mm_error.c \
mm_header.c \
mm_mem.c \
mm_mimepart.c \
mm_mimeutil.c \
mm_param.c \
mm_parse.c \
mm_util.c
MM_OBJS:=$(MM_SRCS:%.c=%.o)
MM_HDRS:=mm.h mm_util.h
ASTCFLAGS:=$(filter-out -Werror -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes,$(ASTCFLAGS))
all: $(LIBMMIME)
$(LIBMMIME): $(MM_OBJS)
$(ECHO_PREFIX) echo " [AR] $^ -> $@"
$(CMD_PREFIX) $(AR) cr $@ $^
$(CMD_PREFIX) $(RANLIB) $@
#mimeparser.yy.c: mimeparser.l
# flex -Pmimeparser_yy -omimeparser.yy.c mimeparser.l
#mimeparser.tab.c: mimeparser.y
# bison -d -pmimeparser_yy -omimeparser.tab.c mimeparser.y
clean::
rm -f $(LIBMMIME) *.o
.PHONY: clean all
ifneq ($(wildcard .*.d),)
include .*.d
endif

View File

@ -0,0 +1,67 @@
#ifndef _MIMEPARSER_H_INCLUDED
#define _MIMEPARSER_H_INCLUDED
#include "mm.h"
struct s_position
{
size_t opaque_start;
size_t start;
size_t end;
};
struct lexer_state
{
int header_state;
int lineno;
size_t current_pos;
int condition;
int is_envelope;
size_t message_len;
size_t buffer_length;
/* temporary marker variables */
size_t body_opaque_start;
size_t body_start;
size_t body_end;
size_t preamble_start;
size_t preamble_end;
size_t postamble_start;
size_t postamble_end;
char *boundary_string;
char *endboundary_string;
char *message_buffer;
};
struct parser_state
{
MM_CTX *ctx;
struct mm_mimepart *envelope;
struct mm_mimepart *temppart;
struct mm_mimepart *current_mimepart;
struct mm_content *ctype;
int parsemode;
int have_contenttype;
int debug;
int mime_parts;
struct lexer_state lstate;
};
#include "mimeparser.tab.h"
/**
* Prototypes for functions used by the parser routines
*/
int count_lines(char *);
int dprintf2(struct parser_state *, const char *, ...);
int mimeparser_yyparse(struct parser_state *, void *);
int mimeparser_yylex(YYSTYPE *, void *);
int mimeparser_yyerror(struct parser_state *, void *, const char *);
#endif /* ! _MIMEPARSER_H_INCLUDED */

483
main/minimime/mimeparser.l Normal file
View File

@ -0,0 +1,483 @@
%{
/*
* Copyright (c) 2004 Jann Fischer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/**
* This is a lexer file for parsing MIME compatible messages. It is intended
* to satisfy at least RFC 2045 (Format of Internet Message Bodies). It still
* has quite a few problems:
*
* - The parsing could probably be done in a more elegant way
* - I don't know what performance impact REJECT has on the parser
*/
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include "mimeparser.h"
#include "mimeparser.tab.h"
#define NAMEOF(v) #v
/* BC() is a debug wrapper for lex' BEGIN() macro */
#define BC(x) do { \
struct lexer_state *lstate = yyget_extra(yyscanner); \
BEGIN(x); \
lstate->condition = x; \
} while(0);
#define ZERO(x) memset(x, '\0', sizeof(x))
#define PREALLOC_BUFFER 100000
#undef YY_BUF_SIZE
#define YY_BUF_SIZE 65536
enum header_states
{
STATE_MAIL = 0,
STATE_CTYPE,
STATE_CDISP,
STATE_CENC,
STATE_MIME
};
%}
%option reentrant
%option yylineno
%option bison-bridge
%s headers
%s header
%s headervalue
%s tspecialvalue
%s comment
%s body
%s postamble
%s preamble
%s boundary
%s endboundary
%s endoffile
STRING [a-zA-Z0-9\-\.\_]
TSPECIAL [a-zA-Z0-9)(<>@,;:/\-.=_\+'? ]
TSPECIAL_LITE [a-zA-Z0-9)(<>@,-._+'?\[\]]
%%
<INITIAL,headers>^[a-zA-Z]+[a-zA-Z0-9\-\_]* {
yylval_param->string=strdup(yytext);
struct lexer_state *lstate = yyget_extra(yyscanner);
lstate->current_pos += yyleng;
BC(header);
/* Depending on what header we are processing, we enter a different
* state and return a different value.
*/
if (!strcasecmp(yytext, "Content-Type")) {
lstate->header_state = STATE_CTYPE;
return CONTENTTYPE_HEADER;
} else if (!strcasecmp(yytext, "Content-Transfer-Encoding")) {
lstate->header_state = STATE_CENC;
return CONTENTENCODING_HEADER;
} else if (!strcasecmp(yytext, "Content-Disposition")) {
lstate->header_state = STATE_CDISP;
return CONTENTDISPOSITION_HEADER;
} else if (!strcasecmp(yytext, "MIME-Version")) {
lstate->header_state = STATE_MAIL;
return MIMEVERSION_HEADER;
} else {
lstate->header_state = STATE_MAIL;
return MAIL_HEADER;
}
}
<INITIAL,headers>. {
struct lexer_state *lstate = yyget_extra(yyscanner);
/* dprintf2("Unknown header char: %c\n", *yytext); */
lstate->current_pos += yyleng;
return ANY;
}
<headers>^(\r\n|\n) {
struct lexer_state *lstate = yyget_extra(yyscanner);
lstate->lineno++;
lstate->current_pos += yyleng;
/* This marks the end of headers. Depending on whether we are in the
* envelope currently we need to parse either a body or the preamble
* now.
*/
if (lstate->is_envelope == 0 || lstate->boundary_string == NULL) {
BC(body);
lstate->body_start = lstate->current_pos;
} else {
lstate->is_envelope = 0;
lstate->preamble_start = lstate->current_pos;
BC(preamble);
}
return ENDOFHEADERS;
}
<header>\: {
struct lexer_state *lstate = yyget_extra(yyscanner);
BC(headervalue);
lstate->current_pos += yyleng;
return COLON;
}
<header>(\r\n|\n) {
struct lexer_state *lstate = yyget_extra(yyscanner);
BC(headers);
/* dprintf2("Invalid header, returning EOL\n"); */
lstate->current_pos += yyleng;
return EOL;
}
<headervalue>(\n|\r\n)[\ \t]+ {
struct lexer_state *lstate = yyget_extra(yyscanner);
lstate->current_pos += yyleng;
}
<headervalue>.+|(.+(\n|\r\n)[\ \t]+.+)+ {
struct lexer_state *lstate = yyget_extra(yyscanner);
if (lstate->header_state != STATE_MAIL && lstate->header_state != STATE_CENC) {
REJECT;
}
lstate->current_pos += yyleng;
while (*yytext && isspace(*yytext)) yytext++;
/* Do we actually have a header value? */
if (*yytext == '\0') {
yylval_param->string = strdup("");
} else {
yylval_param->string=strdup(yytext);
lstate->lineno += count_lines(yytext);
}
return WORD;
}
<headervalue,tspecialvalue>(\r\n|\n) {
struct lexer_state *lstate = yyget_extra(yyscanner);
/* marks the end of one header line */
lstate->lineno++;
BC(headers);
lstate->current_pos += yyleng;
return EOL;
}
<headervalue>;|;(\r\n|\n)[\ \t]+ {
struct lexer_state *lstate = yyget_extra(yyscanner);
lstate->lineno += count_lines(yytext);
lstate->current_pos += yyleng;
return SEMICOLON;
}
<headervalue>\= {
struct lexer_state *lstate = yyget_extra(yyscanner);
lstate->current_pos += yyleng;
return EQUAL;
}
<headervalue>\" {
struct lexer_state *lstate = yyget_extra(yyscanner);
BC(tspecialvalue);
lstate->current_pos += yyleng;
return *yytext;
}
<headervalue>{STRING}+|{TSPECIAL_LITE}+ {
struct lexer_state *lstate = yyget_extra(yyscanner);
yylval_param->string=strdup(yytext);
lstate->lineno += count_lines(yytext);
lstate->current_pos += yyleng;
return WORD;
}
<headervalue>[\ |\t]+ {
struct lexer_state *lstate = yyget_extra(yyscanner);
lstate->current_pos += yyleng;
}
<tspecialvalue>{TSPECIAL}+ {
struct lexer_state *lstate = yyget_extra(yyscanner);
lstate->lineno += count_lines(yytext);
yylval_param->string=strdup(yytext);
lstate->current_pos += yyleng;
return TSPECIAL;
}
<tspecialvalue>\" {
struct lexer_state *lstate = yyget_extra(yyscanner);
BC(headervalue);
lstate->current_pos += yyleng;
return *yytext;
}
<body>^\-\-{TSPECIAL}+\-\- {
struct lexer_state *lstate = yyget_extra(yyscanner);
/**
* Make sure we only catch matching boundaries, and not other lines
* that begin and end with two dashes. If we have catched a valid
* end boundary, which actually ends a body, we save the current
* position, put the token back on the input stream and let the
* endboundary condition parse the actual token.
*/
if (lstate->endboundary_string != NULL) {
if (strcmp(lstate->endboundary_string, yytext)) {
/* dprintf2("YYTEXT != end_boundary: '%s'\n", yytext); */
REJECT;
} else {
lstate->current_pos += yyleng;
/* dprintf2("YYTEXT == lstate->end_boundary: '%s'\n", yytext); */
if (lstate->body_start) {
yylval_param->position.opaque_start =
lstate->body_opaque_start;
yylval_param->position.start = lstate->body_start;
yylval_param->position.end = lstate->current_pos - yyleng;
lstate->body_opaque_start = 0;
lstate->body_start = 0;
lstate->body_end = 0;
yyless(0);
BC(endboundary);
return BODY;
}
}
} else {
}
REJECT;
}
<body,preamble>^\-\-{TSPECIAL}+ {
struct lexer_state *lstate = yyget_extra(yyscanner);
/**
* Make sure we only catch matching boundaries, and not other lines
* that begin with two dashes.
*/
if (lstate->boundary_string != NULL) {
if (strcmp(lstate->boundary_string, yytext)) {
/* dprintf2("YYTEXT != boundary: '%s'\n", yytext);*/
REJECT;
} else {
/* dprintf2("YYTEXT == boundary: '%s'\n", yytext);*/
if (lstate->body_start) {
yylval_param->position.opaque_start = lstate->body_opaque_start;
yylval_param->position.start = lstate->body_start;
yylval_param->position.end = lstate->current_pos;
lstate->body_opaque_start = 0;
lstate->body_start = 0;
lstate->body_end = 0;
yyless(0);
BC(boundary);
return BODY;
} else if (lstate->preamble_start) {
yylval_param->position.start = lstate->preamble_start;
yylval_param->position.end = lstate->current_pos;
lstate->preamble_start = lstate->preamble_end = 0;
yyless(0);
BC(boundary);
return PREAMBLE;
} else {
BC(boundary);
yylval_param->string = strdup(yytext);
lstate->current_pos += yyleng;
return(BOUNDARY);
}
}
} else {
}
REJECT;
}
<body>(\r\n|\n) {
struct lexer_state *lstate = yyget_extra(yyscanner);
lstate->current_pos += yyleng;
lstate->lineno++;
}
<body>\r {
struct lexer_state *lstate = yyget_extra(yyscanner);
lstate->current_pos += yyleng;
/* dprintf2("stray CR in body...\n"); */
}
<body>[^\r\n]+ {
struct lexer_state *lstate = yyget_extra(yyscanner);
lstate->current_pos += yyleng;
}
<body><<EOF>> {
struct lexer_state *lstate = yyget_extra(yyscanner);
if (lstate->boundary_string == NULL && lstate->body_start) {
yylval_param->position.opaque_start = 0;
yylval_param->position.start = lstate->body_start;
yylval_param->position.end = lstate->current_pos;
lstate->body_start = 0;
return BODY;
} else if (lstate->body_start) {
return POSTAMBLE;
}
yyterminate();
}
<preamble,postamble>(\r\n|\n) {
struct lexer_state *lstate = yyget_extra(yyscanner);
/* dprintf2("Preamble CR/LF at line %d\n", lineno); */
lstate->lineno++;
lstate->current_pos += yyleng;
}
<boundary>[^\r\n]+ {
struct lexer_state *lstate = yyget_extra(yyscanner);
yylval_param->string = strdup(yytext);
lstate->current_pos += yyleng;
return BOUNDARY;
}
<endboundary>[^\r\n]+ {
struct lexer_state *lstate = yyget_extra(yyscanner);
yylval_param->string = strdup(yytext);
lstate->current_pos += yyleng;
return ENDBOUNDARY;
}
<boundary>(\r\n|\n) {
struct lexer_state *lstate = yyget_extra(yyscanner);
BC(headers);
lstate->lineno++;
lstate->current_pos += yyleng;
lstate->body_opaque_start = lstate->current_pos;
return EOL;
}
<endboundary>(\r\n|\n) {
struct lexer_state *lstate = yyget_extra(yyscanner);
BC(postamble);
lstate->lineno++;
lstate->current_pos += yyleng;
}
<preamble>. {
struct lexer_state *lstate = yyget_extra(yyscanner);
lstate->current_pos += yyleng;
}
<postamble>. {
struct lexer_state *lstate = yyget_extra(yyscanner);
lstate->current_pos += yyleng;
}
(\r\n|\n) {
struct lexer_state *lstate = yyget_extra(yyscanner);
lstate->lineno++;
lstate->current_pos += yyleng;
return EOL;
}
. {
struct lexer_state *lstate = yyget_extra(yyscanner);
lstate->current_pos += yyleng;
return((int)*yytext);
}
%%
void reset_lexer_state(void *yyscanner, struct parser_state *pstate)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
struct lexer_state *lstate = &(pstate->lstate);
yyset_extra((void*)lstate, yyscanner);
BEGIN(0);
lstate->header_state = STATE_MAIL;
lstate->lineno = 0;
lstate->current_pos = 1;
lstate->condition = 0;
lstate->is_envelope = 1;
lstate->message_len = 0;
lstate->buffer_length = 0;
/* temporary marker variables */
lstate->body_opaque_start = 0;
lstate->body_start = 0;
lstate->body_end = 0;
lstate->preamble_start = 0;
lstate->preamble_end = 0;
lstate->postamble_start = 0;
lstate->postamble_end = 0;
}
void
PARSER_setbuffer(char *string, yyscan_t scanner)
{
struct lexer_state *lstate = yyget_extra(scanner);
lstate->message_buffer = string;
yy_scan_string(string, scanner);
}
void
PARSER_setfp(FILE *fp, yyscan_t yyscanner)
{
/* looks like a bug in bison 2.2a -- the wrong code is generated for yyset_in !! */
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
yyg->yyin_r = fp;
if (0) {
/* This is just to make a compiler warning go away */
yyunput(0, NULL, yyscanner);
}
}
/**
* Counts how many lines a given string represents in the message (in case of
* folded header values, for example, or a message body).
*/
int
count_lines(char *txt)
{
char *o;
int line;
line = 0;
for (o = txt; *o != '\0'; o++)
if (*o == '\n')
line++;
return line;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,112 @@
/* A Bison parser, made by GNU Bison 2.3. */
/* Skeleton interface for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
ANY = 258,
COLON = 259,
DASH = 260,
DQUOTE = 261,
ENDOFHEADERS = 262,
EOL = 263,
EOM = 264,
EQUAL = 265,
MIMEVERSION_HEADER = 266,
SEMICOLON = 267,
CONTENTDISPOSITION_HEADER = 268,
CONTENTENCODING_HEADER = 269,
CONTENTTYPE_HEADER = 270,
MAIL_HEADER = 271,
HEADERVALUE = 272,
BOUNDARY = 273,
ENDBOUNDARY = 274,
CONTENTTYPE_VALUE = 275,
TSPECIAL = 276,
WORD = 277,
BODY = 278,
PREAMBLE = 279,
POSTAMBLE = 280
};
#endif
/* Tokens. */
#define ANY 258
#define COLON 259
#define DASH 260
#define DQUOTE 261
#define ENDOFHEADERS 262
#define EOL 263
#define EOM 264
#define EQUAL 265
#define MIMEVERSION_HEADER 266
#define SEMICOLON 267
#define CONTENTDISPOSITION_HEADER 268
#define CONTENTENCODING_HEADER 269
#define CONTENTTYPE_HEADER 270
#define MAIL_HEADER 271
#define HEADERVALUE 272
#define BOUNDARY 273
#define ENDBOUNDARY 274
#define CONTENTTYPE_VALUE 275
#define TSPECIAL 276
#define WORD 277
#define BODY 278
#define PREAMBLE 279
#define POSTAMBLE 280
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
#line 69 "mimeparser.y"
{
int number;
char *string;
struct s_position position;
}
/* Line 1529 of yacc.c. */
#line 105 "mimeparser.tab.h"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif

750
main/minimime/mimeparser.y Normal file
View File

@ -0,0 +1,750 @@
%{
/*
* Copyright (c) 2004 Jann Fischer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/**
* These are the grammatic definitions in yacc syntax to parse MIME conform
* messages.
*
* TODO:
* - honour parse flags passed to us (partly done)
* - parse Content-Disposition header (partly done)
* - parse Content-Encoding header
*/
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include "mimeparser.h"
#include "mm.h"
#include "mm_internal.h"
int set_boundary(char *,struct parser_state *);
int mimeparser_yywrap(void);
void reset_environ(struct parser_state *pstate);
int PARSER_initialize(struct parser_state *pstate, void *yyscanner);
typedef void *yyscan_t;
static char *PARSE_readmessagepart(size_t, size_t, size_t, size_t *,yyscan_t, struct parser_state *);
FILE *mimeparser_yyget_in (yyscan_t yyscanner );
%}
%pure-parser
%parse-param {struct parser_state *pstate}
%parse-param {void *yyscanner}
%lex-param {void *yyscanner}
%union
{
int number;
char *string;
struct s_position position;
}
%token ANY
%token COLON
%token DASH
%token DQUOTE
%token ENDOFHEADERS
%token EOL
%token EOM
%token EQUAL
%token MIMEVERSION_HEADER
%token SEMICOLON
%token <string> CONTENTDISPOSITION_HEADER
%token <string> CONTENTENCODING_HEADER
%token <string> CONTENTTYPE_HEADER
%token <string> MAIL_HEADER
%token <string> HEADERVALUE
%token <string> BOUNDARY
%token <string> ENDBOUNDARY
%token <string> CONTENTTYPE_VALUE
%token <string> TSPECIAL
%token <string> WORD
%token <position> BODY
%token <position> PREAMBLE
%token <position> POSTAMBLE
%type <string> content_disposition
%type <string> contenttype_parameter_value
%type <string> mimetype
%type <string> body
%start message
%%
/* This is a parser for a MIME-conform message, which is in either single
* part or multi part format.
*/
message :
multipart_message
|
singlepart_message
;
multipart_message:
headers preamble
{
mm_context_attachpart(pstate->ctx, pstate->current_mimepart);
pstate->current_mimepart = mm_mimepart_new();
pstate->have_contenttype = 0;
}
mimeparts endboundary postamble
{
dprintf2(pstate,"This was a multipart message\n");
}
;
singlepart_message:
headers body
{
dprintf2(pstate,"This was a single part message\n");
mm_context_attachpart(pstate->ctx, pstate->current_mimepart);
}
;
headers :
header headers
|
end_headers
{
/* If we did not find a Content-Type header for the current
* MIME part (or envelope), we create one and attach it.
* According to the RFC, a type of "text/plain" and a
* charset of "us-ascii" can be assumed.
*/
struct mm_content *ct;
struct mm_param *param;
if (!pstate->have_contenttype) {
ct = mm_content_new();
mm_content_settype(ct, "text/plain");
param = mm_param_new();
param->name = xstrdup("charset");
param->value = xstrdup("us-ascii");
mm_content_attachtypeparam(ct, param);
mm_mimepart_attachcontenttype(pstate->current_mimepart, ct);
}
pstate->have_contenttype = 0;
}
|
header
;
preamble:
PREAMBLE
{
char *preamble;
size_t offset;
if ($1.start != $1.end) {
preamble = PARSE_readmessagepart(0, $1.start, $1.end,
&offset,yyscanner,pstate);
if (preamble == NULL) {
return(-1);
}
pstate->ctx->preamble = preamble;
dprintf2(pstate,"PREAMBLE:\n%s\n", preamble);
}
}
|
;
postamble:
POSTAMBLE
{
}
|
;
mimeparts:
mimeparts mimepart
|
mimepart
;
mimepart:
boundary headers body
{
if (mm_context_attachpart(pstate->ctx, pstate->current_mimepart) == -1) {
mm_errno = MM_ERROR_ERRNO;
return(-1);
}
pstate->temppart = mm_mimepart_new();
pstate->current_mimepart = pstate->temppart;
pstate->mime_parts++;
}
;
header :
mail_header
|
contenttype_header
{
pstate->have_contenttype = 1;
if (mm_content_iscomposite(pstate->envelope->type)) {
pstate->ctx->messagetype = MM_MSGTYPE_MULTIPART;
} else {
pstate->ctx->messagetype = MM_MSGTYPE_FLAT;
}
}
|
contentdisposition_header
|
contentencoding_header
|
mimeversion_header
|
invalid_header
{
if (pstate->parsemode != MM_PARSE_LOOSE) {
mm_errno = MM_ERROR_PARSE;
mm_error_setmsg("invalid header encountered");
mm_error_setlineno(pstate->lstate.lineno);
return(-1);
} else {
/* TODO: attach MM_WARNING_INVHDR */
}
}
;
mail_header:
MAIL_HEADER COLON WORD EOL
{
struct mm_mimeheader *hdr;
hdr = mm_mimeheader_generate($1, $3);
mm_mimepart_attachheader(pstate->current_mimepart, hdr);
}
|
MAIL_HEADER COLON EOL
{
struct mm_mimeheader *hdr;
if (pstate->parsemode != MM_PARSE_LOOSE) {
mm_errno = MM_ERROR_MIME;
mm_error_setmsg("invalid header encountered");
mm_error_setlineno(pstate->lstate.lineno);
return(-1);
} else {
/* TODO: attach MM_WARNING_INVHDR */
}
hdr = mm_mimeheader_generate($1, xstrdup(""));
mm_mimepart_attachheader(pstate->current_mimepart, hdr);
}
;
contenttype_header:
CONTENTTYPE_HEADER COLON mimetype EOL
{
mm_content_settype(pstate->ctype, "%s", $3);
mm_mimepart_attachcontenttype(pstate->current_mimepart, pstate->ctype);
dprintf2(pstate,"Content-Type -> %s\n", $3);
pstate->ctype = mm_content_new();
}
|
CONTENTTYPE_HEADER COLON mimetype contenttype_parameters EOL
{
mm_content_settype(pstate->ctype, "%s", $3);
mm_mimepart_attachcontenttype(pstate->current_mimepart, pstate->ctype);
dprintf2(pstate,"Content-Type (P) -> %s\n", $3);
pstate->ctype = mm_content_new();
}
;
contentdisposition_header:
CONTENTDISPOSITION_HEADER COLON content_disposition EOL
{
dprintf2(pstate,"Content-Disposition -> %s\n", $3);
pstate->ctype->disposition_type = xstrdup($3);
}
|
CONTENTDISPOSITION_HEADER COLON content_disposition content_disposition_parameters EOL
{
dprintf2(pstate,"Content-Disposition (P) -> %s; params\n", $3);
pstate->ctype->disposition_type = xstrdup($3);
}
;
content_disposition:
WORD
{
/*
* According to RFC 2183, the content disposition value may
* only be "inline", "attachment" or an extension token. We
* catch invalid values here if we are not in loose parsing
* mode.
*/
if (strcasecmp($1, "inline") && strcasecmp($1, "attachment")
&& strncasecmp($1, "X-", 2)) {
if (pstate->parsemode != MM_PARSE_LOOSE) {
mm_errno = MM_ERROR_MIME;
mm_error_setmsg("invalid content-disposition");
return(-1);
}
} else {
/* TODO: attach MM_WARNING_INVHDR */
}
$$ = $1;
}
;
contentencoding_header:
CONTENTENCODING_HEADER COLON WORD EOL
{
dprintf2(pstate,"Content-Transfer-Encoding -> %s\n", $3);
}
;
mimeversion_header:
MIMEVERSION_HEADER COLON WORD EOL
{
dprintf2(pstate,"MIME-Version -> '%s'\n", $3);
}
;
invalid_header:
any EOL
;
any:
any ANY
|
ANY
;
mimetype:
WORD '/' WORD
{
char type[255];
snprintf(type, sizeof(type), "%s/%s", $1, $3);
$$ = type;
}
;
contenttype_parameters:
SEMICOLON contenttype_parameter contenttype_parameters
|
SEMICOLON contenttype_parameter
|
SEMICOLON
{
if (pstate->parsemode != MM_PARSE_LOOSE) {
mm_errno = MM_ERROR_MIME;
mm_error_setmsg("invalid Content-Type header");
mm_error_setlineno(pstate->lstate.lineno);
return(-1);
} else {
/* TODO: attach MM_WARNING_INVHDR */
}
}
;
content_disposition_parameters:
SEMICOLON content_disposition_parameter content_disposition_parameters
|
SEMICOLON content_disposition_parameter
|
SEMICOLON
{
if (pstate->parsemode != MM_PARSE_LOOSE) {
mm_errno = MM_ERROR_MIME;
mm_error_setmsg("invalid Content-Disposition header");
mm_error_setlineno(pstate->lstate.lineno);
return(-1);
} else {
/* TODO: attach MM_WARNING_INVHDR */
}
}
;
contenttype_parameter:
WORD EQUAL contenttype_parameter_value
{
struct mm_param *param;
param = mm_param_new();
dprintf2(pstate,"Param: '%s', Value: '%s'\n", $1, $3);
/* Catch an eventual boundary identifier */
if (!strcasecmp($1, "boundary")) {
if (pstate->lstate.boundary_string == NULL) {
set_boundary($3,pstate);
} else {
if (pstate->parsemode != MM_PARSE_LOOSE) {
mm_errno = MM_ERROR_MIME;
mm_error_setmsg("duplicate boundary "
"found");
return -1;
} else {
/* TODO: attach MM_WARNING_DUPPARAM */
}
}
}
param->name = xstrdup($1);
param->value = xstrdup($3);
mm_content_attachtypeparam(pstate->ctype, param);
}
;
content_disposition_parameter:
WORD EQUAL contenttype_parameter_value
{
struct mm_param *param;
param = mm_param_new();
param->name = xstrdup($1);
param->value = xstrdup($3);
mm_content_attachdispositionparam(pstate->ctype, param);
}
;
contenttype_parameter_value:
WORD
{
dprintf2(pstate,"contenttype_param_val: WORD=%s\n", $1);
$$ = $1;
}
|
TSPECIAL
{
dprintf2(pstate,"contenttype_param_val: TSPECIAL\n");
/* For broken MIME implementation */
if (pstate->parsemode != MM_PARSE_LOOSE) {
mm_errno = MM_ERROR_MIME;
mm_error_setmsg("tspecial without quotes");
mm_error_setlineno(pstate->lstate.lineno);
return(-1);
} else {
/* TODO: attach MM_WARNING_INVAL */
}
$$ = $1;
}
|
'"' TSPECIAL '"'
{
dprintf2(pstate,"contenttype_param_val: \"TSPECIAL\"\n" );
$$ = $2;
}
;
end_headers :
ENDOFHEADERS
{
dprintf2(pstate,"End of headers at line %d\n", pstate->lstate.lineno);
}
;
boundary :
BOUNDARY EOL
{
if (pstate->lstate.boundary_string == NULL) {
mm_errno = MM_ERROR_PARSE;
mm_error_setmsg("internal incosistency");
mm_error_setlineno(pstate->lstate.lineno);
return(-1);
}
if (strcmp(pstate->lstate.boundary_string, $1)) {
mm_errno = MM_ERROR_PARSE;
mm_error_setmsg("invalid boundary: '%s' (%d)", $1, strlen($1));
mm_error_setlineno(pstate->lstate.lineno);
return(-1);
}
dprintf2(pstate,"New MIME part... (%s)\n", $1);
}
;
endboundary :
ENDBOUNDARY
{
if (pstate->lstate.endboundary_string == NULL) {
mm_errno = MM_ERROR_PARSE;
mm_error_setmsg("internal incosistency");
mm_error_setlineno(pstate->lstate.lineno);
return(-1);
}
if (strcmp(pstate->lstate.endboundary_string, $1)) {
mm_errno = MM_ERROR_PARSE;
mm_error_setmsg("invalid end boundary: %s", $1);
mm_error_setlineno(pstate->lstate.lineno);
return(-1);
}
dprintf2(pstate,"End of MIME message\n");
}
;
body:
BODY
{
char *body;
size_t offset;
dprintf2(pstate,"BODY (%d/%d), SIZE %d\n", $1.start, $1.end, $1.end - $1.start);
body = PARSE_readmessagepart($1.opaque_start, $1.start, $1.end,
&offset,yyscanner,pstate);
if (body == NULL) {
return(-1);
}
pstate->current_mimepart->opaque_body = body;
pstate->current_mimepart->body = body + offset;
pstate->current_mimepart->opaque_length = $1.end - $1.start - 2 + offset;
pstate->current_mimepart->length = pstate->current_mimepart->opaque_length - offset;
}
;
%%
/*
* This function gets the specified part from the currently parsed message.
*/
static char *
PARSE_readmessagepart(size_t opaque_start, size_t real_start, size_t end,
size_t *offset, yyscan_t yyscanner, struct parser_state *pstate)
{
size_t body_size;
size_t current;
size_t start;
char *body;
/* calculate start and offset markers for the opaque and
* header stripped body message.
*/
if (opaque_start > 0) {
/* Multipart message */
if (real_start) {
if (real_start < opaque_start) {
mm_errno = MM_ERROR_PARSE;
mm_error_setmsg("internal incosistency (S:%d/O:%d)",
real_start,
opaque_start);
return(NULL);
}
start = opaque_start;
*offset = real_start - start;
/* Flat message */
} else {
start = opaque_start;
*offset = 0;
}
} else {
start = real_start;
*offset = 0;
}
/* The next three cases should NOT happen anytime */
if (end <= start) {
mm_errno = MM_ERROR_PARSE;
mm_error_setmsg("internal incosistency,2");
mm_error_setlineno(pstate->lstate.lineno);
return(NULL);
}
if (start < *offset) {
mm_errno = MM_ERROR_PARSE;
mm_error_setmsg("internal incosistency, S:%d,O:%d,L:%d", start, offset, pstate->lstate.lineno);
mm_error_setlineno(pstate->lstate.lineno);
return(NULL);
}
if (start < 0 || end < 0) {
mm_errno = MM_ERROR_PARSE;
mm_error_setmsg("internal incosistency,4");
mm_error_setlineno(pstate->lstate.lineno);
return(NULL);
}
/* XXX: do we want to enforce a maximum body size? make it a
* parser option? */
/* Read in the body message */
body_size = end - start;
if (body_size < 1) {
mm_errno = MM_ERROR_PARSE;
mm_error_setmsg("size of body cannot be < 1");
mm_error_setlineno(pstate->lstate.lineno);
return(NULL);
}
body = (char *)malloc(body_size + 1);
if (body == NULL) {
mm_errno = MM_ERROR_ERRNO;
return(NULL);
}
/* Get the message body either from a stream or a memory
* buffer.
*/
if (mimeparser_yyget_in(yyscanner) != NULL) {
FILE *x = mimeparser_yyget_in(yyscanner);
current = ftell(x);
fseek(x, start - 1, SEEK_SET);
fread(body, body_size - 1, 1, x);
fseek(x, current, SEEK_SET);
} else if (pstate->lstate.message_buffer != NULL) {
strlcpy(body, pstate->lstate.message_buffer + start - 1, body_size);
}
return(body);
}
int
yyerror(struct parser_state *pstate, void *yyscanner, const char *str)
{
mm_errno = MM_ERROR_PARSE;
mm_error_setmsg("%s", str);
mm_error_setlineno(pstate->lstate.lineno);
return -1;
}
int
mimeparser_yywrap(void)
{
return 1;
}
/**
* Sets the boundary value for the current message
*/
int
set_boundary(char *str, struct parser_state *pstate)
{
size_t blen;
blen = strlen(str);
pstate->lstate.boundary_string = (char *)malloc(blen + 3);
pstate->lstate.endboundary_string = (char *)malloc(blen + 5);
if (pstate->lstate.boundary_string == NULL || pstate->lstate.endboundary_string == NULL) {
if (pstate->lstate.boundary_string != NULL) {
free(pstate->lstate.boundary_string);
}
if (pstate->lstate.endboundary_string != NULL) {
free(pstate->lstate.endboundary_string);
}
return -1;
}
pstate->ctx->boundary = xstrdup(str);
snprintf(pstate->lstate.boundary_string, blen + 3, "--%s", str);
snprintf(pstate->lstate.endboundary_string, blen + 5, "--%s--", str);
return 0;
}
/**
* Debug printf()
*/
int
dprintf2(struct parser_state *pstate, const char *fmt, ...)
{
va_list ap;
char *msg;
if (pstate->debug == 0) return 1;
va_start(ap, fmt);
vasprintf(&msg, fmt, ap);
va_end(ap);
fprintf(stderr, "%s", msg);
free(msg);
return 0;
}
void reset_environ(struct parser_state *pstate)
{
pstate->lstate.lineno = 0;
pstate->lstate.boundary_string = NULL;
pstate->lstate.endboundary_string = NULL;
pstate->lstate.message_buffer = NULL;
pstate->mime_parts = 0;
pstate->debug = 0;
pstate->envelope = NULL;
pstate->temppart = NULL;
pstate->ctype = NULL;
pstate->current_mimepart = NULL;
pstate->have_contenttype = 0;
}
/**
* Initializes the parser engine.
*/
int
PARSER_initialize(struct parser_state *pstate, void *yyscanner)
{
void reset_lexer_state(void *yyscanner, struct parser_state *);
#if 0
if (pstate->ctx != NULL) {
xfree(pstate->ctx);
pstate->ctx = NULL;
}
if (pstate->envelope != NULL) {
xfree(pstate->envelope);
pstate->envelope = NULL;
}
if (pstate->ctype != NULL) {
xfree(pstate->ctype);
pstate->ctype = NULL;
}
#endif
/* yydebug = 1; */
reset_environ(pstate);
reset_lexer_state(yyscanner,pstate);
pstate->envelope = mm_mimepart_new();
pstate->current_mimepart = pstate->envelope;
pstate->ctype = mm_content_new();
pstate->have_contenttype = 0;
return 1;
}

File diff suppressed because it is too large Load Diff

245
main/minimime/minimime.c Normal file
View File

@ -0,0 +1,245 @@
/*
* Copyright (c) 2004 Jann Fischer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* MiniMIME test program
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <getopt.h>
#include <err.h>
#include "mm.h"
void
usage(void)
{
fprintf(stderr,
"MiniMIME test suite\n"
"Usage: ./minimime [-m] <filename>\n\n"
" -m : use memory based scanning\n\n"
);
exit(1);
}
int
main(int argc, char **argv)
{
MM_CTX *ctx;
struct mm_mimeheader *header, *lastheader;
struct mm_warning *lastwarning;
struct mm_mimepart *part;
struct mm_content *ct;
int parts, i;
struct stat st;
int fd;
char *buf;
int scan_mode = 0;
lastheader = NULL;
while ((i = getopt(argc, argv, "m")) != -1) {
switch(i) {
case 'm':
scan_mode = 1;
break;
default:
usage();
}
}
argc -= optind;
argv += optind;
if (argc < 1) {
usage();
}
#ifdef __HAVE_LEAK_DETECTION
/* Initialize memory leak detection if compiled in */
MM_leakd_init();
#endif
/* Initialize MiniMIME library */
mm_library_init();
/* Register all default codecs (base64/qp) */
mm_codec_registerdefaultcodecs();
do {
/* Create a new context */
ctx = mm_context_new();
/* Parse a file into our context */
if (scan_mode == 0) {
i = mm_parse_file(ctx, argv[0], MM_PARSE_LOOSE, 0);
} else {
if (stat(argv[0], &st) == -1) {
err(1, "stat");
}
if ((fd = open(argv[0], O_RDONLY)) == -1) {
err(1, "open");
}
buf = (char *)malloc(st.st_size);
if (buf == NULL) {
err(1, "malloc");
}
if (read(fd, buf, st.st_size) != st.st_size) {
err(1, "read");
}
close(fd);
buf[st.st_size] = '\0';
i = mm_parse_mem(ctx, buf, MM_PARSE_LOOSE, 0);
}
if (i == -1 || mm_errno != MM_ERROR_NONE) {
printf("ERROR: %s at line %d\n", mm_error_string(), mm_error_lineno());
exit(1);
}
/* Get the number of MIME parts */
parts = mm_context_countparts(ctx);
if (parts == 0) {
printf("ERROR: got zero MIME parts, huh\n");
exit(1);
} else {
if (mm_context_iscomposite(ctx)) {
printf("Got %d MIME parts\n", parts - 1);
} else {
printf("Flat message (not multipart)\n");
}
}
/* Get the main MIME part */
part = mm_context_getpart(ctx, 0);
if (part == NULL) {
fprintf(stderr, "Could not get envelope part\n");
exit(1);
}
printf("Printing envelope headers:\n");
/* Print all headers */
if (mm_mimepart_headers_start(part, &lastheader) == -1) {
fprintf(stderr, "No headers in envelope\n");
exit(1);
}
while ((header = mm_mimepart_headers_next(part, &lastheader)) != NULL) {
printf("%s: %s\n", header->name, header->value);
}
printf("%s\n", mm_content_tostring(part->type));
printf("\n");
ct = part->type;
assert(ct != NULL);
if (mm_context_iscomposite(ctx) == 0) {
printf("Printing body part for FLAT message:\n");
part = mm_context_getpart(ctx, 0);
printf("%s", part->body);
}
/* Loop through all MIME parts beginning with 1 */
for (i = 1; i < mm_context_countparts(ctx); i++) {
char *decoded;
printf("Printing headers for MIME part %d\n", i);
/* Get the current MIME entity */
part = mm_context_getpart(ctx, i);
if (part == NULL) {
fprintf(stderr, "Should have %d parts but "
"couldn't retrieve part %d",
mm_context_countparts(ctx), i);
exit(1);
}
/* Print all headers */
if (mm_mimepart_headers_start(part, &lastheader) == -1) {
printf("Ups no headers\n");
}
while ((header = mm_mimepart_headers_next(part, &lastheader)) != NULL) {
printf("%s: %s\n", header->name, header->value);
}
printf("Part Type: %s\n", mm_content_tostring(part->type));
/* Print MIME part body */
printf("\nPrinting message BODY:\n%s\n", (char *)part->opaque_body);
decoded = mm_mimepart_decode(part);
if (decoded != NULL) {
printf("DECODED:\n%s\n", decoded);
free(decoded);
}
}
/* Print out all warnings that we might have received */
if (mm_context_haswarnings(ctx) > 0) {
lastwarning = NULL;
fprintf(stderr, "WARNINGS:\n");
#if 0
while ((warning = mm_warning_next(ctx, &lastwarning))
!= NULL) {
fprintf(stderr, " -> %s\n", warning->message);
}
#endif
}
printf("ENVELOPE:\n");
do {
char *env;
size_t env_len;
mm_context_flatten(ctx, &env, &env_len, 0);
printf("%s", env);
} while (0);
mm_context_free(ctx);
ctx = NULL;
#ifdef __HAVE_LEAK_DETECTION
MM_leakd_printallocated();
#endif
} while (0);
return 0;
}

View File

@ -0,0 +1,28 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: Bug List</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<h1><a class="anchor" name="bug">Bug List</a></h1><a class="anchor" name="_bug000001"></a> <dl>
<dt>Global <a class="el" href="group__contenttype.html#g7bab273d117c6c0cacad20361d8fb1c8">mm_content_setmaintype</a> </dt>
<dd>The xfree() call could lead to undesirable results. Do we really need it? </dd>
</dl>
<p>
<a class="anchor" name="_bug000002"></a> <dl>
<dt>Global <a class="el" href="group__contenttype.html#g14b0738410d566ad2312405946f22212">mm_content_setsubtype</a> </dt>
<dd>The xfree() call could lead to undesirable results. Do we really need it? </dd>
</dl>
<hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:08 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,358 @@
BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV {
font-family: Geneva, Arial, Helvetica, sans-serif;
}
BODY,TD {
font-size: 90%;
}
H1 {
text-align: center;
font-size: 160%;
}
H2 {
font-size: 120%;
}
H3 {
font-size: 100%;
}
CAPTION { font-weight: bold }
DIV.qindex {
width: 100%;
background-color: #e8eef2;
border: 1px solid #84b0c7;
text-align: center;
margin: 2px;
padding: 2px;
line-height: 140%;
}
DIV.nav {
width: 100%;
background-color: #e8eef2;
border: 1px solid #84b0c7;
text-align: center;
margin: 2px;
padding: 2px;
line-height: 140%;
}
DIV.navtab {
background-color: #e8eef2;
border: 1px solid #84b0c7;
text-align: center;
margin: 2px;
margin-right: 15px;
padding: 2px;
}
TD.navtab {
font-size: 70%;
}
A.qindex {
text-decoration: none;
font-weight: bold;
color: #1A419D;
}
A.qindex:visited {
text-decoration: none;
font-weight: bold;
color: #1A419D
}
A.qindex:hover {
text-decoration: none;
background-color: #ddddff;
}
A.qindexHL {
text-decoration: none;
font-weight: bold;
background-color: #6666cc;
color: #ffffff;
border: 1px double #9295C2;
}
A.qindexHL:hover {
text-decoration: none;
background-color: #6666cc;
color: #ffffff;
}
A.qindexHL:visited { text-decoration: none; background-color: #6666cc; color: #ffffff }
A.el { text-decoration: none; font-weight: bold }
A.elRef { font-weight: bold }
A.code:link { text-decoration: none; font-weight: normal; color: #0000FF}
A.code:visited { text-decoration: none; font-weight: normal; color: #0000FF}
A.codeRef:link { font-weight: normal; color: #0000FF}
A.codeRef:visited { font-weight: normal; color: #0000FF}
A:hover { text-decoration: none; background-color: #f2f2ff }
DL.el { margin-left: -1cm }
.fragment {
font-family: monospace, fixed;
font-size: 95%;
}
PRE.fragment {
border: 1px solid #CCCCCC;
background-color: #f5f5f5;
margin-top: 4px;
margin-bottom: 4px;
margin-left: 2px;
margin-right: 8px;
padding-left: 6px;
padding-right: 6px;
padding-top: 4px;
padding-bottom: 4px;
}
DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px }
DIV.groupHeader {
margin-left: 16px;
margin-top: 12px;
margin-bottom: 6px;
font-weight: bold;
}
DIV.groupText { margin-left: 16px; font-style: italic; font-size: 90% }
BODY {
background: white;
color: black;
margin-right: 20px;
margin-left: 20px;
}
TD.indexkey {
background-color: #e8eef2;
font-weight: bold;
padding-right : 10px;
padding-top : 2px;
padding-left : 10px;
padding-bottom : 2px;
margin-left : 0px;
margin-right : 0px;
margin-top : 2px;
margin-bottom : 2px;
border: 1px solid #CCCCCC;
}
TD.indexvalue {
background-color: #e8eef2;
font-style: italic;
padding-right : 10px;
padding-top : 2px;
padding-left : 10px;
padding-bottom : 2px;
margin-left : 0px;
margin-right : 0px;
margin-top : 2px;
margin-bottom : 2px;
border: 1px solid #CCCCCC;
}
TR.memlist {
background-color: #f0f0f0;
}
P.formulaDsp { text-align: center; }
IMG.formulaDsp { }
IMG.formulaInl { vertical-align: middle; }
SPAN.keyword { color: #008000 }
SPAN.keywordtype { color: #604020 }
SPAN.keywordflow { color: #e08000 }
SPAN.comment { color: #800000 }
SPAN.preprocessor { color: #806020 }
SPAN.stringliteral { color: #002080 }
SPAN.charliteral { color: #008080 }
.mdescLeft {
padding: 0px 8px 4px 8px;
font-size: 80%;
font-style: italic;
background-color: #FAFAFA;
border-top: 1px none #E0E0E0;
border-right: 1px none #E0E0E0;
border-bottom: 1px none #E0E0E0;
border-left: 1px none #E0E0E0;
margin: 0px;
}
.mdescRight {
padding: 0px 8px 4px 8px;
font-size: 80%;
font-style: italic;
background-color: #FAFAFA;
border-top: 1px none #E0E0E0;
border-right: 1px none #E0E0E0;
border-bottom: 1px none #E0E0E0;
border-left: 1px none #E0E0E0;
margin: 0px;
}
.memItemLeft {
padding: 1px 0px 0px 8px;
margin: 4px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-color: #E0E0E0;
border-right-color: #E0E0E0;
border-bottom-color: #E0E0E0;
border-left-color: #E0E0E0;
border-top-style: solid;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
background-color: #FAFAFA;
font-size: 80%;
}
.memItemRight {
padding: 1px 8px 0px 8px;
margin: 4px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-color: #E0E0E0;
border-right-color: #E0E0E0;
border-bottom-color: #E0E0E0;
border-left-color: #E0E0E0;
border-top-style: solid;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
background-color: #FAFAFA;
font-size: 80%;
}
.memTemplItemLeft {
padding: 1px 0px 0px 8px;
margin: 4px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-color: #E0E0E0;
border-right-color: #E0E0E0;
border-bottom-color: #E0E0E0;
border-left-color: #E0E0E0;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
background-color: #FAFAFA;
font-size: 80%;
}
.memTemplItemRight {
padding: 1px 8px 0px 8px;
margin: 4px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-color: #E0E0E0;
border-right-color: #E0E0E0;
border-bottom-color: #E0E0E0;
border-left-color: #E0E0E0;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
background-color: #FAFAFA;
font-size: 80%;
}
.memTemplParams {
padding: 1px 0px 0px 8px;
margin: 4px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-color: #E0E0E0;
border-right-color: #E0E0E0;
border-bottom-color: #E0E0E0;
border-left-color: #E0E0E0;
border-top-style: solid;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
color: #606060;
background-color: #FAFAFA;
font-size: 80%;
}
.search { color: #003399;
font-weight: bold;
}
FORM.search {
margin-bottom: 0px;
margin-top: 0px;
}
INPUT.search { font-size: 75%;
color: #000080;
font-weight: normal;
background-color: #e8eef2;
}
TD.tiny { font-size: 75%;
}
a {
color: #1A41A8;
}
a:visited {
color: #2A3798;
}
.dirtab { padding: 4px;
border-collapse: collapse;
border: 1px solid #84b0c7;
}
TH.dirtab { background: #e8eef2;
font-weight: bold;
}
HR { height: 1px;
border: none;
border-top: 1px solid black;
}
/* Style for detailed member documentation */
.memtemplate {
font-size: 80%;
color: #606060;
font-weight: normal;
}
.memnav {
background-color: #e8eef2;
border: 1px solid #84b0c7;
text-align: center;
margin: 2px;
margin-right: 15px;
padding: 2px;
}
.memitem {
padding: 4px;
background-color: #eef3f5;
border-width: 1px;
border-style: solid;
border-color: #dedeee;
-moz-border-radius: 8px 8px 8px 8px;
}
.memname {
white-space: nowrap;
font-weight: bold;
}
.memdoc{
padding-left: 10px;
}
.memproto {
background-color: #d5e1e8;
width: 100%;
border-width: 1px;
border-style: solid;
border-color: #84b0c7;
font-weight: bold;
-moz-border-radius: 8px 8px 8px 8px;
}
.paramkey {
text-align: right;
}
.paramtype {
white-space: nowrap;
}
.paramname {
color: #602020;
font-style: italic;
white-space: nowrap;
}
/* End Styling for detailed member documentation */
/* for the tree view */
.ftvtree {
font-family: sans-serif;
margin:0.5em;
}
.directory { font-size: 9pt; font-weight: bold; }
.directory h3 { margin: 0px; margin-top: 1em; font-size: 11pt; }
.directory > h3 { margin-top: 0; }
.directory p { margin: 0px; white-space: nowrap; }
.directory div { display: none; margin: 0px; }
.directory img { vertical-align: -30%; }

View File

@ -0,0 +1,44 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: File Index</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<div class="tabs">
<ul>
<li id="current"><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul></div>
<h1>MiniMIME File List</h1>Here is a list of all documented files with brief descriptions:<table>
<tr><td class="indexkey"><b>mimeparser.h</b> <a href="mimeparser_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey"><b>mimeparser.tab.h</b> <a href="mimeparser_8tab_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey"><b>mm.h</b> <a href="mm_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey"><a class="el" href="mm__codecs_8c.html">mm_codecs.c</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey"><a class="el" href="mm__contenttype_8c.html">mm_contenttype.c</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey"><a class="el" href="mm__context_8c.html">mm_context.c</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey"><a class="el" href="mm__envelope_8c.html">mm_envelope.c</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey"><a class="el" href="mm__error_8c.html">mm_error.c</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey"><a class="el" href="mm__header_8c.html">mm_header.c</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey"><a class="el" href="mm__internal_8h.html">mm_internal.h</a> <a href="mm__internal_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey"><b>mm_mem.h</b> <a href="mm__mem_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey"><a class="el" href="mm__mimepart_8c.html">mm_mimepart.c</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey"><a class="el" href="mm__mimeutil_8c.html">mm_mimeutil.c</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey"><a class="el" href="mm__param_8c.html">mm_param.c</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey"><a class="el" href="mm__parse_8c.html">mm_parse.c</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey"><b>mm_queue.h</b> <a href="mm__queue_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey"><a class="el" href="mm__util_8c.html">mm_util.c</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey"><b>mm_util.h</b> <a href="mm__util_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
</table>
<hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:09 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,198 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: Data Fields</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li id="current"><a href="globals.html"><span>Globals</span></a></li>
</ul></div>
<div class="tabs">
<ul>
<li id="current"><a href="globals.html"><span>All</span></a></li>
<li><a href="globals_func.html"><span>Functions</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="#index_m"><span>m</span></a></li>
<li><a href="#index_x"><span>x</span></a></li>
</ul>
</div>
<p>
Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:
<p>
<h3><a class="anchor" name="index_m">- m -</a></h3><ul>
<li>mm_addchars()
: <a class="el" href="group__util.html#g0747d4b4e33644263e6d73d2d8d4818b">mm_util.c</a>
<li>mm_codec_hasdecoder()
: <a class="el" href="group__codecs.html#g6ccb0f7a1d7c870dc3dae04f31d6ccca">mm_codecs.c</a>
<li>mm_codec_hasencoder()
: <a class="el" href="group__codecs.html#g50ff257b794ceaec7aedf9ae18bfcc57">mm_codecs.c</a>
<li>mm_codec_isregistered()
: <a class="el" href="group__codecs.html#g9e19f6343128fd7e4ec57c3d55049b55">mm_codecs.c</a>
<li>mm_codec_register()
: <a class="el" href="group__codecs.html#gf97a7311c909888ed9f6f14d6f1bf397">mm_codecs.c</a>
<li>mm_codec_registerdefaultcodecs()
: <a class="el" href="group__codecs.html#gf39e72460fb85f5ca41f6e270a68aacc">mm_codecs.c</a>
<li>mm_codec_unregister()
: <a class="el" href="group__codecs.html#g0c71696bc70f834386193e3c7a0e2ca4">mm_codecs.c</a>
<li>mm_codec_unregisterall()
: <a class="el" href="group__codecs.html#g7c9e6538f84c368be2b56a3c9ba702be">mm_codecs.c</a>
<li>mm_content_attachparam()
: <a class="el" href="group__contenttype.html#g080b7ed798ed497dcd635a6bab86962f">mm_contenttype.c</a>
<li>mm_content_free()
: <a class="el" href="group__contenttype.html#g404314481125849bce869ee4b0f647af">mm_contenttype.c</a>
<li>mm_content_getencoding()
: <a class="el" href="group__contenttype.html#gbff87e581cd04db16e91245e9e9de67d">mm_contenttype.c</a>
<li>mm_content_getmaintype()
: <a class="el" href="group__contenttype.html#gb213081017abf6bc7e601c6bf4214924">mm_contenttype.c</a>
<li>mm_content_getparambyname()
: <a class="el" href="group__contenttype.html#g451441ee557ab5ef29477f3dc8330bf6">mm_contenttype.c</a>
<li>mm_content_getsubtype()
: <a class="el" href="group__contenttype.html#g97f77ef40c14cd0fb397bad358ee5d49">mm_contenttype.c</a>
<li>mm_content_iscomposite()
: <a class="el" href="group__contenttype.html#ga7fa479f27e73dea57257421d8fc9fc5">mm_contenttype.c</a>
<li>mm_content_isvalidencoding()
: <a class="el" href="group__contenttype.html#gb724b5979182fa272fe4fd1b72b395d5">mm_contenttype.c</a>
<li>mm_content_new()
: <a class="el" href="group__contenttype.html#g3880ac74a20b4a9f610a4159568e1801">mm_contenttype.c</a>
<li>mm_content_paramstostring()
: <a class="el" href="group__contenttype.html#g792e7d33fbb30e0123408bcef9d3204c">mm_contenttype.c</a>
<li>mm_content_setencoding()
: <a class="el" href="group__contenttype.html#gea945e48ac5cca846715543634b9afe4">mm_contenttype.c</a>
<li>mm_content_setmaintype()
: <a class="el" href="group__contenttype.html#g7bab273d117c6c0cacad20361d8fb1c8">mm_contenttype.c</a>
<li>mm_content_setsubtype()
: <a class="el" href="group__contenttype.html#g14b0738410d566ad2312405946f22212">mm_contenttype.c</a>
<li>mm_content_tostring()
: <a class="el" href="group__contenttype.html#g18a99c95e35a76f13a77a83c4231e738">mm_contenttype.c</a>
<li>mm_context_attachpart()
: <a class="el" href="group__context.html#gec3ca486a61b392ff68774242086768e">mm_context.c</a>
<li>mm_context_attachpart_after()
: <a class="el" href="group__context.html#g73a3dd187053aeabca4836dc28a6c468">mm_context.c</a>
<li>mm_context_countparts()
: <a class="el" href="group__context.html#gf5bb032ad1c481d31d7b1b0710939712">mm_context.c</a>
<li>mm_context_deletepart()
: <a class="el" href="group__context.html#g53d20c33a401539ef1ffa45f3dddb983">mm_context.c</a>
<li>mm_context_flatten()
: <a class="el" href="group__context.html#g5288136ab923605f6508c09359ae5772">mm_context.c</a>
<li>mm_context_free()
: <a class="el" href="group__context.html#g76392d5269e9ef340c2f5f8336f7193b">mm_context.c</a>
<li>mm_context_generateboundary()
: <a class="el" href="group__context.html#g9710e485f51167099d90f0d659979068">mm_context.c</a>
<li>mm_context_getpart()
: <a class="el" href="group__context.html#g57fea229675f3e56a77eb40bb8193ee3">mm_context.c</a>
<li>mm_context_haswarnings()
: <a class="el" href="group__context.html#g8733dee7d83d3205349a7ee4ee5b2750">mm_context.c</a>
<li>mm_context_iscomposite()
: <a class="el" href="group__context.html#g1e73cadba4acd3ef9dd148dd0c2c3e70">mm_context.c</a>
<li>mm_context_new()
: <a class="el" href="group__context.html#g919fd41f85534d9c87c256857faa2610">mm_context.c</a>
<li>mm_context_setpreamble()
: <a class="el" href="group__context.html#gc0e7cc297516618d4773830a1988fc8d">mm_context.c</a>
<li>mm_envelope_getheaders()
: <a class="el" href="group__envelope.html#g38f1164142cedfc3253b068a81f85563">mm_envelope.c</a>
<li>mm_envelope_getrecipients()
: <a class="el" href="group__envelope.html#ge63da17c56867ca2406a4eaf73230baf">mm_envelope.c</a>
<li>mm_envelope_setheader()
: <a class="el" href="group__envelope.html#gb2c43c1645e42ae0860c902ce1dda788">mm_envelope.c</a>
<li>mm_error_init()
: <a class="el" href="group__error.html#g69de7c9bee1d535593a55807590de543">mm_error.c</a>
<li>mm_error_setmsg()
: <a class="el" href="group__error.html#g92006c97728639d8f32f5bc4c6e2a47f">mm_error.c</a>
<li>mm_error_string()
: <a class="el" href="group__error.html#g8654857a3ac349b87d798902912371a3">mm_error.c</a>
<li>mm_mimeheader_free()
: <a class="el" href="mm__header_8c.html#61e3e62728f720ac381196ec59303064">mm_header.c</a>
<li>mm_mimeheader_generate()
: <a class="el" href="mm__header_8c.html#07a7f7dcebc91aa86f5478e1d84341a1">mm_header.c</a>
<li>mm_mimeheader_new()
: <a class="el" href="mm__header_8c.html#2f2c5f2f640111caf3096ed46b5986a4">mm_header.c</a>
<li>mm_mimepart_attachcontenttype()
: <a class="el" href="group__mimepart.html#g01822bc93b4741af75b5379384354e37">mm_mimepart.c</a>
<li>mm_mimepart_attachheader()
: <a class="el" href="group__mimepart.html#g46a674ff6b9873c0c45fa4eb5d94fd62">mm_mimepart.c</a>
<li>mm_mimepart_countheaderbyname()
: <a class="el" href="group__mimepart.html#gf89da502ac54306994bdb452448a8026">mm_mimepart.c</a>
<li>mm_mimepart_countheaders()
: <a class="el" href="group__mimepart.html#g44c78abfb0535312bcb427a2cd220026">mm_mimepart.c</a>
<li>mm_mimepart_decode()
: <a class="el" href="group__mimepart.html#g4551bf4460e5d165bbcd9f32d4f625de">mm_mimepart.c</a>
<li>mm_mimepart_flatten()
: <a class="el" href="group__mimepart.html#gf19d3ace5ae174b3eaa35f9ddbe6e216">mm_mimepart.c</a>
<li>mm_mimepart_free()
: <a class="el" href="group__mimepart.html#gbf47790a0bb96b22bc5e236bc40cb32e">mm_mimepart.c</a>
<li>mm_mimepart_fromfile()
: <a class="el" href="group__mimepart.html#ged8112012a337371ae8093adb1ab6d27">mm_mimepart.c</a>
<li>mm_mimepart_getbody()
: <a class="el" href="group__mimepart.html#g52dc9f27a2801e4f6abb1effd2ed838d">mm_mimepart.c</a>
<li>mm_mimepart_getheaderbyname()
: <a class="el" href="group__mimepart.html#ga3ca298eaa82f4ef3ea731511ac84e53">mm_mimepart.c</a>
<li>mm_mimepart_getheadervalue()
: <a class="el" href="group__mimepart.html#g779f11f7a6a54f83763b5ef6ff87e48f">mm_mimepart.c</a>
<li>mm_mimepart_getlength()
: <a class="el" href="group__mimepart.html#gf8ccae1737dc4b9b91958fe448da677f">mm_mimepart.c</a>
<li>mm_mimepart_gettype()
: <a class="el" href="group__mimepart.html#g210e2ceee56f8349f6778006da87d080">mm_mimepart.c</a>
<li>mm_mimepart_headers_next()
: <a class="el" href="group__mimepart.html#g8e9064736efdeebf4b257cc45f8a6adf">mm_mimepart.c</a>
<li>mm_mimepart_headers_start()
: <a class="el" href="group__mimepart.html#g4440bdcfddf88eb642b6a834a0557176">mm_mimepart.c</a>
<li>mm_mimepart_new()
: <a class="el" href="group__mimepart.html#g417e5dd361e30cddb91e1d9a5e30b223">mm_mimepart.c</a>
<li>mm_mimepart_setbody()
: <a class="el" href="group__mimepart.html#gd1def098c00edc546b03e98e9ff8b27a">mm_mimepart.c</a>
<li>mm_mimepart_setdefaultcontenttype()
: <a class="el" href="group__mimepart.html#g164bb39a266559574c252f11266809ff">mm_mimepart.c</a>
<li>mm_mimeutil_gendate()
: <a class="el" href="mm__mimeutil_8c.html#a7b7f63b42dfa7a7f907b615aa4cd057">mm_mimeutil.c</a>
<li>mm_param_free()
: <a class="el" href="group__param.html#g46339038e995799e6a3e37512f442fc9">mm_param.c</a>
<li>mm_param_generate()
: <a class="el" href="group__param.html#gd3970def45b8bede334f4b89a41dec15">mm_param.c</a>
<li>mm_param_getname()
: <a class="el" href="group__param.html#g0e0ddccf47a2b1e0ad5bcc52c7b39753">mm_param.c</a>
<li>mm_param_getvalue()
: <a class="el" href="group__param.html#g3c6f8cddd409de3000c31584e140561e">mm_param.c</a>
<li>mm_param_new()
: <a class="el" href="group__param.html#gd3ac756551bf5a29a07d5992bfdbde09">mm_param.c</a>
<li>mm_param_setname()
: <a class="el" href="group__param.html#g2a266c63c7e89cf829b2af8e995e55e8">mm_param.c</a>
<li>mm_param_setvalue()
: <a class="el" href="group__param.html#gca3e636ab5700462eb32ca5bc19e4cc6">mm_param.c</a>
<li>mm_parse_file()
: <a class="el" href="mm__parse_8c.html#cc9f623682b05f330c46e72e4e9d66cc">mm_parse.c</a>
<li>mm_parse_mem()
: <a class="el" href="mm__parse_8c.html#58c960b6017f13d4e4ec5f09b3c38495">mm_parse.c</a>
<li>mm_stripchars()
: <a class="el" href="group__util.html#gf62be7dd21e545f8db72f3c9e3b6a3c3">mm_util.c</a>
<li>mm_uncomment()
: <a class="el" href="group__util.html#g49c016ff4cfd02f1b019c4dce5aac357">mm_util.c</a>
<li>mm_unquote()
: <a class="el" href="group__util.html#gf0f89a29a634f6f1f833abb1e214a6b1">mm_util.c</a>
</ul>
<h3><a class="anchor" name="index_x">- x -</a></h3><ul>
<li>xmalloc()
: <a class="el" href="group__util.html#g2ff4ef58da7e543466e75f20f2a2d8b7">mm_util.c</a>
<li>xrealloc()
: <a class="el" href="group__util.html#ge14637b4672461f1f0bee822406d68dc">mm_util.c</a>
<li>xstrsep()
: <a class="el" href="group__util.html#g3ae25483c8a42f6562f2a916a511228f">mm_util.c</a>
</ul>
<hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:09 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,198 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: Data Fields</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li id="current"><a href="globals.html"><span>Globals</span></a></li>
</ul></div>
<div class="tabs">
<ul>
<li><a href="globals.html"><span>All</span></a></li>
<li id="current"><a href="globals_func.html"><span>Functions</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="#index_m"><span>m</span></a></li>
<li><a href="#index_x"><span>x</span></a></li>
</ul>
</div>
<p>
&nbsp;
<p>
<h3><a class="anchor" name="index_m">- m -</a></h3><ul>
<li>mm_addchars()
: <a class="el" href="group__util.html#g0747d4b4e33644263e6d73d2d8d4818b">mm_util.c</a>
<li>mm_codec_hasdecoder()
: <a class="el" href="group__codecs.html#g6ccb0f7a1d7c870dc3dae04f31d6ccca">mm_codecs.c</a>
<li>mm_codec_hasencoder()
: <a class="el" href="group__codecs.html#g50ff257b794ceaec7aedf9ae18bfcc57">mm_codecs.c</a>
<li>mm_codec_isregistered()
: <a class="el" href="group__codecs.html#g9e19f6343128fd7e4ec57c3d55049b55">mm_codecs.c</a>
<li>mm_codec_register()
: <a class="el" href="group__codecs.html#gf97a7311c909888ed9f6f14d6f1bf397">mm_codecs.c</a>
<li>mm_codec_registerdefaultcodecs()
: <a class="el" href="group__codecs.html#gf39e72460fb85f5ca41f6e270a68aacc">mm_codecs.c</a>
<li>mm_codec_unregister()
: <a class="el" href="group__codecs.html#g0c71696bc70f834386193e3c7a0e2ca4">mm_codecs.c</a>
<li>mm_codec_unregisterall()
: <a class="el" href="group__codecs.html#g7c9e6538f84c368be2b56a3c9ba702be">mm_codecs.c</a>
<li>mm_content_attachparam()
: <a class="el" href="group__contenttype.html#g080b7ed798ed497dcd635a6bab86962f">mm_contenttype.c</a>
<li>mm_content_free()
: <a class="el" href="group__contenttype.html#g404314481125849bce869ee4b0f647af">mm_contenttype.c</a>
<li>mm_content_getencoding()
: <a class="el" href="group__contenttype.html#gbff87e581cd04db16e91245e9e9de67d">mm_contenttype.c</a>
<li>mm_content_getmaintype()
: <a class="el" href="group__contenttype.html#gb213081017abf6bc7e601c6bf4214924">mm_contenttype.c</a>
<li>mm_content_getparambyname()
: <a class="el" href="group__contenttype.html#g451441ee557ab5ef29477f3dc8330bf6">mm_contenttype.c</a>
<li>mm_content_getsubtype()
: <a class="el" href="group__contenttype.html#g97f77ef40c14cd0fb397bad358ee5d49">mm_contenttype.c</a>
<li>mm_content_iscomposite()
: <a class="el" href="group__contenttype.html#ga7fa479f27e73dea57257421d8fc9fc5">mm_contenttype.c</a>
<li>mm_content_isvalidencoding()
: <a class="el" href="group__contenttype.html#gb724b5979182fa272fe4fd1b72b395d5">mm_contenttype.c</a>
<li>mm_content_new()
: <a class="el" href="group__contenttype.html#g3880ac74a20b4a9f610a4159568e1801">mm_contenttype.c</a>
<li>mm_content_paramstostring()
: <a class="el" href="group__contenttype.html#g792e7d33fbb30e0123408bcef9d3204c">mm_contenttype.c</a>
<li>mm_content_setencoding()
: <a class="el" href="group__contenttype.html#gea945e48ac5cca846715543634b9afe4">mm_contenttype.c</a>
<li>mm_content_setmaintype()
: <a class="el" href="group__contenttype.html#g7bab273d117c6c0cacad20361d8fb1c8">mm_contenttype.c</a>
<li>mm_content_setsubtype()
: <a class="el" href="group__contenttype.html#g14b0738410d566ad2312405946f22212">mm_contenttype.c</a>
<li>mm_content_tostring()
: <a class="el" href="group__contenttype.html#g18a99c95e35a76f13a77a83c4231e738">mm_contenttype.c</a>
<li>mm_context_attachpart()
: <a class="el" href="group__context.html#gec3ca486a61b392ff68774242086768e">mm_context.c</a>
<li>mm_context_attachpart_after()
: <a class="el" href="group__context.html#g73a3dd187053aeabca4836dc28a6c468">mm_context.c</a>
<li>mm_context_countparts()
: <a class="el" href="group__context.html#gf5bb032ad1c481d31d7b1b0710939712">mm_context.c</a>
<li>mm_context_deletepart()
: <a class="el" href="group__context.html#g53d20c33a401539ef1ffa45f3dddb983">mm_context.c</a>
<li>mm_context_flatten()
: <a class="el" href="group__context.html#g5288136ab923605f6508c09359ae5772">mm_context.c</a>
<li>mm_context_free()
: <a class="el" href="group__context.html#g76392d5269e9ef340c2f5f8336f7193b">mm_context.c</a>
<li>mm_context_generateboundary()
: <a class="el" href="group__context.html#g9710e485f51167099d90f0d659979068">mm_context.c</a>
<li>mm_context_getpart()
: <a class="el" href="group__context.html#g57fea229675f3e56a77eb40bb8193ee3">mm_context.c</a>
<li>mm_context_haswarnings()
: <a class="el" href="group__context.html#g8733dee7d83d3205349a7ee4ee5b2750">mm_context.c</a>
<li>mm_context_iscomposite()
: <a class="el" href="group__context.html#g1e73cadba4acd3ef9dd148dd0c2c3e70">mm_context.c</a>
<li>mm_context_new()
: <a class="el" href="group__context.html#g919fd41f85534d9c87c256857faa2610">mm_context.c</a>
<li>mm_context_setpreamble()
: <a class="el" href="group__context.html#gc0e7cc297516618d4773830a1988fc8d">mm_context.c</a>
<li>mm_envelope_getheaders()
: <a class="el" href="group__envelope.html#g38f1164142cedfc3253b068a81f85563">mm_envelope.c</a>
<li>mm_envelope_getrecipients()
: <a class="el" href="group__envelope.html#ge63da17c56867ca2406a4eaf73230baf">mm_envelope.c</a>
<li>mm_envelope_setheader()
: <a class="el" href="group__envelope.html#gb2c43c1645e42ae0860c902ce1dda788">mm_envelope.c</a>
<li>mm_error_init()
: <a class="el" href="group__error.html#g69de7c9bee1d535593a55807590de543">mm_error.c</a>
<li>mm_error_setmsg()
: <a class="el" href="group__error.html#g92006c97728639d8f32f5bc4c6e2a47f">mm_error.c</a>
<li>mm_error_string()
: <a class="el" href="group__error.html#g8654857a3ac349b87d798902912371a3">mm_error.c</a>
<li>mm_mimeheader_free()
: <a class="el" href="mm__header_8c.html#61e3e62728f720ac381196ec59303064">mm_header.c</a>
<li>mm_mimeheader_generate()
: <a class="el" href="mm__header_8c.html#07a7f7dcebc91aa86f5478e1d84341a1">mm_header.c</a>
<li>mm_mimeheader_new()
: <a class="el" href="mm__header_8c.html#2f2c5f2f640111caf3096ed46b5986a4">mm_header.c</a>
<li>mm_mimepart_attachcontenttype()
: <a class="el" href="group__mimepart.html#g01822bc93b4741af75b5379384354e37">mm_mimepart.c</a>
<li>mm_mimepart_attachheader()
: <a class="el" href="group__mimepart.html#g46a674ff6b9873c0c45fa4eb5d94fd62">mm_mimepart.c</a>
<li>mm_mimepart_countheaderbyname()
: <a class="el" href="group__mimepart.html#gf89da502ac54306994bdb452448a8026">mm_mimepart.c</a>
<li>mm_mimepart_countheaders()
: <a class="el" href="group__mimepart.html#g44c78abfb0535312bcb427a2cd220026">mm_mimepart.c</a>
<li>mm_mimepart_decode()
: <a class="el" href="group__mimepart.html#g4551bf4460e5d165bbcd9f32d4f625de">mm_mimepart.c</a>
<li>mm_mimepart_flatten()
: <a class="el" href="group__mimepart.html#gf19d3ace5ae174b3eaa35f9ddbe6e216">mm_mimepart.c</a>
<li>mm_mimepart_free()
: <a class="el" href="group__mimepart.html#gbf47790a0bb96b22bc5e236bc40cb32e">mm_mimepart.c</a>
<li>mm_mimepart_fromfile()
: <a class="el" href="group__mimepart.html#ged8112012a337371ae8093adb1ab6d27">mm_mimepart.c</a>
<li>mm_mimepart_getbody()
: <a class="el" href="group__mimepart.html#g52dc9f27a2801e4f6abb1effd2ed838d">mm_mimepart.c</a>
<li>mm_mimepart_getheaderbyname()
: <a class="el" href="group__mimepart.html#ga3ca298eaa82f4ef3ea731511ac84e53">mm_mimepart.c</a>
<li>mm_mimepart_getheadervalue()
: <a class="el" href="group__mimepart.html#g779f11f7a6a54f83763b5ef6ff87e48f">mm_mimepart.c</a>
<li>mm_mimepart_getlength()
: <a class="el" href="group__mimepart.html#gf8ccae1737dc4b9b91958fe448da677f">mm_mimepart.c</a>
<li>mm_mimepart_gettype()
: <a class="el" href="group__mimepart.html#g210e2ceee56f8349f6778006da87d080">mm_mimepart.c</a>
<li>mm_mimepart_headers_next()
: <a class="el" href="group__mimepart.html#g8e9064736efdeebf4b257cc45f8a6adf">mm_mimepart.c</a>
<li>mm_mimepart_headers_start()
: <a class="el" href="group__mimepart.html#g4440bdcfddf88eb642b6a834a0557176">mm_mimepart.c</a>
<li>mm_mimepart_new()
: <a class="el" href="group__mimepart.html#g417e5dd361e30cddb91e1d9a5e30b223">mm_mimepart.c</a>
<li>mm_mimepart_setbody()
: <a class="el" href="group__mimepart.html#gd1def098c00edc546b03e98e9ff8b27a">mm_mimepart.c</a>
<li>mm_mimepart_setdefaultcontenttype()
: <a class="el" href="group__mimepart.html#g164bb39a266559574c252f11266809ff">mm_mimepart.c</a>
<li>mm_mimeutil_gendate()
: <a class="el" href="mm__mimeutil_8c.html#a7b7f63b42dfa7a7f907b615aa4cd057">mm_mimeutil.c</a>
<li>mm_param_free()
: <a class="el" href="group__param.html#g46339038e995799e6a3e37512f442fc9">mm_param.c</a>
<li>mm_param_generate()
: <a class="el" href="group__param.html#gd3970def45b8bede334f4b89a41dec15">mm_param.c</a>
<li>mm_param_getname()
: <a class="el" href="group__param.html#g0e0ddccf47a2b1e0ad5bcc52c7b39753">mm_param.c</a>
<li>mm_param_getvalue()
: <a class="el" href="group__param.html#g3c6f8cddd409de3000c31584e140561e">mm_param.c</a>
<li>mm_param_new()
: <a class="el" href="group__param.html#gd3ac756551bf5a29a07d5992bfdbde09">mm_param.c</a>
<li>mm_param_setname()
: <a class="el" href="group__param.html#g2a266c63c7e89cf829b2af8e995e55e8">mm_param.c</a>
<li>mm_param_setvalue()
: <a class="el" href="group__param.html#gca3e636ab5700462eb32ca5bc19e4cc6">mm_param.c</a>
<li>mm_parse_file()
: <a class="el" href="mm__parse_8c.html#cc9f623682b05f330c46e72e4e9d66cc">mm_parse.c</a>
<li>mm_parse_mem()
: <a class="el" href="mm__parse_8c.html#58c960b6017f13d4e4ec5f09b3c38495">mm_parse.c</a>
<li>mm_stripchars()
: <a class="el" href="group__util.html#gf62be7dd21e545f8db72f3c9e3b6a3c3">mm_util.c</a>
<li>mm_uncomment()
: <a class="el" href="group__util.html#g49c016ff4cfd02f1b019c4dce5aac357">mm_util.c</a>
<li>mm_unquote()
: <a class="el" href="group__util.html#gf0f89a29a634f6f1f833abb1e214a6b1">mm_util.c</a>
</ul>
<h3><a class="anchor" name="index_x">- x -</a></h3><ul>
<li>xmalloc()
: <a class="el" href="group__util.html#g2ff4ef58da7e543466e75f20f2a2d8b7">mm_util.c</a>
<li>xrealloc()
: <a class="el" href="group__util.html#ge14637b4672461f1f0bee822406d68dc">mm_util.c</a>
<li>xstrsep()
: <a class="el" href="group__util.html#g3ae25483c8a42f6562f2a916a511228f">mm_util.c</a>
</ul>
<hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:09 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,243 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: Manipulating MiniMIME codecs</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<h1>Manipulating MiniMIME codecs</h1><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Codec manipulation</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__codecs.html#g6ccb0f7a1d7c870dc3dae04f31d6ccca">mm_codec_hasdecoder</a> (const char *encoding)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__codecs.html#g50ff257b794ceaec7aedf9ae18bfcc57">mm_codec_hasencoder</a> (const char *encoding)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__codecs.html#g9e19f6343128fd7e4ec57c3d55049b55">mm_codec_isregistered</a> (const char *encoding)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__codecs.html#gf97a7311c909888ed9f6f14d6f1bf397">mm_codec_register</a> (const char *encoding, char *(*encoder)(char *data, u_int32_t i), char *(*decoder)(char *data))</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__codecs.html#g0c71696bc70f834386193e3c7a0e2ca4">mm_codec_unregister</a> (const char *encoding)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__codecs.html#g7c9e6538f84c368be2b56a3c9ba702be">mm_codec_unregisterall</a> (void)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__codecs.html#gf39e72460fb85f5ca41f6e270a68aacc">mm_codec_registerdefaultcodecs</a> (void)</td></tr>
</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="g6ccb0f7a1d7c870dc3dae04f31d6ccca"></a><!-- doxytag: member="mm_codecs.c::mm_codec_hasdecoder" ref="g6ccb0f7a1d7c870dc3dae04f31d6ccca" args="(const char *encoding)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_codec_hasdecoder </td>
<td>(</td>
<td class="paramtype">const char *&nbsp;</td>
<td class="paramname"> <em>encoding</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Looks up whether a context has an decoder installed for a given encoding<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>encoding</em>&nbsp;</td><td>The encoding specifier to look up </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 if a decoder is installed or 0 if not </dd></dl>
</div>
</div><p>
<a class="anchor" name="g50ff257b794ceaec7aedf9ae18bfcc57"></a><!-- doxytag: member="mm_codecs.c::mm_codec_hasencoder" ref="g50ff257b794ceaec7aedf9ae18bfcc57" args="(const char *encoding)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_codec_hasencoder </td>
<td>(</td>
<td class="paramtype">const char *&nbsp;</td>
<td class="paramname"> <em>encoding</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Looks up whether a context has an encoder installed for a given encoding<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ctx</em>&nbsp;</td><td>A valid MIME context </td></tr>
<tr><td valign="top"></td><td valign="top"><em>encoding</em>&nbsp;</td><td>The encoding specifier to look up </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 if an encoder is installed or 0 if not </dd></dl>
</div>
</div><p>
<a class="anchor" name="g9e19f6343128fd7e4ec57c3d55049b55"></a><!-- doxytag: member="mm_codecs.c::mm_codec_isregistered" ref="g9e19f6343128fd7e4ec57c3d55049b55" args="(const char *encoding)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_codec_isregistered </td>
<td>(</td>
<td class="paramtype">const char *&nbsp;</td>
<td class="paramname"> <em>encoding</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Looks up whether a codec for a given encoding is installed to a context<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>encoding</em>&nbsp;</td><td>The encoding specifier to look up </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 if a codec was found or 0 if not </dd></dl>
</div>
</div><p>
<a class="anchor" name="gf97a7311c909888ed9f6f14d6f1bf397"></a><!-- doxytag: member="mm_codecs.c::mm_codec_register" ref="gf97a7311c909888ed9f6f14d6f1bf397" args="(const char *encoding, char *(*encoder)(char *data, u_int32_t i), char *(*decoder)(char *data))" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_codec_register </td>
<td>(</td>
<td class="paramtype">const char *&nbsp;</td>
<td class="paramname"> <em>encoding</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char *(*)(char *data, u_int32_t i)&nbsp;</td>
<td class="paramname"> <em>encoder</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char *(*)(char *data)&nbsp;</td>
<td class="paramname"> <em>decoder</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Registers a codec with the MiniMIME library<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>encoding</em>&nbsp;</td><td>The encoding specifier for which to register the codec </td></tr>
<tr><td valign="top"></td><td valign="top"><em>encoder</em>&nbsp;</td><td>The encoder function for this encoding </td></tr>
<tr><td valign="top"></td><td valign="top"><em>decoder</em>&nbsp;</td><td>The decoder function for this encoding </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 if successfull or 0 if not</dd></dl>
This function registers a codec for a given MiniMIME context. The codec may provide an decoder, an encoder or both (but not none). If there is a codec already installed for this encoding, the function will puke.
</div>
</div><p>
<a class="anchor" name="gf39e72460fb85f5ca41f6e270a68aacc"></a><!-- doxytag: member="mm_codecs.c::mm_codec_registerdefaultcodecs" ref="gf39e72460fb85f5ca41f6e270a68aacc" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void mm_codec_registerdefaultcodecs </td>
<td>(</td>
<td class="paramtype">void&nbsp;</td>
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Registers the default codecs to a MiniMIME context<p>
This functions registers the codecs for the following encodings to a MiniMIME context:<p>
<ul>
<li>Base64</li><li>(TODO:) Quoted-Printable </li></ul>
</div>
</div><p>
<a class="anchor" name="g0c71696bc70f834386193e3c7a0e2ca4"></a><!-- doxytag: member="mm_codecs.c::mm_codec_unregister" ref="g0c71696bc70f834386193e3c7a0e2ca4" args="(const char *encoding)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_codec_unregister </td>
<td>(</td>
<td class="paramtype">const char *&nbsp;</td>
<td class="paramname"> <em>encoding</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Unregisters a MiniMIME codec<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>encoding</em>&nbsp;</td><td>The encoding specifier which to unregister </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 if unregistered successfully, or -1 if there was no such codec </dd></dl>
</div>
</div><p>
<a class="anchor" name="g7c9e6538f84c368be2b56a3c9ba702be"></a><!-- doxytag: member="mm_codecs.c::mm_codec_unregisterall" ref="g7c9e6538f84c368be2b56a3c9ba702be" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_codec_unregisterall </td>
<td>(</td>
<td class="paramtype">void&nbsp;</td>
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Unregisters all codecs within a context<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ctx</em>&nbsp;</td><td>A valid MiniMIME context </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 if all codecs were unregistered successfully or -1 if an error occured. </dd></dl>
<dl class="note" compact><dt><b>Note:</b></dt><dd>Foobar </dd></dl>
</div>
</div><p>
<hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:08 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,516 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: Accessing and manipulating Content-Type objects</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<h1>Accessing and manipulating Content-Type objects</h1><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions for manipulating Content-Type objects</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">mm_content *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__contenttype.html#g3880ac74a20b4a9f610a4159568e1801">mm_content_new</a> (void)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__contenttype.html#g404314481125849bce869ee4b0f647af">mm_content_free</a> (struct mm_content *ct)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__contenttype.html#g080b7ed798ed497dcd635a6bab86962f">mm_content_attachparam</a> (struct mm_content *ct, struct mm_param *param)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__contenttype.html#g451441ee557ab5ef29477f3dc8330bf6">mm_content_getparambyname</a> (struct mm_content *ct, const char *name)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g1ba63e679d2b49aceb6cfec8a6752581"></a><!-- doxytag: member="contenttype::mm_content_getparamobjbyname" ref="g1ba63e679d2b49aceb6cfec8a6752581" args="(struct mm_content *ct, const char *name)" -->
mm_param *&nbsp;</td><td class="memItemRight" valign="bottom"><b>mm_content_getparamobjbyname</b> (struct mm_content *ct, const char *name)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__contenttype.html#g7bab273d117c6c0cacad20361d8fb1c8">mm_content_setmaintype</a> (struct mm_content *ct, char *value, int copy)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__contenttype.html#gb213081017abf6bc7e601c6bf4214924">mm_content_getmaintype</a> (struct mm_content *ct)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__contenttype.html#g97f77ef40c14cd0fb397bad358ee5d49">mm_content_getsubtype</a> (struct mm_content *ct)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga6d8453eb35bd695c4944e53b7040b65"></a><!-- doxytag: member="contenttype::mm_content_gettype" ref="ga6d8453eb35bd695c4944e53b7040b65" args="(struct mm_content *ct)" -->
char *&nbsp;</td><td class="memItemRight" valign="bottom"><b>mm_content_gettype</b> (struct mm_content *ct)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__contenttype.html#g14b0738410d566ad2312405946f22212">mm_content_setsubtype</a> (struct mm_content *ct, char *value, int copy)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g878686678ea2ba97aa8edb1206a564d8"></a><!-- doxytag: member="contenttype::mm_content_settype" ref="g878686678ea2ba97aa8edb1206a564d8" args="(struct mm_content *ct, const char *fmt,...)" -->
int&nbsp;</td><td class="memItemRight" valign="bottom"><b>mm_content_settype</b> (struct mm_content *ct, const char *fmt,...)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__contenttype.html#ga7fa479f27e73dea57257421d8fc9fc5">mm_content_iscomposite</a> (struct mm_content *ct)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__contenttype.html#gb724b5979182fa272fe4fd1b72b395d5">mm_content_isvalidencoding</a> (const char *encoding)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__contenttype.html#gea945e48ac5cca846715543634b9afe4">mm_content_setencoding</a> (struct mm_content *ct, const char *encoding)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__contenttype.html#gbff87e581cd04db16e91245e9e9de67d">mm_content_getencoding</a> (struct mm_content *ct, const char *encoding)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__contenttype.html#g792e7d33fbb30e0123408bcef9d3204c">mm_content_paramstostring</a> (struct mm_content *ct)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__contenttype.html#g18a99c95e35a76f13a77a83c4231e738">mm_content_tostring</a> (struct mm_content *ct)</td></tr>
<tr><td colspan="2"><br><h2>Variables</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g6c458a8611981109bf0519b5ae21e12e"></a><!-- doxytag: member="contenttype::type" ref="g6c458a8611981109bf0519b5ae21e12e" args="" -->
int&nbsp;</td><td class="memItemRight" valign="bottom"><b>mm_encoding_mappings::type</b></td></tr>
</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="g080b7ed798ed497dcd635a6bab86962f"></a><!-- doxytag: member="mm_contenttype.c::mm_content_attachparam" ref="g080b7ed798ed497dcd635a6bab86962f" args="(struct mm_content *ct, struct mm_param *param)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_content_attachparam </td>
<td>(</td>
<td class="paramtype">struct mm_content *&nbsp;</td>
<td class="paramname"> <em>ct</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">struct mm_param *&nbsp;</td>
<td class="paramname"> <em>param</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Attaches a parameter to a Content-Type object<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ct</em>&nbsp;</td><td>The target Content-Type object </td></tr>
<tr><td valign="top"></td><td valign="top"><em>param</em>&nbsp;</td><td>The Content-Type parameter which to attach </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success and -1 on failure </dd></dl>
</div>
</div><p>
<a class="anchor" name="g404314481125849bce869ee4b0f647af"></a><!-- doxytag: member="mm_contenttype.c::mm_content_free" ref="g404314481125849bce869ee4b0f647af" args="(struct mm_content *ct)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void mm_content_free </td>
<td>(</td>
<td class="paramtype">struct mm_content *&nbsp;</td>
<td class="paramname"> <em>ct</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Releases all memory associated with an Content-Type object<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ct</em>&nbsp;</td><td>A Content-Type object </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Nothing </dd></dl>
</div>
</div><p>
<a class="anchor" name="gbff87e581cd04db16e91245e9e9de67d"></a><!-- doxytag: member="mm_contenttype.c::mm_content_getencoding" ref="gbff87e581cd04db16e91245e9e9de67d" args="(struct mm_content *ct, const char *encoding)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_content_getencoding </td>
<td>(</td>
<td class="paramtype">struct mm_content *&nbsp;</td>
<td class="paramname"> <em>ct</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&nbsp;</td>
<td class="paramname"> <em>encoding</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Gets the numerical ID of a content encoding identifier<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ct</em>&nbsp;</td><td>A valid Content Type object </td></tr>
<tr><td valign="top"></td><td valign="top"><em>encoding</em>&nbsp;</td><td>A string representing the content encoding identifier </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>The numerical ID of the content encoding </dd></dl>
</div>
</div><p>
<a class="anchor" name="gb213081017abf6bc7e601c6bf4214924"></a><!-- doxytag: member="mm_contenttype.c::mm_content_getmaintype" ref="gb213081017abf6bc7e601c6bf4214924" args="(struct mm_content *ct)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char* mm_content_getmaintype </td>
<td>(</td>
<td class="paramtype">struct mm_content *&nbsp;</td>
<td class="paramname"> <em>ct</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Retrieves the main MIME type stored in a Content-Type object<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ct</em>&nbsp;</td><td>A valid Content-Type object </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>A pointer to the string representing the main type </dd></dl>
</div>
</div><p>
<a class="anchor" name="g451441ee557ab5ef29477f3dc8330bf6"></a><!-- doxytag: member="mm_contenttype.c::mm_content_getparambyname" ref="g451441ee557ab5ef29477f3dc8330bf6" args="(struct mm_content *ct, const char *name)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char* mm_content_getparambyname </td>
<td>(</td>
<td class="paramtype">struct mm_content *&nbsp;</td>
<td class="paramname"> <em>ct</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&nbsp;</td>
<td class="paramname"> <em>name</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Gets a parameter value from a Content-Type object.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ct</em>&nbsp;</td><td>the Content-Type object </td></tr>
<tr><td valign="top"></td><td valign="top"><em>name</em>&nbsp;</td><td>the name of the parameter to retrieve </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>The value of the parameter on success or a NULL pointer on failure </dd></dl>
</div>
</div><p>
<a class="anchor" name="g97f77ef40c14cd0fb397bad358ee5d49"></a><!-- doxytag: member="mm_contenttype.c::mm_content_getsubtype" ref="g97f77ef40c14cd0fb397bad358ee5d49" args="(struct mm_content *ct)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char* mm_content_getsubtype </td>
<td>(</td>
<td class="paramtype">struct mm_content *&nbsp;</td>
<td class="paramname"> <em>ct</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Retrieves the sub MIME type stored in a Content-Type object<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ct</em>&nbsp;</td><td>A valid Content-Type object </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>A pointer to the string holding the current sub MIME type </dd></dl>
</div>
</div><p>
<a class="anchor" name="ga7fa479f27e73dea57257421d8fc9fc5"></a><!-- doxytag: member="mm_contenttype.c::mm_content_iscomposite" ref="ga7fa479f27e73dea57257421d8fc9fc5" args="(struct mm_content *ct)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_content_iscomposite </td>
<td>(</td>
<td class="paramtype">struct mm_content *&nbsp;</td>
<td class="paramname"> <em>ct</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Checks whether the Content-Type represents a composite message or not<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ct</em>&nbsp;</td><td>A valid Content-Type object </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 if the Content-Type object represents a composite message or 0 if not. </dd></dl>
</div>
</div><p>
<a class="anchor" name="gb724b5979182fa272fe4fd1b72b395d5"></a><!-- doxytag: member="mm_contenttype.c::mm_content_isvalidencoding" ref="gb724b5979182fa272fe4fd1b72b395d5" args="(const char *encoding)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_content_isvalidencoding </td>
<td>(</td>
<td class="paramtype">const char *&nbsp;</td>
<td class="paramname"> <em>encoding</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Verifies whether a string represents a valid encoding or not.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>encoding</em>&nbsp;</td><td>The string to verify </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 if the encoding string is valid or 0 if not </dd></dl>
</div>
</div><p>
<a class="anchor" name="g3880ac74a20b4a9f610a4159568e1801"></a><!-- doxytag: member="mm_contenttype.c::mm_content_new" ref="g3880ac74a20b4a9f610a4159568e1801" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">struct mm_content* mm_content_new </td>
<td>(</td>
<td class="paramtype">void&nbsp;</td>
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Creates a new object to hold a Content-Type representation. The allocated memory must later be freed using <a class="el" href="group__contenttype.html#g404314481125849bce869ee4b0f647af">mm_content_free()</a><p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>An object representing a MIME Content-Type </dd></dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__contenttype.html#g404314481125849bce869ee4b0f647af">mm_content_free</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="g792e7d33fbb30e0123408bcef9d3204c"></a><!-- doxytag: member="mm_contenttype.c::mm_content_paramstostring" ref="g792e7d33fbb30e0123408bcef9d3204c" args="(struct mm_content *ct)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char* mm_content_paramstostring </td>
<td>(</td>
<td class="paramtype">struct mm_content *&nbsp;</td>
<td class="paramname"> <em>ct</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Constructs a MIME conform string of Content-Type parameters.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ct</em>&nbsp;</td><td>A valid Content Type object </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>A pointer to a string representing the Content-Type parameters in MIME terminology, or NULL if either the Content-Type object is invalid, has no parameters or no memory could be allocated.</dd></dl>
This function constructs a MIME conform string including all the parameters associated with the given Content-Type object. It should NOT be used if you need an opaque copy of the current MIME part (e.g. for PGP purposes).
</div>
</div><p>
<a class="anchor" name="gea945e48ac5cca846715543634b9afe4"></a><!-- doxytag: member="mm_contenttype.c::mm_content_setencoding" ref="gea945e48ac5cca846715543634b9afe4" args="(struct mm_content *ct, const char *encoding)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_content_setencoding </td>
<td>(</td>
<td class="paramtype">struct mm_content *&nbsp;</td>
<td class="paramname"> <em>ct</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&nbsp;</td>
<td class="paramname"> <em>encoding</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Set the encoding of a MIME entitity according to a mapping table<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ct</em>&nbsp;</td><td>A valid content type object </td></tr>
<tr><td valign="top"></td><td valign="top"><em>encoding</em>&nbsp;</td><td>A string representing the content encoding </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 if successfull or -1 if not (i.e. unknown content encoding) </dd></dl>
</div>
</div><p>
<a class="anchor" name="g7bab273d117c6c0cacad20361d8fb1c8"></a><!-- doxytag: member="mm_contenttype.c::mm_content_setmaintype" ref="g7bab273d117c6c0cacad20361d8fb1c8" args="(struct mm_content *ct, char *value, int copy)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_content_setmaintype </td>
<td>(</td>
<td class="paramtype">struct mm_content *&nbsp;</td>
<td class="paramname"> <em>ct</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char *&nbsp;</td>
<td class="paramname"> <em>value</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"> <em>copy</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Sets the MIME main type for a MIME Content-Type object<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ct</em>&nbsp;</td><td>The MIME Content-Type object </td></tr>
<tr><td valign="top"></td><td valign="top"><em>value</em>&nbsp;</td><td>The value which to set the main type to </td></tr>
<tr><td valign="top"></td><td valign="top"><em>copy</em>&nbsp;</td><td>Whether to make a copy of the value (original value must be freed afterwards to prevent memory leaks). </td></tr>
</table>
</dl>
<p>
<dl compact><dt><b><a class="el" href="bug.html#_bug000001">Bug:</a></b></dt><dd>The xfree() call could lead to undesirable results. Do we really need it? </dd></dl>
</div>
</div><p>
<a class="anchor" name="g14b0738410d566ad2312405946f22212"></a><!-- doxytag: member="mm_contenttype.c::mm_content_setsubtype" ref="g14b0738410d566ad2312405946f22212" args="(struct mm_content *ct, char *value, int copy)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_content_setsubtype </td>
<td>(</td>
<td class="paramtype">struct mm_content *&nbsp;</td>
<td class="paramname"> <em>ct</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char *&nbsp;</td>
<td class="paramname"> <em>value</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"> <em>copy</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Sets the MIME sub type for a MIME Content-Type object<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ct</em>&nbsp;</td><td>The MIME Content-Type object </td></tr>
<tr><td valign="top"></td><td valign="top"><em>value</em>&nbsp;</td><td>The value which to set the sub type to </td></tr>
<tr><td valign="top"></td><td valign="top"><em>copy</em>&nbsp;</td><td>Whether to make a copy of the value (original value must be freed afterwards to prevent memory leaks). </td></tr>
</table>
</dl>
<p>
<dl compact><dt><b><a class="el" href="bug.html#_bug000002">Bug:</a></b></dt><dd>The xfree() call could lead to undesirable results. Do we really need it? </dd></dl>
</div>
</div><p>
<a class="anchor" name="g18a99c95e35a76f13a77a83c4231e738"></a><!-- doxytag: member="mm_contenttype.c::mm_content_tostring" ref="g18a99c95e35a76f13a77a83c4231e738" args="(struct mm_content *ct)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char* mm_content_tostring </td>
<td>(</td>
<td class="paramtype">struct mm_content *&nbsp;</td>
<td class="paramname"> <em>ct</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Creates a Content-Type header according to the object given<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ct</em>&nbsp;</td><td>A valid Content-Type object </td></tr>
</table>
</dl>
</div>
</div><p>
<hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:08 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,465 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: Accessing and manipulating MIME contexts</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<h1>Accessing and manipulating MIME contexts</h1><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Manipulating MiniMIME contexts</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">MM_CTX *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__context.html#g919fd41f85534d9c87c256857faa2610">mm_context_new</a> (void)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__context.html#g76392d5269e9ef340c2f5f8336f7193b">mm_context_free</a> (MM_CTX *ctx)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__context.html#gec3ca486a61b392ff68774242086768e">mm_context_attachpart</a> (MM_CTX *ctx, struct mm_mimepart *part)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__context.html#g73a3dd187053aeabca4836dc28a6c468">mm_context_attachpart_after</a> (MM_CTX *ctx, struct mm_mimepart *part, int pos)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__context.html#g53d20c33a401539ef1ffa45f3dddb983">mm_context_deletepart</a> (MM_CTX *ctx, int which, int freemem)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__context.html#gf5bb032ad1c481d31d7b1b0710939712">mm_context_countparts</a> (MM_CTX *ctx)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">mm_mimepart *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__context.html#g57fea229675f3e56a77eb40bb8193ee3">mm_context_getpart</a> (MM_CTX *ctx, int which)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__context.html#g1e73cadba4acd3ef9dd148dd0c2c3e70">mm_context_iscomposite</a> (MM_CTX *ctx)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__context.html#g8733dee7d83d3205349a7ee4ee5b2750">mm_context_haswarnings</a> (MM_CTX *ctx)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__context.html#g9710e485f51167099d90f0d659979068">mm_context_generateboundary</a> (MM_CTX *ctx)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__context.html#gc0e7cc297516618d4773830a1988fc8d">mm_context_setpreamble</a> (MM_CTX *ctx, char *preamble)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g1ebbdd51106ccdee77ca421f9692bde7"></a><!-- doxytag: member="context::mm_context_getpreamble" ref="g1ebbdd51106ccdee77ca421f9692bde7" args="(MM_CTX *ctx)" -->
char *&nbsp;</td><td class="memItemRight" valign="bottom"><b>mm_context_getpreamble</b> (MM_CTX *ctx)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__context.html#g5288136ab923605f6508c09359ae5772">mm_context_flatten</a> (MM_CTX *ctx, char **flat, size_t *length, int flags)</td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Each message in MiniMIME is represented by a so called ``context''. A context holds all necessary information given about a MIME message, such as the envelope, all MIME parts etc. <hr><h2>Function Documentation</h2>
<a class="anchor" name="gec3ca486a61b392ff68774242086768e"></a><!-- doxytag: member="mm_context.c::mm_context_attachpart" ref="gec3ca486a61b392ff68774242086768e" args="(MM_CTX *ctx, struct mm_mimepart *part)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_context_attachpart </td>
<td>(</td>
<td class="paramtype">MM_CTX *&nbsp;</td>
<td class="paramname"> <em>ctx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">struct mm_mimepart *&nbsp;</td>
<td class="paramname"> <em>part</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Attaches a MIME part object to a MiniMIME context.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ctx</em>&nbsp;</td><td>the MiniMIME context </td></tr>
<tr><td valign="top"></td><td valign="top"><em>part</em>&nbsp;</td><td>the MIME part object to attach </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success or -1 on failure. Sets mm_errno on failure.</dd></dl>
This function attaches a MIME part to a context, appending it to the end of the message.<p>
The MIME part should be initialized before attaching it using <a class="el" href="group__mimepart.html#g417e5dd361e30cddb91e1d9a5e30b223">mm_mimepart_new()</a>.
</div>
</div><p>
<a class="anchor" name="g73a3dd187053aeabca4836dc28a6c468"></a><!-- doxytag: member="mm_context.c::mm_context_attachpart_after" ref="g73a3dd187053aeabca4836dc28a6c468" args="(MM_CTX *ctx, struct mm_mimepart *part, int pos)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_context_attachpart_after </td>
<td>(</td>
<td class="paramtype">MM_CTX *&nbsp;</td>
<td class="paramname"> <em>ctx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">struct mm_mimepart *&nbsp;</td>
<td class="paramname"> <em>part</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"> <em>pos</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Attaches a MIME part object to a MiniMIME context at a given position<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ctx</em>&nbsp;</td><td>A valid MiniMIME context </td></tr>
<tr><td valign="top"></td><td valign="top"><em>part</em>&nbsp;</td><td>The MIME part object to attach </td></tr>
<tr><td valign="top"></td><td valign="top"><em>pos</em>&nbsp;</td><td>After which part to attach the object </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success or -1 if the given position is invalid </dd></dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__context.html#gec3ca486a61b392ff68774242086768e">mm_context_attachpart</a></dd></dl>
This function attaches a MIME part object after a given position in the specified context. If the position is invalid (out of range), the part will not get attached to the message and the function returns -1. If the index was in range, the MIME part will get attached after the MIME part at the given position, moving any possible following MIME parts one down the hierarchy.
</div>
</div><p>
<a class="anchor" name="gf5bb032ad1c481d31d7b1b0710939712"></a><!-- doxytag: member="mm_context.c::mm_context_countparts" ref="gf5bb032ad1c481d31d7b1b0710939712" args="(MM_CTX *ctx)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_context_countparts </td>
<td>(</td>
<td class="paramtype">MM_CTX *&nbsp;</td>
<td class="paramname"> <em>ctx</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Counts the number of attached MIME part objects in a given MiniMIME context<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ctx</em>&nbsp;</td><td>The MiniMIME context </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>The number of attached MIME part objects </dd></dl>
</div>
</div><p>
<a class="anchor" name="g53d20c33a401539ef1ffa45f3dddb983"></a><!-- doxytag: member="mm_context.c::mm_context_deletepart" ref="g53d20c33a401539ef1ffa45f3dddb983" args="(MM_CTX *ctx, int which, int freemem)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_context_deletepart </td>
<td>(</td>
<td class="paramtype">MM_CTX *&nbsp;</td>
<td class="paramname"> <em>ctx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"> <em>which</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"> <em>freemem</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Deletes a MIME part object from a MiniMIME context<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ctx</em>&nbsp;</td><td>A valid MiniMIME context object </td></tr>
<tr><td valign="top"></td><td valign="top"><em>which</em>&nbsp;</td><td>The number of the MIME part object to delete </td></tr>
<tr><td valign="top"></td><td valign="top"><em>freemem</em>&nbsp;</td><td>Whether to free the memory associated with the MIME part object </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success or -1 on failure. Sets mm_errno on failure.</dd></dl>
This function deletes a MIME part from a given context. The MIME part to delete is specified as numerical index by the parameter ``which''. If the parameter ``freemem'' is set to anything greater than 0, the memory that is associated will be free'd by using <a class="el" href="group__mimepart.html#gbf47790a0bb96b22bc5e236bc40cb32e">mm_mimepart_free()</a>, otherwise the memory is left untouched (if you still have a pointer to the MIME part around).
</div>
</div><p>
<a class="anchor" name="g5288136ab923605f6508c09359ae5772"></a><!-- doxytag: member="mm_context.c::mm_context_flatten" ref="g5288136ab923605f6508c09359ae5772" args="(MM_CTX *ctx, char **flat, size_t *length, int flags)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_context_flatten </td>
<td>(</td>
<td class="paramtype">MM_CTX *&nbsp;</td>
<td class="paramname"> <em>ctx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char **&nbsp;</td>
<td class="paramname"> <em>flat</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t *&nbsp;</td>
<td class="paramname"> <em>length</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"> <em>flags</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Creates an ASCII message of the specified context<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ctx</em>&nbsp;</td><td>A valid MiniMIME context object </td></tr>
<tr><td valign="top"></td><td valign="top"><em>flat</em>&nbsp;</td><td>Where to store the message </td></tr>
<tr><td valign="top"></td><td valign="top"><em>flags</em>&nbsp;</td><td>Flags that affect the flattening process</td></tr>
</table>
</dl>
This function ``flattens'' a MiniMIME context, that is, it creates an ASCII represantation of the message the context contains. The flags can be a bitwise combination of the following constants:<p>
<ul>
<li>MM_FLATTEN_OPAQUE : use opaque MIME parts when flattening</li><li>MM_FLATTEN_SKIPENVELOPE : do not flatten the envelope part</li></ul>
<p>
Great care is taken to not produce invalid MIME output.
</div>
</div><p>
<a class="anchor" name="g76392d5269e9ef340c2f5f8336f7193b"></a><!-- doxytag: member="mm_context.c::mm_context_free" ref="g76392d5269e9ef340c2f5f8336f7193b" args="(MM_CTX *ctx)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void mm_context_free </td>
<td>(</td>
<td class="paramtype">MM_CTX *&nbsp;</td>
<td class="paramname"> <em>ctx</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Releases a MiniMIME context object<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ctx</em>&nbsp;</td><td>A valid MiniMIME context </td></tr>
</table>
</dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__context.html#g919fd41f85534d9c87c256857faa2610">mm_context_new</a></dd></dl>
This function releases all memory associated with MiniMIME context object that was created using <a class="el" href="group__context.html#g919fd41f85534d9c87c256857faa2610">mm_context_new()</a>. It will also release all memory used for the MIME parts attached, and their specific properties (such as Content-Type information, headers, and the body data).
</div>
</div><p>
<a class="anchor" name="g9710e485f51167099d90f0d659979068"></a><!-- doxytag: member="mm_context.c::mm_context_generateboundary" ref="g9710e485f51167099d90f0d659979068" args="(MM_CTX *ctx)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_context_generateboundary </td>
<td>(</td>
<td class="paramtype">MM_CTX *&nbsp;</td>
<td class="paramname"> <em>ctx</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Generates a generic boundary string for a given context<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ctx</em>&nbsp;</td><td>A valid MiniMIME context </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success or -1 on failure</dd></dl>
This function generates a default boundary string for the given context. If there is already a boundary for the context, the memory will be free()'d.
</div>
</div><p>
<a class="anchor" name="g57fea229675f3e56a77eb40bb8193ee3"></a><!-- doxytag: member="mm_context.c::mm_context_getpart" ref="g57fea229675f3e56a77eb40bb8193ee3" args="(MM_CTX *ctx, int which)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">struct mm_mimepart* mm_context_getpart </td>
<td>(</td>
<td class="paramtype">MM_CTX *&nbsp;</td>
<td class="paramname"> <em>ctx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"> <em>which</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Gets a specified MIME part object from a MimeMIME context<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ctx</em>&nbsp;</td><td>The MiniMIME context </td></tr>
<tr><td valign="top"></td><td valign="top"><em>which</em>&nbsp;</td><td>The number of the MIME part object to retrieve </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>The requested MIME part object on success or a NULL pointer if there is no such part. </dd></dl>
</div>
</div><p>
<a class="anchor" name="g8733dee7d83d3205349a7ee4ee5b2750"></a><!-- doxytag: member="mm_context.c::mm_context_haswarnings" ref="g8733dee7d83d3205349a7ee4ee5b2750" args="(MM_CTX *ctx)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_context_haswarnings </td>
<td>(</td>
<td class="paramtype">MM_CTX *&nbsp;</td>
<td class="paramname"> <em>ctx</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Checks whether there are any warnings associated with a given context<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ctx</em>&nbsp;</td><td>A valid MiniMIME context </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 if there are warnings associated with the context, otherwise 0 </dd></dl>
</div>
</div><p>
<a class="anchor" name="g1e73cadba4acd3ef9dd148dd0c2c3e70"></a><!-- doxytag: member="mm_context.c::mm_context_iscomposite" ref="g1e73cadba4acd3ef9dd148dd0c2c3e70" args="(MM_CTX *ctx)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_context_iscomposite </td>
<td>(</td>
<td class="paramtype">MM_CTX *&nbsp;</td>
<td class="paramname"> <em>ctx</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Checks whether a given context represents a composite (multipart) message<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ctx</em>&nbsp;</td><td>A valid MiniMIME context object </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 if the context is a composite message or 0 if it's flat </dd></dl>
</div>
</div><p>
<a class="anchor" name="g919fd41f85534d9c87c256857faa2610"></a><!-- doxytag: member="mm_context.c::mm_context_new" ref="g919fd41f85534d9c87c256857faa2610" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">MM_CTX* mm_context_new </td>
<td>(</td>
<td class="paramtype">void&nbsp;</td>
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Creates a new MiniMIME context object.<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>a new MiniMIME context object </dd></dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__context.html#g76392d5269e9ef340c2f5f8336f7193b">mm_context_free</a></dd></dl>
This function creates a new MiniMIME context, which will hold a message. The memory needed is allocated dynamically and should later be free'd using <a class="el" href="group__context.html#g76392d5269e9ef340c2f5f8336f7193b">mm_context_free()</a>.<p>
Before a context can be created, the MiniMIME library needs to be initialized properly using mm_library_init().
</div>
</div><p>
<a class="anchor" name="gc0e7cc297516618d4773830a1988fc8d"></a><!-- doxytag: member="mm_context.c::mm_context_setpreamble" ref="gc0e7cc297516618d4773830a1988fc8d" args="(MM_CTX *ctx, char *preamble)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_context_setpreamble </td>
<td>(</td>
<td class="paramtype">MM_CTX *&nbsp;</td>
<td class="paramname"> <em>ctx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char *&nbsp;</td>
<td class="paramname"> <em>preamble</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Sets a preamble for the given MiniMIME context<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ctx</em>&nbsp;</td><td>A valid MiniMIME context </td></tr>
<tr><td valign="top"></td><td valign="top"><em>preamble</em>&nbsp;</td><td>The preamble to set </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success or -1 on failure</dd></dl>
This function sets the MIME preamble (the text between the end of envelope headers and the beginning of the first MIME part) for a given context object. If preamble is a NULL-pointer then the preamble will be deleted, and the currently associated memory will be free automagically.
</div>
</div><p>
<hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:08 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,172 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: Accessing and manipulating a message&apos;s envelope</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<h1>Accessing and manipulating a message's envelope</h1><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Accessing and manipulating a message's envelope</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__envelope.html#g38f1164142cedfc3253b068a81f85563">mm_envelope_getheaders</a> (MM_CTX *ctx, char **result, size_t *length)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__envelope.html#gb2c43c1645e42ae0860c902ce1dda788">mm_envelope_setheader</a> (MM_CTX *ctx, const char *name, const char *fmt,...)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__envelope.html#ge63da17c56867ca2406a4eaf73230baf">mm_envelope_getrecipients</a> (MM_CTX *ctx, char **result, size_t *length)</td></tr>
</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="g38f1164142cedfc3253b068a81f85563"></a><!-- doxytag: member="mm_envelope.c::mm_envelope_getheaders" ref="g38f1164142cedfc3253b068a81f85563" args="(MM_CTX *ctx, char **result, size_t *length)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_envelope_getheaders </td>
<td>(</td>
<td class="paramtype">MM_CTX *&nbsp;</td>
<td class="paramname"> <em>ctx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char **&nbsp;</td>
<td class="paramname"> <em>result</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t *&nbsp;</td>
<td class="paramname"> <em>length</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Gets an ASCII representation of all envelope headers<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ctx</em>&nbsp;</td><td>A valid MiniMIME context </td></tr>
<tr><td valign="top"></td><td valign="top"><em>result</em>&nbsp;</td><td>Where to store the resulting ASCII headers </td></tr>
<tr><td valign="top"></td><td valign="top"><em>length</em>&nbsp;</td><td>Where to store the length of the result </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success or -1 on failure. </dd></dl>
<dl class="note" compact><dt><b>Note:</b></dt><dd>Sets mm_errno on failure</dd></dl>
This is mainly a convinience function. It constructs an ASCII representation from all of the message's envelope headers and stores the result in headers. Memory is allocated dynamically, and the total length of the result is stored in length. This function takes care that the output is MIME conform, and folds long lines according to the MIME standard at position 78 of the string. It also nicely formats all MIME related header fields, such as the Content-Type header.<p>
Since the memory needed to store the result is allocated dynamically, one should take care of freeing it again when it's not needed anymore. If an error occurs, *result will be set to NULL, *length will be set to zero and mm_errno will be set to a reasonable value.
</div>
</div><p>
<a class="anchor" name="ge63da17c56867ca2406a4eaf73230baf"></a><!-- doxytag: member="mm_envelope.c::mm_envelope_getrecipients" ref="ge63da17c56867ca2406a4eaf73230baf" args="(MM_CTX *ctx, char **result, size_t *length)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_envelope_getrecipients </td>
<td>(</td>
<td class="paramtype">MM_CTX *&nbsp;</td>
<td class="paramname"> <em>ctx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char **&nbsp;</td>
<td class="paramname"> <em>result</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t *&nbsp;</td>
<td class="paramname"> <em>length</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Gets the list of recipients for a MIME message<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ctx</em>&nbsp;</td><td>A valid MiniMIME context </td></tr>
<tr><td valign="top"></td><td valign="top"><em>result</em>&nbsp;</td><td>Where to store the result </td></tr>
<tr><td valign="top"></td><td valign="top"><em>length</em>&nbsp;</td><td>Where to store the length of the result </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success or -1 on error </dd></dl>
<dl class="note" compact><dt><b>Note:</b></dt><dd>Sets mm_errno on error</dd></dl>
This functions gets the list of recipients for a given MIME message. It does so by concatenating the "From" and "Cc" header fields, and storing the results in recipients. The memory needed to store the result is allocated dynamically, and the total length of the result is stored in length.<p>
One should take care to free() the result once it's not needed anymore.
</div>
</div><p>
<a class="anchor" name="gb2c43c1645e42ae0860c902ce1dda788"></a><!-- doxytag: member="mm_envelope.c::mm_envelope_setheader" ref="gb2c43c1645e42ae0860c902ce1dda788" args="(MM_CTX *ctx, const char *name, const char *fmt,...)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_envelope_setheader </td>
<td>(</td>
<td class="paramtype">MM_CTX *&nbsp;</td>
<td class="paramname"> <em>ctx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&nbsp;</td>
<td class="paramname"> <em>name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&nbsp;</td>
<td class="paramname"> <em>fmt</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&nbsp;</td>
<td class="paramname"> <em>...</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Sets a header field in the envelope<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ctx</em>&nbsp;</td><td>A valid MiniMIME context </td></tr>
<tr><td valign="top"></td><td valign="top"><em>name</em>&nbsp;</td><td>The name of the header field to set </td></tr>
<tr><td valign="top"></td><td valign="top"><em>fmt</em>&nbsp;</td><td>A format string specifying the value of the header field </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success or -1 on failure</dd></dl>
This function generates a new MIME header and attaches it to the first MIME part (the envelope) found in the given context. If no part is attached already, the function will return an error. The function will store a copy of ``name'' as the header's name field, and dynamically allocate the memory needed to build the format string.
</div>
</div><p>
<hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:08 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,108 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: MiniMIME error functions</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<h1>MiniMIME error functions</h1><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__error.html#g69de7c9bee1d535593a55807590de543">mm_error_init</a> (void)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__error.html#g92006c97728639d8f32f5bc4c6e2a47f">mm_error_setmsg</a> (const char *fmt,...)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__error.html#g8654857a3ac349b87d798902912371a3">mm_error_string</a> (void)</td></tr>
</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="g69de7c9bee1d535593a55807590de543"></a><!-- doxytag: member="mm_error.c::mm_error_init" ref="g69de7c9bee1d535593a55807590de543" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void mm_error_init </td>
<td>(</td>
<td class="paramtype">void&nbsp;</td>
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Initializes the global error object<p>
This function initializes the global error object mm_error. This must be done when the library is initialized, and is automatically called from mm_init_library().
</div>
</div><p>
<a class="anchor" name="g92006c97728639d8f32f5bc4c6e2a47f"></a><!-- doxytag: member="mm_error.c::mm_error_setmsg" ref="g92006c97728639d8f32f5bc4c6e2a47f" args="(const char *fmt,...)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void mm_error_setmsg </td>
<td>(</td>
<td class="paramtype">const char *&nbsp;</td>
<td class="paramname"> <em>fmt</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&nbsp;</td>
<td class="paramname"> <em>...</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Sets a descriptive error message<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>fmt</em>&nbsp;</td><td>The error message as format string</td></tr>
</table>
</dl>
This function is called from the various MiniMIME modules in case an error occured. Should never be called by the user.
</div>
</div><p>
<a class="anchor" name="g8654857a3ac349b87d798902912371a3"></a><!-- doxytag: member="mm_error.c::mm_error_string" ref="g8654857a3ac349b87d798902912371a3" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char* mm_error_string </td>
<td>(</td>
<td class="paramtype">void&nbsp;</td>
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Retrieves the current error message<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>The currently set error message</dd></dl>
This function can be used to retrieve a descriptive error message for the current error, much like strerror() function of libc. When this function is called without an error being set, it returns the string "No error". The string returned does not need to be freed, since it is not dynamically allocated by the library.
</div>
</div><p>
<hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:08 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,705 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: Accessing and manipulating MIME parts</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<h1>Accessing and manipulating MIME parts</h1><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Creating and destroying MIME parts</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">mm_mimepart *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#g417e5dd361e30cddb91e1d9a5e30b223">mm_mimepart_new</a> (void)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">mm_mimepart *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#ged8112012a337371ae8093adb1ab6d27">mm_mimepart_fromfile</a> (const char *filename)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#gbf47790a0bb96b22bc5e236bc40cb32e">mm_mimepart_free</a> (struct mm_mimepart *part)</td></tr>
<tr><td colspan="2"><br><h2>Accessing the MIME part's mail header</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#g46a674ff6b9873c0c45fa4eb5d94fd62">mm_mimepart_attachheader</a> (struct mm_mimepart *part, struct mm_mimeheader *header)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#g44c78abfb0535312bcb427a2cd220026">mm_mimepart_countheaders</a> (struct mm_mimepart *part)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#gf89da502ac54306994bdb452448a8026">mm_mimepart_countheaderbyname</a> (struct mm_mimepart *part, const char *name)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">mm_mimeheader *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#ga3ca298eaa82f4ef3ea731511ac84e53">mm_mimepart_getheaderbyname</a> (struct mm_mimepart *part, const char *name, int idx)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">const char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#g779f11f7a6a54f83763b5ef6ff87e48f">mm_mimepart_getheadervalue</a> (struct mm_mimepart *part, const char *name, int idx)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#g4440bdcfddf88eb642b6a834a0557176">mm_mimepart_headers_start</a> (struct mm_mimepart *part, struct mm_mimeheader **id)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">mm_mimeheader *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#g8e9064736efdeebf4b257cc45f8a6adf">mm_mimepart_headers_next</a> (struct mm_mimepart *part, struct mm_mimeheader **id)</td></tr>
<tr><td colspan="2"><br><h2>Accessing and manipulating the MIME part's body</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#g52dc9f27a2801e4f6abb1effd2ed838d">mm_mimepart_getbody</a> (struct mm_mimepart *part, int opaque)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#gd1def098c00edc546b03e98e9ff8b27a">mm_mimepart_setbody</a> (struct mm_mimepart *part, const char *data, int opaque)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">size_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#gf8ccae1737dc4b9b91958fe448da677f">mm_mimepart_getlength</a> (struct mm_mimepart *part)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#g4551bf4460e5d165bbcd9f32d4f625de">mm_mimepart_decode</a> (struct mm_mimepart *part)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#gf19d3ace5ae174b3eaa35f9ddbe6e216">mm_mimepart_flatten</a> (struct mm_mimepart *part, char **result, size_t *length, int opaque)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#g164bb39a266559574c252f11266809ff">mm_mimepart_setdefaultcontenttype</a> (struct mm_mimepart *part, int composite)</td></tr>
<tr><td colspan="2"><br><h2>Accessing the MIME part's Content-Type information</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#g01822bc93b4741af75b5379384354e37">mm_mimepart_attachcontenttype</a> (struct mm_mimepart *part, struct mm_content *ct)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">mm_content *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#g210e2ceee56f8349f6778006da87d080">mm_mimepart_gettype</a> (struct mm_mimepart *part)</td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
MIME parts, also called entities, represent the structure of a MIME message. ``Normal'' internet messages have only a single part, and are called ``flat'' messages. Multipart messages have more then one part, and each MIME part can have it's own subset of headers.<p>
Provided here are functions to easily access all informations from a MIME part, including their specific headers and bodies. <hr><h2>Function Documentation</h2>
<a class="anchor" name="g01822bc93b4741af75b5379384354e37"></a><!-- doxytag: member="mm_mimepart.c::mm_mimepart_attachcontenttype" ref="g01822bc93b4741af75b5379384354e37" args="(struct mm_mimepart *part, struct mm_content *ct)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void mm_mimepart_attachcontenttype </td>
<td>(</td>
<td class="paramtype">struct mm_mimepart *&nbsp;</td>
<td class="paramname"> <em>part</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">struct mm_content *&nbsp;</td>
<td class="paramname"> <em>ct</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Attaches a context type object to a MIME part<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>part</em>&nbsp;</td><td>A valid MIME part object </td></tr>
<tr><td valign="top"></td><td valign="top"><em>ct</em>&nbsp;</td><td>The content type object to attach </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Nothing</dd></dl>
This function attaches a Content-Type object to a MIME part. It does not care whether the Content-Type suites the actual content in the MIME part, so the programmer should take care of that.
</div>
</div><p>
<a class="anchor" name="g46a674ff6b9873c0c45fa4eb5d94fd62"></a><!-- doxytag: member="mm_mimepart.c::mm_mimepart_attachheader" ref="g46a674ff6b9873c0c45fa4eb5d94fd62" args="(struct mm_mimepart *part, struct mm_mimeheader *header)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_mimepart_attachheader </td>
<td>(</td>
<td class="paramtype">struct mm_mimepart *&nbsp;</td>
<td class="paramname"> <em>part</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">struct mm_mimeheader *&nbsp;</td>
<td class="paramname"> <em>header</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Attaches a mm_mimeheader object to a MIME part<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>part</em>&nbsp;</td><td>A valid MIME part object </td></tr>
<tr><td valign="top"></td><td valign="top"><em>header</em>&nbsp;</td><td>A valid MIME header object </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 if successfull or -1 if the header could not be attached </dd></dl>
</div>
</div><p>
<a class="anchor" name="gf89da502ac54306994bdb452448a8026"></a><!-- doxytag: member="mm_mimepart.c::mm_mimepart_countheaderbyname" ref="gf89da502ac54306994bdb452448a8026" args="(struct mm_mimepart *part, const char *name)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_mimepart_countheaderbyname </td>
<td>(</td>
<td class="paramtype">struct mm_mimepart *&nbsp;</td>
<td class="paramname"> <em>part</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&nbsp;</td>
<td class="paramname"> <em>name</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Retrieves the number of MIME headers with a given name in a MIME part<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>part</em>&nbsp;</td><td>A valid MIME part object </td></tr>
<tr><td valign="top"></td><td valign="top"><em>name</em>&nbsp;</td><td>The name of the MIME header which to count for </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>The number of MIME headers within the MIME part </dd></dl>
</div>
</div><p>
<a class="anchor" name="g44c78abfb0535312bcb427a2cd220026"></a><!-- doxytag: member="mm_mimepart.c::mm_mimepart_countheaders" ref="g44c78abfb0535312bcb427a2cd220026" args="(struct mm_mimepart *part)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_mimepart_countheaders </td>
<td>(</td>
<td class="paramtype">struct mm_mimepart *&nbsp;</td>
<td class="paramname"> <em>part</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Retrieves the number of MIME headers available in a MIME part<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>part</em>&nbsp;</td><td>A valid MIME part object </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>The number of MIME headers within the MIME part </dd></dl>
</div>
</div><p>
<a class="anchor" name="g4551bf4460e5d165bbcd9f32d4f625de"></a><!-- doxytag: member="mm_mimepart.c::mm_mimepart_decode" ref="g4551bf4460e5d165bbcd9f32d4f625de" args="(struct mm_mimepart *part)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char* mm_mimepart_decode </td>
<td>(</td>
<td class="paramtype">struct mm_mimepart *&nbsp;</td>
<td class="paramname"> <em>part</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Decodes a MIME part according to it's encoding using MiniMIME codecs<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>A</em>&nbsp;</td><td>valid MIME part object </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 if the MIME part could be successfully decoded or -1 if not </dd></dl>
<dl class="note" compact><dt><b>Note:</b></dt><dd>Sets mm_errno on error</dd></dl>
This function decodes the body of a MIME part with a registered decoder according to it's Content-Transfer-Encoding header field.
</div>
</div><p>
<a class="anchor" name="gf19d3ace5ae174b3eaa35f9ddbe6e216"></a><!-- doxytag: member="mm_mimepart.c::mm_mimepart_flatten" ref="gf19d3ace5ae174b3eaa35f9ddbe6e216" args="(struct mm_mimepart *part, char **result, size_t *length, int opaque)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_mimepart_flatten </td>
<td>(</td>
<td class="paramtype">struct mm_mimepart *&nbsp;</td>
<td class="paramname"> <em>part</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char **&nbsp;</td>
<td class="paramname"> <em>result</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t *&nbsp;</td>
<td class="paramname"> <em>length</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"> <em>opaque</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Creates an ASCII representation of the given MIME part<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>part</em>&nbsp;</td><td>A valid MIME part object </td></tr>
<tr><td valign="top"></td><td valign="top"><em>result</em>&nbsp;</td><td>Where to store the result </td></tr>
<tr><td valign="top"></td><td valign="top"><em>length</em>&nbsp;</td><td>Where to store the length of the result </td></tr>
<tr><td valign="top"></td><td valign="top"><em>opaque</em>&nbsp;</td><td>Whether to use the opaque MIME part 0 on success or -1 on error. </td></tr>
</table>
</dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__context.html#g5288136ab923605f6508c09359ae5772">mm_context_flatten</a></dd></dl>
This function creates an ASCII representation of a given MIME part. It will dynamically allocate the memory needed and stores the result in the memory region pointed to by result. The length of the result will be stored in length. If opaque is set to 1, mm_mimepart_flatten will store an opaque version of the MIME part in result, which means no headers will be created or sanitized. This is particulary useful if the part is digitally signed by e.g. PGP, and the signature spans the header fields of the part in question.
</div>
</div><p>
<a class="anchor" name="gbf47790a0bb96b22bc5e236bc40cb32e"></a><!-- doxytag: member="mm_mimepart.c::mm_mimepart_free" ref="gbf47790a0bb96b22bc5e236bc40cb32e" args="(struct mm_mimepart *part)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void mm_mimepart_free </td>
<td>(</td>
<td class="paramtype">struct mm_mimepart *&nbsp;</td>
<td class="paramname"> <em>part</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Frees all memory allocated by a mm_mimepart object.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>part</em>&nbsp;</td><td>A pointer to an allocated mm_mimepart object </td></tr>
</table>
</dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__mimepart.html#g417e5dd361e30cddb91e1d9a5e30b223">mm_mimepart_new</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="ged8112012a337371ae8093adb1ab6d27"></a><!-- doxytag: member="mm_mimepart.c::mm_mimepart_fromfile" ref="ged8112012a337371ae8093adb1ab6d27" args="(const char *filename)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">struct mm_mimepart* mm_mimepart_fromfile </td>
<td>(</td>
<td class="paramtype">const char *&nbsp;</td>
<td class="paramname"> <em>filename</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Creates a MIME part from a file<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>filename</em>&nbsp;</td><td>The name of the file to create the MIME part from </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>A pointer to a new MIME part object</dd></dl>
This function creates a new MIME part object from a file. The object should be freed using <a class="el" href="group__mimepart.html#gbf47790a0bb96b22bc5e236bc40cb32e">mm_mimepart_free()</a> later on. This function does NOT set the Content-Type and neither does any encoding work.
</div>
</div><p>
<a class="anchor" name="g52dc9f27a2801e4f6abb1effd2ed838d"></a><!-- doxytag: member="mm_mimepart.c::mm_mimepart_getbody" ref="g52dc9f27a2801e4f6abb1effd2ed838d" args="(struct mm_mimepart *part, int opaque)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char* mm_mimepart_getbody </td>
<td>(</td>
<td class="paramtype">struct mm_mimepart *&nbsp;</td>
<td class="paramname"> <em>part</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"> <em>opaque</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Gets the pointer to the MIME part's body data<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>part</em>&nbsp;</td><td>A valid MIME part object </td></tr>
<tr><td valign="top"></td><td valign="top"><em>opaque</em>&nbsp;</td><td>Whether to get the opaque part or not </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>A pointer to the MIME part's body </dd></dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__mimepart.html#gd1def098c00edc546b03e98e9ff8b27a">mm_mimepart_setbody</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="ga3ca298eaa82f4ef3ea731511ac84e53"></a><!-- doxytag: member="mm_mimepart.c::mm_mimepart_getheaderbyname" ref="ga3ca298eaa82f4ef3ea731511ac84e53" args="(struct mm_mimepart *part, const char *name, int idx)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">struct mm_mimeheader* mm_mimepart_getheaderbyname </td>
<td>(</td>
<td class="paramtype">struct mm_mimepart *&nbsp;</td>
<td class="paramname"> <em>part</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&nbsp;</td>
<td class="paramname"> <em>name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"> <em>idx</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Get a MIME header object from a MIME part<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>part</em>&nbsp;</td><td>A valid MIME part object </td></tr>
<tr><td valign="top"></td><td valign="top"><em>name</em>&nbsp;</td><td>The name of the MIME header which to retrieve </td></tr>
<tr><td valign="top"></td><td valign="top"><em>idx</em>&nbsp;</td><td>Which header field to get (in case of multiple headers of the same name). </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>A pointer to the requested MIME header on success, or NULL if there either isn't a header with the requested name or idx is out of range. </dd></dl>
</div>
</div><p>
<a class="anchor" name="g779f11f7a6a54f83763b5ef6ff87e48f"></a><!-- doxytag: member="mm_mimepart.c::mm_mimepart_getheadervalue" ref="g779f11f7a6a54f83763b5ef6ff87e48f" args="(struct mm_mimepart *part, const char *name, int idx)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const char* mm_mimepart_getheadervalue </td>
<td>(</td>
<td class="paramtype">struct mm_mimepart *&nbsp;</td>
<td class="paramname"> <em>part</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&nbsp;</td>
<td class="paramname"> <em>name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"> <em>idx</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Gets the value of a MIME header object<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>part</em>&nbsp;</td><td>A valid MIME part object </td></tr>
<tr><td valign="top"></td><td valign="top"><em>name</em>&nbsp;</td><td>The name of the header field to get the value from </td></tr>
<tr><td valign="top"></td><td valign="top"><em>idx</em>&nbsp;</td><td>The index of the header field to get, in case there are multiple headers with the same name. </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>A pointer to the requested value on success, or NULL if there either isn't a header with the requested name or idx is out of range. </dd></dl>
</div>
</div><p>
<a class="anchor" name="gf8ccae1737dc4b9b91958fe448da677f"></a><!-- doxytag: member="mm_mimepart.c::mm_mimepart_getlength" ref="gf8ccae1737dc4b9b91958fe448da677f" args="(struct mm_mimepart *part)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">size_t mm_mimepart_getlength </td>
<td>(</td>
<td class="paramtype">struct mm_mimepart *&nbsp;</td>
<td class="paramname"> <em>part</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Gets the length of a given MIME part object<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>part</em>&nbsp;</td><td>A valid MIME part object </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>The size of the part's body in byte.</dd></dl>
This function returns the total length of the given MIME part's body. The length does not include the headers of the MIME parts. If the function returns 0, no body part is set currently.
</div>
</div><p>
<a class="anchor" name="g210e2ceee56f8349f6778006da87d080"></a><!-- doxytag: member="mm_mimepart.c::mm_mimepart_gettype" ref="g210e2ceee56f8349f6778006da87d080" args="(struct mm_mimepart *part)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">struct mm_content* mm_mimepart_gettype </td>
<td>(</td>
<td class="paramtype">struct mm_mimepart *&nbsp;</td>
<td class="paramname"> <em>part</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Gets the Content-Type of a given MIME part object<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>part</em>&nbsp;</td><td>A valid MIME part object </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>The Content-Type object of the specified MIME part</dd></dl>
This function returns a pointer to the Content-Type object of the given MIME part. This pointer might be set to NULL, indicating that there is no Content-Type object for the given MIME part currently.
</div>
</div><p>
<a class="anchor" name="g8e9064736efdeebf4b257cc45f8a6adf"></a><!-- doxytag: member="mm_mimepart.c::mm_mimepart_headers_next" ref="g8e9064736efdeebf4b257cc45f8a6adf" args="(struct mm_mimepart *part, struct mm_mimeheader **id)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">struct mm_mimeheader* mm_mimepart_headers_next </td>
<td>(</td>
<td class="paramtype">struct mm_mimepart *&nbsp;</td>
<td class="paramname"> <em>part</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">struct mm_mimeheader **&nbsp;</td>
<td class="paramname"> <em>id</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns the next MIME header of a given MIME part object<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>part</em>&nbsp;</td><td>A valid MIME part object </td></tr>
<tr><td valign="top"></td><td valign="top"><em>id</em>&nbsp;</td><td>A previously initialized MIME header object </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>A pointer to the MIME header object or NULL if end of headers was reached. </dd></dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__mimepart.html#g4440bdcfddf88eb642b6a834a0557176">mm_mimepart_headers_start</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="g4440bdcfddf88eb642b6a834a0557176"></a><!-- doxytag: member="mm_mimepart.c::mm_mimepart_headers_start" ref="g4440bdcfddf88eb642b6a834a0557176" args="(struct mm_mimepart *part, struct mm_mimeheader **id)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_mimepart_headers_start </td>
<td>(</td>
<td class="paramtype">struct mm_mimepart *&nbsp;</td>
<td class="paramname"> <em>part</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">struct mm_mimeheader **&nbsp;</td>
<td class="paramname"> <em>id</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Initializes a header loop for a given MIME part<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>part</em>&nbsp;</td><td>A valid MIME part object </td></tr>
<tr><td valign="top"></td><td valign="top"><em>id</em>&nbsp;</td><td>The address of a MIME header object (to allow reentrance) </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success or -1 on failure </dd></dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__mimepart.html#g8e9064736efdeebf4b257cc45f8a6adf">mm_mimepart_headers_next</a></dd></dl>
Looping through headers can be done in the following way:<p>
<div class="fragment"><pre class="fragment"> <span class="keyword">struct </span>mm_mimeheader *header, *lheader;
<a class="code" href="group__mimepart.html#g4440bdcfddf88eb642b6a834a0557176">mm_mimepart_headers_start</a>(part, &amp;lheader);
<span class="keywordflow">while</span> ((header = <a class="code" href="group__mimepart.html#g8e9064736efdeebf4b257cc45f8a6adf">mm_mimepart_headers_next</a>(part, &amp;lheader)) != NULL) {
printf(<span class="stringliteral">"%s: %s\n"</span>, header-&gt;name, header-&gt;value);
}
</pre></div><p>
For convienience, the macro mm_mimepart_headers_foreach() can be used to loop through headers in a one-shot manner.
</div>
</div><p>
<a class="anchor" name="g417e5dd361e30cddb91e1d9a5e30b223"></a><!-- doxytag: member="mm_mimepart.c::mm_mimepart_new" ref="g417e5dd361e30cddb91e1d9a5e30b223" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">struct mm_mimepart* mm_mimepart_new </td>
<td>(</td>
<td class="paramtype">void&nbsp;</td>
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Allocates memory for a new mm_mimepart structure and initializes it.<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>A pointer to a struct of type mm_mimeheader or NULL on failure </dd></dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__mimepart.html#gbf47790a0bb96b22bc5e236bc40cb32e">mm_mimepart_free</a> </dd></dl>
<dl class="note" compact><dt><b>Note:</b></dt><dd>The memory must be freed by using <a class="el" href="group__mimepart.html#gbf47790a0bb96b22bc5e236bc40cb32e">mm_mimepart_free()</a> later on. </dd></dl>
</div>
</div><p>
<a class="anchor" name="gd1def098c00edc546b03e98e9ff8b27a"></a><!-- doxytag: member="mm_mimepart.c::mm_mimepart_setbody" ref="gd1def098c00edc546b03e98e9ff8b27a" args="(struct mm_mimepart *part, const char *data, int opaque)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void mm_mimepart_setbody </td>
<td>(</td>
<td class="paramtype">struct mm_mimepart *&nbsp;</td>
<td class="paramname"> <em>part</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&nbsp;</td>
<td class="paramname"> <em>data</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"> <em>opaque</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Sets the MIME part's body data<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>part</em>&nbsp;</td><td>A valid MIME part object </td></tr>
<tr><td valign="top"></td><td valign="top"><em>data</em>&nbsp;</td><td>A pointer to the data which to set </td></tr>
</table>
</dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__mimepart.html#g52dc9f27a2801e4f6abb1effd2ed838d">mm_mimepart_getbody</a></dd></dl>
This functions sets the body data for a given MIME part. The string pointed to by data must be NUL-terminated. The data is copied into the MIME part's body, and thus, the memory pointed to by data can be freed after the operation.
</div>
</div><p>
<a class="anchor" name="g164bb39a266559574c252f11266809ff"></a><!-- doxytag: member="mm_mimepart.c::mm_mimepart_setdefaultcontenttype" ref="g164bb39a266559574c252f11266809ff" args="(struct mm_mimepart *part, int composite)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_mimepart_setdefaultcontenttype </td>
<td>(</td>
<td class="paramtype">struct mm_mimepart *&nbsp;</td>
<td class="paramname"> <em>part</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"> <em>composite</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Sets the default Content-Type for a given MIME part<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>part</em>&nbsp;</td><td>A valid MIME part object </td></tr>
<tr><td valign="top"></td><td valign="top"><em>part</em>&nbsp;</td><td>Whether the Content-Type should be for composite or not </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success or -1 on failure</dd></dl>
This function sets a default Content-Type according to RFC 2045 with a value of "text/plain; charset="us-ascii"". This function should only be used if the MIME part in question does not have a valid Content-Type specification.
</div>
</div><p>
<hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:09 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,22 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: MIME related utility functions</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<h1>MIME related utility functions</h1><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
</table>
<hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:09 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,273 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: Accessing and manipulating MIME parameters</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<h1>Accessing and manipulating MIME parameters</h1><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions for manipulating MIME parameters</h2></td></tr>
<tr><td colspan="2">MIME parameters are properties attached to certain MIME headers, such as Content-Type and Content-Disposition. MIME parameters have a textual representations as in <em>name=value</em>. They contain important information about the MIME structure of a message, such as the boundary string used, which charset was used to encode the message and so on. This module provides simple to use functions to query or set MIME parameters.<p>
Each MIME header may hold an arbitrary amount of such parameters, which are delimeted by each other with a semicolon. <br><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">mm_param *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__param.html#gd3ac756551bf5a29a07d5992bfdbde09">mm_param_new</a> (void)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__param.html#g46339038e995799e6a3e37512f442fc9">mm_param_free</a> (struct mm_param *param)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">mm_param *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__param.html#gd3970def45b8bede334f4b89a41dec15">mm_param_generate</a> (const char *name, const char *value)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__param.html#g2a266c63c7e89cf829b2af8e995e55e8">mm_param_setname</a> (struct mm_param *param, const char *name, int copy)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__param.html#gca3e636ab5700462eb32ca5bc19e4cc6">mm_param_setvalue</a> (struct mm_param *param, const char *value, int copy)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">const char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__param.html#g0e0ddccf47a2b1e0ad5bcc52c7b39753">mm_param_getname</a> (struct mm_param *param)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">const char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__param.html#g3c6f8cddd409de3000c31584e140561e">mm_param_getvalue</a> (struct mm_param *param)</td></tr>
</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="g46339038e995799e6a3e37512f442fc9"></a><!-- doxytag: member="mm_param.c::mm_param_free" ref="g46339038e995799e6a3e37512f442fc9" args="(struct mm_param *param)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void mm_param_free </td>
<td>(</td>
<td class="paramtype">struct mm_param *&nbsp;</td>
<td class="paramname"> <em>param</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Releases all memory associated with a MIME parameter object.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>param</em>&nbsp;</td><td>A valid MIME parameter object to be freed </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Nothing </dd></dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__param.html#gd3ac756551bf5a29a07d5992bfdbde09">mm_param_new</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="gd3970def45b8bede334f4b89a41dec15"></a><!-- doxytag: member="mm_param.c::mm_param_generate" ref="gd3970def45b8bede334f4b89a41dec15" args="(const char *name, const char *value)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">struct mm_param* mm_param_generate </td>
<td>(</td>
<td class="paramtype">const char *&nbsp;</td>
<td class="paramname"> <em>name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&nbsp;</td>
<td class="paramname"> <em>value</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Generates a new Content-Type parameter with the given name and value<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>name</em>&nbsp;</td><td>The name of the MIME parameter </td></tr>
<tr><td valign="top"></td><td valign="top"><em>value</em>&nbsp;</td><td>The value of the MIME parameter </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>A new MIME parameter object </dd></dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__param.html#g46339038e995799e6a3e37512f442fc9">mm_param_free</a> <p>
<a class="el" href="group__param.html#gd3ac756551bf5a29a07d5992bfdbde09">mm_param_new</a></dd></dl>
This function generates a new MIME parameter, with the name and value given as the arguments. The needed memory for the operation is allocated dynamically. It stores a copy of name and value in the actual object, so the memory holding the arguments can safely be freed after successfull return of this function.
</div>
</div><p>
<a class="anchor" name="g0e0ddccf47a2b1e0ad5bcc52c7b39753"></a><!-- doxytag: member="mm_param.c::mm_param_getname" ref="g0e0ddccf47a2b1e0ad5bcc52c7b39753" args="(struct mm_param *param)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const char* mm_param_getname </td>
<td>(</td>
<td class="paramtype">struct mm_param *&nbsp;</td>
<td class="paramname"> <em>param</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Gets the name of a MIME parameter object<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>param</em>&nbsp;</td><td>A valid MIME parameter object </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>The name of the MIME parameter </dd></dl>
</div>
</div><p>
<a class="anchor" name="g3c6f8cddd409de3000c31584e140561e"></a><!-- doxytag: member="mm_param.c::mm_param_getvalue" ref="g3c6f8cddd409de3000c31584e140561e" args="(struct mm_param *param)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const char* mm_param_getvalue </td>
<td>(</td>
<td class="paramtype">struct mm_param *&nbsp;</td>
<td class="paramname"> <em>param</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Gets the value of a MIME parameter object<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>param</em>&nbsp;</td><td>A valid MIME parameter object </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>The value of the MIME parameter </dd></dl>
</div>
</div><p>
<a class="anchor" name="gd3ac756551bf5a29a07d5992bfdbde09"></a><!-- doxytag: member="mm_param.c::mm_param_new" ref="gd3ac756551bf5a29a07d5992bfdbde09" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">struct mm_param* mm_param_new </td>
<td>(</td>
<td class="paramtype">void&nbsp;</td>
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Creates a new object to hold a MIME parameter.<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>An object representing a MIME parameter </dd></dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__param.html#g46339038e995799e6a3e37512f442fc9">mm_param_free</a> </dd></dl>
<dl class="note" compact><dt><b>Note:</b></dt><dd>The allocated memory must later be freed using <a class="el" href="group__param.html#g46339038e995799e6a3e37512f442fc9">mm_param_free()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="g2a266c63c7e89cf829b2af8e995e55e8"></a><!-- doxytag: member="mm_param.c::mm_param_setname" ref="g2a266c63c7e89cf829b2af8e995e55e8" args="(struct mm_param *param, const char *name, int copy)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char* mm_param_setname </td>
<td>(</td>
<td class="paramtype">struct mm_param *&nbsp;</td>
<td class="paramname"> <em>param</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&nbsp;</td>
<td class="paramname"> <em>name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"> <em>copy</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Sets the name of the given MIME parameter<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>param</em>&nbsp;</td><td>A valid MIME parameter object </td></tr>
<tr><td valign="top"></td><td valign="top"><em>name</em>&nbsp;</td><td>The new name of the parameter </td></tr>
<tr><td valign="top"></td><td valign="top"><em>copy</em>&nbsp;</td><td>If set to &gt; 0, copy the value stored in name </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>The address of the previous name for passing to free() </dd></dl>
</div>
</div><p>
<a class="anchor" name="gca3e636ab5700462eb32ca5bc19e4cc6"></a><!-- doxytag: member="mm_param.c::mm_param_setvalue" ref="gca3e636ab5700462eb32ca5bc19e4cc6" args="(struct mm_param *param, const char *value, int copy)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char* mm_param_setvalue </td>
<td>(</td>
<td class="paramtype">struct mm_param *&nbsp;</td>
<td class="paramname"> <em>param</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&nbsp;</td>
<td class="paramname"> <em>value</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"> <em>copy</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Sets the value of the given MIME parameter<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>param</em>&nbsp;</td><td>A valid MIME parameter object </td></tr>
<tr><td valign="top"></td><td valign="top"><em>name</em>&nbsp;</td><td>The new value for the parameter </td></tr>
<tr><td valign="top"></td><td valign="top"><em>copy</em>&nbsp;</td><td>If set to &gt; 0, copy the value stored in value </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>The address of the previous value for passing to free() </dd></dl>
</div>
</div><p>
<hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:09 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,280 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: General purpose utility functions</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<h1>General purpose utility functions</h1><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Utility functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g35c4383ff0dee2de18985e6edfed1ae6"></a><!-- doxytag: member="util::xfree" ref="g35c4383ff0dee2de18985e6edfed1ae6" args="(void *)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><b>xfree</b> (void *)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g2961ae74e91b0b28acdf9822438a581c"></a><!-- doxytag: member="util::xstrdup" ref="g2961ae74e91b0b28acdf9822438a581c" args="(const char *)" -->
char *&nbsp;</td><td class="memItemRight" valign="bottom"><b>xstrdup</b> (const char *)</td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__util.html#g2ff4ef58da7e543466e75f20f2a2d8b7">xmalloc</a> (size_t size)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__util.html#ge14637b4672461f1f0bee822406d68dc">xrealloc</a> (void *p, size_t size)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__util.html#gf0f89a29a634f6f1f833abb1e214a6b1">mm_unquote</a> (const char *string)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__util.html#g49c016ff4cfd02f1b019c4dce5aac357">mm_uncomment</a> (const char *string)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__util.html#g3ae25483c8a42f6562f2a916a511228f">xstrsep</a> (char **stringp, const char *delim)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__util.html#gf62be7dd21e545f8db72f3c9e3b6a3c3">mm_stripchars</a> (char *input, char *strip)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__util.html#g0747d4b4e33644263e6d73d2d8d4818b">mm_addchars</a> (char *input, char *add, u_int16_t linelength)</td></tr>
</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="g0747d4b4e33644263e6d73d2d8d4818b"></a><!-- doxytag: member="mm_util.c::mm_addchars" ref="g0747d4b4e33644263e6d73d2d8d4818b" args="(char *input, char *add, u_int16_t linelength)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char* mm_addchars </td>
<td>(</td>
<td class="paramtype">char *&nbsp;</td>
<td class="paramname"> <em>input</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char *&nbsp;</td>
<td class="paramname"> <em>add</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">u_int16_t&nbsp;</td>
<td class="paramname"> <em>linelength</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Adds characters to a string at given positions<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>input</em>&nbsp;</td><td>The string to which to add characters </td></tr>
<tr><td valign="top"></td><td valign="top"><em>add</em>&nbsp;</td><td>The character string to add </td></tr>
<tr><td valign="top"></td><td valign="top"><em>linelength</em>&nbsp;</td><td>The position where to add the character </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>A copy of the string with characters added</dd></dl>
This function adds the characters add at each linelength positions and returns this new string.
</div>
</div><p>
<a class="anchor" name="gf62be7dd21e545f8db72f3c9e3b6a3c3"></a><!-- doxytag: member="mm_util.c::mm_stripchars" ref="gf62be7dd21e545f8db72f3c9e3b6a3c3" args="(char *input, char *strip)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char* mm_stripchars </td>
<td>(</td>
<td class="paramtype">char *&nbsp;</td>
<td class="paramname"> <em>input</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char *&nbsp;</td>
<td class="paramname"> <em>strip</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Strips a given character set from a string<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>input</em>&nbsp;</td><td>The string which to strip </td></tr>
<tr><td valign="top"></td><td valign="top"><em>strip</em>&nbsp;</td><td>The character set to strip off </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>A copy of the original string with all chars stripped </dd></dl>
</div>
</div><p>
<a class="anchor" name="g49c016ff4cfd02f1b019c4dce5aac357"></a><!-- doxytag: member="mm_util.c::mm_uncomment" ref="g49c016ff4cfd02f1b019c4dce5aac357" args="(const char *string)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char* mm_uncomment </td>
<td>(</td>
<td class="paramtype">const char *&nbsp;</td>
<td class="paramname"> <em>string</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Removes MIME comments from a string<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>string</em>&nbsp;</td><td>The string to uncomment </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>A pointer to the uncommented string or NULL on error. Sets mm_errno.</dd></dl>
This function removes MIME comments from a string (included in parantheses). It returns a pointer to a newly allocated memory region in which the uncommented string is stored. The returned string needs to be freed when it's not used anymore.
</div>
</div><p>
<a class="anchor" name="gf0f89a29a634f6f1f833abb1e214a6b1"></a><!-- doxytag: member="mm_util.c::mm_unquote" ref="gf0f89a29a634f6f1f833abb1e214a6b1" args="(const char *string)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char* mm_unquote </td>
<td>(</td>
<td class="paramtype">const char *&nbsp;</td>
<td class="paramname"> <em>string</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Unquotes a string<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>string</em>&nbsp;</td><td>The quoted string to unquote </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>A pointer to the unquoted string</dd></dl>
This function unquotes a string. That is, it returns a pointer to a newly allocated memory region in which the unquoted string is stored. Only leading and trailing double-qoutes are removed. The string needs to be freed when it is not needed anymore.
</div>
</div><p>
<a class="anchor" name="g2ff4ef58da7e543466e75f20f2a2d8b7"></a><!-- doxytag: member="mm_util.c::xmalloc" ref="g2ff4ef58da7e543466e75f20f2a2d8b7" args="(size_t size)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void* xmalloc </td>
<td>(</td>
<td class="paramtype">size_t&nbsp;</td>
<td class="paramname"> <em>size</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Allocates a block of memory<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>size</em>&nbsp;</td><td>The size of the memory region to allocate </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>A pointer to the allocated memory region</dd></dl>
<a class="el" href="group__util.html#g2ff4ef58da7e543466e75f20f2a2d8b7">xmalloc()</a> calls abort() if either the size argument is negative or the requested memory amount could not be allocated via an assert() call.
</div>
</div><p>
<a class="anchor" name="ge14637b4672461f1f0bee822406d68dc"></a><!-- doxytag: member="mm_util.c::xrealloc" ref="ge14637b4672461f1f0bee822406d68dc" args="(void *p, size_t size)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void* xrealloc </td>
<td>(</td>
<td class="paramtype">void *&nbsp;</td>
<td class="paramname"> <em>p</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t&nbsp;</td>
<td class="paramname"> <em>size</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
realloc() wrapper<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>p</em>&nbsp;</td><td>Pointer to a memory region which should be reallocated </td></tr>
<tr><td valign="top"></td><td valign="top"><em>size</em>&nbsp;</td><td>The new size of the memory region </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>A pointer to the reallocated memory region</dd></dl>
<a class="el" href="group__util.html#ge14637b4672461f1f0bee822406d68dc">xrealloc()</a> is a wrapper around realloc() which calls abort() if either the size argument is negative or the requested memory amount could not be allocated.
</div>
</div><p>
<a class="anchor" name="g3ae25483c8a42f6562f2a916a511228f"></a><!-- doxytag: member="mm_util.c::xstrsep" ref="g3ae25483c8a42f6562f2a916a511228f" args="(char **stringp, const char *delim)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char* xstrsep </td>
<td>(</td>
<td class="paramtype">char **&nbsp;</td>
<td class="paramname"> <em>stringp</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&nbsp;</td>
<td class="paramname"> <em>delim</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
separate strings<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>stringp</em>&nbsp;</td><td>A pointer to the string being splitted </td></tr>
<tr><td valign="top"></td><td valign="top"><em>delim</em>&nbsp;</td><td>The delimeter string</td></tr>
</table>
</dl>
This function works similar to strsep(), with the difference that delim is treated as a whole.
</div>
</div><p>
<hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:09 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,21 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: Main Page</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li id="current"><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<h1>MiniMIME Documentation</h1>
<p>
<hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:08 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,42 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: mimeparser.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul></div>
<h1>mimeparser.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef _MIMEPARSER_H_INCLUDED</span>
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define _MIMEPARSER_H_INCLUDED</span>
<a name="l00003"></a>00003 <span class="preprocessor"></span>
<a name="l00007"></a>00007 <span class="keywordtype">int</span> count_lines(<span class="keywordtype">char</span> *);
<a name="l00008"></a>00008 <span class="keywordtype">void</span> mimieparser_yyerror(<span class="keyword">const</span> <span class="keywordtype">char</span> *);
<a name="l00009"></a>00009 <span class="keywordtype">int</span> dprintf2(<span class="keyword">const</span> <span class="keywordtype">char</span> *, ...);
<a name="l00010"></a>00010 <span class="keywordtype">int</span> mimeparser_yyparse(<span class="keywordtype">void</span>);
<a name="l00011"></a>00011 <span class="keywordtype">int</span> mimeparser_yylex(<span class="keywordtype">void</span>);
<a name="l00012"></a>00012 <span class="keywordtype">int</span> mimeparser_yyerror(<span class="keyword">const</span> <span class="keywordtype">char</span> *);
<a name="l00013"></a>00013
<a name="l00014"></a>00014 <span class="keyword">struct </span>s_position
<a name="l00015"></a>00015 {
<a name="l00016"></a>00016 size_t opaque_start;
<a name="l00017"></a>00017 size_t start;
<a name="l00018"></a>00018 size_t end;
<a name="l00019"></a>00019 };
<a name="l00020"></a>00020
<a name="l00021"></a>00021 <span class="preprocessor">#endif </span><span class="comment">/* ! _MIMEPARSER_H_INCLUDED */</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:08 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,136 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: mimeparser.tab.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul></div>
<h1>mimeparser.tab.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* A Bison parser, made by GNU Bison 2.3. */</span>
<a name="l00002"></a>00002
<a name="l00003"></a>00003 <span class="comment">/* Skeleton interface for Bison's Yacc-like parsers in C</span>
<a name="l00004"></a>00004 <span class="comment"></span>
<a name="l00005"></a>00005 <span class="comment"> Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006</span>
<a name="l00006"></a>00006 <span class="comment"> Free Software Foundation, Inc.</span>
<a name="l00007"></a>00007 <span class="comment"></span>
<a name="l00008"></a>00008 <span class="comment"> This program is free software; you can redistribute it and/or modify</span>
<a name="l00009"></a>00009 <span class="comment"> it under the terms of the GNU General Public License as published by</span>
<a name="l00010"></a>00010 <span class="comment"> the Free Software Foundation; either version 2, or (at your option)</span>
<a name="l00011"></a>00011 <span class="comment"> any later version.</span>
<a name="l00012"></a>00012 <span class="comment"></span>
<a name="l00013"></a>00013 <span class="comment"> This program is distributed in the hope that it will be useful,</span>
<a name="l00014"></a>00014 <span class="comment"> but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00015"></a>00015 <span class="comment"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
<a name="l00016"></a>00016 <span class="comment"> GNU General Public License for more details.</span>
<a name="l00017"></a>00017 <span class="comment"></span>
<a name="l00018"></a>00018 <span class="comment"> You should have received a copy of the GNU General Public License</span>
<a name="l00019"></a>00019 <span class="comment"> along with this program; if not, write to the Free Software</span>
<a name="l00020"></a>00020 <span class="comment"> Foundation, Inc., 51 Franklin Street, Fifth Floor,</span>
<a name="l00021"></a>00021 <span class="comment"> Boston, MA 02110-1301, USA. */</span>
<a name="l00022"></a>00022
<a name="l00023"></a>00023 <span class="comment">/* As a special exception, you may create a larger work that contains</span>
<a name="l00024"></a>00024 <span class="comment"> part or all of the Bison parser skeleton and distribute that work</span>
<a name="l00025"></a>00025 <span class="comment"> under terms of your choice, so long as that work isn't itself a</span>
<a name="l00026"></a>00026 <span class="comment"> parser generator using the skeleton or a modified version thereof</span>
<a name="l00027"></a>00027 <span class="comment"> as a parser skeleton. Alternatively, if you modify or redistribute</span>
<a name="l00028"></a>00028 <span class="comment"> the parser skeleton itself, you may (at your option) remove this</span>
<a name="l00029"></a>00029 <span class="comment"> special exception, which will cause the skeleton and the resulting</span>
<a name="l00030"></a>00030 <span class="comment"> Bison output files to be licensed under the GNU General Public</span>
<a name="l00031"></a>00031 <span class="comment"> License without this special exception.</span>
<a name="l00032"></a>00032 <span class="comment"></span>
<a name="l00033"></a>00033 <span class="comment"> This special exception was added by the Free Software Foundation in</span>
<a name="l00034"></a>00034 <span class="comment"> version 2.2 of Bison. */</span>
<a name="l00035"></a>00035
<a name="l00036"></a>00036 <span class="comment">/* Tokens. */</span>
<a name="l00037"></a>00037 <span class="preprocessor">#ifndef YYTOKENTYPE</span>
<a name="l00038"></a>00038 <span class="preprocessor"></span><span class="preprocessor"># define YYTOKENTYPE</span>
<a name="l00039"></a>00039 <span class="preprocessor"></span> <span class="comment">/* Put the tokens into the symbol table, so that GDB and other debuggers</span>
<a name="l00040"></a>00040 <span class="comment"> know about them. */</span>
<a name="l00041"></a>00041 <span class="keyword">enum</span> yytokentype {
<a name="l00042"></a>00042 ANY = 258,
<a name="l00043"></a>00043 COLON = 259,
<a name="l00044"></a>00044 DASH = 260,
<a name="l00045"></a>00045 DQUOTE = 261,
<a name="l00046"></a>00046 ENDOFHEADERS = 262,
<a name="l00047"></a>00047 EOL = 263,
<a name="l00048"></a>00048 EOM = 264,
<a name="l00049"></a>00049 EQUAL = 265,
<a name="l00050"></a>00050 MIMEVERSION_HEADER = 266,
<a name="l00051"></a>00051 SEMICOLON = 267,
<a name="l00052"></a>00052 CONTENTDISPOSITION_HEADER = 268,
<a name="l00053"></a>00053 CONTENTENCODING_HEADER = 269,
<a name="l00054"></a>00054 CONTENTTYPE_HEADER = 270,
<a name="l00055"></a>00055 MAIL_HEADER = 271,
<a name="l00056"></a>00056 HEADERVALUE = 272,
<a name="l00057"></a>00057 BOUNDARY = 273,
<a name="l00058"></a>00058 ENDBOUNDARY = 274,
<a name="l00059"></a>00059 CONTENTTYPE_VALUE = 275,
<a name="l00060"></a>00060 TSPECIAL = 276,
<a name="l00061"></a>00061 WORD = 277,
<a name="l00062"></a>00062 BODY = 278,
<a name="l00063"></a>00063 PREAMBLE = 279,
<a name="l00064"></a>00064 POSTAMBLE = 280
<a name="l00065"></a>00065 };
<a name="l00066"></a>00066 <span class="preprocessor">#endif</span>
<a name="l00067"></a>00067 <span class="preprocessor"></span><span class="comment">/* Tokens. */</span>
<a name="l00068"></a>00068 <span class="preprocessor">#define ANY 258</span>
<a name="l00069"></a>00069 <span class="preprocessor"></span><span class="preprocessor">#define COLON 259</span>
<a name="l00070"></a>00070 <span class="preprocessor"></span><span class="preprocessor">#define DASH 260</span>
<a name="l00071"></a>00071 <span class="preprocessor"></span><span class="preprocessor">#define DQUOTE 261</span>
<a name="l00072"></a>00072 <span class="preprocessor"></span><span class="preprocessor">#define ENDOFHEADERS 262</span>
<a name="l00073"></a>00073 <span class="preprocessor"></span><span class="preprocessor">#define EOL 263</span>
<a name="l00074"></a>00074 <span class="preprocessor"></span><span class="preprocessor">#define EOM 264</span>
<a name="l00075"></a>00075 <span class="preprocessor"></span><span class="preprocessor">#define EQUAL 265</span>
<a name="l00076"></a>00076 <span class="preprocessor"></span><span class="preprocessor">#define MIMEVERSION_HEADER 266</span>
<a name="l00077"></a>00077 <span class="preprocessor"></span><span class="preprocessor">#define SEMICOLON 267</span>
<a name="l00078"></a>00078 <span class="preprocessor"></span><span class="preprocessor">#define CONTENTDISPOSITION_HEADER 268</span>
<a name="l00079"></a>00079 <span class="preprocessor"></span><span class="preprocessor">#define CONTENTENCODING_HEADER 269</span>
<a name="l00080"></a>00080 <span class="preprocessor"></span><span class="preprocessor">#define CONTENTTYPE_HEADER 270</span>
<a name="l00081"></a>00081 <span class="preprocessor"></span><span class="preprocessor">#define MAIL_HEADER 271</span>
<a name="l00082"></a>00082 <span class="preprocessor"></span><span class="preprocessor">#define HEADERVALUE 272</span>
<a name="l00083"></a>00083 <span class="preprocessor"></span><span class="preprocessor">#define BOUNDARY 273</span>
<a name="l00084"></a>00084 <span class="preprocessor"></span><span class="preprocessor">#define ENDBOUNDARY 274</span>
<a name="l00085"></a>00085 <span class="preprocessor"></span><span class="preprocessor">#define CONTENTTYPE_VALUE 275</span>
<a name="l00086"></a>00086 <span class="preprocessor"></span><span class="preprocessor">#define TSPECIAL 276</span>
<a name="l00087"></a>00087 <span class="preprocessor"></span><span class="preprocessor">#define WORD 277</span>
<a name="l00088"></a>00088 <span class="preprocessor"></span><span class="preprocessor">#define BODY 278</span>
<a name="l00089"></a>00089 <span class="preprocessor"></span><span class="preprocessor">#define PREAMBLE 279</span>
<a name="l00090"></a>00090 <span class="preprocessor"></span><span class="preprocessor">#define POSTAMBLE 280</span>
<a name="l00091"></a>00091 <span class="preprocessor"></span>
<a name="l00092"></a>00092
<a name="l00093"></a>00093
<a name="l00094"></a>00094
<a name="l00095"></a>00095 <span class="preprocessor">#if ! defined YYSTYPE &amp;&amp; ! defined YYSTYPE_IS_DECLARED</span>
<a name="l00096"></a>00096 <span class="preprocessor"></span><span class="keyword">typedef</span> <span class="keyword">union </span>YYSTYPE
<a name="l00097"></a>00097 #line 84 "mimeparser.y"
<a name="l00098"></a>00098 {
<a name="l00099"></a>00099 <span class="keywordtype">int</span> number;
<a name="l00100"></a>00100 <span class="keywordtype">char</span> *string;
<a name="l00101"></a>00101 <span class="keyword">struct </span>s_position position;
<a name="l00102"></a>00102 }
<a name="l00103"></a>00103 <span class="comment">/* Line 1489 of yacc.c. */</span>
<a name="l00104"></a>00104 <span class="preprocessor">#line 105 "mimeparser.tab.h"</span>
<a name="l00105"></a>00105 <span class="preprocessor"></span> YYSTYPE;
<a name="l00106"></a>00106 <span class="preprocessor"># define yystype YYSTYPE </span><span class="comment">/* obsolescent; will be withdrawn */</span>
<a name="l00107"></a>00107 <span class="preprocessor"># define YYSTYPE_IS_DECLARED 1</span>
<a name="l00108"></a>00108 <span class="preprocessor"></span><span class="preprocessor"># define YYSTYPE_IS_TRIVIAL 1</span>
<a name="l00109"></a>00109 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00110"></a>00110 <span class="preprocessor"></span>
<a name="l00111"></a>00111 <span class="keyword">extern</span> YYSTYPE mimeparser_yylval;
<a name="l00112"></a>00112
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:08 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,382 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: mm.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul></div>
<h1>mm.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * $Id$</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> * MiniMIME - a library for handling MIME messages</span>
<a name="l00005"></a>00005 <span class="comment"> *</span>
<a name="l00006"></a>00006 <span class="comment"> * Copyright (C) 2003 Jann Fischer &lt;rezine@mistrust.net&gt;</span>
<a name="l00007"></a>00007 <span class="comment"> * All rights reserved.</span>
<a name="l00008"></a>00008 <span class="comment"> *</span>
<a name="l00009"></a>00009 <span class="comment"> * Redistribution and use in source and binary forms, with or without</span>
<a name="l00010"></a>00010 <span class="comment"> * modification, are permitted provided that the following conditions</span>
<a name="l00011"></a>00011 <span class="comment"> * are met:</span>
<a name="l00012"></a>00012 <span class="comment"> *</span>
<a name="l00013"></a>00013 <span class="comment"> * 1. Redistributions of source code must retain the above copyright</span>
<a name="l00014"></a>00014 <span class="comment"> * notice, this list of conditions and the following disclaimer.</span>
<a name="l00015"></a>00015 <span class="comment"> * 2. Redistributions in binary form must reproduce the above copyright</span>
<a name="l00016"></a>00016 <span class="comment"> * notice, this list of conditions and the following disclaimer in the</span>
<a name="l00017"></a>00017 <span class="comment"> * documentation and/or other materials provided with the distribution.</span>
<a name="l00018"></a>00018 <span class="comment"> * 3. Neither the name of the author nor the names of the contributors</span>
<a name="l00019"></a>00019 <span class="comment"> * may be used to endorse or promote products derived from this software</span>
<a name="l00020"></a>00020 <span class="comment"> * without specific prior written permission.</span>
<a name="l00021"></a>00021 <span class="comment"> *</span>
<a name="l00022"></a>00022 <span class="comment"> * THIS SOFTWARE IS PROVIDED BY JANN FISCHER AND CONTRIBUTORS ``AS IS'' AND</span>
<a name="l00023"></a>00023 <span class="comment"> * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE</span>
<a name="l00024"></a>00024 <span class="comment"> * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE</span>
<a name="l00025"></a>00025 <span class="comment"> * ARE DISCLAIMED. IN NO EVENT SHALL JANN FISCHER OR THE VOICES IN HIS HEAD</span>
<a name="l00026"></a>00026 <span class="comment"> * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR</span>
<a name="l00027"></a>00027 <span class="comment"> * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF</span>
<a name="l00028"></a>00028 <span class="comment"> * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS</span>
<a name="l00029"></a>00029 <span class="comment"> * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN</span>
<a name="l00030"></a>00030 <span class="comment"> * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)</span>
<a name="l00031"></a>00031 <span class="comment"> * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF</span>
<a name="l00032"></a>00032 <span class="comment"> * THE POSSIBILITY OF SUCH DAMAGE.</span>
<a name="l00033"></a>00033 <span class="comment"> */</span>
<a name="l00034"></a>00034
<a name="l00035"></a>00035 <span class="preprocessor">#ifndef _MM_H_INCLUDED</span>
<a name="l00036"></a>00036 <span class="preprocessor"></span><span class="preprocessor">#define _MM_H_INCLUDED</span>
<a name="l00037"></a>00037 <span class="preprocessor"></span>
<a name="l00038"></a>00038 <span class="preprocessor">#include &lt;sys/types.h&gt;</span>
<a name="l00039"></a>00039 <span class="preprocessor">#include &lt;assert.h&gt;</span>
<a name="l00040"></a>00040 <span class="preprocessor">#include "mm_queue.h"</span>
<a name="l00041"></a>00041 <span class="preprocessor">#include "mm_mem.h"</span>
<a name="l00042"></a>00042
<a name="l00043"></a>00043 <span class="preprocessor">#define MM_MIME_LINELEN 998</span>
<a name="l00044"></a>00044 <span class="preprocessor"></span><span class="preprocessor">#define MM_BASE64_LINELEN 76</span>
<a name="l00045"></a>00045 <span class="preprocessor"></span>
<a name="l00046"></a>00046 TAILQ_HEAD(mm_mimeheaders, mm_mimeheader);
<a name="l00047"></a>00047 TAILQ_HEAD(mm_mimeparts, mm_mimepart);
<a name="l00048"></a>00048 TAILQ_HEAD(mm_params, mm_param);
<a name="l00049"></a>00049 SLIST_HEAD(mm_codecs, mm_codec);
<a name="l00050"></a>00050 SLIST_HEAD(mm_warnings, mm_warning);
<a name="l00051"></a>00051
<a name="l00052"></a>00052 <span class="comment">/*</span>
<a name="l00053"></a>00053 <span class="comment"> * Parser modes</span>
<a name="l00054"></a>00054 <span class="comment"> */</span>
<a name="l00055"></a>00055 <span class="keyword">enum</span> mm_parsemodes
<a name="l00056"></a>00056 {
<a name="l00058"></a>00058 MM_PARSE_LOOSE = 0,
<a name="l00060"></a>00060 MM_PARSE_STRICT
<a name="l00061"></a>00061 };
<a name="l00062"></a>00062
<a name="l00063"></a>00063 <span class="comment">/*</span>
<a name="l00064"></a>00064 <span class="comment"> * Available parser flags</span>
<a name="l00065"></a>00065 <span class="comment"> */</span>
<a name="l00066"></a>00066 <span class="keyword">enum</span> mm_parseflags
<a name="l00067"></a>00067 {
<a name="l00068"></a>00068 MM_PARSE_NONE = (1L &lt;&lt; 0),
<a name="l00069"></a>00069 MM_PARSE_STRIPCOMMENTS = (1L &lt;&lt; 1)
<a name="l00070"></a>00070 };
<a name="l00071"></a>00071
<a name="l00072"></a>00072 <span class="comment">/*</span>
<a name="l00073"></a>00073 <span class="comment"> * Enumeration of MIME encodings</span>
<a name="l00074"></a>00074 <span class="comment"> */</span>
<a name="l00075"></a>00075 <span class="keyword">enum</span> mm_encoding
<a name="l00076"></a>00076 {
<a name="l00077"></a>00077 MM_ENCODING_NONE = 0,
<a name="l00078"></a>00078 MM_ENCODING_BASE64,
<a name="l00079"></a>00079 MM_ENCODING_QUOTEDPRINTABLE,
<a name="l00080"></a>00080 MM_ENCODING_UNKNOWN
<a name="l00081"></a>00081 };
<a name="l00082"></a>00082
<a name="l00083"></a>00083 <span class="comment">/*</span>
<a name="l00084"></a>00084 <span class="comment"> * Message type</span>
<a name="l00085"></a>00085 <span class="comment"> */</span>
<a name="l00086"></a>00086 <span class="keyword">enum</span> mm_messagetype
<a name="l00087"></a>00087 {
<a name="l00089"></a>00089 MM_MSGTYPE_FLAT = 0,
<a name="l00091"></a>00091 MM_MSGTYPE_MULTIPART
<a name="l00092"></a>00092 };
<a name="l00093"></a>00093
<a name="l00094"></a>00094 <span class="comment">/*</span>
<a name="l00095"></a>00095 <span class="comment"> * Enumeration of error categories</span>
<a name="l00096"></a>00096 <span class="comment"> */</span>
<a name="l00097"></a>00097 <span class="keyword">enum</span> mm_errors
<a name="l00098"></a>00098 {
<a name="l00099"></a>00099 MM_ERROR_NONE = 0,
<a name="l00100"></a>00100 MM_ERROR_UNDEF,
<a name="l00101"></a>00101 MM_ERROR_ERRNO,
<a name="l00102"></a>00102 MM_ERROR_PARSE,
<a name="l00103"></a>00103 MM_ERROR_MIME,
<a name="l00104"></a>00104 MM_ERROR_CODEC,
<a name="l00105"></a>00105 MM_ERROR_PROGRAM
<a name="l00106"></a>00106 };
<a name="l00107"></a>00107
<a name="l00108"></a>00108 <span class="keyword">enum</span> mm_warning_ids
<a name="l00109"></a>00109 {
<a name="l00110"></a>00110 MM_WARN_NONE = 0,
<a name="l00111"></a>00111 MM_WARN_PARSE,
<a name="l00112"></a>00112 MM_WARN_MIME,
<a name="l00113"></a>00113 MM_WARN_CODEC
<a name="l00114"></a>00114 };
<a name="l00115"></a>00115
<a name="l00116"></a>00116 <span class="keyword">enum</span> mm_addressfields {
<a name="l00117"></a>00117 MM_ADDR_TO = 0,
<a name="l00118"></a>00118 MM_ADDR_CC,
<a name="l00119"></a>00119 MM_ADDR_BCC,
<a name="l00120"></a>00120 MM_ADDR_FROM,
<a name="l00121"></a>00121 MM_ADDR_SENDER,
<a name="l00122"></a>00122 MM_ADDR_REPLY_TO
<a name="l00123"></a>00123 };
<a name="l00124"></a>00124
<a name="l00125"></a>00125 <span class="keyword">enum</span> mm_flatten_flags {
<a name="l00126"></a>00126 MM_FLATTEN_NONE = 0,
<a name="l00127"></a>00127 MM_FLATTEN_SKIPENVELOPE = (1L &lt;&lt; 1),
<a name="l00128"></a>00128 MM_FLATTEN_OPAQUE = (1L &lt;&lt; 2),
<a name="l00129"></a>00129 MM_FLATTEN_NOPREAMBLE = (1L &lt;&lt; 3)
<a name="l00130"></a>00130 };
<a name="l00131"></a>00131
<a name="l00132"></a>00132 <span class="comment">/*</span>
<a name="l00133"></a>00133 <span class="comment"> * More information about an error</span>
<a name="l00134"></a>00134 <span class="comment"> */</span>
<a name="l00135"></a>00135 <span class="keyword">struct </span>mm_error_data
<a name="l00136"></a>00136 {
<a name="l00137"></a>00137 <span class="keywordtype">int</span> error_id;
<a name="l00138"></a>00138 <span class="keywordtype">int</span> error_where;
<a name="l00139"></a>00139 <span class="keywordtype">int</span> lineno;
<a name="l00140"></a>00140 <span class="keywordtype">char</span> error_msg[128];
<a name="l00141"></a>00141 };
<a name="l00142"></a>00142
<a name="l00143"></a>00143 <span class="keyword">extern</span> <span class="keywordtype">int</span> mm_errno;
<a name="l00144"></a>00144 <span class="keyword">extern</span> <span class="keyword">struct </span>mm_error_data mm_error;
<a name="l00145"></a>00145
<a name="l00146"></a>00146 <span class="keyword">enum</span> mm_warning_code
<a name="l00147"></a>00147 {
<a name="l00148"></a>00148 MM_WARNING_NONE = 0,
<a name="l00149"></a>00149 MM_WARNING_INVHDR,
<a name="l00150"></a>00150 };
<a name="l00151"></a>00151
<a name="l00152"></a>00152 <span class="comment">/*</span>
<a name="l00153"></a>00153 <span class="comment"> * A parser warning</span>
<a name="l00154"></a>00154 <span class="comment"> */</span>
<a name="l00155"></a>00155 <span class="keyword">struct </span>mm_warning
<a name="l00156"></a>00156 {
<a name="l00157"></a>00157 <span class="keyword">enum</span> mm_warning_code warning;
<a name="l00158"></a>00158 u_int32_t lineno;
<a name="l00159"></a>00159 SLIST_ENTRY(mm_warning) next;
<a name="l00160"></a>00160 };
<a name="l00161"></a>00161
<a name="l00162"></a>00162 <span class="comment">/*</span>
<a name="l00163"></a>00163 <span class="comment"> * Representation of a MiniMIME codec object</span>
<a name="l00164"></a>00164 <span class="comment"> */</span>
<a name="l00165"></a>00165 struct mm_codec
<a name="l00166"></a>00166 {
<a name="l00167"></a>00167 <span class="keyword">enum</span> mm_encoding id;
<a name="l00168"></a>00168 <span class="keywordtype">char</span> *encoding;
<a name="l00169"></a>00169
<a name="l00170"></a>00170 <span class="keywordtype">char</span> *(*encoder)(<span class="keywordtype">char</span> *, u_int32_t);
<a name="l00171"></a>00171 <span class="keywordtype">char</span> *(*decoder)(<span class="keywordtype">char</span> *);
<a name="l00172"></a>00172
<a name="l00173"></a>00173 SLIST_ENTRY(mm_codec) next;
<a name="l00174"></a>00174 };
<a name="l00175"></a>00175
<a name="l00176"></a>00176 <span class="comment">/*</span>
<a name="l00177"></a>00177 <span class="comment"> * Representation of a mail or MIME header field</span>
<a name="l00178"></a>00178 <span class="comment"> */</span>
<a name="l00179"></a>00179 struct mm_mimeheader
<a name="l00180"></a>00180 {
<a name="l00181"></a>00181 <span class="keywordtype">char</span> *name;
<a name="l00182"></a>00182 <span class="keywordtype">char</span> *value;
<a name="l00183"></a>00183
<a name="l00184"></a>00184 TAILQ_ENTRY(mm_mimeheader) next;
<a name="l00185"></a>00185 };
<a name="l00186"></a>00186
<a name="l00187"></a>00187 <span class="comment">/*</span>
<a name="l00188"></a>00188 <span class="comment"> * Representation of a MIME Content-Type parameter</span>
<a name="l00189"></a>00189 <span class="comment"> */</span>
<a name="l00190"></a>00190 struct mm_param
<a name="l00191"></a>00191 {
<a name="l00192"></a>00192 <span class="keywordtype">char</span> *name;
<a name="l00193"></a>00193 <span class="keywordtype">char</span> *value;
<a name="l00194"></a>00194
<a name="l00195"></a>00195 TAILQ_ENTRY(mm_param) next;
<a name="l00196"></a>00196 };
<a name="l00197"></a>00197
<a name="l00198"></a>00198 <span class="comment">/*</span>
<a name="l00199"></a>00199 <span class="comment"> * Representation of a MIME Content-Type object</span>
<a name="l00200"></a>00200 <span class="comment"> */</span>
<a name="l00201"></a>00201 struct mm_content
<a name="l00202"></a>00202 {
<a name="l00203"></a>00203 <span class="keywordtype">char</span> *maintype;
<a name="l00204"></a>00204 <span class="keywordtype">char</span> *subtype;
<a name="l00205"></a>00205
<a name="l00206"></a>00206 <span class="keyword">struct </span>mm_params params;
<a name="l00207"></a>00207
<a name="l00208"></a>00208 <span class="keywordtype">char</span> *encstring;
<a name="l00209"></a>00209 <span class="keyword">enum</span> mm_encoding encoding;
<a name="l00210"></a>00210 };
<a name="l00211"></a>00211
<a name="l00212"></a>00212 <span class="comment">/*</span>
<a name="l00213"></a>00213 <span class="comment"> * Representation of a MIME part </span>
<a name="l00214"></a>00214 <span class="comment"> */</span>
<a name="l00215"></a>00215 <span class="keyword">struct </span>mm_mimepart
<a name="l00216"></a>00216 {
<a name="l00217"></a>00217 <span class="keyword">struct </span>mm_mimeheaders headers;
<a name="l00218"></a>00218
<a name="l00219"></a>00219 size_t opaque_length;
<a name="l00220"></a>00220 <span class="keywordtype">char</span> *opaque_body;
<a name="l00221"></a>00221
<a name="l00222"></a>00222 size_t length;
<a name="l00223"></a>00223 <span class="keywordtype">char</span> *body;
<a name="l00224"></a>00224
<a name="l00225"></a>00225 <span class="keyword">struct </span>mm_content *type;
<a name="l00226"></a>00226
<a name="l00227"></a>00227 <span class="keywordtype">char</span> *disposition_type;
<a name="l00228"></a>00228 <span class="keywordtype">char</span> *filename;
<a name="l00229"></a>00229 <span class="keywordtype">char</span> *creation_date;
<a name="l00230"></a>00230 <span class="keywordtype">char</span> *modification_date;
<a name="l00231"></a>00231 <span class="keywordtype">char</span> *read_date;
<a name="l00232"></a>00232 <span class="keywordtype">char</span> *disposition_size;
<a name="l00233"></a>00233
<a name="l00234"></a>00234 TAILQ_ENTRY(mm_mimepart) next;
<a name="l00235"></a>00235 };
<a name="l00236"></a>00236
<a name="l00237"></a>00237 <span class="comment">/*</span>
<a name="l00238"></a>00238 <span class="comment"> * Represantation of a MiniMIME context</span>
<a name="l00239"></a>00239 <span class="comment"> */</span>
<a name="l00240"></a>00240 struct mm_context
<a name="l00241"></a>00241 {
<a name="l00242"></a>00242 <span class="keyword">struct </span>mm_mimeparts parts;
<a name="l00243"></a>00243 <span class="keyword">enum</span> mm_messagetype messagetype;
<a name="l00244"></a>00244 <span class="keyword">struct </span>mm_warnings warnings;
<a name="l00245"></a>00245 <span class="keyword">struct </span>mm_codecs codecs;
<a name="l00246"></a>00246 <span class="keywordtype">char</span> *boundary;
<a name="l00247"></a>00247 <span class="keywordtype">char</span> *preamble;
<a name="l00248"></a>00248 size_t max_message_size;
<a name="l00249"></a>00249 };
<a name="l00250"></a>00250
<a name="l00251"></a>00251 <span class="keyword">typedef</span> <span class="keyword">struct </span>mm_context MM_CTX;
<a name="l00252"></a>00252 <span class="keyword">typedef</span> <span class="keyword">struct </span>mm_context mm_ctx_t;
<a name="l00253"></a>00253
<a name="l00254"></a>00254 <span class="keywordtype">char</span> *<a class="code" href="group__util.html#gf0f89a29a634f6f1f833abb1e214a6b1">mm_unquote</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *);
<a name="l00255"></a>00255 <span class="keywordtype">char</span> *<a class="code" href="group__util.html#g49c016ff4cfd02f1b019c4dce5aac357">mm_uncomment</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *);
<a name="l00256"></a>00256 <span class="keywordtype">char</span> *<a class="code" href="group__util.html#gf62be7dd21e545f8db72f3c9e3b6a3c3">mm_stripchars</a>(<span class="keywordtype">char</span> *, <span class="keywordtype">char</span> *);
<a name="l00257"></a>00257 <span class="keywordtype">char</span> *<a class="code" href="group__util.html#g0747d4b4e33644263e6d73d2d8d4818b">mm_addchars</a>(<span class="keywordtype">char</span> *, <span class="keywordtype">char</span> *, u_int16_t);
<a name="l00258"></a>00258 <span class="keywordtype">int</span> mm_gendate(<span class="keywordtype">char</span> **);
<a name="l00259"></a>00259 <span class="keywordtype">void</span> mm_striptrailing(<span class="keywordtype">char</span> **, <span class="keyword">const</span> <span class="keywordtype">char</span> *);
<a name="l00260"></a>00260 <span class="keywordtype">int</span> mm_mimeutil_genboundary(<span class="keywordtype">char</span> *, size_t, <span class="keywordtype">char</span> **);
<a name="l00261"></a>00261
<a name="l00262"></a>00262 <span class="keywordtype">int</span> mm_library_init(<span class="keywordtype">void</span>);
<a name="l00263"></a>00263 <span class="keywordtype">int</span> mm_library_isinitialized(<span class="keywordtype">void</span>);
<a name="l00264"></a>00264
<a name="l00265"></a>00265 <span class="keywordtype">int</span> <a class="code" href="mm__parse_8c.html#58c960b6017f13d4e4ec5f09b3c38495">mm_parse_mem</a>(MM_CTX *, <span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keywordtype">int</span>, <span class="keywordtype">int</span>);
<a name="l00266"></a>00266 <span class="keywordtype">int</span> <a class="code" href="mm__parse_8c.html#cc9f623682b05f330c46e72e4e9d66cc">mm_parse_file</a>(MM_CTX *, <span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keywordtype">int</span>, <span class="keywordtype">int</span>);
<a name="l00267"></a>00267
<a name="l00268"></a>00268 MM_CTX *<a class="code" href="group__context.html#g919fd41f85534d9c87c256857faa2610">mm_context_new</a>(<span class="keywordtype">void</span>);
<a name="l00269"></a>00269 <span class="keywordtype">void</span> <a class="code" href="group__context.html#g76392d5269e9ef340c2f5f8336f7193b">mm_context_free</a>(MM_CTX *);
<a name="l00270"></a>00270 <span class="keywordtype">int</span> <a class="code" href="group__context.html#gec3ca486a61b392ff68774242086768e">mm_context_attachpart</a>(MM_CTX *, <span class="keyword">struct</span> mm_mimepart *);
<a name="l00271"></a>00271 <span class="keywordtype">int</span> <a class="code" href="group__context.html#g53d20c33a401539ef1ffa45f3dddb983">mm_context_deletepart</a>(MM_CTX *, <span class="keywordtype">int</span>, <span class="keywordtype">int</span>);
<a name="l00272"></a>00272 <span class="keywordtype">int</span> <a class="code" href="group__context.html#gf5bb032ad1c481d31d7b1b0710939712">mm_context_countparts</a>(MM_CTX *);
<a name="l00273"></a>00273 <span class="keyword">struct </span>mm_mimepart *<a class="code" href="group__context.html#g57fea229675f3e56a77eb40bb8193ee3">mm_context_getpart</a>(MM_CTX *, <span class="keywordtype">int</span>);
<a name="l00274"></a>00274 <span class="keywordtype">int</span> <a class="code" href="group__context.html#g1e73cadba4acd3ef9dd148dd0c2c3e70">mm_context_iscomposite</a>(MM_CTX *);
<a name="l00275"></a>00275 <span class="keywordtype">int</span> <a class="code" href="group__context.html#g8733dee7d83d3205349a7ee4ee5b2750">mm_context_haswarnings</a>(MM_CTX *);
<a name="l00276"></a>00276 <span class="keywordtype">int</span> <a class="code" href="group__context.html#g5288136ab923605f6508c09359ae5772">mm_context_flatten</a>(MM_CTX *, <span class="keywordtype">char</span> **, size_t *, <span class="keywordtype">int</span>);
<a name="l00277"></a>00277
<a name="l00278"></a>00278 <span class="keywordtype">int</span> <a class="code" href="group__envelope.html#g38f1164142cedfc3253b068a81f85563">mm_envelope_getheaders</a>(MM_CTX *, <span class="keywordtype">char</span> **, size_t *);
<a name="l00279"></a>00279 <span class="keywordtype">int</span> <a class="code" href="group__envelope.html#gb2c43c1645e42ae0860c902ce1dda788">mm_envelope_setheader</a>(MM_CTX *, <span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keyword">const</span> <span class="keywordtype">char</span> *, ...);
<a name="l00280"></a>00280
<a name="l00281"></a>00281 <span class="keyword">struct </span>mm_mimeheader *<a class="code" href="mm__header_8c.html#2f2c5f2f640111caf3096ed46b5986a4">mm_mimeheader_new</a>(<span class="keywordtype">void</span>);
<a name="l00282"></a>00282 <span class="keywordtype">void</span> <a class="code" href="mm__header_8c.html#61e3e62728f720ac381196ec59303064">mm_mimeheader_free</a>(<span class="keyword">struct</span> mm_mimeheader *);
<a name="l00283"></a>00283 <span class="keyword">struct </span>mm_mimeheader *<a class="code" href="mm__header_8c.html#07a7f7dcebc91aa86f5478e1d84341a1">mm_mimeheader_generate</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keyword">const</span> <span class="keywordtype">char</span> *);
<a name="l00284"></a>00284 <span class="keywordtype">int</span> mm_mimeheader_uncomment(<span class="keyword">struct</span> mm_mimeheader *);
<a name="l00285"></a>00285 <span class="keywordtype">int</span> mm_mimeheader_uncommentbyname(<span class="keyword">struct</span> mm_mimepart *, <span class="keyword">const</span> <span class="keywordtype">char</span> *);
<a name="l00286"></a>00286 <span class="keywordtype">int</span> mm_mimeheader_uncommentall(<span class="keyword">struct</span> mm_mimepart *);
<a name="l00287"></a>00287 <span class="keywordtype">int</span> mm_mimeheader_tostring(<span class="keyword">struct</span> mm_mimeheader *);
<a name="l00288"></a>00288
<a name="l00289"></a>00289 <span class="keyword">struct </span>mm_mimepart *<a class="code" href="group__mimepart.html#g417e5dd361e30cddb91e1d9a5e30b223">mm_mimepart_new</a>(<span class="keywordtype">void</span>);
<a name="l00290"></a>00290 <span class="keywordtype">void</span> <a class="code" href="group__mimepart.html#gbf47790a0bb96b22bc5e236bc40cb32e">mm_mimepart_free</a>(<span class="keyword">struct</span> mm_mimepart *);
<a name="l00291"></a>00291 <span class="keywordtype">int</span> <a class="code" href="group__mimepart.html#g46a674ff6b9873c0c45fa4eb5d94fd62">mm_mimepart_attachheader</a>(<span class="keyword">struct</span> mm_mimepart *, <span class="keyword">struct</span> mm_mimeheader *);
<a name="l00292"></a>00292 <span class="keywordtype">int</span> <a class="code" href="group__mimepart.html#g44c78abfb0535312bcb427a2cd220026">mm_mimepart_countheaders</a>(<span class="keyword">struct</span> mm_mimepart *part);
<a name="l00293"></a>00293 <span class="keywordtype">int</span> <a class="code" href="group__mimepart.html#gf89da502ac54306994bdb452448a8026">mm_mimepart_countheaderbyname</a>(<span class="keyword">struct</span> mm_mimepart *, <span class="keyword">const</span> <span class="keywordtype">char</span> *);
<a name="l00294"></a>00294 <span class="keyword">struct </span>mm_mimeheader *<a class="code" href="group__mimepart.html#ga3ca298eaa82f4ef3ea731511ac84e53">mm_mimepart_getheaderbyname</a>(<span class="keyword">struct</span> mm_mimepart *, <span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keywordtype">int</span>);
<a name="l00295"></a>00295 <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="group__mimepart.html#g779f11f7a6a54f83763b5ef6ff87e48f">mm_mimepart_getheadervalue</a>(<span class="keyword">struct</span> mm_mimepart *, <span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keywordtype">int</span>);
<a name="l00296"></a>00296 <span class="keywordtype">int</span> <a class="code" href="group__mimepart.html#g4440bdcfddf88eb642b6a834a0557176">mm_mimepart_headers_start</a>(<span class="keyword">struct</span> mm_mimepart *, <span class="keyword">struct</span> mm_mimeheader **);
<a name="l00297"></a>00297 <span class="keyword">struct </span>mm_mimeheader *<a class="code" href="group__mimepart.html#g8e9064736efdeebf4b257cc45f8a6adf">mm_mimepart_headers_next</a>(<span class="keyword">struct</span> mm_mimepart *, <span class="keyword">struct</span> mm_mimeheader **);
<a name="l00298"></a>00298 <span class="keywordtype">char</span> *<a class="code" href="group__mimepart.html#g4551bf4460e5d165bbcd9f32d4f625de">mm_mimepart_decode</a>(<span class="keyword">struct</span> mm_mimepart *);
<a name="l00299"></a>00299 <span class="keyword">struct </span>mm_content *<a class="code" href="group__mimepart.html#g210e2ceee56f8349f6778006da87d080">mm_mimepart_gettype</a>(<span class="keyword">struct</span> mm_mimepart *);
<a name="l00300"></a>00300 size_t <a class="code" href="group__mimepart.html#gf8ccae1737dc4b9b91958fe448da677f">mm_mimepart_getlength</a>(<span class="keyword">struct</span> mm_mimepart *);
<a name="l00301"></a>00301 <span class="keywordtype">char</span> *<a class="code" href="group__mimepart.html#g52dc9f27a2801e4f6abb1effd2ed838d">mm_mimepart_getbody</a>(<span class="keyword">struct</span> mm_mimepart *, <span class="keywordtype">int</span>);
<a name="l00302"></a>00302 <span class="keywordtype">void</span> <a class="code" href="group__mimepart.html#g01822bc93b4741af75b5379384354e37">mm_mimepart_attachcontenttype</a>(<span class="keyword">struct</span> mm_mimepart *, <span class="keyword">struct</span> mm_content *);
<a name="l00303"></a>00303 <span class="keywordtype">int</span> <a class="code" href="group__mimepart.html#g164bb39a266559574c252f11266809ff">mm_mimepart_setdefaultcontenttype</a>(<span class="keyword">struct</span> mm_mimepart *, <span class="keywordtype">int</span>);
<a name="l00304"></a>00304 <span class="keywordtype">int</span> <a class="code" href="group__mimepart.html#gf19d3ace5ae174b3eaa35f9ddbe6e216">mm_mimepart_flatten</a>(<span class="keyword">struct</span> mm_mimepart *, <span class="keywordtype">char</span> **, size_t *, <span class="keywordtype">int</span>);
<a name="l00305"></a>00305 <span class="keyword">struct </span>mm_mimepart *<a class="code" href="group__mimepart.html#ged8112012a337371ae8093adb1ab6d27">mm_mimepart_fromfile</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *);
<a name="l00306"></a>00306
<a name="l00307"></a>00307 <span class="keyword">struct </span>mm_content *<a class="code" href="group__contenttype.html#g3880ac74a20b4a9f610a4159568e1801">mm_content_new</a>(<span class="keywordtype">void</span>);
<a name="l00308"></a>00308 <span class="keywordtype">void</span> <a class="code" href="group__contenttype.html#g404314481125849bce869ee4b0f647af">mm_content_free</a>(<span class="keyword">struct</span> mm_content *);
<a name="l00309"></a>00309 <span class="keywordtype">int</span> <a class="code" href="group__contenttype.html#g080b7ed798ed497dcd635a6bab86962f">mm_content_attachparam</a>(<span class="keyword">struct</span> mm_content *, <span class="keyword">struct</span> mm_param *);
<a name="l00310"></a>00310 <span class="keyword">struct </span>mm_content *mm_content_parse(<span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keywordtype">int</span>);
<a name="l00311"></a>00311 <span class="keywordtype">char</span> *<a class="code" href="group__contenttype.html#g451441ee557ab5ef29477f3dc8330bf6">mm_content_getparambyname</a>(<span class="keyword">struct</span> mm_content *, <span class="keyword">const</span> <span class="keywordtype">char</span> *);
<a name="l00312"></a>00312 <span class="keyword">struct </span>mm_param *mm_content_getparamobjbyname(<span class="keyword">struct</span> mm_content *, <span class="keyword">const</span> <span class="keywordtype">char</span> *);
<a name="l00313"></a>00313 <span class="keywordtype">int</span> <a class="code" href="group__contenttype.html#g7bab273d117c6c0cacad20361d8fb1c8">mm_content_setmaintype</a>(<span class="keyword">struct</span> mm_content *, <span class="keywordtype">char</span> *, <span class="keywordtype">int</span>);
<a name="l00314"></a>00314 <span class="keywordtype">int</span> <a class="code" href="group__contenttype.html#g14b0738410d566ad2312405946f22212">mm_content_setsubtype</a>(<span class="keyword">struct</span> mm_content *, <span class="keywordtype">char</span> *, <span class="keywordtype">int</span>);
<a name="l00315"></a>00315 <span class="keywordtype">int</span> mm_content_settype(<span class="keyword">struct</span> mm_content *, <span class="keyword">const</span> <span class="keywordtype">char</span> *, ...);
<a name="l00316"></a>00316 <span class="keywordtype">char</span> *<a class="code" href="group__contenttype.html#gb213081017abf6bc7e601c6bf4214924">mm_content_getmaintype</a>(<span class="keyword">struct</span> mm_content *);
<a name="l00317"></a>00317 <span class="keywordtype">char</span> *<a class="code" href="group__contenttype.html#g97f77ef40c14cd0fb397bad358ee5d49">mm_content_getsubtype</a>(<span class="keyword">struct</span> mm_content *);
<a name="l00318"></a>00318 <span class="keywordtype">char</span> *mm_content_gettype(<span class="keyword">struct</span> mm_content *);
<a name="l00319"></a>00319 <span class="keywordtype">int</span> <a class="code" href="group__contenttype.html#ga7fa479f27e73dea57257421d8fc9fc5">mm_content_iscomposite</a>(<span class="keyword">struct</span> mm_content *);
<a name="l00320"></a>00320 <span class="keywordtype">int</span> <a class="code" href="group__contenttype.html#gb724b5979182fa272fe4fd1b72b395d5">mm_content_isvalidencoding</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *);
<a name="l00321"></a>00321 <span class="keywordtype">int</span> <a class="code" href="group__contenttype.html#gea945e48ac5cca846715543634b9afe4">mm_content_setencoding</a>(<span class="keyword">struct</span> mm_content *, <span class="keyword">const</span> <span class="keywordtype">char</span> *);
<a name="l00322"></a>00322 <span class="keywordtype">char</span> *<a class="code" href="group__contenttype.html#g792e7d33fbb30e0123408bcef9d3204c">mm_content_paramstostring</a>(<span class="keyword">struct</span> mm_content *);
<a name="l00323"></a>00323 <span class="keywordtype">char</span> *<a class="code" href="group__contenttype.html#g18a99c95e35a76f13a77a83c4231e738">mm_content_tostring</a>(<span class="keyword">struct</span> mm_content *);
<a name="l00324"></a>00324
<a name="l00325"></a>00325 <span class="keyword">struct </span>mm_param *<a class="code" href="group__param.html#gd3ac756551bf5a29a07d5992bfdbde09">mm_param_new</a>(<span class="keywordtype">void</span>);
<a name="l00326"></a>00326 <span class="keywordtype">void</span> <a class="code" href="group__param.html#g46339038e995799e6a3e37512f442fc9">mm_param_free</a>(<span class="keyword">struct</span> mm_param *);
<a name="l00327"></a>00327
<a name="l00328"></a>00328 <span class="keywordtype">char</span> *mm_flatten_mimepart(<span class="keyword">struct</span> mm_mimepart *);
<a name="l00329"></a>00329 <span class="keywordtype">char</span> *mm_flatten_context(MM_CTX *);
<a name="l00330"></a>00330
<a name="l00331"></a>00331 <span class="keywordtype">int</span> <a class="code" href="group__codecs.html#g9e19f6343128fd7e4ec57c3d55049b55">mm_codec_isregistered</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *);
<a name="l00332"></a>00332 <span class="keywordtype">int</span> <a class="code" href="group__codecs.html#g6ccb0f7a1d7c870dc3dae04f31d6ccca">mm_codec_hasdecoder</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *);
<a name="l00333"></a>00333 <span class="keywordtype">int</span> <a class="code" href="group__codecs.html#g50ff257b794ceaec7aedf9ae18bfcc57">mm_codec_hasencoder</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *);
<a name="l00334"></a>00334 <span class="keywordtype">int</span> <a class="code" href="group__codecs.html#gf97a7311c909888ed9f6f14d6f1bf397">mm_codec_register</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keywordtype">char</span> *(*encoder)(<span class="keywordtype">char</span> *, u_int32_t), <span class="keywordtype">char</span> *(*decoder)(<span class="keywordtype">char</span> *));
<a name="l00335"></a>00335 <span class="keywordtype">int</span> <a class="code" href="group__codecs.html#g0c71696bc70f834386193e3c7a0e2ca4">mm_codec_unregister</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *);
<a name="l00336"></a>00336 <span class="keywordtype">int</span> <a class="code" href="group__codecs.html#g7c9e6538f84c368be2b56a3c9ba702be">mm_codec_unregisterall</a>(<span class="keywordtype">void</span>);
<a name="l00337"></a>00337 <span class="keywordtype">void</span> <a class="code" href="group__codecs.html#gf39e72460fb85f5ca41f6e270a68aacc">mm_codec_registerdefaultcodecs</a>(<span class="keywordtype">void</span>);
<a name="l00338"></a>00338
<a name="l00339"></a>00339 <span class="keywordtype">char</span> *mm_base64_decode(<span class="keywordtype">char</span> *);
<a name="l00340"></a>00340 <span class="keywordtype">char</span> *mm_base64_encode(<span class="keywordtype">char</span> *, u_int32_t);
<a name="l00341"></a>00341
<a name="l00342"></a>00342 <span class="keywordtype">void</span> <a class="code" href="group__error.html#g69de7c9bee1d535593a55807590de543">mm_error_init</a>(<span class="keywordtype">void</span>);
<a name="l00343"></a>00343 <span class="keywordtype">void</span> <a class="code" href="group__error.html#g92006c97728639d8f32f5bc4c6e2a47f">mm_error_setmsg</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *, ...);
<a name="l00344"></a>00344 <span class="keywordtype">void</span> mm_error_setlineno(<span class="keywordtype">int</span> lineno);
<a name="l00345"></a>00345 <span class="keywordtype">char</span> *<a class="code" href="group__error.html#g8654857a3ac349b87d798902912371a3">mm_error_string</a>(<span class="keywordtype">void</span>);
<a name="l00346"></a>00346 <span class="keywordtype">int</span> mm_error_lineno(<span class="keywordtype">void</span>);
<a name="l00347"></a>00347
<a name="l00348"></a>00348 <span class="keywordtype">void</span> mm_warning_add(MM_CTX *, <span class="keywordtype">int</span>, <span class="keyword">const</span> <span class="keywordtype">char</span> *, ...);
<a name="l00349"></a>00349 <span class="keyword">struct </span>mm_warning *mm_warning_next(MM_CTX *, <span class="keyword">struct</span> mm_warning **);
<a name="l00350"></a>00350
<a name="l00351"></a>00351 <span class="preprocessor">#ifndef HAVE_STRLCPY</span>
<a name="l00352"></a>00352 <span class="preprocessor"></span>size_t strlcpy(<span class="keywordtype">char</span> *, <span class="keyword">const</span> <span class="keywordtype">char</span> *, size_t);
<a name="l00353"></a>00353 <span class="preprocessor">#endif </span><span class="comment">/* ! HAVE_STRLCPY */</span>
<a name="l00354"></a>00354 <span class="preprocessor">#ifndef HAVE_STRLCAT</span>
<a name="l00355"></a>00355 <span class="preprocessor"></span>size_t strlcat(<span class="keywordtype">char</span> *, <span class="keyword">const</span> <span class="keywordtype">char</span> *, size_t);
<a name="l00356"></a>00356 <span class="preprocessor">#endif </span><span class="comment">/* ! HAVE_STRLCAT */</span>
<a name="l00357"></a>00357
<a name="l00358"></a>00358 <span class="preprocessor">#define MM_ISINIT() do { \</span>
<a name="l00359"></a>00359 <span class="preprocessor"> assert(mm_library_isinitialized() == 1); \</span>
<a name="l00360"></a>00360 <span class="preprocessor">} while (0);</span>
<a name="l00361"></a>00361 <span class="preprocessor"></span>
<a name="l00362"></a>00362 <span class="preprocessor">#endif </span><span class="comment">/* ! _MM_H_INCLUDED */</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:08 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,58 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: mm_codecs.c File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul></div>
<h1>mm_codecs.c File Reference</h1><code>#include &lt;sys/types.h&gt;</code><br>
<code>#include &lt;sys/stat.h&gt;</code><br>
<code>#include &lt;stdio.h&gt;</code><br>
<code>#include &lt;stdlib.h&gt;</code><br>
<code>#include &lt;unistd.h&gt;</code><br>
<code>#include &lt;fcntl.h&gt;</code><br>
<code>#include &lt;string.h&gt;</code><br>
<code>#include &lt;assert.h&gt;</code><br>
<code>#include &quot;<a class="el" href="mm__internal_8h-source.html">mm_internal.h</a>&quot;</code><br>
<code>#include &quot;mm_util.h&quot;</code><br>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td colspan="2"><div class="groupHeader">Codec manipulation</div></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__codecs.html#g6ccb0f7a1d7c870dc3dae04f31d6ccca">mm_codec_hasdecoder</a> (const char *encoding)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__codecs.html#g50ff257b794ceaec7aedf9ae18bfcc57">mm_codec_hasencoder</a> (const char *encoding)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__codecs.html#g9e19f6343128fd7e4ec57c3d55049b55">mm_codec_isregistered</a> (const char *encoding)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__codecs.html#gf97a7311c909888ed9f6f14d6f1bf397">mm_codec_register</a> (const char *encoding, char *(*encoder)(char *data, u_int32_t i), char *(*decoder)(char *data))</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__codecs.html#g0c71696bc70f834386193e3c7a0e2ca4">mm_codec_unregister</a> (const char *encoding)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__codecs.html#g7c9e6538f84c368be2b56a3c9ba702be">mm_codec_unregisterall</a> (void)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__codecs.html#gf39e72460fb85f5ca41f6e270a68aacc">mm_codec_registerdefaultcodecs</a> (void)</td></tr>
<tr><td colspan="2"><br><h2>Variables</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="b669b6dc7c7d10408d8da81b3f1a30d3"></a><!-- doxytag: member="mm_codecs.c::codecs" ref="b669b6dc7c7d10408d8da81b3f1a30d3" args="" -->
mm_codecs&nbsp;</td><td class="memItemRight" valign="bottom"><b>codecs</b></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
This module contains functions to manipulate MiniMIME codecs <hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:08 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,78 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: mm_contenttype.c File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul></div>
<h1>mm_contenttype.c File Reference</h1><code>#include &lt;stdio.h&gt;</code><br>
<code>#include &lt;stdlib.h&gt;</code><br>
<code>#include &lt;stdarg.h&gt;</code><br>
<code>#include &lt;string.h&gt;</code><br>
<code>#include &lt;ctype.h&gt;</code><br>
<code>#include &lt;assert.h&gt;</code><br>
<code>#include &quot;<a class="el" href="mm__internal_8h-source.html">mm_internal.h</a>&quot;</code><br>
<code>#include &quot;mm_util.h&quot;</code><br>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Data Structures</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">struct &nbsp;</td><td class="memItemRight" valign="bottom"><b>mm_encoding_mappings</b></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td colspan="2"><div class="groupHeader">Functions for manipulating Content-Type objects</div></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">mm_content *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__contenttype.html#g3880ac74a20b4a9f610a4159568e1801">mm_content_new</a> (void)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__contenttype.html#g404314481125849bce869ee4b0f647af">mm_content_free</a> (struct mm_content *ct)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__contenttype.html#g080b7ed798ed497dcd635a6bab86962f">mm_content_attachparam</a> (struct mm_content *ct, struct mm_param *param)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__contenttype.html#g451441ee557ab5ef29477f3dc8330bf6">mm_content_getparambyname</a> (struct mm_content *ct, const char *name)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g1ba63e679d2b49aceb6cfec8a6752581"></a><!-- doxytag: member="mm_contenttype.c::mm_content_getparamobjbyname" ref="g1ba63e679d2b49aceb6cfec8a6752581" args="(struct mm_content *ct, const char *name)" -->
mm_param *&nbsp;</td><td class="memItemRight" valign="bottom"><b>mm_content_getparamobjbyname</b> (struct mm_content *ct, const char *name)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__contenttype.html#g7bab273d117c6c0cacad20361d8fb1c8">mm_content_setmaintype</a> (struct mm_content *ct, char *value, int copy)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__contenttype.html#gb213081017abf6bc7e601c6bf4214924">mm_content_getmaintype</a> (struct mm_content *ct)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__contenttype.html#g97f77ef40c14cd0fb397bad358ee5d49">mm_content_getsubtype</a> (struct mm_content *ct)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga6d8453eb35bd695c4944e53b7040b65"></a><!-- doxytag: member="mm_contenttype.c::mm_content_gettype" ref="ga6d8453eb35bd695c4944e53b7040b65" args="(struct mm_content *ct)" -->
char *&nbsp;</td><td class="memItemRight" valign="bottom"><b>mm_content_gettype</b> (struct mm_content *ct)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__contenttype.html#g14b0738410d566ad2312405946f22212">mm_content_setsubtype</a> (struct mm_content *ct, char *value, int copy)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g878686678ea2ba97aa8edb1206a564d8"></a><!-- doxytag: member="mm_contenttype.c::mm_content_settype" ref="g878686678ea2ba97aa8edb1206a564d8" args="(struct mm_content *ct, const char *fmt,...)" -->
int&nbsp;</td><td class="memItemRight" valign="bottom"><b>mm_content_settype</b> (struct mm_content *ct, const char *fmt,...)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__contenttype.html#ga7fa479f27e73dea57257421d8fc9fc5">mm_content_iscomposite</a> (struct mm_content *ct)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__contenttype.html#gb724b5979182fa272fe4fd1b72b395d5">mm_content_isvalidencoding</a> (const char *encoding)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__contenttype.html#gea945e48ac5cca846715543634b9afe4">mm_content_setencoding</a> (struct mm_content *ct, const char *encoding)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__contenttype.html#gbff87e581cd04db16e91245e9e9de67d">mm_content_getencoding</a> (struct mm_content *ct, const char *encoding)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__contenttype.html#g792e7d33fbb30e0123408bcef9d3204c">mm_content_paramstostring</a> (struct mm_content *ct)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__contenttype.html#g18a99c95e35a76f13a77a83c4231e738">mm_content_tostring</a> (struct mm_content *ct)</td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
This module contains functions for manipulating Content-Type objects. <hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:08 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,63 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: mm_context.c File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul></div>
<h1>mm_context.c File Reference</h1><code>#include &lt;stdio.h&gt;</code><br>
<code>#include &lt;stdlib.h&gt;</code><br>
<code>#include &lt;stdarg.h&gt;</code><br>
<code>#include &lt;string.h&gt;</code><br>
<code>#include &lt;assert.h&gt;</code><br>
<code>#include &quot;<a class="el" href="mm__internal_8h-source.html">mm_internal.h</a>&quot;</code><br>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td colspan="2"><div class="groupHeader">Manipulating MiniMIME contexts</div></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">MM_CTX *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__context.html#g919fd41f85534d9c87c256857faa2610">mm_context_new</a> (void)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__context.html#g76392d5269e9ef340c2f5f8336f7193b">mm_context_free</a> (MM_CTX *ctx)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__context.html#gec3ca486a61b392ff68774242086768e">mm_context_attachpart</a> (MM_CTX *ctx, struct mm_mimepart *part)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__context.html#g73a3dd187053aeabca4836dc28a6c468">mm_context_attachpart_after</a> (MM_CTX *ctx, struct mm_mimepart *part, int pos)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__context.html#g53d20c33a401539ef1ffa45f3dddb983">mm_context_deletepart</a> (MM_CTX *ctx, int which, int freemem)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__context.html#gf5bb032ad1c481d31d7b1b0710939712">mm_context_countparts</a> (MM_CTX *ctx)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">mm_mimepart *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__context.html#g57fea229675f3e56a77eb40bb8193ee3">mm_context_getpart</a> (MM_CTX *ctx, int which)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__context.html#g1e73cadba4acd3ef9dd148dd0c2c3e70">mm_context_iscomposite</a> (MM_CTX *ctx)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__context.html#g8733dee7d83d3205349a7ee4ee5b2750">mm_context_haswarnings</a> (MM_CTX *ctx)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__context.html#g9710e485f51167099d90f0d659979068">mm_context_generateboundary</a> (MM_CTX *ctx)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__context.html#gc0e7cc297516618d4773830a1988fc8d">mm_context_setpreamble</a> (MM_CTX *ctx, char *preamble)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g1ebbdd51106ccdee77ca421f9692bde7"></a><!-- doxytag: member="mm_context.c::mm_context_getpreamble" ref="g1ebbdd51106ccdee77ca421f9692bde7" args="(MM_CTX *ctx)" -->
char *&nbsp;</td><td class="memItemRight" valign="bottom"><b>mm_context_getpreamble</b> (MM_CTX *ctx)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__context.html#g5288136ab923605f6508c09359ae5772">mm_context_flatten</a> (MM_CTX *ctx, char **flat, size_t *length, int flags)</td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Modules for manipulating MiniMIME contexts <hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:08 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,44 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: mm_envelope.c File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul></div>
<h1>mm_envelope.c File Reference</h1><code>#include &lt;stdio.h&gt;</code><br>
<code>#include &lt;stdlib.h&gt;</code><br>
<code>#include &lt;stdarg.h&gt;</code><br>
<code>#include &lt;string.h&gt;</code><br>
<code>#include &lt;ctype.h&gt;</code><br>
<code>#include &lt;assert.h&gt;</code><br>
<code>#include &quot;<a class="el" href="mm__internal_8h-source.html">mm_internal.h</a>&quot;</code><br>
<code>#include &quot;mm_util.h&quot;</code><br>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td colspan="2"><div class="groupHeader">Accessing and manipulating a message's envelope</div></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__envelope.html#g38f1164142cedfc3253b068a81f85563">mm_envelope_getheaders</a> (MM_CTX *ctx, char **result, size_t *length)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__envelope.html#gb2c43c1645e42ae0860c902ce1dda788">mm_envelope_setheader</a> (MM_CTX *ctx, const char *name, const char *fmt,...)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__envelope.html#ge63da17c56867ca2406a4eaf73230baf">mm_envelope_getrecipients</a> (MM_CTX *ctx, char **result, size_t *length)</td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
This module contains functions for accessing a message's envelope. This are mainly wrapper functions for easy access. <hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:08 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,49 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: mm_error.c File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul></div>
<h1>mm_error.c File Reference</h1><code>#include &lt;stdio.h&gt;</code><br>
<code>#include &lt;stdlib.h&gt;</code><br>
<code>#include &lt;stdarg.h&gt;</code><br>
<code>#include &lt;string.h&gt;</code><br>
<code>#include &lt;assert.h&gt;</code><br>
<code>#include &lt;errno.h&gt;</code><br>
<code>#include &quot;<a class="el" href="mm__internal_8h-source.html">mm_internal.h</a>&quot;</code><br>
<code>#include &quot;mm_util.h&quot;</code><br>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__error.html#g69de7c9bee1d535593a55807590de543">mm_error_init</a> (void)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__error.html#g92006c97728639d8f32f5bc4c6e2a47f">mm_error_setmsg</a> (const char *fmt,...)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="190c991d7bb378b6cd6f995ffc3011f7"></a><!-- doxytag: member="mm_error.c::mm_error_setlineno" ref="190c991d7bb378b6cd6f995ffc3011f7" args="(int lineno)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><b>mm_error_setlineno</b> (int lineno)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__error.html#g8654857a3ac349b87d798902912371a3">mm_error_string</a> (void)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="c84acacac29f1e6efd10bb3a89eab272"></a><!-- doxytag: member="mm_error.c::mm_error_lineno" ref="c84acacac29f1e6efd10bb3a89eab272" args="(void)" -->
int&nbsp;</td><td class="memItemRight" valign="bottom"><b>mm_error_lineno</b> (void)</td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
This module contains functions for MiniMIME error information/manipulation <hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:08 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,131 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: mm_header.c File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul></div>
<h1>mm_header.c File Reference</h1><code>#include &lt;stdio.h&gt;</code><br>
<code>#include &lt;stdlib.h&gt;</code><br>
<code>#include &lt;stdarg.h&gt;</code><br>
<code>#include &lt;string.h&gt;</code><br>
<code>#include &lt;ctype.h&gt;</code><br>
<code>#include &lt;assert.h&gt;</code><br>
<code>#include &quot;<a class="el" href="mm__internal_8h-source.html">mm_internal.h</a>&quot;</code><br>
<code>#include &quot;mm_util.h&quot;</code><br>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">mm_mimeheader *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="mm__header_8c.html#2f2c5f2f640111caf3096ed46b5986a4">mm_mimeheader_new</a> (void)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="mm__header_8c.html#61e3e62728f720ac381196ec59303064">mm_mimeheader_free</a> (struct mm_mimeheader *header)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">mm_mimeheader *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="mm__header_8c.html#07a7f7dcebc91aa86f5478e1d84341a1">mm_mimeheader_generate</a> (const char *name, const char *value)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="26657e44385646fde63712d7110492d7"></a><!-- doxytag: member="mm_header.c::mm_mimeheader_uncomment" ref="26657e44385646fde63712d7110492d7" args="(struct mm_mimeheader *header)" -->
int&nbsp;</td><td class="memItemRight" valign="bottom"><b>mm_mimeheader_uncomment</b> (struct mm_mimeheader *header)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="2081ee4c43e88d5a318a783069a5d471"></a><!-- doxytag: member="mm_header.c::mm_mimeheader_uncommentbyname" ref="2081ee4c43e88d5a318a783069a5d471" args="(struct mm_mimepart *part, const char *name)" -->
int&nbsp;</td><td class="memItemRight" valign="bottom"><b>mm_mimeheader_uncommentbyname</b> (struct mm_mimepart *part, const char *name)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="9f9bcb0fb26461bd349c15366748ecb7"></a><!-- doxytag: member="mm_header.c::mm_mimeheader_uncommentall" ref="9f9bcb0fb26461bd349c15366748ecb7" args="(struct mm_mimepart *part)" -->
int&nbsp;</td><td class="memItemRight" valign="bottom"><b>mm_mimeheader_uncommentall</b> (struct mm_mimepart *part)</td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
This module contains functions for manipulating MIME headers <hr><h2>Function Documentation</h2>
<a class="anchor" name="61e3e62728f720ac381196ec59303064"></a><!-- doxytag: member="mm_header.c::mm_mimeheader_free" ref="61e3e62728f720ac381196ec59303064" args="(struct mm_mimeheader *header)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void mm_mimeheader_free </td>
<td>(</td>
<td class="paramtype">struct mm_mimeheader *&nbsp;</td>
<td class="paramname"> <em>header</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Frees a MIME header object<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>header</em>&nbsp;</td><td>The MIME header object which to free </td></tr>
</table>
</dl>
</div>
</div><p>
<a class="anchor" name="07a7f7dcebc91aa86f5478e1d84341a1"></a><!-- doxytag: member="mm_header.c::mm_mimeheader_generate" ref="07a7f7dcebc91aa86f5478e1d84341a1" args="(const char *name, const char *value)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">struct mm_mimeheader* mm_mimeheader_generate </td>
<td>(</td>
<td class="paramtype">const char *&nbsp;</td>
<td class="paramname"> <em>name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&nbsp;</td>
<td class="paramname"> <em>value</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Creates a new MIME header, but does no checks whatsoever (create as-is)
</div>
</div><p>
<a class="anchor" name="2f2c5f2f640111caf3096ed46b5986a4"></a><!-- doxytag: member="mm_header.c::mm_mimeheader_new" ref="2f2c5f2f640111caf3096ed46b5986a4" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">struct mm_mimeheader* mm_mimeheader_new </td>
<td>(</td>
<td class="paramtype">void&nbsp;</td>
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Creates a new MIME header object<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>A new and initialized MIME header object </dd></dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="mm__header_8c.html#61e3e62728f720ac381196ec59303064">mm_mimeheader_free</a></dd></dl>
This function creates and initializes a new MIME header object, which must later be freed using <a class="el" href="mm__header_8c.html#61e3e62728f720ac381196ec59303064">mm_mimeheader_free()</a>
</div>
</div><p>
<hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:08 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,82 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: mm_internal.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul></div>
<h1>mm_internal.h</h1><a href="mm__internal_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * $Id$</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> * MiniMIME - a library for handling MIME messages</span>
<a name="l00005"></a>00005 <span class="comment"> *</span>
<a name="l00006"></a>00006 <span class="comment"> * Copyright (C) 2003 Jann Fischer &lt;rezine@mistrust.net&gt;</span>
<a name="l00007"></a>00007 <span class="comment"> * All rights reserved.</span>
<a name="l00008"></a>00008 <span class="comment"> *</span>
<a name="l00009"></a>00009 <span class="comment"> * Redistribution and use in source and binary forms, with or without</span>
<a name="l00010"></a>00010 <span class="comment"> * modification, are permitted provided that the following conditions</span>
<a name="l00011"></a>00011 <span class="comment"> * are met:</span>
<a name="l00012"></a>00012 <span class="comment"> *</span>
<a name="l00013"></a>00013 <span class="comment"> * 1. Redistributions of source code must retain the above copyright</span>
<a name="l00014"></a>00014 <span class="comment"> * notice, this list of conditions and the following disclaimer.</span>
<a name="l00015"></a>00015 <span class="comment"> * 2. Redistributions in binary form must reproduce the above copyright</span>
<a name="l00016"></a>00016 <span class="comment"> * notice, this list of conditions and the following disclaimer in the</span>
<a name="l00017"></a>00017 <span class="comment"> * documentation and/or other materials provided with the distribution.</span>
<a name="l00018"></a>00018 <span class="comment"> * 3. Neither the name of the author nor the names of the contributors</span>
<a name="l00019"></a>00019 <span class="comment"> * may be used to endorse or promote products derived from this software</span>
<a name="l00020"></a>00020 <span class="comment"> * without specific prior written permission.</span>
<a name="l00021"></a>00021 <span class="comment"> *</span>
<a name="l00022"></a>00022 <span class="comment"> * THIS SOFTWARE IS PROVIDED BY JANN FISCHER AND CONTRIBUTORS ``AS IS'' AND</span>
<a name="l00023"></a>00023 <span class="comment"> * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE</span>
<a name="l00024"></a>00024 <span class="comment"> * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE</span>
<a name="l00025"></a>00025 <span class="comment"> * ARE DISCLAIMED. IN NO EVENT SHALL JANN FISCHER OR THE VOICES IN HIS HEAD</span>
<a name="l00026"></a>00026 <span class="comment"> * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR</span>
<a name="l00027"></a>00027 <span class="comment"> * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF</span>
<a name="l00028"></a>00028 <span class="comment"> * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS</span>
<a name="l00029"></a>00029 <span class="comment"> * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN</span>
<a name="l00030"></a>00030 <span class="comment"> * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)</span>
<a name="l00031"></a>00031 <span class="comment"> * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF</span>
<a name="l00032"></a>00032 <span class="comment"> * THE POSSIBILITY OF SUCH DAMAGE.</span>
<a name="l00033"></a>00033 <span class="comment"> */</span>
<a name="l00034"></a>00034
<a name="l00038"></a>00038 <span class="preprocessor">#ifndef _MM_INTERNAL_H_INCLUDED</span>
<a name="l00039"></a>00039 <span class="preprocessor"></span><span class="preprocessor">#define _MM_INTERNAL_H_INCLUDED</span>
<a name="l00040"></a>00040 <span class="preprocessor"></span>
<a name="l00041"></a>00041 <span class="preprocessor">#include "mm.h"</span>
<a name="l00042"></a>00042
<a name="l00043"></a>00043 <span class="preprocessor">#define debugp(m, ...) do { \</span>
<a name="l00044"></a>00044 <span class="preprocessor"> fprintf(stderr, "%s:%d:: ", __FILE__, __LINE__); \</span>
<a name="l00045"></a>00045 <span class="preprocessor"> fprintf(stderr, m, ## __VA_ARGS__); \</span>
<a name="l00046"></a>00046 <span class="preprocessor"> fprintf(stderr, "\n"); \</span>
<a name="l00047"></a>00047 <span class="preprocessor"> fflush(stderr); \</span>
<a name="l00048"></a>00048 <span class="preprocessor">} while (0); </span>
<a name="l00049"></a>00049 <span class="preprocessor"></span>
<a name="l00054"></a>00054 <span class="preprocessor">#ifndef __HAVE_LEAK_DETECTION</span>
<a name="l00055"></a>00055 <span class="preprocessor"></span><span class="keywordtype">void</span> *<a class="code" href="group__util.html#g2ff4ef58da7e543466e75f20f2a2d8b7">xmalloc</a>(size_t);
<a name="l00056"></a>00056 <span class="keywordtype">void</span> *<a class="code" href="group__util.html#ge14637b4672461f1f0bee822406d68dc">xrealloc</a>(<span class="keywordtype">void</span> *, size_t);
<a name="l00057"></a>00057 <span class="keywordtype">void</span> xfree(<span class="keywordtype">void</span> *);
<a name="l00058"></a>00058 <span class="keywordtype">char</span> *xstrdup(<span class="keyword">const</span> <span class="keywordtype">char</span> *);
<a name="l00059"></a>00059 <span class="preprocessor">#endif</span>
<a name="l00060"></a>00060 <span class="preprocessor"></span>
<a name="l00061"></a>00061 <span class="keywordtype">char</span> *<a class="code" href="group__util.html#g3ae25483c8a42f6562f2a916a511228f">xstrsep</a>(<span class="keywordtype">char</span> **, <span class="keyword">const</span> <span class="keywordtype">char</span> *);
<a name="l00062"></a>00062
<a name="l00063"></a>00063 <span class="comment">/* THIS FILE IS INTENTIONALLY LEFT BLANK */</span>
<a name="l00064"></a>00064
<a name="l00065"></a>00065 <span class="preprocessor">#endif </span><span class="comment">/* ! _MM_INTERNAL_H_INCLUDED */</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:08 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,78 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: mm_internal.h File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul></div>
<h1>mm_internal.h File Reference</h1><code>#include &quot;mm.h&quot;</code><br>
<p>
<a href="mm__internal_8h-source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Defines</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><b>debugp</b>(m,...)</td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td colspan="2"><div class="groupHeader">Utility functions</div></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__util.html#g2ff4ef58da7e543466e75f20f2a2d8b7">xmalloc</a> (size_t)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__util.html#ge14637b4672461f1f0bee822406d68dc">xrealloc</a> (void *, size_t)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g35c4383ff0dee2de18985e6edfed1ae6"></a><!-- doxytag: member="mm_internal.h::xfree" ref="g35c4383ff0dee2de18985e6edfed1ae6" args="(void *)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><b>xfree</b> (void *)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g2961ae74e91b0b28acdf9822438a581c"></a><!-- doxytag: member="mm_internal.h::xstrdup" ref="g2961ae74e91b0b28acdf9822438a581c" args="(const char *)" -->
char *&nbsp;</td><td class="memItemRight" valign="bottom"><b>xstrdup</b> (const char *)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__util.html#g3ae25483c8a42f6562f2a916a511228f">xstrsep</a> (char **, const char *)</td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Data definitions for MiniMIME <hr><h2>Define Documentation</h2>
<a class="anchor" name="089dd7bda22f552c35ebdc06a8849c56"></a><!-- doxytag: member="mm_internal.h::debugp" ref="089dd7bda22f552c35ebdc06a8849c56" args="(m,...)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define debugp </td>
<td>(</td>
<td class="paramtype">m, <tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> <em>...</em>&nbsp;</td>
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
<b>Value:</b><div class="fragment"><pre class="fragment"><span class="keywordflow">do</span> { \
fprintf(stderr, <span class="stringliteral">"%s:%d:: "</span>, __FILE__, __LINE__); \
fprintf(stderr, m, ## __VA_ARGS__); \
fprintf(stderr, <span class="stringliteral">"\n"</span>); \
fflush(stderr); \
} <span class="keywordflow">while</span> (0);
</pre></div>
</div>
</div><p>
<hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:08 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,56 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: mm_mem.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul></div>
<h1>mm_mem.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef __MEM_H</span>
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define __MEM_H</span>
<a name="l00003"></a>00003 <span class="preprocessor"></span>
<a name="l00004"></a>00004 <span class="preprocessor">#ifdef __HAVE_LEAK_DETECTION</span>
<a name="l00005"></a>00005 <span class="preprocessor"></span>
<a name="l00006"></a>00006 <span class="preprocessor">#define NAMEOF(v) #v</span>
<a name="l00007"></a>00007 <span class="preprocessor"></span><span class="preprocessor">#define xmalloc(x) MM_malloc(x, __FILE__, __LINE__)</span>
<a name="l00008"></a>00008 <span class="preprocessor"></span><span class="preprocessor">#define xfree(x) MM_free(x, __FILE__, __LINE__, NAMEOF(x))</span>
<a name="l00009"></a>00009 <span class="preprocessor"></span><span class="preprocessor">#define xstrdup(x) MM_strdup(x, __FILE__, __LINE__)</span>
<a name="l00010"></a>00010 <span class="preprocessor"></span><span class="preprocessor">#define xrealloc(x, y) MM_realloc(x, y, __FILE__, __LINE__)</span>
<a name="l00011"></a>00011 <span class="preprocessor"></span>
<a name="l00012"></a>00012 TAILQ_HEAD(MM_chunks, MM_mem_chunk);
<a name="l00013"></a>00013
<a name="l00014"></a>00014 <span class="keyword">struct </span>MM_mem_chunk {
<a name="l00015"></a>00015 <span class="keywordtype">void</span> *address;
<a name="l00016"></a>00016 <span class="keyword">const</span> <span class="keywordtype">char</span> *filename;
<a name="l00017"></a>00017 u_int32_t line;
<a name="l00018"></a>00018 size_t size;
<a name="l00019"></a>00019
<a name="l00020"></a>00020 TAILQ_ENTRY(MM_mem_chunk) next;
<a name="l00021"></a>00021 };
<a name="l00022"></a>00022
<a name="l00023"></a>00023 <span class="keywordtype">void</span> *MM_malloc(size_t, <span class="keywordtype">char</span> *, <span class="keywordtype">int</span>);
<a name="l00024"></a>00024 <span class="keywordtype">void</span> *MM_realloc(<span class="keywordtype">void</span> *, size_t, <span class="keywordtype">char</span> *, <span class="keywordtype">int</span>);
<a name="l00025"></a>00025 <span class="keywordtype">void</span> MM_free(<span class="keywordtype">void</span> *, <span class="keywordtype">char</span> *, <span class="keywordtype">int</span>, <span class="keywordtype">char</span> *);
<a name="l00026"></a>00026 <span class="keywordtype">char</span> *MM_strdup(const <span class="keywordtype">char</span> *, <span class="keywordtype">char</span> *, <span class="keywordtype">int</span>);
<a name="l00027"></a>00027 <span class="keywordtype">void</span> MM_leakd_init(<span class="keywordtype">void</span>);
<a name="l00028"></a>00028 <span class="keywordtype">void</span> MM_leakd_printallocated(<span class="keywordtype">void</span>);
<a name="l00029"></a>00029 <span class="keywordtype">void</span> MM_leakd_flush(<span class="keywordtype">void</span>);
<a name="l00030"></a>00030
<a name="l00031"></a>00031 <span class="preprocessor">#endif </span><span class="comment">/* __HAVE_LEAK_DETECTION */</span>
<a name="l00032"></a>00032 <span class="preprocessor">#endif </span><span class="comment">/* ! HAVE_MEM_H */</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:08 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,79 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: mm_mimepart.c File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul></div>
<h1>mm_mimepart.c File Reference</h1><code>#include &lt;sys/types.h&gt;</code><br>
<code>#include &lt;sys/stat.h&gt;</code><br>
<code>#include &lt;stdio.h&gt;</code><br>
<code>#include &lt;stdlib.h&gt;</code><br>
<code>#include &lt;string.h&gt;</code><br>
<code>#include &lt;unistd.h&gt;</code><br>
<code>#include &lt;fcntl.h&gt;</code><br>
<code>#include &lt;ctype.h&gt;</code><br>
<code>#include &lt;assert.h&gt;</code><br>
<code>#include &quot;<a class="el" href="mm__internal_8h-source.html">mm_internal.h</a>&quot;</code><br>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td colspan="2"><div class="groupHeader">Creating and destroying MIME parts</div></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">mm_mimepart *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#g417e5dd361e30cddb91e1d9a5e30b223">mm_mimepart_new</a> (void)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">mm_mimepart *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#ged8112012a337371ae8093adb1ab6d27">mm_mimepart_fromfile</a> (const char *filename)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#gbf47790a0bb96b22bc5e236bc40cb32e">mm_mimepart_free</a> (struct mm_mimepart *part)</td></tr>
<tr><td colspan="2"><div class="groupHeader">Accessing the MIME part's mail header</div></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#g46a674ff6b9873c0c45fa4eb5d94fd62">mm_mimepart_attachheader</a> (struct mm_mimepart *part, struct mm_mimeheader *header)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#g44c78abfb0535312bcb427a2cd220026">mm_mimepart_countheaders</a> (struct mm_mimepart *part)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#gf89da502ac54306994bdb452448a8026">mm_mimepart_countheaderbyname</a> (struct mm_mimepart *part, const char *name)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">mm_mimeheader *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#ga3ca298eaa82f4ef3ea731511ac84e53">mm_mimepart_getheaderbyname</a> (struct mm_mimepart *part, const char *name, int idx)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">const char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#g779f11f7a6a54f83763b5ef6ff87e48f">mm_mimepart_getheadervalue</a> (struct mm_mimepart *part, const char *name, int idx)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#g4440bdcfddf88eb642b6a834a0557176">mm_mimepart_headers_start</a> (struct mm_mimepart *part, struct mm_mimeheader **id)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">mm_mimeheader *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#g8e9064736efdeebf4b257cc45f8a6adf">mm_mimepart_headers_next</a> (struct mm_mimepart *part, struct mm_mimeheader **id)</td></tr>
<tr><td colspan="2"><div class="groupHeader">Accessing and manipulating the MIME part's body</div></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#g52dc9f27a2801e4f6abb1effd2ed838d">mm_mimepart_getbody</a> (struct mm_mimepart *part, int opaque)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#gd1def098c00edc546b03e98e9ff8b27a">mm_mimepart_setbody</a> (struct mm_mimepart *part, const char *data, int opaque)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">size_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#gf8ccae1737dc4b9b91958fe448da677f">mm_mimepart_getlength</a> (struct mm_mimepart *part)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#g4551bf4460e5d165bbcd9f32d4f625de">mm_mimepart_decode</a> (struct mm_mimepart *part)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#gf19d3ace5ae174b3eaa35f9ddbe6e216">mm_mimepart_flatten</a> (struct mm_mimepart *part, char **result, size_t *length, int opaque)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#g164bb39a266559574c252f11266809ff">mm_mimepart_setdefaultcontenttype</a> (struct mm_mimepart *part, int composite)</td></tr>
<tr><td colspan="2"><div class="groupHeader">Accessing the MIME part's Content-Type information</div></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#g01822bc93b4741af75b5379384354e37">mm_mimepart_attachcontenttype</a> (struct mm_mimepart *part, struct mm_content *ct)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">mm_content *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mimepart.html#g210e2ceee56f8349f6778006da87d080">mm_mimepart_gettype</a> (struct mm_mimepart *part)</td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
This module contains functions for manipulating MIME header objects. <hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:08 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,76 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: mm_mimeutil.c File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul></div>
<h1>mm_mimeutil.c File Reference</h1><code>#include &lt;sys/time.h&gt;</code><br>
<code>#include &lt;stdio.h&gt;</code><br>
<code>#include &lt;stdlib.h&gt;</code><br>
<code>#include &lt;string.h&gt;</code><br>
<code>#include &lt;time.h&gt;</code><br>
<code>#include &lt;assert.h&gt;</code><br>
<code>#include &quot;<a class="el" href="mm__internal_8h-source.html">mm_internal.h</a>&quot;</code><br>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Defines</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="257774e1a30f8190b3d99891be64210a"></a><!-- doxytag: member="mm_mimeutil.c::MM_DATE_LENGTH" ref="257774e1a30f8190b3d99891be64210a" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><b>MM_DATE_LENGTH</b>&nbsp;&nbsp;&nbsp;50</td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="mm__mimeutil_8c.html#a7b7f63b42dfa7a7f907b615aa4cd057">mm_mimeutil_gendate</a> (char **result)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a72e503ba7ce2552456c6bd5935febe9"></a><!-- doxytag: member="mm_mimeutil.c::mm_mimeutil_genboundary" ref="a72e503ba7ce2552456c6bd5935febe9" args="(char *prefix, size_t length, char **result)" -->
int&nbsp;</td><td class="memItemRight" valign="bottom"><b>mm_mimeutil_genboundary</b> (char *prefix, size_t length, char **result)</td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
This module contains various MIME related utility functions. <hr><h2>Function Documentation</h2>
<a class="anchor" name="a7b7f63b42dfa7a7f907b615aa4cd057"></a><!-- doxytag: member="mm_mimeutil.c::mm_mimeutil_gendate" ref="a7b7f63b42dfa7a7f907b615aa4cd057" args="(char **result)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_mimeutil_gendate </td>
<td>(</td>
<td class="paramtype">char **&nbsp;</td>
<td class="paramname"> <em>result</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Generates an RFC 2822 conform date string<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>timezone</em>&nbsp;</td><td>Whether to include timezone information </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>A pointer to the actual date string </dd></dl>
<dl class="note" compact><dt><b>Note:</b></dt><dd>The pointer returned must be freed some time</dd></dl>
This function generates an RFC 2822 conform date string to use in message headers. It allocates memory to hold the string and returns a pointer to it. The generated date is in the format (example):<p>
Thu, 25 December 2003 16:35:22 +0100 (CET)<p>
This function dynamically allocates memory and returns a pointer to it. This memory should be released with free() once not needed anymore.
</div>
</div><p>
<hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:08 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,57 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: mm_param.c File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul></div>
<h1>mm_param.c File Reference</h1><code>#include &lt;sys/types.h&gt;</code><br>
<code>#include &lt;sys/stat.h&gt;</code><br>
<code>#include &lt;stdio.h&gt;</code><br>
<code>#include &lt;stdlib.h&gt;</code><br>
<code>#include &lt;unistd.h&gt;</code><br>
<code>#include &lt;fcntl.h&gt;</code><br>
<code>#include &lt;string.h&gt;</code><br>
<code>#include &lt;ctype.h&gt;</code><br>
<code>#include &lt;assert.h&gt;</code><br>
<code>#include &quot;<a class="el" href="mm__internal_8h-source.html">mm_internal.h</a>&quot;</code><br>
<code>#include &quot;mm_util.h&quot;</code><br>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td colspan="2"><div class="groupHeader">Functions for manipulating MIME parameters</div></td></tr>
<tr><td colspan="2"><div class="groupText">MIME parameters are properties attached to certain MIME headers, such as Content-Type and Content-Disposition. MIME parameters have a textual representations as in <em>name=value</em>. They contain important information about the MIME structure of a message, such as the boundary string used, which charset was used to encode the message and so on. This module provides simple to use functions to query or set MIME parameters.<p>
Each MIME header may hold an arbitrary amount of such parameters, which are delimeted by each other with a semicolon. <br><br></div></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">mm_param *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__param.html#gd3ac756551bf5a29a07d5992bfdbde09">mm_param_new</a> (void)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__param.html#g46339038e995799e6a3e37512f442fc9">mm_param_free</a> (struct mm_param *param)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">mm_param *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__param.html#gd3970def45b8bede334f4b89a41dec15">mm_param_generate</a> (const char *name, const char *value)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__param.html#g2a266c63c7e89cf829b2af8e995e55e8">mm_param_setname</a> (struct mm_param *param, const char *name, int copy)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__param.html#gca3e636ab5700462eb32ca5bc19e4cc6">mm_param_setvalue</a> (struct mm_param *param, const char *value, int copy)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">const char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__param.html#g0e0ddccf47a2b1e0ad5bcc52c7b39753">mm_param_getname</a> (struct mm_param *param)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">const char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__param.html#g3c6f8cddd409de3000c31584e140561e">mm_param_getvalue</a> (struct mm_param *param)</td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Functions to manipulate MIME parameters <hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:08 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,198 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: mm_parse.c File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul></div>
<h1>mm_parse.c File Reference</h1><code>#include &lt;sys/types.h&gt;</code><br>
<code>#include &lt;sys/stat.h&gt;</code><br>
<code>#include &lt;stdio.h&gt;</code><br>
<code>#include &lt;stdlib.h&gt;</code><br>
<code>#include &lt;unistd.h&gt;</code><br>
<code>#include &lt;fcntl.h&gt;</code><br>
<code>#include &lt;string.h&gt;</code><br>
<code>#include &lt;ctype.h&gt;</code><br>
<code>#include &lt;assert.h&gt;</code><br>
<code>#include &quot;<a class="el" href="mm__internal_8h-source.html">mm_internal.h</a>&quot;</code><br>
<code>#include &quot;mm_util.h&quot;</code><br>
<code>#include &quot;mimeparser.h&quot;</code><br>
<code>#include &quot;mimeparser.tab.h&quot;</code><br>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="mm__parse_8c.html#187cf71c0f6c2da1384823e3f20aa1a2">PARSER_initialize</a> (MM_CTX *, int)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="92d7d8e20b6def16fcf2649e0d88651f"></a><!-- doxytag: member="mm_parse.c::PARSER_setbuffer" ref="92d7d8e20b6def16fcf2649e0d88651f" args="(const char *)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><b>PARSER_setbuffer</b> (const char *)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="04446354e4248226578b90007d728a7b"></a><!-- doxytag: member="mm_parse.c::PARSER_setfp" ref="04446354e4248226578b90007d728a7b" args="(FILE *)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><b>PARSER_setfp</b> (FILE *)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="mm__parse_8c.html#58c960b6017f13d4e4ec5f09b3c38495">mm_parse_mem</a> (MM_CTX *ctx, const char *text, int parsemode, int flags)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="mm__parse_8c.html#cc9f623682b05f330c46e72e4e9d66cc">mm_parse_file</a> (MM_CTX *ctx, const char *filename, int parsemode, int flags)</td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Functions to parse MIME messages <hr><h2>Function Documentation</h2>
<a class="anchor" name="cc9f623682b05f330c46e72e4e9d66cc"></a><!-- doxytag: member="mm_parse.c::mm_parse_file" ref="cc9f623682b05f330c46e72e4e9d66cc" args="(MM_CTX *ctx, const char *filename, int parsemode, int flags)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_parse_file </td>
<td>(</td>
<td class="paramtype">MM_CTX *&nbsp;</td>
<td class="paramname"> <em>ctx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&nbsp;</td>
<td class="paramname"> <em>filename</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"> <em>parsemode</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"> <em>flags</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Parses a file into a MiniMIME context<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ctx</em>&nbsp;</td><td>A valid MiniMIME context object </td></tr>
<tr><td valign="top"></td><td valign="top"><em>filename</em>&nbsp;</td><td>The name of the file to parse </td></tr>
<tr><td valign="top"></td><td valign="top"><em>parsemode</em>&nbsp;</td><td>The parsemode </td></tr>
<tr><td valign="top"></td><td valign="top"><em>flags</em>&nbsp;</td><td>The flags to pass to the parser </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success or -1 on failure </dd></dl>
<dl class="note" compact><dt><b>Note:</b></dt><dd>Sets mm_errno if an error occurs</dd></dl>
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.<p>
The following modes can be used to specify how the message should be parsed:<p>
<ul>
<li>MM_PARSE_STRICT: Do not tolerate MIME violations</li><li>MM_PARSE_LOOSE: Tolerate as much MIME violations as possible</li></ul>
<p>
The context needs to be initialized before using <a class="el" href="group__context.html#g919fd41f85534d9c87c256857faa2610">mm_context_new()</a> and may be freed using <a class="el" href="group__context.html#g76392d5269e9ef340c2f5f8336f7193b">mm_context_free()</a>.
</div>
</div><p>
<a class="anchor" name="58c960b6017f13d4e4ec5f09b3c38495"></a><!-- doxytag: member="mm_parse.c::mm_parse_mem" ref="58c960b6017f13d4e4ec5f09b3c38495" args="(MM_CTX *ctx, const char *text, int parsemode, int flags)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_parse_mem </td>
<td>(</td>
<td class="paramtype">MM_CTX *&nbsp;</td>
<td class="paramname"> <em>ctx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&nbsp;</td>
<td class="paramname"> <em>text</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"> <em>parsemode</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"> <em>flags</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Parses a NUL-terminated string into a MiniMIME context<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ctx</em>&nbsp;</td><td>A valid MiniMIME context object </td></tr>
<tr><td valign="top"></td><td valign="top"><em>text</em>&nbsp;</td><td>The NUL-terminated string to parse </td></tr>
<tr><td valign="top"></td><td valign="top"><em>parsemode</em>&nbsp;</td><td>The parsemode </td></tr>
<tr><td valign="top"></td><td valign="top"><em>flags</em>&nbsp;</td><td>The flags to pass to the parser </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success or -1 on failure </dd></dl>
<dl class="note" compact><dt><b>Note:</b></dt><dd>Sets mm_errno if an error occurs</dd></dl>
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.<p>
The following modes can be used to specify how the message should be parsed:<p>
<ul>
<li>MM_PARSE_STRICT: Do not tolerate MIME violations</li><li>MM_PARSE_LOOSE: Tolerate as much MIME violations as possible</li></ul>
<p>
The context needs to be initialized before using <a class="el" href="group__context.html#g919fd41f85534d9c87c256857faa2610">mm_context_new()</a> and may be freed using <a class="el" href="group__context.html#g76392d5269e9ef340c2f5f8336f7193b">mm_context_free()</a>.
</div>
</div><p>
<a class="anchor" name="187cf71c0f6c2da1384823e3f20aa1a2"></a><!-- doxytag: member="mm_parse.c::PARSER_initialize" ref="187cf71c0f6c2da1384823e3f20aa1a2" args="(MM_CTX *, int)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void PARSER_initialize </td>
<td>(</td>
<td class="paramtype">MM_CTX *&nbsp;</td>
<td class="paramname"> <em>newctx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"> <em>mode</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Initializes the parser engine.
</div>
</div><p>
<hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:08 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,532 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: mm_queue.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul></div>
<h1>mm_queue.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $OpenBSD: queue.h,v 1.25 2004/04/08 16:08:21 henning Exp $ */</span>
<a name="l00002"></a>00002 <span class="comment">/* $NetBSD: queue.h,v 1.11 1996/05/16 05:17:14 mycroft Exp $ */</span>
<a name="l00003"></a>00003
<a name="l00004"></a>00004 <span class="comment">/*</span>
<a name="l00005"></a>00005 <span class="comment"> * Copyright (c) 1991, 1993</span>
<a name="l00006"></a>00006 <span class="comment"> * The Regents of the University of California. All rights reserved.</span>
<a name="l00007"></a>00007 <span class="comment"> *</span>
<a name="l00008"></a>00008 <span class="comment"> * Redistribution and use in source and binary forms, with or without</span>
<a name="l00009"></a>00009 <span class="comment"> * modification, are permitted provided that the following conditions</span>
<a name="l00010"></a>00010 <span class="comment"> * are met:</span>
<a name="l00011"></a>00011 <span class="comment"> * 1. Redistributions of source code must retain the above copyright</span>
<a name="l00012"></a>00012 <span class="comment"> * notice, this list of conditions and the following disclaimer.</span>
<a name="l00013"></a>00013 <span class="comment"> * 2. Redistributions in binary form must reproduce the above copyright</span>
<a name="l00014"></a>00014 <span class="comment"> * notice, this list of conditions and the following disclaimer in the</span>
<a name="l00015"></a>00015 <span class="comment"> * documentation and/or other materials provided with the distribution.</span>
<a name="l00016"></a>00016 <span class="comment"> * 3. Neither the name of the University nor the names of its contributors</span>
<a name="l00017"></a>00017 <span class="comment"> * may be used to endorse or promote products derived from this software</span>
<a name="l00018"></a>00018 <span class="comment"> * without specific prior written permission.</span>
<a name="l00019"></a>00019 <span class="comment"> *</span>
<a name="l00020"></a>00020 <span class="comment"> * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND</span>
<a name="l00021"></a>00021 <span class="comment"> * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE</span>
<a name="l00022"></a>00022 <span class="comment"> * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE</span>
<a name="l00023"></a>00023 <span class="comment"> * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE</span>
<a name="l00024"></a>00024 <span class="comment"> * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL</span>
<a name="l00025"></a>00025 <span class="comment"> * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS</span>
<a name="l00026"></a>00026 <span class="comment"> * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)</span>
<a name="l00027"></a>00027 <span class="comment"> * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT</span>
<a name="l00028"></a>00028 <span class="comment"> * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY</span>
<a name="l00029"></a>00029 <span class="comment"> * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF</span>
<a name="l00030"></a>00030 <span class="comment"> * SUCH DAMAGE.</span>
<a name="l00031"></a>00031 <span class="comment"> *</span>
<a name="l00032"></a>00032 <span class="comment"> * @(#)queue.h 8.5 (Berkeley) 8/20/94</span>
<a name="l00033"></a>00033 <span class="comment"> */</span>
<a name="l00034"></a>00034
<a name="l00035"></a>00035 <span class="preprocessor">#ifndef _SYS_QUEUE_H_</span>
<a name="l00036"></a>00036 <span class="preprocessor"></span><span class="preprocessor">#define _SYS_QUEUE_H_</span>
<a name="l00037"></a>00037 <span class="preprocessor"></span>
<a name="l00038"></a>00038 <span class="comment">/*</span>
<a name="l00039"></a>00039 <span class="comment"> * This file defines five types of data structures: singly-linked lists, </span>
<a name="l00040"></a>00040 <span class="comment"> * lists, simple queues, tail queues, and circular queues.</span>
<a name="l00041"></a>00041 <span class="comment"> *</span>
<a name="l00042"></a>00042 <span class="comment"> *</span>
<a name="l00043"></a>00043 <span class="comment"> * A singly-linked list is headed by a single forward pointer. The elements</span>
<a name="l00044"></a>00044 <span class="comment"> * are singly linked for minimum space and pointer manipulation overhead at</span>
<a name="l00045"></a>00045 <span class="comment"> * the expense of O(n) removal for arbitrary elements. New elements can be</span>
<a name="l00046"></a>00046 <span class="comment"> * added to the list after an existing element or at the head of the list.</span>
<a name="l00047"></a>00047 <span class="comment"> * Elements being removed from the head of the list should use the explicit</span>
<a name="l00048"></a>00048 <span class="comment"> * macro for this purpose for optimum efficiency. A singly-linked list may</span>
<a name="l00049"></a>00049 <span class="comment"> * only be traversed in the forward direction. Singly-linked lists are ideal</span>
<a name="l00050"></a>00050 <span class="comment"> * for applications with large datasets and few or no removals or for</span>
<a name="l00051"></a>00051 <span class="comment"> * implementing a LIFO queue.</span>
<a name="l00052"></a>00052 <span class="comment"> *</span>
<a name="l00053"></a>00053 <span class="comment"> * A list is headed by a single forward pointer (or an array of forward</span>
<a name="l00054"></a>00054 <span class="comment"> * pointers for a hash table header). The elements are doubly linked</span>
<a name="l00055"></a>00055 <span class="comment"> * so that an arbitrary element can be removed without a need to</span>
<a name="l00056"></a>00056 <span class="comment"> * traverse the list. New elements can be added to the list before</span>
<a name="l00057"></a>00057 <span class="comment"> * or after an existing element or at the head of the list. A list</span>
<a name="l00058"></a>00058 <span class="comment"> * may only be traversed in the forward direction.</span>
<a name="l00059"></a>00059 <span class="comment"> *</span>
<a name="l00060"></a>00060 <span class="comment"> * A simple queue is headed by a pair of pointers, one the head of the</span>
<a name="l00061"></a>00061 <span class="comment"> * list and the other to the tail of the list. The elements are singly</span>
<a name="l00062"></a>00062 <span class="comment"> * linked to save space, so elements can only be removed from the</span>
<a name="l00063"></a>00063 <span class="comment"> * head of the list. New elements can be added to the list before or after</span>
<a name="l00064"></a>00064 <span class="comment"> * an existing element, at the head of the list, or at the end of the</span>
<a name="l00065"></a>00065 <span class="comment"> * list. A simple queue may only be traversed in the forward direction.</span>
<a name="l00066"></a>00066 <span class="comment"> *</span>
<a name="l00067"></a>00067 <span class="comment"> * A tail queue is headed by a pair of pointers, one to the head of the</span>
<a name="l00068"></a>00068 <span class="comment"> * list and the other to the tail of the list. The elements are doubly</span>
<a name="l00069"></a>00069 <span class="comment"> * linked so that an arbitrary element can be removed without a need to</span>
<a name="l00070"></a>00070 <span class="comment"> * traverse the list. New elements can be added to the list before or</span>
<a name="l00071"></a>00071 <span class="comment"> * after an existing element, at the head of the list, or at the end of</span>
<a name="l00072"></a>00072 <span class="comment"> * the list. A tail queue may be traversed in either direction.</span>
<a name="l00073"></a>00073 <span class="comment"> *</span>
<a name="l00074"></a>00074 <span class="comment"> * A circle queue is headed by a pair of pointers, one to the head of the</span>
<a name="l00075"></a>00075 <span class="comment"> * list and the other to the tail of the list. The elements are doubly</span>
<a name="l00076"></a>00076 <span class="comment"> * linked so that an arbitrary element can be removed without a need to</span>
<a name="l00077"></a>00077 <span class="comment"> * traverse the list. New elements can be added to the list before or after</span>
<a name="l00078"></a>00078 <span class="comment"> * an existing element, at the head of the list, or at the end of the list.</span>
<a name="l00079"></a>00079 <span class="comment"> * A circle queue may be traversed in either direction, but has a more</span>
<a name="l00080"></a>00080 <span class="comment"> * complex end of list detection.</span>
<a name="l00081"></a>00081 <span class="comment"> *</span>
<a name="l00082"></a>00082 <span class="comment"> * For details on the use of these macros, see the queue(3) manual page.</span>
<a name="l00083"></a>00083 <span class="comment"> */</span>
<a name="l00084"></a>00084
<a name="l00085"></a>00085 <span class="comment">/*</span>
<a name="l00086"></a>00086 <span class="comment"> * Singly-linked List definitions.</span>
<a name="l00087"></a>00087 <span class="comment"> */</span>
<a name="l00088"></a>00088 <span class="preprocessor">#define SLIST_HEAD(name, type) \</span>
<a name="l00089"></a>00089 <span class="preprocessor">struct name { \</span>
<a name="l00090"></a>00090 <span class="preprocessor"> struct type *slh_first; </span><span class="comment">/* first element */</span> \
<a name="l00091"></a>00091 }
<a name="l00092"></a>00092
<a name="l00093"></a>00093 <span class="preprocessor">#define SLIST_HEAD_INITIALIZER(head) \</span>
<a name="l00094"></a>00094 <span class="preprocessor"> { NULL }</span>
<a name="l00095"></a>00095 <span class="preprocessor"></span>
<a name="l00096"></a>00096 <span class="preprocessor">#define SLIST_ENTRY(type) \</span>
<a name="l00097"></a>00097 <span class="preprocessor">struct { \</span>
<a name="l00098"></a>00098 <span class="preprocessor"> struct type *sle_next; </span><span class="comment">/* next element */</span> \
<a name="l00099"></a>00099 }
<a name="l00100"></a>00100
<a name="l00101"></a>00101 <span class="comment">/*</span>
<a name="l00102"></a>00102 <span class="comment"> * Singly-linked List access methods.</span>
<a name="l00103"></a>00103 <span class="comment"> */</span>
<a name="l00104"></a>00104 <span class="preprocessor">#define SLIST_FIRST(head) ((head)-&gt;slh_first)</span>
<a name="l00105"></a>00105 <span class="preprocessor"></span><span class="preprocessor">#define SLIST_END(head) NULL</span>
<a name="l00106"></a>00106 <span class="preprocessor"></span><span class="preprocessor">#define SLIST_EMPTY(head) (SLIST_FIRST(head) == SLIST_END(head))</span>
<a name="l00107"></a>00107 <span class="preprocessor"></span><span class="preprocessor">#define SLIST_NEXT(elm, field) ((elm)-&gt;field.sle_next)</span>
<a name="l00108"></a>00108 <span class="preprocessor"></span>
<a name="l00109"></a>00109 <span class="preprocessor">#define SLIST_FOREACH(var, head, field) \</span>
<a name="l00110"></a>00110 <span class="preprocessor"> for((var) = SLIST_FIRST(head); \</span>
<a name="l00111"></a>00111 <span class="preprocessor"> (var) != SLIST_END(head); \</span>
<a name="l00112"></a>00112 <span class="preprocessor"> (var) = SLIST_NEXT(var, field))</span>
<a name="l00113"></a>00113 <span class="preprocessor"></span>
<a name="l00114"></a>00114 <span class="preprocessor">#define SLIST_FOREACH_PREVPTR(var, varp, head, field) \</span>
<a name="l00115"></a>00115 <span class="preprocessor"> for ((varp) = &amp;SLIST_FIRST((head)); \</span>
<a name="l00116"></a>00116 <span class="preprocessor"> ((var) = *(varp)) != SLIST_END(head); \</span>
<a name="l00117"></a>00117 <span class="preprocessor"> (varp) = &amp;SLIST_NEXT((var), field))</span>
<a name="l00118"></a>00118 <span class="preprocessor"></span>
<a name="l00119"></a>00119 <span class="comment">/*</span>
<a name="l00120"></a>00120 <span class="comment"> * Singly-linked List functions.</span>
<a name="l00121"></a>00121 <span class="comment"> */</span>
<a name="l00122"></a>00122 <span class="preprocessor">#define SLIST_INIT(head) { \</span>
<a name="l00123"></a>00123 <span class="preprocessor"> SLIST_FIRST(head) = SLIST_END(head); \</span>
<a name="l00124"></a>00124 <span class="preprocessor">}</span>
<a name="l00125"></a>00125 <span class="preprocessor"></span>
<a name="l00126"></a>00126 <span class="preprocessor">#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \</span>
<a name="l00127"></a>00127 <span class="preprocessor"> (elm)-&gt;field.sle_next = (slistelm)-&gt;field.sle_next; \</span>
<a name="l00128"></a>00128 <span class="preprocessor"> (slistelm)-&gt;field.sle_next = (elm); \</span>
<a name="l00129"></a>00129 <span class="preprocessor">} while (0)</span>
<a name="l00130"></a>00130 <span class="preprocessor"></span>
<a name="l00131"></a>00131 <span class="preprocessor">#define SLIST_INSERT_HEAD(head, elm, field) do { \</span>
<a name="l00132"></a>00132 <span class="preprocessor"> (elm)-&gt;field.sle_next = (head)-&gt;slh_first; \</span>
<a name="l00133"></a>00133 <span class="preprocessor"> (head)-&gt;slh_first = (elm); \</span>
<a name="l00134"></a>00134 <span class="preprocessor">} while (0)</span>
<a name="l00135"></a>00135 <span class="preprocessor"></span>
<a name="l00136"></a>00136 <span class="preprocessor">#define SLIST_REMOVE_NEXT(head, elm, field) do { \</span>
<a name="l00137"></a>00137 <span class="preprocessor"> (elm)-&gt;field.sle_next = (elm)-&gt;field.sle_next-&gt;field.sle_next; \</span>
<a name="l00138"></a>00138 <span class="preprocessor">} while (0)</span>
<a name="l00139"></a>00139 <span class="preprocessor"></span>
<a name="l00140"></a>00140 <span class="preprocessor">#define SLIST_REMOVE_HEAD(head, field) do { \</span>
<a name="l00141"></a>00141 <span class="preprocessor"> (head)-&gt;slh_first = (head)-&gt;slh_first-&gt;field.sle_next; \</span>
<a name="l00142"></a>00142 <span class="preprocessor">} while (0)</span>
<a name="l00143"></a>00143 <span class="preprocessor"></span>
<a name="l00144"></a>00144 <span class="preprocessor">#define SLIST_REMOVE(head, elm, type, field) do { \</span>
<a name="l00145"></a>00145 <span class="preprocessor"> if ((head)-&gt;slh_first == (elm)) { \</span>
<a name="l00146"></a>00146 <span class="preprocessor"> SLIST_REMOVE_HEAD((head), field); \</span>
<a name="l00147"></a>00147 <span class="preprocessor"> } \</span>
<a name="l00148"></a>00148 <span class="preprocessor"> else { \</span>
<a name="l00149"></a>00149 <span class="preprocessor"> struct type *curelm = (head)-&gt;slh_first; \</span>
<a name="l00150"></a>00150 <span class="preprocessor"> while( curelm-&gt;field.sle_next != (elm) ) \</span>
<a name="l00151"></a>00151 <span class="preprocessor"> curelm = curelm-&gt;field.sle_next; \</span>
<a name="l00152"></a>00152 <span class="preprocessor"> curelm-&gt;field.sle_next = \</span>
<a name="l00153"></a>00153 <span class="preprocessor"> curelm-&gt;field.sle_next-&gt;field.sle_next; \</span>
<a name="l00154"></a>00154 <span class="preprocessor"> } \</span>
<a name="l00155"></a>00155 <span class="preprocessor">} while (0)</span>
<a name="l00156"></a>00156 <span class="preprocessor"></span>
<a name="l00157"></a>00157 <span class="comment">/*</span>
<a name="l00158"></a>00158 <span class="comment"> * List definitions.</span>
<a name="l00159"></a>00159 <span class="comment"> */</span>
<a name="l00160"></a>00160 <span class="preprocessor">#define LIST_HEAD(name, type) \</span>
<a name="l00161"></a>00161 <span class="preprocessor">struct name { \</span>
<a name="l00162"></a>00162 <span class="preprocessor"> struct type *lh_first; </span><span class="comment">/* first element */</span> \
<a name="l00163"></a>00163 }
<a name="l00164"></a>00164
<a name="l00165"></a>00165 <span class="preprocessor">#define LIST_HEAD_INITIALIZER(head) \</span>
<a name="l00166"></a>00166 <span class="preprocessor"> { NULL }</span>
<a name="l00167"></a>00167 <span class="preprocessor"></span>
<a name="l00168"></a>00168 <span class="preprocessor">#define LIST_ENTRY(type) \</span>
<a name="l00169"></a>00169 <span class="preprocessor">struct { \</span>
<a name="l00170"></a>00170 <span class="preprocessor"> struct type *le_next; </span><span class="comment">/* next element */</span> \
<a name="l00171"></a>00171 struct type **le_prev; <span class="comment">/* address of previous next element */</span> \
<a name="l00172"></a>00172 }
<a name="l00173"></a>00173
<a name="l00174"></a>00174 <span class="comment">/*</span>
<a name="l00175"></a>00175 <span class="comment"> * List access methods</span>
<a name="l00176"></a>00176 <span class="comment"> */</span>
<a name="l00177"></a>00177 <span class="preprocessor">#define LIST_FIRST(head) ((head)-&gt;lh_first)</span>
<a name="l00178"></a>00178 <span class="preprocessor"></span><span class="preprocessor">#define LIST_END(head) NULL</span>
<a name="l00179"></a>00179 <span class="preprocessor"></span><span class="preprocessor">#define LIST_EMPTY(head) (LIST_FIRST(head) == LIST_END(head))</span>
<a name="l00180"></a>00180 <span class="preprocessor"></span><span class="preprocessor">#define LIST_NEXT(elm, field) ((elm)-&gt;field.le_next)</span>
<a name="l00181"></a>00181 <span class="preprocessor"></span>
<a name="l00182"></a>00182 <span class="preprocessor">#define LIST_FOREACH(var, head, field) \</span>
<a name="l00183"></a>00183 <span class="preprocessor"> for((var) = LIST_FIRST(head); \</span>
<a name="l00184"></a>00184 <span class="preprocessor"> (var)!= LIST_END(head); \</span>
<a name="l00185"></a>00185 <span class="preprocessor"> (var) = LIST_NEXT(var, field))</span>
<a name="l00186"></a>00186 <span class="preprocessor"></span>
<a name="l00187"></a>00187 <span class="comment">/*</span>
<a name="l00188"></a>00188 <span class="comment"> * List functions.</span>
<a name="l00189"></a>00189 <span class="comment"> */</span>
<a name="l00190"></a>00190 <span class="preprocessor">#define LIST_INIT(head) do { \</span>
<a name="l00191"></a>00191 <span class="preprocessor"> LIST_FIRST(head) = LIST_END(head); \</span>
<a name="l00192"></a>00192 <span class="preprocessor">} while (0)</span>
<a name="l00193"></a>00193 <span class="preprocessor"></span>
<a name="l00194"></a>00194 <span class="preprocessor">#define LIST_INSERT_AFTER(listelm, elm, field) do { \</span>
<a name="l00195"></a>00195 <span class="preprocessor"> if (((elm)-&gt;field.le_next = (listelm)-&gt;field.le_next) != NULL) \</span>
<a name="l00196"></a>00196 <span class="preprocessor"> (listelm)-&gt;field.le_next-&gt;field.le_prev = \</span>
<a name="l00197"></a>00197 <span class="preprocessor"> &amp;(elm)-&gt;field.le_next; \</span>
<a name="l00198"></a>00198 <span class="preprocessor"> (listelm)-&gt;field.le_next = (elm); \</span>
<a name="l00199"></a>00199 <span class="preprocessor"> (elm)-&gt;field.le_prev = &amp;(listelm)-&gt;field.le_next; \</span>
<a name="l00200"></a>00200 <span class="preprocessor">} while (0)</span>
<a name="l00201"></a>00201 <span class="preprocessor"></span>
<a name="l00202"></a>00202 <span class="preprocessor">#define LIST_INSERT_BEFORE(listelm, elm, field) do { \</span>
<a name="l00203"></a>00203 <span class="preprocessor"> (elm)-&gt;field.le_prev = (listelm)-&gt;field.le_prev; \</span>
<a name="l00204"></a>00204 <span class="preprocessor"> (elm)-&gt;field.le_next = (listelm); \</span>
<a name="l00205"></a>00205 <span class="preprocessor"> *(listelm)-&gt;field.le_prev = (elm); \</span>
<a name="l00206"></a>00206 <span class="preprocessor"> (listelm)-&gt;field.le_prev = &amp;(elm)-&gt;field.le_next; \</span>
<a name="l00207"></a>00207 <span class="preprocessor">} while (0)</span>
<a name="l00208"></a>00208 <span class="preprocessor"></span>
<a name="l00209"></a>00209 <span class="preprocessor">#define LIST_INSERT_HEAD(head, elm, field) do { \</span>
<a name="l00210"></a>00210 <span class="preprocessor"> if (((elm)-&gt;field.le_next = (head)-&gt;lh_first) != NULL) \</span>
<a name="l00211"></a>00211 <span class="preprocessor"> (head)-&gt;lh_first-&gt;field.le_prev = &amp;(elm)-&gt;field.le_next;\</span>
<a name="l00212"></a>00212 <span class="preprocessor"> (head)-&gt;lh_first = (elm); \</span>
<a name="l00213"></a>00213 <span class="preprocessor"> (elm)-&gt;field.le_prev = &amp;(head)-&gt;lh_first; \</span>
<a name="l00214"></a>00214 <span class="preprocessor">} while (0)</span>
<a name="l00215"></a>00215 <span class="preprocessor"></span>
<a name="l00216"></a>00216 <span class="preprocessor">#define LIST_REMOVE(elm, field) do { \</span>
<a name="l00217"></a>00217 <span class="preprocessor"> if ((elm)-&gt;field.le_next != NULL) \</span>
<a name="l00218"></a>00218 <span class="preprocessor"> (elm)-&gt;field.le_next-&gt;field.le_prev = \</span>
<a name="l00219"></a>00219 <span class="preprocessor"> (elm)-&gt;field.le_prev; \</span>
<a name="l00220"></a>00220 <span class="preprocessor"> *(elm)-&gt;field.le_prev = (elm)-&gt;field.le_next; \</span>
<a name="l00221"></a>00221 <span class="preprocessor">} while (0)</span>
<a name="l00222"></a>00222 <span class="preprocessor"></span>
<a name="l00223"></a>00223 <span class="preprocessor">#define LIST_REPLACE(elm, elm2, field) do { \</span>
<a name="l00224"></a>00224 <span class="preprocessor"> if (((elm2)-&gt;field.le_next = (elm)-&gt;field.le_next) != NULL) \</span>
<a name="l00225"></a>00225 <span class="preprocessor"> (elm2)-&gt;field.le_next-&gt;field.le_prev = \</span>
<a name="l00226"></a>00226 <span class="preprocessor"> &amp;(elm2)-&gt;field.le_next; \</span>
<a name="l00227"></a>00227 <span class="preprocessor"> (elm2)-&gt;field.le_prev = (elm)-&gt;field.le_prev; \</span>
<a name="l00228"></a>00228 <span class="preprocessor"> *(elm2)-&gt;field.le_prev = (elm2); \</span>
<a name="l00229"></a>00229 <span class="preprocessor">} while (0)</span>
<a name="l00230"></a>00230 <span class="preprocessor"></span>
<a name="l00231"></a>00231 <span class="comment">/*</span>
<a name="l00232"></a>00232 <span class="comment"> * Simple queue definitions.</span>
<a name="l00233"></a>00233 <span class="comment"> */</span>
<a name="l00234"></a>00234 <span class="preprocessor">#define SIMPLEQ_HEAD(name, type) \</span>
<a name="l00235"></a>00235 <span class="preprocessor">struct name { \</span>
<a name="l00236"></a>00236 <span class="preprocessor"> struct type *sqh_first; </span><span class="comment">/* first element */</span> \
<a name="l00237"></a>00237 struct type **sqh_last; <span class="comment">/* addr of last next element */</span> \
<a name="l00238"></a>00238 }
<a name="l00239"></a>00239
<a name="l00240"></a>00240 <span class="preprocessor">#define SIMPLEQ_HEAD_INITIALIZER(head) \</span>
<a name="l00241"></a>00241 <span class="preprocessor"> { NULL, &amp;(head).sqh_first }</span>
<a name="l00242"></a>00242 <span class="preprocessor"></span>
<a name="l00243"></a>00243 <span class="preprocessor">#define SIMPLEQ_ENTRY(type) \</span>
<a name="l00244"></a>00244 <span class="preprocessor">struct { \</span>
<a name="l00245"></a>00245 <span class="preprocessor"> struct type *sqe_next; </span><span class="comment">/* next element */</span> \
<a name="l00246"></a>00246 }
<a name="l00247"></a>00247
<a name="l00248"></a>00248 <span class="comment">/*</span>
<a name="l00249"></a>00249 <span class="comment"> * Simple queue access methods.</span>
<a name="l00250"></a>00250 <span class="comment"> */</span>
<a name="l00251"></a>00251 <span class="preprocessor">#define SIMPLEQ_FIRST(head) ((head)-&gt;sqh_first)</span>
<a name="l00252"></a>00252 <span class="preprocessor"></span><span class="preprocessor">#define SIMPLEQ_END(head) NULL</span>
<a name="l00253"></a>00253 <span class="preprocessor"></span><span class="preprocessor">#define SIMPLEQ_EMPTY(head) (SIMPLEQ_FIRST(head) == SIMPLEQ_END(head))</span>
<a name="l00254"></a>00254 <span class="preprocessor"></span><span class="preprocessor">#define SIMPLEQ_NEXT(elm, field) ((elm)-&gt;field.sqe_next)</span>
<a name="l00255"></a>00255 <span class="preprocessor"></span>
<a name="l00256"></a>00256 <span class="preprocessor">#define SIMPLEQ_FOREACH(var, head, field) \</span>
<a name="l00257"></a>00257 <span class="preprocessor"> for((var) = SIMPLEQ_FIRST(head); \</span>
<a name="l00258"></a>00258 <span class="preprocessor"> (var) != SIMPLEQ_END(head); \</span>
<a name="l00259"></a>00259 <span class="preprocessor"> (var) = SIMPLEQ_NEXT(var, field))</span>
<a name="l00260"></a>00260 <span class="preprocessor"></span>
<a name="l00261"></a>00261 <span class="comment">/*</span>
<a name="l00262"></a>00262 <span class="comment"> * Simple queue functions.</span>
<a name="l00263"></a>00263 <span class="comment"> */</span>
<a name="l00264"></a>00264 <span class="preprocessor">#define SIMPLEQ_INIT(head) do { \</span>
<a name="l00265"></a>00265 <span class="preprocessor"> (head)-&gt;sqh_first = NULL; \</span>
<a name="l00266"></a>00266 <span class="preprocessor"> (head)-&gt;sqh_last = &amp;(head)-&gt;sqh_first; \</span>
<a name="l00267"></a>00267 <span class="preprocessor">} while (0)</span>
<a name="l00268"></a>00268 <span class="preprocessor"></span>
<a name="l00269"></a>00269 <span class="preprocessor">#define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \</span>
<a name="l00270"></a>00270 <span class="preprocessor"> if (((elm)-&gt;field.sqe_next = (head)-&gt;sqh_first) == NULL) \</span>
<a name="l00271"></a>00271 <span class="preprocessor"> (head)-&gt;sqh_last = &amp;(elm)-&gt;field.sqe_next; \</span>
<a name="l00272"></a>00272 <span class="preprocessor"> (head)-&gt;sqh_first = (elm); \</span>
<a name="l00273"></a>00273 <span class="preprocessor">} while (0)</span>
<a name="l00274"></a>00274 <span class="preprocessor"></span>
<a name="l00275"></a>00275 <span class="preprocessor">#define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \</span>
<a name="l00276"></a>00276 <span class="preprocessor"> (elm)-&gt;field.sqe_next = NULL; \</span>
<a name="l00277"></a>00277 <span class="preprocessor"> *(head)-&gt;sqh_last = (elm); \</span>
<a name="l00278"></a>00278 <span class="preprocessor"> (head)-&gt;sqh_last = &amp;(elm)-&gt;field.sqe_next; \</span>
<a name="l00279"></a>00279 <span class="preprocessor">} while (0)</span>
<a name="l00280"></a>00280 <span class="preprocessor"></span>
<a name="l00281"></a>00281 <span class="preprocessor">#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \</span>
<a name="l00282"></a>00282 <span class="preprocessor"> if (((elm)-&gt;field.sqe_next = (listelm)-&gt;field.sqe_next) == NULL)\</span>
<a name="l00283"></a>00283 <span class="preprocessor"> (head)-&gt;sqh_last = &amp;(elm)-&gt;field.sqe_next; \</span>
<a name="l00284"></a>00284 <span class="preprocessor"> (listelm)-&gt;field.sqe_next = (elm); \</span>
<a name="l00285"></a>00285 <span class="preprocessor">} while (0)</span>
<a name="l00286"></a>00286 <span class="preprocessor"></span>
<a name="l00287"></a>00287 <span class="preprocessor">#define SIMPLEQ_REMOVE_HEAD(head, elm, field) do { \</span>
<a name="l00288"></a>00288 <span class="preprocessor"> if (((head)-&gt;sqh_first = (elm)-&gt;field.sqe_next) == NULL) \</span>
<a name="l00289"></a>00289 <span class="preprocessor"> (head)-&gt;sqh_last = &amp;(head)-&gt;sqh_first; \</span>
<a name="l00290"></a>00290 <span class="preprocessor">} while (0)</span>
<a name="l00291"></a>00291 <span class="preprocessor"></span>
<a name="l00292"></a>00292 <span class="comment">/*</span>
<a name="l00293"></a>00293 <span class="comment"> * Tail queue definitions.</span>
<a name="l00294"></a>00294 <span class="comment"> */</span>
<a name="l00295"></a>00295 <span class="preprocessor">#define TAILQ_HEAD(name, type) \</span>
<a name="l00296"></a>00296 <span class="preprocessor">struct name { \</span>
<a name="l00297"></a>00297 <span class="preprocessor"> struct type *tqh_first; </span><span class="comment">/* first element */</span> \
<a name="l00298"></a>00298 struct type **tqh_last; <span class="comment">/* addr of last next element */</span> \
<a name="l00299"></a>00299 }
<a name="l00300"></a>00300
<a name="l00301"></a>00301 <span class="preprocessor">#define TAILQ_HEAD_INITIALIZER(head) \</span>
<a name="l00302"></a>00302 <span class="preprocessor"> { NULL, &amp;(head).tqh_first }</span>
<a name="l00303"></a>00303 <span class="preprocessor"></span>
<a name="l00304"></a>00304 <span class="preprocessor">#define TAILQ_ENTRY(type) \</span>
<a name="l00305"></a>00305 <span class="preprocessor">struct { \</span>
<a name="l00306"></a>00306 <span class="preprocessor"> struct type *tqe_next; </span><span class="comment">/* next element */</span> \
<a name="l00307"></a>00307 struct type **tqe_prev; <span class="comment">/* address of previous next element */</span> \
<a name="l00308"></a>00308 }
<a name="l00309"></a>00309
<a name="l00310"></a>00310 <span class="comment">/* </span>
<a name="l00311"></a>00311 <span class="comment"> * tail queue access methods </span>
<a name="l00312"></a>00312 <span class="comment"> */</span>
<a name="l00313"></a>00313 <span class="preprocessor">#define TAILQ_FIRST(head) ((head)-&gt;tqh_first)</span>
<a name="l00314"></a>00314 <span class="preprocessor"></span><span class="preprocessor">#define TAILQ_END(head) NULL</span>
<a name="l00315"></a>00315 <span class="preprocessor"></span><span class="preprocessor">#define TAILQ_NEXT(elm, field) ((elm)-&gt;field.tqe_next)</span>
<a name="l00316"></a>00316 <span class="preprocessor"></span><span class="preprocessor">#define TAILQ_LAST(head, headname) \</span>
<a name="l00317"></a>00317 <span class="preprocessor"> (*(((struct headname *)((head)-&gt;tqh_last))-&gt;tqh_last))</span>
<a name="l00318"></a>00318 <span class="preprocessor"></span><span class="comment">/* XXX */</span>
<a name="l00319"></a>00319 <span class="preprocessor">#define TAILQ_PREV(elm, headname, field) \</span>
<a name="l00320"></a>00320 <span class="preprocessor"> (*(((struct headname *)((elm)-&gt;field.tqe_prev))-&gt;tqh_last))</span>
<a name="l00321"></a>00321 <span class="preprocessor"></span><span class="preprocessor">#define TAILQ_EMPTY(head) \</span>
<a name="l00322"></a>00322 <span class="preprocessor"> (TAILQ_FIRST(head) == TAILQ_END(head))</span>
<a name="l00323"></a>00323 <span class="preprocessor"></span>
<a name="l00324"></a>00324 <span class="preprocessor">#define TAILQ_FOREACH(var, head, field) \</span>
<a name="l00325"></a>00325 <span class="preprocessor"> for((var) = TAILQ_FIRST(head); \</span>
<a name="l00326"></a>00326 <span class="preprocessor"> (var) != TAILQ_END(head); \</span>
<a name="l00327"></a>00327 <span class="preprocessor"> (var) = TAILQ_NEXT(var, field))</span>
<a name="l00328"></a>00328 <span class="preprocessor"></span>
<a name="l00329"></a>00329 <span class="preprocessor">#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \</span>
<a name="l00330"></a>00330 <span class="preprocessor"> for((var) = TAILQ_LAST(head, headname); \</span>
<a name="l00331"></a>00331 <span class="preprocessor"> (var) != TAILQ_END(head); \</span>
<a name="l00332"></a>00332 <span class="preprocessor"> (var) = TAILQ_PREV(var, headname, field))</span>
<a name="l00333"></a>00333 <span class="preprocessor"></span>
<a name="l00334"></a>00334 <span class="comment">/*</span>
<a name="l00335"></a>00335 <span class="comment"> * Tail queue functions.</span>
<a name="l00336"></a>00336 <span class="comment"> */</span>
<a name="l00337"></a>00337 <span class="preprocessor">#define TAILQ_INIT(head) do { \</span>
<a name="l00338"></a>00338 <span class="preprocessor"> (head)-&gt;tqh_first = NULL; \</span>
<a name="l00339"></a>00339 <span class="preprocessor"> (head)-&gt;tqh_last = &amp;(head)-&gt;tqh_first; \</span>
<a name="l00340"></a>00340 <span class="preprocessor">} while (0)</span>
<a name="l00341"></a>00341 <span class="preprocessor"></span>
<a name="l00342"></a>00342 <span class="preprocessor">#define TAILQ_INSERT_HEAD(head, elm, field) do { \</span>
<a name="l00343"></a>00343 <span class="preprocessor"> if (((elm)-&gt;field.tqe_next = (head)-&gt;tqh_first) != NULL) \</span>
<a name="l00344"></a>00344 <span class="preprocessor"> (head)-&gt;tqh_first-&gt;field.tqe_prev = \</span>
<a name="l00345"></a>00345 <span class="preprocessor"> &amp;(elm)-&gt;field.tqe_next; \</span>
<a name="l00346"></a>00346 <span class="preprocessor"> else \</span>
<a name="l00347"></a>00347 <span class="preprocessor"> (head)-&gt;tqh_last = &amp;(elm)-&gt;field.tqe_next; \</span>
<a name="l00348"></a>00348 <span class="preprocessor"> (head)-&gt;tqh_first = (elm); \</span>
<a name="l00349"></a>00349 <span class="preprocessor"> (elm)-&gt;field.tqe_prev = &amp;(head)-&gt;tqh_first; \</span>
<a name="l00350"></a>00350 <span class="preprocessor">} while (0)</span>
<a name="l00351"></a>00351 <span class="preprocessor"></span>
<a name="l00352"></a>00352 <span class="preprocessor">#define TAILQ_INSERT_TAIL(head, elm, field) do { \</span>
<a name="l00353"></a>00353 <span class="preprocessor"> (elm)-&gt;field.tqe_next = NULL; \</span>
<a name="l00354"></a>00354 <span class="preprocessor"> (elm)-&gt;field.tqe_prev = (head)-&gt;tqh_last; \</span>
<a name="l00355"></a>00355 <span class="preprocessor"> *(head)-&gt;tqh_last = (elm); \</span>
<a name="l00356"></a>00356 <span class="preprocessor"> (head)-&gt;tqh_last = &amp;(elm)-&gt;field.tqe_next; \</span>
<a name="l00357"></a>00357 <span class="preprocessor">} while (0)</span>
<a name="l00358"></a>00358 <span class="preprocessor"></span>
<a name="l00359"></a>00359 <span class="preprocessor">#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \</span>
<a name="l00360"></a>00360 <span class="preprocessor"> if (((elm)-&gt;field.tqe_next = (listelm)-&gt;field.tqe_next) != NULL)\</span>
<a name="l00361"></a>00361 <span class="preprocessor"> (elm)-&gt;field.tqe_next-&gt;field.tqe_prev = \</span>
<a name="l00362"></a>00362 <span class="preprocessor"> &amp;(elm)-&gt;field.tqe_next; \</span>
<a name="l00363"></a>00363 <span class="preprocessor"> else \</span>
<a name="l00364"></a>00364 <span class="preprocessor"> (head)-&gt;tqh_last = &amp;(elm)-&gt;field.tqe_next; \</span>
<a name="l00365"></a>00365 <span class="preprocessor"> (listelm)-&gt;field.tqe_next = (elm); \</span>
<a name="l00366"></a>00366 <span class="preprocessor"> (elm)-&gt;field.tqe_prev = &amp;(listelm)-&gt;field.tqe_next; \</span>
<a name="l00367"></a>00367 <span class="preprocessor">} while (0)</span>
<a name="l00368"></a>00368 <span class="preprocessor"></span>
<a name="l00369"></a>00369 <span class="preprocessor">#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \</span>
<a name="l00370"></a>00370 <span class="preprocessor"> (elm)-&gt;field.tqe_prev = (listelm)-&gt;field.tqe_prev; \</span>
<a name="l00371"></a>00371 <span class="preprocessor"> (elm)-&gt;field.tqe_next = (listelm); \</span>
<a name="l00372"></a>00372 <span class="preprocessor"> *(listelm)-&gt;field.tqe_prev = (elm); \</span>
<a name="l00373"></a>00373 <span class="preprocessor"> (listelm)-&gt;field.tqe_prev = &amp;(elm)-&gt;field.tqe_next; \</span>
<a name="l00374"></a>00374 <span class="preprocessor">} while (0)</span>
<a name="l00375"></a>00375 <span class="preprocessor"></span>
<a name="l00376"></a>00376 <span class="preprocessor">#define TAILQ_REMOVE(head, elm, field) do { \</span>
<a name="l00377"></a>00377 <span class="preprocessor"> if (((elm)-&gt;field.tqe_next) != NULL) \</span>
<a name="l00378"></a>00378 <span class="preprocessor"> (elm)-&gt;field.tqe_next-&gt;field.tqe_prev = \</span>
<a name="l00379"></a>00379 <span class="preprocessor"> (elm)-&gt;field.tqe_prev; \</span>
<a name="l00380"></a>00380 <span class="preprocessor"> else \</span>
<a name="l00381"></a>00381 <span class="preprocessor"> (head)-&gt;tqh_last = (elm)-&gt;field.tqe_prev; \</span>
<a name="l00382"></a>00382 <span class="preprocessor"> *(elm)-&gt;field.tqe_prev = (elm)-&gt;field.tqe_next; \</span>
<a name="l00383"></a>00383 <span class="preprocessor">} while (0)</span>
<a name="l00384"></a>00384 <span class="preprocessor"></span>
<a name="l00385"></a>00385 <span class="preprocessor">#define TAILQ_REPLACE(head, elm, elm2, field) do { \</span>
<a name="l00386"></a>00386 <span class="preprocessor"> if (((elm2)-&gt;field.tqe_next = (elm)-&gt;field.tqe_next) != NULL) \</span>
<a name="l00387"></a>00387 <span class="preprocessor"> (elm2)-&gt;field.tqe_next-&gt;field.tqe_prev = \</span>
<a name="l00388"></a>00388 <span class="preprocessor"> &amp;(elm2)-&gt;field.tqe_next; \</span>
<a name="l00389"></a>00389 <span class="preprocessor"> else \</span>
<a name="l00390"></a>00390 <span class="preprocessor"> (head)-&gt;tqh_last = &amp;(elm2)-&gt;field.tqe_next; \</span>
<a name="l00391"></a>00391 <span class="preprocessor"> (elm2)-&gt;field.tqe_prev = (elm)-&gt;field.tqe_prev; \</span>
<a name="l00392"></a>00392 <span class="preprocessor"> *(elm2)-&gt;field.tqe_prev = (elm2); \</span>
<a name="l00393"></a>00393 <span class="preprocessor">} while (0)</span>
<a name="l00394"></a>00394 <span class="preprocessor"></span>
<a name="l00395"></a>00395 <span class="comment">/*</span>
<a name="l00396"></a>00396 <span class="comment"> * Circular queue definitions.</span>
<a name="l00397"></a>00397 <span class="comment"> */</span>
<a name="l00398"></a>00398 <span class="preprocessor">#define CIRCLEQ_HEAD(name, type) \</span>
<a name="l00399"></a>00399 <span class="preprocessor">struct name { \</span>
<a name="l00400"></a>00400 <span class="preprocessor"> struct type *cqh_first; </span><span class="comment">/* first element */</span> \
<a name="l00401"></a>00401 struct type *cqh_last; <span class="comment">/* last element */</span> \
<a name="l00402"></a>00402 }
<a name="l00403"></a>00403
<a name="l00404"></a>00404 <span class="preprocessor">#define CIRCLEQ_HEAD_INITIALIZER(head) \</span>
<a name="l00405"></a>00405 <span class="preprocessor"> { CIRCLEQ_END(&amp;head), CIRCLEQ_END(&amp;head) }</span>
<a name="l00406"></a>00406 <span class="preprocessor"></span>
<a name="l00407"></a>00407 <span class="preprocessor">#define CIRCLEQ_ENTRY(type) \</span>
<a name="l00408"></a>00408 <span class="preprocessor">struct { \</span>
<a name="l00409"></a>00409 <span class="preprocessor"> struct type *cqe_next; </span><span class="comment">/* next element */</span> \
<a name="l00410"></a>00410 struct type *cqe_prev; <span class="comment">/* previous element */</span> \
<a name="l00411"></a>00411 }
<a name="l00412"></a>00412
<a name="l00413"></a>00413 <span class="comment">/*</span>
<a name="l00414"></a>00414 <span class="comment"> * Circular queue access methods </span>
<a name="l00415"></a>00415 <span class="comment"> */</span>
<a name="l00416"></a>00416 <span class="preprocessor">#define CIRCLEQ_FIRST(head) ((head)-&gt;cqh_first)</span>
<a name="l00417"></a>00417 <span class="preprocessor"></span><span class="preprocessor">#define CIRCLEQ_LAST(head) ((head)-&gt;cqh_last)</span>
<a name="l00418"></a>00418 <span class="preprocessor"></span><span class="preprocessor">#define CIRCLEQ_END(head) ((void *)(head))</span>
<a name="l00419"></a>00419 <span class="preprocessor"></span><span class="preprocessor">#define CIRCLEQ_NEXT(elm, field) ((elm)-&gt;field.cqe_next)</span>
<a name="l00420"></a>00420 <span class="preprocessor"></span><span class="preprocessor">#define CIRCLEQ_PREV(elm, field) ((elm)-&gt;field.cqe_prev)</span>
<a name="l00421"></a>00421 <span class="preprocessor"></span><span class="preprocessor">#define CIRCLEQ_EMPTY(head) \</span>
<a name="l00422"></a>00422 <span class="preprocessor"> (CIRCLEQ_FIRST(head) == CIRCLEQ_END(head))</span>
<a name="l00423"></a>00423 <span class="preprocessor"></span>
<a name="l00424"></a>00424 <span class="preprocessor">#define CIRCLEQ_FOREACH(var, head, field) \</span>
<a name="l00425"></a>00425 <span class="preprocessor"> for((var) = CIRCLEQ_FIRST(head); \</span>
<a name="l00426"></a>00426 <span class="preprocessor"> (var) != CIRCLEQ_END(head); \</span>
<a name="l00427"></a>00427 <span class="preprocessor"> (var) = CIRCLEQ_NEXT(var, field))</span>
<a name="l00428"></a>00428 <span class="preprocessor"></span>
<a name="l00429"></a>00429 <span class="preprocessor">#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \</span>
<a name="l00430"></a>00430 <span class="preprocessor"> for((var) = CIRCLEQ_LAST(head); \</span>
<a name="l00431"></a>00431 <span class="preprocessor"> (var) != CIRCLEQ_END(head); \</span>
<a name="l00432"></a>00432 <span class="preprocessor"> (var) = CIRCLEQ_PREV(var, field))</span>
<a name="l00433"></a>00433 <span class="preprocessor"></span>
<a name="l00434"></a>00434 <span class="comment">/*</span>
<a name="l00435"></a>00435 <span class="comment"> * Circular queue functions.</span>
<a name="l00436"></a>00436 <span class="comment"> */</span>
<a name="l00437"></a>00437 <span class="preprocessor">#define CIRCLEQ_INIT(head) do { \</span>
<a name="l00438"></a>00438 <span class="preprocessor"> (head)-&gt;cqh_first = CIRCLEQ_END(head); \</span>
<a name="l00439"></a>00439 <span class="preprocessor"> (head)-&gt;cqh_last = CIRCLEQ_END(head); \</span>
<a name="l00440"></a>00440 <span class="preprocessor">} while (0)</span>
<a name="l00441"></a>00441 <span class="preprocessor"></span>
<a name="l00442"></a>00442 <span class="preprocessor">#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \</span>
<a name="l00443"></a>00443 <span class="preprocessor"> (elm)-&gt;field.cqe_next = (listelm)-&gt;field.cqe_next; \</span>
<a name="l00444"></a>00444 <span class="preprocessor"> (elm)-&gt;field.cqe_prev = (listelm); \</span>
<a name="l00445"></a>00445 <span class="preprocessor"> if ((listelm)-&gt;field.cqe_next == CIRCLEQ_END(head)) \</span>
<a name="l00446"></a>00446 <span class="preprocessor"> (head)-&gt;cqh_last = (elm); \</span>
<a name="l00447"></a>00447 <span class="preprocessor"> else \</span>
<a name="l00448"></a>00448 <span class="preprocessor"> (listelm)-&gt;field.cqe_next-&gt;field.cqe_prev = (elm); \</span>
<a name="l00449"></a>00449 <span class="preprocessor"> (listelm)-&gt;field.cqe_next = (elm); \</span>
<a name="l00450"></a>00450 <span class="preprocessor">} while (0)</span>
<a name="l00451"></a>00451 <span class="preprocessor"></span>
<a name="l00452"></a>00452 <span class="preprocessor">#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \</span>
<a name="l00453"></a>00453 <span class="preprocessor"> (elm)-&gt;field.cqe_next = (listelm); \</span>
<a name="l00454"></a>00454 <span class="preprocessor"> (elm)-&gt;field.cqe_prev = (listelm)-&gt;field.cqe_prev; \</span>
<a name="l00455"></a>00455 <span class="preprocessor"> if ((listelm)-&gt;field.cqe_prev == CIRCLEQ_END(head)) \</span>
<a name="l00456"></a>00456 <span class="preprocessor"> (head)-&gt;cqh_first = (elm); \</span>
<a name="l00457"></a>00457 <span class="preprocessor"> else \</span>
<a name="l00458"></a>00458 <span class="preprocessor"> (listelm)-&gt;field.cqe_prev-&gt;field.cqe_next = (elm); \</span>
<a name="l00459"></a>00459 <span class="preprocessor"> (listelm)-&gt;field.cqe_prev = (elm); \</span>
<a name="l00460"></a>00460 <span class="preprocessor">} while (0)</span>
<a name="l00461"></a>00461 <span class="preprocessor"></span>
<a name="l00462"></a>00462 <span class="preprocessor">#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \</span>
<a name="l00463"></a>00463 <span class="preprocessor"> (elm)-&gt;field.cqe_next = (head)-&gt;cqh_first; \</span>
<a name="l00464"></a>00464 <span class="preprocessor"> (elm)-&gt;field.cqe_prev = CIRCLEQ_END(head); \</span>
<a name="l00465"></a>00465 <span class="preprocessor"> if ((head)-&gt;cqh_last == CIRCLEQ_END(head)) \</span>
<a name="l00466"></a>00466 <span class="preprocessor"> (head)-&gt;cqh_last = (elm); \</span>
<a name="l00467"></a>00467 <span class="preprocessor"> else \</span>
<a name="l00468"></a>00468 <span class="preprocessor"> (head)-&gt;cqh_first-&gt;field.cqe_prev = (elm); \</span>
<a name="l00469"></a>00469 <span class="preprocessor"> (head)-&gt;cqh_first = (elm); \</span>
<a name="l00470"></a>00470 <span class="preprocessor">} while (0)</span>
<a name="l00471"></a>00471 <span class="preprocessor"></span>
<a name="l00472"></a>00472 <span class="preprocessor">#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \</span>
<a name="l00473"></a>00473 <span class="preprocessor"> (elm)-&gt;field.cqe_next = CIRCLEQ_END(head); \</span>
<a name="l00474"></a>00474 <span class="preprocessor"> (elm)-&gt;field.cqe_prev = (head)-&gt;cqh_last; \</span>
<a name="l00475"></a>00475 <span class="preprocessor"> if ((head)-&gt;cqh_first == CIRCLEQ_END(head)) \</span>
<a name="l00476"></a>00476 <span class="preprocessor"> (head)-&gt;cqh_first = (elm); \</span>
<a name="l00477"></a>00477 <span class="preprocessor"> else \</span>
<a name="l00478"></a>00478 <span class="preprocessor"> (head)-&gt;cqh_last-&gt;field.cqe_next = (elm); \</span>
<a name="l00479"></a>00479 <span class="preprocessor"> (head)-&gt;cqh_last = (elm); \</span>
<a name="l00480"></a>00480 <span class="preprocessor">} while (0)</span>
<a name="l00481"></a>00481 <span class="preprocessor"></span>
<a name="l00482"></a>00482 <span class="preprocessor">#define CIRCLEQ_REMOVE(head, elm, field) do { \</span>
<a name="l00483"></a>00483 <span class="preprocessor"> if ((elm)-&gt;field.cqe_next == CIRCLEQ_END(head)) \</span>
<a name="l00484"></a>00484 <span class="preprocessor"> (head)-&gt;cqh_last = (elm)-&gt;field.cqe_prev; \</span>
<a name="l00485"></a>00485 <span class="preprocessor"> else \</span>
<a name="l00486"></a>00486 <span class="preprocessor"> (elm)-&gt;field.cqe_next-&gt;field.cqe_prev = \</span>
<a name="l00487"></a>00487 <span class="preprocessor"> (elm)-&gt;field.cqe_prev; \</span>
<a name="l00488"></a>00488 <span class="preprocessor"> if ((elm)-&gt;field.cqe_prev == CIRCLEQ_END(head)) \</span>
<a name="l00489"></a>00489 <span class="preprocessor"> (head)-&gt;cqh_first = (elm)-&gt;field.cqe_next; \</span>
<a name="l00490"></a>00490 <span class="preprocessor"> else \</span>
<a name="l00491"></a>00491 <span class="preprocessor"> (elm)-&gt;field.cqe_prev-&gt;field.cqe_next = \</span>
<a name="l00492"></a>00492 <span class="preprocessor"> (elm)-&gt;field.cqe_next; \</span>
<a name="l00493"></a>00493 <span class="preprocessor">} while (0)</span>
<a name="l00494"></a>00494 <span class="preprocessor"></span>
<a name="l00495"></a>00495 <span class="preprocessor">#define CIRCLEQ_REPLACE(head, elm, elm2, field) do { \</span>
<a name="l00496"></a>00496 <span class="preprocessor"> if (((elm2)-&gt;field.cqe_next = (elm)-&gt;field.cqe_next) == \</span>
<a name="l00497"></a>00497 <span class="preprocessor"> CIRCLEQ_END(head)) \</span>
<a name="l00498"></a>00498 <span class="preprocessor"> (head).cqh_last = (elm2); \</span>
<a name="l00499"></a>00499 <span class="preprocessor"> else \</span>
<a name="l00500"></a>00500 <span class="preprocessor"> (elm2)-&gt;field.cqe_next-&gt;field.cqe_prev = (elm2); \</span>
<a name="l00501"></a>00501 <span class="preprocessor"> if (((elm2)-&gt;field.cqe_prev = (elm)-&gt;field.cqe_prev) == \</span>
<a name="l00502"></a>00502 <span class="preprocessor"> CIRCLEQ_END(head)) \</span>
<a name="l00503"></a>00503 <span class="preprocessor"> (head).cqh_first = (elm2); \</span>
<a name="l00504"></a>00504 <span class="preprocessor"> else \</span>
<a name="l00505"></a>00505 <span class="preprocessor"> (elm2)-&gt;field.cqe_prev-&gt;field.cqe_next = (elm2); \</span>
<a name="l00506"></a>00506 <span class="preprocessor">} while (0)</span>
<a name="l00507"></a>00507 <span class="preprocessor"></span>
<a name="l00508"></a>00508 <span class="preprocessor">#endif </span><span class="comment">/* !_SYS_QUEUE_H_ */</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:08 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,58 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: mm_util.c File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul></div>
<h1>mm_util.c File Reference</h1><code>#include &lt;stdio.h&gt;</code><br>
<code>#include &lt;stdlib.h&gt;</code><br>
<code>#include &lt;string.h&gt;</code><br>
<code>#include &lt;time.h&gt;</code><br>
<code>#include &lt;assert.h&gt;</code><br>
<code>#include &quot;<a class="el" href="mm__internal_8h-source.html">mm_internal.h</a>&quot;</code><br>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__util.html#g2ff4ef58da7e543466e75f20f2a2d8b7">xmalloc</a> (size_t size)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__util.html#ge14637b4672461f1f0bee822406d68dc">xrealloc</a> (void *p, size_t size)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="700bf3013e33311eacdd1f20d13bdc9a"></a><!-- doxytag: member="mm_util.c::xstrdup" ref="700bf3013e33311eacdd1f20d13bdc9a" args="(const char *str)" -->
char *&nbsp;</td><td class="memItemRight" valign="bottom"><b>xstrdup</b> (const char *str)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="91fc771d8aa78ca2ac43244c491da52d"></a><!-- doxytag: member="mm_util.c::xfree" ref="91fc771d8aa78ca2ac43244c491da52d" args="(void *p)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><b>xfree</b> (void *p)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__util.html#gf0f89a29a634f6f1f833abb1e214a6b1">mm_unquote</a> (const char *string)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__util.html#g49c016ff4cfd02f1b019c4dce5aac357">mm_uncomment</a> (const char *string)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__util.html#g3ae25483c8a42f6562f2a916a511228f">xstrsep</a> (char **stringp, const char *delim)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__util.html#gf62be7dd21e545f8db72f3c9e3b6a3c3">mm_stripchars</a> (char *input, char *strip)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__util.html#g0747d4b4e33644263e6d73d2d8d4818b">mm_addchars</a> (char *input, char *add, u_int16_t linelength)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a965d3d1c625253beffd53051b38548e"></a><!-- doxytag: member="mm_util.c::mm_striptrailing" ref="a965d3d1c625253beffd53051b38548e" args="(char **what, const char *charset)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><b>mm_striptrailing</b> (char **what, const char *charset)</td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
This module contains utility functions for the MiniMIME library <hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:08 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,74 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: mm_util.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul></div>
<h1>mm_util.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * $Id$</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> * MiniMIME - a library for handling MIME messages</span>
<a name="l00005"></a>00005 <span class="comment"> *</span>
<a name="l00006"></a>00006 <span class="comment"> * Copyright (C) 2003 Jann Fischer &lt;rezine@mistrust.net&gt;</span>
<a name="l00007"></a>00007 <span class="comment"> * All rights reserved.</span>
<a name="l00008"></a>00008 <span class="comment"> *</span>
<a name="l00009"></a>00009 <span class="comment"> * Redistribution and use in source and binary forms, with or without</span>
<a name="l00010"></a>00010 <span class="comment"> * modification, are permitted provided that the following conditions</span>
<a name="l00011"></a>00011 <span class="comment"> * are met:</span>
<a name="l00012"></a>00012 <span class="comment"> *</span>
<a name="l00013"></a>00013 <span class="comment"> * 1. Redistributions of source code must retain the above copyright</span>
<a name="l00014"></a>00014 <span class="comment"> * notice, this list of conditions and the following disclaimer.</span>
<a name="l00015"></a>00015 <span class="comment"> * 2. Redistributions in binary form must reproduce the above copyright</span>
<a name="l00016"></a>00016 <span class="comment"> * notice, this list of conditions and the following disclaimer in the</span>
<a name="l00017"></a>00017 <span class="comment"> * documentation and/or other materials provided with the distribution.</span>
<a name="l00018"></a>00018 <span class="comment"> *</span>
<a name="l00019"></a>00019 <span class="comment"> * THIS SOFTWARE IS PROVIDED BY JANN FISCHER AND CONTRIBUTORS ``AS IS'' AND</span>
<a name="l00020"></a>00020 <span class="comment"> * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE</span>
<a name="l00021"></a>00021 <span class="comment"> * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE</span>
<a name="l00022"></a>00022 <span class="comment"> * ARE DISCLAIMED. IN NO EVENT SHALL JANN FISCHER OR THE VOICES IN HIS HEAD</span>
<a name="l00023"></a>00023 <span class="comment"> * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR</span>
<a name="l00024"></a>00024 <span class="comment"> * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF</span>
<a name="l00025"></a>00025 <span class="comment"> * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS</span>
<a name="l00026"></a>00026 <span class="comment"> * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN</span>
<a name="l00027"></a>00027 <span class="comment"> * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)</span>
<a name="l00028"></a>00028 <span class="comment"> * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF</span>
<a name="l00029"></a>00029 <span class="comment"> * THE POSSIBILITY OF SUCH DAMAGE.</span>
<a name="l00030"></a>00030 <span class="comment"> */</span>
<a name="l00031"></a>00031 <span class="preprocessor">#ifndef __MM_UTIL_H</span>
<a name="l00032"></a>00032 <span class="preprocessor"></span><span class="preprocessor">#define __MM_UTIL_H</span>
<a name="l00033"></a>00033 <span class="preprocessor"></span>
<a name="l00034"></a>00034 <span class="preprocessor">#define STRIP_TRAILING(str, charset) do { \</span>
<a name="l00035"></a>00035 <span class="preprocessor"> size_t eos, i, hit; \</span>
<a name="l00036"></a>00036 <span class="preprocessor"> for (eos = strlen(str); eos &gt; 0; eos--) { \</span>
<a name="l00037"></a>00037 <span class="preprocessor"> hit = 0; \</span>
<a name="l00038"></a>00038 <span class="preprocessor"> for (i = 0; i &lt;= strlen(charset); i++) { \</span>
<a name="l00039"></a>00039 <span class="preprocessor"> if (str[eos] == charset[i]) {\</span>
<a name="l00040"></a>00040 <span class="preprocessor"> str[eos] = '\0'; \</span>
<a name="l00041"></a>00041 <span class="preprocessor"> hit = 1; \</span>
<a name="l00042"></a>00042 <span class="preprocessor"> break; \</span>
<a name="l00043"></a>00043 <span class="preprocessor"> } \</span>
<a name="l00044"></a>00044 <span class="preprocessor"> } \</span>
<a name="l00045"></a>00045 <span class="preprocessor"> if (!hit) \</span>
<a name="l00046"></a>00046 <span class="preprocessor"> break; \</span>
<a name="l00047"></a>00047 <span class="preprocessor"> } \</span>
<a name="l00048"></a>00048 <span class="preprocessor">} while (0);</span>
<a name="l00049"></a>00049 <span class="preprocessor"></span>
<a name="l00050"></a>00050 <span class="preprocessor">#endif </span><span class="comment">/* ! __MM_UTIL_H */</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:08 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,30 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: Module Index</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li id="current"><a href="modules.html"><span>Modules</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<h1>MiniMIME Modules</h1>Here is a list of all modules:<ul>
<li><a class="el" href="group__codecs.html">Manipulating MiniMIME codecs</a>
<li><a class="el" href="group__contenttype.html">Accessing and manipulating Content-Type objects</a>
<li><a class="el" href="group__context.html">Accessing and manipulating MIME contexts</a>
<li><a class="el" href="group__envelope.html">Accessing and manipulating a message's envelope</a>
<li><a class="el" href="group__error.html">MiniMIME error functions</a>
<li><a class="el" href="group__mimepart.html">Accessing and manipulating MIME parts</a>
<li><a class="el" href="group__mimeutil.html">MIME related utility functions</a>
<li><a class="el" href="group__param.html">Accessing and manipulating MIME parameters</a>
<li><a class="el" href="group__util.html">General purpose utility functions</a>
</ul>
<hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:09 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,23 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: Page Index</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li id="current"><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<h1>MiniMIME Related Pages</h1>Here is a list of all related documentation pages:<ul>
<li><a class="el" href="bug.html">Bug List</a>
</ul>
<hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:09 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>

View File

@ -0,0 +1,102 @@
/* tabs styles, based on http://www.alistapart.com/articles/slidingdoors */
DIV.tabs
{
float : left;
width : 100%;
background : url("tab_b.gif") repeat-x bottom;
margin-bottom : 4px;
}
DIV.tabs UL
{
margin : 0px;
padding-left : 10px;
list-style : none;
}
DIV.tabs LI, DIV.tabs FORM
{
display : inline;
margin : 0px;
padding : 0px;
}
DIV.tabs FORM
{
float : right;
}
DIV.tabs A
{
float : left;
background : url("tab_r.gif") no-repeat right top;
border-bottom : 1px solid #84B0C7;
font-size : x-small;
font-weight : bold;
text-decoration : none;
}
DIV.tabs A:hover
{
background-position: 100% -150px;
}
DIV.tabs A:link, DIV.tabs A:visited,
DIV.tabs A:active, DIV.tabs A:hover
{
color: #1A419D;
}
DIV.tabs SPAN
{
float : left;
display : block;
background : url("tab_l.gif") no-repeat left top;
padding : 5px 9px;
white-space : nowrap;
}
DIV.tabs INPUT
{
float : right;
display : inline;
font-size : 1em;
}
DIV.tabs TD
{
font-size : x-small;
font-weight : bold;
text-decoration : none;
}
/* Commented Backslash Hack hides rule from IE5-Mac \*/
DIV.tabs SPAN {float : none;}
/* End IE5-Mac hack */
DIV.tabs A:hover SPAN
{
background-position: 0% -150px;
}
DIV.tabs LI#current A
{
background-position: 100% -150px;
border-width : 0px;
}
DIV.tabs LI#current SPAN
{
background-position: 0% -150px;
padding-bottom : 6px;
}
DIV.nav
{
background : none;
border : none;
border-bottom : 1px solid #84B0C7;
}

View File

@ -0,0 +1,39 @@
all: clean refman.dvi
ps: refman.ps
pdf: refman.pdf
ps_2on1: refman_2on1.ps
pdf_2on1: refman_2on1.pdf
refman.ps: refman.dvi
dvips -o refman.ps refman.dvi
refman.pdf: refman.ps
ps2pdf refman.ps refman.pdf
refman.dvi: refman.tex doxygen.sty
echo "Running latex..."
latex refman.tex
echo "Running makeindex..."
makeindex refman.idx
echo "Rerunning latex...."
latex refman.tex
latex_count=5 ; \
while egrep -s 'Rerun (LaTeX|to get cross-references right)' refman.log && [ $$latex_count -gt 0 ] ;\
do \
echo "Rerunning latex...." ;\
latex refman.tex ;\
latex_count=`expr $$latex_count - 1` ;\
done
refman_2on1.ps: refman.ps
psnup -2 refman.ps >refman_2on1.ps
refman_2on1.pdf: refman_2on1.ps
ps2pdf refman_2on1.ps refman_2on1.pdf
clean:
rm -f *.ps *.dvi *.aux *.toc *.idx *.ind *.ilg *.log *.out refman.pdf

View File

@ -0,0 +1,9 @@
\section{Bug List}\label{bug}
\label{bug__bug000001}
\begin{description}
\item[Global \doxyref{mm\_\-content\_\-setmaintype}{p.}{group__contenttype_g7bab273d117c6c0cacad20361d8fb1c8} ]The xfree() call could lead to undesirable results. Do we really need it? \end{description}
\label{bug__bug000002}
\begin{description}
\item[Global \doxyref{mm\_\-content\_\-setsubtype}{p.}{group__contenttype_g14b0738410d566ad2312405946f22212} ]The xfree() call could lead to undesirable results. Do we really need it? \end{description}

View File

@ -0,0 +1,78 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{doxygen}
\RequirePackage{calc}
\RequirePackage{array}
\pagestyle{fancyplain}
\newcommand{\clearemptydoublepage}{\newpage{\pagestyle{empty}\cleardoublepage}}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\lhead[\fancyplain{}{\bfseries\thepage}]
{\fancyplain{}{\bfseries\rightmark}}
\rhead[\fancyplain{}{\bfseries\leftmark}]
{\fancyplain{}{\bfseries\thepage}}
\rfoot[\fancyplain{}{\bfseries\scriptsize Generated on Thu Mar 29 17:59:08 2007 for Mini\-MIME by Doxygen }]{}
\lfoot[]{\fancyplain{}{\bfseries\scriptsize Generated on Thu Mar 29 17:59:08 2007 for Mini\-MIME by Doxygen }}
\cfoot{}
\newenvironment{Code}
{\footnotesize}
{\normalsize}
\newcommand{\doxyref}[3]{\textbf{#1} (\textnormal{#2}\,\pageref{#3})}
\newenvironment{DocInclude}
{\footnotesize}
{\normalsize}
\newenvironment{VerbInclude}
{\footnotesize}
{\normalsize}
\newenvironment{Image}
{\begin{figure}[H]}
{\end{figure}}
\newenvironment{ImageNoCaption}{}{}
\newenvironment{CompactList}
{\begin{list}{}{
\setlength{\leftmargin}{0.5cm}
\setlength{\itemsep}{0pt}
\setlength{\parsep}{0pt}
\setlength{\topsep}{0pt}
\renewcommand{\makelabel}{\hfill}}}
{\end{list}}
\newenvironment{CompactItemize}
{
\begin{itemize}
\setlength{\itemsep}{-3pt}
\setlength{\parsep}{0pt}
\setlength{\topsep}{0pt}
\setlength{\partopsep}{0pt}
}
{\end{itemize}}
\newcommand{\PBS}[1]{\let\temp=\\#1\let\\=\temp}
\newlength{\tmplength}
\newenvironment{TabularC}[1]
{
\setlength{\tmplength}
{\linewidth/(#1)-\tabcolsep*2-\arrayrulewidth*(#1+1)/(#1)}
\par\begin{tabular*}{\linewidth}
{*{#1}{|>{\PBS\raggedright\hspace{0pt}}p{\the\tmplength}}|}
}
{\end{tabular*}\par}
\newcommand{\entrylabel}[1]{
{\parbox[b]{\labelwidth-4pt}{\makebox[0pt][l]{\textbf{#1}}\vspace{1.5\baselineskip}}}}
\newenvironment{Desc}
{\begin{list}{}
{
\settowidth{\labelwidth}{40pt}
\setlength{\leftmargin}{\labelwidth}
\setlength{\parsep}{0pt}
\setlength{\itemsep}{-4pt}
\renewcommand{\makelabel}{\entrylabel}
}
}
{\end{list}}
\newenvironment{Indent}
{\begin{list}{}{\setlength{\leftmargin}{0.5cm}}
\item[]\ignorespaces}
{\unskip\end{list}}
\setlength{\parindent}{0cm}
\setlength{\parskip}{0.2cm}
\addtocounter{secnumdepth}{1}
\sloppy
\usepackage[T1]{fontenc}

View File

@ -0,0 +1,21 @@
\section{Mini\-MIME File List}
Here is a list of all documented files with brief descriptions:\begin{CompactList}
\item\contentsline{section}{\textbf{mimeparser.h} }{\pageref{mimeparser_8h}}{}
\item\contentsline{section}{\textbf{mimeparser.tab.h} }{\pageref{mimeparser_8tab_8h}}{}
\item\contentsline{section}{\textbf{mm.h} }{\pageref{mm_8h}}{}
\item\contentsline{section}{{\bf mm\_\-codecs.c} }{\pageref{mm__codecs_8c}}{}
\item\contentsline{section}{{\bf mm\_\-contenttype.c} }{\pageref{mm__contenttype_8c}}{}
\item\contentsline{section}{{\bf mm\_\-context.c} }{\pageref{mm__context_8c}}{}
\item\contentsline{section}{{\bf mm\_\-envelope.c} }{\pageref{mm__envelope_8c}}{}
\item\contentsline{section}{{\bf mm\_\-error.c} }{\pageref{mm__error_8c}}{}
\item\contentsline{section}{{\bf mm\_\-header.c} }{\pageref{mm__header_8c}}{}
\item\contentsline{section}{{\bf mm\_\-internal.h} }{\pageref{mm__internal_8h}}{}
\item\contentsline{section}{\textbf{mm\_\-mem.h} }{\pageref{mm__mem_8h}}{}
\item\contentsline{section}{{\bf mm\_\-mimepart.c} }{\pageref{mm__mimepart_8c}}{}
\item\contentsline{section}{{\bf mm\_\-mimeutil.c} }{\pageref{mm__mimeutil_8c}}{}
\item\contentsline{section}{{\bf mm\_\-param.c} }{\pageref{mm__param_8c}}{}
\item\contentsline{section}{{\bf mm\_\-parse.c} }{\pageref{mm__parse_8c}}{}
\item\contentsline{section}{\textbf{mm\_\-queue.h} }{\pageref{mm__queue_8h}}{}
\item\contentsline{section}{{\bf mm\_\-util.c} }{\pageref{mm__util_8c}}{}
\item\contentsline{section}{\textbf{mm\_\-util.h} }{\pageref{mm__util_8h}}{}
\end{CompactList}

View File

@ -0,0 +1,119 @@
\section{Manipulating Mini\-MIME codecs}
\label{group__codecs}\index{Manipulating MiniMIME codecs@{Manipulating MiniMIME codecs}}
\subsection*{Codec manipulation}
\begin{CompactItemize}
\item
int {\bf mm\_\-codec\_\-hasdecoder} (const char $\ast$encoding)
\item
int {\bf mm\_\-codec\_\-hasencoder} (const char $\ast$encoding)
\item
int {\bf mm\_\-codec\_\-isregistered} (const char $\ast$encoding)
\item
int {\bf mm\_\-codec\_\-register} (const char $\ast$encoding, char $\ast$($\ast$encoder)(char $\ast$data, u\_\-int32\_\-t i), char $\ast$($\ast$decoder)(char $\ast$data))
\item
int {\bf mm\_\-codec\_\-unregister} (const char $\ast$encoding)
\item
int {\bf mm\_\-codec\_\-unregisterall} (void)
\item
void {\bf mm\_\-codec\_\-registerdefaultcodecs} (void)
\end{CompactItemize}
\subsection{Function Documentation}
\index{codecs@{codecs}!mm_codec_hasdecoder@{mm\_\-codec\_\-hasdecoder}}
\index{mm_codec_hasdecoder@{mm\_\-codec\_\-hasdecoder}!codecs@{codecs}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-codec\_\-hasdecoder (const char $\ast$ {\em encoding})}\label{group__codecs_g6ccb0f7a1d7c870dc3dae04f31d6ccca}
Looks up whether a context has an decoder installed for a given encoding
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em encoding}]The encoding specifier to look up \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]1 if a decoder is installed or 0 if not \end{Desc}
\index{codecs@{codecs}!mm_codec_hasencoder@{mm\_\-codec\_\-hasencoder}}
\index{mm_codec_hasencoder@{mm\_\-codec\_\-hasencoder}!codecs@{codecs}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-codec\_\-hasencoder (const char $\ast$ {\em encoding})}\label{group__codecs_g50ff257b794ceaec7aedf9ae18bfcc57}
Looks up whether a context has an encoder installed for a given encoding
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ctx}]A valid MIME context \item[{\em encoding}]The encoding specifier to look up \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]1 if an encoder is installed or 0 if not \end{Desc}
\index{codecs@{codecs}!mm_codec_isregistered@{mm\_\-codec\_\-isregistered}}
\index{mm_codec_isregistered@{mm\_\-codec\_\-isregistered}!codecs@{codecs}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-codec\_\-isregistered (const char $\ast$ {\em encoding})}\label{group__codecs_g9e19f6343128fd7e4ec57c3d55049b55}
Looks up whether a codec for a given encoding is installed to a context
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em encoding}]The encoding specifier to look up \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]1 if a codec was found or 0 if not \end{Desc}
\index{codecs@{codecs}!mm_codec_register@{mm\_\-codec\_\-register}}
\index{mm_codec_register@{mm\_\-codec\_\-register}!codecs@{codecs}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-codec\_\-register (const char $\ast$ {\em encoding}, char $\ast$($\ast$)(char $\ast$data, u\_\-int32\_\-t i) {\em encoder}, char $\ast$($\ast$)(char $\ast$data) {\em decoder})}\label{group__codecs_gf97a7311c909888ed9f6f14d6f1bf397}
Registers a codec with the Mini\-MIME library
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em encoding}]The encoding specifier for which to register the codec \item[{\em encoder}]The encoder function for this encoding \item[{\em decoder}]The decoder function for this encoding \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]1 if successfull or 0 if not\end{Desc}
This function registers a codec for a given Mini\-MIME context. The codec may provide an decoder, an encoder or both (but not none). If there is a codec already installed for this encoding, the function will puke. \index{codecs@{codecs}!mm_codec_registerdefaultcodecs@{mm\_\-codec\_\-registerdefaultcodecs}}
\index{mm_codec_registerdefaultcodecs@{mm\_\-codec\_\-registerdefaultcodecs}!codecs@{codecs}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mm\_\-codec\_\-registerdefaultcodecs (void)}\label{group__codecs_gf39e72460fb85f5ca41f6e270a68aacc}
Registers the default codecs to a Mini\-MIME context
This functions registers the codecs for the following encodings to a Mini\-MIME context:
\begin{itemize}
\item Base64\item (TODO:) Quoted-Printable \end{itemize}
\index{codecs@{codecs}!mm_codec_unregister@{mm\_\-codec\_\-unregister}}
\index{mm_codec_unregister@{mm\_\-codec\_\-unregister}!codecs@{codecs}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-codec\_\-unregister (const char $\ast$ {\em encoding})}\label{group__codecs_g0c71696bc70f834386193e3c7a0e2ca4}
Unregisters a Mini\-MIME codec
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em encoding}]The encoding specifier which to unregister \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 if unregistered successfully, or -1 if there was no such codec \end{Desc}
\index{codecs@{codecs}!mm_codec_unregisterall@{mm\_\-codec\_\-unregisterall}}
\index{mm_codec_unregisterall@{mm\_\-codec\_\-unregisterall}!codecs@{codecs}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-codec\_\-unregisterall (void)}\label{group__codecs_g7c9e6538f84c368be2b56a3c9ba702be}
Unregisters all codecs within a context
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ctx}]A valid Mini\-MIME context \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 if all codecs were unregistered successfully or -1 if an error occured. \end{Desc}
\begin{Desc}
\item[Note:]Foobar \end{Desc}

View File

@ -0,0 +1,246 @@
\section{Accessing and manipulating Content-Type objects}
\label{group__contenttype}\index{Accessing and manipulating Content-Type objects@{Accessing and manipulating Content-Type objects}}
\subsection*{Functions for manipulating Content-Type objects}
\begin{CompactItemize}
\item
mm\_\-content $\ast$ {\bf mm\_\-content\_\-new} (void)
\item
void {\bf mm\_\-content\_\-free} (struct mm\_\-content $\ast$ct)
\item
int {\bf mm\_\-content\_\-attachparam} (struct mm\_\-content $\ast$ct, struct mm\_\-param $\ast$param)
\item
char $\ast$ {\bf mm\_\-content\_\-getparambyname} (struct mm\_\-content $\ast$ct, const char $\ast$name)
\item
mm\_\-param $\ast$ \textbf{mm\_\-content\_\-getparamobjbyname} (struct mm\_\-content $\ast$ct, const char $\ast$name)\label{group__contenttype_g1ba63e679d2b49aceb6cfec8a6752581}
\item
int {\bf mm\_\-content\_\-setmaintype} (struct mm\_\-content $\ast$ct, char $\ast$value, int copy)
\item
char $\ast$ {\bf mm\_\-content\_\-getmaintype} (struct mm\_\-content $\ast$ct)
\item
char $\ast$ {\bf mm\_\-content\_\-getsubtype} (struct mm\_\-content $\ast$ct)
\item
char $\ast$ \textbf{mm\_\-content\_\-gettype} (struct mm\_\-content $\ast$ct)\label{group__contenttype_ga6d8453eb35bd695c4944e53b7040b65}
\item
int {\bf mm\_\-content\_\-setsubtype} (struct mm\_\-content $\ast$ct, char $\ast$value, int copy)
\item
int \textbf{mm\_\-content\_\-settype} (struct mm\_\-content $\ast$ct, const char $\ast$fmt,...)\label{group__contenttype_g878686678ea2ba97aa8edb1206a564d8}
\item
int {\bf mm\_\-content\_\-iscomposite} (struct mm\_\-content $\ast$ct)
\item
int {\bf mm\_\-content\_\-isvalidencoding} (const char $\ast$encoding)
\item
int {\bf mm\_\-content\_\-setencoding} (struct mm\_\-content $\ast$ct, const char $\ast$encoding)
\item
int {\bf mm\_\-content\_\-getencoding} (struct mm\_\-content $\ast$ct, const char $\ast$encoding)
\item
char $\ast$ {\bf mm\_\-content\_\-paramstostring} (struct mm\_\-content $\ast$ct)
\item
char $\ast$ {\bf mm\_\-content\_\-tostring} (struct mm\_\-content $\ast$ct)
\end{CompactItemize}
\subsection*{Variables}
\begin{CompactItemize}
\item
int \textbf{mm\_\-encoding\_\-mappings::type}\label{group__contenttype_g6c458a8611981109bf0519b5ae21e12e}
\end{CompactItemize}
\subsection{Function Documentation}
\index{contenttype@{contenttype}!mm_content_attachparam@{mm\_\-content\_\-attachparam}}
\index{mm_content_attachparam@{mm\_\-content\_\-attachparam}!contenttype@{contenttype}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-content\_\-attachparam (struct mm\_\-content $\ast$ {\em ct}, struct mm\_\-param $\ast$ {\em param})}\label{group__contenttype_g080b7ed798ed497dcd635a6bab86962f}
Attaches a parameter to a Content-Type object
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ct}]The target Content-Type object \item[{\em param}]The Content-Type parameter which to attach \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 on success and -1 on failure \end{Desc}
\index{contenttype@{contenttype}!mm_content_free@{mm\_\-content\_\-free}}
\index{mm_content_free@{mm\_\-content\_\-free}!contenttype@{contenttype}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mm\_\-content\_\-free (struct mm\_\-content $\ast$ {\em ct})}\label{group__contenttype_g404314481125849bce869ee4b0f647af}
Releases all memory associated with an Content-Type object
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ct}]A Content-Type object \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Nothing \end{Desc}
\index{contenttype@{contenttype}!mm_content_getencoding@{mm\_\-content\_\-getencoding}}
\index{mm_content_getencoding@{mm\_\-content\_\-getencoding}!contenttype@{contenttype}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-content\_\-getencoding (struct mm\_\-content $\ast$ {\em ct}, const char $\ast$ {\em encoding})}\label{group__contenttype_gbff87e581cd04db16e91245e9e9de67d}
Gets the numerical ID of a content encoding identifier
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ct}]A valid Content Type object \item[{\em encoding}]A string representing the content encoding identifier \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The numerical ID of the content encoding \end{Desc}
\index{contenttype@{contenttype}!mm_content_getmaintype@{mm\_\-content\_\-getmaintype}}
\index{mm_content_getmaintype@{mm\_\-content\_\-getmaintype}!contenttype@{contenttype}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ mm\_\-content\_\-getmaintype (struct mm\_\-content $\ast$ {\em ct})}\label{group__contenttype_gb213081017abf6bc7e601c6bf4214924}
Retrieves the main MIME type stored in a Content-Type object
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ct}]A valid Content-Type object \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A pointer to the string representing the main type \end{Desc}
\index{contenttype@{contenttype}!mm_content_getparambyname@{mm\_\-content\_\-getparambyname}}
\index{mm_content_getparambyname@{mm\_\-content\_\-getparambyname}!contenttype@{contenttype}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ mm\_\-content\_\-getparambyname (struct mm\_\-content $\ast$ {\em ct}, const char $\ast$ {\em name})}\label{group__contenttype_g451441ee557ab5ef29477f3dc8330bf6}
Gets a parameter value from a Content-Type object.
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ct}]the Content-Type object \item[{\em name}]the name of the parameter to retrieve \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The value of the parameter on success or a NULL pointer on failure \end{Desc}
\index{contenttype@{contenttype}!mm_content_getsubtype@{mm\_\-content\_\-getsubtype}}
\index{mm_content_getsubtype@{mm\_\-content\_\-getsubtype}!contenttype@{contenttype}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ mm\_\-content\_\-getsubtype (struct mm\_\-content $\ast$ {\em ct})}\label{group__contenttype_g97f77ef40c14cd0fb397bad358ee5d49}
Retrieves the sub MIME type stored in a Content-Type object
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ct}]A valid Content-Type object \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A pointer to the string holding the current sub MIME type \end{Desc}
\index{contenttype@{contenttype}!mm_content_iscomposite@{mm\_\-content\_\-iscomposite}}
\index{mm_content_iscomposite@{mm\_\-content\_\-iscomposite}!contenttype@{contenttype}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-content\_\-iscomposite (struct mm\_\-content $\ast$ {\em ct})}\label{group__contenttype_ga7fa479f27e73dea57257421d8fc9fc5}
Checks whether the Content-Type represents a composite message or not
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ct}]A valid Content-Type object \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]1 if the Content-Type object represents a composite message or 0 if not. \end{Desc}
\index{contenttype@{contenttype}!mm_content_isvalidencoding@{mm\_\-content\_\-isvalidencoding}}
\index{mm_content_isvalidencoding@{mm\_\-content\_\-isvalidencoding}!contenttype@{contenttype}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-content\_\-isvalidencoding (const char $\ast$ {\em encoding})}\label{group__contenttype_gb724b5979182fa272fe4fd1b72b395d5}
Verifies whether a string represents a valid encoding or not.
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em encoding}]The string to verify \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]1 if the encoding string is valid or 0 if not \end{Desc}
\index{contenttype@{contenttype}!mm_content_new@{mm\_\-content\_\-new}}
\index{mm_content_new@{mm\_\-content\_\-new}!contenttype@{contenttype}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct mm\_\-content$\ast$ mm\_\-content\_\-new (void)}\label{group__contenttype_g3880ac74a20b4a9f610a4159568e1801}
Creates a new object to hold a Content-Type representation. The allocated memory must later be freed using \doxyref{mm\_\-content\_\-free()}{p.}{group__contenttype_g404314481125849bce869ee4b0f647af}
\begin{Desc}
\item[Returns:]An object representing a MIME Content-Type \end{Desc}
\begin{Desc}
\item[See also:]\doxyref{mm\_\-content\_\-free}{p.}{group__contenttype_g404314481125849bce869ee4b0f647af} \end{Desc}
\index{contenttype@{contenttype}!mm_content_paramstostring@{mm\_\-content\_\-paramstostring}}
\index{mm_content_paramstostring@{mm\_\-content\_\-paramstostring}!contenttype@{contenttype}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ mm\_\-content\_\-paramstostring (struct mm\_\-content $\ast$ {\em ct})}\label{group__contenttype_g792e7d33fbb30e0123408bcef9d3204c}
Constructs a MIME conform string of Content-Type parameters.
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ct}]A valid Content Type object \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A pointer to a string representing the Content-Type parameters in MIME terminology, or NULL if either the Content-Type object is invalid, has no parameters or no memory could be allocated.\end{Desc}
This function constructs a MIME conform string including all the parameters associated with the given Content-Type object. It should NOT be used if you need an opaque copy of the current MIME part (e.g. for PGP purposes). \index{contenttype@{contenttype}!mm_content_setencoding@{mm\_\-content\_\-setencoding}}
\index{mm_content_setencoding@{mm\_\-content\_\-setencoding}!contenttype@{contenttype}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-content\_\-setencoding (struct mm\_\-content $\ast$ {\em ct}, const char $\ast$ {\em encoding})}\label{group__contenttype_gea945e48ac5cca846715543634b9afe4}
Set the encoding of a MIME entitity according to a mapping table
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ct}]A valid content type object \item[{\em encoding}]A string representing the content encoding \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 if successfull or -1 if not (i.e. unknown content encoding) \end{Desc}
\index{contenttype@{contenttype}!mm_content_setmaintype@{mm\_\-content\_\-setmaintype}}
\index{mm_content_setmaintype@{mm\_\-content\_\-setmaintype}!contenttype@{contenttype}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-content\_\-setmaintype (struct mm\_\-content $\ast$ {\em ct}, char $\ast$ {\em value}, int {\em copy})}\label{group__contenttype_g7bab273d117c6c0cacad20361d8fb1c8}
Sets the MIME main type for a MIME Content-Type object
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ct}]The MIME Content-Type object \item[{\em value}]The value which to set the main type to \item[{\em copy}]Whether to make a copy of the value (original value must be freed afterwards to prevent memory leaks). \end{description}
\end{Desc}
\begin{Desc}
\item[{\bf Bug}]The xfree() call could lead to undesirable results. Do we really need it? \end{Desc}
\index{contenttype@{contenttype}!mm_content_setsubtype@{mm\_\-content\_\-setsubtype}}
\index{mm_content_setsubtype@{mm\_\-content\_\-setsubtype}!contenttype@{contenttype}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-content\_\-setsubtype (struct mm\_\-content $\ast$ {\em ct}, char $\ast$ {\em value}, int {\em copy})}\label{group__contenttype_g14b0738410d566ad2312405946f22212}
Sets the MIME sub type for a MIME Content-Type object
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ct}]The MIME Content-Type object \item[{\em value}]The value which to set the sub type to \item[{\em copy}]Whether to make a copy of the value (original value must be freed afterwards to prevent memory leaks). \end{description}
\end{Desc}
\begin{Desc}
\item[{\bf Bug}]The xfree() call could lead to undesirable results. Do we really need it? \end{Desc}
\index{contenttype@{contenttype}!mm_content_tostring@{mm\_\-content\_\-tostring}}
\index{mm_content_tostring@{mm\_\-content\_\-tostring}!contenttype@{contenttype}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ mm\_\-content\_\-tostring (struct mm\_\-content $\ast$ {\em ct})}\label{group__contenttype_g18a99c95e35a76f13a77a83c4231e738}
Creates a Content-Type header according to the object given
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ct}]A valid Content-Type object \end{description}
\end{Desc}

View File

@ -0,0 +1,214 @@
\section{Accessing and manipulating MIME contexts}
\label{group__context}\index{Accessing and manipulating MIME contexts@{Accessing and manipulating MIME contexts}}
\subsection*{Manipulating Mini\-MIME contexts}
\begin{CompactItemize}
\item
MM\_\-CTX $\ast$ {\bf mm\_\-context\_\-new} (void)
\item
void {\bf mm\_\-context\_\-free} (MM\_\-CTX $\ast$ctx)
\item
int {\bf mm\_\-context\_\-attachpart} (MM\_\-CTX $\ast$ctx, struct mm\_\-mimepart $\ast$part)
\item
int {\bf mm\_\-context\_\-attachpart\_\-after} (MM\_\-CTX $\ast$ctx, struct mm\_\-mimepart $\ast$part, int pos)
\item
int {\bf mm\_\-context\_\-deletepart} (MM\_\-CTX $\ast$ctx, int which, int freemem)
\item
int {\bf mm\_\-context\_\-countparts} (MM\_\-CTX $\ast$ctx)
\item
mm\_\-mimepart $\ast$ {\bf mm\_\-context\_\-getpart} (MM\_\-CTX $\ast$ctx, int which)
\item
int {\bf mm\_\-context\_\-iscomposite} (MM\_\-CTX $\ast$ctx)
\item
int {\bf mm\_\-context\_\-haswarnings} (MM\_\-CTX $\ast$ctx)
\item
int {\bf mm\_\-context\_\-generateboundary} (MM\_\-CTX $\ast$ctx)
\item
int {\bf mm\_\-context\_\-setpreamble} (MM\_\-CTX $\ast$ctx, char $\ast$preamble)
\item
char $\ast$ \textbf{mm\_\-context\_\-getpreamble} (MM\_\-CTX $\ast$ctx)\label{group__context_g1ebbdd51106ccdee77ca421f9692bde7}
\item
int {\bf mm\_\-context\_\-flatten} (MM\_\-CTX $\ast$ctx, char $\ast$$\ast$flat, size\_\-t $\ast$length, int flags)
\end{CompactItemize}
\subsection{Detailed Description}
Each message in Mini\-MIME is represented by a so called ``context''. A context holds all necessary information given about a MIME message, such as the envelope, all MIME parts etc.
\subsection{Function Documentation}
\index{context@{context}!mm_context_attachpart@{mm\_\-context\_\-attachpart}}
\index{mm_context_attachpart@{mm\_\-context\_\-attachpart}!context@{context}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-context\_\-attachpart (MM\_\-CTX $\ast$ {\em ctx}, struct mm\_\-mimepart $\ast$ {\em part})}\label{group__context_gec3ca486a61b392ff68774242086768e}
Attaches a MIME part object to a Mini\-MIME context.
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ctx}]the Mini\-MIME context \item[{\em part}]the MIME part object to attach \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 on success or -1 on failure. Sets mm\_\-errno on failure.\end{Desc}
This function attaches a MIME part to a context, appending it to the end of the message.
The MIME part should be initialized before attaching it using \doxyref{mm\_\-mimepart\_\-new()}{p.}{group__mimepart_g417e5dd361e30cddb91e1d9a5e30b223}. \index{context@{context}!mm_context_attachpart_after@{mm\_\-context\_\-attachpart\_\-after}}
\index{mm_context_attachpart_after@{mm\_\-context\_\-attachpart\_\-after}!context@{context}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-context\_\-attachpart\_\-after (MM\_\-CTX $\ast$ {\em ctx}, struct mm\_\-mimepart $\ast$ {\em part}, int {\em pos})}\label{group__context_g73a3dd187053aeabca4836dc28a6c468}
Attaches a MIME part object to a Mini\-MIME context at a given position
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ctx}]A valid Mini\-MIME context \item[{\em part}]The MIME part object to attach \item[{\em pos}]After which part to attach the object \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 on success or -1 if the given position is invalid \end{Desc}
\begin{Desc}
\item[See also:]\doxyref{mm\_\-context\_\-attachpart}{p.}{group__context_gec3ca486a61b392ff68774242086768e}\end{Desc}
This function attaches a MIME part object after a given position in the specified context. If the position is invalid (out of range), the part will not get attached to the message and the function returns -1. If the index was in range, the MIME part will get attached after the MIME part at the given position, moving any possible following MIME parts one down the hierarchy. \index{context@{context}!mm_context_countparts@{mm\_\-context\_\-countparts}}
\index{mm_context_countparts@{mm\_\-context\_\-countparts}!context@{context}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-context\_\-countparts (MM\_\-CTX $\ast$ {\em ctx})}\label{group__context_gf5bb032ad1c481d31d7b1b0710939712}
Counts the number of attached MIME part objects in a given Mini\-MIME context
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ctx}]The Mini\-MIME context \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The number of attached MIME part objects \end{Desc}
\index{context@{context}!mm_context_deletepart@{mm\_\-context\_\-deletepart}}
\index{mm_context_deletepart@{mm\_\-context\_\-deletepart}!context@{context}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-context\_\-deletepart (MM\_\-CTX $\ast$ {\em ctx}, int {\em which}, int {\em freemem})}\label{group__context_g53d20c33a401539ef1ffa45f3dddb983}
Deletes a MIME part object from a Mini\-MIME context
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ctx}]A valid Mini\-MIME context object \item[{\em which}]The number of the MIME part object to delete \item[{\em freemem}]Whether to free the memory associated with the MIME part object \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 on success or -1 on failure. Sets mm\_\-errno on failure.\end{Desc}
This function deletes a MIME part from a given context. The MIME part to delete is specified as numerical index by the parameter ``which''. If the parameter ``freemem'' is set to anything greater than 0, the memory that is associated will be free'd by using \doxyref{mm\_\-mimepart\_\-free()}{p.}{group__mimepart_gbf47790a0bb96b22bc5e236bc40cb32e}, otherwise the memory is left untouched (if you still have a pointer to the MIME part around). \index{context@{context}!mm_context_flatten@{mm\_\-context\_\-flatten}}
\index{mm_context_flatten@{mm\_\-context\_\-flatten}!context@{context}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-context\_\-flatten (MM\_\-CTX $\ast$ {\em ctx}, char $\ast$$\ast$ {\em flat}, size\_\-t $\ast$ {\em length}, int {\em flags})}\label{group__context_g5288136ab923605f6508c09359ae5772}
Creates an ASCII message of the specified context
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ctx}]A valid Mini\-MIME context object \item[{\em flat}]Where to store the message \item[{\em flags}]Flags that affect the flattening process\end{description}
\end{Desc}
This function ``flattens'' a Mini\-MIME context, that is, it creates an ASCII represantation of the message the context contains. The flags can be a bitwise combination of the following constants:
\begin{itemize}
\item MM\_\-FLATTEN\_\-OPAQUE : use opaque MIME parts when flattening\item MM\_\-FLATTEN\_\-SKIPENVELOPE : do not flatten the envelope part\end{itemize}
Great care is taken to not produce invalid MIME output. \index{context@{context}!mm_context_free@{mm\_\-context\_\-free}}
\index{mm_context_free@{mm\_\-context\_\-free}!context@{context}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mm\_\-context\_\-free (MM\_\-CTX $\ast$ {\em ctx})}\label{group__context_g76392d5269e9ef340c2f5f8336f7193b}
Releases a Mini\-MIME context object
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ctx}]A valid Mini\-MIME context \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]\doxyref{mm\_\-context\_\-new}{p.}{group__context_g919fd41f85534d9c87c256857faa2610}\end{Desc}
This function releases all memory associated with Mini\-MIME context object that was created using \doxyref{mm\_\-context\_\-new()}{p.}{group__context_g919fd41f85534d9c87c256857faa2610}. It will also release all memory used for the MIME parts attached, and their specific properties (such as Content-Type information, headers, and the body data). \index{context@{context}!mm_context_generateboundary@{mm\_\-context\_\-generateboundary}}
\index{mm_context_generateboundary@{mm\_\-context\_\-generateboundary}!context@{context}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-context\_\-generateboundary (MM\_\-CTX $\ast$ {\em ctx})}\label{group__context_g9710e485f51167099d90f0d659979068}
Generates a generic boundary string for a given context
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ctx}]A valid Mini\-MIME context \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 on success or -1 on failure\end{Desc}
This function generates a default boundary string for the given context. If there is already a boundary for the context, the memory will be free()'d. \index{context@{context}!mm_context_getpart@{mm\_\-context\_\-getpart}}
\index{mm_context_getpart@{mm\_\-context\_\-getpart}!context@{context}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct mm\_\-mimepart$\ast$ mm\_\-context\_\-getpart (MM\_\-CTX $\ast$ {\em ctx}, int {\em which})}\label{group__context_g57fea229675f3e56a77eb40bb8193ee3}
Gets a specified MIME part object from a Mime\-MIME context
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ctx}]The Mini\-MIME context \item[{\em which}]The number of the MIME part object to retrieve \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The requested MIME part object on success or a NULL pointer if there is no such part. \end{Desc}
\index{context@{context}!mm_context_haswarnings@{mm\_\-context\_\-haswarnings}}
\index{mm_context_haswarnings@{mm\_\-context\_\-haswarnings}!context@{context}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-context\_\-haswarnings (MM\_\-CTX $\ast$ {\em ctx})}\label{group__context_g8733dee7d83d3205349a7ee4ee5b2750}
Checks whether there are any warnings associated with a given context
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ctx}]A valid Mini\-MIME context \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]1 if there are warnings associated with the context, otherwise 0 \end{Desc}
\index{context@{context}!mm_context_iscomposite@{mm\_\-context\_\-iscomposite}}
\index{mm_context_iscomposite@{mm\_\-context\_\-iscomposite}!context@{context}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-context\_\-iscomposite (MM\_\-CTX $\ast$ {\em ctx})}\label{group__context_g1e73cadba4acd3ef9dd148dd0c2c3e70}
Checks whether a given context represents a composite (multipart) message
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ctx}]A valid Mini\-MIME context object \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]1 if the context is a composite message or 0 if it's flat \end{Desc}
\index{context@{context}!mm_context_new@{mm\_\-context\_\-new}}
\index{mm_context_new@{mm\_\-context\_\-new}!context@{context}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}MM\_\-CTX$\ast$ mm\_\-context\_\-new (void)}\label{group__context_g919fd41f85534d9c87c256857faa2610}
Creates a new Mini\-MIME context object.
\begin{Desc}
\item[Returns:]a new Mini\-MIME context object \end{Desc}
\begin{Desc}
\item[See also:]\doxyref{mm\_\-context\_\-free}{p.}{group__context_g76392d5269e9ef340c2f5f8336f7193b}\end{Desc}
This function creates a new Mini\-MIME context, which will hold a message. The memory needed is allocated dynamically and should later be free'd using \doxyref{mm\_\-context\_\-free()}{p.}{group__context_g76392d5269e9ef340c2f5f8336f7193b}.
Before a context can be created, the Mini\-MIME library needs to be initialized properly using mm\_\-library\_\-init(). \index{context@{context}!mm_context_setpreamble@{mm\_\-context\_\-setpreamble}}
\index{mm_context_setpreamble@{mm\_\-context\_\-setpreamble}!context@{context}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-context\_\-setpreamble (MM\_\-CTX $\ast$ {\em ctx}, char $\ast$ {\em preamble})}\label{group__context_gc0e7cc297516618d4773830a1988fc8d}
Sets a preamble for the given Mini\-MIME context
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ctx}]A valid Mini\-MIME context \item[{\em preamble}]The preamble to set \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 on success or -1 on failure\end{Desc}
This function sets the MIME preamble (the text between the end of envelope headers and the beginning of the first MIME part) for a given context object. If preamble is a NULL-pointer then the preamble will be deleted, and the currently associated memory will be free automagically.

View File

@ -0,0 +1,65 @@
\section{Accessing and manipulating a message's envelope}
\label{group__envelope}\index{Accessing and manipulating a message's envelope@{Accessing and manipulating a message's envelope}}
\subsection*{Accessing and manipulating a message's envelope}
\begin{CompactItemize}
\item
int {\bf mm\_\-envelope\_\-getheaders} (MM\_\-CTX $\ast$ctx, char $\ast$$\ast$result, size\_\-t $\ast$length)
\item
int {\bf mm\_\-envelope\_\-setheader} (MM\_\-CTX $\ast$ctx, const char $\ast$name, const char $\ast$fmt,...)
\item
int {\bf mm\_\-envelope\_\-getrecipients} (MM\_\-CTX $\ast$ctx, char $\ast$$\ast$result, size\_\-t $\ast$length)
\end{CompactItemize}
\subsection{Function Documentation}
\index{envelope@{envelope}!mm_envelope_getheaders@{mm\_\-envelope\_\-getheaders}}
\index{mm_envelope_getheaders@{mm\_\-envelope\_\-getheaders}!envelope@{envelope}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-envelope\_\-getheaders (MM\_\-CTX $\ast$ {\em ctx}, char $\ast$$\ast$ {\em result}, size\_\-t $\ast$ {\em length})}\label{group__envelope_g38f1164142cedfc3253b068a81f85563}
Gets an ASCII representation of all envelope headers
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ctx}]A valid Mini\-MIME context \item[{\em result}]Where to store the resulting ASCII headers \item[{\em length}]Where to store the length of the result \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 on success or -1 on failure. \end{Desc}
\begin{Desc}
\item[Note:]Sets mm\_\-errno on failure\end{Desc}
This is mainly a convinience function. It constructs an ASCII representation from all of the message's envelope headers and stores the result in headers. Memory is allocated dynamically, and the total length of the result is stored in length. This function takes care that the output is MIME conform, and folds long lines according to the MIME standard at position 78 of the string. It also nicely formats all MIME related header fields, such as the Content-Type header.
Since the memory needed to store the result is allocated dynamically, one should take care of freeing it again when it's not needed anymore. If an error occurs, $\ast$result will be set to NULL, $\ast$length will be set to zero and mm\_\-errno will be set to a reasonable value. \index{envelope@{envelope}!mm_envelope_getrecipients@{mm\_\-envelope\_\-getrecipients}}
\index{mm_envelope_getrecipients@{mm\_\-envelope\_\-getrecipients}!envelope@{envelope}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-envelope\_\-getrecipients (MM\_\-CTX $\ast$ {\em ctx}, char $\ast$$\ast$ {\em result}, size\_\-t $\ast$ {\em length})}\label{group__envelope_ge63da17c56867ca2406a4eaf73230baf}
Gets the list of recipients for a MIME message
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ctx}]A valid Mini\-MIME context \item[{\em result}]Where to store the result \item[{\em length}]Where to store the length of the result \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 on success or -1 on error \end{Desc}
\begin{Desc}
\item[Note:]Sets mm\_\-errno on error\end{Desc}
This functions gets the list of recipients for a given MIME message. It does so by concatenating the \char`\"{}From\char`\"{} and \char`\"{}Cc\char`\"{} header fields, and storing the results in recipients. The memory needed to store the result is allocated dynamically, and the total length of the result is stored in length.
One should take care to free() the result once it's not needed anymore. \index{envelope@{envelope}!mm_envelope_setheader@{mm\_\-envelope\_\-setheader}}
\index{mm_envelope_setheader@{mm\_\-envelope\_\-setheader}!envelope@{envelope}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-envelope\_\-setheader (MM\_\-CTX $\ast$ {\em ctx}, const char $\ast$ {\em name}, const char $\ast$ {\em fmt}, {\em ...})}\label{group__envelope_gb2c43c1645e42ae0860c902ce1dda788}
Sets a header field in the envelope
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ctx}]A valid Mini\-MIME context \item[{\em name}]The name of the header field to set \item[{\em fmt}]A format string specifying the value of the header field \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 on success or -1 on failure\end{Desc}
This function generates a new MIME header and attaches it to the first MIME part (the envelope) found in the given context. If no part is attached already, the function will return an error. The function will store a copy of ``name'' as the header's name field, and dynamically allocate the memory needed to build the format string.

View File

@ -0,0 +1,43 @@
\section{Mini\-MIME error functions}
\label{group__error}\index{MiniMIME error functions@{MiniMIME error functions}}
\subsection*{Functions}
\begin{CompactItemize}
\item
void {\bf mm\_\-error\_\-init} (void)
\item
void {\bf mm\_\-error\_\-setmsg} (const char $\ast$fmt,...)
\item
char $\ast$ {\bf mm\_\-error\_\-string} (void)
\end{CompactItemize}
\subsection{Function Documentation}
\index{error@{error}!mm_error_init@{mm\_\-error\_\-init}}
\index{mm_error_init@{mm\_\-error\_\-init}!error@{error}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mm\_\-error\_\-init (void)}\label{group__error_g69de7c9bee1d535593a55807590de543}
Initializes the global error object
This function initializes the global error object mm\_\-error. This must be done when the library is initialized, and is automatically called from mm\_\-init\_\-library(). \index{error@{error}!mm_error_setmsg@{mm\_\-error\_\-setmsg}}
\index{mm_error_setmsg@{mm\_\-error\_\-setmsg}!error@{error}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mm\_\-error\_\-setmsg (const char $\ast$ {\em fmt}, {\em ...})}\label{group__error_g92006c97728639d8f32f5bc4c6e2a47f}
Sets a descriptive error message
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em fmt}]The error message as format string\end{description}
\end{Desc}
This function is called from the various Mini\-MIME modules in case an error occured. Should never be called by the user. \index{error@{error}!mm_error_string@{mm\_\-error\_\-string}}
\index{mm_error_string@{mm\_\-error\_\-string}!error@{error}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ mm\_\-error\_\-string (void)}\label{group__error_g8654857a3ac349b87d798902912371a3}
Retrieves the current error message
\begin{Desc}
\item[Returns:]The currently set error message\end{Desc}
This function can be used to retrieve a descriptive error message for the current error, much like strerror() function of libc. When this function is called without an error being set, it returns the string \char`\"{}No error\char`\"{}. The string returned does not need to be freed, since it is not dynamically allocated by the library.

View File

@ -0,0 +1,333 @@
\section{Accessing and manipulating MIME parts}
\label{group__mimepart}\index{Accessing and manipulating MIME parts@{Accessing and manipulating MIME parts}}
\subsection*{Creating and destroying MIME parts}
\begin{CompactItemize}
\item
mm\_\-mimepart $\ast$ {\bf mm\_\-mimepart\_\-new} (void)
\item
mm\_\-mimepart $\ast$ {\bf mm\_\-mimepart\_\-fromfile} (const char $\ast$filename)
\item
void {\bf mm\_\-mimepart\_\-free} (struct mm\_\-mimepart $\ast$part)
\end{CompactItemize}
\subsection*{Accessing the MIME part's mail header}
\begin{CompactItemize}
\item
int {\bf mm\_\-mimepart\_\-attachheader} (struct mm\_\-mimepart $\ast$part, struct mm\_\-mimeheader $\ast$header)
\item
int {\bf mm\_\-mimepart\_\-countheaders} (struct mm\_\-mimepart $\ast$part)
\item
int {\bf mm\_\-mimepart\_\-countheaderbyname} (struct mm\_\-mimepart $\ast$part, const char $\ast$name)
\item
mm\_\-mimeheader $\ast$ {\bf mm\_\-mimepart\_\-getheaderbyname} (struct mm\_\-mimepart $\ast$part, const char $\ast$name, int idx)
\item
const char $\ast$ {\bf mm\_\-mimepart\_\-getheadervalue} (struct mm\_\-mimepart $\ast$part, const char $\ast$name, int idx)
\item
int {\bf mm\_\-mimepart\_\-headers\_\-start} (struct mm\_\-mimepart $\ast$part, struct mm\_\-mimeheader $\ast$$\ast$id)
\item
mm\_\-mimeheader $\ast$ {\bf mm\_\-mimepart\_\-headers\_\-next} (struct mm\_\-mimepart $\ast$part, struct mm\_\-mimeheader $\ast$$\ast$id)
\end{CompactItemize}
\subsection*{Accessing and manipulating the MIME part's body}
\begin{CompactItemize}
\item
char $\ast$ {\bf mm\_\-mimepart\_\-getbody} (struct mm\_\-mimepart $\ast$part, int opaque)
\item
void {\bf mm\_\-mimepart\_\-setbody} (struct mm\_\-mimepart $\ast$part, const char $\ast$data, int opaque)
\item
size\_\-t {\bf mm\_\-mimepart\_\-getlength} (struct mm\_\-mimepart $\ast$part)
\item
char $\ast$ {\bf mm\_\-mimepart\_\-decode} (struct mm\_\-mimepart $\ast$part)
\item
int {\bf mm\_\-mimepart\_\-flatten} (struct mm\_\-mimepart $\ast$part, char $\ast$$\ast$result, size\_\-t $\ast$length, int opaque)
\item
int {\bf mm\_\-mimepart\_\-setdefaultcontenttype} (struct mm\_\-mimepart $\ast$part, int composite)
\end{CompactItemize}
\subsection*{Accessing the MIME part's Content-Type information}
\begin{CompactItemize}
\item
void {\bf mm\_\-mimepart\_\-attachcontenttype} (struct mm\_\-mimepart $\ast$part, struct mm\_\-content $\ast$ct)
\item
mm\_\-content $\ast$ {\bf mm\_\-mimepart\_\-gettype} (struct mm\_\-mimepart $\ast$part)
\end{CompactItemize}
\subsection{Detailed Description}
MIME parts, also called entities, represent the structure of a MIME message. ``Normal'' internet messages have only a single part, and are called ``flat'' messages. Multipart messages have more then one part, and each MIME part can have it's own subset of headers.
Provided here are functions to easily access all informations from a MIME part, including their specific headers and bodies.
\subsection{Function Documentation}
\index{mimepart@{mimepart}!mm_mimepart_attachcontenttype@{mm\_\-mimepart\_\-attachcontenttype}}
\index{mm_mimepart_attachcontenttype@{mm\_\-mimepart\_\-attachcontenttype}!mimepart@{mimepart}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mm\_\-mimepart\_\-attachcontenttype (struct mm\_\-mimepart $\ast$ {\em part}, struct mm\_\-content $\ast$ {\em ct})}\label{group__mimepart_g01822bc93b4741af75b5379384354e37}
Attaches a context type object to a MIME part
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em part}]A valid MIME part object \item[{\em ct}]The content type object to attach \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Nothing\end{Desc}
This function attaches a Content-Type object to a MIME part. It does not care whether the Content-Type suites the actual content in the MIME part, so the programmer should take care of that. \index{mimepart@{mimepart}!mm_mimepart_attachheader@{mm\_\-mimepart\_\-attachheader}}
\index{mm_mimepart_attachheader@{mm\_\-mimepart\_\-attachheader}!mimepart@{mimepart}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-mimepart\_\-attachheader (struct mm\_\-mimepart $\ast$ {\em part}, struct mm\_\-mimeheader $\ast$ {\em header})}\label{group__mimepart_g46a674ff6b9873c0c45fa4eb5d94fd62}
Attaches a mm\_\-mimeheader object to a MIME part
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em part}]A valid MIME part object \item[{\em header}]A valid MIME header object \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 if successfull or -1 if the header could not be attached \end{Desc}
\index{mimepart@{mimepart}!mm_mimepart_countheaderbyname@{mm\_\-mimepart\_\-countheaderbyname}}
\index{mm_mimepart_countheaderbyname@{mm\_\-mimepart\_\-countheaderbyname}!mimepart@{mimepart}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-mimepart\_\-countheaderbyname (struct mm\_\-mimepart $\ast$ {\em part}, const char $\ast$ {\em name})}\label{group__mimepart_gf89da502ac54306994bdb452448a8026}
Retrieves the number of MIME headers with a given name in a MIME part
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em part}]A valid MIME part object \item[{\em name}]The name of the MIME header which to count for \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The number of MIME headers within the MIME part \end{Desc}
\index{mimepart@{mimepart}!mm_mimepart_countheaders@{mm\_\-mimepart\_\-countheaders}}
\index{mm_mimepart_countheaders@{mm\_\-mimepart\_\-countheaders}!mimepart@{mimepart}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-mimepart\_\-countheaders (struct mm\_\-mimepart $\ast$ {\em part})}\label{group__mimepart_g44c78abfb0535312bcb427a2cd220026}
Retrieves the number of MIME headers available in a MIME part
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em part}]A valid MIME part object \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The number of MIME headers within the MIME part \end{Desc}
\index{mimepart@{mimepart}!mm_mimepart_decode@{mm\_\-mimepart\_\-decode}}
\index{mm_mimepart_decode@{mm\_\-mimepart\_\-decode}!mimepart@{mimepart}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ mm\_\-mimepart\_\-decode (struct mm\_\-mimepart $\ast$ {\em part})}\label{group__mimepart_g4551bf4460e5d165bbcd9f32d4f625de}
Decodes a MIME part according to it's encoding using Mini\-MIME codecs
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em A}]valid MIME part object \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 if the MIME part could be successfully decoded or -1 if not \end{Desc}
\begin{Desc}
\item[Note:]Sets mm\_\-errno on error\end{Desc}
This function decodes the body of a MIME part with a registered decoder according to it's Content-Transfer-Encoding header field. \index{mimepart@{mimepart}!mm_mimepart_flatten@{mm\_\-mimepart\_\-flatten}}
\index{mm_mimepart_flatten@{mm\_\-mimepart\_\-flatten}!mimepart@{mimepart}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-mimepart\_\-flatten (struct mm\_\-mimepart $\ast$ {\em part}, char $\ast$$\ast$ {\em result}, size\_\-t $\ast$ {\em length}, int {\em opaque})}\label{group__mimepart_gf19d3ace5ae174b3eaa35f9ddbe6e216}
Creates an ASCII representation of the given MIME part
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em part}]A valid MIME part object \item[{\em result}]Where to store the result \item[{\em length}]Where to store the length of the result \item[{\em opaque}]Whether to use the opaque MIME part 0 on success or -1 on error. \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]\doxyref{mm\_\-context\_\-flatten}{p.}{group__context_g5288136ab923605f6508c09359ae5772}\end{Desc}
This function creates an ASCII representation of a given MIME part. It will dynamically allocate the memory needed and stores the result in the memory region pointed to by result. The length of the result will be stored in length. If opaque is set to 1, mm\_\-mimepart\_\-flatten will store an opaque version of the MIME part in result, which means no headers will be created or sanitized. This is particulary useful if the part is digitally signed by e.g. PGP, and the signature spans the header fields of the part in question. \index{mimepart@{mimepart}!mm_mimepart_free@{mm\_\-mimepart\_\-free}}
\index{mm_mimepart_free@{mm\_\-mimepart\_\-free}!mimepart@{mimepart}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mm\_\-mimepart\_\-free (struct mm\_\-mimepart $\ast$ {\em part})}\label{group__mimepart_gbf47790a0bb96b22bc5e236bc40cb32e}
Frees all memory allocated by a mm\_\-mimepart object.
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em part}]A pointer to an allocated mm\_\-mimepart object \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]\doxyref{mm\_\-mimepart\_\-new}{p.}{group__mimepart_g417e5dd361e30cddb91e1d9a5e30b223} \end{Desc}
\index{mimepart@{mimepart}!mm_mimepart_fromfile@{mm\_\-mimepart\_\-fromfile}}
\index{mm_mimepart_fromfile@{mm\_\-mimepart\_\-fromfile}!mimepart@{mimepart}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct mm\_\-mimepart$\ast$ mm\_\-mimepart\_\-fromfile (const char $\ast$ {\em filename})}\label{group__mimepart_ged8112012a337371ae8093adb1ab6d27}
Creates a MIME part from a file
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em filename}]The name of the file to create the MIME part from \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A pointer to a new MIME part object\end{Desc}
This function creates a new MIME part object from a file. The object should be freed using \doxyref{mm\_\-mimepart\_\-free()}{p.}{group__mimepart_gbf47790a0bb96b22bc5e236bc40cb32e} later on. This function does NOT set the Content-Type and neither does any encoding work. \index{mimepart@{mimepart}!mm_mimepart_getbody@{mm\_\-mimepart\_\-getbody}}
\index{mm_mimepart_getbody@{mm\_\-mimepart\_\-getbody}!mimepart@{mimepart}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ mm\_\-mimepart\_\-getbody (struct mm\_\-mimepart $\ast$ {\em part}, int {\em opaque})}\label{group__mimepart_g52dc9f27a2801e4f6abb1effd2ed838d}
Gets the pointer to the MIME part's body data
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em part}]A valid MIME part object \item[{\em opaque}]Whether to get the opaque part or not \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A pointer to the MIME part's body \end{Desc}
\begin{Desc}
\item[See also:]\doxyref{mm\_\-mimepart\_\-setbody}{p.}{group__mimepart_gd1def098c00edc546b03e98e9ff8b27a} \end{Desc}
\index{mimepart@{mimepart}!mm_mimepart_getheaderbyname@{mm\_\-mimepart\_\-getheaderbyname}}
\index{mm_mimepart_getheaderbyname@{mm\_\-mimepart\_\-getheaderbyname}!mimepart@{mimepart}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct mm\_\-mimeheader$\ast$ mm\_\-mimepart\_\-getheaderbyname (struct mm\_\-mimepart $\ast$ {\em part}, const char $\ast$ {\em name}, int {\em idx})}\label{group__mimepart_ga3ca298eaa82f4ef3ea731511ac84e53}
Get a MIME header object from a MIME part
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em part}]A valid MIME part object \item[{\em name}]The name of the MIME header which to retrieve \item[{\em idx}]Which header field to get (in case of multiple headers of the same name). \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A pointer to the requested MIME header on success, or NULL if there either isn't a header with the requested name or idx is out of range. \end{Desc}
\index{mimepart@{mimepart}!mm_mimepart_getheadervalue@{mm\_\-mimepart\_\-getheadervalue}}
\index{mm_mimepart_getheadervalue@{mm\_\-mimepart\_\-getheadervalue}!mimepart@{mimepart}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ mm\_\-mimepart\_\-getheadervalue (struct mm\_\-mimepart $\ast$ {\em part}, const char $\ast$ {\em name}, int {\em idx})}\label{group__mimepart_g779f11f7a6a54f83763b5ef6ff87e48f}
Gets the value of a MIME header object
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em part}]A valid MIME part object \item[{\em name}]The name of the header field to get the value from \item[{\em idx}]The index of the header field to get, in case there are multiple headers with the same name. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A pointer to the requested value on success, or NULL if there either isn't a header with the requested name or idx is out of range. \end{Desc}
\index{mimepart@{mimepart}!mm_mimepart_getlength@{mm\_\-mimepart\_\-getlength}}
\index{mm_mimepart_getlength@{mm\_\-mimepart\_\-getlength}!mimepart@{mimepart}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}size\_\-t mm\_\-mimepart\_\-getlength (struct mm\_\-mimepart $\ast$ {\em part})}\label{group__mimepart_gf8ccae1737dc4b9b91958fe448da677f}
Gets the length of a given MIME part object
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em part}]A valid MIME part object \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The size of the part's body in byte.\end{Desc}
This function returns the total length of the given MIME part's body. The length does not include the headers of the MIME parts. If the function returns 0, no body part is set currently. \index{mimepart@{mimepart}!mm_mimepart_gettype@{mm\_\-mimepart\_\-gettype}}
\index{mm_mimepart_gettype@{mm\_\-mimepart\_\-gettype}!mimepart@{mimepart}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct mm\_\-content$\ast$ mm\_\-mimepart\_\-gettype (struct mm\_\-mimepart $\ast$ {\em part})}\label{group__mimepart_g210e2ceee56f8349f6778006da87d080}
Gets the Content-Type of a given MIME part object
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em part}]A valid MIME part object \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The Content-Type object of the specified MIME part\end{Desc}
This function returns a pointer to the Content-Type object of the given MIME part. This pointer might be set to NULL, indicating that there is no Content-Type object for the given MIME part currently. \index{mimepart@{mimepart}!mm_mimepart_headers_next@{mm\_\-mimepart\_\-headers\_\-next}}
\index{mm_mimepart_headers_next@{mm\_\-mimepart\_\-headers\_\-next}!mimepart@{mimepart}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct mm\_\-mimeheader$\ast$ mm\_\-mimepart\_\-headers\_\-next (struct mm\_\-mimepart $\ast$ {\em part}, struct mm\_\-mimeheader $\ast$$\ast$ {\em id})}\label{group__mimepart_g8e9064736efdeebf4b257cc45f8a6adf}
Returns the next MIME header of a given MIME part object
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em part}]A valid MIME part object \item[{\em id}]A previously initialized MIME header object \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A pointer to the MIME header object or NULL if end of headers was reached. \end{Desc}
\begin{Desc}
\item[See also:]\doxyref{mm\_\-mimepart\_\-headers\_\-start}{p.}{group__mimepart_g4440bdcfddf88eb642b6a834a0557176} \end{Desc}
\index{mimepart@{mimepart}!mm_mimepart_headers_start@{mm\_\-mimepart\_\-headers\_\-start}}
\index{mm_mimepart_headers_start@{mm\_\-mimepart\_\-headers\_\-start}!mimepart@{mimepart}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-mimepart\_\-headers\_\-start (struct mm\_\-mimepart $\ast$ {\em part}, struct mm\_\-mimeheader $\ast$$\ast$ {\em id})}\label{group__mimepart_g4440bdcfddf88eb642b6a834a0557176}
Initializes a header loop for a given MIME part
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em part}]A valid MIME part object \item[{\em id}]The address of a MIME header object (to allow reentrance) \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 on success or -1 on failure \end{Desc}
\begin{Desc}
\item[See also:]\doxyref{mm\_\-mimepart\_\-headers\_\-next}{p.}{group__mimepart_g8e9064736efdeebf4b257cc45f8a6adf}\end{Desc}
Looping through headers can be done in the following way:
\begin{Code}\begin{verbatim} struct mm_mimeheader *header, *lheader;
mm_mimepart_headers_start(part, &lheader);
while ((header = mm_mimepart_headers_next(part, &lheader)) != NULL) {
printf("%s: %s\n", header->name, header->value);
}
\end{verbatim}\end{Code}
For convienience, the macro mm\_\-mimepart\_\-headers\_\-foreach() can be used to loop through headers in a one-shot manner. \index{mimepart@{mimepart}!mm_mimepart_new@{mm\_\-mimepart\_\-new}}
\index{mm_mimepart_new@{mm\_\-mimepart\_\-new}!mimepart@{mimepart}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct mm\_\-mimepart$\ast$ mm\_\-mimepart\_\-new (void)}\label{group__mimepart_g417e5dd361e30cddb91e1d9a5e30b223}
Allocates memory for a new mm\_\-mimepart structure and initializes it.
\begin{Desc}
\item[Returns:]A pointer to a struct of type mm\_\-mimeheader or NULL on failure \end{Desc}
\begin{Desc}
\item[See also:]\doxyref{mm\_\-mimepart\_\-free}{p.}{group__mimepart_gbf47790a0bb96b22bc5e236bc40cb32e} \end{Desc}
\begin{Desc}
\item[Note:]The memory must be freed by using \doxyref{mm\_\-mimepart\_\-free()}{p.}{group__mimepart_gbf47790a0bb96b22bc5e236bc40cb32e} later on. \end{Desc}
\index{mimepart@{mimepart}!mm_mimepart_setbody@{mm\_\-mimepart\_\-setbody}}
\index{mm_mimepart_setbody@{mm\_\-mimepart\_\-setbody}!mimepart@{mimepart}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mm\_\-mimepart\_\-setbody (struct mm\_\-mimepart $\ast$ {\em part}, const char $\ast$ {\em data}, int {\em opaque})}\label{group__mimepart_gd1def098c00edc546b03e98e9ff8b27a}
Sets the MIME part's body data
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em part}]A valid MIME part object \item[{\em data}]A pointer to the data which to set \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]\doxyref{mm\_\-mimepart\_\-getbody}{p.}{group__mimepart_g52dc9f27a2801e4f6abb1effd2ed838d}\end{Desc}
This functions sets the body data for a given MIME part. The string pointed to by data must be NUL-terminated. The data is copied into the MIME part's body, and thus, the memory pointed to by data can be freed after the operation. \index{mimepart@{mimepart}!mm_mimepart_setdefaultcontenttype@{mm\_\-mimepart\_\-setdefaultcontenttype}}
\index{mm_mimepart_setdefaultcontenttype@{mm\_\-mimepart\_\-setdefaultcontenttype}!mimepart@{mimepart}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-mimepart\_\-setdefaultcontenttype (struct mm\_\-mimepart $\ast$ {\em part}, int {\em composite})}\label{group__mimepart_g164bb39a266559574c252f11266809ff}
Sets the default Content-Type for a given MIME part
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em part}]A valid MIME part object \item[{\em part}]Whether the Content-Type should be for composite or not \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 on success or -1 on failure\end{Desc}
This function sets a default Content-Type according to RFC 2045 with a value of \char`\"{}text/plain; charset=\char`\"{}us-ascii\char`\"{}\char`\"{}. This function should only be used if the MIME part in question does not have a valid Content-Type specification.

View File

@ -0,0 +1,2 @@
\section{MIME related utility functions}
\label{group__mimeutil}\index{MIME related utility functions@{MIME related utility functions}}

View File

@ -0,0 +1,127 @@
\section{Accessing and manipulating MIME parameters}
\label{group__param}\index{Accessing and manipulating MIME parameters@{Accessing and manipulating MIME parameters}}
\subsection*{Functions for manipulating MIME parameters}
MIME parameters are properties attached to certain MIME headers, such as Content-Type and Content-Disposition. MIME parameters have a textual representations as in {\em name=value\/}. They contain important information about the MIME structure of a message, such as the boundary string used, which charset was used to encode the message and so on. This module provides simple to use functions to query or set MIME parameters.
Each MIME header may hold an arbitrary amount of such parameters, which are delimeted by each other with a semicolon. \begin{CompactItemize}
\item
mm\_\-param $\ast$ {\bf mm\_\-param\_\-new} (void)
\item
void {\bf mm\_\-param\_\-free} (struct mm\_\-param $\ast$param)
\item
mm\_\-param $\ast$ {\bf mm\_\-param\_\-generate} (const char $\ast$name, const char $\ast$value)
\item
char $\ast$ {\bf mm\_\-param\_\-setname} (struct mm\_\-param $\ast$param, const char $\ast$name, int copy)
\item
char $\ast$ {\bf mm\_\-param\_\-setvalue} (struct mm\_\-param $\ast$param, const char $\ast$value, int copy)
\item
const char $\ast$ {\bf mm\_\-param\_\-getname} (struct mm\_\-param $\ast$param)
\item
const char $\ast$ {\bf mm\_\-param\_\-getvalue} (struct mm\_\-param $\ast$param)
\end{CompactItemize}
\subsection{Function Documentation}
\index{param@{param}!mm_param_free@{mm\_\-param\_\-free}}
\index{mm_param_free@{mm\_\-param\_\-free}!param@{param}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mm\_\-param\_\-free (struct mm\_\-param $\ast$ {\em param})}\label{group__param_g46339038e995799e6a3e37512f442fc9}
Releases all memory associated with a MIME parameter object.
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em param}]A valid MIME parameter object to be freed \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Nothing \end{Desc}
\begin{Desc}
\item[See also:]\doxyref{mm\_\-param\_\-new}{p.}{group__param_gd3ac756551bf5a29a07d5992bfdbde09} \end{Desc}
\index{param@{param}!mm_param_generate@{mm\_\-param\_\-generate}}
\index{mm_param_generate@{mm\_\-param\_\-generate}!param@{param}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct mm\_\-param$\ast$ mm\_\-param\_\-generate (const char $\ast$ {\em name}, const char $\ast$ {\em value})}\label{group__param_gd3970def45b8bede334f4b89a41dec15}
Generates a new Content-Type parameter with the given name and value
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em name}]The name of the MIME parameter \item[{\em value}]The value of the MIME parameter \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A new MIME parameter object \end{Desc}
\begin{Desc}
\item[See also:]\doxyref{mm\_\-param\_\-free}{p.}{group__param_g46339038e995799e6a3e37512f442fc9}
\doxyref{mm\_\-param\_\-new}{p.}{group__param_gd3ac756551bf5a29a07d5992bfdbde09}\end{Desc}
This function generates a new MIME parameter, with the name and value given as the arguments. The needed memory for the operation is allocated dynamically. It stores a copy of name and value in the actual object, so the memory holding the arguments can safely be freed after successfull return of this function. \index{param@{param}!mm_param_getname@{mm\_\-param\_\-getname}}
\index{mm_param_getname@{mm\_\-param\_\-getname}!param@{param}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ mm\_\-param\_\-getname (struct mm\_\-param $\ast$ {\em param})}\label{group__param_g0e0ddccf47a2b1e0ad5bcc52c7b39753}
Gets the name of a MIME parameter object
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em param}]A valid MIME parameter object \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The name of the MIME parameter \end{Desc}
\index{param@{param}!mm_param_getvalue@{mm\_\-param\_\-getvalue}}
\index{mm_param_getvalue@{mm\_\-param\_\-getvalue}!param@{param}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ mm\_\-param\_\-getvalue (struct mm\_\-param $\ast$ {\em param})}\label{group__param_g3c6f8cddd409de3000c31584e140561e}
Gets the value of a MIME parameter object
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em param}]A valid MIME parameter object \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The value of the MIME parameter \end{Desc}
\index{param@{param}!mm_param_new@{mm\_\-param\_\-new}}
\index{mm_param_new@{mm\_\-param\_\-new}!param@{param}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct mm\_\-param$\ast$ mm\_\-param\_\-new (void)}\label{group__param_gd3ac756551bf5a29a07d5992bfdbde09}
Creates a new object to hold a MIME parameter.
\begin{Desc}
\item[Returns:]An object representing a MIME parameter \end{Desc}
\begin{Desc}
\item[See also:]\doxyref{mm\_\-param\_\-free}{p.}{group__param_g46339038e995799e6a3e37512f442fc9} \end{Desc}
\begin{Desc}
\item[Note:]The allocated memory must later be freed using \doxyref{mm\_\-param\_\-free()}{p.}{group__param_g46339038e995799e6a3e37512f442fc9} \end{Desc}
\index{param@{param}!mm_param_setname@{mm\_\-param\_\-setname}}
\index{mm_param_setname@{mm\_\-param\_\-setname}!param@{param}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ mm\_\-param\_\-setname (struct mm\_\-param $\ast$ {\em param}, const char $\ast$ {\em name}, int {\em copy})}\label{group__param_g2a266c63c7e89cf829b2af8e995e55e8}
Sets the name of the given MIME parameter
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em param}]A valid MIME parameter object \item[{\em name}]The new name of the parameter \item[{\em copy}]If set to $>$ 0, copy the value stored in name \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The address of the previous name for passing to free() \end{Desc}
\index{param@{param}!mm_param_setvalue@{mm\_\-param\_\-setvalue}}
\index{mm_param_setvalue@{mm\_\-param\_\-setvalue}!param@{param}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ mm\_\-param\_\-setvalue (struct mm\_\-param $\ast$ {\em param}, const char $\ast$ {\em value}, int {\em copy})}\label{group__param_gca3e636ab5700462eb32ca5bc19e4cc6}
Sets the value of the given MIME parameter
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em param}]A valid MIME parameter object \item[{\em name}]The new value for the parameter \item[{\em copy}]If set to $>$ 0, copy the value stored in value \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The address of the previous value for passing to free() \end{Desc}

View File

@ -0,0 +1,128 @@
\section{General purpose utility functions}
\label{group__util}\index{General purpose utility functions@{General purpose utility functions}}
\subsection*{Utility functions}
\begin{CompactItemize}
\item
void \textbf{xfree} (void $\ast$)\label{group__util_g35c4383ff0dee2de18985e6edfed1ae6}
\item
char $\ast$ \textbf{xstrdup} (const char $\ast$)\label{group__util_g2961ae74e91b0b28acdf9822438a581c}
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item
void $\ast$ {\bf xmalloc} (size\_\-t size)
\item
void $\ast$ {\bf xrealloc} (void $\ast$p, size\_\-t size)
\item
char $\ast$ {\bf mm\_\-unquote} (const char $\ast$string)
\item
char $\ast$ {\bf mm\_\-uncomment} (const char $\ast$string)
\item
char $\ast$ {\bf xstrsep} (char $\ast$$\ast$stringp, const char $\ast$delim)
\item
char $\ast$ {\bf mm\_\-stripchars} (char $\ast$input, char $\ast$strip)
\item
char $\ast$ {\bf mm\_\-addchars} (char $\ast$input, char $\ast$add, u\_\-int16\_\-t linelength)
\end{CompactItemize}
\subsection{Function Documentation}
\index{util@{util}!mm_addchars@{mm\_\-addchars}}
\index{mm_addchars@{mm\_\-addchars}!util@{util}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ mm\_\-addchars (char $\ast$ {\em input}, char $\ast$ {\em add}, u\_\-int16\_\-t {\em linelength})}\label{group__util_g0747d4b4e33644263e6d73d2d8d4818b}
Adds characters to a string at given positions
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em input}]The string to which to add characters \item[{\em add}]The character string to add \item[{\em linelength}]The position where to add the character \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A copy of the string with characters added\end{Desc}
This function adds the characters add at each linelength positions and returns this new string. \index{util@{util}!mm_stripchars@{mm\_\-stripchars}}
\index{mm_stripchars@{mm\_\-stripchars}!util@{util}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ mm\_\-stripchars (char $\ast$ {\em input}, char $\ast$ {\em strip})}\label{group__util_gf62be7dd21e545f8db72f3c9e3b6a3c3}
Strips a given character set from a string
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em input}]The string which to strip \item[{\em strip}]The character set to strip off \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A copy of the original string with all chars stripped \end{Desc}
\index{util@{util}!mm_uncomment@{mm\_\-uncomment}}
\index{mm_uncomment@{mm\_\-uncomment}!util@{util}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ mm\_\-uncomment (const char $\ast$ {\em string})}\label{group__util_g49c016ff4cfd02f1b019c4dce5aac357}
Removes MIME comments from a string
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em string}]The string to uncomment \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A pointer to the uncommented string or NULL on error. Sets mm\_\-errno.\end{Desc}
This function removes MIME comments from a string (included in parantheses). It returns a pointer to a newly allocated memory region in which the uncommented string is stored. The returned string needs to be freed when it's not used anymore. \index{util@{util}!mm_unquote@{mm\_\-unquote}}
\index{mm_unquote@{mm\_\-unquote}!util@{util}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ mm\_\-unquote (const char $\ast$ {\em string})}\label{group__util_gf0f89a29a634f6f1f833abb1e214a6b1}
Unquotes a string
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em string}]The quoted string to unquote \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A pointer to the unquoted string\end{Desc}
This function unquotes a string. That is, it returns a pointer to a newly allocated memory region in which the unquoted string is stored. Only leading and trailing double-qoutes are removed. The string needs to be freed when it is not needed anymore. \index{util@{util}!xmalloc@{xmalloc}}
\index{xmalloc@{xmalloc}!util@{util}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ xmalloc (size\_\-t {\em size})}\label{group__util_g2ff4ef58da7e543466e75f20f2a2d8b7}
Allocates a block of memory
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em size}]The size of the memory region to allocate \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A pointer to the allocated memory region\end{Desc}
\doxyref{xmalloc()}{p.}{group__util_g2ff4ef58da7e543466e75f20f2a2d8b7} calls abort() if either the size argument is negative or the requested memory amount could not be allocated via an assert() call. \index{util@{util}!xrealloc@{xrealloc}}
\index{xrealloc@{xrealloc}!util@{util}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ xrealloc (void $\ast$ {\em p}, size\_\-t {\em size})}\label{group__util_ge14637b4672461f1f0bee822406d68dc}
realloc() wrapper
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em p}]Pointer to a memory region which should be reallocated \item[{\em size}]The new size of the memory region \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A pointer to the reallocated memory region\end{Desc}
\doxyref{xrealloc()}{p.}{group__util_ge14637b4672461f1f0bee822406d68dc} is a wrapper around realloc() which calls abort() if either the size argument is negative or the requested memory amount could not be allocated. \index{util@{util}!xstrsep@{xstrsep}}
\index{xstrsep@{xstrsep}!util@{util}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ xstrsep (char $\ast$$\ast$ {\em stringp}, const char $\ast$ {\em delim})}\label{group__util_g3ae25483c8a42f6562f2a916a511228f}
separate strings
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em stringp}]A pointer to the string being splitted \item[{\em delim}]The delimeter string\end{description}
\end{Desc}
This function works similar to strsep(), with the difference that delim is treated as a whole.

View File

@ -0,0 +1,41 @@
\section{mm\_\-codecs.c File Reference}
\label{mm__codecs_8c}\index{mm_codecs.c@{mm\_\-codecs.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 $<$assert.h$>$}\par
{\tt \#include \char`\"{}mm\_\-internal.h\char`\"{}}\par
{\tt \#include \char`\"{}mm\_\-util.h\char`\"{}}\par
\subsection*{Functions}
\begin{Indent}{\bf Codec manipulation}\par
\begin{CompactItemize}
\item
int {\bf mm\_\-codec\_\-hasdecoder} (const char $\ast$encoding)
\item
int {\bf mm\_\-codec\_\-hasencoder} (const char $\ast$encoding)
\item
int {\bf mm\_\-codec\_\-isregistered} (const char $\ast$encoding)
\item
int {\bf mm\_\-codec\_\-register} (const char $\ast$encoding, char $\ast$($\ast$encoder)(char $\ast$data, u\_\-int32\_\-t i), char $\ast$($\ast$decoder)(char $\ast$data))
\item
int {\bf mm\_\-codec\_\-unregister} (const char $\ast$encoding)
\item
int {\bf mm\_\-codec\_\-unregisterall} (void)
\item
void {\bf mm\_\-codec\_\-registerdefaultcodecs} (void)
\end{CompactItemize}
\end{Indent}
\subsection*{Variables}
\begin{CompactItemize}
\item
mm\_\-codecs \textbf{codecs}\label{mm__codecs_8c_b669b6dc7c7d10408d8da81b3f1a30d3}
\end{CompactItemize}
\subsection{Detailed Description}
This module contains functions to manipulate Mini\-MIME codecs

View File

@ -0,0 +1,61 @@
\section{mm\_\-contenttype.c File Reference}
\label{mm__contenttype_8c}\index{mm_contenttype.c@{mm\_\-contenttype.c}}
{\tt \#include $<$stdio.h$>$}\par
{\tt \#include $<$stdlib.h$>$}\par
{\tt \#include $<$stdarg.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
\subsection*{Data Structures}
\begin{CompactItemize}
\item
struct \textbf{mm\_\-encoding\_\-mappings}
\end{CompactItemize}
\subsection*{Functions}
\begin{Indent}{\bf Functions for manipulating Content-Type objects}\par
\begin{CompactItemize}
\item
mm\_\-content $\ast$ {\bf mm\_\-content\_\-new} (void)
\item
void {\bf mm\_\-content\_\-free} (struct mm\_\-content $\ast$ct)
\item
int {\bf mm\_\-content\_\-attachparam} (struct mm\_\-content $\ast$ct, struct mm\_\-param $\ast$param)
\item
char $\ast$ {\bf mm\_\-content\_\-getparambyname} (struct mm\_\-content $\ast$ct, const char $\ast$name)
\item
mm\_\-param $\ast$ \textbf{mm\_\-content\_\-getparamobjbyname} (struct mm\_\-content $\ast$ct, const char $\ast$name)\label{group__contenttype_g1ba63e679d2b49aceb6cfec8a6752581}
\item
int {\bf mm\_\-content\_\-setmaintype} (struct mm\_\-content $\ast$ct, char $\ast$value, int copy)
\item
char $\ast$ {\bf mm\_\-content\_\-getmaintype} (struct mm\_\-content $\ast$ct)
\item
char $\ast$ {\bf mm\_\-content\_\-getsubtype} (struct mm\_\-content $\ast$ct)
\item
char $\ast$ \textbf{mm\_\-content\_\-gettype} (struct mm\_\-content $\ast$ct)\label{group__contenttype_ga6d8453eb35bd695c4944e53b7040b65}
\item
int {\bf mm\_\-content\_\-setsubtype} (struct mm\_\-content $\ast$ct, char $\ast$value, int copy)
\item
int \textbf{mm\_\-content\_\-settype} (struct mm\_\-content $\ast$ct, const char $\ast$fmt,...)\label{group__contenttype_g878686678ea2ba97aa8edb1206a564d8}
\item
int {\bf mm\_\-content\_\-iscomposite} (struct mm\_\-content $\ast$ct)
\item
int {\bf mm\_\-content\_\-isvalidencoding} (const char $\ast$encoding)
\item
int {\bf mm\_\-content\_\-setencoding} (struct mm\_\-content $\ast$ct, const char $\ast$encoding)
\item
int {\bf mm\_\-content\_\-getencoding} (struct mm\_\-content $\ast$ct, const char $\ast$encoding)
\item
char $\ast$ {\bf mm\_\-content\_\-paramstostring} (struct mm\_\-content $\ast$ct)
\item
char $\ast$ {\bf mm\_\-content\_\-tostring} (struct mm\_\-content $\ast$ct)
\end{CompactItemize}
\end{Indent}
\subsection{Detailed Description}
This module contains functions for manipulating Content-Type objects.

View File

@ -0,0 +1,44 @@
\section{mm\_\-context.c File Reference}
\label{mm__context_8c}\index{mm_context.c@{mm\_\-context.c}}
{\tt \#include $<$stdio.h$>$}\par
{\tt \#include $<$stdlib.h$>$}\par
{\tt \#include $<$stdarg.h$>$}\par
{\tt \#include $<$string.h$>$}\par
{\tt \#include $<$assert.h$>$}\par
{\tt \#include \char`\"{}mm\_\-internal.h\char`\"{}}\par
\subsection*{Functions}
\begin{Indent}{\bf Manipulating Mini\-MIME contexts}\par
\begin{CompactItemize}
\item
MM\_\-CTX $\ast$ {\bf mm\_\-context\_\-new} (void)
\item
void {\bf mm\_\-context\_\-free} (MM\_\-CTX $\ast$ctx)
\item
int {\bf mm\_\-context\_\-attachpart} (MM\_\-CTX $\ast$ctx, struct mm\_\-mimepart $\ast$part)
\item
int {\bf mm\_\-context\_\-attachpart\_\-after} (MM\_\-CTX $\ast$ctx, struct mm\_\-mimepart $\ast$part, int pos)
\item
int {\bf mm\_\-context\_\-deletepart} (MM\_\-CTX $\ast$ctx, int which, int freemem)
\item
int {\bf mm\_\-context\_\-countparts} (MM\_\-CTX $\ast$ctx)
\item
mm\_\-mimepart $\ast$ {\bf mm\_\-context\_\-getpart} (MM\_\-CTX $\ast$ctx, int which)
\item
int {\bf mm\_\-context\_\-iscomposite} (MM\_\-CTX $\ast$ctx)
\item
int {\bf mm\_\-context\_\-haswarnings} (MM\_\-CTX $\ast$ctx)
\item
int {\bf mm\_\-context\_\-generateboundary} (MM\_\-CTX $\ast$ctx)
\item
int {\bf mm\_\-context\_\-setpreamble} (MM\_\-CTX $\ast$ctx, char $\ast$preamble)
\item
char $\ast$ \textbf{mm\_\-context\_\-getpreamble} (MM\_\-CTX $\ast$ctx)\label{group__context_g1ebbdd51106ccdee77ca421f9692bde7}
\item
int {\bf mm\_\-context\_\-flatten} (MM\_\-CTX $\ast$ctx, char $\ast$$\ast$flat, size\_\-t $\ast$length, int flags)
\end{CompactItemize}
\end{Indent}
\subsection{Detailed Description}
Modules for manipulating Mini\-MIME contexts

View File

@ -0,0 +1,25 @@
\section{mm\_\-envelope.c File Reference}
\label{mm__envelope_8c}\index{mm_envelope.c@{mm\_\-envelope.c}}
{\tt \#include $<$stdio.h$>$}\par
{\tt \#include $<$stdlib.h$>$}\par
{\tt \#include $<$stdarg.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
\subsection*{Functions}
\begin{Indent}{\bf Accessing and manipulating a message's envelope}\par
\begin{CompactItemize}
\item
int {\bf mm\_\-envelope\_\-getheaders} (MM\_\-CTX $\ast$ctx, char $\ast$$\ast$result, size\_\-t $\ast$length)
\item
int {\bf mm\_\-envelope\_\-setheader} (MM\_\-CTX $\ast$ctx, const char $\ast$name, const char $\ast$fmt,...)
\item
int {\bf mm\_\-envelope\_\-getrecipients} (MM\_\-CTX $\ast$ctx, char $\ast$$\ast$result, size\_\-t $\ast$length)
\end{CompactItemize}
\end{Indent}
\subsection{Detailed Description}
This module contains functions for accessing a message's envelope. This are mainly wrapper functions for easy access.

View File

@ -0,0 +1,29 @@
\section{mm\_\-error.c File Reference}
\label{mm__error_8c}\index{mm_error.c@{mm\_\-error.c}}
{\tt \#include $<$stdio.h$>$}\par
{\tt \#include $<$stdlib.h$>$}\par
{\tt \#include $<$stdarg.h$>$}\par
{\tt \#include $<$string.h$>$}\par
{\tt \#include $<$assert.h$>$}\par
{\tt \#include $<$errno.h$>$}\par
{\tt \#include \char`\"{}mm\_\-internal.h\char`\"{}}\par
{\tt \#include \char`\"{}mm\_\-util.h\char`\"{}}\par
\subsection*{Functions}
\begin{CompactItemize}
\item
void {\bf mm\_\-error\_\-init} (void)
\item
void {\bf mm\_\-error\_\-setmsg} (const char $\ast$fmt,...)
\item
void \textbf{mm\_\-error\_\-setlineno} (int lineno)\label{mm__error_8c_190c991d7bb378b6cd6f995ffc3011f7}
\item
char $\ast$ {\bf mm\_\-error\_\-string} (void)
\item
int \textbf{mm\_\-error\_\-lineno} (void)\label{mm__error_8c_c84acacac29f1e6efd10bb3a89eab272}
\end{CompactItemize}
\subsection{Detailed Description}
This module contains functions for Mini\-MIME error information/manipulation

View File

@ -0,0 +1,63 @@
\section{mm\_\-header.c File Reference}
\label{mm__header_8c}\index{mm_header.c@{mm\_\-header.c}}
{\tt \#include $<$stdio.h$>$}\par
{\tt \#include $<$stdlib.h$>$}\par
{\tt \#include $<$stdarg.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
\subsection*{Functions}
\begin{CompactItemize}
\item
mm\_\-mimeheader $\ast$ {\bf mm\_\-mimeheader\_\-new} (void)
\item
void {\bf mm\_\-mimeheader\_\-free} (struct mm\_\-mimeheader $\ast$header)
\item
mm\_\-mimeheader $\ast$ {\bf mm\_\-mimeheader\_\-generate} (const char $\ast$name, const char $\ast$value)
\item
int \textbf{mm\_\-mimeheader\_\-uncomment} (struct mm\_\-mimeheader $\ast$header)\label{mm__header_8c_26657e44385646fde63712d7110492d7}
\item
int \textbf{mm\_\-mimeheader\_\-uncommentbyname} (struct mm\_\-mimepart $\ast$part, const char $\ast$name)\label{mm__header_8c_2081ee4c43e88d5a318a783069a5d471}
\item
int \textbf{mm\_\-mimeheader\_\-uncommentall} (struct mm\_\-mimepart $\ast$part)\label{mm__header_8c_9f9bcb0fb26461bd349c15366748ecb7}
\end{CompactItemize}
\subsection{Detailed Description}
This module contains functions for manipulating MIME headers
\subsection{Function Documentation}
\index{mm_header.c@{mm\_\-header.c}!mm_mimeheader_free@{mm\_\-mimeheader\_\-free}}
\index{mm_mimeheader_free@{mm\_\-mimeheader\_\-free}!mm_header.c@{mm\_\-header.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mm\_\-mimeheader\_\-free (struct mm\_\-mimeheader $\ast$ {\em header})}\label{mm__header_8c_61e3e62728f720ac381196ec59303064}
Frees a MIME header object
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em header}]The MIME header object which to free \end{description}
\end{Desc}
\index{mm_header.c@{mm\_\-header.c}!mm_mimeheader_generate@{mm\_\-mimeheader\_\-generate}}
\index{mm_mimeheader_generate@{mm\_\-mimeheader\_\-generate}!mm_header.c@{mm\_\-header.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct mm\_\-mimeheader$\ast$ mm\_\-mimeheader\_\-generate (const char $\ast$ {\em name}, const char $\ast$ {\em value})}\label{mm__header_8c_07a7f7dcebc91aa86f5478e1d84341a1}
Creates a new MIME header, but does no checks whatsoever (create as-is) \index{mm_header.c@{mm\_\-header.c}!mm_mimeheader_new@{mm\_\-mimeheader\_\-new}}
\index{mm_mimeheader_new@{mm\_\-mimeheader\_\-new}!mm_header.c@{mm\_\-header.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct mm\_\-mimeheader$\ast$ mm\_\-mimeheader\_\-new (void)}\label{mm__header_8c_2f2c5f2f640111caf3096ed46b5986a4}
Creates a new MIME header object
\begin{Desc}
\item[Returns:]A new and initialized MIME header object \end{Desc}
\begin{Desc}
\item[See also:]\doxyref{mm\_\-mimeheader\_\-free}{p.}{mm__header_8c_61e3e62728f720ac381196ec59303064}\end{Desc}
This function creates and initializes a new MIME header object, which must later be freed using \doxyref{mm\_\-mimeheader\_\-free()}{p.}{mm__header_8c_61e3e62728f720ac381196ec59303064}

View File

@ -0,0 +1,45 @@
\section{mm\_\-internal.h File Reference}
\label{mm__internal_8h}\index{mm_internal.h@{mm\_\-internal.h}}
{\tt \#include \char`\"{}mm.h\char`\"{}}\par
\subsection*{Defines}
\begin{CompactItemize}
\item
\#define \textbf{debugp}(m,...)
\end{CompactItemize}
\subsection*{Functions}
\begin{Indent}{\bf Utility functions}\par
\begin{CompactItemize}
\item
void $\ast$ {\bf xmalloc} (size\_\-t)
\item
void $\ast$ {\bf xrealloc} (void $\ast$, size\_\-t)
\item
void \textbf{xfree} (void $\ast$)\label{group__util_g35c4383ff0dee2de18985e6edfed1ae6}
\item
char $\ast$ \textbf{xstrdup} (const char $\ast$)\label{group__util_g2961ae74e91b0b28acdf9822438a581c}
\item
char $\ast$ {\bf xstrsep} (char $\ast$$\ast$, const char $\ast$)
\end{CompactItemize}
\end{Indent}
\subsection{Detailed Description}
Data definitions for Mini\-MIME
\subsection{Define Documentation}
\index{mm_internal.h@{mm\_\-internal.h}!debugp@{debugp}}
\index{debugp@{debugp}!mm_internal.h@{mm\_\-internal.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define debugp(m, {\em ...})}\label{mm__internal_8h_089dd7bda22f552c35ebdc06a8849c56}
\textbf{Value:}
\begin{Code}\begin{verbatim}do { \
fprintf(stderr, "%s:%d:: ", __FILE__, __LINE__); \
fprintf(stderr, m, ## __VA_ARGS__); \
fprintf(stderr, "\n"); \
fflush(stderr); \
} while (0);
\end{verbatim}\end{Code}

View File

@ -0,0 +1,69 @@
\section{mm\_\-mimepart.c File Reference}
\label{mm__mimepart_8c}\index{mm_mimepart.c@{mm\_\-mimepart.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 $<$string.h$>$}\par
{\tt \#include $<$unistd.h$>$}\par
{\tt \#include $<$fcntl.h$>$}\par
{\tt \#include $<$ctype.h$>$}\par
{\tt \#include $<$assert.h$>$}\par
{\tt \#include \char`\"{}mm\_\-internal.h\char`\"{}}\par
\subsection*{Functions}
\begin{Indent}{\bf Creating and destroying MIME parts}\par
\begin{CompactItemize}
\item
mm\_\-mimepart $\ast$ {\bf mm\_\-mimepart\_\-new} (void)
\item
mm\_\-mimepart $\ast$ {\bf mm\_\-mimepart\_\-fromfile} (const char $\ast$filename)
\item
void {\bf mm\_\-mimepart\_\-free} (struct mm\_\-mimepart $\ast$part)
\end{CompactItemize}
\end{Indent}
\begin{Indent}{\bf Accessing the MIME part's mail header}\par
\begin{CompactItemize}
\item
int {\bf mm\_\-mimepart\_\-attachheader} (struct mm\_\-mimepart $\ast$part, struct mm\_\-mimeheader $\ast$header)
\item
int {\bf mm\_\-mimepart\_\-countheaders} (struct mm\_\-mimepart $\ast$part)
\item
int {\bf mm\_\-mimepart\_\-countheaderbyname} (struct mm\_\-mimepart $\ast$part, const char $\ast$name)
\item
mm\_\-mimeheader $\ast$ {\bf mm\_\-mimepart\_\-getheaderbyname} (struct mm\_\-mimepart $\ast$part, const char $\ast$name, int idx)
\item
const char $\ast$ {\bf mm\_\-mimepart\_\-getheadervalue} (struct mm\_\-mimepart $\ast$part, const char $\ast$name, int idx)
\item
int {\bf mm\_\-mimepart\_\-headers\_\-start} (struct mm\_\-mimepart $\ast$part, struct mm\_\-mimeheader $\ast$$\ast$id)
\item
mm\_\-mimeheader $\ast$ {\bf mm\_\-mimepart\_\-headers\_\-next} (struct mm\_\-mimepart $\ast$part, struct mm\_\-mimeheader $\ast$$\ast$id)
\end{CompactItemize}
\end{Indent}
\begin{Indent}{\bf Accessing and manipulating the MIME part's body}\par
\begin{CompactItemize}
\item
char $\ast$ {\bf mm\_\-mimepart\_\-getbody} (struct mm\_\-mimepart $\ast$part, int opaque)
\item
void {\bf mm\_\-mimepart\_\-setbody} (struct mm\_\-mimepart $\ast$part, const char $\ast$data, int opaque)
\item
size\_\-t {\bf mm\_\-mimepart\_\-getlength} (struct mm\_\-mimepart $\ast$part)
\item
char $\ast$ {\bf mm\_\-mimepart\_\-decode} (struct mm\_\-mimepart $\ast$part)
\item
int {\bf mm\_\-mimepart\_\-flatten} (struct mm\_\-mimepart $\ast$part, char $\ast$$\ast$result, size\_\-t $\ast$length, int opaque)
\item
int {\bf mm\_\-mimepart\_\-setdefaultcontenttype} (struct mm\_\-mimepart $\ast$part, int composite)
\end{CompactItemize}
\end{Indent}
\begin{Indent}{\bf Accessing the MIME part's Content-Type information}\par
\begin{CompactItemize}
\item
void {\bf mm\_\-mimepart\_\-attachcontenttype} (struct mm\_\-mimepart $\ast$part, struct mm\_\-content $\ast$ct)
\item
mm\_\-content $\ast$ {\bf mm\_\-mimepart\_\-gettype} (struct mm\_\-mimepart $\ast$part)
\end{CompactItemize}
\end{Indent}
\subsection{Detailed Description}
This module contains functions for manipulating MIME header objects.

View File

@ -0,0 +1,50 @@
\section{mm\_\-mimeutil.c File Reference}
\label{mm__mimeutil_8c}\index{mm_mimeutil.c@{mm\_\-mimeutil.c}}
{\tt \#include $<$sys/time.h$>$}\par
{\tt \#include $<$stdio.h$>$}\par
{\tt \#include $<$stdlib.h$>$}\par
{\tt \#include $<$string.h$>$}\par
{\tt \#include $<$time.h$>$}\par
{\tt \#include $<$assert.h$>$}\par
{\tt \#include \char`\"{}mm\_\-internal.h\char`\"{}}\par
\subsection*{Defines}
\begin{CompactItemize}
\item
\#define \textbf{MM\_\-DATE\_\-LENGTH}~50\label{mm__mimeutil_8c_257774e1a30f8190b3d99891be64210a}
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item
int {\bf mm\_\-mimeutil\_\-gendate} (char $\ast$$\ast$result)
\item
int \textbf{mm\_\-mimeutil\_\-genboundary} (char $\ast$prefix, size\_\-t length, char $\ast$$\ast$result)\label{mm__mimeutil_8c_a72e503ba7ce2552456c6bd5935febe9}
\end{CompactItemize}
\subsection{Detailed Description}
This module contains various MIME related utility functions.
\subsection{Function Documentation}
\index{mm_mimeutil.c@{mm\_\-mimeutil.c}!mm_mimeutil_gendate@{mm\_\-mimeutil\_\-gendate}}
\index{mm_mimeutil_gendate@{mm\_\-mimeutil\_\-gendate}!mm_mimeutil.c@{mm\_\-mimeutil.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mm\_\-mimeutil\_\-gendate (char $\ast$$\ast$ {\em result})}\label{mm__mimeutil_8c_a7b7f63b42dfa7a7f907b615aa4cd057}
Generates an RFC 2822 conform date string
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em timezone}]Whether to include timezone information \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A pointer to the actual date string \end{Desc}
\begin{Desc}
\item[Note:]The pointer returned must be freed some time\end{Desc}
This function generates an RFC 2822 conform date string to use in message headers. It allocates memory to hold the string and returns a pointer to it. The generated date is in the format (example):
Thu, 25 December 2003 16:35:22 +0100 (CET)
This function dynamically allocates memory and returns a pointer to it. This memory should be released with free() once not needed anymore.

View File

@ -0,0 +1,38 @@
\section{mm\_\-param.c File Reference}
\label{mm__param_8c}\index{mm_param.c@{mm\_\-param.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
\subsection*{Functions}
\begin{Indent}{\bf Functions for manipulating MIME parameters}\par
{\em MIME parameters are properties attached to certain MIME headers, such as Content-Type and Content-Disposition. MIME parameters have a textual representations as in {\em name=value\/}. They contain important information about the MIME structure of a message, such as the boundary string used, which charset was used to encode the message and so on. This module provides simple to use functions to query or set MIME parameters.
Each MIME header may hold an arbitrary amount of such parameters, which are delimeted by each other with a semicolon. }\begin{CompactItemize}
\item
mm\_\-param $\ast$ {\bf mm\_\-param\_\-new} (void)
\item
void {\bf mm\_\-param\_\-free} (struct mm\_\-param $\ast$param)
\item
mm\_\-param $\ast$ {\bf mm\_\-param\_\-generate} (const char $\ast$name, const char $\ast$value)
\item
char $\ast$ {\bf mm\_\-param\_\-setname} (struct mm\_\-param $\ast$param, const char $\ast$name, int copy)
\item
char $\ast$ {\bf mm\_\-param\_\-setvalue} (struct mm\_\-param $\ast$param, const char $\ast$value, int copy)
\item
const char $\ast$ {\bf mm\_\-param\_\-getname} (struct mm\_\-param $\ast$param)
\item
const char $\ast$ {\bf mm\_\-param\_\-getvalue} (struct mm\_\-param $\ast$param)
\end{CompactItemize}
\end{Indent}
\subsection{Detailed Description}
Functions to manipulate MIME parameters

View File

@ -0,0 +1,90 @@
\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.

View File

@ -0,0 +1,38 @@
\section{mm\_\-util.c File Reference}
\label{mm__util_8c}\index{mm_util.c@{mm\_\-util.c}}
{\tt \#include $<$stdio.h$>$}\par
{\tt \#include $<$stdlib.h$>$}\par
{\tt \#include $<$string.h$>$}\par
{\tt \#include $<$time.h$>$}\par
{\tt \#include $<$assert.h$>$}\par
{\tt \#include \char`\"{}mm\_\-internal.h\char`\"{}}\par
\subsection*{Functions}
\begin{CompactItemize}
\item
void $\ast$ {\bf xmalloc} (size\_\-t size)
\item
void $\ast$ {\bf xrealloc} (void $\ast$p, size\_\-t size)
\item
char $\ast$ \textbf{xstrdup} (const char $\ast$str)\label{mm__util_8c_700bf3013e33311eacdd1f20d13bdc9a}
\item
void \textbf{xfree} (void $\ast$p)\label{mm__util_8c_91fc771d8aa78ca2ac43244c491da52d}
\item
char $\ast$ {\bf mm\_\-unquote} (const char $\ast$string)
\item
char $\ast$ {\bf mm\_\-uncomment} (const char $\ast$string)
\item
char $\ast$ {\bf xstrsep} (char $\ast$$\ast$stringp, const char $\ast$delim)
\item
char $\ast$ {\bf mm\_\-stripchars} (char $\ast$input, char $\ast$strip)
\item
char $\ast$ {\bf mm\_\-addchars} (char $\ast$input, char $\ast$add, u\_\-int16\_\-t linelength)
\item
void \textbf{mm\_\-striptrailing} (char $\ast$$\ast$what, const char $\ast$charset)\label{mm__util_8c_a965d3d1c625253beffd53051b38548e}
\end{CompactItemize}
\subsection{Detailed Description}
This module contains utility functions for the Mini\-MIME library

View File

@ -0,0 +1,12 @@
\section{Mini\-MIME Modules}
Here is a list of all modules:\begin{CompactList}
\item \contentsline{section}{Manipulating Mini\-MIME codecs}{\pageref{group__codecs}}{}
\item \contentsline{section}{Accessing and manipulating Content-Type objects}{\pageref{group__contenttype}}{}
\item \contentsline{section}{Accessing and manipulating MIME contexts}{\pageref{group__context}}{}
\item \contentsline{section}{Accessing and manipulating a message's envelope}{\pageref{group__envelope}}{}
\item \contentsline{section}{Mini\-MIME error functions}{\pageref{group__error}}{}
\item \contentsline{section}{Accessing and manipulating MIME parts}{\pageref{group__mimepart}}{}
\item \contentsline{section}{MIME related utility functions}{\pageref{group__mimeutil}}{}
\item \contentsline{section}{Accessing and manipulating MIME parameters}{\pageref{group__param}}{}
\item \contentsline{section}{General purpose utility functions}{\pageref{group__util}}{}
\end{CompactList}

View File

@ -0,0 +1,5 @@
\section{Mini\-MIME Related Pages}
Here is a list of all related documentation pages:\begin{CompactList}
\item \contentsline{section}{Bug List}{\pageref{bug}}{}
\end{CompactList}

View File

@ -0,0 +1,62 @@
\documentclass[a4paper]{book}
\usepackage{a4wide}
\usepackage{makeidx}
\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage{multicol}
\usepackage{float}
\usepackage{textcomp}
\usepackage{alltt}
\usepackage{doxygen}
\makeindex
\setcounter{tocdepth}{1}
\renewcommand{\footrulewidth}{0.4pt}
\begin{document}
\begin{titlepage}
\vspace*{7cm}
\begin{center}
{\Large Mini\-MIME Reference Manual}\\
\vspace*{1cm}
{\large Generated by Doxygen 1.5.1}\\
\vspace*{0.5cm}
{\small Thu Mar 29 17:59:08 2007}\\
\end{center}
\end{titlepage}
\clearemptydoublepage
\pagenumbering{roman}
\tableofcontents
\clearemptydoublepage
\pagenumbering{arabic}
\chapter{Mini\-MIME Module Index}
\input{modules}
\chapter{Mini\-MIME File Index}
\input{files}
\chapter{Mini\-MIME Page Index}
\input{pages}
\chapter{Mini\-MIME Module Documentation}
\input{group__codecs}
\include{group__contenttype}
\include{group__context}
\include{group__envelope}
\include{group__error}
\include{group__mimepart}
\include{group__mimeutil}
\include{group__param}
\include{group__util}
\chapter{Mini\-MIME File Documentation}
\input{mm__codecs_8c}
\include{mm__contenttype_8c}
\include{mm__context_8c}
\include{mm__envelope_8c}
\include{mm__error_8c}
\include{mm__header_8c}
\include{mm__internal_8h}
\include{mm__mimepart_8c}
\include{mm__mimeutil_8c}
\include{mm__param_8c}
\include{mm__parse_8c}
\include{mm__util_8c}
\chapter{Mini\-MIME Page Documentation}
\input{bug}
\printindex
\end{document}

Binary file not shown.

368
main/minimime/mm.h Normal file
View File

@ -0,0 +1,368 @@
/*
* $Id$
*
* MiniMIME - a library for handling MIME messages
*
* Copyright (C) 2003 Jann Fischer <rezine@mistrust.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the author nor the names of the contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY JANN FISCHER AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL JANN FISCHER OR THE VOICES IN HIS HEAD
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _MM_H_INCLUDED
#define _MM_H_INCLUDED
#include <sys/types.h>
#include <assert.h>
#include "mm_queue.h"
#include "mm_mem.h"
#define MM_MIME_LINELEN 998
#define MM_BASE64_LINELEN 76
TAILQ_HEAD(mm_mimeheaders, mm_mimeheader);
TAILQ_HEAD(mm_mimeparts, mm_mimepart);
TAILQ_HEAD(mm_params, mm_param);
SLIST_HEAD(mm_codecs, mm_codec);
SLIST_HEAD(mm_warnings, mm_warning);
/*
* Parser modes
*/
enum mm_parsemodes
{
/** Parse loosely, accept some MIME quirks */
MM_PARSE_LOOSE = 0,
/** Parse as strict as possible */
MM_PARSE_STRICT
};
/*
* Available parser flags
*/
enum mm_parseflags
{
MM_PARSE_NONE = (1L << 0),
MM_PARSE_STRIPCOMMENTS = (1L << 1)
};
/*
* Enumeration of MIME encodings
*/
enum mm_encoding
{
MM_ENCODING_NONE = 0,
MM_ENCODING_BASE64,
MM_ENCODING_QUOTEDPRINTABLE,
MM_ENCODING_UNKNOWN
};
/*
* Message type
*/
enum mm_messagetype
{
/** Flat message */
MM_MSGTYPE_FLAT = 0,
/** Composite message */
MM_MSGTYPE_MULTIPART
};
/*
* Enumeration of error categories
*/
enum mm_errors
{
MM_ERROR_NONE = 0,
MM_ERROR_UNDEF,
MM_ERROR_ERRNO,
MM_ERROR_PARSE,
MM_ERROR_MIME,
MM_ERROR_CODEC,
MM_ERROR_PROGRAM
};
enum mm_warning_ids
{
MM_WARN_NONE = 0,
MM_WARN_PARSE,
MM_WARN_MIME,
MM_WARN_CODEC
};
enum mm_addressfields {
MM_ADDR_TO = 0,
MM_ADDR_CC,
MM_ADDR_BCC,
MM_ADDR_FROM,
MM_ADDR_SENDER,
MM_ADDR_REPLY_TO
};
enum mm_flatten_flags {
MM_FLATTEN_NONE = 0,
MM_FLATTEN_SKIPENVELOPE = (1L << 1),
MM_FLATTEN_OPAQUE = (1L << 2),
MM_FLATTEN_NOPREAMBLE = (1L << 3)
};
/*
* More information about an error
*/
struct mm_error_data
{
int error_id;
int error_where;
int lineno;
char error_msg[128];
};
extern int mm_errno;
extern struct mm_error_data mm_error;
enum mm_warning_code
{
MM_WARNING_NONE = 0,
MM_WARNING_INVHDR,
};
/*
* A parser warning
*/
struct mm_warning
{
enum mm_warning_code warning;
u_int32_t lineno;
SLIST_ENTRY(mm_warning) next;
};
/*
* Representation of a MiniMIME codec object
*/
struct mm_codec
{
enum mm_encoding id;
char *encoding;
char *(*encoder)(char *, u_int32_t);
char *(*decoder)(char *);
SLIST_ENTRY(mm_codec) next;
};
/*
* Representation of a MIME Content-Type parameter
*/
struct mm_param
{
char *name;
char *value;
TAILQ_ENTRY(mm_param) next;
};
/*
* Representation of a mail or MIME header field
*/
struct mm_mimeheader
{
char *name;
char *value;
struct mm_params params;
TAILQ_ENTRY(mm_mimeheader) next;
};
/*
* Representation of a MIME Content-Type object
*/
struct mm_content
{
char *maintype;
char *subtype;
char *disposition_type;
struct mm_params type_params;
struct mm_params disposition_params;
char *encstring;
enum mm_encoding encoding;
};
/*
* Representation of a MIME part
*/
struct mm_mimepart
{
struct mm_mimeheaders headers;
size_t opaque_length;
char *opaque_body;
size_t length;
char *body;
struct mm_content *type;
TAILQ_ENTRY(mm_mimepart) next;
};
/*
* Represantation of a MiniMIME context
*/
struct mm_context
{
struct mm_mimeparts parts;
enum mm_messagetype messagetype;
struct mm_warnings warnings;
struct mm_codecs codecs;
char *boundary;
char *preamble;
size_t max_message_size;
};
typedef struct mm_context MM_CTX;
typedef struct mm_context mm_ctx_t;
char *mm_unquote(const char *);
char *mm_uncomment(const char *);
char *mm_stripchars(char *, char *);
char *mm_addchars(char *, char *, u_int16_t);
int mm_gendate(char **);
void mm_striptrailing(char **, const char *);
int mm_mimeutil_genboundary(char *, size_t, char **);
int mm_library_init(void);
int mm_library_isinitialized(void);
int mm_parse_mem(MM_CTX *, const char *, int, int);
int mm_parse_file(MM_CTX *, const char *, int, int);
int mm_parse_fileptr(MM_CTX *, FILE *, int, int);
MM_CTX *mm_context_new(void);
void mm_context_free(MM_CTX *);
int mm_context_attachpart(MM_CTX *, struct mm_mimepart *);
int mm_context_deletepart(MM_CTX *, int, int);
int mm_context_countparts(MM_CTX *);
struct mm_mimepart *mm_context_getpart(MM_CTX *, int);
int mm_context_iscomposite(MM_CTX *);
int mm_context_haswarnings(MM_CTX *);
int mm_context_flatten(MM_CTX *, char **, size_t *, int);
int mm_envelope_getheaders(MM_CTX *, char **, size_t *);
int mm_envelope_setheader(MM_CTX *, const char *, const char *, ...);
struct mm_mimeheader *mm_mimeheader_new(void);
void mm_mimeheader_free(struct mm_mimeheader *);
struct mm_mimeheader *mm_mimeheader_generate(const char *, const char *);
int mm_mimeheader_uncomment(struct mm_mimeheader *);
int mm_mimeheader_uncommentbyname(struct mm_mimepart *, const char *);
int mm_mimeheader_uncommentall(struct mm_mimepart *);
int mm_mimeheader_tostring(struct mm_mimeheader *);
char *mm_mimeheader_getparambyname(struct mm_mimeheader *hdr, const char *name);
int mm_mimeheader_attachparam(struct mm_mimeheader *hdr, struct mm_param *param);
struct mm_mimepart *mm_mimepart_new(void);
void mm_mimepart_free(struct mm_mimepart *);
int mm_mimepart_attachheader(struct mm_mimepart *, struct mm_mimeheader *);
int mm_mimepart_countheaders(struct mm_mimepart *part);
int mm_mimepart_countheaderbyname(struct mm_mimepart *, const char *);
struct mm_mimeheader *mm_mimepart_getheaderbyname(struct mm_mimepart *, const char *, int);
const char *mm_mimepart_getheadervalue(struct mm_mimepart *, const char *, int);
int mm_mimepart_headers_start(struct mm_mimepart *, struct mm_mimeheader **);
struct mm_mimeheader *mm_mimepart_headers_next(struct mm_mimepart *, struct mm_mimeheader **);
char *mm_mimepart_decode(struct mm_mimepart *);
struct mm_content *mm_mimepart_getcontent(struct mm_mimepart *);
size_t mm_mimepart_getlength(struct mm_mimepart *);
char *mm_mimepart_getbody(struct mm_mimepart *, int);
void mm_mimepart_attachcontenttype(struct mm_mimepart *, struct mm_content *);
int mm_mimepart_setdefaultcontenttype(struct mm_mimepart *, int);
int mm_mimepart_flatten(struct mm_mimepart *, char **, size_t *, int);
struct mm_mimepart *mm_mimepart_fromfile(const char *);
struct mm_content *mm_content_new(void);
void mm_content_free(struct mm_content *);
int mm_content_attachtypeparam(struct mm_content *, struct mm_param *);
int mm_content_attachdispositionparam(struct mm_content *, struct mm_param *);
struct mm_content *mm_content_parse(const char *, int);
char *mm_content_gettypeparambyname(struct mm_content *, const char *);
char *mm_content_getdispositionparambyname(struct mm_content *, const char *);
struct mm_param *mm_content_gettypeparamobjbyname(struct mm_content *, const char *);
struct mm_param *mm_content_getdispositionparamobjbyname(struct mm_content *, const char *);
int mm_content_setmaintype(struct mm_content *, char *, int);
int mm_content_setsubtype(struct mm_content *, char *, int);
int mm_content_settype(struct mm_content *, const char *, ...);
int mm_content_setdispositiontype(struct mm_content *ct, char *value, int copy);
char *mm_content_getmaintype(struct mm_content *);
char *mm_content_getsubtype(struct mm_content *);
char *mm_content_gettype(struct mm_content *);
char *mm_content_getdispositiontype(struct mm_content *ct);
int mm_content_iscomposite(struct mm_content *);
int mm_content_isvalidencoding(const char *);
int mm_content_setencoding(struct mm_content *, const char *);
char *mm_content_typeparamstostring(struct mm_content *);
char *mm_content_dispositionparamstostring(struct mm_content *);
char *mm_content_tostring(struct mm_content *);
struct mm_param *mm_param_new(void);
void mm_param_free(struct mm_param *);
char *mm_flatten_mimepart(struct mm_mimepart *);
char *mm_flatten_context(MM_CTX *);
int mm_codec_isregistered(const char *);
int mm_codec_hasdecoder(const char *);
int mm_codec_hasencoder(const char *);
int mm_codec_register(const char *, char *(*encoder)(char *, u_int32_t), char *(*decoder)(char *));
int mm_codec_unregister(const char *);
int mm_codec_unregisterall(void);
void mm_codec_registerdefaultcodecs(void);
char *mm_base64_decode(char *);
char *mm_base64_encode(char *, u_int32_t);
void mm_error_init(void);
void mm_error_setmsg(const char *, ...);
void mm_error_setlineno(int lineno);
char *mm_error_string(void);
int mm_error_lineno(void);
void mm_warning_add(MM_CTX *, int, const char *, ...);
struct mm_warning *mm_warning_next(MM_CTX *, struct mm_warning **);
#ifndef HAVE_STRLCPY
size_t strlcpy(char *, const char *, size_t);
#endif /* ! HAVE_STRLCPY */
#ifndef HAVE_STRLCAT
size_t strlcat(char *, const char *, size_t);
#endif /* ! HAVE_STRLCAT */
#define MM_ISINIT() do { \
assert(mm_library_isinitialized() == 1); \
} while (0);
#endif /* ! _MM_H_INCLUDED */

210
main/minimime/mm_base64.c Normal file
View File

@ -0,0 +1,210 @@
/*
* Copyright (C) 2003 Jann Fischer <jfi@openbsd.de>
* All rights reserved.
*
* XXX: This piece of software is not nearly MIME compatible as it should be.
*
* This is based on third-party code, see the copyright notice below.
*
*/
/* $Id$ */
/***********************************************************
Copyright 1998 by Carnegie Mellon University
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Carnegie Mellon
University not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior
permission.
CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE FOR
ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "mm_internal.h"
#define XX 127
static int _mm_base64_decode(char *);
static char *_mm_base64_encode(char *, u_int32_t);
/*
* Tables for encoding/decoding base64
*/
static const char basis_64[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
static const char index_64[256] = {
XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX,
XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX,
XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,62, XX,XX,XX,63,
52,53,54,55, 56,57,58,59, 60,61,XX,XX, XX,XX,XX,XX,
XX, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,12,13,14,
15,16,17,18, 19,20,21,22, 23,24,25,XX, XX,XX,XX,XX,
XX,26,27,28, 29,30,31,32, 33,34,35,36, 37,38,39,40,
41,42,43,44, 45,46,47,48, 49,50,51,XX, XX,XX,XX,XX,
XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX,
XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX,
XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX,
XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX,
XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX,
XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX,
XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX,
XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX,
};
#define CHAR64(c) (index_64[(unsigned char)(c)])
/*
* mm_base64_decode()
*
* Decodes the data pointed to by 'data' from the BASE64 encoding to the data
* format it was encoded from. Returns a pointer to a string on success or
* NULL on error. The string returned needs to be freed by the caller at some
* later point.
*
*/
char *
mm_base64_decode(char *data)
{
char *buf;
assert(data != NULL);
buf = mm_stripchars(data, "\r\n");
assert(buf != NULL);
_mm_base64_decode(buf);
assert(buf != NULL);
return(buf);
}
/*
* mm_base64_encode()
*
* Encodes the data pointed to by 'data', which is of the length specified in
* 'len' to the BASE64 format. Returns a pointer to a string containing the
* BASE64 encoding, whose lines are broken at the MIME recommended linelength
* of 76 characters. If an error occured, returns NULL. The string returned
* needs to be freed by the caller at some later point.
*
*/
char *
mm_base64_encode(char *data, u_int32_t len) {
char *buf;
char *ret;
assert(data != NULL);
buf = _mm_base64_encode(data, len);
assert(buf != NULL);
ret = mm_addchars(buf, "\r\n", MM_BASE64_LINELEN);
xfree(buf);
assert(ret != NULL);
return ret;
}
/*
* Decode in-place the base64 data in 'input'. Returns the length
* of the decoded data, or -1 if there was an error.
*/
static int
_mm_base64_decode(char *input)
{
u_int32_t len = 0;
unsigned char *output = (unsigned char *)input;
int c1, c2, c3, c4;
while (*input) {
c1 = *input++;
if (CHAR64(c1) == XX) return -1;
c2 = *input++;
if (CHAR64(c2) == XX) return -1;
c3 = *input++;
if (c3 != '=' && CHAR64(c3) == XX) return -1;
c4 = *input++;
if (c4 != '=' && CHAR64(c4) == XX) return -1;
*output++ = (CHAR64(c1) << 2) | (CHAR64(c2) >> 4);
++len;
if (c3 == '=') break;
*output++ = ((CHAR64(c2) << 4) & 0xf0) | (CHAR64(c3) >> 2);
++len;
if (c4 == '=') break;
*output++ = ((CHAR64(c3) << 6) & 0xc0) | CHAR64(c4);
++len;
}
*output = 0;
return len;
}
/*
* Encode the given binary string of length 'len' and return Base64
* in a char buffer. It allocates the space for buffer.
* caller must free the space.
*/
static char *
_mm_base64_encode(char *data, u_int32_t len)
{
char *buf;
u_int32_t buflen;
int c1;
int c2;
int c3;
u_int32_t maxbuf;
buflen = 0;
#ifdef RUBBISH
maxbuf = len*4/3 + 1; /* size after expantion */
#endif
maxbuf = len*2 + 20; /* size after expantion */
buf = (char *)xmalloc(maxbuf);
while (len && buflen < (maxbuf - 6)) {
c1 = (unsigned char)*data++;
buf[buflen++] = basis_64[c1>>2];
if (--len == 0) c2 = 0;
else c2 = (unsigned char)*data++;
buf[buflen++] = basis_64[((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4)];
if (len == 0) {
buf[buflen++] = '=';
buf[buflen++] = '=';
break;
}
if (--len == 0) c3 = 0;
else c3 = (unsigned char)*data++;
buf[buflen++] = basis_64[((c2 & 0xF) << 2) | ((c3 & 0xC0) >>6)];
if (len == 0) {
buf[buflen++] = '=';
break;
}
--len;
buf[buflen++] = basis_64[c3 & 0x3F];
}
buf[buflen]=0;
return buf;
}

250
main/minimime/mm_codecs.c Normal file
View File

@ -0,0 +1,250 @@
/*
* $Id$
*
* MiniMIME - a library for handling MIME messages
*
* Copyright (C) 2003 Jann Fischer <rezine@mistrust.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the author nor the names of the contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY JANN FISCHER AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL JANN FISCHER OR THE VOICES IN HIS HEAD
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <assert.h>
#include "mm_internal.h"
#include "mm_util.h"
extern struct mm_codecs codecs;
/** @file mm_codecs.c
*
* This module contains functions to manipulate MiniMIME codecs
*
*/
/** @defgroup codecs Manipulating MiniMIME codecs */
/** @{
* @name Codec manipulation
*/
/**
* Looks up whether a context has an decoder installed for a given encoding
*
* @param encoding The encoding specifier to look up
* @return 1 if a decoder is installed or 0 if not
* @ingroup codecs
*/
int
mm_codec_hasdecoder(const char *encoding)
{
struct mm_codec *codec;
assert(encoding != NULL);
SLIST_FOREACH(codec, &codecs, next) {
assert(codec->encoding != NULL);
if (!strcasecmp(codec->encoding, encoding)) {
if (codec->decoder != NULL)
return 1;
else
return 0;
}
}
return 0;
}
/**
* Looks up whether a context has an encoder installed for a given encoding
*
* @param ctx A valid MIME context
* @param encoding The encoding specifier to look up
* @return 1 if an encoder is installed or 0 if not
* @ingroup codecs
*/
int
mm_codec_hasencoder(const char *encoding)
{
struct mm_codec *codec;
assert(encoding != NULL);
SLIST_FOREACH(codec, &codecs, next) {
assert(codec->encoding != NULL);
if (!strcasecmp(codec->encoding, encoding)) {
if (codec->encoder != NULL)
return 1;
else
return 0;
}
}
return 0;
}
/**
* Looks up whether a codec for a given encoding is installed to a context
*
* @param encoding The encoding specifier to look up
* @return 1 if a codec was found or 0 if not
* @ingroup codecs
*/
int
mm_codec_isregistered(const char *encoding)
{
struct mm_codec *codec;
assert(encoding != NULL);
SLIST_FOREACH(codec, &codecs, next) {
if (!strcasecmp(codec->encoding, encoding)) {
return 1;
}
}
return 0;
}
/**
* Registers a codec with the MiniMIME library
*
* @param encoding The encoding specifier for which to register the codec
* @param encoder The encoder function for this encoding
* @param decoder The decoder function for this encoding
* @return 1 if successfull or 0 if not
* @ingroup codecs
*
* This function registers a codec for a given MiniMIME context. The codec
* may provide an decoder, an encoder or both (but not none). If there is
* a codec already installed for this encoding, the function will puke.
*/
int
mm_codec_register(const char *encoding,
char *(*encoder)(char *data, u_int32_t i),
char *(*decoder)(char *data))
{
struct mm_codec *codec;
assert(encoding != NULL);
assert(mm_codec_isregistered(encoding) != 1);
codec = (struct mm_codec *)xmalloc(sizeof(struct mm_codec));
codec->encoding = xstrdup(encoding);
codec->encoder = encoder;
codec->decoder = decoder;
if (SLIST_EMPTY(&codecs)) {
SLIST_INSERT_HEAD(&codecs, codec, next);
return 1;
} else {
struct mm_codec *lcodec, *tcodec;
tcodec = NULL;
SLIST_FOREACH(lcodec, &codecs, next) {
if (lcodec != NULL)
tcodec = lcodec;
}
assert(tcodec != NULL);
SLIST_INSERT_AFTER(tcodec, codec, next);
return 1;
}
return 0;
}
/**
* Unregisters a MiniMIME codec
*
* @param encoding The encoding specifier which to unregister
* @return 0 if unregistered successfully, or -1 if there was no such codec
* @ingroup codecs
*/
int
mm_codec_unregister(const char *encoding)
{
struct mm_codec *codec;
assert(encoding != NULL);
SLIST_FOREACH(codec, &codecs, next) {
if (!strcasecmp(codec->encoding, encoding)) {
xfree(codec->encoding);
xfree(codec);
codec = NULL;
return 0;
}
}
return -1;
}
/**
* Unregisters all codecs within a context
*
* @param ctx A valid MiniMIME context
* @return 0 if all codecs were unregistered successfully or -1 if an error
* occured.
* @note Foobar
*/
int
mm_codec_unregisterall(void)
{
struct mm_codec *codec;
SLIST_FOREACH(codec, &codecs, next) {
if (mm_codec_unregister(codec->encoding) == -1) {
return -1;
}
}
return 0;
}
/**
* Registers the default codecs to a MiniMIME context
*
* This functions registers the codecs for the following encodings to a
* MiniMIME context:
*
* - Base64
* - (TODO:) Quoted-Printable
*/
void
mm_codec_registerdefaultcodecs(void)
{
mm_codec_register("base64", mm_base64_encode, mm_base64_decode);
}
/** @} */

View File

@ -0,0 +1,757 @@
/*
* $Id$
*
* MiniMIME - a library for handling MIME messages
*
* Copyright (C) 2003 Jann Fischer <rezine@mistrust.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the author nor the names of the contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY JANN FISCHER AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL JANN FISCHER OR THE VOICES IN HIS HEAD
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>
#include "mm_internal.h"
#include "mm_util.h"
/* This file is documented using Doxygen */
/**
* @file mm_contenttype.c
*
* This module contains functions for manipulating Content-Type objects.
*/
/** @defgroup contenttype Accessing and manipulating Content-Type objects */
struct mm_encoding_mappings {
const char *idstring;
int type;
};
static struct mm_encoding_mappings mm_content_enctypes[] = {
{ "Base64", MM_ENCODING_BASE64 },
{ "Quoted-Printable", MM_ENCODING_QUOTEDPRINTABLE },
{ NULL, - 1},
};
static const char *mm_composite_maintypes[] = {
"multipart",
"message",
NULL,
};
static const char *mm_composite_encodings[] = {
"7bit",
"8bit",
"binary",
NULL,
};
/** @{
* @name Functions for manipulating Content objects
*/
/**
* Creates a new object to hold a Content representation.
* The allocated memory must later be freed using mm_content_free()
*
* @return An object representing a MIME Content-Type
* @see mm_content_free
* @ingroup contenttype
*/
struct mm_content *
mm_content_new(void)
{
struct mm_content *ct;
ct = (struct mm_content *)xmalloc(sizeof(struct mm_content));
ct->maintype = NULL;
ct->subtype = NULL;
TAILQ_INIT(&ct->type_params);
TAILQ_INIT(&ct->disposition_params);
ct->encoding = MM_ENCODING_NONE;
ct->encstring = NULL;
return ct;
}
/**
* Releases all memory associated with an Content object
*
* @param ct A Content-Type object
* @return Nothing
* @ingroup contenttype
*/
void
mm_content_free(struct mm_content *ct)
{
struct mm_param *param;
assert(ct != NULL);
if (ct->maintype != NULL) {
xfree(ct->maintype);
ct->maintype = NULL;
}
if (ct->subtype != NULL) {
xfree(ct->subtype);
ct->subtype = NULL;
}
if (ct->encstring != NULL) {
xfree(ct->encstring);
ct->encstring = NULL;
}
TAILQ_FOREACH(param, &ct->type_params, next) {
TAILQ_REMOVE(&ct->type_params, param, next);
mm_param_free(param);
}
TAILQ_FOREACH(param, &ct->disposition_params, next) {
TAILQ_REMOVE(&ct->disposition_params, param, next);
mm_param_free(param);
}
xfree(ct);
}
/**
* Attaches a content-type parameter to a Content object
*
* @param ct The target Content object
* @param param The Content-Type parameter which to attach
* @return 0 on success and -1 on failure
* @ingroup contenttype
*/
int
mm_content_attachtypeparam(struct mm_content *ct, struct mm_param *param)
{
assert(ct != NULL);
assert(param != NULL);
if (TAILQ_EMPTY(&ct->type_params)) {
TAILQ_INSERT_HEAD(&ct->type_params, param, next);
} else {
TAILQ_INSERT_TAIL(&ct->type_params, param, next);
}
return 0;
}
/**
* Attaches a content-disposition parameter to a Content-Disposition object
*
* @param ct The target Content object
* @param param The Content-Type parameter which to attach
* @return 0 on success and -1 on failure
* @ingroup contenttype
*/
int
mm_content_attachdispositionparam(struct mm_content *ct, struct mm_param *param)
{
assert(ct != NULL);
assert(param != NULL);
if (TAILQ_EMPTY(&ct->disposition_params)) {
TAILQ_INSERT_HEAD(&ct->disposition_params, param, next);
} else {
TAILQ_INSERT_TAIL(&ct->disposition_params, param, next);
}
return 0;
}
/**
* Gets a Content-Type parameter value from a Content object.
*
* @param ct the Content object
* @param name the name of the parameter to retrieve
* @return The value of the parameter on success or a NULL pointer on failure
* @ingroup contenttype
*/
char *
mm_content_gettypeparambyname(struct mm_content *ct, const char *name)
{
struct mm_param *param;
assert(ct != NULL);
TAILQ_FOREACH(param, &ct->type_params, next) {
if (!strcasecmp(param->name, name)) {
return param->value;
}
}
return NULL;
}
/**
* Gets a Content-Disposition parameter value from a Content object.
*
* @param ct the Content object
* @param name the name of the parameter to retrieve
* @return The value of the parameter on success or a NULL pointer on failure
* @ingroup contenttype
*/
char *
mm_content_getdispositionparambyname(struct mm_content *ct, const char *name)
{
struct mm_param *param;
assert(ct != NULL);
TAILQ_FOREACH(param, &ct->disposition_params, next) {
if (!strcasecmp(param->name, name)) {
return param->value;
}
}
return NULL;
}
struct mm_param *
mm_content_gettypeparamobjbyname(struct mm_content *ct, const char *name)
{
struct mm_param *param;
assert(ct != NULL);
TAILQ_FOREACH(param, &ct->type_params, next) {
if (!strcasecmp(param->name, name)) {
return param;
}
}
return NULL;
}
struct mm_param *
mm_content_getdispositionparamobjbyname(struct mm_content *ct, const char *name)
{
struct mm_param *param;
assert(ct != NULL);
TAILQ_FOREACH(param, &ct->disposition_params, next) {
if (!strcasecmp(param->name, name)) {
return param;
}
}
return NULL;
}
/**
* Sets the MIME main Content-Type for a MIME Content object
*
* @param ct The MIME Content object
* @param value The value which to set the main type to
* @param copy Whether to make a copy of the value (original value must be
* freed afterwards to prevent memory leaks).
*/
int
mm_content_setmaintype(struct mm_content *ct, char *value, int copy)
{
assert(ct != NULL);
assert(value != NULL);
if (copy) {
/**
* @bug The xfree() call could lead to undesirable results.
* Do we really need it?
*/
if (ct->maintype != NULL) {
xfree(ct->maintype);
}
ct->maintype = xstrdup(value);
} else {
ct->maintype = value;
}
return 0;
}
/**
* Retrieves the main MIME Content-Type stored in a Content object
*
* @param ct A valid Content object
* @returns A pointer to the string representing the main type
* @ingroup contenttype
*/
char *
mm_content_getmaintype(struct mm_content *ct)
{
assert(ct != NULL);
assert(ct->maintype != NULL);
return ct->maintype;
}
/**
* Sets the MIME Content-Disposition type for a MIME Content object
*
* @param ct The MIME Content object
* @param value The value which to set the main type to
* @param copy Whether to make a copy of the value (original value must be
* freed afterwards to prevent memory leaks).
*/
int
mm_content_setdispositiontype(struct mm_content *ct, char *value, int copy)
{
assert(ct != NULL);
assert(value != NULL);
if (copy) {
/**
* @bug The xfree() call could lead to undesirable results.
* Do we really need it?
*/
if (ct->disposition_type != NULL) {
xfree(ct->disposition_type);
}
ct->disposition_type = xstrdup(value);
} else {
ct->disposition_type = value;
}
return 0;
}
/**
* Retrieves the Content-Disposition MIME type stored in a Content object
*
* @param ct A valid Content-Type object
* @returns A pointer to the string representing the main type
* @ingroup contenttype
*/
char *
mm_content_getdispositiontype(struct mm_content *ct)
{
assert(ct != NULL);
assert(ct->disposition_type != NULL);
return ct->disposition_type;
}
/**
* Retrieves the sub MIME Content-Type stored in a Content object
*
* @param ct A valid Content-Type object
* @return A pointer to the string holding the current sub MIME type
* @ingroup contenttype
*/
char *
mm_content_getsubtype(struct mm_content *ct)
{
assert(ct != NULL);
assert(ct->subtype != NULL);
return ct->subtype;
}
/**
* Sets the MIME sub Content-Type for a MIME Content object
*
* @param ct The MIME Content-Type object
* @param value The value which to set the sub type to
* @param copy Whether to make a copy of the value (original value must be
* freed afterwards to prevent memory leaks).
*/
int
mm_content_setsubtype(struct mm_content *ct, char *value, int copy)
{
assert(ct != NULL);
assert(value != NULL);
if (copy) {
/**
* @bug The xfree() call could lead to undesirable results.
* Do we really need it?
*/
if (ct->subtype != NULL) {
xfree(ct->subtype);
}
ct->subtype = xstrdup(value);
} else {
ct->subtype = value;
}
return 0;
}
int
mm_content_settype(struct mm_content *ct, const char *fmt, ...)
{
char *maint, *subt;
char buf[512], *parse;
va_list ap;
mm_errno = MM_ERROR_NONE;
va_start(ap, fmt);
/* Make sure no truncation occurs */
if (vsnprintf(buf, sizeof buf, fmt, ap) > sizeof buf) {
mm_errno = MM_ERROR_ERRNO;
mm_error_setmsg("Input string too long");
return -1;
}
va_end(ap);
parse = buf;
maint = strsep(&parse, "/");
if (maint == NULL) {
mm_errno = MM_ERROR_PARSE;
mm_error_setmsg("Invalid type specifier: %s", buf);
return -1;
}
ct->maintype = xstrdup(maint);
subt = strsep(&parse, "");
if (subt == NULL) {
mm_errno = MM_ERROR_PARSE;
mm_error_setmsg("Invalid type specifier: %s", buf);
return -1;
}
ct->subtype = xstrdup(subt);
return 0;
}
/**
* Checks whether the Content-Type represents a composite message or not
*
* @param ct A valid Content-Type object
* @returns 1 if the Content-Type object represents a composite message or
* 0 if not.
*/
int
mm_content_iscomposite(struct mm_content *ct)
{
int i;
for (i = 0; mm_composite_maintypes[i] != NULL; i++) {
if (!strcasecmp(ct->maintype, mm_composite_maintypes[i])) {
return 1;
}
}
/* Not found */
return 0;
}
/**
* Verifies whether a string represents a valid encoding or not.
*
* @param encoding The string to verify
* @return 1 if the encoding string is valid or 0 if not
*
*/
int
mm_content_isvalidencoding(const char *encoding)
{
int i;
for (i = 0; mm_composite_encodings[i] != NULL; i++) {
if (!strcasecmp(encoding, mm_composite_encodings[i])) {
return 1;
}
}
/* Not found */
return 0;
}
/**
* Set the encoding of a MIME entitity according to a mapping table
*
* @param ct A valid content type object
* @param encoding A string representing the content encoding
* @return 0 if successfull or -1 if not (i.e. unknown content encoding)
*/
int
mm_content_setencoding(struct mm_content *ct, const char *encoding)
{
int i;
assert(ct != NULL);
assert(encoding != NULL);
for (i = 0; mm_content_enctypes[i].idstring != NULL; i++) {
if (!strcasecmp(mm_content_enctypes[i].idstring, encoding)) {
ct->encoding = mm_content_enctypes[i].type;
ct->encstring = xstrdup(encoding);
return 0;
}
}
/* If we didn't find a mapping, set the encoding to unknown */
ct->encoding = MM_ENCODING_UNKNOWN;
ct->encstring = NULL;
return 1;
}
/**
* Gets the numerical ID of a content encoding identifier
*
* @param ct A valid Content Type object
* @param encoding A string representing the content encoding identifier
* @return The numerical ID of the content encoding
*/
int
mm_content_getencoding(struct mm_content *ct, const char *encoding)
{
int i;
assert(ct != NULL);
for (i = 0; mm_content_enctypes[i].idstring != NULL; i++) {
if (!strcasecmp(mm_content_enctypes[i].idstring, encoding)) {
return mm_content_enctypes[i].type;
}
}
/* Not found */
return MM_ENCODING_UNKNOWN;
}
/**
* Constructs a MIME conform string of Content-Type parameters.
*
* @param ct A valid Content Type object
* @return A pointer to a string representing the Content-Type parameters
* in MIME terminology, or NULL if either the Content-Type object
* is invalid, has no parameters or no memory could be allocated.
*
* This function constructs a MIME conform string including all the parameters
* associated with the given Content-Type object. It should NOT be used if
* you need an opaque copy of the current MIME part (e.g. for PGP purposes).
*/
char *
mm_content_typeparamstostring(struct mm_content *ct)
{
size_t size, new_size;
struct mm_param *param;
char *param_string, *cur_param;
char *buf;
size = 1;
param_string = NULL;
cur_param = NULL;
param_string = (char *) xmalloc(size);
*param_string = '\0';
/* Concatenate all Content-Type parameters attached to the current
* Content-Type object to a single string.
*/
TAILQ_FOREACH(param, &ct->type_params, next) {
if (asprintf(&cur_param, "; %s=\"%s\"", param->name,
param->value) == -1) {
goto cleanup;
}
new_size = size + strlen(cur_param) + 1;
if (new_size < 0 || new_size > 1000) {
size = 0;
goto cleanup;
}
buf = (char *) xrealloc(param_string, new_size);
if (buf == NULL) {
size = 0;
goto cleanup;
}
param_string = buf;
size = new_size;
strlcat(param_string, cur_param, size);
xfree(cur_param);
cur_param = NULL;
}
return param_string;
cleanup:
if (param_string != NULL) {
xfree(param_string);
param_string = NULL;
}
if (cur_param != NULL) {
xfree(cur_param);
cur_param = NULL;
}
return NULL;
}
/**
* Constructs a MIME conformant string of Content-Disposition parameters.
*
* @param ct A valid Content object
* @return A pointer to a string representing the Content-Disposition parameters
* in MIME terminology, or NULL if either the Content object
* is invalid, has no Disposition parameters or no memory could be allocated.
*
* This function constructs a MIME conforming string including all the parameters
* associated with the given Content-Disposition object. It should NOT be used if
* you need an opaque copy of the current MIME part (e.g. for PGP purposes).
*/
char *
mm_content_dispositionparamstostring(struct mm_content *ct)
{
size_t size, new_size;
struct mm_param *param;
char *param_string, *cur_param;
char *buf;
size = 1;
param_string = NULL;
cur_param = NULL;
param_string = (char *) xmalloc(size);
*param_string = '\0';
/* Concatenate all Content-Disposition parameters attached to the current
* Content object to a single string.
*/
TAILQ_FOREACH(param, &ct->disposition_params, next) {
if (asprintf(&cur_param, "; %s=\"%s\"", param->name,
param->value) == -1) {
goto cleanup;
}
new_size = size + strlen(cur_param) + 1;
if (new_size < 0 || new_size > 1000) {
size = 0;
goto cleanup;
}
buf = (char *) xrealloc(param_string, new_size);
if (buf == NULL) {
size = 0;
goto cleanup;
}
param_string = buf;
size = new_size;
strlcat(param_string, cur_param, size);
xfree(cur_param);
cur_param = NULL;
}
return param_string;
cleanup:
if (param_string != NULL) {
xfree(param_string);
param_string = NULL;
}
if (cur_param != NULL) {
xfree(cur_param);
cur_param = NULL;
}
return NULL;
}
/**
* Creates a Content-Type header according to the object given
*
* @param ct A valid Content-Type object
*
*/
char *
mm_content_tostring(struct mm_content *ct)
{
char *paramstring;
char *buf;
char *headerstring;
size_t size;
paramstring = NULL;
headerstring = NULL;
buf = NULL;
if (ct == NULL) {
return NULL;
}
if (ct->maintype == NULL || ct->subtype == NULL) {
return NULL;
}
size = strlen(ct->maintype) + strlen(ct->subtype) + 2;
headerstring = (char *)xmalloc(size);
snprintf(headerstring, size, "%s/%s", ct->maintype, ct->subtype);
paramstring = mm_content_typeparamstostring(ct);
if (paramstring == NULL) {
goto cleanup;
}
size += strlen(paramstring) + strlen("Content-Type: ") + 1;
buf = (char *)malloc(size);
if (buf == NULL) {
goto cleanup;
}
snprintf(buf, size, "Content-Type: %s%s", headerstring, paramstring);
xfree(headerstring);
xfree(paramstring);
headerstring = NULL;
paramstring = NULL;
return buf;
cleanup:
if (paramstring != NULL) {
xfree(paramstring);
paramstring = NULL;
}
if (headerstring != NULL) {
xfree(headerstring);
headerstring = NULL;
}
if (buf != NULL) {
xfree(buf);
buf = NULL;
}
return NULL;
}
/** @} */

604
main/minimime/mm_context.c Normal file
View File

@ -0,0 +1,604 @@
/*
* $Id$
*
* MiniMIME - a library for handling MIME messages
*
* Copyright (C) 2003 Jann Fischer <rezine@mistrust.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the author nor the names of the contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY JANN FISCHER AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL JANN FISCHER OR THE VOICES IN HIS HEAD
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <assert.h>
#include "mm_internal.h"
/** @file mm_context.c
*
* Modules for manipulating MiniMIME contexts
*/
/** @defgroup context Accessing and manipulating MIME contexts
*
* Each message in MiniMIME is represented by a so called ``context''. A
* context holds all necessary information given about a MIME message, such
* as the envelope, all MIME parts etc.
*/
/** @{
* @name Manipulating MiniMIME contexts
*/
/**
* Creates a new MiniMIME context object.
*
* @return a new MiniMIME context object
* @see mm_context_free
*
* This function creates a new MiniMIME context, which will hold a message.
* The memory needed is allocated dynamically and should later be free'd
* using mm_context_free().
*
* Before a context can be created, the MiniMIME library needs to be
* initialized properly using mm_library_init().
*
*/
MM_CTX *
mm_context_new(void)
{
MM_CTX *ctx;
MM_ISINIT();
ctx = (MM_CTX *)xmalloc(sizeof(MM_CTX));
ctx->messagetype = MM_MSGTYPE_FLAT; /* This is the default */
ctx->boundary = NULL;
ctx->preamble = xstrdup("This is a message in MIME format, generated "
"by MiniMIME 0.1");
TAILQ_INIT(&ctx->parts);
SLIST_INIT(&ctx->warnings);
return ctx;
}
/**
* Releases a MiniMIME context object
*
* @param ctx A valid MiniMIME context
* @see mm_context_new
*
* This function releases all memory associated with MiniMIME context object
* that was created using mm_context_new(). It will also release all memory
* used for the MIME parts attached, and their specific properties (such as
* Content-Type information, headers, and the body data).
*/
void
mm_context_free(MM_CTX *ctx)
{
struct mm_mimepart *part;
struct mm_warning *warning, *nxt;
assert(ctx != NULL);
TAILQ_FOREACH(part, &ctx->parts, next) {
TAILQ_REMOVE(&ctx->parts, part, next);
mm_mimepart_free(part);
}
if (ctx->boundary != NULL) {
xfree(ctx->boundary);
ctx->boundary = NULL;
}
if (ctx->preamble != NULL) {
xfree(ctx->preamble);
ctx->preamble = NULL;
}
for (warning = SLIST_FIRST(&ctx->warnings);
warning != SLIST_END(&ctx->warnings);
warning = nxt) {
nxt = SLIST_NEXT(warning, next);
SLIST_REMOVE(&ctx->warnings, warning, mm_warning, next);
xfree(warning);
warning = NULL;
}
xfree(ctx);
ctx = NULL;
}
/**
* Attaches a MIME part object to a MiniMIME context.
*
* @param ctx the MiniMIME context
* @param part the MIME part object to attach
* @return 0 on success or -1 on failure. Sets mm_errno on failure.
*
* This function attaches a MIME part to a context, appending it to the end
* of the message.
*
* The MIME part should be initialized before attaching it using
* mm_mimepart_new().
*/
int
mm_context_attachpart(MM_CTX *ctx, struct mm_mimepart *part)
{
assert(ctx != NULL);
assert(part != NULL);
if (TAILQ_EMPTY(&ctx->parts)) {
TAILQ_INSERT_HEAD(&ctx->parts, part, next);
} else {
TAILQ_INSERT_TAIL(&ctx->parts, part, next);
}
return 0;
}
/**
* Attaches a MIME part object to a MiniMIME context at a given position
*
* @param ctx A valid MiniMIME context
* @param part The MIME part object to attach
* @param pos After which part to attach the object
* @return 0 on success or -1 if the given position is invalid
* @see mm_context_attachpart
*
* This function attaches a MIME part object after a given position in the
* specified context. If the position is invalid (out of range), the part
* will not get attached to the message and the function returns -1. If
* the index was in range, the MIME part will get attached after the MIME
* part at the given position, moving any possible following MIME parts one
* down the hierarchy.
*/
int
mm_context_attachpart_after(MM_CTX *ctx, struct mm_mimepart *part, int pos)
{
struct mm_mimepart *p;
int where;
where = 0;
p = NULL;
TAILQ_FOREACH(part, &ctx->parts, next) {
if (where == pos) {
p = part;
}
}
if (p == NULL) {
return(-1);
}
TAILQ_INSERT_AFTER(&ctx->parts, p, part, next);
return(0);
}
/**
* Deletes a MIME part object from a MiniMIME context
*
* @param ctx A valid MiniMIME context object
* @param which The number of the MIME part object to delete
* @param freemem Whether to free the memory associated with the MIME part
* object
* @return 0 on success or -1 on failure. Sets mm_errno on failure.
*
* This function deletes a MIME part from a given context. The MIME part to
* delete is specified as numerical index by the parameter ``which''. If the
* parameter ``freemem'' is set to anything greater than 0, the memory that
* is associated will be free'd by using mm_mimepart_free(), otherwise the
* memory is left untouched (if you still have a pointer to the MIME part
* around).
*/
int
mm_context_deletepart(MM_CTX *ctx, int which, int freemem)
{
struct mm_mimepart *part;
int cur;
assert(ctx != NULL);
assert(which >= 0);
cur = 0;
TAILQ_FOREACH(part, &ctx->parts, next) {
if (cur == which) {
TAILQ_REMOVE(&ctx->parts, part, next);
if (freemem)
mm_mimepart_free(part);
return 0;
}
cur++;
}
return -1;
}
/**
* Counts the number of attached MIME part objects in a given MiniMIME context
*
* @param ctx The MiniMIME context
* @returns The number of attached MIME part objects
*/
int
mm_context_countparts(MM_CTX *ctx)
{
int count;
struct mm_mimepart *part;
assert(ctx != NULL);
count = 0;
if (TAILQ_EMPTY(&ctx->parts)) {
return 0;
} else {
TAILQ_FOREACH(part, &ctx->parts, next) {
count++;
}
}
assert(count > -1);
return count;
}
/**
* Gets a specified MIME part object from a MimeMIME context
*
* @param ctx The MiniMIME context
* @param which The number of the MIME part object to retrieve
* @returns The requested MIME part object on success or a NULL pointer if
* there is no such part.
*/
struct mm_mimepart *
mm_context_getpart(MM_CTX *ctx, int which)
{
struct mm_mimepart *part;
int cur;
assert(ctx != NULL);
cur = 0;
TAILQ_FOREACH(part, &ctx->parts, next) {
if (cur == which) {
return part;
}
cur++;
}
return NULL;
}
/**
* Checks whether a given context represents a composite (multipart) message
*
* @param ctx A valid MiniMIME context object
* @return 1 if the context is a composite message or 0 if it's flat
*
*/
int
mm_context_iscomposite(MM_CTX *ctx)
{
if (ctx->messagetype == MM_MSGTYPE_MULTIPART) {
return 1;
} else {
return 0;
}
}
/**
* Checks whether there are any warnings associated with a given context
*
* @param ctx A valid MiniMIME context
* @return 1 if there are warnings associated with the context, otherwise 0
*/
int
mm_context_haswarnings(MM_CTX *ctx)
{
if (SLIST_EMPTY(&ctx->warnings)) {
return 0;
} else {
return 1;
}
}
/**
* Generates a generic boundary string for a given context
*
* @param ctx A valid MiniMIME context
* @return 0 on success or -1 on failure
*
* This function generates a default boundary string for the given context.
* If there is already a boundary for the context, the memory will be free()'d.
*/
int
mm_context_generateboundary(MM_CTX *ctx)
{
char *boundary;
struct mm_mimepart *part;
struct mm_param *param;
if (mm_mimeutil_genboundary("++MiniMIME++", 20, &boundary) == -1) {
return(-1);
}
if (ctx->boundary != NULL) {
xfree(ctx->boundary);
ctx->boundary = NULL;
}
/* If we already have an envelope, make sure that we also justify the
* "boundary" parameter of the envelope.
*/
part = mm_context_getpart(ctx, 0);
if (part == NULL) {
return(0);
}
if (part->type != NULL) {
param = mm_content_gettypeparamobjbyname(part->type, "boundary");
if (param == NULL) {
param = mm_param_new();
param->name = xstrdup("boundary");
param->value = xstrdup(boundary);
mm_content_attachtypeparam(part->type, param);
} else {
if (param->value != NULL) {
xfree(param->value);
param->value = NULL;
}
param->value = xstrdup(boundary);
}
}
ctx->boundary = boundary;
return(0);
}
/**
* Sets a preamble for the given MiniMIME context
*
* @param ctx A valid MiniMIME context
* @param preamble The preamble to set
* @return 0 on success or -1 on failure
*
* This function sets the MIME preamble (the text between the end of envelope
* headers and the beginning of the first MIME part) for a given context
* object. If preamble is a NULL-pointer then the preamble will be deleted,
* and the currently associated memory will be free automagically.
*/
int
mm_context_setpreamble(MM_CTX *ctx, char *preamble)
{
if (ctx == NULL)
return(-1);
if (preamble == NULL) {
if (ctx->preamble != NULL) {
xfree(ctx->preamble);
}
ctx->preamble = NULL;
} else {
ctx->preamble = xstrdup(preamble);
}
return(0);
}
char *
mm_context_getpreamble(MM_CTX *ctx)
{
if (ctx == NULL)
return(NULL);
return(ctx->preamble);
}
/**
* Creates an ASCII message of the specified context
*
* @param ctx A valid MiniMIME context object
* @param flat Where to store the message
* @param flags Flags that affect the flattening process
*
* This function ``flattens'' a MiniMIME context, that is, it creates an ASCII
* represantation of the message the context contains. The flags can be a
* bitwise combination of the following constants:
*
* - MM_FLATTEN_OPAQUE : use opaque MIME parts when flattening
* - MM_FLATTEN_SKIPENVELOPE : do not flatten the envelope part
*
* Great care is taken to not produce invalid MIME output.
*/
int
mm_context_flatten(MM_CTX *ctx, char **flat, size_t *length, int flags)
{
struct mm_mimepart *part;
char *message;
char *flatpart;
char *buf;
char *envelope_headers;
size_t message_size;
size_t tmp_size;
char envelope;
mm_errno = MM_ERROR_NONE;
envelope = 1;
message = NULL;
message_size = 0;
if (ctx->boundary == NULL) {
if (mm_context_iscomposite(ctx)) {
mm_context_generateboundary(ctx);
}
}
TAILQ_FOREACH(part, &ctx->parts, next) {
if (envelope) {
if (flags & MM_FLATTEN_SKIPENVELOPE) {
envelope = 0;
if ((message = (char *) malloc(1)) == NULL) {
mm_errno = MM_ERROR_ERRNO;
goto cleanup;
}
*message = '\0';
continue;
}
if (part->type == NULL && mm_context_countparts(ctx) > 1) {
if (mm_mimepart_setdefaultcontenttype(part, 1)
== -1) {
goto cleanup;
}
if (mm_context_generateboundary(ctx) == -1) {
goto cleanup;
}
ctx->messagetype = MM_MSGTYPE_MULTIPART;
}
if (mm_envelope_getheaders(ctx, &envelope_headers,
&tmp_size) == -1) {
return -1;
}
message = envelope_headers;
message_size = tmp_size;
envelope = 0;
if (ctx->preamble != NULL
&& mm_context_iscomposite(ctx)
&& !(flags & MM_FLATTEN_NOPREAMBLE)) {
tmp_size += strlen(ctx->preamble)
+ (strlen("\r\n") * 2);
buf = (char *)xrealloc(message, tmp_size);
if (buf == NULL) {
goto cleanup;
}
message_size += tmp_size;
message = buf;
strlcat(message, "\r\n", message_size);
strlcat(message, ctx->preamble, message_size);
strlcat(message, "\r\n", message_size);
}
} else {
/* Enforce Content-Type if none exist */
if (part->type == NULL) {
if (mm_mimepart_setdefaultcontenttype(part, 0)
== -1) {
goto cleanup;
}
}
/* Append a boundary if necessary */
if (ctx->boundary != NULL) {
tmp_size = strlen(ctx->boundary) +
(strlen("\r\n") * 2) + strlen("--");
if (tmp_size < 1) {
return(-1);
}
if (message_size + tmp_size < 1) {
return(-1);
}
buf = (char *)xrealloc(message, message_size
+ tmp_size);
if (buf == NULL) {
goto cleanup;
}
message_size += tmp_size;
message = buf;
strlcat(message, "\r\n", message_size);
strlcat(message, "--", message_size);
strlcat(message, ctx->boundary, message_size);
strlcat(message, "\r\n", message_size);
}
if (mm_mimepart_flatten(part, &flatpart, &tmp_size,
(flags & MM_FLATTEN_OPAQUE)) == -1) {
goto cleanup;
}
if (tmp_size < 1) {
goto cleanup;
}
buf = (char *) xrealloc(message, message_size
+ tmp_size);
if (buf == NULL) {
goto cleanup;
}
message_size += tmp_size;
message = buf;
strlcat(message, flatpart, message_size);
xfree(flatpart);
flatpart = NULL;
}
}
/* Append end boundary */
if (ctx->boundary != NULL && mm_context_iscomposite(ctx)) {
tmp_size = strlen(ctx->boundary) + (strlen("\r\n") * 2)
+ (strlen("--") * 2);
buf = (char *)xrealloc(message, message_size + tmp_size);
if (buf == NULL) {
goto cleanup;
}
message_size += tmp_size;
message = buf;
if (message[strlen(message)-1] != 13)
strlcat(message, "\r", message_size);
strlcat(message, "\n", message_size);
strlcat(message, "--", message_size);
strlcat(message, ctx->boundary, message_size);
strlcat(message, "--", message_size);
strlcat(message, "\r\n", message_size);
}
*flat = message;
*length = message_size;
return 0;
cleanup:
if (message != NULL) {
xfree(message);
message = NULL;
}
return -1;
}
/** @} */

269
main/minimime/mm_envelope.c Normal file
View File

@ -0,0 +1,269 @@
/*
* $Id$
*
* MiniMIME - a library for handling MIME messages
*
* Copyright (C) 2003 Jann Fischer <rezine@mistrust.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the author nor the names of the contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY JANN FISCHER AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL JANN FISCHER OR THE VOICES IN HIS HEAD
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>
#include "mm_internal.h"
#include "mm_util.h"
/** @file mm_envelope.c
*
* This module contains functions for accessing a message's envelope. This
* are mainly wrapper functions for easy access.
*/
/** @defgroup envelope Accessing and manipulating a message's envelope
*/
/** @{
* @name Accessing and manipulating a message's envelope
*/
/**
* Gets an ASCII representation of all envelope headers
*
* @param ctx A valid MiniMIME context
* @param result Where to store the resulting ASCII headers
* @param length Where to store the length of the result
* @returns 0 on success or -1 on failure.
* @note Sets mm_errno on failure
*
* This is mainly a convinience function. It constructs an ASCII representation
* from all of the message's envelope headers and stores the result in headers.
* Memory is allocated dynamically, and the total length of the result is
* stored in length. This function takes care that the output is MIME conform,
* and folds long lines according to the MIME standard at position 78 of the
* string. It also nicely formats all MIME related header fields, such as
* the Content-Type header.
*
* Since the memory needed to store the result is allocated dynamically, one
* should take care of freeing it again when it's not needed anymore. If an
* error occurs, *result will be set to NULL, *length will be set to zero
* and mm_errno will be set to a reasonable value.
*
*/
int
mm_envelope_getheaders(MM_CTX *ctx, char **result, size_t *length)
{
struct mm_mimepart *part;
struct mm_mimeheader *hdr;
char *buf, *hdrbuf;
size_t headers_length, tmp_length;
headers_length = 1;
buf = NULL;
part = mm_context_getpart(ctx, 0);
if (part == NULL) {
return -1;
}
/* Initialize our buffer */
if ((buf = (char *)xmalloc(headers_length)) == NULL) {
mm_errno = MM_ERROR_ERRNO;
goto cleanup;
}
*buf = '\0';
/* Store each envelope header */
TAILQ_FOREACH(hdr, &part->headers, next) {
tmp_length = strlen(hdr->name) + strlen(hdr->value)
+ strlen(": \r\n");
hdrbuf = (char *) xrealloc(buf, headers_length + tmp_length);
if (hdrbuf == NULL) {
mm_errno = MM_ERROR_ERRNO;
goto cleanup;
}
headers_length += tmp_length;
buf = hdrbuf;
strlcat(buf, hdr->name, headers_length);
strlcat(buf, ": ", headers_length);
strlcat(buf, hdr->value, headers_length);
strlcat(buf, "\r\n", headers_length);
}
/* Construct and store MIME headers */
if (part->type != NULL) {
char *typebuf;
typebuf = mm_content_tostring(part->type);
if (typebuf == NULL) {
goto cleanup;
}
tmp_length = strlen(typebuf) + strlen("\r\n");
hdrbuf = (char *) xrealloc(buf, headers_length + tmp_length);
if (hdrbuf == NULL) {
mm_errno = MM_ERROR_ERRNO;
goto cleanup;
}
headers_length += tmp_length;
buf = hdrbuf;
strlcat(buf, typebuf, headers_length);
strlcat(buf, "\r\n", headers_length);
}
*result = buf;
*length = headers_length;
return 0;
cleanup:
if (buf != NULL) {
xfree(buf);
buf = NULL;
}
*result = NULL;
*length = 0;
return -1;
}
/**
* Sets a header field in the envelope
*
* @param ctx A valid MiniMIME context
* @param name The name of the header field to set
* @param fmt A format string specifying the value of the header field
* @return 0 on success or -1 on failure
*
* This function generates a new MIME header and attaches it to the first
* MIME part (the envelope) found in the given context. If no part is
* attached already, the function will return an error. The function will
* store a copy of ``name'' as the header's name field, and dynamically
* allocate the memory needed to build the format string.
*/
int
mm_envelope_setheader(MM_CTX *ctx, const char *name, const char *fmt, ...)
{
va_list ap;
char *buf;
struct mm_mimeheader *hdr;
struct mm_mimepart *part;
part = mm_context_getpart(ctx, 0);
if (part == NULL) {
return(-1);
}
hdr = mm_mimeheader_new();
if (hdr == NULL) {
return(-1);
}
hdr->name = xstrdup(name);
va_start(ap, fmt);
if (vasprintf(&buf, fmt, ap) == -1) {
goto cleanup;
}
va_end(ap);
hdr->value = buf;
if (mm_mimepart_attachheader(part, hdr) == -1) {
goto cleanup;
}
return(0);
cleanup:
if (hdr != NULL) {
if (hdr->name != NULL) {
xfree(hdr->name);
hdr->name = NULL;
}
if (hdr->value != NULL) {
xfree(hdr->value);
hdr->value = NULL;
}
}
return(-1);
}
/**
* Gets the list of recipients for a MIME message
*
* @param ctx A valid MiniMIME context
* @param result Where to store the result
* @param length Where to store the length of the result
* @returns 0 on success or -1 on error
* @note Sets mm_errno on error
*
* This functions gets the list of recipients for a given MIME message. It
* does so by concatenating the "From" and "Cc" header fields, and storing
* the results in recipients. The memory needed to store the result is
* allocated dynamically, and the total length of the result is stored in
* length.
*
* One should take care to free() the result once it's not needed anymore.
*/
int
mm_envelope_getrecipients(MM_CTX *ctx, char **result, size_t *length)
{
struct mm_mimepart *part;
struct mm_mimeheader *to, *cc;
size_t recipients_length;
part = mm_context_getpart(ctx, 0);
if (part == NULL) {
return -1;
}
to = mm_mimepart_getheaderbyname(part, "From", 0);
cc = mm_mimepart_getheaderbyname(part, "Cc", 0);
if (to == NULL || cc == NULL) {
*result = NULL;
*length = 0;
return -1;
}
if (to != NULL) {
recipients_length += strlen(to->value);
}
if (cc != NULL) {
recipients_length += strlen(cc->value);
}
return 0;
}
/** @} */

123
main/minimime/mm_error.c Normal file
View File

@ -0,0 +1,123 @@
/*
* $Id$
*
* MiniMIME - a library for handling MIME messages
*
* Copyright (C) 2003 Jann Fischer <rezine@mistrust.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the author nor the names of the contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY JANN FISCHER AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL JANN FISCHER OR THE VOICES IN HIS HEAD
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include "mm_internal.h"
#include "mm_util.h"
/** @file mm_error.c
*
* This module contains functions for MiniMIME error information/manipulation
*/
/** @defgroup error MiniMIME error functions */
/**
* Initializes the global error object
*
* @ingroup error
*
* This function initializes the global error object mm_error. This must be
* done when the library is initialized, and is automatically called from
* mm_init_library().
*/
void
mm_error_init(void)
{
mm_error.error_id = 0;
mm_error.error_where = 0;
mm_error.lineno = 0;
memset(&mm_error.error_msg, '\0', sizeof(mm_error.error_msg));
}
/**
* Sets a descriptive error message
*
* @param fmt The error message as format string
* @ingroup error
*
* This function is called from the various MiniMIME modules in case an
* error occured. Should never be called by the user.
*/
void
mm_error_setmsg(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vsnprintf(mm_error.error_msg, sizeof(mm_error.error_msg), fmt, ap);
va_end(ap);
}
void
mm_error_setlineno(int lineno)
{
mm_error.lineno = lineno;
}
/**
* Retrieves the current error message
*
* @return The currently set error message
* @ingroup error
*
* This function can be used to retrieve a descriptive error message for the
* current error, much like strerror() function of libc. When this function
* is called without an error being set, it returns the string "No error".
* The string returned does not need to be freed, since it is not dynamically
* allocated by the library.
*/
char *
mm_error_string(void)
{
if (mm_errno != MM_ERROR_ERRNO && mm_error.error_msg[0] == '\0') {
return "No error";
} else if (mm_errno == MM_ERROR_ERRNO) {
return strerror(errno);
} else {
return mm_error.error_msg;
}
}
int
mm_error_lineno(void)
{
return mm_error.lineno;
}

213
main/minimime/mm_header.c Normal file
View File

@ -0,0 +1,213 @@
/*
* $Id$
*
* MiniMIME - a library for handling MIME messages
*
* Copyright (C) 2003 Jann Fischer <rezine@mistrust.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the author nor the names of the contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY JANN FISCHER AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL JANN FISCHER OR THE VOICES IN HIS HEAD
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>
#include "mm_internal.h"
#include "mm_util.h"
/** @file mm_header.c
*
* This module contains functions for manipulating MIME headers
*/
/**
* Creates a new MIME header object
*
* @return A new and initialized MIME header object
* @see mm_mimeheader_free
*
* This function creates and initializes a new MIME header object, which must
* later be freed using mm_mimeheader_free()
*/
struct mm_mimeheader *
mm_mimeheader_new(void)
{
struct mm_mimeheader *header;
header = (struct mm_mimeheader *)xmalloc(sizeof(struct mm_mimeheader));
header->name = NULL;
header->value = NULL;
TAILQ_INIT(&header->params);
return header;
}
/**
* Frees a MIME header object
*
* @param header The MIME header object which to free
*/
void
mm_mimeheader_free(struct mm_mimeheader *header)
{
struct mm_param *param;
assert(header != NULL);
if (header->name != NULL) {
xfree(header->name);
header->name = NULL;
}
if (header->value != NULL) {
xfree(header->value);
header->value = NULL;
}
TAILQ_FOREACH(param, &header->params, next) {
TAILQ_REMOVE(&header->params, param, next);
mm_param_free(param);
}
xfree(header);
header = NULL;
}
/**
* Creates a new MIME header, but does no checks whatsoever (create as-is)
*/
struct mm_mimeheader *
mm_mimeheader_generate(const char *name, const char *value)
{
struct mm_mimeheader *header;
header = mm_mimeheader_new();
header->name = xstrdup(name);
header->value = xstrdup(value);
return header;
}
/**
* Attaches a parameter to a MimeHeader object
*
* @param hdr The target MimeHeader object
* @param param The parameter to attach
* @return 0 on success and -1 on failure
* @ingroup mimeheader
*/
int
mm_mimeheader_attachparam(struct mm_mimeheader *hdr, struct mm_param *param)
{
assert(hdr != NULL);
assert(param != NULL);
if (TAILQ_EMPTY(&hdr->params)) {
TAILQ_INSERT_HEAD(&hdr->params, param, next);
} else {
TAILQ_INSERT_TAIL(&hdr->params, param, next);
}
return 0;
}
/**
* Gets a parameter value from a MimeHeader object.
*
* @param hdr the MimeHeader object
* @param name the name of the parameter to retrieve
* @return The value of the parameter on success or a NULL pointer on failure
* @ingroup mimeheader
*/
char *
mm_mimeheader_getparambyname(struct mm_mimeheader *hdr, const char *name)
{
struct mm_param *param;
assert(hdr != NULL);
TAILQ_FOREACH(param, &hdr->params, next) {
if (!strcasecmp(param->name, name)) {
return param->value;
}
}
return NULL;
}
int
mm_mimeheader_uncomment(struct mm_mimeheader *header)
{
char *new;
assert(header != NULL);
assert(header->name != NULL);
assert(header->value != NULL);
new = mm_uncomment(header->value);
if (new == NULL)
return -1;
xfree(header->value);
header->value = new;
return 0;
}
int
mm_mimeheader_uncommentbyname(struct mm_mimepart *part, const char *name)
{
struct mm_mimeheader *header;
TAILQ_FOREACH(header, &part->headers, next) {
if (!strcasecmp(header->name, name)) {
return mm_mimeheader_uncomment(header);
}
}
/* Not found */
return -1;
}
int
mm_mimeheader_uncommentall(struct mm_mimepart *part)
{
struct mm_mimeheader *header;
int ret, r;
ret = 0;
TAILQ_FOREACH(header, &part->headers, next) {
if ((r = mm_mimeheader_uncomment(header)) == -1) {
ret = -1;
}
}
return ret;
}

65
main/minimime/mm_init.c Normal file
View File

@ -0,0 +1,65 @@
/*
* $Id$
*
* MiniMIME - a library for handling MIME messages
*
* Copyright (C) 2003 Jann Fischer <rezine@mistrust.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the author nor the names of the contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY JANN FISCHER AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL JANN FISCHER OR THE VOICES IN HIS HEAD
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "mm_internal.h"
int mm_errno;
struct mm_error_data mm_error;
static int mm_initialized;
struct mm_codecs codecs;
int
mm_library_init(void)
{
assert(mm_initialized != 1);
mm_errno = MM_ERROR_NONE;
mm_initialized = 1;
SLIST_INIT(&codecs);
mm_error_init();
return 0;
}
int
mm_library_isinitialized(void)
{
return mm_initialized;
}

View File

@ -0,0 +1,65 @@
/*
* $Id$
*
* MiniMIME - a library for handling MIME messages
*
* Copyright (C) 2003 Jann Fischer <rezine@mistrust.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the author nor the names of the contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY JANN FISCHER AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL JANN FISCHER OR THE VOICES IN HIS HEAD
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
/** @file mm_internal.h
* Data definitions for MiniMIME
*/
#ifndef _MM_INTERNAL_H_INCLUDED
#define _MM_INTERNAL_H_INCLUDED
#include "mm.h"
#define debugp(m, ...) do { \
fprintf(stderr, "%s:%d:: ", __FILE__, __LINE__); \
fprintf(stderr, m, ## __VA_ARGS__); \
fprintf(stderr, "\n"); \
fflush(stderr); \
} while (0);
/**
* @{
* @name Utility functions
*/
#ifndef __HAVE_LEAK_DETECTION
void *xmalloc(size_t);
void *xrealloc(void *, size_t);
void xfree(void *);
char *xstrdup(const char *);
#endif
char *xstrsep(char **, const char *);
/* THIS FILE IS INTENTIONALLY LEFT BLANK */
#endif /* ! _MM_INTERNAL_H_INCLUDED */

171
main/minimime/mm_mem.c Normal file
View File

@ -0,0 +1,171 @@
/*
* $Id$
*
* MiniMIME - a library for handling MIME messages
*
* Copyright (C) 2003 Jann Fischer <rezine@mistrust.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the author nor the names of the contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY JANN FISCHER AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL JANN FISCHER OR THE VOICES IN HIS HEAD
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/types.h>
#include <sys/param.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <err.h>
#include <assert.h>
#include "mm_internal.h"
#ifdef __HAVE_LEAK_DETECTION
# include "mm_mem.h"
static struct MM_chunks chunks;
void *
MM_malloc(size_t size, char *filename, int line)
{
struct MM_mem_chunk *chunk;
void *pointer;
pointer = malloc(size);
if (pointer == NULL)
err(1, "malloc");
chunk = (struct MM_mem_chunk *)malloc(sizeof(struct MM_mem_chunk));
if (chunk == NULL)
err(1, "malloc");
chunk->address = pointer;
chunk->size = size;
chunk->filename = filename;
chunk->line = line;
TAILQ_INSERT_TAIL(&chunks, chunk, next);
return pointer;
}
char *
MM_strdup(const char *s, char *filename, int line)
{
char *r;
r = (char *)MM_malloc(strlen(s)+1, filename, line);
strlcpy(r, s, strlen(s) + 1);
if (strlen(r) != strlen(s)) {
debugp("%d:%d", strlen(s), strlen(r));
}
return r;
}
void *
MM_realloc(void *p, size_t new_size, char *filename, int line)
{
void *r;
void *a;
struct MM_mem_chunk *chunk;
struct MM_mem_chunk *last;
a = p;
chunk = NULL;
last = NULL;
assert(new_size > 0);
TAILQ_FOREACH(chunk, &chunks, next) {
if (chunk->address == p) {
last = chunk;
}
}
if (last == NULL) {
debugp("MM_realloc: did not find chunk at %p (%s:%d) "
", creating new", p, filename, line);
return MM_malloc(new_size, filename, line);
}
r = realloc(p, new_size);
if (r == NULL)
return NULL;
last->address = r;
last->size = new_size;
last->filename = filename;
last->line = line;
return r;
}
void
MM_free(void *pointer, char *filename, int line, char *name)
{
struct MM_mem_chunk *chunk, *nxt;
for (chunk = TAILQ_FIRST(&chunks); chunk != TAILQ_END(&chunks);
chunk = nxt) {
nxt = TAILQ_NEXT(&chunks, next);
if (chunk->address == pointer) {
TAILQ_REMOVE(&chunks, chunk, next);
free(chunk->address);
free(chunk);
return;
}
}
debugp("FREE: did not find storage %s (at %p), %s:%d", name, pointer,
filename, line);
}
void
MM_leakd_flush(void)
{
debugp("flushing memory informations");
while (!TAILQ_EMPTY(&chunks))
SLIST_REMOVE_HEAD(&chunks, next);
}
void
MM_leakd_printallocated(void)
{
struct MM_mem_chunk *chunk;
debugp("printing dynamic memory allocations");
TAILQ_FOREACH(chunk, &chunks, next) {
debugp(" chunk: %p (alloc'ed at %s:%d, size %d)\n",
chunk->address, chunk->filename, chunk->line, chunk->size);
}
}
void
MM_leakd_init(void)
{
TAILQ_INIT(&chunks);
}
#endif /* !__HAVE_LEAK_DETECTOR */

32
main/minimime/mm_mem.h Normal file
View File

@ -0,0 +1,32 @@
#ifndef __MEM_H
#define __MEM_H
#ifdef __HAVE_LEAK_DETECTION
#define NAMEOF(v) #v
#define xmalloc(x) MM_malloc(x, __FILE__, __LINE__)
#define xfree(x) MM_free(x, __FILE__, __LINE__, NAMEOF(x))
#define xstrdup(x) MM_strdup(x, __FILE__, __LINE__)
#define xrealloc(x, y) MM_realloc(x, y, __FILE__, __LINE__)
TAILQ_HEAD(MM_chunks, MM_mem_chunk);
struct MM_mem_chunk {
void *address;
const char *filename;
u_int32_t line;
size_t size;
TAILQ_ENTRY(MM_mem_chunk) next;
};
void *MM_malloc(size_t, char *, int);
void *MM_realloc(void *, size_t, char *, int);
void MM_free(void *, char *, int, char *);
char *MM_strdup(const char *, char *, int);
void MM_leakd_init(void);
void MM_leakd_printallocated(void);
void MM_leakd_flush(void);
#endif /* __HAVE_LEAK_DETECTION */
#endif /* ! HAVE_MEM_H */

657
main/minimime/mm_mimepart.c Normal file
View File

@ -0,0 +1,657 @@
/*
* $Id$
*
* MiniMIME - a library for handling MIME messages
*
* Copyright (C) 2003 Jann Fischer <rezine@mistrust.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the author nor the names of the contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY JANN FISCHER AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL JANN FISCHER OR THE VOICES IN HIS HEAD
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <ctype.h>
#include <assert.h>
#include "mm_internal.h"
/** @file mm_mimepart.c
*
* This module contains functions for manipulating MIME header objects.
*/
/** @defgroup mimepart Accessing and manipulating MIME parts
*
* MIME parts, also called entities, represent the structure of a MIME
* message. ``Normal'' internet messages have only a single part, and
* are called ``flat'' messages. Multipart messages have more then one
* part, and each MIME part can have it's own subset of headers.
*
* Provided here are functions to easily access all informations from
* a MIME part, including their specific headers and bodies.
*/
/** @{
* @name Creating and destroying MIME parts
*/
/**
* Allocates memory for a new mm_mimepart structure and initializes it.
*
* @return A pointer to a struct of type mm_mimeheader or NULL on failure
* @see mm_mimepart_free
* @note The memory must be freed by using mm_mimepart_free() later on.
*/
struct mm_mimepart *
mm_mimepart_new(void)
{
struct mm_mimepart *part;
part = (struct mm_mimepart *)xmalloc(sizeof(struct mm_mimepart));
TAILQ_INIT(&part->headers);
part->opaque_length = 0;
part->opaque_body = NULL;
part->length = 0;
part->body = NULL;
part->type = NULL;
return part;
}
/**
* Creates a MIME part from a file
*
* @param filename The name of the file to create the MIME part from
* @return A pointer to a new MIME part object
*
* This function creates a new MIME part object from a file. The object should
* be freed using mm_mimepart_free() later on. This function does NOT set the
* Content-Type and neither does any encoding work.
*/
struct mm_mimepart *
mm_mimepart_fromfile(const char *filename)
{
int fd;
char *data;
size_t r;
struct stat st;
struct mm_mimepart *part;
mm_errno = MM_ERROR_NONE;
if ((fd = open(filename, O_RDONLY)) == -1) {
mm_errno = MM_ERROR_ERRNO;
return NULL;
}
if ((stat(filename, &st)) == -1) {
mm_errno = MM_ERROR_ERRNO;
close(fd);
return NULL;
}
data = xmalloc(st.st_size);
r = read(fd, data, st.st_size);
if (r != st.st_size) {
mm_errno = MM_ERROR_ERRNO;
close(fd);
return(NULL);
}
data[r] = '\0';
close(fd);
part = mm_mimepart_new();
part->length = r;
part->body = data;
return part;
}
/**
* Frees all memory allocated by a mm_mimepart object.
*
* @param part A pointer to an allocated mm_mimepart object
* @see mm_mimepart_new
*/
void
mm_mimepart_free(struct mm_mimepart *part)
{
struct mm_mimeheader *header;
assert(part != NULL);
TAILQ_FOREACH(header, &part->headers, next) {
mm_mimeheader_free(header);
TAILQ_REMOVE(&part->headers, header, next);
}
if (part->opaque_body != NULL) {
xfree(part->opaque_body);
part->opaque_body = NULL;
part->body = NULL;
} else if (part->body != NULL) {
xfree(part->body);
part->body = NULL;
}
if (part->type != NULL) {
mm_content_free(part->type);
part->type = NULL;
}
xfree(part);
part = NULL;
}
/** @} */
/** @{
* @name Accessing the MIME part's mail header
*/
/**
* Attaches a mm_mimeheader object to a MIME part
*
* @param part A valid MIME part object
* @param header A valid MIME header object
* @return 0 if successfull or -1 if the header could not be attached
*/
int
mm_mimepart_attachheader(struct mm_mimepart *part, struct mm_mimeheader *header)
{
assert(part != NULL);
assert(header != NULL);
if (TAILQ_EMPTY(&part->headers)) {
TAILQ_INSERT_HEAD(&part->headers, header, next);
} else {
TAILQ_INSERT_TAIL(&part->headers, header, next);
}
return(0);
}
/**
* Retrieves the number of MIME headers available in a MIME part
*
* @param part A valid MIME part object
* @return The number of MIME headers within the MIME part
*/
int
mm_mimepart_countheaders(struct mm_mimepart *part)
{
int found;
struct mm_mimeheader *header;
assert(part != NULL);
found = 0;
TAILQ_FOREACH(header, &part->headers, next) {
found++;
}
return found;
}
/**
* Retrieves the number of MIME headers with a given name in a MIME part
*
* @param part A valid MIME part object
* @param name The name of the MIME header which to count for
* @return The number of MIME headers within the MIME part
*/
int
mm_mimepart_countheaderbyname(struct mm_mimepart *part, const char *name)
{
int found;
struct mm_mimeheader *header;
assert(part != NULL);
found = 0;
TAILQ_FOREACH(header, &part->headers, next) {
if (strcasecmp(header->name, name) == 0) {
found++;
}
}
return found;
}
/**
* Get a MIME header object from a MIME part
*
* @param part A valid MIME part object
* @param name The name of the MIME header which to retrieve
* @param idx Which header field to get (in case of multiple headers of the
* same name).
* @return A pointer to the requested MIME header on success, or NULL if there
* either isn't a header with the requested name or idx is out of
* range.
*/
struct mm_mimeheader *
mm_mimepart_getheaderbyname(struct mm_mimepart *part, const char *name, int idx)
{
struct mm_mimeheader *header;
int curidx;
curidx = 0;
TAILQ_FOREACH(header, &part->headers, next) {
if (!strcasecmp(header->name, name)) {
if (curidx == idx)
return header;
else
curidx++;
}
}
/* Not found */
return NULL;
}
/**
* Gets the value of a MIME header object
*
* @param part A valid MIME part object
* @param name The name of the header field to get the value from
* @param idx The index of the header field to get, in case there are multiple
* headers with the same name.
* @return A pointer to the requested value on success, or NULL if there either
* isn't a header with the requested name or idx is out of range.
*
*/
const char *
mm_mimepart_getheadervalue(struct mm_mimepart *part, const char *name, int idx)
{
struct mm_mimeheader *header;
header = mm_mimepart_getheaderbyname(part, name, idx);
if (header == NULL)
return NULL;
else
return header->value;
}
/**
* Initializes a header loop for a given MIME part
*
* @param part A valid MIME part object
* @param id The address of a MIME header object (to allow reentrance)
* @return 0 on success or -1 on failure
* @see mm_mimepart_headers_next
*
* Looping through headers can be done in the following way:
*
* @code
* struct mm_mimeheader *header, *lheader;
*
* mm_mimepart_headers_start(part, &lheader);
*
* while ((header = mm_mimepart_headers_next(part, &lheader)) != NULL) {
* printf("%s: %s\n", header->name, header->value);
* }
*
* @endcode
*
* For convienience, the macro mm_mimepart_headers_foreach() can be used to
* loop through headers in a one-shot manner.
*/
int
mm_mimepart_headers_start(struct mm_mimepart *part, struct mm_mimeheader **id)
{
assert(part != NULL);
if (TAILQ_EMPTY(&part->headers)) {
return -1;
}
*id = NULL;
return 0;
}
/**
* Returns the next MIME header of a given MIME part object
*
* @param part A valid MIME part object
* @param id A previously initialized MIME header object
* @return A pointer to the MIME header object or NULL if end of headers was
* reached.
* @see mm_mimepart_headers_start
*/
struct mm_mimeheader *
mm_mimepart_headers_next(struct mm_mimepart *part, struct mm_mimeheader **id)
{
struct mm_mimeheader *header;
assert(part != NULL);
if (*id == NULL) {
header = TAILQ_FIRST(&part->headers);
} else {
header = TAILQ_NEXT(*id, next);
}
*id = header;
return header;
}
/** @} */
/** @{
* @name Accessing and manipulating the MIME part's body
*/
/**
* Gets the pointer to the MIME part's body data
*
* @param part A valid MIME part object
* @param opaque Whether to get the opaque part or not
* @return A pointer to the MIME part's body
* @see mm_mimepart_setbody
*
*/
char *
mm_mimepart_getbody(struct mm_mimepart *part, int opaque)
{
assert(part != NULL);
if (opaque)
return part->opaque_body;
else
return part->body;
}
/**
* Sets the MIME part's body data
*
* @param part A valid MIME part object
* @param data A pointer to the data which to set
* @see mm_mimepart_getbody
*
* This functions sets the body data for a given MIME part. The string pointed
* to by data must be NUL-terminated. The data is copied into the MIME part's
* body, and thus, the memory pointed to by data can be freed after the
* operation.
*/
void
mm_mimepart_setbody(struct mm_mimepart *part, const char *data, int opaque)
{
assert(part != NULL);
assert(data != NULL);
if (opaque) {
part->opaque_body = xstrdup(data);
part->body = part->opaque_body;
} else {
part->body = xstrdup(data);
}
part->length = strlen(data);
}
/**
* Gets the length of a given MIME part object
*
* @param part A valid MIME part object
* @returns The size of the part's body in byte.
*
* This function returns the total length of the given MIME part's body. The
* length does not include the headers of the MIME parts. If the function
* returns 0, no body part is set currently.
*/
size_t
mm_mimepart_getlength(struct mm_mimepart *part)
{
assert(part != NULL);
return part->length;
}
/**
* Decodes a MIME part according to it's encoding using MiniMIME codecs
*
* @param A valid MIME part object
* @return 0 if the MIME part could be successfully decoded or -1 if not
* @note Sets mm_errno on error
*
* This function decodes the body of a MIME part with a registered decoder
* according to it's Content-Transfer-Encoding header field.
*/
char *
mm_mimepart_decode(struct mm_mimepart *part)
{
extern struct mm_codecs codecs;
struct mm_codec *codec;
void *decoded;
assert(part != NULL);
assert(part->type != NULL);
decoded = NULL;
/* No encoding associated */
if (part->type->encstring == NULL)
return NULL;
/* Loop through codecs and find a suitable one */
SLIST_FOREACH(codec, &codecs, next) {
if (!strcasecmp(part->type->encstring, codec->encoding)) {
decoded = codec->decoder((char *)part->body);
break;
}
}
return decoded;
}
/**
* Creates an ASCII representation of the given MIME part
*
* @param part A valid MIME part object
* @param result Where to store the result
* @param length Where to store the length of the result
* @param opaque Whether to use the opaque MIME part
* @returtn 0 on success or -1 on error.
* @see mm_context_flatten
*
* This function creates an ASCII representation of a given MIME part. It will
* dynamically allocate the memory needed and stores the result in the memory
* region pointed to by result. The length of the result will be stored in
* length. If opaque is set to 1, mm_mimepart_flatten will store an opaque
* version of the MIME part in result, which means no headers will be created
* or sanitized. This is particulary useful if the part is digitally signed by
* e.g. PGP, and the signature spans the header fields of the part in question.
*
*/
int
mm_mimepart_flatten(struct mm_mimepart *part, char **result, size_t *length,
int opaque)
{
size_t part_length;
char *buf;
char *ct_hdr;
*result = NULL;
*length = 0;
buf = NULL;
ct_hdr = NULL;
part_length = 0;
if (opaque && part->opaque_body != NULL) {
part_length = strlen(part->opaque_body);
*result = xstrdup(part->opaque_body);
*length = part_length;
return(0);
} else {
if (part->type == NULL) {
return(-1);
}
ct_hdr = mm_content_tostring(part->type);
if (ct_hdr == NULL) {
return(-1);
}
part_length += strlen(ct_hdr) + 2;
part_length += strlen("\r\n") * 2;
part_length += strlen(part->body);
if (part_length < 0) {
goto cleanup;
}
buf = (char *) xmalloc(part_length);
if (buf == NULL) {
goto cleanup;
}
snprintf(buf, part_length,
"%s\r\n\r\n%s\r\n",
ct_hdr,
part->body);
xfree(ct_hdr);
ct_hdr = NULL;
*result = buf;
*length = part_length;
}
return(0);
cleanup:
if (ct_hdr != NULL) {
xfree(ct_hdr);
ct_hdr = NULL;
}
if (buf != NULL) {
xfree(buf);
buf = NULL;
}
*result = NULL;
*length = 0;
return -1;
}
/**
* Sets the default Content-Type for a given MIME part
*
* @param part A valid MIME part object
* @param part Whether the Content-Type should be for composite or not
* @return 0 on success or -1 on failure
*
* This function sets a default Content-Type according to RFC 2045 with a value
* of "text/plain; charset="us-ascii"". This function should only be used if
* the MIME part in question does not have a valid Content-Type specification.
*/
int
mm_mimepart_setdefaultcontenttype(struct mm_mimepart *part, int composite)
{
struct mm_content *type;
struct mm_param *param;
if (part == NULL) {
return(-1);
}
if (part->type != NULL) {
mm_content_free(part->type);
part->type = NULL;
}
type = mm_content_new();
if (composite) {
type->maintype = xstrdup("multipart");
type->subtype = xstrdup("mixed");
} else {
type->maintype = xstrdup("text");
type->subtype = xstrdup("plain");
param = mm_param_new();
param->name = xstrdup("charset");
param->value = xstrdup("us-ascii");
mm_content_attachtypeparam(type, param);
}
mm_mimepart_attachcontenttype(part, type);
return (0);
}
/** @{
* @name Accessing the MIME part's Content-Type information
*/
/**
* Attaches a context type object to a MIME part
*
* @param part A valid MIME part object
* @param ct The content type object to attach
* @return Nothing
*
* This function attaches a Content-Type object to a MIME part. It does not
* care whether the Content-Type suites the actual content in the MIME part,
* so the programmer should take care of that.
*/
void
mm_mimepart_attachcontenttype(struct mm_mimepart *part, struct mm_content *ct)
{
part->type = ct;
}
/**
* Gets the Content-Type of a given MIME part object
*
* @param part A valid MIME part object
* @return The Content-Type object of the specified MIME part
*
* This function returns a pointer to the Content-Type object of the given
* MIME part. This pointer might be set to NULL, indicating that there is
* no Content-Type object for the given MIME part currently.
*/
struct mm_content *
mm_mimepart_getcontent(struct mm_mimepart *part)
{
assert(part != NULL);
return part->type;
}
/** @} */

Some files were not shown because too many files have changed in this diff Show More