x400_mtsend_rep.c
1 /* Copyright (c) 2004-2024, Isode Limited, London, England.
2  * All rights reserved.
3  *
4  * Acquisition and use of this software and related materials for any
5  * purpose requires a written licence agreement from Isode Limited,
6  * or a written licence from an organisation licenced by Isode Limited
7  * to grant such a licence.
8  *
9  */
10 
11 /*
12  *
13  * @VERSION@
14  * Simple example program for transferring a report into the MTA
15  *
16  */
17 
18 #include <stdio.h>
19 #include <stdlib.h>
20 
21 #include <x400_mtapi.h>
22 #include "example.h"
23 
24 /* local functions */
25 static int send_report (
26  int drtype
27 );
28 static int add_recips_positive(
29  struct X400mtMessage *mp
30 );
31 static int add_recips_negative(
32  struct X400mtMessage *mp
33 );
34 static int build_env(
35  struct X400mtMessage *mp
36 );
37 static int add_env_recip_info(
38  struct X400Recipient *rp
39 );
40 static void usage(void);
41 
42 static int rno = 1;
43 
44 static int do_redi_hist(
45  struct X400Recipient *rp
46 );
47 
48 static int do_redi_hist_env(
49  struct X400mtMessage *msg
50 );
51 
52 static void do_origandl(
53  struct X400mtMessage *msg
54 );
55 
56 
57 /* These are the data items used */
58 
59 /* The O/R addresses used are intended to be compatible with those
60  * used in the quick install scripts mktailor.tcl, and createmhs.tcl.
61  * Change this value to the name of your host. */
62 #define HOSTNAME "dhcp-164"
63 
64 static char *optstr = "uo:O:r:g:G:c:l:R:y:C:iaqsAv";
65 
66 /* this value is used for the originator of the message */
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;
69 
70 /* default recipients */
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;
73 
74 
75 /* default envelope integer values */
76 static int def_content_type = 2;
77 static int def_bool = 0;
78 static int def_priority = 2;
79 
80 /* default envelope string values */
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";
85 
89 int main(
90  int argc,
91  char **argv
92 )
93 {
94  int drtype;
95 
96  orig = strdup(x400_default_gw_originator);
97  recip = strdup(x400_default_gw_recipient);
98 
99  if (get_args(argc, argv, optstr)) {
100  usage();
101  exit(-1);
102  }
103 
104  if (x400_channel == NULL) {
105  printf("You must specify an X.400 channel\n");
106  usage();
107  exit(-1);
108  }
109 
110  printf("Delivery Report type (0 = Positive, 1 = Negative): ");
111  drtype = ic_fgetc(x400_contype, stdin);
112  if ((drtype != '0') && (drtype != '1'))
113  exit(1);
114 
115  drtype -= '0';
116 
117  return send_report(drtype);
118 }
119 
120 static int send_report (
121  int drtype
122 )
123 {
124  int status;
125  struct X400mtSession *sp;
126  struct X400mtMessage *mp;
127 
128  if (x400_channel == NULL) {
129  fprintf (stderr, "No x400_channel value set in x400tailor file");
130  exit(1);
131  }
132 
133  /* open a new session */
134  status = X400mtOpen (x400_channel, &sp);
135  if ( status != X400_E_NOERROR ) {
136  fprintf (stderr, "Error in Open: %s\n", X400mtError (status));
137  exit (status);
138  }
139 
140  /* start preparing a new report */
141  status = X400mtMsgNew (sp, X400_MSG_REPORT, &mp);
142  /* Should report all errors as above */
143  if ( status != X400_E_NOERROR ) exit (status);
144 
145  /* setup originator using a single string */
146  status = X400mtMsgAddStrParam (mp, X400_S_OR_ADDRESS, orig, -1);
147  if ( status != X400_E_NOERROR ) exit (status);
148 
149  /* add various envelope and header recipients into the report */
150  if (drtype == 0)
151  status = add_recips_positive(mp);
152  else
153  status = add_recips_negative(mp);
154  if ( status != X400_E_NOERROR ) exit (status);
155 
156 #define ADD_TRACE_INFO 1
157 #ifdef ADD_TRACE_INFO
158  {
159  struct X400TraceInfo *info1; /*Will contain all trace information */
160 
161  status = X400mtTraceInfoNew(mp,&info1,X400_SUBJECT_TRACE_INFO);
162  if (status !=X400_E_NOERROR) {
163  fprintf(stderr,"Failed to allocate new trace info object \n");
164  exit(status);
165  }
166 
167 
168  status = X400TraceInfoAddStrParam (info1,
170  "/PRMD=wibble/ADMD=TestADMD/C=GB/",
171  -1);
172  if (status !=X400_E_NOERROR) {
173  fprintf(stderr,
174  "Failed to add X400_S_GLOBAL_DOMAIN_ID to trace info\n");
175  exit(status);
176  }
177 
178  status = X400TraceInfoAddStrParam (info1,
180  "071121125704Z",
181  -1);
182  if (status !=X400_E_NOERROR) {
183  fprintf(stderr,
184  "Failed to add X400_S_DSI_ARRIVAL_TIME to trace info\n");
185  exit(status);
186  }
187 
188  /*Add optional*/
189  status = X400TraceInfoAddStrParam (info1,
191  "/PRMD=atmpdom/ADMD=TestADMD/C=GB/",
192  -1);
193  if (status !=X400_E_NOERROR) {
194  fprintf(stderr,
195  "Failed to add X400_S_DSI_ATTEMPTED_DOMAIN to trace info\n");
196  exit(status);
197  }
198 
199 
200  /*Add optional*/
201  status = X400TraceInfoAddStrParam (info1,
203  "071122125704Z",
204  -1);
205  if (status !=X400_E_NOERROR) {
206  fprintf(stderr,
207  "Failed to add X400_S_DSI_AA_DEF_TIME to trace info\n");
208  exit(status);
209  }
210  }
211 #endif
212 
213  /* build rest of the report envelope */
214  status = build_env(mp);
215  if ( status != X400_E_NOERROR ) exit (status);
216 
217 
218  /* send the report */
219  status = X400mtMsgSend (mp);
220  if ( status != X400_E_NOERROR ) {
221  fprintf (stderr, "Error in MsgSend: %s\n", X400mtError (status));
222  exit (status);
223  }
224 
225  /* delete the message structure */
226  status = X400mtMsgDelete (mp);
227  if ( status != X400_E_NOERROR ) exit (status);
228 
229  mp = NULL;
230 
231  /* close the API session */
232  return X400mtClose (sp);
233 }
234 
235 static int add_recips_positive(
236  struct X400mtMessage *mp
237 )
238 {
239  struct X400Recipient *rp;
240  int status;
241 
242  /* add new recipient to the report envelope */
243  status = X400mtRecipNew (mp, X400_RECIP_ENVELOPE, &rp);
244  if ( status != X400_E_NOERROR ) return (status);
245  /* give recip an address */
246  status = X400mtRecipAddStrParam (rp, X400_S_OR_ADDRESS, recip, -1);
247  if ( status != X400_E_NOERROR ) return (status);
248  /* add other values to recip */
249  status = add_env_recip_info (rp);
250  if ( status != X400_E_NOERROR ) return (status);
251 
252  /* add new recipient to the report content */
253  status = X400mtRecipNew (mp, X400_RECIP_REPORT, &rp);
254  if ( status != X400_E_NOERROR ) return (status);
255  /* give recip an address */
256  status = X400mtRecipAddStrParam (rp, X400_S_OR_ADDRESS, recip, -1);
257  if ( status != X400_E_NOERROR ) return (status);
258  /* add other values to recip */
259  status = add_env_recip_info (rp);
260  if ( status != X400_E_NOERROR ) return (status);
261 
262  /* add the arrival time for this recipient */
263  status = X400mtRecipAddStrParam (rp, X400_S_ARRIVAL_TIME, "070701140026+0100", -1);
264  if ( status != X400_E_NOERROR ) {
265  fprintf (stderr, "X400mtMsgAddStrParam returned error: %s\n", X400mtError (status));
266  return (status);
267  }
268 
269  /* add the delivery time for this recipient (positive dr) */
270  status = X400mtRecipAddStrParam (rp, X400_S_MESSAGE_DELIVERY_TIME, "040701140026+0100", -1);
271  if ( status != X400_E_NOERROR ) {
272  fprintf (stderr, "X400mtMsgAddStrParam returned error: %s\n", X400mtError (status));
273  return (status);
274  }
275 
276  /* add the CEIT for this recipient */
278  if ( status != X400_E_NOERROR ) {
279  fprintf (stderr, "X400mtMsgAddStrParam returned error: %s\n", X400mtError (status));
280  return (status);
281  }
282 #define USE_REDIRECTION_HISTORY 1
283 #ifdef USE_REDIRECTION_HISTORY
284  /* Add redirection history for this recipient (8.3.1.1.1.5)*/
285  do_redi_hist(rp);
286 
287 
288 #endif
289 
290  return X400_E_NOERROR;
291 }
292 
293 
294 static int add_recips_negative(
295  struct X400mtMessage *mp
296 )
297 {
298  struct X400Recipient *rp;
299  int status;
300 
301  /* add new recipient to the report envelope */
302  status = X400mtRecipNew (mp, X400_RECIP_ENVELOPE, &rp);
303  if ( status != X400_E_NOERROR ) return (status);
304  /* give recip an address */
305  status = X400mtRecipAddStrParam (rp, X400_S_OR_ADDRESS, recip, -1);
306  if ( status != X400_E_NOERROR ) return (status);
307  /* add other values to recip */
308  status = add_env_recip_info (rp);
309  if ( status != X400_E_NOERROR ) return (status);
310 
311  /* add new recipient to the report content */
312  status = X400mtRecipNew (mp, X400_RECIP_REPORT, &rp);
313  if ( status != X400_E_NOERROR ) return (status);
314  /* give recip an address */
315  status = X400mtRecipAddStrParam (rp, X400_S_OR_ADDRESS, recip, -1);
316  if ( status != X400_E_NOERROR ) return (status);
317  /* add other values to recip */
318  status = add_env_recip_info (rp);
319  if ( status != X400_E_NOERROR ) return (status);
320 
321  /* add the arrival time for this recipient */
322  status = X400mtRecipAddStrParam (rp, X400_S_ARRIVAL_TIME, "070701140026+0100", -1);
323  if ( status != X400_E_NOERROR ) {
324  fprintf (stderr, "X400mtMsgAddStrParam returned error: %s\n", X400mtError (status));
325  return (status);
326  }
327 
328  /* add the supplementary info for this recipient (negative dr) */
329  status = X400mtRecipAddStrParam (rp, X400_S_SUPPLEMENTARY_INFO, "Couldn't delivery message", -1);
330  if ( status != X400_E_NOERROR ) {
331  fprintf (stderr, "X400mtMsgAddStrParam returned error: %s\n", X400mtError (status));
332  return (status);
333  }
334 
335  /* add the non-delivery reason for this recipient (negative dr) */
337  if ( status != X400_E_NOERROR ) {
338  fprintf (stderr, "X400mtMsgAddIntParam returned error: %s\n", X400mtError (status));
339  return (status);
340  }
341 
342  /* add the non-delivery diagnostic for this recipient (negative dr) */
344  if ( status != X400_E_NOERROR ) {
345  fprintf (stderr, "X400mtMsgAddIntParam returned error: %s\n", X400mtError (status));
346  return (status);
347  }
348 
349  return X400_E_NOERROR;
350 }
351 
352 static int build_env(
353  struct X400mtMessage *mp
354 )
355 {
356  int status;
357 
358  /* Envelope Attributes */
359 
360  /* Content Type: 2 or 22 */
361  status = X400mtMsgAddIntParam (mp, X400_N_CONTENT_TYPE, def_content_type);
362  if ( status != X400_E_NOERROR ) return (status);
363 
364  /* X400_N_CONTENT_LENGTH is probe only */
365 
366  /* Priority: 0 - normal, 1 - non-urgent, 2 - urgent */
367  status = X400mtMsgAddIntParam (mp, X400_N_PRIORITY, def_priority);
368  if ( status != X400_E_NOERROR ) return (status);
369 
370  /* Disclosure of recipients: 0 - no, 1 - yes */
371  status = X400mtMsgAddIntParam (mp, X400_N_DISCLOSURE, 1);
372  if ( status != X400_E_NOERROR ) return (status);
373 
374  /* Implicit conversion prohibited: 0 - no, 1 - yes */
376  if ( status != X400_E_NOERROR ) return (status);
377 
378  /* Alternate recipient allowed: 0 - no, 1 - yes */
380  if ( status != X400_E_NOERROR ) return (status);
381 
382  /* Content return request: 0 - no, 1 - yes */
383  /* hmm - 1 is headers - what does that do in X.400 ? */
385  if ( status != X400_E_NOERROR ) return (status);
386 
387  /* Recipient reassignment prohibited: 0 - no, 1 - yes */
389  if ( status != X400_E_NOERROR ) return (status);
390 
391  /* Distribution List expansion prohibited: 0 - no, 1 - yes */
392  status = X400mtMsgAddIntParam (mp, X400_N_DL_EXPANSION_PROHIBITED, def_bool);
393  if ( status != X400_E_NOERROR ) return (status);
394 
395  /* Conversion with loss prohibited: 0 - no, 1 - yes */
397  if ( status != X400_E_NOERROR ) return (status);
398 
399  /* string params */
400 
401  /* Message Identifier. In RFC 2156 String form */
402  status = X400mtMsgAddStrParam (mp, X400_S_MESSAGE_IDENTIFIER, msg_id, -1);
403  if ( status != X400_E_NOERROR ) return (status);
404 
405  /* Content correlator */
406  status = X400mtMsgAddStrParam (mp, X400_S_CONTENT_CORRELATOR_IA5_STRING, content_corr, -1);
407  if ( status != X400_E_NOERROR ) return (status);
408 
409  /* Content Identifier */
410  status = X400mtMsgAddStrParam (mp, X400_S_CONTENT_IDENTIFIER, content_id, -1);
411  if ( status != X400_E_NOERROR ) return (status);
412 
413  /* Subject Identifier, the Message Identifier of the original message */
414  status = X400mtMsgAddStrParam (mp, X400_S_SUBJECT_IDENTIFIER, msg_id, -1);
415  if ( status != X400_E_NOERROR ) return (status);
416 
417  /*
418  * X400_S_ORIGINAL_ENCODED_INFORMATION_TYPES
419  * X400_S_MESSAGE_SUBMISSION_TIME
420  * X400_S_MESSAGE_DELIVERY_TIME
421  * are read only, so don't add them
422  */
423 
424  /* Latest Delivery Time: UTCTime format YYMMDDHHMMSS<zone> */
425  status = X400mtMsgAddStrParam (mp, X400_S_LATEST_DELIVERY_TIME, latest_del_time, -1);
426  if ( status != X400_E_NOERROR ) return (status);
427 
428 
429 #ifdef USE_REDIRECTION_HISTORY
430  /*Add redirection history for the envelope (8.3.1.2.1.5) */
431  do_redi_hist_env(mp);
432 #endif
433 
434  do_origandl(mp);
435 
436  /* all OK */
437  return X400_E_NOERROR;
438 }
439 
440 
441 static int add_env_recip_info(
442  struct X400Recipient *rp
443 )
444 {
445  int status;
446 
447  /* add attributes to recipient in envelope */
449  if ( status != X400_E_NOERROR ) return (status);
450 
452  if ( status != X400_E_NOERROR ) return (status);
453 
455  if ( status != X400_E_NOERROR ) return (status);
456 
458  rno++;
459  if ( status != X400_E_NOERROR ) return (status);
460 
461  return X400_E_NOERROR;
462 }
463 
464 
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");
483  return;
484 }
485 
486 
487 static int do_redi_hist(
488  struct X400Recipient *rp
489 )
490  {
491  struct X400RediHist *hist1;
492  struct X400RediHist *hist2;
493  int status;
494 
495  status = X400RediHistNew(rp,&hist1);
496  if (status !=X400_E_NOERROR) {
497  fprintf(stderr,"Failed to allocate new trace info object \n");
498  exit(status);
499  }
500 
501  /* Add Redirection History time */
502  status = X400RediHistAddStrParam (hist1,
504  "071121125704Z",
505  -1);
506  if (status !=X400_E_NOERROR) {
507  fprintf(stderr,
508  "Failed to add X400_S_REDIRECTION_TIME to Redirection Hist\n");
509  exit(status);
510  }
511 
512  status = X400RediHistAddStrParam (hist1,
514  "/cn=redihist/prmd=TestPRMD/admd=TestPRMD/C=gb",
515  -1);
516  if (status !=X400_E_NOERROR) {
517  fprintf(stderr,
518  "Failed to add X400_S_OR_ADDRESS to Redirection Hist\n");
519  exit(status);
520  }
521 
522  status = X400RediHistAddStrParam (hist1,
524  "CN=redihist,c=GB",
525  -1);
526  if (status !=X400_E_NOERROR) {
527  fprintf(stderr,
528  "Failed to add X400_S_DIRECTORY_NAME to Redirection Hist\n");
529  exit(status);
530  }
531 
532 
533  status = X400RediHistAddIntParam(hist1,
535  X400_RR_ALIAS);
536  if (status !=X400_E_NOERROR) {
537  fprintf(stderr,
538  "Failed to add X400_N_REDIRECTION_REASON to trace info\n");
539  exit(status);
540  }
541 
542  /*hist2*/
543 
544  status = X400RediHistNew(rp,&hist2);
545  if (status !=X400_E_NOERROR) {
546  fprintf(stderr,"Failed to allocate new trace info object \n");
547  exit(status);
548  }
549 
550  /* Add Redirection History time */
551  status = X400RediHistAddStrParam (hist2,
553  "071121125714Z",
554  -1);
555  if (status !=X400_E_NOERROR) {
556  fprintf(stderr,
557  "Failed to add X400_S_REDIRECTION_TIME to Redirection Hist\n");
558  exit(status);
559  }
560 
561  status = X400RediHistAddStrParam (hist2,
563  "/cn=redihist2/prmd=TestPRMD/admd=TestPRMD/C=gb",
564  -1);
565  if (status !=X400_E_NOERROR) {
566  fprintf(stderr,
567  "Failed to add X400_S_OR_ADDRESS to Redirection Hist\n");
568  exit(status);
569  }
570 
571  status = X400RediHistAddStrParam (hist2,
573  "CN=redihist2,c=GB",
574  -1);
575  if (status !=X400_E_NOERROR) {
576  fprintf(stderr,
577  "Failed to add X400_S_DIRECTORY_NAME to Redirection Hist\n");
578  exit(status);
579  }
580 
581 
582  status = X400RediHistAddIntParam(hist2,
585  if (status !=X400_E_NOERROR) {
586  fprintf(stderr,
587  "Failed to add X400_N_REDIRECTION_REASON to "
588  "Redirection Hist\n");
589  exit(status);
590  }
591  return X400_E_NOERROR;
592 }
593 
594 static int do_redi_hist_env(
595  struct X400mtMessage *msg
596 )
597  {
598  struct X400RediHist *hist1;
599  struct X400RediHist *hist2;
600  int status;
601 
602  status = X400mtRediHistNewEnv(msg,&hist1);
603  if (status !=X400_E_NOERROR) {
604  fprintf(stderr,"Failed to allocate new trace info object \n");
605  exit(status);
606  }
607 
608  /* Add Redirection History time */
609  status = X400RediHistAddStrParam (hist1,
611  "071121125704Z",
612  -1);
613  if (status !=X400_E_NOERROR) {
614  fprintf(stderr,
615  "Failed to add X400_S_REDIRECTION_TIME to Redirection Hist\n");
616  exit(status);
617  }
618 
619  status = X400RediHistAddStrParam (hist1,
621  "/cn=redihist/prmd=TestPRMD/admd=TestPRMD/C=gb",
622  -1);
623  if (status !=X400_E_NOERROR) {
624  fprintf(stderr,
625  "Failed to add X400_S_OR_ADDRESS to Redirection Hist\n");
626  exit(status);
627  }
628 
629  status = X400RediHistAddStrParam (hist1,
631  "CN=redihist,c=GB",
632  -1);
633  if (status !=X400_E_NOERROR) {
634  fprintf(stderr,
635  "Failed to add X400_S_DIRECTORY_NAME to Redirection Hist\n");
636  exit(status);
637  }
638 
639 
640  status = X400RediHistAddIntParam(hist1,
642  X400_RR_ALIAS);
643  if (status !=X400_E_NOERROR) {
644  fprintf(stderr,
645  "Failed to add X400_N_REDIRECTION_REASON to trace info\n");
646  exit(status);
647  }
648 
649  /*hist2*/
650 
651  status = X400mtRediHistNewEnv(msg,&hist2);
652  if (status !=X400_E_NOERROR) {
653  fprintf(stderr,"Failed to allocate new trace info object \n");
654  exit(status);
655  }
656 
657  /* Add Redirection History time */
658  status = X400RediHistAddStrParam (hist2,
660  "071121125714Z",
661  -1);
662  if (status !=X400_E_NOERROR) {
663  fprintf(stderr,
664  "Failed to add X400_S_REDIRECTION_TIME to Redirection Hist\n");
665  exit(status);
666  }
667 
668  status = X400RediHistAddStrParam (hist2,
670  "/cn=redihist2/prmd=TestPRMD/admd=TestPRMD/C=gb",
671  -1);
672  if (status !=X400_E_NOERROR) {
673  fprintf(stderr,
674  "Failed to add X400_S_OR_ADDRESS to Redirection Hist\n");
675  exit(status);
676  }
677 
678  status = X400RediHistAddStrParam (hist2,
680  "CN=redihist2,c=GB",
681  -1);
682  if (status !=X400_E_NOERROR) {
683  fprintf(stderr,
684  "Failed to add X400_S_DIRECTORY_NAME to Redirection Hist\n");
685  exit(status);
686  }
687 
688 
689  status = X400RediHistAddIntParam(hist2,
692  if (status !=X400_E_NOERROR) {
693  fprintf(stderr,
694  "Failed to add X400_N_REDIRECTION_REASON to "
695  "Redirection Hist\n");
696  exit(status);
697  }
698  return X400_E_NOERROR;
699 }
700 
701 static void do_origandl(
702  struct X400mtMessage *msg
703 )
704 {
705  struct X400ORandDL *or_and_dl1;
706  struct X400ORandDL *or_and_dl2;
707 
708  const char *origin_or_address = "/cn=origandlorig/prmd=TestPRMD/admd=TestPRMD/C=gb/";
709  const char *origin_dn_address = "CN=origandlorig,c=GB";
710  int status;
711 
712  status = X400mtORandDLNew(msg,&or_and_dl1);
713  if (status !=X400_E_NOERROR) {
714  fprintf(stderr,"Failed to allocate new OR Address and DL "
715  "expansion object \n");
716  exit(status);
717  }
718 
719  /* Add Origin or expansion time */
720  status = X400ORandDLAddStrParam (or_and_dl1,
722  "071121125704Z",
723  -1);
724  if (status != X400_E_NOERROR) {
725  fprintf(stderr,
726  "Failed to add X400_S_ORIG_OR_EXAP_TIME "
727  "to X400ORandDL\n");
728  exit(status);
729  }
730 
731  /* originator or dl_name */
732 
733  /* Add Origin or expansion time */
734  status = X400ORandDLAddStrParam (or_and_dl1,
736  origin_or_address,
737  -1);
738  if (status != X400_E_NOERROR) {
739  fprintf(stderr,
740  "Failed to add X400_S_OR_ADDRESS "
741  "to X400ORandDL\n");
742  exit(status);
743  }
744 
745 
746  status = X400ORandDLAddStrParam (or_and_dl1,
748  origin_dn_address,
749  -1);
750  if (status != X400_E_NOERROR) {
751  fprintf(stderr,
752  "Failed to add X400_S_DIRECTORY_NAME "
753  "to X400ORandDL\n");
754  exit(status);
755  }
756  status = X400mtORandDLNew(msg,&or_and_dl2);
757  if (status !=X400_E_NOERROR) {
758  fprintf(stderr,"Failed to allocate new OR Address and DL "
759  "expansion object \n");
760  exit(status);
761  }
762 
763  /* Add Origin or expansion time */
764  status = X400ORandDLAddStrParam (or_and_dl2,
766  "091121125704Z",
767  -1);
768  if (status != X400_E_NOERROR) {
769  fprintf(stderr,
770  "Failed to add X400_S_ORIG_OR_EXAP_TIME "
771  "to X400ORandDL\n");
772  exit(status);
773  }
774 
775  /* originator or dl_name */
776 
777  /* Add Origin or expansion time */
778  status = X400ORandDLAddStrParam (or_and_dl2,
780  origin_or_address,
781  -1);
782  if (status != X400_E_NOERROR) {
783  fprintf(stderr,
784  "Failed to add X400_S_OR_ADDRESS "
785  "to X400ORandDL\n");
786  exit(status);
787  }
788 
789 
790  status = X400ORandDLAddStrParam (or_and_dl2,
792  origin_dn_address,
793  -1);
794  if (status != X400_E_NOERROR) {
795  fprintf(stderr,
796  "Failed to add X400_S_DIRECTORY_NAME "
797  "to X400ORandDL\n");
798  exit(status);
799  }
800 }
#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_RR_ALIAS
Definition: x400_att.h:1557
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
Definition: x400_att.h:1357
#define X400_N_DISCLOSURE
Definition: x400_att.h:427
#define X400_N_CONTENT_RETURN_REQUEST
Definition: x400_att.h:436
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
Definition: x400_att.h:461
#define X400_S_CONVERTED_ENCODED_INFORMATION_TYPES
Definition: x400_att.h:694
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.
X.400 Gateway Interface.
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
Definition: x400_att.h:511
const char * X400mtError(int error)
Return string for error code.
#define X400_S_DSI_ATTEMPTED_DOMAIN
Definition: x400_att.h:490
int X400mtRecipNew(struct X400mtMessage *mp, int type, struct X400Recipient **rpp)
Add new recipient to a message.
#define X400_S_DIRECTORY_NAME
Definition: x400_att.h:397
#define X400_N_PRIORITY
Definition: x400_att.h:422
#define X400_S_MESSAGE_DELIVERY_TIME
Definition: x400_att.h:442
#define X400_S_LATEST_DELIVERY_TIME
Definition: x400_att.h:464
#define X400_MSG_REPORT
Definition: x400_att.h:32
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
Definition: x400_att.h:414
#define X400_S_MESSAGE_IDENTIFIER
Definition: x400_att.h:405
#define X400_E_NOERROR
Definition: x400_att.h:46
#define X400_N_REPORT_REQUEST
Definition: x400_att.h:654
#define X400_N_IMPLICIT_CONVERSION_PROHIBITED
Definition: x400_att.h:430
#define X400_N_REDIRECTION_REASON
Definition: x400_att.h:508
int X400mtMsgAddIntParam(struct X400mtMessage *mp, int paramtype, int value)
Add integer-valued parameter to the message.
#define X400_S_SUBJECT_IDENTIFIER
Definition: x400_att.h:1039
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
Definition: x400_att.h:1548
#define X400_N_ORIGINAL_RECIPIENT_NUMBER
Definition: x400_att.h:640
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
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_N_NON_DELIVERY_REASON
Definition: x400_att.h:1051
#define X400_N_ALTERNATE_RECIPIENT_ALLOWED
Definition: x400_att.h:433
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
Definition: x400_att.h:481
#define X400_S_SUPPLEMENTARY_INFO
Definition: x400_att.h:1042
#define X400_S_DSI_ARRIVAL_TIME
Definition: x400_att.h:484
#define X400_N_RESPONSIBILITY
Definition: x400_att.h:643
int X400mtORandDLNew(struct X400mtMessage *msg, struct X400ORandDL **or_and_dl)
Create new Originator and DL expansion history object.
#define X400_N_MTA_REPORT_REQUEST
Definition: x400_att.h:646
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
Definition: x400_att.h:408
#define X400_S_OR_ADDRESS
Definition: x400_att.h:349
#define X400_S_ORIG_OR_EXAP_TIME
Definition: x400_att.h:969
#define X400_S_DSI_AA_DEF_TIME
Definition: x400_att.h:493
#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.