Sun Java System Messaging Server 6 2005Q4 MTA Developer's Reference

Caller-Supplied Output Routine

To use a caller-supplied output routine, specify the MTA_DECODE_PROC for the output_type call argument, and pass the address of the output routine as the output argument.

This code fragment shows the syntax of a caller-supplied output routine.


int output_routine(void         *ctx,
                   mta_decode_t *dctx,
                   const char  **line,
                   size_t       *line_len);

The following table lists the arguments for a caller-supplied output routine, and gives a description of each.

Arguments  

Description  

ctx

The caller-supplied private context passed as ctx to mtaDecodeMessage().

dctx

A decode context created by mtaDecodeMessage(). This decode context should be used with calls to the other decode routines requiring a decode context. This context is automatically disposed of by mtaDecodeMessage().

line

Pointer to a line of the message to output. This line is not NULL terminated. The line will also lack any carriage return or line feed record terminators. 

line_len

The length in bytes of the message line to output. A length of 0 indicates a blank line. The maximum line length presented will be BIGALFA_SIZE bytes (1024 bytes).

Each line passed to the output routine represents a complete line of the message to be output. The output routine must add to the line any line terminators required by the output destination (for example, carriage return, line feed pairs if transmitting over the SMTP protocol, or line feed terminators if writing to a UNIX® text file). Supplying a value of zero for the output_type call argument, causes the output argument to be ignored. In this case no output routine will be used.