NAME
immd_mime_decode - Decodes a MIME message
SYNOPSIS
#include <imta.h>
immd_mime_decode(immd_t md, void *param, void
(*output_header)(), void (*output_line)(), void
(*output_block)());
DESCRIPTION
immd_mime_decode() may be used to decode a MIME message
being dequeued with the dequeue context md. An example pro-
gram illustrating the use of this routine is given by the
file decode_mime_messages.c.
The message being dequeued must have its read point posi-
tioned at the start of the message's outer header. This will
be the case immediately after having retrieved the entire
list of recipients, or, after immd_get_recipient() has
returned 1, or immediately after calling immd_rewind().
The procedures referenced by output_header, output_line, and
output_block have the form:
int output_header(void *param, imhdr_t hdr, int part, int
depth, int index);
int output_line(void *param, const char *line, int
line_len);
int output_block(void *param, const char *data, int
data_len);
The arguments are as follows:
param Value passed to immd_mime_decode() for the param
argument.
hdr Pointer to a header structure containing the
header lines to output.
part Will have the value 2 if the message part asso-
ciated with the header is textual in nature and
the value 1 if the associated part is binary in
nature.
depth Nesting depth in the MIME structure for this
message part.
index Index for this part; first message part at depth
N has an index value of 1, second part at depth
N has an index value of 2, etc.
line Line of text output. This text comes from the
content of a non-binary message part. The line
is not null terminated.
line_len Length in bytes of the line of message text to
output.
data Raw binary data to output. This data comes from
the content of a binary data part. The data is
not null terminated and may contain nulls within
it.
data_len Length in bytes of the data to output.
These routines should return a value of IMTARC_OK if there
is more data to read and IMTARC_EOF if there is an error or
no further data to read.
RETURN VALUES
immd_mime_decode() return IMRC_OK when successful, and one
of the following error codes otherwise.
IMRC_BAD_CONTEXT
The dequeue context md has not been initialized
or has been corrupted. Make sure immd_init()
has been previously called.
A textual explanation of the failure can be obtained by cal-
ling imta_error() immediately afterwards.
ATTRIBUTES
_______________________________________
| Attribute Type | Attribute Value|
|____________________|_________________|
| Architecture | sparc, x86 |
|____________________|_________________|
| Availability | SUNWimsdk |
|____________________|_________________|
| MT-Level | MT-Safe |
|____________________|_________________|
| Interface Stability| Stable |
|____________________|_________________|
SEE ALSO
immd_init(3), immd_rewind(3), immd_get_recipient(3)