x400_mtapi.h File Reference

X.400 Gateway Interface. More...

#include "cdecl.h"
#include "x400_api.h"

Go to the source code of this file.

Macros

#define X400mtOpen(p1, p2)   X400mtOpenVer(p1, p2, X400_API_VERSN)
 

Functions

const char * X400mtError (int error)
 Return string for error code. More...
 
int X400mtOpen (const char *credentials, struct X400mtSession **spp)
 Open a session to the MTA. More...
 
int X400mtClose (struct X400mtSession *sp)
 Close a X400 Session. More...
 
int X400mtSetIntDefault (struct X400mtSession *sp, int paramtype, int value)
 Set a default integer parameter value in a session. More...
 
int X400mtSetStrDefault (struct X400mtSession *sp, int paramtype, const char *value, size_t length)
 Set a default string parameter value in a session. More...
 
int X400mtMsgNew (struct X400mtSession *sp, int type, struct X400mtMessage **mpp)
 Creates new message. More...
 
int X400mtMsgCountRecip (struct X400mtMessage *mp, int type, int *cp)
 Returns count of addresses of given type in message object. More...
 
int X400mtMsgSend (struct X400mtMessage *mp)
 Send message object to MTA. More...
 
int X400mtMsgDelete (struct X400mtMessage *mp)
 Delete message object. More...
 
int X400mtMsgAddStrParam (struct X400mtMessage *mp, int paramtype, const char *value, size_t length)
 Add string-valued parameter to the message. More...
 
int X400mtMsgAddIntParam (struct X400mtMessage *mp, int paramtype, int value)
 Add integer-valued parameter to the message. More...
 
int X400mtMsgAddAttachment (struct X400mtMessage *mp, int type, const char *string, size_t length)
 Add an attachment to the message. More...
 
int X400mtMsgAddBodypart (struct X400mtMessage *mp, struct X400Bodypart *bp)
 Add a body part object to a message. More...
 
int X400mtMsgAddMessageBody (struct X400mtMessage *mp, struct X400Message *mbp)
 
int X400mtMsgAddMessageBodyWType (struct X400mtMessage *mp, struct X400Message *mbp, int type)
 Add a message body part object to a message. More...
 
int X400mtRecipNew (struct X400mtMessage *mp, int type, struct X400Recipient **rpp)
 Add new recipient to a message. More...
 
int X400mtRecipAddStrParam (struct X400Recipient *rp, int paramtype, const char *value, size_t length)
 Add string-valued parameter to the message. More...
 
int X400mtRecipAddIntParam (struct X400Recipient *rp, int paramtype, int value)
 Add integer-valued parameter to the message. More...
 
int X400mtWait (struct X400mtSession *sp, int seconds, int *count)
 Wait for messages to be transferred out. More...
 
int X400mtMsgGet (struct X400mtSession *sp, struct X400mtMessage **mpp, int *typep)
 Transfer message object out from MTA completely. More...
 
int X400mtMsgGetStart (struct X400mtSession *sp, struct X400mtMessage **mpp, int *typep)
 Get message object for transfer out from MTA. More...
 
int X400mtMsgGetFinish (struct X400mtMessage *mp, int status, int reason, int diag, const char *info)
 Finish transfer-out of message from MTA, generate DR if required. More...
 
int X400mtMsgGetStrParam (struct X400mtMessage *mp, int paramtype, char *buffer, size_t buflen, size_t *paramlenp)
 Return a string-valued parameter from the message object. More...
 
int X400mtMsgGetIntParam (struct X400mtMessage *mp, int paramtype, int *valp)
 Return a integer-valued parameter from the message object. More...
 
int X400mtMsgGetAttachment (struct X400mtMessage *mp, int number, int *typep, char *buffer, size_t buflen, size_t *lengthp)
 Return the data of an attachment (=bodypart) from the message object. More...
 
int X400mtMsgGetBodypart (struct X400mtMessage *mp, int number, int *typep, struct X400Bodypart **bpp)
 Return a pointer to a body part object. More...
 
