examples/x400_mtrcv.c

This is an example program which transfers messages and reports out of the MTA.

/* Copyright (c) 2003-2011, Isode Limited, London, England.
* All rights reserved.
*
* Acquisition and use of this software and related materials for any
* purpose requires a written licence agreement from Isode Limited,
* or a written licence from an organisation licenced by Isode Limited
* to grant such a licence.
*
*/
/*
*
* @VERSION@
* Simple example program for transferring a message out of the MTA
*/
#include <stdio.h>
#include <stdlib.h>
#include <x400_mtapi.h>
#include <seclabel_api.h> /* For security labels */
#include "example.h"
/* to get NDR values */
/* #include "esc.h" */
#define XML_BUFSIZE 1024
static int get_msg (
int argc,
char **argv
) ;
static int do_msg_env(
struct X400mtMessage *mp
);
static int do_msg_headers(
struct X400mtMessage *mp
);
static void do_msg_content(
struct X400mtMessage *mp
);
static int get_a_msg (
struct X400mtSession *sp
) ;
static int get_recips(
struct X400mtMessage *mp,
int recip_type,
char *recip_str
);
static int get_exempted_recips (
struct X400mtMessage *mp
);
static int do_rep_env(
struct X400mtMessage *mp
);
static int do_rep_content(
struct X400mtMessage *mp
);
static int do_rep_retcontent(
struct X400mtMessage *mp
);
static void usage(void);
#ifdef WANT_DL_EXP_HIST
static int do_dl_hist (
struct X400mtMessage *mp
);
#endif
static int do_trace_info (
struct X400mtMessage *mp
);
static int do_internal_trace_info (
struct X400mtMessage *mp
);
static int do_redirection_hist (
struct X400Recipient *recip
);
static int do_redirection_hist_env (
struct X400mtMessage *msg
);
static int get_ALI (
struct X400mtMessage *mp
);
static int get_hi (
struct X400mtMessage *mp
);
static int get_mi (
struct X400mtMessage *mp
);
static int get_dist_codes_sic(
struct X400mtMessage *mp
);
static int get_other_recips(
struct X400mtMessage *mp
);
#ifdef HANDLING_MILITARY_IPN
static int get_acp127_ali (
struct X400ACP127Resp *resp
);
#endif
static char *optstr = "uo:O:r:c:l:EQ:";
static int get_body_parts(
struct X400mtMessage *mp
);
static int do_orig_and_dl (
struct X400mtMessage *mp
);
static void report_sig_info(
struct X400Recipient *rp
);
static void print_sec_label(
unsigned char slab_buffer[],
unsigned int length
);
static int get_cic(
struct X400Recipient *rp
);
static void show_certificate (
struct X400Recipient *rp,
int certtype,
const char *tag
);
int num_atts = 0;
int main (
int argc,
char **argv
)
{
int retval;
if (x400_channel == NULL) {
fprintf (stderr, "No x400_channel value set in x400tailor file");
exit(1);
}
/*
while (retval == X400_E_NOERROR || retval == X400_E_NO_MESSAGE) {
retval = get_msg(argc, argv);
}
*/
retval = get_msg(argc, argv);
fprintf (stderr, "Error in X400mtMsgGet: %s\n", X400mtError (retval));
return(retval);
}
static int get_msg (
int argc,
char **argv
)
{
int status;
struct X400mtSession *sp;
char *filepath = "/var/isode";
if (get_args(argc, argv, optstr)) {
usage();
exit(-1);
}
/* open our X400 session */
status = X400mtOpen (x400_channel, &sp);
if ( status != X400_E_NOERROR ) {
fprintf (stderr, "Error in Open: %s\n", X400mtError (status));
return (status);
}
filepath, strlen(filepath));
#ifdef WANT_OR_CANONICAL
#endif
if (attr_to_fault != 0) {
status = X400mtMarkToFault(sp, attr_to_fault, 1);
if (status != X400_E_NOERROR) {
fprintf (stderr, "Error in X400mtMarkToFault: %s\n", X400mtError (status));
return (status);
}
}
get_a_msg(sp);
if ( status != X400_E_NOERROR ) {
/* close API session */
status = X400mtClose (sp);
if ( status != X400_E_NOERROR ) {
printf("X400mtClose returned error %d\n", status);
fprintf (stderr, "Error in X400mtClose: %s\n",
X400mtError (status));
}
return status;
}
do {
get_a_msg(sp);
if ( status != X400_E_NOERROR ) {
/* close API session */
status = X400mtClose (sp);
if ( status != X400_E_NOERROR ) {
printf("X400mtClose returned error %d\n", status);
fprintf (stderr, "Error in X400mtClose: %s\n",
X400mtError (status));
}
return status;
}
}
while (until_no_more_msgs);
/* close API session */
status = X400mtClose (sp);
if ( status != X400_E_NOERROR ) {
printf("X400mtClose returned error %d\n", status);
fprintf (stderr, "Error in X400mtClose: %s\n",
X400mtError (status));
}
return (status);
}
static int get_a_msg (
struct X400mtSession *sp
)
{
struct X400mtMessage *mp;
int type;
int status;
static int reported_none = 0;
/* get the message */
status = X400mtMsgGetStart (sp, &mp, &type);
if ( status != X400_E_NOERROR ) {
if ( status == X400_E_NO_MESSAGE ) {
if (reported_none == 0) {
printf("No messages ...\n");
reported_none = 1;
}
}
printf("Error getting message (%d) %s\n", status, X400mtError(status));
fprintf (stderr, "Error in X400mtMsgGet: %s\n", X400mtError (status));
return (status);
}
/* process the message */
switch ( type) {
printf("Message waiting\n\n");
/* display message attributes */
do_msg_env(mp);
do_msg_headers(mp);
do_msg_content(mp);
break;
printf("Report waiting\n\n");
/* display message attributes */
do_rep_env(mp);
do_rep_content(mp);
do_rep_retcontent(mp);
break;
/* Not handling a Probe here */
printf ("Got a probe, ignoring ...\n");
/* Delete internal copy */
status = X400mtMsgDelete (mp);
if ( status != X400_E_NOERROR ) {
printf("X400mtMsgDelete returned error %d\n", status);
fprintf (stderr, "Error in X400mtMsgDelete: %s\n",
X400mtError (status));
}
return (status);
}
#ifdef always_dr_msg
#define DRD_UNRECOGNISED_OR 0
#define DRR_UNABLE_TO_TRANSFER 1
/* finish transfer - NDR */
DRR_UNABLE_TO_TRANSFER, DRD_UNRECOGNISED_OR, "Unable to transfer");
#endif
/* finish transfer - accept: no DR */
-1, -1, "");
if ( status != X400_E_NOERROR ) {
printf("X400mtMsgFinish returned error %d\n", status);
fprintf (stderr, "Error in X400mtMsgFinish: %s\n",
X400mtError (status));
}
printf("X400mtMsgFinish returned success %d\n", status);
/* Delete internal copy */
status = X400mtMsgDelete (mp);
if ( status != X400_E_NOERROR ) {
printf("X400mtMsgDelete returned error %d\n", status);
fprintf (stderr, "Error in X400mtMsgDelete: %s\n",
X400mtError (status));
}
return status;
}
/*
* Message functions
*/
static int do_msg_env(
struct X400mtMessage *mp
)
{
char buffer[BUFSIZ];
int status;
size_t length;
int int_param = 0;
/* Envelope Attributes */
/* string attributes */
/* The ORADDRESS in the message is the (envelope) originator */
buffer, sizeof buffer , &length);
if ( status != X400_E_NOERROR ) {
printf("error getting originator address\n");
fprintf (stderr,
"Error in X400mtMsgGetStrParam: %s\n", X400mtError (status));
return (status);
}
printf ("Originator: %.*s\n", (int)length, buffer);
/* Envelope message IDentifier */
buffer, sizeof buffer , &length);
if ( status != X400_E_NOERROR ) {
printf("error getting message identifier\n");
fprintf (stderr, "Error in X400mtMsgGetStrParam: %s\n", X400mtError (status));
return (status);
}
printf ("MessageID: %.*s\n", (int)length, buffer);
/* Content Identifier */
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR )
printf ("Content Identifier: %.*s\n", (int)length, buffer);
/* Content Correlator */
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR )
printf ("Content Correlator IA5Text: %.*s\n", (int)length, buffer);
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR )
printf ("Content Correlator Octet String: %i bytes\n", (int)length);
/* Original EITs */
status = X400mtMsgGetStrParam (mp,
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR )
printf ("Original EITs: %.*s\n", (int)length, buffer);
/* Message Submission Time */
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR )
printf ("Message Submission Time: %.*s\n", (int)length, buffer);
/* Message Delivery Time */
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR )
printf ("Message Delivery Time: %.*s\n", (int)length, buffer);
/* Latest Delivery Time */
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR )
printf ("Latest Delivery Time: %.*s\n", (int)length, buffer);
/* Originator Return Address */
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR )
printf ("Originator Return Address : %.*s\n", (int)length, buffer);
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR )
printf ("External Content Type : %.*s\n", (int)length, buffer);
/* Integer parameters */
/* Content Type */
status = X400mtMsgGetIntParam (mp, X400_N_CONTENT_TYPE, &int_param);
if ( status == X400_E_NOERROR )
printf ("Content type : P%d\n", int_param);
if ( status == X400_E_NOERROR )
printf ("Content type : P%d\n", int_param);
/* Content Length */
status = X400mtMsgGetIntParam (mp, X400_N_CONTENT_LENGTH, &int_param);
if ( status == X400_E_NOERROR )
printf ("Content length: %d\n", int_param);
/* Priority */
status = X400mtMsgGetIntParam (mp, X400_N_PRIORITY, &int_param);
if ( status == X400_E_NOERROR )
printf ("Priority: %d\n", int_param);
/* Disclosure of recips prohibited */
status = X400mtMsgGetIntParam (mp, X400_N_DISCLOSURE, &int_param);
if ( status == X400_E_NOERROR )
printf ("Disclosure of recips prohibited %s\n", int_param == 0 ? "No": "Yes");
/* Implicit conversion prohibited */
if ( status == X400_E_NOERROR )
printf ("Implicit conversion prohibited %s\n", int_param == 0 ? "No": "Yes");
/* Alternate recipient allowed */
if ( status == X400_E_NOERROR )
printf (" Alternate recipient allowed: %s\n", int_param == 0 ? "No": "Yes");
/* Content return request */
if ( status == X400_E_NOERROR )
printf (" Content return request: %s\n", int_param == 0 ? "No": "Yes");
/* Recipient reassignment prohibited */
if ( status == X400_E_NOERROR )
printf ("Recipient reassignment prohibited: %s\n", int_param == 0 ? "No": "Yes");
/* Distribution List expansion prohibited */
if ( status == X400_E_NOERROR )
printf ("Distribution List expansion prohibited: %s\n", int_param == 0 ? "No": "Yes");
/* Conversion with loss prohibited */
if ( status == X400_E_NOERROR )
printf ("Conversion with loss prohibited: %s\n", int_param == 0 ? "No": "Yes");
/* Get the envelope recipients */
status = get_recips(mp, X400_RECIP_ENVELOPE, "envelope");
if ( status != X400_E_NOERROR && status != X400_E_NO_RECIP) {
printf("error getting recipients\n");
fprintf (stderr, "Error in getting recipient: %s\n",
X400mtError (status));
return (status);
}
/* Get X.411 exempted recipients */
status = get_recips(mp, X400_DL_EXEMPTED_RECIP, "DL Exempted recips");
if ( status != X400_E_NOERROR && status != X400_E_NO_RECIP) {
printf("error getting recipients\n");
fprintf (stderr, "Error in getting recipient: %s\n",
X400mtError (status));
return (status);
}
#ifdef WANT_DL_EXP_HIST
/* DL Expansion history */
{
/*Process the DL Expansion History object */
status = do_dl_hist(mp);
if (status == X400_E_NO_VALUE )
printf("No DL Expansion history\n");
else if ( status != X400_E_NOERROR ) {
/* There has been an error fetching the DL expansion history*/
printf("error getting DL Expansion History\n");
fprintf (stderr, "Error in X400mtDLExpHistGet: %s\n",
X400mtError (status));
return status;
}
}
#endif
/* Security Label */
#ifdef USE_SEC_LABEL
#define XML_BUFSIZE 1024
{
char xml_buffer[XML_BUFSIZE];
unsigned char slab_buffer[XML_BUFSIZE];
status = X400mtMsgGetStrParam(mp,
(char*)slab_buffer,
XML_BUFSIZE,
&length);
if (status == X400_E_NO_VALUE) {
printf("No security label\n");
} else if (status != X400_E_NOERROR) {
fprintf(stderr,"Failed to fetch security label: %d",status);
exit(1);
} else {
int sec_status = 0;
sec_status = SecLabelInit("Example program");
if (status != SECLABEL_E_NOERROR) {
fprintf(stderr, "SecLabelInit returned error %d\n", status);
exit(1);
}
status = SecLabelPrint(slab_buffer,
length,
xml_buffer,
XML_BUFSIZE);
if (status != SECLABEL_E_NOERROR) {
fprintf(stderr, "SecLabelParse returned error %d\n", status);
exit(1);
}
/* You could now write out the XML file, or parse it in memory..*/
printf("Got security label:%s\n",xml_buffer);
}
}
#endif
#define WANT_TRACE_INFO 1
#ifdef WANT_TRACE_INFO
{
status = do_trace_info(mp);
if ( status == X400_E_NOERROR) {
/* all OK */
} else if (status == X400_E_MISSING_ATTR ) {
printf("There is no Trace Info\n");
} else {
printf("error getting Trace Info\n");
fprintf (stderr, "Error fetching trace info: %s\n",
X400mtError (status));
return status;
}
}
#endif
#define USE_INTERNAL_TRACE_INFO 1
#ifdef USE_INTERNAL_TRACE_INFO
{
status = do_internal_trace_info(mp);
if ( status == X400_E_NOERROR) {
/* do nothing */
} else if (status == X400_E_MISSING_ATTR ) {
printf("There is no internal Trace Info\n");
} else {
printf("error getting Trace Info\n");
fprintf (stderr, "Error fetching trace info: %s\n",
X400mtError (status));
return status;
}
}
#endif
/* NB: Originator cert is just being treated as a binary blob */
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR )
printf ("Originator Cert got %i bytes\n", (int)length);
/* NB: Originator cert is just being treated as a binary blob */
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR )
printf ("MOAC got %i bytes\n", (int)length);
}
#ifdef WANT_DL_EXP_HIST
static int do_dl_hist (
struct X400mtMessage *mp
)
{
struct X400DLExpHist *hist = NULL;
char DLORAddress[BUFSIZ];
char DLORDN[BUFSIZ];
char DLExpTime[BUFSIZ];
size_t length;
int n;
int status;
/* Loop through the entries, pulling out the OR Address, DN, and expansion
* time for each entry.
* Stop looping when there is no n entry
*/
for ( n=1; ;n++ ) {
status = X400mtDLExpHistGet (mp,n,&hist);
if (status != X400_E_NOERROR) {
return status;
}
status = X400DLGetStrParam (hist, X400_S_OR_ADDRESS,
DLORAddress, BUFSIZ , &length);
if (status == X400_E_NO_VALUE) {
}
if ( status == X400_E_NOERROR ) {
DLORAddress[length] = '\0';
printf ("DLExpansion List entry %d OR Address:%s\n",
n,DLORAddress);
} else {
fprintf (stderr, "Error in :X400DLGetStrParam OR %s\n",
X400mtError (status));
}
status = X400DLGetStrParam (hist,X400_S_DIRECTORY_NAME,
DLORDN, BUFSIZ , &length);
if ( status == X400_E_NOERROR ) {
DLORDN[length] = '\0';
printf ("DLExpansion List entry %d DN :%s\n",n,DLORDN);
} else {
fprintf (stderr, "Error in :X400DLGetStrParam DN %s\n",
X400mtError (status));
}
status = X400DLGetStrParam (hist,X400_S_DLEXP_TIME,
DLExpTime, BUFSIZ , &length);
if ( status == X400_E_NOERROR ) {
DLExpTime[length] = '\0';
printf ("DLExpansion List entry %d Time :%s\n",n,DLExpTime);
} else {
fprintf (stderr, "Error in :X400DLGetStrParam Time %s\n",
X400mtError (status));
}
}
}
#endif
static int do_msg_headers(
struct X400mtMessage *mp
)
{
char buffer[BUFSIZ];
int status;
size_t length;
int int_param;
/* Message Headers */
printf("\nContent:\n");
/* Get the primary recipients */
status = get_recips(mp, X400_RECIP_PRIMARY, "primary");
if ( status != X400_E_NOERROR && status != X400_E_NO_RECIP) {
printf("error getting recipients\n");
fprintf (stderr, "Error in getting recipient: %s\n",
X400mtError (status));
return (status);
}
/* Get the cc recipients */
status = get_recips(mp, X400_RECIP_CC, "cc");
if ( status != X400_E_NOERROR && status != X400_E_NO_RECIP) {
printf("error getting recipients\n");
fprintf (stderr, "Error in getting recipient: %s\n",
X400mtError (status));
return (status);
}
/* Get the bcc recipients */
status = get_recips(mp, X400_RECIP_BCC, "bcc");
if ( status != X400_E_NOERROR && status != X400_E_NO_RECIP) {
printf("error getting recipients\n");
fprintf (stderr, "Error in getting recipient: %s\n",
X400mtError (status));
return (status);
}
/* Get the reply recipients */
status = get_recips(mp, X400_AUTH_ORIG, "auth-orig");
if ( status != X400_E_NOERROR && status != X400_E_NO_RECIP) {
printf("error getting recipients\n");
fprintf (stderr, "Error in getting recipient: %s\n",
X400mtError (status));
return (status);
}
/* Get the reply recipients */
status = get_recips(mp, X400_RECIP_REPLY, "reply");
if ( status != X400_E_NOERROR && status != X400_E_NO_RECIP) {
printf("error getting recipients\n");
fprintf (stderr, "Error in getting recipient: %s\n",
X400mtError (status));
return (status);
}
/* Get the Exempted recipients */
status = get_exempted_recips(mp);
if ( status != X400_E_NOERROR && status != X400_E_NO_RECIP) {
fprintf (stderr, "Error in getting exempted recipient: %s\n",
X400mtError (status));
return (status);
}
/* string parameters */
/* IPM IDentifier */
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR )
printf ("IPM IDentifier: %.*s\n", (int)length, buffer);
/* Subject */
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR )
printf ("Subject: %.*s\n", (int)length, buffer);
/* Replied-to-identifier */
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR )
printf ("Replied-to-identifier: %.*s\n", (int)length, buffer);
/* Obsoleted IPMs */
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR )
printf ("Obsoleted IPMs: %.*s\n", (int)length, buffer);
/* Related IPMs */
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR )
printf ("Related IPMs: %.*s\n", (int)length, buffer);
/* Expiry Time */
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR )
printf ("Expiry Time: %.*s\n", (int)length, buffer);
/* Reply Time */
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR )
printf ("Reply Time: %.*s\n", (int)length, buffer);
/* Authorisation Time */
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR )
printf ("Authorisation Time: %.*s\n", (int)length, buffer);
/* Originator's Reference */
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR )
printf ("Originator's Reference: %.*s\n", (int)length, buffer);
/* integer arguments */
/* Importance */
status = X400mtMsgGetIntParam (mp, X400_N_IMPORTANCE, &int_param);
if ( status == X400_E_NOERROR )
printf ("Importance: %d\n", int_param);
/* Sensitivity: 1 - personal, 2 - private, 3 - company-confidential */
status = X400mtMsgGetIntParam (mp, X400_N_SENSITIVITY, &int_param);
if ( status == X400_E_NOERROR )
printf ("Sensitivity: %d\n", int_param);
/* Autoforwarded */
status = X400mtMsgGetIntParam (mp, X400_N_AUTOFORWARDED, &int_param);
if ( status == X400_E_NOERROR )
printf ("Autoforwarded: %s\n", int_param ? "false" : "true");
/* number of attachments apart from main body part */
status = X400mtMsgGetIntParam (mp, X400_N_NUM_ATTACHMENTS, &num_atts);
if ( status == X400_E_NOERROR )
printf ("number of attachments: %d\n", num_atts);
/* Fetch P772 Extended Auth Info */
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR )
printf ("P772 Ext Auth Info Time: %.*s\n", (int)length, buffer);
/* Fetch P772 Codress value */
status = X400mtMsgGetIntParam (mp, X400_N_EXT_CODRESS, &int_param);
if ( status == X400_E_NOERROR )
printf ("P772 Codress value: %d\n", int_param);
/* Fetch P772 Message type value */
status = X400mtMsgGetIntParam (mp, X400_N_EXT_MSG_TYPE, &int_param);
if ( status == X400_E_NOERROR )
printf ("P772 Message Type: %.*s\n", (int)length, buffer);
/* Fetch P772 Message id value */
buffer, sizeof buffer, &length);
if ( status == X400_E_NOERROR )
printf ("P772 Message Type/Identifier: %d\n", int_param);
/* Fetch P772 Primary Precedence */
status = X400mtMsgGetIntParam (mp, X400_N_EXT_PRIM_PREC, &int_param);
if ( status == X400_E_NOERROR )
printf ("P772 Primary Precedence: %d\n", int_param);
/* Fetch P772 Copy Precedence */
status = X400mtMsgGetIntParam (mp, X400_N_EXT_COPY_PREC, &int_param);
if ( status == X400_E_NOERROR )
printf ("P772 Copy Precedence: %d\n", int_param);
/* Fetch P772 Address List Indicators*/
get_ALI(mp);
/* Fetch handling instructions */
get_hi(mp);
/* Fetch message instructions */
get_mi(mp);
/* Fetch distribution codes sic */
get_dist_codes_sic(mp);
/* Fetch Other Recipients */
get_other_recips(mp);
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR )
printf ("P772 Originator Reference: %.*s\n", (int)length, buffer);
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR )
printf ("P772 Originator PLAD: %.*s\n", (int)length, buffer);
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR )
printf ("P772 ACP127 Msg ID: %.*s\n", (int)length, buffer);
/* NB: Pilot forwarding info is just being treated as a binary blob */
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR )
printf ("P772 Pilot Forwarding Info got %i bytes\n", (int)length);
/* NB: information security label is just being treated as a binary blob */
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR )
printf ("P772 Information Security Label got %i bytes\n", (int)length);
#ifdef HANDLING_MILITARY_IPN
/* Fetch ACP127 Notification Response - this will only be present in a Military Notification */
{
struct X400ACP127Resp *resp = NULL;
int int_param = 0;
status = X400mtACP127RespGet(mp,&resp);
if ( status == X400_E_NOERROR ) {
status = X400ACP127RespGetIntParam(resp,&int_param);
if ( status == X400_E_NOERROR ) {
if (int_param & X400_ACP127_NOTI_TYPE_NEG) {
printf("P772 ACP127 Notification Response Type Negative\n");
}
if (int_param & X400_ACP127_NOTI_TYPE_POS) {
printf("P772 ACP127 Notification Response Type Positive\n");
}
if (int_param & X400_ACP127_NOTI_TYPE_TRANS) {
printf("P772 ACP127 Notification Response Type Transfer\n");
}
}
status = X400ACP127RespGetStrParam (resp,
buffer,
sizeof buffer,
&length);
if ( status == X400_E_NOERROR )
printf ("P772 ACP127 Response time: %.*s\n", (int)length, buffer);
status = X400ACP127RespGetStrParam (resp,
buffer,
sizeof buffer,
&length);
if ( status == X400_E_NOERROR )
printf ("P772 ACP127 Recipient: %.*s\n", (int)length, buffer);
status = X400ACP127RespGetStrParam (resp,
buffer,
sizeof buffer,
&length);
if ( status == X400_E_NOERROR )
printf ("P772 ACP127 Resp supp info: %.*s\n", (int)length, buffer);
/* Fetch ACP127 Notification Response Address list indicator */
get_acp127_ali(resp);
}
}
#endif
}
static void do_msg_content(
struct X400mtMessage *mp
)
{
char buffer[30000];
int status;
size_t length;
memset(buffer,0,30000);
buffer, sizeof buffer , &length);
if ( status != X400_E_NOERROR ) {
printf("Failed to read raw content into file: %s\n", X400mtError (status));
}
printf("Read raw content into file %s\n", buffer);
/* Message Body */
/* And now get message text (or it could be another type - ie not IA5) */
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR ) {
printf ("Text:\n%.*s\n", (int)length, buffer);
num_atts--; /* The IA5text bodypart is infact the first "attachment"
* So there is one less to fetch */
}
/* Go through message bodyparts */
get_body_parts(mp);
return;
}
static int get_exempted_recips (
struct X400mtMessage *mp
)
{
struct X400Recipient *rp;
int n;
char buffer[BUFSIZ];
size_t length;
int status;
for ( n = 1; ; n++ ) {
status = X400mtRecipGet (mp,X400_EXEMPTED_ADDRESS , n, &rp);
if ( (status == X400_E_NO_RECIP) || (status == X400_E_NO_VALUE) )
break;
if ( status != X400_E_NOERROR ) {
fprintf (stderr, "Error in X400mtRecipGet: %s\n",
X400mtError (status));
return (status);
}
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR ) {
printf ("Exempted recipient OR address %d: %.*s\n",
n, (int)length, buffer);
}
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR ) {
printf ("Exempted recipient DN address %d: %.*s\n",
n, (int)length, buffer);
}
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR ) {
printf ("Exempted recipient free form name %d: %.*s\n",
n, (int)length, buffer);
}
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR ) {
printf ("Exempted recipient Tel number %d: %.*s\n",
n, (int)length, buffer);
}
}
}
static int get_ALI (
struct X400mtMessage *mp
)
{
struct X400ALI *ali = NULL;
int n;
char buffer[BUFSIZ];
size_t length;
int status;
int int_param;
for ( n = 1; ; n++ ) {
status = X400mtALIGet (mp,n,&ali);
if ( status != X400_E_NOERROR )
return status;
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR ) {
printf ("P772 ALI recipient OR address %d: %.*s\n",
n, (int)length, buffer);
} else if ( status == X400_E_NO_VALUE) {
}
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR ) {
printf ("P772 ALI recipient DN address %d: %.*s\n",
n, (int)length, buffer);
}
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR ) {
printf ("P772 ALI recipient free form name %d: %.*s\n",
n, (int)length, buffer);
}
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR ) {
printf ("P772 ALI recipient Tel number %d: %.*s\n",
n, (int)length, buffer);
}
status = X400ALIGetIntParam (ali,X400_N_ALI_TYPE , &int_param);
if ( status == X400_E_NOERROR ) {
printf ("P772 ALI Type %d\n", int_param);
}
&int_param);
if ( status == X400_E_NOERROR ) {
printf ("P772 ALI Notification Request %d\n", int_param);
}
status = X400ALIGetIntParam (ali,X400_N_ALI_REPLY_REQUEST ,&int_param);
if ( status == X400_E_NOERROR ) {
printf ("P772 ALI Notification Request %d\n", int_param);
}
}
}
static int get_hi (
struct X400mtMessage *mp
)
{
struct X400PSS *pss = NULL;
int n;
char buffer[BUFSIZ];
size_t length;
int status;
for ( n = 1; ; n++ ) {
if ( status != X400_E_NOERROR )
return status;
status = X400PSSGetStrParam (pss,buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR ) {
printf ("P772 Handling instruction %d: %.*s\n",
n, (int)length, buffer);
} else if ( status == X400_E_NO_VALUE) {
}
}
}
static int get_mi (
struct X400mtMessage *mp
)
{
struct X400PSS *pss = NULL;
int n;
char buffer[BUFSIZ];
size_t length;
int status;
for ( n = 1; ; n++ ) {
if ( status != X400_E_NOERROR )
return status;
status = X400PSSGetStrParam (pss,buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR ) {
printf ("P772 Message instruction %d: %.*s\n",
n, (int)length, buffer);
} else if ( status == X400_E_NO_VALUE) {
}
}
}
static int get_dist_codes_sic(
struct X400mtMessage *mp
)
{
struct X400PSS *pss = NULL;
struct X400DistField *distfield = NULL;
int n;
char buffer[BUFSIZ];
size_t length;
int status;
for ( n = 1; ; n++ ) {
status = X400mtPSSGet (mp,X400_S_DIST_CODES_SIC,n,&pss);
if (status == X400_E_NO_VALUE) {
break; /* Now try the extension fields*/
} else if ( status != X400_E_NOERROR ) {
return status;
}
status = X400PSSGetStrParam (pss,buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR ) {
printf ("P772 Distribution code SIC %d: %.*s\n",
n, (int)length, buffer);
}
}
for ( n = 1; ; n++ ) {
status = X400mtDistFieldGet (mp,n,&distfield);
if (status == X400_E_NO_VALUE) {
break; /* Now try the extension fields*/
} else if ( status != X400_E_NOERROR ) {
return status;
}
distfield,
buffer,
sizeof buffer,
&length
);
if ( status == X400_E_NOERROR ) {
printf ("P772 Distribution code Field Extension OID %d: %.*s\n",
n, (int)length, buffer);
}
distfield,
buffer,
sizeof buffer,
&length
);
if ( status == X400_E_NOERROR ) {
printf ("P772 Distribution code Field Extension value %d: %.*s\n",
n, (int)length, buffer);
}
}
}
static int get_other_recips(
struct X400mtMessage *mp
)
{
struct X400OtherRecip *otherrecip = NULL;
int n;
char buffer[BUFSIZ];
size_t length;
int status;
int type;
for ( n = 1; ; n++ ) {
status = X400mtOtherRecipGet (mp,n,&otherrecip);
if ( status != X400_E_NOERROR ) {
return status;
}
status = X400OtherRecipGetIntParam (otherrecip,&type);
if ( status == X400_E_NOERROR ) {
printf ("P772 Other Recipient type %d: %i \n",n,type);
}
status = X400OtherRecipGetStrParam (otherrecip,
buffer,
sizeof buffer ,
&length);
if ( status == X400_E_NOERROR ) {
printf ("P772 Other Recipient Designator %d: %.*s\n",
n, (int)length, buffer);
}
}
}
static int get_recips(
struct X400mtMessage *mp,
int recip_type,
char *recip_str
)
{
char buffer[BUFSIZ];
int status;
struct X400Recipient *rp;
size_t length;
int n;
int int_param;
for ( n = 1; ; n++ ) {
status = X400mtRecipGet (mp, recip_type, n, &rp);
if ( status == X400_E_NO_RECIP )
break;
if ( status != X400_E_NOERROR ) {
printf("error getting recip %d\n", n);
fprintf (stderr, "Error in X400mtRecipGet: %s\n",
X400mtError (status));
return (status);
}
/* Note: recipient may not actually have an O/R address */
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR ) {
printf ("%s recipient %d: %.*s\n", recip_str, n, (int)length, buffer);
} else {
printf ("recipient %d ORAddress status %d\n", n, status);
}
/* envelope recipient integer parameters */
/* Responsibility */
(rp, X400_N_RESPONSIBILITY, &int_param);
if ( status == X400_E_NOERROR ) {
printf ("\tResponsibility %d\n", int_param);
}
/* MTA report request */
(rp, X400_N_MTA_REPORT_REQUEST, &int_param);
if ( status == X400_E_NOERROR ) {
printf ("\tMTA report request %d\n", int_param);
}
/* Originator report request */
(rp, X400_N_REPORT_REQUEST, &int_param);
if ( status == X400_E_NOERROR ) {
printf ("\tOriginator report request %d\n", int_param);
}
/* envelope recipient string parameters */
/* Originator requested alternate recipient: X.400 string form */
/* this is a submission argument, so should get error */
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR ) {
printf ("\tOriginator requested AR %.*s\n", (int)length, buffer);
}
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR ) {
printf ("\tOriginator requested AR DN %.*s\n", (int)length, buffer);
}
/* content recipient integer parameters */
/* Notification request */
(rp, X400_N_NOTIFICATION_REQUEST, &int_param);
if ( status == X400_E_NOERROR ) {
printf ("\tNotification request %d\n", int_param);
}
/* Reply Request */
(rp, X400_N_REPLY_REQUESTED, &int_param);
if ( status == X400_E_NOERROR ) {
printf ("\tReply Request %s\n", int_param ? "false" : "true");
}
/* content recipient string parameters */
/* Notification request */
/* Free Form Name */
(rp, X400_S_FREE_FORM_NAME, buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR ) {
printf ("\tFree form name %.*s\n", (int)length, buffer);
}
(rp, X400_S_DIRECTORY_NAME, buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR ) {
printf ("\tDirectory Name %.*s\n", (int)length, buffer);
}
/* Telephone Number */
(rp, X400_S_TELEPHONE_NUMBER, buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR ) {
printf ("\tTelephone Number %.*s\n", (int)length, buffer);
}
(rp, X400_S_ARRIVAL_TIME, buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR )
printf ("Arrival Time: %.*s\n", (int)length, buffer);
/* Positive reports */
/* Message Delivery Time - present for successful deliveries */
(rp, X400_S_MESSAGE_DELIVERY_TIME, buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR )
printf ("Subject Message Delivery Time: %.*s\n", (int)length, buffer);
/* type of MTS user - successful report only */
(rp, X400_N_TYPE_OF_USER, &int_param);
if ( status == X400_E_NOERROR ) {
printf ("\tType of MTS user %d\n", int_param);
}
/* Negative reports */
/* Supplementary info (reported recips only) */
(rp, X400_S_SUPPLEMENTARY_INFO, buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR ) {
printf ("\tSupplementary info %.*s\n", (int)length, buffer);
}
/* reason - non-success report only */
(rp, X400_N_NON_DELIVERY_REASON, &int_param);
if ( status == X400_E_NOERROR ) {
printf ("\tNon-delivery Reason %d\n", int_param);
}
/* diagnostic info - non-success report only */
(rp, X400_N_NON_DELIVERY_DIAGNOSTIC, &int_param);
if ( status == X400_E_NOERROR ) {
printf ("\tNon-delivery diagnostic %d\n", int_param);
}
/* CEITS */
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR ) {
printf ("\tCEIT info %.*s\n", (int)length, buffer);
}
#define USE_REDIRECTION_HISTORY 1
#ifdef USE_REDIRECTION_HISTORY
{
status = do_redirection_hist(rp);
if ( status == X400_E_NO_VALUE ) {
/* do nothing */
} else if (status == X400_E_MISSING_ATTR ) {
printf("There is no Redirection History\n");
} else if (status != X400_E_NOERROR) {
printf("error getting Redirection History\n");
fprintf (stderr, "Error fetching Redirection History: %s\n",
X400mtError (status));
return status;
}
}
#endif
if ( status == X400_E_NOERROR ) {
if (int_param & X400_ACP127_NOTI_TYPE_NEG) {
printf("P772 ACP127 Notification Request Type Negative\n");
}
if (int_param & X400_ACP127_NOTI_TYPE_POS) {
printf("P772 ACP127 Notification Request Type Positive\n");
}
if (int_param & X400_ACP127_NOTI_TYPE_TRANS) {
printf("P772 ACP127 Notification Request Type Transfer\n");
}
}
/* report content integrity check info if available */
get_cic(rp);
/* report message token info if available */
report_sig_info(rp);
printf("-----------------------------------------------------------\n");
}
}
static int do_rep_env(
struct X400mtMessage *mp
)
{
char buffer[BUFSIZ];
int status;
size_t length;
/* Envelope Attributes */
/* string attributes */
/* The ORADDRESS in the message is the (envelope) originator */
buffer, sizeof buffer , &length);
if ( status != X400_E_NOERROR ) {
if (status == X400_E_NO_VALUE) {
printf("Reports don't have an originator\n");
} else {
printf("error getting originator address\n");
fprintf (stderr, "Error in getting originator: %s\n",
X400mtError (status));
return (status);
}
} else {
printf ("Originator: %.*s\n", (int)length, buffer);
}
/* report identifier - rather confusingly, use X400_S_MESSAGE_IDENTIFIER */
buffer, sizeof buffer , &length);
if ( status != X400_E_NOERROR ) {
printf("error getting report identifier\n");
fprintf (stderr, "Error in getting report identifier: %s\n",
X400mtError (status));
return (status);
}
printf ("report identifier: %.*s\n", (int)length, buffer);
/* content identifier not present in report */
/* original EITs */
status = X400mtMsgGetStrParam (mp,
buffer, sizeof buffer , &length);
if (status == X400_E_NOERROR) {
printf ("original EITs: %.*s\n", (int)length, buffer);
} else if ( status != X400_E_NO_VALUE ) {
fprintf (stderr, "Error in getting original EITs : %s\n",
X400mtError (status));
return (status);
}
/* submission time not present in report*/
#ifdef WANT_TRACE_INFO
{
status = do_trace_info(mp);
if ( status == X400_E_NO_VALUE) {
} else if (status == X400_E_MISSING_ATTR ) {
printf("There is no Trace Info\n");
} else if (status != X400_E_NOERROR) {
printf("error getting Trace Info\n");
fprintf (stderr, "Error fetching trace info: %s\n",
X400mtError (status));
return status;
}
}
#endif
#ifdef USE_REDIRECTION_HISTORY
{
status = do_redirection_hist_env(mp);
if ( status == X400_E_NO_VALUE ) {
/* do nothing */
} else if (status == X400_E_MISSING_ATTR ) {
printf("There is no Redirection History\n");
} else if (status != X400_E_NOERROR) {
printf("error getting Redirection History\n");
fprintf (stderr, "Error fetching Redirection History: %s\n",
X400mtError (status));
return status;
}
}
#endif
status = do_orig_and_dl(mp);
if ( status == X400_E_NO_VALUE ) {
/* do nothing */
} else if (status == X400_E_MISSING_ATTR ) {
printf("There is no orig and dl exp history\n");
} else if (status != X400_E_NOERROR) {
fprintf (stderr, "Error getting orig and dl exp history: %s\n",
X400mtError (status));
return status;
}
/* latest delivery time */
buffer, sizeof buffer , &length);
if ( status != X400_E_NOERROR && status != X400_E_INVALID_ATTR) {
printf("error getting latest delivery time\n");
fprintf (stderr, "Error in getting latest delivery time: %s\n",
X400mtError (status));
return (status);
} else {
printf ("latest delivery time: %.*s\n", (int)length, buffer);
}
/* Get the envelope recipients */
status = get_recips(mp, X400_RECIP_ENVELOPE, "envelope");
if ( status != X400_E_NOERROR && status != X400_E_NO_RECIP) {
printf("error getting recipients\n");
fprintf (stderr, "Error in getting recipient: %s\n",
X400mtError (status));
return (status);
}
/* Get the reporting dl name */
status = get_recips(mp, X400_REPORTING_DL_NAME, "Reporting DL name");
if ( status != X400_E_NOERROR && status != X400_E_NO_RECIP) {
printf("error getting dl name\n");
fprintf (stderr, "Error in getting recipient: %s\n",
X400mtError (status));
return (status);
}
}
static void report_sig_info(
struct X400Recipient *rp
)
{
char buffer[BUFSIZ];
int status;
int param;
size_t length;
show_certificate (rp, X400_N_CERT_MSGTOK, "message-token");
status = X400mtRecipGetStrParam(rp,
buffer, sizeof buffer, &length);
if (status != X400_E_NOERROR) {
fprintf(stderr, "Error from RecipGetStrParam: %s\n",
X400mtError(status));
fprintf(stderr, "recipient in token not available\n");
} else {
fprintf(stderr,
"Message Token(%u): recipient in Token '%.*s'\n",
(unsigned)length, (int)length, buffer);
}
status = X400mtRecipGetStrParam(rp,
buffer, sizeof buffer, &length);
if (status != X400_E_NOERROR) {
fprintf(stderr, "Error from RecipGetStrParam: %s (%d)\n",
X400mtError(status),
fprintf(stderr, "Message Token DER not available\n");
} else {
fprintf(stderr,
"Message Token DER available (%u bytes)\n", (unsigned)length);
}
status = X400mtRecipGetIntParam(rp,
if (status != X400_E_NOERROR) {
fprintf(stderr, "Error from RecipGetStrParam: %s (%d)\n",
X400mtError(status),
fprintf(stderr, "Message Token seq num not available\n");
} else {
fprintf(stderr,
"Message Token seq num %d \n", param);
}
status = X400mtRecipGetStrParam(rp,
buffer, sizeof buffer, &length);
if (status != X400_E_NOERROR) {
fprintf(stderr, "Error from RecipGetStrParam: %s (%d)\n",
X400mtError(status),
fprintf(stderr, "Message Token Security Label DER not available\n");
} else {
fprintf(stderr,
"Message Token Security Label DER available (%u bytes)\n", (unsigned)length);
fprintf(stderr, "Security Label from Message Token is:\n");
print_sec_label((unsigned char *)buffer, length);
}
status = X400mtRecipGetStrParam(rp,
buffer, sizeof buffer, &length);
if (status != X400_E_NOERROR) {
fprintf(stderr, "Error from RecipGetStrParam: %s (%d)\n",
X400mtError(status),
fprintf(stderr,
"Message Token Content Integrity Check DER not available\n");
} else {
fprintf(stderr,
"Message Token Content Integrity Check DER available (%u bytes)\n",
(unsigned)length);
}
show_certificate (rp, X400_N_CERT_MSGTOK_CIC, "token CIC");
return;
}
static void print_sec_label(
unsigned char slab_buffer[],
unsigned int length
)
{
char xml_buffer[XML_BUFSIZE];
int status;
status = SecLabelInit("Example program");
if (status != SECLABEL_E_NOERROR) {
fprintf(stderr, "SecLabelInit returned error %d\n", status);
return ;
}
status = SecLabelPrint(slab_buffer,
length,
xml_buffer,
XML_BUFSIZE);
if (status != SECLABEL_E_NOERROR) {
fprintf(stderr, "SecLabelParse returned error %d\n", status);
return ;
}
/* You could now write out the XML file, or parse it in memory..*/
printf("Got security label:%s\n", xml_buffer);
return;
}
static int get_cic(
struct X400Recipient *rp
)
{
char buffer[BUFSIZ];
int status, cic_status;
int intparam;
size_t length;
/* get back status of the Content Integrity Check in the recipient */
&intparam);
if (cic_status == X400_E_NO_VALUE) {
printf("No Content Integrity Check in recipient\n");
} else if (cic_status != X400_E_NOERROR) {
printf("Error from RecipGetIntParam: %s\n", X400mtError(cic_status));
return cic_status;
}
/* report CIC information */
switch (intparam) {
printf("Content Integrity Check succeeded\n");
break;
default:
printf("Content Integrity Check error (%d): %s\n",
intparam, X400mtError(intparam));
break;
}
/* Return the Content Integrity Check */
buffer, sizeof buffer, &length);
if (status != X400_E_NOERROR) {
fprintf(stderr, "Error getting recipient cic: %s\n",
X400mtError(status));
} else {
printf("Content Integrity Check found in recipient (%d)\n",
(int)length);
}
show_certificate (rp, X400_N_CERT_RECIP_CIC, "recipient CIC");
}
static void show_certificate (
struct X400Recipient *rp,
int certtype,
const char *tag)
{
int status;
struct X400Certificate *cert;
char buffer[BUFSIZ];
size_t length;
int paramval;
status = X400RecipGetCert (rp, certtype, &cert);
if ( status != X400_E_NOERROR ) {
fprintf (stderr, "Error getting %s certificate: %s\n",
tag, X400mtError (status));
return;
}
/* Return the subject DN from Orig cert */
buffer, sizeof buffer, &length);
if (status != X400_E_NOERROR) {
fprintf(stderr, "Error getting subject of cert used for %s: %s\n",
tag, X400mtError(status));
} else {
printf("Subject of Cert used to verify %s (%.*s)\n",
tag, (int)length, buffer);
}
/* Return the issuer DN from Orig cert */
buffer, sizeof buffer, &length);
if (status != X400_E_NOERROR) {
fprintf(stderr, "Error getting issuer of cert used for %s: %s\n",
tag, X400mtError(status));
} else {
printf("Issuer of Cert used to verify %s (%.*s)\n",
tag, (int)length, buffer);
}
/* Return the serial number from Orig cert used to verify the
* Content Integrity Check */
buffer, sizeof buffer, &length);
if (status != X400_E_NOERROR) {
fprintf(stderr, "Error getting serial num of cert used for %s: %s\n",
tag, X400mtError(status));
} else {
printf("Serial Num of Cert used to verify %s (%.*s)\n",
tag, (int)length, buffer);
}
/* Return the Orig cert used to verify the Content Integrity Check */
buffer, sizeof buffer, &length);
if (status != X400_E_NOERROR) {
fprintf(stderr, "Error getting cert der used for %s: %s\n",
tag, X400mtError(status));
} else {
printf(
"Returned Cert used to verify %s (%d)\n",
tag, (int)length);
}
/* Find any ORaddress subject alt name and its status */
buffer, sizeof buffer, &length);
if (status != X400_E_NOERROR) {
if ( status == X400_E_NO_VALUE ) {
fprintf(stderr, "No ORaddress subject alt. name\n");
} else {
fprintf(stderr, "Error from CertGetStrParam: %s\n",
X400mtError(status));
return;
}
} else {
fprintf(stderr, "ORaddress subject alt name: '%.*s'\n",
(int)length, buffer);
}
if (status != X400_E_NOERROR) {
fprintf(stderr, "Error from CertGetStrParam: %s\n",
X400mtError(status));
return;
}
fprintf(stderr, "ORaddress subject alt name status: %s\n",
X400mtError (paramval));
}
static int do_rep_content(
struct X400mtMessage *mp
)
{
char buffer[BUFSIZ];
int status;
size_t length;
/* Message Body */
printf("Report content\n");
/* subject ID */
buffer, sizeof buffer , &length);
if ( status != X400_E_NOERROR ) {
printf("error getting subject id\n");
fprintf (stderr, "Error in getting subject id: %s\n",
X400mtError (status));
return (status);
}
printf ("subject id: %.*s\n", (int)length, buffer);
/* content-correlator */
buffer, sizeof buffer , &length);
if ( status != X400_E_NOERROR ) {
printf("error getting icontent-correlator\n");
fprintf (stderr, "Error in getting content-correlator: %s\n",
X400mtError (status));
return (status);
}
printf ("content-correlator: %.*s\n", (int)length, buffer);
/* Get the reported recipients */
status = get_recips(mp, X400_RECIP_REPORT, "reported-recip");
if ( status != X400_E_NOERROR && status != X400_E_NO_RECIP) {
printf("error getting reported-recip\n");
fprintf (stderr, "Error in getting reported-recip: %s\n",
X400mtError (status));
return (status);
}
#ifdef WANT_TRACE_INFO
{
status = do_trace_info(mp);
if ( status == X400_E_NO_VALUE) {
} else if (status == X400_E_MISSING_ATTR ) {
printf("There is no Trace Info\n");
} else {
printf("error getting Trace Info\n");
fprintf (stderr, "Error fetching trace info: %s\n",
X400mtError (status));
return status;
}
}
#endif
return(status);
}
static int do_rep_retcontent(
struct X400mtMessage *mp
)
{
char buffer[BUFSIZ];
int status;
size_t length;
int int_param;
printf("Returned content\n");
(mp, X400_N_NUM_ATTACHMENTS, &int_param);
if ( status == X400_E_NOERROR )
printf ("\tNum attachments %d\n", int_param);
else
printf ("\tNum attachments STATUS %d\n", status);
/* And now get message text (or it could be another type - ie not IA5) */
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR )
printf ("Text:\n%.*s\n", (int)length, buffer);
return status;
}
static void usage(void) {
printf("usage: %s\n", optstr);
printf("\t where:\n");
printf("\t -u : Don't prompt to override defaults \n");
printf("\t -o : Originator \n");
printf("\t -O : Originator Return Address \n");
printf("\t -r : Recipient\n");
printf("\t -c : X.400 passive channel\n");
printf("\t -l : Logline\n");
printf("\t -E : Stop after one attempt to transfer a msg\n");
return;
}
static int do_trace_info (
struct X400mtMessage *mp
)
{
char GDI [BUFSIZ];
char DSI_arrival_time[BUFSIZ];
int DSI_routing_action;
char DSI_attempted_domain[BUFSIZ];
char DSI_AA_def_time[BUFSIZ];
char DSI_AA_CEIT[BUFSIZ];
int DSI_AA_redirected = 0;
int DSI_AA_dl_operation = 0;
size_t length;
int n;
int status;
struct X400TraceInfo *info = NULL;
for ( n=1; ;n++ ) {
status = X400mtTraceInfoGet (mp, n, &info, X400_TRACE_INFO);
if (status != X400_E_NOERROR)
break;
GDI, BUFSIZ , &length);
if ( status == X400_E_NOERROR ) {
GDI[length] = '\0';
printf ("GDI entry %d OR Address:%s\n",n,GDI);
} else {
fprintf (stderr, "Error in do_trace_info: %s\n",
X400mtError (status));
}
DSI_arrival_time, BUFSIZ , &length);
if ( status == X400_E_NOERROR ) {
DSI_arrival_time[length] = '\0';
printf ("DSI arrival time %d :%s\n",n,DSI_arrival_time);
} else {
fprintf (stderr, "Error in do_trace_info: %s\n",
X400mtError (status));
}
&DSI_routing_action);
if ( status == X400_E_NOERROR ) {
printf ("DSI routing action %d :%s\n",n,
DSI_routing_action ? "rerouted" : "relayed");
} else {
fprintf (stderr, "Error in do_trace_info: %s\n",
X400mtError (status));
}
/* This one is optional*/
status = X400TraceInfoGetStrParam (info,
DSI_attempted_domain,
BUFSIZ ,&length);
if ( status == X400_E_NOERROR ) {
DSI_attempted_domain[length] = '\0';
printf ("DSI attempted domain %d :%s\n",n,DSI_attempted_domain);
} else {
fprintf (stderr, "Error in do_trace_info optional component: %s\n",
X400mtError (status));
}
/*optional*/
status = X400TraceInfoGetStrParam (info,
DSI_AA_def_time,
BUFSIZ ,&length);
if ( status == X400_E_NOERROR ) {
DSI_AA_def_time[length] = '\0';
printf ("DSI AA %d :%s\n",n,DSI_AA_def_time);
} else {
fprintf (stderr, "Error in do_trace_info optional component: %s\n",
X400mtError (status));
}
/*optional*/
status = X400TraceInfoGetStrParam (info,
DSI_AA_CEIT,
BUFSIZ ,&length);
if ( status == X400_E_NOERROR ) {
DSI_AA_CEIT[length] = '\0';
printf ("DSI AA %d :%s\n",n,DSI_AA_CEIT);
} else {
fprintf (stderr, "Error in do_trace_info optional component: %s\n",
X400mtError (status));
}
status = X400TraceInfoGetIntParam (info,
&DSI_AA_redirected);
if ( status == X400_E_NOERROR ) {
printf ("DSI AA redirected %d :%d\n",n,DSI_AA_redirected );
} else {
fprintf (stderr, "Error in do_trace_info: %s\n",
X400mtError (status));
}
status = X400TraceInfoGetIntParam (info,
&DSI_AA_dl_operation);
if ( status == X400_E_NOERROR ) {
printf ("DSI AA dl operation %d :%d\n",n,DSI_AA_dl_operation );
} else {
fprintf (stderr, "Error in do_trace_info: %s\n",
X400mtError (status));
}
}
if (n == 1) {
printf("No Trace Info found in message\n");
} else {
printf("%d Trace Info entries found in message\n", n - 1);
}
}
static int do_internal_trace_info (
struct X400mtMessage *mp
)
{
size_t length;
int n;
int status;
int SI_routing_action = 0;
int SI_attempted_action = 0;
int SI_OA = 0;
char GDI [BUFSIZ];
char SI_MTA_name [BUFSIZ];
char SI_time [BUFSIZ];
char SI_attempted_MTA_name[BUFSIZ];
char SI_attempted_domain [BUFSIZ];
char SI_defered_time [BUFSIZ];
char SI_CEIT [BUFSIZ];
struct X400InternalTraceInfo *info = NULL;
for ( n=1; ;n++ ) {
/*GDI*/
status = X400mtInternalTraceInfoGet (mp,n, &info);
if (status == X400_E_NO_VALUE)
break;
GDI, BUFSIZ , &length);
if (status == X400_E_NO_VALUE) {
}
if ( status == X400_E_NOERROR ) {
GDI[length] = '\0';
printf ("GDI entry %d Domain:%s\n",n,GDI);
} else {
fprintf (stderr, "Error in do_trace_info: %s\n",
X400mtError (status));
}
/*MTA Name */
SI_time, BUFSIZ , &length);
if (status == X400_E_NO_VALUE) {
}
if ( status == X400_E_NOERROR ) {
SI_time[length] = '\0';
printf ("SI time entry %d :%s\n",n,SI_time);
} else {
fprintf (stderr, "Error in do_internal_trace_info: %s\n",
X400mtError (status));
}
/*SI MTA Name*/
SI_MTA_name, BUFSIZ , &length);
if (status == X400_E_NO_VALUE) {
}
if ( status == X400_E_NOERROR ) {
SI_MTA_name[length] = '\0';
printf ("SI MTA Name entry %d :%s\n",n,SI_MTA_name);
} else {
fprintf (stderr, "Error in do_internal_trace_info: %s\n",
X400mtError (status));
}
/* SI routing action */
&SI_routing_action);
if ( status == X400_E_NOERROR ) {
if (SI_routing_action == X400_MTA_SI_ROUTING_ACTION_RELAYED) {
printf ("SI routing action %d :relayed\n",n);
} else {
printf ("SI routing action %d :rerouted\n",n);
}
} else {
fprintf (stderr, "Error in do_internal_trace_info: %s\n",
X400mtError (status));
}
&SI_attempted_action);
if ( status == X400_E_NOERROR ) {
if (SI_routing_action == X400_MTA_SI_RA_MTA) {
printf ("SI attempted action %d :MTA\n",n);
} else {
printf ("SI attempted action %d :Domain\n",n);
}
} else {
fprintf (stderr, "Error in do_internal_trace_info: %s\n",
X400mtError (status));
}
if (SI_attempted_action == X400_MTA_SI_RA_MTA) {
/* SI Attempted MTA Name */
SI_attempted_MTA_name,
BUFSIZ,&length);
if (status == X400_E_NO_VALUE) {
}
if ( status == X400_E_NOERROR ) {
SI_attempted_MTA_name[length] = '\0';
printf ("Supplied information attempted MTA %d"
":%s\n",n,SI_attempted_MTA_name);
} else {
fprintf (stderr, "Error in do_trace_info: %s\n",
X400mtError (status));
}
} else {
/*SI Attempted domain*/
SI_attempted_domain, BUFSIZ,
&length);
if (status == X400_E_NO_VALUE) {
}
if ( status == X400_E_NOERROR ) {
SI_attempted_domain[length] = '\0';
printf ("Supplied information attempted Domain entry"
" %d :%s\n",n,SI_attempted_domain);
} else {
fprintf (stderr, "Error in do_internal_trace_info: %s\n",
X400mtError (status));
}
}
/* SI MTA Defered time*/
SI_defered_time,
BUFSIZ , &length);
if (status == X400_E_NO_VALUE) {
}
if ( status == X400_E_NOERROR ) {
SI_defered_time[length] = '\0';
printf ("SI_defered_time entry %d :%s\n",n,
SI_defered_time);
} else {
fprintf (stderr, "Error in do_internaltrace_info: %s\n",
X400mtError (status));
}
/* SI MTA Converted Encoded Information Types*/
SI_CEIT,
BUFSIZ , &length);
if (status == X400_E_NO_VALUE) {
}
if ( status == X400_E_NOERROR ) {
SI_CEIT[length] = '\0';
printf ("SI_CEIT entry %d :%s\n",n,
SI_CEIT);
} else {
fprintf (stderr, "Error in do_internaltrace_info: %s\n",
X400mtError (status));
}
&SI_OA);
if ( status == X400_E_NOERROR ) {
printf("SI_Other_Actions: %d: Redirected\n",n);
}
printf("SI_Other_Actions: %d: DLOP\n",n);
}
} else {
fprintf (stderr, "Error in do_internal_trace_info: %s\n",
X400mtError (status));
}
}
if (n == 1) {
printf("No Internal Trace Info found in message\n");
} else {
printf("%d Internal Trace Info entries found in message\n", n - 1);
}
}
static int do_redirection_hist (
struct X400Recipient *recip
)
{
char redirection_time [BUFSIZ];
char or_address [BUFSIZ];
char dn [BUFSIZ];
int rr;
size_t length;
int n;
int status;
struct X400RediHist *hist = NULL;
for ( n=1; ;n++ ) {
status = X400RediHistGet (recip,n, &hist);
if (status != X400_E_NOERROR)
break;
redirection_time, BUFSIZ,&length);
if ( status == X400_E_NOERROR ) {
redirection_time[length] = '\0';
printf ("Redirection time: %i %s\n",n,redirection_time);
} else {
fprintf (stderr, "Error in do_redirection_hist: %s\n",
X400mtError (status));
}
or_address, BUFSIZ , &length);
if ( status == X400_E_NOERROR ) {
or_address[length] = '\0';
printf ("Redirection OR address %i :%s\n",n,or_address);
} else {
fprintf (stderr, "Error in do_trace_info: %s\n",
X400mtError (status));
}
dn, BUFSIZ , &length);
if ( status == X400_E_NOERROR ) {
dn[length] = '\0';
printf ("Redirection DN %i :%s\n",n,dn);
} else {
fprintf (stderr, "Error in do_trace_info: %s\n",
X400mtError (status));
}
if ( status == X400_E_NOERROR ) {
printf ("DSI routing action %d :%s\n",n,X400RediReason(rr));
} else {
fprintf (stderr, "Error in do_redirection_hist: %s\n",
X400mtError (status));
}
}
if (n == 1) {
printf("No Trace Info found in message\n");
} else {
printf("%d Trace Info entries found in message\n", n - 1);
}
}
static int do_redirection_hist_env (
struct X400mtMessage *msg
)
{
char redirection_time [BUFSIZ];
char or_address [BUFSIZ];
char dn [BUFSIZ];
int rr;
size_t length;
int n;
int status;
struct X400RediHist *hist = NULL;
for ( n=1; ;n++ ) {
status = X400mtRediHistGetEnv (msg,n, &hist);
if (status != X400_E_NOERROR)
break;
redirection_time, BUFSIZ,&length);
if ( status == X400_E_NOERROR ) {
redirection_time[length] = '\0';
printf ("Redirection time: %i %s\n",n,redirection_time);
} else {
fprintf (stderr, "Error in do_redirection_hist: %s\n",
X400mtError (status));
}
or_address, BUFSIZ , &length);
if ( status == X400_E_NOERROR ) {
or_address[length] = '\0';
printf ("Redirection OR address %i :%s\n",n,or_address);
} else {
fprintf (stderr, "Error in do_trace_info: %s\n",
X400mtError (status));
}
dn, BUFSIZ , &length);
if ( status == X400_E_NOERROR ) {
dn[length] = '\0';
printf ("Redirection DN %i :%s\n",n,dn);
} else {
fprintf (stderr, "Error in do_trace_info: %s\n",
X400mtError (status));
}
if ( status == X400_E_NOERROR ) {
printf ("DSI routing action %d :%s\n",n,X400RediReason(rr));
} else {
fprintf (stderr, "Error in do_redirection_hist: %s\n",
X400mtError (status));
}
}
if (n == 1) {
printf("No Redirection histories found in message\n");
} else {
printf("%d Redirection histories entries found in message\n", n - 1);
}
}
#ifdef HANDLING_MILITARY_IPN
static int get_acp127_ali (
struct X400ACP127Resp *resp
)
{
struct X400ALI *ali = NULL;
int n;
char buffer[BUFSIZ];
size_t length;
int status;
int int_param;
for ( n = 1; ; n++ ) {
status = X400ACP127RespGetALI (resp,&ali,n);
if ( status != X400_E_NOERROR )
return status;
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR ) {
printf ("P772 ACP127 response Notification "
"ALI recipient OR address %d: %.*s\n",
n, (int)length, buffer);
} else if ( status == X400_E_NO_VALUE) {
}
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR ) {
printf ("P772 ACP127 response Notification"
" ALI recipient DN address %d: %.*s\n",
n, (int)length, buffer);
}
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR ) {
printf ("P772 ACP127 response Notification"
" ALI recipient free form name %d: %.*s\n",
n, (int)length, buffer);
}
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR ) {
printf ("P772 ACP127 response Notification"
"ALI recipient Tel number %d: %.*s\n",
n, (int)length, buffer);
}
status = X400ALIGetIntParam (ali,X400_N_ALI_TYPE , &int_param);
if ( status == X400_E_NOERROR ) {
printf ("P772 ACP127 response Notification"
"ALI Type %d\n", int_param);
}
&int_param);
if ( status == X400_E_NOERROR ) {
printf ("P772 ACP127 response Notification"
"ALI Notification Request %d\n", int_param);
}
status = X400ALIGetIntParam (ali,X400_N_ALI_REPLY_REQUEST ,&int_param);
if ( status == X400_E_NOERROR ) {
printf ("P772 ACP127 response Notification"
"ALI Notification Request %d\n", int_param);
}
}
}
#endif
/* This is a very simple function to go through the P772 body parts only.
* It's a modified version of what's in x400_msrcv.c
*/
static int get_body_parts(
struct X400mtMessage *mp
)
{
#define INIT_BUFFER_SIZE 10000
int status = X400_E_NOERROR;
int type = 0;
char *buf;
size_t buflen;
size_t ret_len;
int i = 0;
struct X400Bodypart *bp;
buf = (char *) malloc(INIT_BUFFER_SIZE);
if (buf == NULL) {
fprintf(stderr, "can't alloc %d bytes\n", INIT_BUFFER_SIZE);
}
buflen = INIT_BUFFER_SIZE;
for (i = 1; i <= num_atts ; i++) {
printf ("Get attachment %d\n", i);
status = X400mtMsgGetBodypart(mp, i, &type, &bp);
if (status != X400_E_NOERROR &&
status != X400_E_MESSAGE_BODY) {
fprintf(stderr, "X400mtMsgGetBodypart %d failed %s\n", i,
X400mtError (status));
/* skip this bodypart.
* The IA5text bodypart has already been fetched throught the
* X400mtMsgGetStrParam interface.
* So fetching that bodypart fails here.
*/
break;
}
printf("got Bodypart %d, type = %s\n", i,
type == X400_T_IA5TEXT ? "IA5" :
type == X400_T_ISO8859_1 ? "ISO8859-1" :
type == X400_T_ISO8859_2 ? "ISO8859_2" :
type == X400_T_BINARY ? "Binary" :
type == X400_T_MESSAGE ? "Message" :
type == X400_T_FTBP ? "File Transfer BP" :
type == X400_T_GENERAL_TEXT ? "General Text" :
type == X400_T_CORRECTIONS ? "P772 Correction" :
type == X400_T_ACP127DATA ? "P772 ACP127 Data" :
type == X400_T_MM ? "P772 Forwarded MM" :
type == X400_T_FWDENC ? "P772 Forwarded Encrypted" :
type == X400_T_FWD_CONTENT ? " Forwarded Content":
type == X400_T_ADATP3 ? "P772 ADatP3" : "unknown"
);
switch (type) {
{
/* Fetch a forwarded bodypart */
char buffer[BUFSIZ];
struct X400Message *fwd_content_env = NULL;
size_t length = 0;
status = X400mtMsgGetMessageBody(mp,i,&fwd_content_env);
if (status != X400_E_NOERROR) {
fprintf(stderr, "X400mtMsgGetBodypart failed %s\n",
X400mtError (status));
free (buf);
return status;
}
status = X400MsgGetStrParam (fwd_content_env,
buffer, sizeof buffer , &length);
if (status == X400_E_NOERROR) {
printf ("Forwarded Content bodypart"
" Message Delivery Time: %.*s\n",
(int)length, buffer);
} else {
fprintf(stderr, "X400MsgGetStrParam failed %s\n",
X400mtError (status));
}
status = X400MsgGetStrParam (fwd_content_env,
buffer, sizeof buffer , &length);
if (status == X400_E_NOERROR) {
printf ("Forwarded Content bodypart"
" Message identifier: %.*s\n",
(int)length, buffer);
} else {
fprintf(stderr, "X400MsgGetStrParam failed %s\n",
X400mtError (status));
}
/* We currently don't support proof of submission */
status = X400MsgGetStrParam (fwd_content_env,
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR ) {
printf ("Forwarded content bodypart data: %i bytes\n",
(int)length);
} else {
fprintf(stderr, "X400MsgGetStrParam failed %s\n",
X400mtError (status));
}
break;
}
{
/* Fetch a forwarded bodypart */
char buffer[BUFSIZ];
struct X400Message *ENC_fwd = NULL;
size_t length = 0;
status = X400mtMsgGetMessageBody(mp,i,&ENC_fwd);
if (status != X400_E_NOERROR) {
fprintf(stderr, "X400mtMsgGetBodypart failed %s\n",
X400mtError (status));
free (buf);
return status;
}
buffer, sizeof buffer , &length);
if (status == X400_E_NOERROR) {
printf ("P772 Forwarded Encrypted bodypart"
" Message Delivery Time: %.*s\n",
(int)length, buffer);
} else {
fprintf(stderr, "X400MsgGetStrParam failed %s\n",
X400mtError (status));
}
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR ) {
printf ("P772 Forwarded encrypted bodypart data: %i bytes\n",
(int)length);
} else {
fprintf(stderr, "X400MsgGetStrParam failed %s\n",
X400mtError (status));
}
break;
}
case X400_T_MM:
{
/* Fetch a forwarded bodypart */
char buffer[BUFSIZ];
struct X400Message *MM_fwd = NULL;
size_t length = 0;
status = X400mtMsgGetMessageBody(mp,i,&MM_fwd);
if (status != X400_E_NOERROR) {
fprintf(stderr, "X400mtMsgGetBodypart failed %s\n",
X400mtError (status));
free (buf);
return status;
}
buffer, sizeof buffer , &length);
if (status == X400_E_NOERROR) {
printf ("P772 MM bodypart Message Delivery Time: %.*s\n",
(int)length, buffer);
} else {
fprintf(stderr, "X400MsgGetStrParam failed %s\n",
X400mtError (status));
}
buffer, sizeof buffer , &length);
if ( status == X400_E_NOERROR ) {
printf ("Subject: %.*s\n", (int)length, buffer);
} else {
fprintf(stderr, "X400MsgGetStrParam failed %s\n",
X400mtError (status));
}
break;
}
{
int parm_type;
X400_N_ADATP3_PARM, &parm_type);
if (status == X400_E_NO_VALUE) {
printf("No P772 ADatP3 parameters present\n");
} else if (status != X400_E_NOERROR) {
fprintf(stderr, "X400BodypartGetIntParam failed %s\n",
X400mtError (status));
free (buf);
return status;
}
printf("P772 ADatP3 Parm %d is %d\n",i,parm_type);
X400_N_ADATP3_CHOICE, &parm_type);
if (status != X400_E_NOERROR) {
fprintf(stderr, "X400BodypartGetIntParam failed %s\n",
X400mtError (status));
free (buf);
return status;
}
printf("P772 ADatP3 Choice %d is %d\n",i,parm_type);
buf,
buflen,
&ret_len);
if (status == X400_E_NOERROR)
printf("P772 ADatP3 %i data: %.*s \n",
i,(int)ret_len,buf);
break;
}
{
int parm;
char buffer [BUFSIZ];
size_t length;
&parm);
if (status != X400_E_NOERROR) {
fprintf(stderr, "X400BodypartGetIntParam failed %s\n",
X400mtError (status));
free (buf);
return status;
}
printf("P772 Corrections Parm %d is %d\n",i,parm);
buffer,
BUFSIZ,
&length);
if ( status == X400_E_NOERROR ) {
printf("P772 Correction %i data: %.*s \n",i,(int)length,buffer);
}
break;
}
{
int parm;
char buffer [BUFSIZ];
size_t length;
&parm);
if (status != X400_E_NOERROR) {
fprintf(stderr, "X400BodypartGetIntParam failed %s\n",
X400mtError (status));
free (buf);
return status;
}
printf("P772 ACP127Data Parm %d is %d\n",i,parm);
buffer,
BUFSIZ,
&length);
if ( status == X400_E_NOERROR ) {
printf("P772 ACP127Data %i data: %.*s \n",i,(int)length,buffer);
}
break;
}
default:
printf ("Skipping bodypart\n");
}
}
free (buf);
return status;
}
static int do_orig_and_dl (
struct X400mtMessage *mp
)
{
char exp_time [BUFSIZ];
char or_address [BUFSIZ];
char dn_address [BUFSIZ];
size_t length;
int n;
int status;
struct X400ORandDL *orig_and_dl = NULL;
for ( n=1; ;n++ ) {
status = X400mtORandDLGet (mp,n,&orig_and_dl);
if (status == X400_E_NO_VALUE) {
printf("Finished getting originator and dl expansion history\n");
return status;
} else if (status != X400_E_NOERROR) {
return status;
}
status = X400ORandDLGetStrParam (orig_and_dl,
exp_time, BUFSIZ,&length);
if ( status == X400_E_NOERROR ) {
exp_time[length] = '\0';
printf ("do_orig_and_dl: %i %s\n",n,exp_time);
} else if(status != X400_E_MISSING_ATTR ) {
fprintf (stderr, "Error in do_orig_and_dl: %s\n",
X400mtError (status));
}
or_address, BUFSIZ , &length);
if ( status == X400_E_NOERROR ) {
or_address[length] = '\0';
printf ("do_orig_and_dl OR address %i :%s\n",n,or_address);
} else if(status != X400_E_MISSING_ATTR ) {
fprintf (stderr, "Error in do_orig_and_dl: %s\n",
X400mtError (status));
}
status = X400ORandDLGetStrParam(orig_and_dl,
dn_address, BUFSIZ , &length);
if ( status == X400_E_NOERROR ) {
dn_address[length] = '\0';
printf ("originator and DL expansion DN %i :%s\n",n,dn_address);
} else if(status != X400_E_MISSING_ATTR ) {
fprintf (stderr, "Error in do_orig_and_dl: %s\n",
X400mtError (status));
}
}
}
#define X400_S_ORIGINATOR_RETURN_ADDRESS
Definition: x400_att.h:467
#define X400_MTA_SI_OTHER_ACTION_REDIRECTED
Definition: x400_att.h:1618
#define X400_N_ACP127_NOTI_TYPE
Definition: x400_att.h:912
X400COMMON_CDECL int X400ACP127RespGetStrParam(struct X400ACP127Resp *resp, int type, char *buffer, size_t buflen, size_t *paramlenp)
Get string parameter from ACP127 Notification Response object.
X400COMMON_CDECL int X400OtherRecipGetIntParam(struct X400OtherRecip *otherrecip, int *value)
Get integer parameter from the Other Recipient Indicator object.
#define X400_N_MTA_SI_ROUTING_ACTION
Definition: x400_att.h:1585
#define X400_S_LOG_CONFIGURATION_FILE
Definition: x400_att.h:1092
#define X400_MSG_PROBE
Definition: x400_att.h:35
X400COMMON_CDECL int X400RecipGetCert(struct X400Recipient *rp, int certtype, struct X400Certificate **certp)
Get certificate object from recipient This returns a certificate which was used to sign an object in ...
#define X400_N_EXT_CODRESS
Definition: x400_att.h:858
#define X400_S_ENCRYPTED_DATA_BYTES_ONLY
Definition: x400_att.h:985
X400COMMON_CDECL int X400BodypartGetIntParam(struct X400Bodypart *bp, int paramtype, int *valp)
Return a integer-valued parameter from the body part object.
#define X400_S_OBSOLETED_IPMS
Definition: x400_att.h:730
#define X400_S_CERT_ISSUER_DN
Definition: x400_att.h:1529
#define X400_AUTH_ORIG
Definition: x400_att.h:308
#define X400_N_RECIPIENT_REASSIGNMENT_PROHIBITED
Definition: x400_att.h:455
#define X400_S_CONTENT_CORRELATOR_IA5_STRING
Definition: x400_att.h:517
#define X400_S_REPLY_TIME
Definition: x400_att.h:740
#define X400_E_ADDRESS_ERROR
Definition: x400_att.h:118
#define X400_S_CONTENT_CORRELATOR
Definition: x400_att.h:505
#define X400_S_ACP127_NOTI_RESP_SUPP_INFO
Definition: x400_att.h:1676
#define X400_S_ORIGINATOR_REQUESTED_ALTERNATE_RECIPIENT
Definition: x400_att.h:662
#define X400_S_MSGTOK_RECIP
Definition: x400_att.h:1446
#define X400_RECIP_BCC
Definition: x400_att.h:302
#define X400_N_DISCLOSURE
Definition: x400_att.h:427
#define X400_S_ACP127_NOTI_RESP_TIME
Definition: x400_att.h:1667
#define X400_N_ACP127DATA_PARM
Definition: x400_att.h:942
#define X400_S_RECIP_CIC
Definition: x400_att.h:1478
#define X400_N_MTA_SI_ATTEMPTED_ACTION
Definition: x400_att.h:1603
#define X400_ADATP3_SEP
Definition: x400_att.h:1113
#define X400_S_ORIGINATORS_REFERENCE
Definition: x400_att.h:759
#define X400_S_DIST_CODES_EXT_OID
Definition: x400_att.h:894
#define X400_S_ORIGINAL_ENCODED_INFORMATION_TYPES
Definition: x400_att.h:417
#define X400_N_CONTENT_RETURN_REQUEST
Definition: x400_att.h:436
#define X400_S_ORIG_CERT
Definition: x400_att.h:975
int X400mtSetStrDefault(struct X400mtSession *sp, int paramtype, const char *value, size_t length)
Set a default string parameter value in a session.
#define X400_N_AUTOFORWARDED
Definition: x400_att.h:749
int X400mtMsgDelete(struct X400mtMessage *mp)
Delete message object.
X400COMMON_CDECL int X400ORandDLGetStrParam(struct X400ORandDL *or_and_dl, int paramtype, char *buffer, size_t buflen, size_t *paramlenp)
Get string parameter from ACP127 Response object.
#define X400_S_DIST_CODES_SIC
Definition: x400_att.h:888
X400COMMON_CDECL int X400ALIGetStrParam(struct X400ALI *ALI, int paramtype, char *buffer, size_t buflen, size_t *paramlenp)
Get string parameter from Address List Indicator object.
int X400mtInternalTraceInfoGet(struct X400mtMessage *mp, int entry, struct X400InternalTraceInfo **info)
Get an Internal Trace Info object for a message object.
X400COMMON_CDECL int X400CertGetIntParam(struct X400Certificate *cp, int paramtype, int *valp)
Return a integer-valued parameter from the certificate object.
#define X400_N_TYPE_OF_USER
Definition: x400_att.h:1045
int X400mtClose(struct X400mtSession *sp)
Close a X400 Session.
#define X400_S_INFO_SEC_LABEL
Definition: x400_att.h:915
X400COMMON_CDECL int X400PSSGetStrParam(struct X400PSS *pss, char *buffer, size_t buflen, size_t *paramlenp)
Get string parameter from Printable String Sequence object.
X400COMMON_CDECL int X400RediHistGet(struct X400Recipient *recip, int entry, struct X400RediHist **hist)
Get the Redirection History object from a recipient.
#define X400_N_EXT_MSG_TYPE
Definition: x400_att.h:861
#define X400_N_DSI_ROUTING_ACTION
Definition: x400_att.h:487
X400COMMON_CDECL int X400InternalTraceInfoGetStrParam(struct X400InternalTraceInfo *info, int paramtype, char *buffer, size_t buflen, size_t *paramlenp)
Get string parameter from Internal Trace Information object.
#define X400_N_CONVERSION_WITH_LOSS_PROHIBITED
Definition: x400_att.h:461
#define X400_N_ADATP3_CHOICE
Definition: x400_att.h:921
int X400mtDistFieldGet(struct X400mtMessage *mp, int entry, struct X400DistField **distfield)
Get a new P772 Distribution Field object for a message object.
int X400mtMsgGetStart(struct X400mtSession *sp, struct X400mtMessage **mpp, int *typep)
Get message object for transfer out from MTA.
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.
int X400mtOtherRecipGet(struct X400mtMessage *mp, int entry, struct X400OtherRecip **otherrecip)
Get a new P772 Other Recipient object for a message object.
#define X400_S_CONVERTED_ENCODED_INFORMATION_TYPES
Definition: x400_att.h:694
int X400mtMsgGetMessageBody(struct X400mtMessage *mp, int number, struct X400Message **mpp)
Return a pointer to a body part object.
int X400mtMsgGetBodypart(struct X400mtMessage *mp, int number, int *typep, struct X400Bodypart **bpp)
Return a pointer to a body part object.
#define X400_S_EXT_AUTH_INFO
Definition: x400_att.h:855
#define X400_S_CONTENT_FILE_PATH
Definition: x400_att.h:1078
#define X400_N_MSGTOK_STATUS
Definition: x400_att.h:1437
int X400mtRecipGet(struct X400mtMessage *mp, int type, int number, struct X400Recipient **rpp)
Get recipient object from message.
#define X400_S_MTA_SI_ATTEMPTED_MTA
Definition: x400_att.h:1588
#define X400_N_ADATP3_PARM
Definition: x400_att.h:918
X.400 Gateway Interface.
int X400mtMarkToFault(struct X400mtSession *sp, int attType, int fault)
Control how extension attributes in Envelopes and Envelope Recipient addresses are handled....
#define X400_N_NUM_ATTACHMENTS
Definition: x400_att.h:796
int X400mtOpen(const char *credentials, struct X400mtSession **spp)
Open a session to the MTA.
#define X400_S_REDIRECTION_TIME
Definition: x400_att.h:511
#define X400_E_NO_RECIP
Definition: x400_att.h:109
#define X400_T_ADATP3
Definition: x400_att.h:927
#define X400_N_RECIP_CIC_STATUS
Definition: x400_att.h:1475
#define X400_S_MTA_SI_ATTEMPTED_DOMAIN
Definition: x400_att.h:1591
#define X400_ACP127_NOTI_TYPE_NEG
Definition: x400_att.h:1648
#define X400_S_MSGTOK_CIC
Definition: x400_att.h:1464
#define X400_S_SECURITY_LABEL
Definition: x400_att.h:1348
#define X400_E_MESSAGE_BODY
Definition: x400_att.h:169
int X400mtMsgGetIntParam(struct X400mtMessage *mp, int paramtype, int *valp)
Return a integer-valued parameter from the message object.
#define X400_T_ACP127DATA
Definition: x400_att.h:939
#define X400_EXEMPTED_ADDRESS
Definition: x400_att.h:332
const char * X400mtError(int error)
Return string for error code.
#define X400_E_NO_VALUE
Definition: x400_att.h:100
X400COMMON_CDECL int X400RediHistGetStrParam(struct X400RediHist *hist, int paramtype, char *value, size_t length, size_t *lengthp)
Get string-valued parameter from the X400RediHist object.
#define X400_N_REPLY_REQUESTED
Definition: x400_att.h:683
#define X400_S_DSI_ATTEMPTED_DOMAIN
Definition: x400_att.h:490
#define X400_DL_EXEMPTED_RECIP
Definition: x400_att.h:323
#define X400_N_EXT_COPY_PREC
Definition: x400_att.h:867
#define X400_S_CERT_BER
Definition: x400_att.h:1523
X400COMMON_CDECL int X400ACP127RespGetIntParam(struct X400ACP127Resp *resp, int *value)
Get integer parameter from the ACP127 Notification Response object.
#define X400_T_BINARY
Definition: x400_att.h:825
#define X400_S_MTA_SI_TIME
Definition: x400_att.h:1582
int X400mtRecipGetIntParam(struct X400Recipient *rp, int paramtype, int *valp)
Return a integer-valued parameter from the recipient object.
#define X400_S_TELEPHONE_NUMBER
Definition: x400_att.h:673
#define X400_S_MSGTOK_SEC_LAB
Definition: x400_att.h:1449
#define X400_S_DIRECTORY_NAME
Definition: x400_att.h:397
#define X400_S_RELATED_IPMS
Definition: x400_att.h:734
int X400mtRediHistGetEnv(struct X400mtMessage *msg, int entry, struct X400RediHist **hist)
Get the Redirection History object from a message envelope this is represented by 8....
#define X400_N_OR_CANONICAL
Definition: x400_att.h:1136
#define X400_RECIP_CC
Definition: x400_att.h:299
#define X400_N_PRIORITY
Definition: x400_att.h:422
#define X400_T_MESSAGE
Definition: x400_att.h:828
#define X400_S_MESSAGE_DELIVERY_TIME
Definition: x400_att.h:442
#define X400_T_ISO8859_2
Definition: x400_att.h:817
#define X400_S_LATEST_DELIVERY_TIME
Definition: x400_att.h:464
#define X400_S_ACP127_MSG_ID
Definition: x400_att.h:906
#define X400_S_MSGTOK_DER
Definition: x400_att.h:1440
X400COMMON_CDECL int X400InternalTraceInfoGetIntParam(struct X400InternalTraceInfo *info, int paramtype, int *valuep)
Get int parameter from Internal Trace Information object.
#define X400_T_ISO8859_1
Definition: x400_att.h:809
#define X400_T_FWD_CONTENT
Definition: x400_att.h:966
#define X400_N_CERT_MSGTOK_CIC
Definition: x400_att.h:1513
int X400mtDLExpHistGet(struct X400mtMessage *mp, int entry, struct X400DLExpHist **hist)
Create a new DL Expansion History object from the message object.
#define X400_S_ORIG_REF
Definition: x400_att.h:882
#define X400_ACP127_NOTI_TYPE_POS
Definition: x400_att.h:1651
#define X400_MSG_REPORT
Definition: x400_att.h:32
#define X400_N_ALI_NOTIFICATION_REQUEST
Definition: x400_att.h:1635
X400COMMON_CDECL int X400DistFieldGetStrParam(struct X400DistField *distfield, int type, char *buffer, size_t buflen, size_t *paramlenp)
Get string parameter from Distribution Code extension Field object.
#define X400_T_IA5TEXT
Definition: x400_att.h:799
#define X400_S_DIST_CODES_EXT_VALUE
Definition: x400_att.h:897
#define X400_MTA_SI_OTHER_ACTION_DLOPERATION
Definition: x400_att.h:1621
#define X400_N_ALI_TYPE
Definition: x400_att.h:1632
X400COMMON_CDECL int X400ALIGetIntParam(struct X400ALI *ALI, int paramtype, int *valuep)
Get int parameter from Address List Indicator object.
#define X400_S_ACP127_NOTI_RESP_RECIPIENT
Definition: x400_att.h:1673
#define X400_MTA_SI_ROUTING_ACTION_RELAYED
Definition: x400_att.h:1612
#define X400_S_CONTENT_FILENAME
Definition: x400_att.h:772
#define X400_S_CONTENT_IDENTIFIER
Definition: x400_att.h:414
#define X400_S_MESSAGE_IDENTIFIER
Definition: x400_att.h:405
#define X400_MTA_SI_RA_MTA
Definition: x400_att.h:1606
#define X400_N_SENSITIVITY
Definition: x400_att.h:746
#define X400_T_FWDENC
Definition: x400_att.h:951
#define X400_S_ADATP3_DATA
Definition: x400_att.h:924
#define X400_T_MM
Definition: x400_att.h:948
#define X400_E_NO_MESSAGE
Definition: x400_att.h:103
#define X400_E_NOERROR
Definition: x400_att.h:46
#define X400_S_FWD_CONTENT_STRING
Definition: x400_att.h:960
#define X400_N_ALI_REPLY_REQUEST
Definition: x400_att.h:1638
#define X400_N_DSI_AA_REDIRECTED
Definition: x400_att.h:499
#define X400_N_REPORT_REQUEST
Definition: x400_att.h:654
X400COMMON_CDECL int X400RediHistGetIntParam(struct X400RediHist *info, int paramtype, int *valuep)
Get int parameter from Redirection History object.
X400COMMON_CDECL int X400MsgGetStrParam(struct X400Message *mp, int paramtype, char *buffer, size_t buflen, size_t *paramlenp)
Return a string-valued parameter from the message object.
int X400mtMsgGetStrParam(struct X400mtMessage *mp, int paramtype, char *buffer, size_t buflen, size_t *paramlenp)
Return a string-valued parameter from the message object.
#define X400_N_IMPLICIT_CONVERSION_PROHIBITED
Definition: x400_att.h:430
#define X400_N_REDIRECTION_REASON
Definition: x400_att.h:508
#define X400_S_EXPIRY_TIME
Definition: x400_att.h:737
#define X400_S_SUBJECT_IDENTIFIER
Definition: x400_att.h:1039
#define X400_S_AUTHORIZATION_TIME
Definition: x400_att.h:756
int X400mtPSSGet(struct X400mtMessage *mp, int type, int entry, struct X400PSS **pss)
Get a new Printable String Syntax object for a message object.
X400COMMON_CDECL int X400ACP127RespGetALI(struct X400ACP127Resp *resp, struct X400ALI **ali, int entry)
Get an Address List Indicator object associated with the X400ACP127 object.
#define X400_N_DSI_AA_DLOPERATION
Definition: x400_att.h:502
#define X400_S_EXTERNAL_CONTENT_TYPE
Definition: x400_att.h:447
#define X400_S_ORIGINATOR_REQUESTED_ALTERNATE_RECIPIENT_DN
Definition: x400_att.h:666
#define X400_N_CERT_ORADDRESS_STATUS
Definition: x400_att.h:1535
#define X400_N_CONTENT_LENGTH
Definition: x400_att.h:411
#define X400_N_MSGTOK_SEQ_NUM
Definition: x400_att.h:1443
#define X400_S_MESSAGE_INSTRUCTIONS
Definition: x400_att.h:877
#define X400_S_CONTENT_CORRELATOR_OCTET_STRING
Definition: x400_att.h:520
#define X400_E_MISSING_ATTR
Definition: x400_att.h:88
#define X400_S_ORIG_PLAD
Definition: x400_att.h:885
#define X400_RECIP_PRIMARY
Definition: x400_att.h:296
#define X400_S_CORREC_DATA
Definition: x400_att.h:936
#define X400_N_MTA_SI_OTHER_ACTIONS
Definition: x400_att.h:1600
int X400mtTraceInfoGet(struct X400mtMessage *mp, int entry, struct X400TraceInfo **info, int type)
Get a Trace Info object for a message object.
#define X400_S_CERT_SERIAL_NUM
Definition: x400_att.h:1532
#define X400_S_FREE_FORM_NAME
Definition: x400_att.h:670
#define X400_S_PILOT_FWD_INFO
Definition: x400_att.h:903
#define X400_N_DL_EXPANSION_PROHIBITED
Definition: x400_att.h:458
#define X400_S_ARRIVAL_TIME
Definition: x400_att.h:1048
#define X400_N_NON_DELIVERY_DIAGNOSTIC
Definition: x400_att.h:1054
#define X400_T_FTBP
Definition: x400_att.h:834
#define X400_N_NON_DELIVERY_REASON
Definition: x400_att.h:1051
X400COMMON_CDECL int X400TraceInfoGetStrParam(struct X400TraceInfo *info, int paramtype, char *buffer, size_t buflen, size_t *paramlenp)
Get string parameter from Trace Information object.
#define X400_S_SUBJECT
Definition: x400_att.h:723
const X400COMMON_CDECL char * X400RediReason(int redirection_reason)
Return a human readable string based on a redirection reason.
int X400mtALIGet(struct X400mtMessage *mp, int entry, struct X400ALI **ali)
Get a new Address List Indicator object for a message object.
#define X400_N_ALTERNATE_RECIPIENT_ALLOWED
Definition: x400_att.h:433
#define X400_N_IMPORTANCE
Definition: x400_att.h:743
#define X400_N_NOTIFICATION_REQUEST
Definition: x400_att.h:676
#define X400_N_CERT_MSGTOK
Definition: x400_att.h:1507
#define X400_S_REPLIED_TO_IDENTIFIER
Definition: x400_att.h:726
#define X400_S_MESSAGE_SUBMISSION_TIME
Definition: x400_att.h:439
#define X400_S_CERT_SUBJECT_DN
Definition: x400_att.h:1526
#define X400_S_GLOBAL_DOMAIN_ID
Definition: x400_att.h:481
#define X400_S_DSI_AA_CEIT
Definition: x400_att.h:496
int X400mtORandDLGet(struct X400mtMessage *msg, int entry, struct X400ORandDL **or_and_dl)
Get Originator and DL expansion history object.
#define X400_N_CORREC_PARM
Definition: x400_att.h:933
#define X400_S_SUPPLEMENTARY_INFO
Definition: x400_att.h:1042
#define X400_S_IPM_IDENTIFIER
Definition: x400_att.h:702
#define X400_T_CORRECTIONS
Definition: x400_att.h:930
#define X400_ACP127_NOTI_TYPE_TRANS
Definition: x400_att.h:1654
#define X400_N_EXT_PRIM_PREC
Definition: x400_att.h:864
int X400mtRecipGetStrParam(struct X400Recipient *rp, int paramtype, char *buffer, size_t buflen, size_t *paramlenp)
Return a string-valued parameter from the recipient object.
#define X400_S_EXT_MSG_IDENTIFIER
Definition: x400_att.h:981
#define X400_REPORTING_DL_NAME
Definition: x400_att.h:320
#define X400_S_ACP127_DATA
Definition: x400_att.h:945
#define X400_S_MTA_SI_DEFERRED_TIME
Definition: x400_att.h:1594
#define X400_S_HANDLING_INSTRUCTIONS
Definition: x400_att.h:873
#define X400_RECIP_REPLY
Definition: x400_att.h:311
#define X400_S_DSI_ARRIVAL_TIME
Definition: x400_att.h:484
X400COMMON_CDECL int X400OtherRecipGetStrParam(struct X400OtherRecip *otherrecip, char *buffer, size_t buflen, size_t *paramlenp)
Get string parameter from Other Recipient object.
X400COMMON_CDECL int X400TraceInfoGetIntParam(struct X400TraceInfo *info, int paramtype, int *valuep)
Get int parameter from Trace Information object.
X400COMMON_CDECL int X400CertGetStrParam(struct X400Certificate *cp, int paramtype, char *buffer, size_t buflen, size_t *paramlenp)
Return a string-valued parameter from the certificate object.
int X400mtSetIntDefault(struct X400mtSession *sp, int paramtype, int value)
Set a default integer parameter value in a session.
#define X400_N_RESPONSIBILITY
Definition: x400_att.h:643
#define X400_MSG_MESSAGE
Definition: x400_att.h:29
#define X400_N_MTA_REPORT_REQUEST
Definition: x400_att.h:646
int X400mtACP127RespGet(struct X400mtMessage *mp, struct X400ACP127Resp **respp)
Get the ACP127 Notification Response object from a message.
#define X400_S_DLEXP_TIME
Definition: x400_att.h:479
#define X400_N_CERT_RECIP_CIC
Definition: x400_att.h:1510
#define X400_E_NOMEMORY
Definition: x400_att.h:52
#define X400_S_MTA_SI_CEIT
Definition: x400_att.h:1597
#define X400_S_MOAC
Definition: x400_att.h:569
#define X400_T_GENERAL_TEXT
Definition: x400_att.h:841
#define X400_N_CONTENT_TYPE
Definition: x400_att.h:408
#define X400_E_INVALID_ATTR
Definition: x400_att.h:94
#define X400_S_OR_ADDRESS
Definition: x400_att.h:349
#define X400_S_MTA_NAME
Definition: x400_att.h:1579
#define X400_S_ORIG_OR_EXAP_TIME
Definition: x400_att.h:969
#define X400_S_DSI_AA_DEF_TIME
Definition: x400_att.h:493
X400COMMON_CDECL int X400BodypartGetStrParam(struct X400Bodypart *bp, int paramtype, char *buffer, size_t buflen, size_t *paramlenp)
Return a string-valued parameter from the body part object.
#define X400_TRACE_INFO
Definition: x400_att.h:1351
#define X400_RECIP_REPORT
Definition: x400_att.h:314
#define X400_RECIP_ENVELOPE
Definition: x400_att.h:335

All rights reserved © 2002 - 2024 Isode Ltd.