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

mtaAddressToChannel()

Determine which channel an address rewrites to.

Syntax


const char *mtaAddressToChannel(char       *channel,
                                size_t     *channel_len,
                                size_t      channel_len_max,
                                const char *address,
                                size_t      address_len,
                                int         address_type,
                                int         item_code, ...);

Arguments

Arguments  

Description  

channel

A pointer to a buffer to receive the NULL terminated channel name. To avoid possible truncation of the channel name, this buffer must be at least CHANLENGTH+1 bytes long.

channel_len

An optional pointer to a size_t to receive the length in bytes of the returned channel name. This length does not include the NULL terminator that terminates the channel name.

channel_len_max

The maximum size in bytes of the buffer pointed at by the channel argument.

address

The address to rewrite. The length of this address, not including any NULL terminator, should not exceed ALFA_SIZE bytes. If a value of 0 is passed for the address_len argument, then this string must be NULL terminated.

address_len

The length in bytes of the address string, address. This length does not include any NULL terminator. If a value of 0 is passed for this argument, the address string must be NULL terminated.

address_type

Indicates what type of address is being rewritten. There are two types: envelope or header. In addition it can be either forward or reverse pointing. See the description for a list of the possible values. 

item_code

Reserved for future use. Presently, a value of 0 must be supplied for this argument.

Description

Use this routine to determine which channel an address rewrites to. The address to be rewritten can be an envelope or header address, and can be forward or reverse pointing. The nature of the address is specified with the address_type argument. The following table lists the possible values for each combination: forward pointing envelope, reversing pointing envelope, forward pointing header, reverse pointing header:

Types of Address  

Value  

Forward pointing envelope address 

0, MTA_BCC, MTA_CC, MTA_ENV_TO, MTA_TO

Reverse pointing envelope address 

MTA_ENV_FROM

Forward pointing header address 

MTA_HDR_BCC, MTA_HDR_CC, MTA_HDR_TO

Reverse pointing header address 

MTA_HDR_FROM

In most cases, a value of MTA_ENV_TO is appropriate. Other values will typically give the same result, unless the MTA configuration has rewrite rules that are sensitive to the distinctions between the four types of addresses.

Return Values

On successful operation, the routine returns the value of the channel argument. In the event of an error, the value returned is NULL and the mta_errno variable is set with an error status code. The following table lists the error status codes and gives a description of each.

Error Status Codes  

Description  

MTA_BADARGS

There are two reasons to get this return value: 

  1. A NULL value was supplied for the address argument.

  2. An invalid value was supplied for the address_type.

MTA_FOPEN

Unable to initialize the MTA SDK; can’t read one or more configuration files. Issue the following command for further information: 

imsimta test -rewrite

MTA_NO

There are two reasons to get this return value: 

  1. Unable to rewrite the supplied address. Either the address is syntactically invalid, or it does not match any channel.

  2. Unable to initialize the MTA_SDK. Issue the following command for further information:

    imsimta test -rewrite

MTA_NOSUCHITEM

An invalid item code was specified. 

MTA_STRTRUERR

There are two reasons to get this return value: 

  1. Supplied address string is too long; length can not exceed ALFA_SIZE bytes.

  2. The supplied buffer to receive the channel name is too small.

Example

None