int X400mtMsgGetMessageBody (struct X400mtMessage *mp, int number, struct X400Message **mpp)
 Return a pointer to a body part object. More...
 
int X400mtRecipGet (struct X400mtMessage *mp, int type, int number, struct X400Recipient **rpp)
 Get recipient object from message. More...
 
int X400mtRecipGetStrParam (struct X400Recipient *rp, int paramtype, char *buffer, size_t buflen, size_t *paramlenp)
 Return a string-valued parameter from the recipient object. More...
 
int X400mtRecipGetIntParam (struct X400Recipient *rp, int paramtype, int *valp)
 Return a integer-valued parameter from the recipient object. More...
 
int X400mtDLExpHistGet (struct X400mtMessage *mp, int entry, struct X400DLExpHist **hist)
 Create a new DL Expansion History object from the message object. More...
 
int X400mtDLExpHistNew (struct X400mtMessage *mp, struct X400DLExpHist **histp)
 Create a new DL Expansion History object, and associate it with the existing message. More...
 
struct X400DLExpHist * X400mtDLExpHistDeepCopy (struct X400mtMessage *mp, struct X400DLExpHist *orig)
 Copy a new DL Expansion History object, and associate it with the a message. More...
 
int X400mtTraceInfoGet (struct X400mtMessage *mp, int entry, struct X400TraceInfo **info, int type)
 Get a Trace Info object for a message object. More...
 
int X400mtTraceInfoNew (struct X400mtMessage *mp, struct X400TraceInfo **info, int type)
 Create a new Trace Info object for a message object. More...
 
struct X400TraceInfo * X400mtTraceInfoDeepCopy (struct X400mtMessage *mp, struct X400TraceInfo *orig, int type)
 Copy a TraceInformation object, and associate it with the a message. More...
 
int X400mtInternalTraceInfoGet (struct X400mtMessage *mp, int entry, struct X400InternalTraceInfo **info)
 Get an Internal Trace Info object for a message object. More...
 
int X400mtInternalTraceInfoNew (struct X400mtMessage *mp, struct X400InternalTraceInfo **info)
 Create a new Internal Trace Info object for a message object. More...
 
struct X400InternalTraceInfo * X400mtInternalTraceInfoDeepCopy (struct X400mtMessage *mp, struct X400InternalTraceInfo *orig)
 Copy an InternalTraceInformation object, and associate it with the a message. More...
 
int X400mtALINew (struct X400mtMessage *mp, struct X400ALI **ali)
 Create a new Address List Indicator object for a message object. More...
 
struct X400ALI * X400mtALIDeepCopy (struct X400mtMessage *mp, struct X400ALI *orig)
 Copy an AddressListIndicator object, and associate it with the a message. More...
 
int X400mtALIGet (struct X400mtMessage *mp, int entry, struct X400ALI **ali)
 Get a new Address List Indicator object for a message object. More...
 
int X400mtPSSNew (struct X400mtMessage *mp, int type, struct X400PSS **pss)
 Create a new Printable String Syntax object for a message object. More...
 
struct X400PSS * X400mtPSSDeepCopy (struct X400mtMessage *mp, struct X400PSS *orig, int type)
 Copy a PrintableStringSequence object, and associate it with the a message. More...
 
int X400mtPSSGet (struct X400mtMessage *mp, int type, int entry, struct X400PSS **pss)
 Get a new Printable String Syntax object for a message object. More...
 
int X400mtDistFieldNew (struct X400mtMessage *mp, struct X400DistField **distfield)
 Create a new P772 Distribution Field object for a message object. More...
 
struct X400DistField * X400mtDistFieldDeepCopy (struct X400mtMessage *mp, struct X400DistField *orig)
 Copy a P772 DistributionField object, and associate it with the a message. More...
 
int X400mtDistFieldGet (struct X400mtMessage *mp, int entry, struct X400DistField **distfield)
 Get a new P772 Distribution Field object for a message object. More...
 
