| RoadRunner Reference Manual | |||
|---|---|---|---|
| <<< Previous Page | Home | Up | Next Page >>> |
struct RRMimePart {
GHashTable *headers;
gboolean multipart;
GSList *subparts;
gchar *body;
gsize body_len;
gboolean should_free;
gchar *multipart_type;
gchar *boundary;
gsize boundary_len;
}; |
RRMimePart* rr_mime_parse (const gchar *data, gsize len); |
Parse a MIME message.
| data : | mime data |
| len : | data length |
| Returns : | a newly created RRMimePart or NULL. |
RRMimePart* rr_mime_part_new (const gchar *type); |
Creates a new mime part and sets the "Content-Type" header to type
| type : | a mime content type |
| Returns : | A new mime part. |
RRMimePart* rr_mime_multipart_new (const gchar *type); |
Creates a new mime multi-part and sets the "Content-Type" header to type
| type : | a mime content type |
| Returns : | A new mime multi-part. |
gchar* rr_mime_part_to_string (RRMimePart *part); |
Allocates a new string containing the text representation of the mime part. The string is null terminated.
| part : | mime part |
| Returns : | a newly allocated string representation of the mime part. |
gsize rr_mime_part_render (RRMimePart *part, gchar *str); |
renders a string representation of part to the buffer str.
Note: The string isn't null terminated and buffer has to be at least rr_mime_part_to_string_len (part) bytes long.
| part : | mime part |
| str : | buffer to render to |
| Returns : | number of bytes written. |
gsize rr_mime_part_to_string_len (RRMimePart *part); |
calculate how long the string representation of the mime part will be in bytes.
| part : | mime part |
| Returns : | the number of bytes required. |
void rr_mime_part_set_header (RRMimePart *part, const gchar *name, const gchar *value); |
Set the mime header named name to value.
| part : | a mime part |
| name : | the header name to set |
| value : | the value to use |
gboolean rr_mime_part_has_header (RRMimePart *part, const gchar *name); |
Checks whether a header named name exists or not.
| part : |
|
| name : |
|
| Returns : | TRUE is the header exists else FALSE. |
const gchar* rr_mime_part_get_header (RRMimePart *part, const gchar *name); |
retrieves the value of a mime header
| part : | mime part |
| name : | header name |
| Returns : | the header value or NULL. |
const gchar* rr_mime_part_get_id (RRMimePart *part); |
| part : | mime part |
| Returns : | the header value or the "Content-ID" header. |
void rr_mime_part_set_unique_id (RRMimePart *part); |
Generates a world-unique Content-ID header
| part : |
void rr_mime_part_set_body (RRMimePart *part, gchar *data, gsize len, gboolean should_free); |
Sets the mime body to data.
| part : | mime part |
| data : | mime body string |
| len : | mime body length. |
| should_free : | determines if the data should be freed when the mime part is destroyed. |
const gchar* rr_mime_part_get_body (RRMimePart *part); |
the mime body
| part : | mime part |
| Returns : | a pointer to the mime body |
gsize rr_mime_part_get_body_len (RRMimePart *part); |
mime body length
| part : | mime part |
| Returns : | the mime body length |
void rr_mime_part_append (RRMimePart *part, RRMimePart *subpart); |
Appends subpart to part.
| part : | mime part |
| subpart : | the subpart to append. |
#define rr_mime_part_get_first(part) rr_mime_part_get_next (part, NULL) |
| part : |
|
RRMimePart* rr_mime_part_get_next (RRMimePart *part, RRMimePart *iter); |
Returns the mime part that comes after iter when doing a depth first search. iter of value NULL will result in the first non-multipart part to be returned.
| part : | a mime part |
| iter : | optional iterator |
| Returns : | a mime part or NULL. |
RRMimePart* rr_mime_part_find (RRMimePart *part, const gchar *content_id); |
Searches (depth first) for a (sub)part with a "Content-ID" header of value content_id.
| part : | a mime part |
| content_id : | identification string |
| Returns : | The first part found or NULL. |
RRMimePart* rr_mime_part_find_type (RRMimePart *part, const gchar *content_type, RRMimePart *iter); |
Searches (depth first) for a (sub)part with a "Content-Type" header of value content_type.
| part : | a mime part |
| content_type : | type to search for |
| iter : | start the search after this part. or NULL |
| Returns : | The first part found or NULL. |
void rr_mime_part_foreach (RRMimePart *part, RRMimeFunc func, gpointer user_data); |
iterates through and calls func on all subparts.
| part : | mime part |
| func : | callback function |
| user_data : | callback user_data |