25 static int send_report (
28 static int add_recips_positive(
29 struct X400mtMessage *mp
31 static int add_recips_negative(
32 struct X400mtMessage *mp
35 struct X400mtMessage *mp
37 static int add_env_recip_info(
38 struct X400Recipient *rp
40 static void usage(
void);
44 static int do_redi_hist(
45 struct X400Recipient *rp
48 static int do_redi_hist_env(
49 struct X400mtMessage *msg
52 static void do_origandl(
53 struct X400mtMessage *msg
62 #define HOSTNAME "dhcp-164"
64 static char *optstr =
"uo:O:r:g:G:c:l:R:y:C:iaqsAv";
67 static const char orig_s[] =
"/S=x400test-orig/OU="HOSTNAME
"/O=GatewayMTA/PRMD=TestPRMD/ADMD=TestADMD/C=GB/";
68 static const char *orig = orig_s;
71 static const char recip_s[] =
"/S=x400test-recip2/OU="HOSTNAME
"/O=GatewayMTA/PRMD=TestPRMD/ADMD=TestADMD/C=GB/";
72 static const char *recip = recip_s;
76 static int def_content_type = 2;
77 static int def_bool = 0;
78 static int def_priority = 2;
81 static const char msg_id[] =
"/PRMD=TestPRMD/ADMD=TestADMD/C=GB/;"HOSTNAME
".2810401-030924.140212";
82 static const char content_id[] =
"030924.140212";
83 static const char content_corr[] =
"CONTENT-CORROLATOR";
84 static const char latest_del_time[] =
"120927120000Z";
96 orig = strdup(x400_default_gw_originator);
97 recip = strdup(x400_default_gw_recipient);
99 if (get_args(argc, argv, optstr)) {
104 if (x400_channel == NULL) {
105 printf(
"You must specify an X.400 channel\n");
110 printf(
"Delivery Report type (0 = Positive, 1 = Negative): ");
111 drtype = ic_fgetc(x400_contype, stdin);
112 if ((drtype !=
'0') && (drtype !=
'1'))
117 return send_report(drtype);
120 static int send_report (
125 struct X400mtSession *sp;
126 struct X400mtMessage *mp;
128 if (x400_channel == NULL) {
129 fprintf (stderr,
"No x400_channel value set in x400tailor file");
136 fprintf (stderr,
"Error in Open: %s\n",
X400mtError (status));
151 status = add_recips_positive(mp);
153 status = add_recips_negative(mp);
156 #define ADD_TRACE_INFO 1
157 #ifdef ADD_TRACE_INFO
159 struct X400TraceInfo *info1;
163 fprintf(stderr,
"Failed to allocate new trace info object \n");
170 "/PRMD=wibble/ADMD=TestADMD/C=GB/",
174 "Failed to add X400_S_GLOBAL_DOMAIN_ID to trace info\n");
184 "Failed to add X400_S_DSI_ARRIVAL_TIME to trace info\n");
191 "/PRMD=atmpdom/ADMD=TestADMD/C=GB/",
195 "Failed to add X400_S_DSI_ATTEMPTED_DOMAIN to trace info\n");
207 "Failed to add X400_S_DSI_AA_DEF_TIME to trace info\n");
214 status = build_env(mp);
221 fprintf (stderr,
"Error in MsgSend: %s\n",
X400mtError (status));
235 static int add_recips_positive(
236 struct X400mtMessage *mp
239 struct X400Recipient *rp;
249 status = add_env_recip_info (rp);
259 status = add_env_recip_info (rp);
265 fprintf (stderr,
"X400mtMsgAddStrParam returned error: %s\n",
X400mtError (status));
272 fprintf (stderr,
"X400mtMsgAddStrParam returned error: %s\n",
X400mtError (status));
279 fprintf (stderr,
"X400mtMsgAddStrParam returned error: %s\n",
X400mtError (status));
282 #define USE_REDIRECTION_HISTORY 1
283 #ifdef USE_REDIRECTION_HISTORY
294 static int add_recips_negative(
295 struct X400mtMessage *mp
298 struct X400Recipient *rp;
308 status = add_env_recip_info (rp);
318 status = add_env_recip_info (rp);
324 fprintf (stderr,
"X400mtMsgAddStrParam returned error: %s\n",
X400mtError (status));
331 fprintf (stderr,
"X400mtMsgAddStrParam returned error: %s\n",
X400mtError (status));
338 fprintf (stderr,
"X400mtMsgAddIntParam returned error: %s\n",
X400mtError (status));
345 fprintf (stderr,
"X400mtMsgAddIntParam returned error: %s\n",
X400mtError (status));
352 static int build_env(
353 struct X400mtMessage *mp
429 #ifdef USE_REDIRECTION_HISTORY
431 do_redi_hist_env(mp);
441 static int add_env_recip_info(
442 struct X400Recipient *rp
465 static void usage(
void) {
466 printf(
"usage: %s\n", optstr);
467 printf(
"\t where:\n");
468 printf(
"\t -u : Don't prompt to override defaults \n");
469 printf(
"\t -o : Originator \n");
470 printf(
"\t -O : Originator Return Address \n");
471 printf(
"\t -r : Recipient\n");
472 printf(
"\t -c : X.400 passive channel\n");
473 printf(
"\t -l : Logline\n");
474 printf(
"\t -R : Reports (0 - never, 1 - always, 2 - always NDR \n");
475 printf(
"\t -y : Priority (0 - normal, 1 - non-urgent, 2 - urgent \n");
476 printf(
"\t -C : Content Type (2/22/772/OID) \n");
477 printf(
"\t -i : Implicit conversion prohibited = TRUE \n");
478 printf(
"\t -a : Alternate Recipient Prohibited = TRUE \n");
479 printf(
"\t -q : Content Return Request = TRUE \n");
480 printf(
"\t -s : Disclosure of Recipient = FALSE \n");
481 printf(
"\t -A : Recipient Reassignment Prohibited = FALSE \n");
482 printf(
"\t -v : Conversion with Loss Prohibited = FALSE \n");
487 static int do_redi_hist(
488 struct X400Recipient *rp
491 struct X400RediHist *hist1;
492 struct X400RediHist *hist2;
497 fprintf(stderr,
"Failed to allocate new trace info object \n");
508 "Failed to add X400_S_REDIRECTION_TIME to Redirection Hist\n");
514 "/cn=redihist/prmd=TestPRMD/admd=TestPRMD/C=gb",
518 "Failed to add X400_S_OR_ADDRESS to Redirection Hist\n");
528 "Failed to add X400_S_DIRECTORY_NAME to Redirection Hist\n");
538 "Failed to add X400_N_REDIRECTION_REASON to trace info\n");
546 fprintf(stderr,
"Failed to allocate new trace info object \n");
557 "Failed to add X400_S_REDIRECTION_TIME to Redirection Hist\n");
563 "/cn=redihist2/prmd=TestPRMD/admd=TestPRMD/C=gb",
567 "Failed to add X400_S_OR_ADDRESS to Redirection Hist\n");
577 "Failed to add X400_S_DIRECTORY_NAME to Redirection Hist\n");
587 "Failed to add X400_N_REDIRECTION_REASON to "
588 "Redirection Hist\n");
594 static int do_redi_hist_env(
595 struct X400mtMessage *msg
598 struct X400RediHist *hist1;
599 struct X400RediHist *hist2;
604 fprintf(stderr,
"Failed to allocate new trace info object \n");
615 "Failed to add X400_S_REDIRECTION_TIME to Redirection Hist\n");
621 "/cn=redihist/prmd=TestPRMD/admd=TestPRMD/C=gb",
625 "Failed to add X400_S_OR_ADDRESS to Redirection Hist\n");
635 "Failed to add X400_S_DIRECTORY_NAME to Redirection Hist\n");
645 "Failed to add X400_N_REDIRECTION_REASON to trace info\n");
653 fprintf(stderr,
"Failed to allocate new trace info object \n");
664 "Failed to add X400_S_REDIRECTION_TIME to Redirection Hist\n");
670 "/cn=redihist2/prmd=TestPRMD/admd=TestPRMD/C=gb",
674 "Failed to add X400_S_OR_ADDRESS to Redirection Hist\n");
684 "Failed to add X400_S_DIRECTORY_NAME to Redirection Hist\n");
694 "Failed to add X400_N_REDIRECTION_REASON to "
695 "Redirection Hist\n");
701 static void do_origandl(
702 struct X400mtMessage *msg
705 struct X400ORandDL *or_and_dl1;
706 struct X400ORandDL *or_and_dl2;
708 const char *origin_or_address =
"/cn=origandlorig/prmd=TestPRMD/admd=TestPRMD/C=gb/";
709 const char *origin_dn_address =
"CN=origandlorig,c=GB";
714 fprintf(stderr,
"Failed to allocate new OR Address and DL "
715 "expansion object \n");
726 "Failed to add X400_S_ORIG_OR_EXAP_TIME "
740 "Failed to add X400_S_OR_ADDRESS "
752 "Failed to add X400_S_DIRECTORY_NAME "
758 fprintf(stderr,
"Failed to allocate new OR Address and DL "
759 "expansion object \n");
770 "Failed to add X400_S_ORIG_OR_EXAP_TIME "
784 "Failed to add X400_S_OR_ADDRESS "
796 "Failed to add X400_S_DIRECTORY_NAME "
#define X400_N_RECIPIENT_REASSIGNMENT_PROHIBITED
#define X400_S_CONTENT_CORRELATOR_IA5_STRING
X400COMMON_CDECL int X400RediHistAddIntParam(struct X400RediHist *hist, int paramtype, int value)
Set an integer value in a Redirection History object.
#define X400_SUBJECT_TRACE_INFO
#define X400_N_DISCLOSURE
#define X400_N_CONTENT_RETURN_REQUEST
int X400mtMsgDelete(struct X400mtMessage *mp)
Delete message object.
int X400mtClose(struct X400mtSession *sp)
Close a X400 Session.
X400COMMON_CDECL int X400ORandDLAddStrParam(struct X400ORandDL *or_and_dl, int type, const char *value, size_t length)
Add string parameter for a Originator and DL Expansion History object.
#define X400_N_CONVERSION_WITH_LOSS_PROHIBITED
#define X400_S_CONVERTED_ENCODED_INFORMATION_TYPES
int X400mtRediHistNewEnv(struct X400mtMessage *msg, struct X400RediHist **hist)
Create a new Redirection History object for a message envelope this is represented by 8....
int X400mtRecipAddStrParam(struct X400Recipient *rp, int paramtype, const char *value, size_t length)
Add string-valued parameter to the message.
int X400mtOpen(const char *credentials, struct X400mtSession **spp)
Open a session to the MTA.
X400COMMON_CDECL int X400RediHistNew(struct X400Recipient *recip, struct X400RediHist **hist)
Create a new Redirection History object.
#define X400_S_REDIRECTION_TIME
const char * X400mtError(int error)
Return string for error code.
#define X400_S_DSI_ATTEMPTED_DOMAIN
int X400mtRecipNew(struct X400mtMessage *mp, int type, struct X400Recipient **rpp)
Add new recipient to a message.
#define X400_S_DIRECTORY_NAME
#define X400_S_MESSAGE_DELIVERY_TIME
#define X400_S_LATEST_DELIVERY_TIME
int X400mtMsgAddStrParam(struct X400mtMessage *mp, int paramtype, const char *value, size_t length)
Add string-valued parameter to the message.
#define X400_S_CONTENT_IDENTIFIER
#define X400_S_MESSAGE_IDENTIFIER
#define X400_N_REPORT_REQUEST
#define X400_N_IMPLICIT_CONVERSION_PROHIBITED
#define X400_N_REDIRECTION_REASON
int X400mtMsgAddIntParam(struct X400mtMessage *mp, int paramtype, int value)
Add integer-valued parameter to the message.
#define X400_S_SUBJECT_IDENTIFIER
int X400mtRecipAddIntParam(struct X400Recipient *rp, int paramtype, int value)
Add integer-valued parameter to the message.
int X400mtMsgNew(struct X400mtSession *sp, int type, struct X400mtMessage **mpp)
Creates new message.
#define X400_RR_RECIP_ASSIGNED_ALT_RECIP
#define X400_N_ORIGINAL_RECIPIENT_NUMBER
X400COMMON_CDECL int X400TraceInfoAddStrParam(struct X400TraceInfo *info, int paramtype, const char *value, size_t length)
Add string-valued parameter to the X400TraceInfo object.
int X400mtMsgSend(struct X400mtMessage *mp)
Send message object to MTA.
#define X400_N_DL_EXPANSION_PROHIBITED
#define X400_S_ARRIVAL_TIME
#define X400_N_NON_DELIVERY_DIAGNOSTIC
#define X400_N_NON_DELIVERY_REASON
#define X400_N_ALTERNATE_RECIPIENT_ALLOWED
X400COMMON_CDECL int X400RediHistAddStrParam(struct X400RediHist *hist, int paramtype, const char *value, size_t length)
Add string-valued parameter to the X400RediHist object.
#define X400_S_GLOBAL_DOMAIN_ID
#define X400_S_SUPPLEMENTARY_INFO
#define X400_S_DSI_ARRIVAL_TIME
#define X400_N_RESPONSIBILITY
int X400mtORandDLNew(struct X400mtMessage *msg, struct X400ORandDL **or_and_dl)
Create new Originator and DL expansion history object.
#define X400_N_MTA_REPORT_REQUEST
int X400mtTraceInfoNew(struct X400mtMessage *mp, struct X400TraceInfo **info, int type)
Create a new Trace Info object for a message object.
#define X400_N_CONTENT_TYPE
#define X400_S_OR_ADDRESS
#define X400_S_ORIG_OR_EXAP_TIME
#define X400_S_DSI_AA_DEF_TIME
#define X400_RECIP_REPORT
#define X400_RECIP_ENVELOPE
All rights reserved © 2002 - 2024 Isode Ltd.