int X400mtOtherRecipNew (struct X400mtMessage *mp, struct X400OtherRecip **otherrecip)
 Create a new P772 Other Recipient object for a message object. More...
 
struct X400OtherRecip * X400mtOtherRecipDeepCopy (struct X400mtMessage *mp, struct X400OtherRecip *orig)
 Copy a P772 Other Recipient object, and associate it with the a message. More...
 
int X400mtOtherRecipGet (struct X400mtMessage *mp, int entry, struct X400OtherRecip **otherrecip)
 Get a new P772 Other Recipient object for a message object. More...
 
int X400mtRediHistGetEnv (struct X400mtMessage *msg, int entry, struct X400RediHist **hist)
 Get the Redirection History object from a message envelope this is represented by 8.3.1.2.1.5 in X.411. More...
 
int X400mtRediHistNewEnv (struct X400mtMessage *msg, struct X400RediHist **hist)
 Create a new Redirection History object for a message envelope this is represented by 8.3.1.2.1.5 in X.411. More...
 
struct X400RediHist * X400mtRediHistDeepCopyEnv (struct X400mtMessage *mp, struct X400RediHist *orig)
 Copy a Redirection History object, and associate it with the a message. More...
 
int X400mtORandDLNew (struct X400mtMessage *msg, struct X400ORandDL **or_and_dl)
 Create new Originator and DL expansion history object. More...
 
struct X400ORandDL * X400mtORandDLDeepCopy (struct X400mtMessage *mp, struct X400ORandDL *orig)
 Copy an Originator and DL Expansion History object, and associate it with the a message. More...
 
int X400mtORandDLGet (struct X400mtMessage *msg, int entry, struct X400ORandDL **or_and_dl)
 Get Originator and DL expansion history object. More...
 
int X400mtOpenVer (const char *credentials, struct X400mtSession **spp, int version)
 Open X400 MT session. More...
 
int X400mtMarkToFault (struct X400mtSession *sp, int attType, int fault)
 Control how extension attributes in Envelopes and Envelope Recipient addresses are handled. Setting 'TRUE' for a given attribute type means that any incoming message which contains the corresponding extension field AND which is marked as critical-for-delivery or critical-for-transfer will be automatically NDRed. In the case of addresses, the individual address will be NDRed. If all of the recipient addresses for which this MT instance is responsible are NDRed, calls to X400mtMsgGet and X400msMsgGetStart will return an error code as well as causing the NDR to be generated. More...
 
int X400mtGetContentOctets (struct X400mtMessage *mp, char *buf, size_t buflen, size_t *lenp)
 Obtains the bytes containing the ASN.1 encoding of the Content of a message. The Content is obtained by building an IPM from the attributes of the message and then encoding it. More...
 
int X400mtSetContentOctets (struct X400mtMessage *mp, char *buf, size_t len)
 Takes a byte stream containing the ASN.1 encoding of a P22 (or P772) content, decodes it and sets it into a message, so that attributes can be extracted from it. More...
 
int X400ReadArchive (char *filepath, struct X400Message **mpp)
 Takes the path to a file containing the archived envelope of an X.400 message (i.e. .xar file) and returns an X.400 Message object containing the contents of the envelope an accompanying content if necessary. More...
 
int X400mtACP127RespGet (struct X400mtMessage *mp, struct X400ACP127Resp **respp)
 Get the ACP127 Notification Response object from a message. More...
 
int X400mtACP127RespNew (struct X400mtMessage *mp, struct X400ACP127Resp **respp)
 Create an ACP127 Notification Response object. More...
 
struct X400ACP127Resp * X400mtACP127RespDeepCopy (struct X400mtMessage *mp, struct X400ACP127Resp *orig)
 Copy an ACP127 Notification Response object. More...
 

Detailed Description

X.400 Gateway Interface.

This is an API for interfacing to an X400 MTA suitable for building gateway functionality. It provides mechanisms for building and examining X.400 message, probes and reports. It also provides mechanisms for transferring such objects into X.400, and transferring out such objects.

Definition in file x400_mtapi.h.

Macro Definition Documentation

