Accessing and manipulating Content-Type objects


Functions for manipulating Content-Type objects

mm_content * mm_content_new (void)
void mm_content_free (struct mm_content *ct)
int mm_content_attachparam (struct mm_content *ct, struct mm_param *param)
char * mm_content_getparambyname (struct mm_content *ct, const char *name)
mm_param * mm_content_getparamobjbyname (struct mm_content *ct, const char *name)
int mm_content_setmaintype (struct mm_content *ct, char *value, int copy)
char * mm_content_getmaintype (struct mm_content *ct)
char * mm_content_getsubtype (struct mm_content *ct)
char * mm_content_gettype (struct mm_content *ct)
int mm_content_setsubtype (struct mm_content *ct, char *value, int copy)
int mm_content_settype (struct mm_content *ct, const char *fmt,...)
int mm_content_iscomposite (struct mm_content *ct)
int mm_content_isvalidencoding (const char *encoding)
int mm_content_setencoding (struct mm_content *ct, const char *encoding)
int mm_content_getencoding (struct mm_content *ct, const char *encoding)
char * mm_content_paramstostring (struct mm_content *ct)
char * mm_content_tostring (struct mm_content *ct)

Variables

int mm_encoding_mappings::type

Function Documentation

int mm_content_attachparam ( struct mm_content *  ct,
struct mm_param *  param 
)

Attaches a parameter to a Content-Type object

Parameters:
ct The target Content-Type object
param The Content-Type parameter which to attach
Returns:
0 on success and -1 on failure

void mm_content_free ( struct mm_content *  ct  ) 

Releases all memory associated with an Content-Type object

Parameters:
ct A Content-Type object
Returns:
Nothing

int mm_content_getencoding ( struct mm_content *  ct,
const char *  encoding 
)

Gets the numerical ID of a content encoding identifier

Parameters:
ct A valid Content Type object
encoding A string representing the content encoding identifier
Returns:
The numerical ID of the content encoding

char* mm_content_getmaintype ( struct mm_content *  ct  ) 

Retrieves the main MIME type stored in a Content-Type object

Parameters:
ct A valid Content-Type object
Returns:
A pointer to the string representing the main type

char* mm_content_getparambyname ( struct mm_content *  ct,
const char *  name 
)

Gets a parameter value from a Content-Type object.

Parameters:
ct the Content-Type object
name the name of the parameter to retrieve
Returns:
The value of the parameter on success or a NULL pointer on failure

char* mm_content_getsubtype ( struct mm_content *  ct  ) 

Retrieves the sub MIME type stored in a Content-Type object

Parameters:
ct A valid Content-Type object
Returns:
A pointer to the string holding the current sub MIME type

int mm_content_iscomposite ( struct mm_content *  ct  ) 

Checks whether the Content-Type represents a composite message or not

Parameters:
ct A valid Content-Type object
Returns:
1 if the Content-Type object represents a composite message or 0 if not.

int mm_content_isvalidencoding ( const char *  encoding  ) 

Verifies whether a string represents a valid encoding or not.

Parameters:
encoding The string to verify
Returns:
1 if the encoding string is valid or 0 if not

struct mm_content* mm_content_new ( void   ) 

Creates a new object to hold a Content-Type representation. The allocated memory must later be freed using mm_content_free()

Returns:
An object representing a MIME Content-Type
See also:
mm_content_free

char* mm_content_paramstostring ( struct mm_content *  ct  ) 

Constructs a MIME conform string of Content-Type parameters.

Parameters:
ct A valid Content Type object
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.
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).

int mm_content_setencoding ( struct mm_content *  ct,
const char *  encoding 
)

Set the encoding of a MIME entitity according to a mapping table

Parameters:
ct A valid content type object
encoding A string representing the content encoding
Returns:
0 if successfull or -1 if not (i.e. unknown content encoding)

int mm_content_setmaintype ( struct mm_content *  ct,
char *  value,
int  copy 
)

Sets the MIME main type for a MIME Content-Type object

Parameters:
ct The MIME Content-Type object
value The value which to set the main type to
copy Whether to make a copy of the value (original value must be freed afterwards to prevent memory leaks).

Bug:
The xfree() call could lead to undesirable results. Do we really need it?

int mm_content_setsubtype ( struct mm_content *  ct,
char *  value,
int  copy 
)

Sets the MIME sub type for a MIME Content-Type object

Parameters:
ct The MIME Content-Type object
value The value which to set the sub type to
copy Whether to make a copy of the value (original value must be freed afterwards to prevent memory leaks).

Bug:
The xfree() call could lead to undesirable results. Do we really need it?

char* mm_content_tostring ( struct mm_content *  ct  ) 

Creates a Content-Type header according to the object given

Parameters:
ct A valid Content-Type object


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