Accessing and manipulating MIME parameters


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 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.

mm_param * mm_param_new (void)
void mm_param_free (struct mm_param *param)
mm_param * mm_param_generate (const char *name, const char *value)
char * mm_param_setname (struct mm_param *param, const char *name, int copy)
char * mm_param_setvalue (struct mm_param *param, const char *value, int copy)
const char * mm_param_getname (struct mm_param *param)
const char * mm_param_getvalue (struct mm_param *param)

Function Documentation

void mm_param_free ( struct mm_param *  param  ) 

Releases all memory associated with a MIME parameter object.

Parameters:
param A valid MIME parameter object to be freed
Returns:
Nothing
See also:
mm_param_new

struct mm_param* mm_param_generate ( const char *  name,
const char *  value 
)

Generates a new Content-Type parameter with the given name and value

Parameters:
name The name of the MIME parameter
value The value of the MIME parameter
Returns:
A new MIME parameter object
See also:
mm_param_free

mm_param_new

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.

const char* mm_param_getname ( struct mm_param *  param  ) 

Gets the name of a MIME parameter object

Parameters:
param A valid MIME parameter object
Returns:
The name of the MIME parameter

const char* mm_param_getvalue ( struct mm_param *  param  ) 

Gets the value of a MIME parameter object

Parameters:
param A valid MIME parameter object
Returns:
The value of the MIME parameter

struct mm_param* mm_param_new ( void   ) 

Creates a new object to hold a MIME parameter.

Returns:
An object representing a MIME parameter
See also:
mm_param_free
Note:
The allocated memory must later be freed using mm_param_free()

char* mm_param_setname ( struct mm_param *  param,
const char *  name,
int  copy 
)

Sets the name of the given MIME parameter

Parameters:
param A valid MIME parameter object
name The new name of the parameter
copy If set to > 0, copy the value stored in name
Returns:
The address of the previous name for passing to free()

char* mm_param_setvalue ( struct mm_param *  param,
const char *  value,
int  copy 
)

Sets the value of the given MIME parameter

Parameters:
param A valid MIME parameter object
name The new value for the parameter
copy If set to > 0, copy the value stored in value
Returns:
The address of the previous value for passing to free()


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