◆ X400mtOpen

#define X400mtOpen (   p1,
  p2 
)    X400mtOpenVer(p1, p2, X400_API_VERSN)

Macro calls X400mtOpenVer() with expected version

Definition at line 973 of file x400_mtapi.h.

Function Documentation

◆ X400mtOpenVer()

int X400mtOpenVer ( const char *  credentials,
struct X400mtSession **  spp,
int  version 
)

Open X400 MT session.

Parameters
credentials[in] Channel and MTA information
spp[out] Receives pointer to new session
version[in] Version of API client is using
Returns
Zero on success or non-zero error code

◆ X400mtMarkToFault()

int X400mtMarkToFault ( struct X400mtSession *  sp,
int  attType,
int  fault 
)

Control how extension attributes in Envelopes and Envelope Recipient addresses are handled. Setting 'TRUE' for a given attribute type means that any incoming message which contains the corresponding extension field AND which is marked as critical-for-delivery or critical-for-transfer will be automatically NDRed. In the case of addresses, the individual address will be NDRed. If all of the recipient addresses for which this MT instance is responsible are NDRed, calls to X400mtMsgGet and X400msMsgGetStart will return an error code as well as causing the NDR to be generated.

Parameters
spp[in] Session to perform configuration on
attType[in] X.400 attribute type to configure
fault[in] Whether to fault this attribute type or not
Returns
Zero on success or non-zero error code
Examples:
examples/x400_mtrcv.c.

◆ X400mtGetContentOctets()

int X400mtGetContentOctets ( struct X400mtMessage *  mp,
char *  buf,
size_t  buflen,
size_t *  lenp 
)

Obtains the bytes containing the ASN.1 encoding of the Content of a message. The Content is obtained by building an IPM from the attributes of the message and then encoding it.

Parameters
mp[in] Message from which to get Content encoding
buf[in] Buffer for return of content
buflen[in] Length of buffer
lenp[out] Length of data returned
Returns
Zero on success or non-zero error code

◆ X400mtSetContentOctets()

int X400mtSetContentOctets ( struct X400mtMessage *  mp,
char *  buf,
size_t  len 
)

Takes a byte stream containing the ASN.1 encoding of a P22 (or P772) content, decodes it and sets it into a message, so that attributes can be extracted from it.

Parameters
mp[in] Message into which to put the Content
buf[in] Buffer containing encoding of content
buflen[in] Length of buffer
Returns
Zero on success or non-zero error code

◆ X400ReadArchive()

int X400ReadArchive ( char *  filepath,
struct X400Message **  mpp 
)

Takes the path to a file containing the archived envelope of an X.400 message (i.e. .xar file) and returns an X.400 Message object containing the contents of the envelope an accompanying content if necessary.

Parameters
filepath[in] Full path to .xar file
mpp[out] Message for return
Returns
Zero on success or non-zero error code

◆ X400mtACP127RespGet()

int X400mtACP127RespGet ( struct X400mtMessage *  mp,
struct X400ACP127Resp **  respp 
)

Get the ACP127 Notification Response object from a message.

Parameters
mp[in] X.400 Message Recipient pointer
resp[out] Pointer to ACP127 Notification Response object
Returns
Zero on success or non-zero error code
Examples:
examples/x400_mtrcv.c.

◆ X400mtACP127RespNew()

int X400mtACP127RespNew ( struct X400mtMessage *  mp,
struct X400ACP127Resp **  respp 
)

Create an ACP127 Notification Response object.

Parameters
mp[in] X400 message pointer
resp[out] Pointer X400ACP127Resp object
Returns
Zero on success or non-zero error code
Examples:
examples/x400_mtsend.c.

◆ X400mtACP127RespDeepCopy()

struct X400ACP127Resp* X400mtACP127RespDeepCopy ( struct X400mtMessage *  mp,
struct X400ACP127Resp *  orig 
)

Copy an ACP127 Notification Response object.

Parameters
mp[in] message pointer for copy
original[in] object to copy
Returns
Copy of object or NULL on error