x400_mtrcv.c
1/* Copyright (c) 2003-2011, 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 message out of the MTA
15 */
16
17#include <stdio.h>
18#include <stdlib.h>
19#include <x400_mtapi.h>
20#include <seclabel_api.h> /* For security labels */
21#include "example.h"
22/* to get NDR values */
23/* #include "esc.h" */
24
25#define XML_BUFSIZE 1024
26
27static int get_msg (
28 int argc,
29 char **argv
30) ;
31static int do_msg_env(
32 struct X400mtMessage *mp
33);
34static int do_msg_headers(
35 struct X400mtMessage *mp
36);
37static void do_msg_content(
38 struct X400mtMessage *mp
39);
40static int get_a_msg (
41 struct X400mtSession *sp
42) ;
43static int get_recips(
44 struct X400mtMessage *mp,
45 int recip_type,
46 char *recip_str
47);
48
49static int get_exempted_recips (
50 struct X400mtMessage *mp
51);
52
53static int do_rep_env(
54 struct X400mtMessage *mp
55);
56
57static int do_rep_content(
58 struct X400mtMessage *mp
59);
60
61static int do_rep_retcontent(
62 struct X400mtMessage *mp
63);
64
65static void usage(void);
66
67#ifdef WANT_DL_EXP_HIST
68static int do_dl_hist (
69 struct X400mtMessage *mp
70);
71#endif
72
73static int do_trace_info (
74 struct X400mtMessage *mp
75);
76
77static int do_internal_trace_info (
78 struct X400mtMessage *mp
79);
80
81static int do_redirection_hist (
82 struct X400Recipient *recip
83);
84
85static int do_redirection_hist_env (
86 struct X400mtMessage *msg
87);
88
89static int get_ALI (
90 struct X400mtMessage *mp
91);
92
93static int get_hi (
94 struct X400mtMessage *mp
95);
96
97static int get_mi (
98 struct X400mtMessage *mp
99);
100
101static int get_dist_codes_sic(
102 struct X400mtMessage *mp
103);
104
105static int get_other_recips(
106 struct X400mtMessage *mp
107);
108
109#ifdef HANDLING_MILITARY_IPN
110static int get_acp127_ali (
111 struct X400ACP127Resp *resp
112);
113#endif
114
115static char *optstr = "uo:O:r:c:l:EQ:";
116
117static int get_body_parts(
118 struct X400mtMessage *mp
119);
120
121static int do_orig_and_dl (
122 struct X400mtMessage *mp
123);
124
125static void report_sig_info(
126 struct X400Recipient *rp
127);
128
129static void print_sec_label(
130 unsigned char slab_buffer[],
131 unsigned int length
132);
133
134static int get_cic(
135 struct X400Recipient *rp
136);
137
138static void show_certificate (
139 struct X400Recipient *rp,
140 int certtype,
141 const char *tag
142);
143
144int num_atts = 0;
145
149int main (
150 int argc,
151 char **argv
152)
153{
154 int retval;
155
156 if (x400_channel == NULL) {
157 fprintf (stderr, "No x400_channel value set in x400tailor file");
158 exit(1);
159 }
160
161 /*
162 while (retval == X400_E_NOERROR || retval == X400_E_NO_MESSAGE) {
163 retval = get_msg(argc, argv);
164 }
165 */
166
167 retval = get_msg(argc, argv);
168 fprintf (stderr, "Error in X400mtMsgGet: %s\n", X400mtError (retval));
169
170 return(retval);
171}
172static int get_msg (
173 int argc,
174 char **argv
175)
176{
177 int status;
178 struct X400mtSession *sp;
179 char *filepath = "/var/isode";
180
181 if (get_args(argc, argv, optstr)) {
182 usage();
183 exit(-1);
184 }
185
186 /* open our X400 session */
187 status = X400mtOpen (x400_channel, &sp);
188 if ( status != X400_E_NOERROR ) {
189 fprintf (stderr, "Error in Open: %s\n", X400mtError (status));
190 return (status);
191 }
192
194
196 filepath, strlen(filepath));
197
199
200#ifdef WANT_OR_CANONICAL
202#endif
203
204 if (attr_to_fault != 0) {
205 status = X400mtMarkToFault(sp, attr_to_fault, 1);
206 if (status != X400_E_NOERROR) {
207 fprintf (stderr, "Error in X400mtMarkToFault: %s\n", X400mtError (status));
208 X400mtClose (sp);
209 return (status);
210 }
211 }
212
213 get_a_msg(sp);
214 if ( status != X400_E_NOERROR ) {
215 /* close API session */
216 status = X400mtClose (sp);
217 if ( status != X400_E_NOERROR ) {
218 printf("X400mtClose returned error %d\n", status);
219 fprintf (stderr, "Error in X400mtClose: %s\n",
220 X400mtError (status));
221 }
222 return status;
223 }
224
225 do {
226 get_a_msg(sp);
227 if ( status != X400_E_NOERROR ) {
228 /* close API session */
229 status = X400mtClose (sp);
230 if ( status != X400_E_NOERROR ) {
231 printf("X400mtClose returned error %d\n", status);
232 fprintf (stderr, "Error in X400mtClose: %s\n",
233 X400mtError (status));
234 }
235 return status;
236 }
237 }
238 while (until_no_more_msgs);
239
240 /* close API session */
241 status = X400mtClose (sp);
242 if ( status != X400_E_NOERROR ) {
243 printf("X400mtClose returned error %d\n", status);
244 fprintf (stderr, "Error in X400mtClose: %s\n",
245 X400mtError (status));
246 }
247 return (status);
248}
249
250
251static int get_a_msg (
252 struct X400mtSession *sp
253)
254{
255 struct X400mtMessage *mp;
256 int type;
257 int status;
258 static int reported_none = 0;
259
260 /* get the message */
261 status = X400mtMsgGetStart (sp, &mp, &type);
262 if ( status != X400_E_NOERROR ) {
263 if ( status == X400_E_NO_MESSAGE ) {
264 if (reported_none == 0) {
265 printf("No messages ...\n");
266 reported_none = 1;
267 }
268 return (X400_E_NO_MESSAGE);
269 }
270 printf("Error getting message (%d) %s\n", status, X400mtError(status));
271 fprintf (stderr, "Error in X400mtMsgGet: %s\n", X400mtError (status));
272 return (status);
273 }
274
275 /* process the message */
276 switch ( type) {
277 case X400_MSG_MESSAGE:
278 printf("Message waiting\n\n");
279 /* display message attributes */
280 do_msg_env(mp);
281 do_msg_headers(mp);
282 do_msg_content(mp);
283 break;
284
285 case X400_MSG_REPORT:
286 printf("Report waiting\n\n");
287 /* display message attributes */
288 do_rep_env(mp);
289 do_rep_content(mp);
290 do_rep_retcontent(mp);
291 break;
292
293 case X400_MSG_PROBE:
294 /* Not handling a Probe here */
295 printf ("Got a probe, ignoring ...\n");
296 /* Delete internal copy */
297 status = X400mtMsgDelete (mp);
298 if ( status != X400_E_NOERROR ) {
299 printf("X400mtMsgDelete returned error %d\n", status);
300 fprintf (stderr, "Error in X400mtMsgDelete: %s\n",
301 X400mtError (status));
302 }
303 return (status);
304 }
305
306#ifdef always_dr_msg
307#define DRD_UNRECOGNISED_OR 0
308#define DRR_UNABLE_TO_TRANSFER 1
309
310 /* finish transfer - NDR */
312 DRR_UNABLE_TO_TRANSFER, DRD_UNRECOGNISED_OR, "Unable to transfer");
313#endif
314 /* finish transfer - accept: no DR */
315 status = X400mtMsgGetFinish (mp, X400_E_NOERROR,
316 -1, -1, "");
317 if ( status != X400_E_NOERROR ) {
318 printf("X400mtMsgFinish returned error %d\n", status);
319 fprintf (stderr, "Error in X400mtMsgFinish: %s\n",
320 X400mtError (status));
321 }
322 printf("X400mtMsgFinish returned success %d\n", status);
323
324 /* Delete internal copy */
325 status = X400mtMsgDelete (mp);
326 if ( status != X400_E_NOERROR ) {
327 printf("X400mtMsgDelete returned error %d\n", status);
328 fprintf (stderr, "Error in X400mtMsgDelete: %s\n",
329 X400mtError (status));
330 }
331 return status;
332}
333
334
335/*
336 * Message functions
337 */
338static int do_msg_env(
339 struct X400mtMessage *mp
340)
341{
342 char buffer[BUFSIZ];
343 int status;
344 size_t length;
345 int int_param = 0;
346
347 /* Envelope Attributes */
348
349 /* string attributes */
350 /* The ORADDRESS in the message is the (envelope) originator */
352 buffer, sizeof buffer , &length);
353 if ( status != X400_E_NOERROR ) {
354 printf("error getting originator address\n");
355 fprintf (stderr,
356 "Error in X400mtMsgGetStrParam: %s\n", X400mtError (status));
357 return (status);
358 }
359 printf ("Originator: %.*s\n", (int)length, buffer);
360
361 /* Envelope message IDentifier */
363 buffer, sizeof buffer , &length);
364 if ( status != X400_E_NOERROR ) {
365 printf("error getting message identifier\n");
366 fprintf (stderr, "Error in X400mtMsgGetStrParam: %s\n", X400mtError (status));
367 return (status);
368 }
369 printf ("MessageID: %.*s\n", (int)length, buffer);
370
371 /* Content Identifier */
373 buffer, sizeof buffer , &length);
374 if ( status == X400_E_NOERROR )
375 printf ("Content Identifier: %.*s\n", (int)length, buffer);
376
377 /* Content Correlator */
379 buffer, sizeof buffer , &length);
380 if ( status == X400_E_NOERROR )
381 printf ("Content Correlator IA5Text: %.*s\n", (int)length, buffer);
382
384 buffer, sizeof buffer , &length);
385 if ( status == X400_E_NOERROR )
386 printf ("Content Correlator Octet String: %i bytes\n", (int)length);
387
388 /* Original EITs */
389 status = X400mtMsgGetStrParam (mp,
391 buffer, sizeof buffer , &length);
392 if ( status == X400_E_NOERROR )
393 printf ("Original EITs: %.*s\n", (int)length, buffer);
394
395 /* Message Submission Time */
397 buffer, sizeof buffer , &length);
398 if ( status == X400_E_NOERROR )
399 printf ("Message Submission Time: %.*s\n", (int)length, buffer);
400
401 /* Message Delivery Time */
403 buffer, sizeof buffer , &length);
404 if ( status == X400_E_NOERROR )
405 printf ("Message Delivery Time: %.*s\n", (int)length, buffer);
406
407 /* Latest Delivery Time */
409 buffer, sizeof buffer , &length);
410 if ( status == X400_E_NOERROR )
411 printf ("Latest Delivery Time: %.*s\n", (int)length, buffer);
412
413 /* Originator Return Address */
415 buffer, sizeof buffer , &length);
416 if ( status == X400_E_NOERROR )
417 printf ("Originator Return Address : %.*s\n", (int)length, buffer);
418
420 buffer, sizeof buffer , &length);
421 if ( status == X400_E_NOERROR )
422 printf ("External Content Type : %.*s\n", (int)length, buffer);
423
424 /* Integer parameters */
425 /* Content Type */
426 status = X400mtMsgGetIntParam (mp, X400_N_CONTENT_TYPE, &int_param);
427 if ( status == X400_E_NOERROR )
428 printf ("Content type : P%d\n", int_param);
429
430
431 if ( status == X400_E_NOERROR )
432 printf ("Content type : P%d\n", int_param);
433
434 /* Content Length */
435 status = X400mtMsgGetIntParam (mp, X400_N_CONTENT_LENGTH, &int_param);
436 if ( status == X400_E_NOERROR )
437 printf ("Content length: %d\n", int_param);
438
439 /* Priority */
440 status = X400mtMsgGetIntParam (mp, X400_N_PRIORITY, &int_param);
441 if ( status == X400_E_NOERROR )
442 printf ("Priority: %d\n", int_param);
443
444 /* Disclosure of recips prohibited */
445 status = X400mtMsgGetIntParam (mp, X400_N_DISCLOSURE, &int_param);
446 if ( status == X400_E_NOERROR )
447 printf ("Disclosure of recips prohibited %s\n", int_param == 0 ? "No": "Yes");
448
449 /* Implicit conversion prohibited */
451 if ( status == X400_E_NOERROR )
452 printf ("Implicit conversion prohibited %s\n", int_param == 0 ? "No": "Yes");
453
454 /* Alternate recipient allowed */
456 if ( status == X400_E_NOERROR )
457 printf (" Alternate recipient allowed: %s\n", int_param == 0 ? "No": "Yes");
458
459 /* Content return request */
460 status = X400mtMsgGetIntParam (mp, X400_N_CONTENT_RETURN_REQUEST, &int_param);
461 if ( status == X400_E_NOERROR )
462 printf (" Content return request: %s\n", int_param == 0 ? "No": "Yes");
463
464 /* Recipient reassignment prohibited */
466 if ( status == X400_E_NOERROR )
467 printf ("Recipient reassignment prohibited: %s\n", int_param == 0 ? "No": "Yes");
468
469 /* Distribution List expansion prohibited */
470 status = X400mtMsgGetIntParam (mp, X400_N_DL_EXPANSION_PROHIBITED, &int_param);
471 if ( status == X400_E_NOERROR )
472 printf ("Distribution List expansion prohibited: %s\n", int_param == 0 ? "No": "Yes");
473
474 /* Conversion with loss prohibited */
476 if ( status == X400_E_NOERROR )
477 printf ("Conversion with loss prohibited: %s\n", int_param == 0 ? "No": "Yes");
478
479 /* Get the envelope recipients */
480 status = get_recips(mp, X400_RECIP_ENVELOPE, "envelope");
481 if ( status != X400_E_NOERROR && status != X400_E_NO_RECIP) {
482 printf("error getting recipients\n");
483 fprintf (stderr, "Error in getting recipient: %s\n",
484 X400mtError (status));
485 return (status);
486 }
487
488 /* Get X.411 exempted recipients */
489 status = get_recips(mp, X400_DL_EXEMPTED_RECIP, "DL Exempted recips");
490 if ( status != X400_E_NOERROR && status != X400_E_NO_RECIP) {
491 printf("error getting recipients\n");
492 fprintf (stderr, "Error in getting recipient: %s\n",
493 X400mtError (status));
494 return (status);
495 }
496
497
498#ifdef WANT_DL_EXP_HIST
499 /* DL Expansion history */
500 {
501
502 /*Process the DL Expansion History object */
503 status = do_dl_hist(mp);
504
505 if (status == X400_E_NO_VALUE )
506 printf("No DL Expansion history\n");
507 else if ( status != X400_E_NOERROR ) {
508 /* There has been an error fetching the DL expansion history*/
509 printf("error getting DL Expansion History\n");
510 fprintf (stderr, "Error in X400mtDLExpHistGet: %s\n",
511 X400mtError (status));
512 return status;
513 }
514 }
515#endif
516
517 /* Security Label */
518
519#ifdef USE_SEC_LABEL
520
521#define XML_BUFSIZE 1024
522 {
523 char xml_buffer[XML_BUFSIZE];
524 unsigned char slab_buffer[XML_BUFSIZE];
525
526 status = X400mtMsgGetStrParam(mp,
528 (char*)slab_buffer,
529 XML_BUFSIZE,
530 &length);
531 if (status == X400_E_NO_VALUE) {
532 printf("No security label\n");
533 } else if (status != X400_E_NOERROR) {
534 fprintf(stderr,"Failed to fetch security label: %d",status);
535 exit(1);
536 } else {
537 int sec_status = 0;
538
539 sec_status = SecLabelInit("Example program");
540 if (status != SECLABEL_E_NOERROR) {
541 fprintf(stderr, "SecLabelInit returned error %d\n", status);
542 exit(1);
543 }
544
545 status = SecLabelPrint(slab_buffer,
546 length,
547 xml_buffer,
548 XML_BUFSIZE);
549
550 if (status != SECLABEL_E_NOERROR) {
551 fprintf(stderr, "SecLabelParse returned error %d\n", status);
552 exit(1);
553 }
554
555 /* You could now write out the XML file, or parse it in memory..*/
556 printf("Got security label:%s\n",xml_buffer);
557 }
558
559
560 }
561
562#endif
563
564#define WANT_TRACE_INFO 1
565#ifdef WANT_TRACE_INFO
566 {
567
568 status = do_trace_info(mp);
569 if ( status == X400_E_NOERROR) {
570 /* all OK */
571 } else if (status == X400_E_MISSING_ATTR ) {
572 printf("There is no Trace Info\n");
573 } else {
574 printf("error getting Trace Info\n");
575 fprintf (stderr, "Error fetching trace info: %s\n",
576 X400mtError (status));
577 return status;
578 }
579
580 }
581#endif
582
583#define USE_INTERNAL_TRACE_INFO 1
584#ifdef USE_INTERNAL_TRACE_INFO
585 {
586
587 status = do_internal_trace_info(mp);
588 if ( status == X400_E_NOERROR) {
589 /* do nothing */
590 } else if (status == X400_E_MISSING_ATTR ) {
591 printf("There is no internal Trace Info\n");
592 } else {
593 printf("error getting Trace Info\n");
594 fprintf (stderr, "Error fetching trace info: %s\n",
595 X400mtError (status));
596 return status;
597 }
598
599 }
600#endif
601
602
603 /* NB: Originator cert is just being treated as a binary blob */
605 buffer, sizeof buffer , &length);
606 if ( status == X400_E_NOERROR )
607 printf ("Originator Cert got %i bytes\n", (int)length);
608
609
610 /* NB: Originator cert is just being treated as a binary blob */
611 status = X400mtMsgGetStrParam (mp, X400_S_MOAC,
612 buffer, sizeof buffer , &length);
613 if ( status == X400_E_NOERROR )
614 printf ("MOAC got %i bytes\n", (int)length);
615
616 return X400_E_NOERROR;
617}
618
619#ifdef WANT_DL_EXP_HIST
620static int do_dl_hist (
621 struct X400mtMessage *mp
622)
623{
624 struct X400DLExpHist *hist = NULL;
625 char DLORAddress[BUFSIZ];
626 char DLORDN[BUFSIZ];
627 char DLExpTime[BUFSIZ];
628 size_t length;
629 int n;
630 int status;
631
632
633 /* Loop through the entries, pulling out the OR Address, DN, and expansion
634 * time for each entry.
635 * Stop looping when there is no n entry
636 */
637 for ( n=1; ;n++ ) {
638
639 status = X400mtDLExpHistGet (mp,n,&hist);
640 if (status != X400_E_NOERROR) {
641 return status;
642 }
643
644 status = X400DLGetStrParam (hist, X400_S_OR_ADDRESS,
645 DLORAddress, BUFSIZ , &length);
646 if (status == X400_E_NO_VALUE) {
647 return X400_E_NO_VALUE;
648 }
649 if ( status == X400_E_NOERROR ) {
650 DLORAddress[length] = '\0';
651 printf ("DLExpansion List entry %d OR Address:%s\n",
652 n,DLORAddress);
653 } else {
654 fprintf (stderr, "Error in :X400DLGetStrParam OR %s\n",
655 X400mtError (status));
656 }
657
658 status = X400DLGetStrParam (hist,X400_S_DIRECTORY_NAME,
659 DLORDN, BUFSIZ , &length);
660 if ( status == X400_E_NOERROR ) {
661 DLORDN[length] = '\0';
662 printf ("DLExpansion List entry %d DN :%s\n",n,DLORDN);
663 } else {
664 fprintf (stderr, "Error in :X400DLGetStrParam DN %s\n",
665 X400mtError (status));
666 }
667
668 status = X400DLGetStrParam (hist,X400_S_DLEXP_TIME,
669 DLExpTime, BUFSIZ , &length);
670 if ( status == X400_E_NOERROR ) {
671 DLExpTime[length] = '\0';
672 printf ("DLExpansion List entry %d Time :%s\n",n,DLExpTime);
673 } else {
674 fprintf (stderr, "Error in :X400DLGetStrParam Time %s\n",
675 X400mtError (status));
676 }
677
678 }
679 return X400_E_NOERROR;
680}
681#endif
682
683static int do_msg_headers(
684 struct X400mtMessage *mp
685)
686{
687 char buffer[BUFSIZ];
688 int status;
689 size_t length;
690 int int_param;
691
692 /* Message Headers */
693 printf("\nContent:\n");
694
695 /* Get the primary recipients */
696 status = get_recips(mp, X400_RECIP_PRIMARY, "primary");
697 if ( status != X400_E_NOERROR && status != X400_E_NO_RECIP) {
698 printf("error getting recipients\n");
699 fprintf (stderr, "Error in getting recipient: %s\n",
700 X400mtError (status));
701 return (status);
702 }
703
704 /* Get the cc recipients */
705 status = get_recips(mp, X400_RECIP_CC, "cc");
706 if ( status != X400_E_NOERROR && status != X400_E_NO_RECIP) {
707 printf("error getting recipients\n");
708 fprintf (stderr, "Error in getting recipient: %s\n",
709 X400mtError (status));
710 return (status);
711 }
712
713 /* Get the bcc recipients */
714 status = get_recips(mp, X400_RECIP_BCC, "bcc");
715 if ( status != X400_E_NOERROR && status != X400_E_NO_RECIP) {
716 printf("error getting recipients\n");
717 fprintf (stderr, "Error in getting recipient: %s\n",
718 X400mtError (status));
719 return (status);
720 }
721
722 /* Get the reply recipients */
723 status = get_recips(mp, X400_AUTH_ORIG, "auth-orig");
724 if ( status != X400_E_NOERROR && status != X400_E_NO_RECIP) {
725 printf("error getting recipients\n");
726 fprintf (stderr, "Error in getting recipient: %s\n",
727 X400mtError (status));
728 return (status);
729 }
730
731 /* Get the reply recipients */
732 status = get_recips(mp, X400_RECIP_REPLY, "reply");
733 if ( status != X400_E_NOERROR && status != X400_E_NO_RECIP) {
734 printf("error getting recipients\n");
735 fprintf (stderr, "Error in getting recipient: %s\n",
736 X400mtError (status));
737 return (status);
738 }
739
740 /* Get the Exempted recipients */
741 status = get_exempted_recips(mp);
742 if ( status != X400_E_NOERROR && status != X400_E_NO_RECIP) {
743 fprintf (stderr, "Error in getting exempted recipient: %s\n",
744 X400mtError (status));
745 return (status);
746 }
747
748
749 /* string parameters */
750 /* IPM IDentifier */
752 buffer, sizeof buffer , &length);
753 if ( status == X400_E_NOERROR )
754 printf ("IPM IDentifier: %.*s\n", (int)length, buffer);
755
756 /* Subject */
758 buffer, sizeof buffer , &length);
759 if ( status == X400_E_NOERROR )
760 printf ("Subject: %.*s\n", (int)length, buffer);
761
762 /* Replied-to-identifier */
764 buffer, sizeof buffer , &length);
765 if ( status == X400_E_NOERROR )
766 printf ("Replied-to-identifier: %.*s\n", (int)length, buffer);
767
768 /* Obsoleted IPMs */
770 buffer, sizeof buffer , &length);
771 if ( status == X400_E_NOERROR )
772 printf ("Obsoleted IPMs: %.*s\n", (int)length, buffer);
773
774 /* Related IPMs */
776 buffer, sizeof buffer , &length);
777 if ( status == X400_E_NOERROR )
778 printf ("Related IPMs: %.*s\n", (int)length, buffer);
779
780 /* Expiry Time */
782 buffer, sizeof buffer , &length);
783 if ( status == X400_E_NOERROR )
784 printf ("Expiry Time: %.*s\n", (int)length, buffer);
785
786 /* Reply Time */
788 buffer, sizeof buffer , &length);
789 if ( status == X400_E_NOERROR )
790 printf ("Reply Time: %.*s\n", (int)length, buffer);
791
792 /* Authorisation Time */
794 buffer, sizeof buffer , &length);
795 if ( status == X400_E_NOERROR )
796 printf ("Authorisation Time: %.*s\n", (int)length, buffer);
797
798 /* Originator's Reference */
800 buffer, sizeof buffer , &length);
801 if ( status == X400_E_NOERROR )
802 printf ("Originator's Reference: %.*s\n", (int)length, buffer);
803
804 /* integer arguments */
805 /* Importance */
806 status = X400mtMsgGetIntParam (mp, X400_N_IMPORTANCE, &int_param);
807 if ( status == X400_E_NOERROR )
808 printf ("Importance: %d\n", int_param);
809
810 /* Sensitivity: 1 - personal, 2 - private, 3 - company-confidential */
811 status = X400mtMsgGetIntParam (mp, X400_N_SENSITIVITY, &int_param);
812 if ( status == X400_E_NOERROR )
813 printf ("Sensitivity: %d\n", int_param);
814
815 /* Autoforwarded */
816 status = X400mtMsgGetIntParam (mp, X400_N_AUTOFORWARDED, &int_param);
817 if ( status == X400_E_NOERROR )
818 printf ("Autoforwarded: %s\n", int_param ? "false" : "true");
819
820 /* number of attachments apart from main body part */
821 status = X400mtMsgGetIntParam (mp, X400_N_NUM_ATTACHMENTS, &num_atts);
822 if ( status == X400_E_NOERROR )
823 printf ("number of attachments: %d\n", num_atts);
824
825 /* Fetch P772 Extended Auth Info */
827 buffer, sizeof buffer , &length);
828 if ( status == X400_E_NOERROR )
829 printf ("P772 Ext Auth Info Time: %.*s\n", (int)length, buffer);
830
831 /* Fetch P772 Codress value */
832
833 status = X400mtMsgGetIntParam (mp, X400_N_EXT_CODRESS, &int_param);
834 if ( status == X400_E_NOERROR )
835 printf ("P772 Codress value: %d\n", int_param);
836
837 /* Fetch P772 Message type value */
838 status = X400mtMsgGetIntParam (mp, X400_N_EXT_MSG_TYPE, &int_param);
839 if ( status == X400_E_NOERROR )
840 printf ("P772 Message Type: %.*s\n", (int)length, buffer);
841
842 /* Fetch P772 Message id value */
844 buffer, sizeof buffer, &length);
845 if ( status == X400_E_NOERROR )
846 printf ("P772 Message Type/Identifier: %d\n", int_param);
847
848 /* Fetch P772 Primary Precedence */
849 status = X400mtMsgGetIntParam (mp, X400_N_EXT_PRIM_PREC, &int_param);
850 if ( status == X400_E_NOERROR )
851 printf ("P772 Primary Precedence: %d\n", int_param);
852
853 /* Fetch P772 Copy Precedence */
854 status = X400mtMsgGetIntParam (mp, X400_N_EXT_COPY_PREC, &int_param);
855 if ( status == X400_E_NOERROR )
856 printf ("P772 Copy Precedence: %d\n", int_param);
857
858 /* Fetch P772 Address List Indicators*/
859 get_ALI(mp);
860
861 /* Fetch handling instructions */
862 get_hi(mp);
863
864 /* Fetch message instructions */
865 get_mi(mp);
866
867 /* Fetch distribution codes sic */
868 get_dist_codes_sic(mp);
869
870 /* Fetch Other Recipients */
871 get_other_recips(mp);
872
873
875 buffer, sizeof buffer , &length);
876 if ( status == X400_E_NOERROR )
877 printf ("P772 Originator Reference: %.*s\n", (int)length, buffer);
878
880 buffer, sizeof buffer , &length);
881 if ( status == X400_E_NOERROR )
882 printf ("P772 Originator PLAD: %.*s\n", (int)length, buffer);
883
885 buffer, sizeof buffer , &length);
886 if ( status == X400_E_NOERROR )
887 printf ("P772 ACP127 Msg ID: %.*s\n", (int)length, buffer);
888
889 /* NB: Pilot forwarding info is just being treated as a binary blob */
891 buffer, sizeof buffer , &length);
892 if ( status == X400_E_NOERROR )
893 printf ("P772 Pilot Forwarding Info got %i bytes\n", (int)length);
894
895
896 /* NB: information security label is just being treated as a binary blob */
898 buffer, sizeof buffer , &length);
899 if ( status == X400_E_NOERROR )
900 printf ("P772 Information Security Label got %i bytes\n", (int)length);
901
902#ifdef HANDLING_MILITARY_IPN
903
904 /* Fetch ACP127 Notification Response - this will only be present in a Military Notification */
905
906 {
907 struct X400ACP127Resp *resp = NULL;
908 int int_param = 0;
909
910 status = X400mtACP127RespGet(mp,&resp);
911 if ( status == X400_E_NOERROR ) {
912
913
914 status = X400ACP127RespGetIntParam(resp,&int_param);
915 if ( status == X400_E_NOERROR ) {
916 if (int_param & X400_ACP127_NOTI_TYPE_NEG) {
917 printf("P772 ACP127 Notification Response Type Negative\n");
918 }
919 if (int_param & X400_ACP127_NOTI_TYPE_POS) {
920 printf("P772 ACP127 Notification Response Type Positive\n");
921 }
922 if (int_param & X400_ACP127_NOTI_TYPE_TRANS) {
923 printf("P772 ACP127 Notification Response Type Transfer\n");
924 }
925 }
926
927 status = X400ACP127RespGetStrParam (resp,
929 buffer,
930 sizeof buffer,
931 &length);
932 if ( status == X400_E_NOERROR )
933 printf ("P772 ACP127 Response time: %.*s\n", (int)length, buffer);
934
935
936 status = X400ACP127RespGetStrParam (resp,
938 buffer,
939 sizeof buffer,
940 &length);
941 if ( status == X400_E_NOERROR )
942 printf ("P772 ACP127 Recipient: %.*s\n", (int)length, buffer);
943
944 status = X400ACP127RespGetStrParam (resp,
946 buffer,
947 sizeof buffer,
948 &length);
949 if ( status == X400_E_NOERROR )
950 printf ("P772 ACP127 Resp supp info: %.*s\n", (int)length, buffer);
951
952
953 /* Fetch ACP127 Notification Response Address list indicator */
954
955 get_acp127_ali(resp);
956
957
958 }
959 }
960
961#endif
962
963 return X400_E_NOERROR;
964}
965
966static void do_msg_content(
967 struct X400mtMessage *mp
968)
969{
970 char buffer[30000];
971 int status;
972 size_t length;
973
974 memset(buffer,0,30000);
975
977 buffer, sizeof buffer , &length);
978 if ( status != X400_E_NOERROR ) {
979 printf("Failed to read raw content into file: %s\n", X400mtError (status));
980 }
981
982 printf("Read raw content into file %s\n", buffer);
983
984 /* Message Body */
985
986 /* And now get message text (or it could be another type - ie not IA5) */
988 buffer, sizeof buffer , &length);
989
990 if ( status == X400_E_NOERROR ) {
991 printf ("Text:\n%.*s\n", (int)length, buffer);
992 num_atts--; /* The IA5text bodypart is infact the first "attachment"
993 * So there is one less to fetch */
994 }
995 /* Go through message bodyparts */
996 get_body_parts(mp);
997
998 return;
999}
1000
1001static int get_exempted_recips (
1002 struct X400mtMessage *mp
1003)
1004{
1005 struct X400Recipient *rp;
1006 int n;
1007 char buffer[BUFSIZ];
1008 size_t length;
1009 int status;
1010
1011 for ( n = 1; ; n++ ) {
1012 status = X400mtRecipGet (mp,X400_EXEMPTED_ADDRESS , n, &rp);
1013 if ( (status == X400_E_NO_RECIP) || (status == X400_E_NO_VALUE) )
1014 break;
1015 if ( status != X400_E_NOERROR ) {
1016 fprintf (stderr, "Error in X400mtRecipGet: %s\n",
1017 X400mtError (status));
1018 return (status);
1019 }
1021 buffer, sizeof buffer , &length);
1022 if ( status == X400_E_NOERROR ) {
1023 printf ("Exempted recipient OR address %d: %.*s\n",
1024 n, (int)length, buffer);
1025 }
1026
1028 buffer, sizeof buffer , &length);
1029 if ( status == X400_E_NOERROR ) {
1030 printf ("Exempted recipient DN address %d: %.*s\n",
1031 n, (int)length, buffer);
1032 }
1033
1035 buffer, sizeof buffer , &length);
1036 if ( status == X400_E_NOERROR ) {
1037 printf ("Exempted recipient free form name %d: %.*s\n",
1038 n, (int)length, buffer);
1039 }
1040
1042 buffer, sizeof buffer , &length);
1043 if ( status == X400_E_NOERROR ) {
1044 printf ("Exempted recipient Tel number %d: %.*s\n",
1045 n, (int)length, buffer);
1046 }
1047
1048
1049 }
1050 return X400_E_NOERROR;
1051}
1052
1053
1054static int get_ALI (
1055 struct X400mtMessage *mp
1056)
1057{
1058 struct X400ALI *ali = NULL;
1059 int n;
1060 char buffer[BUFSIZ];
1061 size_t length;
1062 int status;
1063 int int_param;
1064
1065 for ( n = 1; ; n++ ) {
1066 status = X400mtALIGet (mp,n,&ali);
1067 if ( status != X400_E_NOERROR )
1068 return status;
1069
1071 buffer, sizeof buffer , &length);
1072 if ( status == X400_E_NOERROR ) {
1073 printf ("P772 ALI recipient OR address %d: %.*s\n",
1074 n, (int)length, buffer);
1075 } else if ( status == X400_E_NO_VALUE) {
1076 return X400_E_NO_VALUE;
1077 }
1078
1079
1081 buffer, sizeof buffer , &length);
1082 if ( status == X400_E_NOERROR ) {
1083 printf ("P772 ALI recipient DN address %d: %.*s\n",
1084 n, (int)length, buffer);
1085 }
1086
1088 buffer, sizeof buffer , &length);
1089 if ( status == X400_E_NOERROR ) {
1090 printf ("P772 ALI recipient free form name %d: %.*s\n",
1091 n, (int)length, buffer);
1092 }
1093
1095 buffer, sizeof buffer , &length);
1096 if ( status == X400_E_NOERROR ) {
1097 printf ("P772 ALI recipient Tel number %d: %.*s\n",
1098 n, (int)length, buffer);
1099 }
1100
1101 status = X400ALIGetIntParam (ali,X400_N_ALI_TYPE , &int_param);
1102 if ( status == X400_E_NOERROR ) {
1103 printf ("P772 ALI Type %d\n", int_param);
1104 }
1105
1107 &int_param);
1108 if ( status == X400_E_NOERROR ) {
1109 printf ("P772 ALI Notification Request %d\n", int_param);
1110 }
1111
1112
1113 status = X400ALIGetIntParam (ali,X400_N_ALI_REPLY_REQUEST ,&int_param);
1114 if ( status == X400_E_NOERROR ) {
1115 printf ("P772 ALI Notification Request %d\n", int_param);
1116 }
1117
1118
1119 }
1120}
1121
1122
1123static int get_hi (
1124 struct X400mtMessage *mp
1125)
1126{
1127 struct X400PSS *pss = NULL;
1128 int n;
1129 char buffer[BUFSIZ];
1130 size_t length;
1131 int status;
1132
1133
1134 for ( n = 1; ; n++ ) {
1135 status = X400mtPSSGet (mp,X400_S_HANDLING_INSTRUCTIONS,n,&pss);
1136 if ( status != X400_E_NOERROR )
1137 return status;
1138
1139 status = X400PSSGetStrParam (pss,buffer, sizeof buffer , &length);
1140 if ( status == X400_E_NOERROR ) {
1141 printf ("P772 Handling instruction %d: %.*s\n",
1142 n, (int)length, buffer);
1143 } else if ( status == X400_E_NO_VALUE) {
1144 return X400_E_NO_VALUE;
1145 }
1146 }
1147}
1148
1149static int get_mi (
1150 struct X400mtMessage *mp
1151)
1152{
1153 struct X400PSS *pss = NULL;
1154 int n;
1155 char buffer[BUFSIZ];
1156 size_t length;
1157 int status;
1158
1159
1160 for ( n = 1; ; n++ ) {
1161 status = X400mtPSSGet (mp,X400_S_MESSAGE_INSTRUCTIONS,n,&pss);
1162 if ( status != X400_E_NOERROR )
1163 return status;
1164
1165 status = X400PSSGetStrParam (pss,buffer, sizeof buffer , &length);
1166 if ( status == X400_E_NOERROR ) {
1167 printf ("P772 Message instruction %d: %.*s\n",
1168 n, (int)length, buffer);
1169 } else if ( status == X400_E_NO_VALUE) {
1170 return X400_E_NO_VALUE;
1171 }
1172 }
1173}
1174
1175static int get_dist_codes_sic(
1176 struct X400mtMessage *mp
1177)
1178{
1179 struct X400PSS *pss = NULL;
1180 struct X400DistField *distfield = NULL;
1181 int n;
1182 char buffer[BUFSIZ];
1183 size_t length;
1184 int status;
1185
1186
1187 for ( n = 1; ; n++ ) {
1188 status = X400mtPSSGet (mp,X400_S_DIST_CODES_SIC,n,&pss);
1189 if (status == X400_E_NO_VALUE) {
1190 break; /* Now try the extension fields*/
1191 } else if ( status != X400_E_NOERROR ) {
1192 return status;
1193 }
1194
1195 status = X400PSSGetStrParam (pss,buffer, sizeof buffer , &length);
1196 if ( status == X400_E_NOERROR ) {
1197 printf ("P772 Distribution code SIC %d: %.*s\n",
1198 n, (int)length, buffer);
1199 }
1200 }
1201
1202
1203 for ( n = 1; ; n++ ) {
1204 status = X400mtDistFieldGet (mp,n,&distfield);
1205 if (status == X400_E_NO_VALUE) {
1206 break; /* Now try the extension fields*/
1207 } else if ( status != X400_E_NOERROR ) {
1208 return status;
1209 }
1210
1211 status = X400DistFieldGetStrParam (
1212 distfield,
1214 buffer,
1215 sizeof buffer,
1216 &length
1217 );
1218 if ( status == X400_E_NOERROR ) {
1219 printf ("P772 Distribution code Field Extension OID %d: %.*s\n",
1220 n, (int)length, buffer);
1221 }
1222
1223 status = X400DistFieldGetStrParam (
1224 distfield,
1226 buffer,
1227 sizeof buffer,
1228 &length
1229 );
1230 if ( status == X400_E_NOERROR ) {
1231 printf ("P772 Distribution code Field Extension value %d: %.*s\n",
1232 n, (int)length, buffer);
1233 }
1234 }
1235
1236 return X400_E_NOERROR;
1237}
1238
1239static int get_other_recips(
1240 struct X400mtMessage *mp
1241)
1242{
1243 struct X400OtherRecip *otherrecip = NULL;
1244 int n;
1245 char buffer[BUFSIZ];
1246 size_t length;
1247 int status;
1248 int type;
1249
1250 for ( n = 1; ; n++ ) {
1251 status = X400mtOtherRecipGet (mp,n,&otherrecip);
1252 if ( status != X400_E_NOERROR ) {
1253 return status;
1254 }
1255
1256 status = X400OtherRecipGetIntParam (otherrecip,&type);
1257 if ( status == X400_E_NOERROR ) {
1258 printf ("P772 Other Recipient type %d: %i \n",n,type);
1259 }
1260
1261
1262 status = X400OtherRecipGetStrParam (otherrecip,
1263 buffer,
1264 sizeof buffer ,
1265 &length);
1266 if ( status == X400_E_NOERROR ) {
1267 printf ("P772 Other Recipient Designator %d: %.*s\n",
1268 n, (int)length, buffer);
1269 }
1270
1271
1272 }
1273}
1274
1275static int get_recips(
1276 struct X400mtMessage *mp,
1277 int recip_type,
1278 char *recip_str
1279)
1280{
1281 char buffer[BUFSIZ];
1282 int status;
1283 struct X400Recipient *rp;
1284 size_t length;
1285 int n;
1286 int int_param;
1287
1288 for ( n = 1; ; n++ ) {
1289 status = X400mtRecipGet (mp, recip_type, n, &rp);
1290 if ( status == X400_E_NO_RECIP )
1291 break;
1292 if ( status != X400_E_NOERROR ) {
1293 printf("error getting recip %d\n", n);
1294 fprintf (stderr, "Error in X400mtRecipGet: %s\n",
1295 X400mtError (status));
1296 return (status);
1297 }
1298
1299 /* Note: recipient may not actually have an O/R address */
1301 buffer, sizeof buffer , &length);
1302 if ( status == X400_E_NOERROR ) {
1303 printf ("%s recipient %d: %.*s\n", recip_str, n, (int)length, buffer);
1304 } else {
1305 printf ("recipient %d ORAddress status %d\n", n, status);
1306 }
1307
1308 /* envelope recipient integer parameters */
1309 /* Responsibility */
1310 status = X400mtRecipGetIntParam
1311 (rp, X400_N_RESPONSIBILITY, &int_param);
1312 if ( status == X400_E_NOERROR ) {
1313 printf ("\tResponsibility %d\n", int_param);
1314 }
1315
1316 /* MTA report request */
1317 status = X400mtRecipGetIntParam
1318 (rp, X400_N_MTA_REPORT_REQUEST, &int_param);
1319 if ( status == X400_E_NOERROR ) {
1320 printf ("\tMTA report request %d\n", int_param);
1321 }
1322
1323 /* Originator report request */
1324 status = X400mtRecipGetIntParam
1325 (rp, X400_N_REPORT_REQUEST, &int_param);
1326 if ( status == X400_E_NOERROR ) {
1327 printf ("\tOriginator report request %d\n", int_param);
1328 }
1329
1330 /* envelope recipient string parameters */
1331 /* Originator requested alternate recipient: X.400 string form */
1332 /* this is a submission argument, so should get error */
1333 status = X400mtRecipGetStrParam
1335 buffer, sizeof buffer , &length);
1336 if ( status == X400_E_NOERROR ) {
1337 printf ("\tOriginator requested AR %.*s\n", (int)length, buffer);
1338 }
1339
1340 status = X400mtRecipGetStrParam
1342 buffer, sizeof buffer , &length);
1343 if ( status == X400_E_NOERROR ) {
1344 printf ("\tOriginator requested AR DN %.*s\n", (int)length, buffer);
1345 }
1346
1347 /* content recipient integer parameters */
1348 /* Notification request */
1349 status = X400mtRecipGetIntParam
1350 (rp, X400_N_NOTIFICATION_REQUEST, &int_param);
1351 if ( status == X400_E_NOERROR ) {
1352 printf ("\tNotification request %d\n", int_param);
1353 }
1354
1355 /* Reply Request */
1356 status = X400mtRecipGetIntParam
1357 (rp, X400_N_REPLY_REQUESTED, &int_param);
1358 if ( status == X400_E_NOERROR ) {
1359 printf ("\tReply Request %s\n", int_param ? "false" : "true");
1360 }
1361
1362 /* content recipient string parameters */
1363 /* Notification request */
1364 /* Free Form Name */
1365 status = X400mtRecipGetStrParam
1366 (rp, X400_S_FREE_FORM_NAME, buffer, sizeof buffer , &length);
1367 if ( status == X400_E_NOERROR ) {
1368 printf ("\tFree form name %.*s\n", (int)length, buffer);
1369 }
1370
1371 status = X400mtRecipGetStrParam
1372 (rp, X400_S_DIRECTORY_NAME, buffer, sizeof buffer , &length);
1373 if ( status == X400_E_NOERROR ) {
1374 printf ("\tDirectory Name %.*s\n", (int)length, buffer);
1375 }
1376
1377 /* Telephone Number */
1378 status = X400mtRecipGetStrParam
1379 (rp, X400_S_TELEPHONE_NUMBER, buffer, sizeof buffer , &length);
1380 if ( status == X400_E_NOERROR ) {
1381 printf ("\tTelephone Number %.*s\n", (int)length, buffer);
1382 }
1383
1384 status = X400mtRecipGetStrParam
1385 (rp, X400_S_ARRIVAL_TIME, buffer, sizeof buffer , &length);
1386 if ( status == X400_E_NOERROR )
1387 printf ("Arrival Time: %.*s\n", (int)length, buffer);
1388
1389 /* Positive reports */
1390 /* Message Delivery Time - present for successful deliveries */
1391 status = X400mtRecipGetStrParam
1392 (rp, X400_S_MESSAGE_DELIVERY_TIME, buffer, sizeof buffer , &length);
1393 if ( status == X400_E_NOERROR )
1394 printf ("Subject Message Delivery Time: %.*s\n", (int)length, buffer);
1395
1396 /* type of MTS user - successful report only */
1397 status = X400mtRecipGetIntParam
1398 (rp, X400_N_TYPE_OF_USER, &int_param);
1399 if ( status == X400_E_NOERROR ) {
1400 printf ("\tType of MTS user %d\n", int_param);
1401 }
1402
1403 /* Negative reports */
1404 /* Supplementary info (reported recips only) */
1405 status = X400mtRecipGetStrParam
1406 (rp, X400_S_SUPPLEMENTARY_INFO, buffer, sizeof buffer , &length);
1407 if ( status == X400_E_NOERROR ) {
1408 printf ("\tSupplementary info %.*s\n", (int)length, buffer);
1409 }
1410
1411 /* reason - non-success report only */
1412 status = X400mtRecipGetIntParam
1413 (rp, X400_N_NON_DELIVERY_REASON, &int_param);
1414 if ( status == X400_E_NOERROR ) {
1415 printf ("\tNon-delivery Reason %d\n", int_param);
1416 }
1417
1418 /* diagnostic info - non-success report only */
1419 status = X400mtRecipGetIntParam
1420 (rp, X400_N_NON_DELIVERY_DIAGNOSTIC, &int_param);
1421 if ( status == X400_E_NOERROR ) {
1422 printf ("\tNon-delivery diagnostic %d\n", int_param);
1423 }
1424
1425 /* CEITS */
1426 status = X400mtRecipGetStrParam
1428 buffer, sizeof buffer , &length);
1429 if ( status == X400_E_NOERROR ) {
1430 printf ("\tCEIT info %.*s\n", (int)length, buffer);
1431 }
1432
1433
1434#define USE_REDIRECTION_HISTORY 1
1435#ifdef USE_REDIRECTION_HISTORY
1436 {
1437
1438 status = do_redirection_hist(rp);
1439
1440 if ( status == X400_E_NO_VALUE ) {
1441 /* do nothing */
1442 } else if (status == X400_E_MISSING_ATTR ) {
1443 printf("There is no Redirection History\n");
1444 } else if (status != X400_E_NOERROR) {
1445 printf("error getting Redirection History\n");
1446 fprintf (stderr, "Error fetching Redirection History: %s\n",
1447 X400mtError (status));
1448 return status;
1449 }
1450 }
1451#endif
1452 status = X400mtRecipGetIntParam(rp, X400_N_ACP127_NOTI_TYPE, &int_param);
1453 if ( status == X400_E_NOERROR ) {
1454 if (int_param & X400_ACP127_NOTI_TYPE_NEG) {
1455 printf("P772 ACP127 Notification Request Type Negative\n");
1456 }
1457 if (int_param & X400_ACP127_NOTI_TYPE_POS) {
1458 printf("P772 ACP127 Notification Request Type Positive\n");
1459 }
1460
1461 if (int_param & X400_ACP127_NOTI_TYPE_TRANS) {
1462 printf("P772 ACP127 Notification Request Type Transfer\n");
1463 }
1464
1465 }
1466
1467 /* report content integrity check info if available */
1468 get_cic(rp);
1469
1470 /* report message token info if available */
1471 report_sig_info(rp);
1472
1473 printf("-----------------------------------------------------------\n");
1474 }
1475 return X400_E_NOERROR;
1476}
1477
1478static int do_rep_env(
1479 struct X400mtMessage *mp
1480)
1481{
1482 char buffer[BUFSIZ];
1483 int status;
1484 size_t length;
1485
1486 /* Envelope Attributes */
1487
1488 /* string attributes */
1489 /* The ORADDRESS in the message is the (envelope) originator */
1491 buffer, sizeof buffer , &length);
1492 if ( status != X400_E_NOERROR ) {
1493 if (status == X400_E_NO_VALUE) {
1494 printf("Reports don't have an originator\n");
1495 } else {
1496 printf("error getting originator address\n");
1497 fprintf (stderr, "Error in getting originator: %s\n",
1498 X400mtError (status));
1499 return (status);
1500 }
1501 } else {
1502 printf ("Originator: %.*s\n", (int)length, buffer);
1503 }
1504
1505
1506 /* report identifier - rather confusingly, use X400_S_MESSAGE_IDENTIFIER */
1508 buffer, sizeof buffer , &length);
1509 if ( status != X400_E_NOERROR ) {
1510 printf("error getting report identifier\n");
1511 fprintf (stderr, "Error in getting report identifier: %s\n",
1512 X400mtError (status));
1513 return (status);
1514 }
1515 printf ("report identifier: %.*s\n", (int)length, buffer);
1516
1517 /* content identifier not present in report */
1518
1519 /* original EITs */
1520 status = X400mtMsgGetStrParam (mp,
1522 buffer, sizeof buffer , &length);
1523 if (status == X400_E_NOERROR) {
1524 printf ("original EITs: %.*s\n", (int)length, buffer);
1525 } else if ( status != X400_E_NO_VALUE ) {
1526 fprintf (stderr, "Error in getting original EITs : %s\n",
1527 X400mtError (status));
1528 return (status);
1529 }
1530
1531
1532 /* submission time not present in report*/
1533
1534
1535
1536#ifdef WANT_TRACE_INFO
1537 {
1538 status = do_trace_info(mp);
1539 if ( status == X400_E_NO_VALUE) {
1540
1541 } else if (status == X400_E_MISSING_ATTR ) {
1542 printf("There is no Trace Info\n");
1543 } else if (status != X400_E_NOERROR) {
1544 printf("error getting Trace Info\n");
1545 fprintf (stderr, "Error fetching trace info: %s\n",
1546 X400mtError (status));
1547 return status;
1548 }
1549
1550 }
1551#endif
1552
1553
1554#ifdef USE_REDIRECTION_HISTORY
1555 {
1556 status = do_redirection_hist_env(mp);
1557
1558 if ( status == X400_E_NO_VALUE ) {
1559 /* do nothing */
1560 } else if (status == X400_E_MISSING_ATTR ) {
1561 printf("There is no Redirection History\n");
1562 } else if (status != X400_E_NOERROR) {
1563 printf("error getting Redirection History\n");
1564 fprintf (stderr, "Error fetching Redirection History: %s\n",
1565 X400mtError (status));
1566 return status;
1567 }
1568 }
1569#endif
1570
1571 status = do_orig_and_dl(mp);
1572
1573 if ( status == X400_E_NO_VALUE ) {
1574 /* do nothing */
1575 } else if (status == X400_E_MISSING_ATTR ) {
1576 printf("There is no orig and dl exp history\n");
1577 } else if (status != X400_E_NOERROR) {
1578 fprintf (stderr, "Error getting orig and dl exp history: %s\n",
1579 X400mtError (status));
1580 return status;
1581 }
1582
1583
1584
1585 /* latest delivery time */
1587 buffer, sizeof buffer , &length);
1588 if ( status != X400_E_NOERROR && status != X400_E_INVALID_ATTR) {
1589 printf("error getting latest delivery time\n");
1590 fprintf (stderr, "Error in getting latest delivery time: %s\n",
1591 X400mtError (status));
1592 return (status);
1593 } else {
1594 printf ("latest delivery time: %.*s\n", (int)length, buffer);
1595 }
1596 /* Get the envelope recipients */
1597 status = get_recips(mp, X400_RECIP_ENVELOPE, "envelope");
1598 if ( status != X400_E_NOERROR && status != X400_E_NO_RECIP) {
1599 printf("error getting recipients\n");
1600 fprintf (stderr, "Error in getting recipient: %s\n",
1601 X400mtError (status));
1602 return (status);
1603 }
1604
1605/* Get the reporting dl name */
1606 status = get_recips(mp, X400_REPORTING_DL_NAME, "Reporting DL name");
1607 if ( status != X400_E_NOERROR && status != X400_E_NO_RECIP) {
1608 printf("error getting dl name\n");
1609 fprintf (stderr, "Error in getting recipient: %s\n",
1610 X400mtError (status));
1611 return (status);
1612 }
1613
1614
1615 return X400_E_NOERROR;
1616}
1617
1618
1619static void report_sig_info(
1620 struct X400Recipient *rp
1621)
1622{
1623 char buffer[BUFSIZ];
1624 int status;
1625 int param;
1626 size_t length;
1627
1628 show_certificate (rp, X400_N_CERT_MSGTOK, "message-token");
1629
1630 status = X400mtRecipGetStrParam(rp,
1632 buffer, sizeof buffer, &length);
1633 if (status != X400_E_NOERROR) {
1634 fprintf(stderr, "Error from RecipGetStrParam: %s\n",
1635 X400mtError(status));
1636
1637 fprintf(stderr, "recipient in token not available\n");
1638 } else {
1639 fprintf(stderr,
1640 "Message Token(%u): recipient in Token '%.*s'\n",
1641 (unsigned)length, (int)length, buffer);
1642 }
1643
1644 status = X400mtRecipGetStrParam(rp,
1646 buffer, sizeof buffer, &length);
1647 if (status != X400_E_NOERROR) {
1648 fprintf(stderr, "Error from RecipGetStrParam: %s (%d)\n",
1649 X400mtError(status),
1651 fprintf(stderr, "Message Token DER not available\n");
1652 } else {
1653 fprintf(stderr,
1654 "Message Token DER available (%u bytes)\n", (unsigned)length);
1655 }
1656
1657 status = X400mtRecipGetIntParam(rp,
1658 X400_N_MSGTOK_SEQ_NUM, &param);
1659 if (status != X400_E_NOERROR) {
1660 fprintf(stderr, "Error from RecipGetStrParam: %s (%d)\n",
1661 X400mtError(status),
1663 fprintf(stderr, "Message Token seq num not available\n");
1664 } else {
1665 fprintf(stderr,
1666 "Message Token seq num %d \n", param);
1667 }
1668
1669 status = X400mtRecipGetStrParam(rp,
1671 buffer, sizeof buffer, &length);
1672 if (status != X400_E_NOERROR) {
1673 fprintf(stderr, "Error from RecipGetStrParam: %s (%d)\n",
1674 X400mtError(status),
1676 fprintf(stderr, "Message Token Security Label DER not available\n");
1677 } else {
1678 fprintf(stderr,
1679 "Message Token Security Label DER available (%u bytes)\n", (unsigned)length);
1680 fprintf(stderr, "Security Label from Message Token is:\n");
1681 print_sec_label((unsigned char *)buffer, length);
1682 }
1683
1684 status = X400mtRecipGetStrParam(rp,
1686 buffer, sizeof buffer, &length);
1687 if (status != X400_E_NOERROR) {
1688 fprintf(stderr, "Error from RecipGetStrParam: %s (%d)\n",
1689 X400mtError(status),
1691 fprintf(stderr,
1692 "Message Token Content Integrity Check DER not available\n");
1693 } else {
1694 fprintf(stderr,
1695 "Message Token Content Integrity Check DER available (%u bytes)\n",
1696 (unsigned)length);
1697 }
1698
1699 show_certificate (rp, X400_N_CERT_MSGTOK_CIC, "token CIC");
1700
1701 return;
1702}
1703
1704
1705static void print_sec_label(
1706 unsigned char slab_buffer[],
1707 unsigned int length
1708)
1709{
1710
1711 char xml_buffer[XML_BUFSIZE];
1712 int status;
1713
1714 status = SecLabelInit("Example program");
1715 if (status != SECLABEL_E_NOERROR) {
1716 fprintf(stderr, "SecLabelInit returned error %d\n", status);
1717 return ;
1718 }
1719
1720 status = SecLabelPrint(slab_buffer,
1721 length,
1722 xml_buffer,
1723 XML_BUFSIZE);
1724
1725 if (status != SECLABEL_E_NOERROR) {
1726 fprintf(stderr, "SecLabelParse returned error %d\n", status);
1727 return ;
1728 }
1729
1730 /* You could now write out the XML file, or parse it in memory..*/
1731 printf("Got security label:%s\n", xml_buffer);
1732 return;
1733}
1734
1735static int get_cic(
1736 struct X400Recipient *rp
1737)
1738{
1739 char buffer[BUFSIZ];
1740 int status, cic_status;
1741 int intparam;
1742 size_t length;
1743
1744 /* get back status of the Content Integrity Check in the recipient */
1746 &intparam);
1747 if (cic_status == X400_E_NO_VALUE) {
1748 printf("No Content Integrity Check in recipient\n");
1749 return X400_E_NOERROR;
1750 } else if (cic_status != X400_E_NOERROR) {
1751 printf("Error from RecipGetIntParam: %s\n", X400mtError(cic_status));
1752 return cic_status;
1753 }
1754
1755 /* report CIC information */
1756 switch (intparam) {
1757 case X400_E_NOERROR:
1758 printf("Content Integrity Check succeeded\n");
1759 break;
1760 default:
1761 printf("Content Integrity Check error (%d): %s\n",
1762 intparam, X400mtError(intparam));
1763 break;
1764 }
1765
1766 /* Return the Content Integrity Check */
1768 buffer, sizeof buffer, &length);
1769 if (status != X400_E_NOERROR) {
1770 fprintf(stderr, "Error getting recipient cic: %s\n",
1771 X400mtError(status));
1772 } else {
1773 printf("Content Integrity Check found in recipient (%d)\n",
1774 (int)length);
1775 }
1776
1777 show_certificate (rp, X400_N_CERT_RECIP_CIC, "recipient CIC");
1778
1779 return X400_E_NOERROR;
1780}
1781
1782static void show_certificate (
1783 struct X400Recipient *rp,
1784 int certtype,
1785 const char *tag)
1786{
1787 int status;
1788 struct X400Certificate *cert;
1789 char buffer[BUFSIZ];
1790 size_t length;
1791 int paramval;
1792
1793 status = X400RecipGetCert (rp, certtype, &cert);
1794 if ( status != X400_E_NOERROR ) {
1795 fprintf (stderr, "Error getting %s certificate: %s\n",
1796 tag, X400mtError (status));
1797 return;
1798 }
1799
1800 /* Return the subject DN from Orig cert */
1802 buffer, sizeof buffer, &length);
1803 if (status != X400_E_NOERROR) {
1804 fprintf(stderr, "Error getting subject of cert used for %s: %s\n",
1805 tag, X400mtError(status));
1806 } else {
1807 printf("Subject of Cert used to verify %s (%.*s)\n",
1808 tag, (int)length, buffer);
1809 }
1810
1811 /* Return the issuer DN from Orig cert */
1813 buffer, sizeof buffer, &length);
1814 if (status != X400_E_NOERROR) {
1815 fprintf(stderr, "Error getting issuer of cert used for %s: %s\n",
1816 tag, X400mtError(status));
1817 } else {
1818 printf("Issuer of Cert used to verify %s (%.*s)\n",
1819 tag, (int)length, buffer);
1820 }
1821
1822 /* Return the serial number from Orig cert used to verify the
1823 * Content Integrity Check */
1825 buffer, sizeof buffer, &length);
1826 if (status != X400_E_NOERROR) {
1827 fprintf(stderr, "Error getting serial num of cert used for %s: %s\n",
1828 tag, X400mtError(status));
1829 } else {
1830 printf("Serial Num of Cert used to verify %s (%.*s)\n",
1831 tag, (int)length, buffer);
1832 }
1833
1834 /* Return the Orig cert used to verify the Content Integrity Check */
1835 status = X400CertGetStrParam(cert, X400_S_CERT_BER,
1836 buffer, sizeof buffer, &length);
1837 if (status != X400_E_NOERROR) {
1838 fprintf(stderr, "Error getting cert der used for %s: %s\n",
1839 tag, X400mtError(status));
1840 } else {
1841 printf(
1842 "Returned Cert used to verify %s (%d)\n",
1843 tag, (int)length);
1844 }
1845
1846 /* Find any ORaddress subject alt name and its status */
1848 buffer, sizeof buffer, &length);
1849 if (status != X400_E_NOERROR) {
1850 if ( status == X400_E_NO_VALUE ) {
1851 fprintf(stderr, "No ORaddress subject alt. name\n");
1852 } else {
1853 fprintf(stderr, "Error from CertGetStrParam: %s\n",
1854 X400mtError(status));
1855 return;
1856 }
1857 } else {
1858 fprintf(stderr, "ORaddress subject alt name: '%.*s'\n",
1859 (int)length, buffer);
1860 }
1861
1862 status = X400CertGetIntParam(cert, X400_N_CERT_ORADDRESS_STATUS, &paramval);
1863
1864 if (status != X400_E_NOERROR) {
1865 fprintf(stderr, "Error from CertGetStrParam: %s\n",
1866 X400mtError(status));
1867 return;
1868 }
1869
1870 fprintf(stderr, "ORaddress subject alt name status: %s\n",
1871 X400mtError (paramval));
1872}
1873
1874static int do_rep_content(
1875 struct X400mtMessage *mp
1876)
1877{
1878 char buffer[BUFSIZ];
1879 int status;
1880 size_t length;
1881
1882 /* Message Body */
1883 printf("Report content\n");
1884
1885 /* subject ID */
1887 buffer, sizeof buffer , &length);
1888 if ( status != X400_E_NOERROR ) {
1889 printf("error getting subject id\n");
1890 fprintf (stderr, "Error in getting subject id: %s\n",
1891 X400mtError (status));
1892 return (status);
1893 }
1894 printf ("subject id: %.*s\n", (int)length, buffer);
1895
1896 /* content-correlator */
1898 buffer, sizeof buffer , &length);
1899 if ( status != X400_E_NOERROR ) {
1900 printf("error getting icontent-correlator\n");
1901 fprintf (stderr, "Error in getting content-correlator: %s\n",
1902 X400mtError (status));
1903 return (status);
1904 }
1905 printf ("content-correlator: %.*s\n", (int)length, buffer);
1906
1907 /* Get the reported recipients */
1908 status = get_recips(mp, X400_RECIP_REPORT, "reported-recip");
1909 if ( status != X400_E_NOERROR && status != X400_E_NO_RECIP) {
1910 printf("error getting reported-recip\n");
1911 fprintf (stderr, "Error in getting reported-recip: %s\n",
1912 X400mtError (status));
1913
1914 return (status);
1915 }
1916
1917#ifdef WANT_TRACE_INFO
1918 {
1919 status = do_trace_info(mp);
1920 if ( status == X400_E_NO_VALUE) {
1921
1922 } else if (status == X400_E_MISSING_ATTR ) {
1923 printf("There is no Trace Info\n");
1924 } else {
1925 printf("error getting Trace Info\n");
1926 fprintf (stderr, "Error fetching trace info: %s\n",
1927 X400mtError (status));
1928 return status;
1929 }
1930 }
1931#endif
1932
1933 return(status);
1934}
1935
1936
1937static int do_rep_retcontent(
1938 struct X400mtMessage *mp
1939)
1940{
1941 char buffer[BUFSIZ];
1942 int status;
1943 size_t length;
1944 int int_param;
1945
1946 printf("Returned content\n");
1947
1948 status = X400mtMsgGetIntParam
1949 (mp, X400_N_NUM_ATTACHMENTS, &int_param);
1950 if ( status == X400_E_NOERROR )
1951 printf ("\tNum attachments %d\n", int_param);
1952 else
1953 printf ("\tNum attachments STATUS %d\n", status);
1954
1955 /* And now get message text (or it could be another type - ie not IA5) */
1957 buffer, sizeof buffer , &length);
1958 if ( status == X400_E_NOERROR )
1959 printf ("Text:\n%.*s\n", (int)length, buffer);
1960 return status;
1961}
1962
1963
1964static void usage(void) {
1965 printf("usage: %s\n", optstr);
1966 printf("\t where:\n");
1967 printf("\t -u : Don't prompt to override defaults \n");
1968 printf("\t -o : Originator \n");
1969 printf("\t -O : Originator Return Address \n");
1970 printf("\t -r : Recipient\n");
1971 printf("\t -c : X.400 passive channel\n");
1972 printf("\t -l : Logline\n");
1973 printf("\t -E : Stop after one attempt to transfer a msg\n");
1974 return;
1975}
1976
1977static int do_trace_info (
1978 struct X400mtMessage *mp
1979)
1980{
1981 char GDI [BUFSIZ];
1982 char DSI_arrival_time[BUFSIZ];
1983 int DSI_routing_action;
1984 char DSI_attempted_domain[BUFSIZ];
1985
1986 char DSI_AA_def_time[BUFSIZ];
1987 char DSI_AA_CEIT[BUFSIZ];
1988 int DSI_AA_redirected = 0;
1989 int DSI_AA_dl_operation = 0;
1990
1991 size_t length;
1992 int n;
1993 int status;
1994
1995 struct X400TraceInfo *info = NULL;
1996
1997 for ( n=1; ;n++ ) {
1998 status = X400mtTraceInfoGet (mp, n, &info, X400_TRACE_INFO);
1999 if (status != X400_E_NOERROR)
2000 break;
2001
2003 GDI, BUFSIZ , &length);
2004
2005 if ( status == X400_E_NOERROR ) {
2006 GDI[length] = '\0';
2007 printf ("GDI entry %d OR Address:%s\n",n,GDI);
2008 } else {
2009 fprintf (stderr, "Error in do_trace_info: %s\n",
2010 X400mtError (status));
2011 }
2012
2014 DSI_arrival_time, BUFSIZ , &length);
2015 if ( status == X400_E_NOERROR ) {
2016 DSI_arrival_time[length] = '\0';
2017 printf ("DSI arrival time %d :%s\n",n,DSI_arrival_time);
2018 } else {
2019 fprintf (stderr, "Error in do_trace_info: %s\n",
2020 X400mtError (status));
2021 }
2022
2024 &DSI_routing_action);
2025 if ( status == X400_E_NOERROR ) {
2026 printf ("DSI routing action %d :%s\n",n,
2027 DSI_routing_action ? "rerouted" : "relayed");
2028 } else {
2029 fprintf (stderr, "Error in do_trace_info: %s\n",
2030 X400mtError (status));
2031 }
2032
2033 /* This one is optional*/
2034 status = X400TraceInfoGetStrParam (info,
2036 DSI_attempted_domain,
2037 BUFSIZ ,&length);
2038 if ( status == X400_E_NOERROR ) {
2039 DSI_attempted_domain[length] = '\0';
2040 printf ("DSI attempted domain %d :%s\n",n,DSI_attempted_domain);
2041 } else {
2042 fprintf (stderr, "Error in do_trace_info optional component: %s\n",
2043 X400mtError (status));
2044 }
2045
2046 /*optional*/
2047 status = X400TraceInfoGetStrParam (info,
2049 DSI_AA_def_time,
2050 BUFSIZ ,&length);
2051 if ( status == X400_E_NOERROR ) {
2052 DSI_AA_def_time[length] = '\0';
2053 printf ("DSI AA %d :%s\n",n,DSI_AA_def_time);
2054 } else {
2055 fprintf (stderr, "Error in do_trace_info optional component: %s\n",
2056 X400mtError (status));
2057 }
2058
2059 /*optional*/
2060 status = X400TraceInfoGetStrParam (info,
2062 DSI_AA_CEIT,
2063 BUFSIZ ,&length);
2064 if ( status == X400_E_NOERROR ) {
2065 DSI_AA_CEIT[length] = '\0';
2066 printf ("DSI AA %d :%s\n",n,DSI_AA_CEIT);
2067 } else {
2068 fprintf (stderr, "Error in do_trace_info optional component: %s\n",
2069 X400mtError (status));
2070 }
2071
2072
2073 status = X400TraceInfoGetIntParam (info,
2075 &DSI_AA_redirected);
2076 if ( status == X400_E_NOERROR ) {
2077 printf ("DSI AA redirected %d :%d\n",n,DSI_AA_redirected );
2078 } else {
2079 fprintf (stderr, "Error in do_trace_info: %s\n",
2080 X400mtError (status));
2081 }
2082
2083 status = X400TraceInfoGetIntParam (info,
2085 &DSI_AA_dl_operation);
2086 if ( status == X400_E_NOERROR ) {
2087 printf ("DSI AA dl operation %d :%d\n",n,DSI_AA_dl_operation );
2088 } else {
2089 fprintf (stderr, "Error in do_trace_info: %s\n",
2090 X400mtError (status));
2091 }
2092
2093
2094 }
2095 if (n == 1) {
2096 printf("No Trace Info found in message\n");
2097 } else {
2098 printf("%d Trace Info entries found in message\n", n - 1);
2099 }
2100 return X400_E_NOERROR;
2101
2102}
2103
2104static int do_internal_trace_info (
2105 struct X400mtMessage *mp
2106)
2107{
2108
2109 size_t length;
2110 int n;
2111 int status;
2112 int SI_routing_action = 0;
2113 int SI_attempted_action = 0;
2114 int SI_OA = 0;
2115
2116 char GDI [BUFSIZ];
2117 char SI_MTA_name [BUFSIZ];
2118 char SI_time [BUFSIZ];
2119 char SI_attempted_MTA_name[BUFSIZ];
2120 char SI_attempted_domain [BUFSIZ];
2121 char SI_defered_time [BUFSIZ];
2122 char SI_CEIT [BUFSIZ];
2123
2124 struct X400InternalTraceInfo *info = NULL;
2125
2126 for ( n=1; ;n++ ) {
2127 /*GDI*/
2128 status = X400mtInternalTraceInfoGet (mp,n, &info);
2129 if (status == X400_E_NO_VALUE)
2130 break;
2131
2132 status = X400InternalTraceInfoGetStrParam (info,
2134 GDI, BUFSIZ , &length);
2135 if (status == X400_E_NO_VALUE) {
2136 return X400_E_NO_VALUE;
2137 }
2138
2139 if ( status == X400_E_NOERROR ) {
2140 GDI[length] = '\0';
2141 printf ("GDI entry %d Domain:%s\n",n,GDI);
2142 } else {
2143 fprintf (stderr, "Error in do_trace_info: %s\n",
2144 X400mtError (status));
2145 }
2146
2147 /*MTA Name */
2148 status = X400InternalTraceInfoGetStrParam (info,
2150 SI_time, BUFSIZ , &length);
2151 if (status == X400_E_NO_VALUE) {
2152 return X400_E_NO_VALUE;
2153 }
2154
2155 if ( status == X400_E_NOERROR ) {
2156 SI_time[length] = '\0';
2157 printf ("SI time entry %d :%s\n",n,SI_time);
2158 } else {
2159 fprintf (stderr, "Error in do_internal_trace_info: %s\n",
2160 X400mtError (status));
2161 }
2162
2163 /*SI MTA Name*/
2164
2165 status = X400InternalTraceInfoGetStrParam (info,
2167 SI_MTA_name, BUFSIZ , &length);
2168 if (status == X400_E_NO_VALUE) {
2169 return X400_E_NO_VALUE;
2170 }
2171
2172 if ( status == X400_E_NOERROR ) {
2173 SI_MTA_name[length] = '\0';
2174 printf ("SI MTA Name entry %d :%s\n",n,SI_MTA_name);
2175 } else {
2176 fprintf (stderr, "Error in do_internal_trace_info: %s\n",
2177 X400mtError (status));
2178 }
2179
2180 /* SI routing action */
2181 status = X400InternalTraceInfoGetIntParam (info,
2183 &SI_routing_action);
2184 if ( status == X400_E_NOERROR ) {
2185 if (SI_routing_action == X400_MTA_SI_ROUTING_ACTION_RELAYED) {
2186 printf ("SI routing action %d :relayed\n",n);
2187 } else {
2188 printf ("SI routing action %d :rerouted\n",n);
2189 }
2190
2191 } else {
2192 fprintf (stderr, "Error in do_internal_trace_info: %s\n",
2193 X400mtError (status));
2194 }
2195
2196 status = X400InternalTraceInfoGetIntParam (info,
2198 &SI_attempted_action);
2199 if ( status == X400_E_NOERROR ) {
2200 if (SI_routing_action == X400_MTA_SI_RA_MTA) {
2201 printf ("SI attempted action %d :MTA\n",n);
2202 } else {
2203 printf ("SI attempted action %d :Domain\n",n);
2204 }
2205
2206 } else {
2207 fprintf (stderr, "Error in do_internal_trace_info: %s\n",
2208 X400mtError (status));
2209 }
2210
2211 if (SI_attempted_action == X400_MTA_SI_RA_MTA) {
2212 /* SI Attempted MTA Name */
2213 status = X400InternalTraceInfoGetStrParam (info,
2215 SI_attempted_MTA_name,
2216 BUFSIZ,&length);
2217 if (status == X400_E_NO_VALUE) {
2218 return X400_E_NO_VALUE;
2219 }
2220
2221 if ( status == X400_E_NOERROR ) {
2222 SI_attempted_MTA_name[length] = '\0';
2223 printf ("Supplied information attempted MTA %d"
2224 ":%s\n",n,SI_attempted_MTA_name);
2225 } else {
2226 fprintf (stderr, "Error in do_trace_info: %s\n",
2227 X400mtError (status));
2228 }
2229
2230 } else {
2231
2232 /*SI Attempted domain*/
2233 status = X400InternalTraceInfoGetStrParam (info,
2235 SI_attempted_domain, BUFSIZ,
2236 &length);
2237 if (status == X400_E_NO_VALUE) {
2238 return X400_E_NO_VALUE;
2239 }
2240
2241 if ( status == X400_E_NOERROR ) {
2242 SI_attempted_domain[length] = '\0';
2243 printf ("Supplied information attempted Domain entry"
2244 " %d :%s\n",n,SI_attempted_domain);
2245 } else {
2246 fprintf (stderr, "Error in do_internal_trace_info: %s\n",
2247 X400mtError (status));
2248 }
2249 }
2250
2251
2252
2253 /* SI MTA Defered time*/
2254 status = X400InternalTraceInfoGetStrParam (info,
2256 SI_defered_time,
2257 BUFSIZ , &length);
2258 if (status == X400_E_NO_VALUE) {
2259 return X400_E_NO_VALUE;
2260 }
2261
2262 if ( status == X400_E_NOERROR ) {
2263 SI_defered_time[length] = '\0';
2264 printf ("SI_defered_time entry %d :%s\n",n,
2265 SI_defered_time);
2266 } else {
2267 fprintf (stderr, "Error in do_internaltrace_info: %s\n",
2268 X400mtError (status));
2269 }
2270
2271 /* SI MTA Converted Encoded Information Types*/
2272 status = X400InternalTraceInfoGetStrParam (info,
2274 SI_CEIT,
2275 BUFSIZ , &length);
2276 if (status == X400_E_NO_VALUE) {
2277 return X400_E_NO_VALUE;
2278 }
2279
2280 if ( status == X400_E_NOERROR ) {
2281 SI_CEIT[length] = '\0';
2282 printf ("SI_CEIT entry %d :%s\n",n,
2283 SI_CEIT);
2284 } else {
2285 fprintf (stderr, "Error in do_internaltrace_info: %s\n",
2286 X400mtError (status));
2287 }
2288
2289
2290 status = X400InternalTraceInfoGetIntParam (info,
2292 &SI_OA);
2293 if ( status == X400_E_NOERROR ) {
2295 printf("SI_Other_Actions: %d: Redirected\n",n);
2296 }
2298 printf("SI_Other_Actions: %d: DLOP\n",n);
2299 }
2300
2301 } else {
2302 fprintf (stderr, "Error in do_internal_trace_info: %s\n",
2303 X400mtError (status));
2304 }
2305
2306
2307 }
2308 if (n == 1) {
2309 printf("No Internal Trace Info found in message\n");
2310 } else {
2311 printf("%d Internal Trace Info entries found in message\n", n - 1);
2312 }
2313 return X400_E_NOERROR;
2314
2315}
2316
2317static int do_redirection_hist (
2318 struct X400Recipient *recip
2319)
2320{
2321 char redirection_time [BUFSIZ];
2322 char or_address [BUFSIZ];
2323 char dn [BUFSIZ];
2324 int rr;
2325
2326 size_t length;
2327 int n;
2328 int status;
2329 struct X400RediHist *hist = NULL;
2330
2331 for ( n=1; ;n++ ) {
2332 status = X400RediHistGet (recip,n, &hist);
2333 if (status != X400_E_NOERROR)
2334 break;
2335
2337 redirection_time, BUFSIZ,&length);
2338
2339
2340 if ( status == X400_E_NOERROR ) {
2341 redirection_time[length] = '\0';
2342 printf ("Redirection time: %i %s\n",n,redirection_time);
2343 } else {
2344 fprintf (stderr, "Error in do_redirection_hist: %s\n",
2345 X400mtError (status));
2346 }
2347
2349 or_address, BUFSIZ , &length);
2350 if ( status == X400_E_NOERROR ) {
2351 or_address[length] = '\0';
2352 printf ("Redirection OR address %i :%s\n",n,or_address);
2353 } else {
2354 fprintf (stderr, "Error in do_trace_info: %s\n",
2355 X400mtError (status));
2356 }
2357
2359 dn, BUFSIZ , &length);
2360 if ( status == X400_E_NOERROR ) {
2361 dn[length] = '\0';
2362 printf ("Redirection DN %i :%s\n",n,dn);
2363 } else {
2364 fprintf (stderr, "Error in do_trace_info: %s\n",
2365 X400mtError (status));
2366 }
2367
2369 if ( status == X400_E_NOERROR ) {
2370 printf ("DSI routing action %d :%s\n",n,X400RediReason(rr));
2371 } else {
2372 fprintf (stderr, "Error in do_redirection_hist: %s\n",
2373 X400mtError (status));
2374 }
2375
2376 }
2377 if (n == 1) {
2378 printf("No Trace Info found in message\n");
2379 } else {
2380 printf("%d Trace Info entries found in message\n", n - 1);
2381 }
2382 return X400_E_NOERROR;
2383
2384}
2385
2386static int do_redirection_hist_env (
2387 struct X400mtMessage *msg
2388)
2389{
2390 char redirection_time [BUFSIZ];
2391 char or_address [BUFSIZ];
2392 char dn [BUFSIZ];
2393 int rr;
2394
2395 size_t length;
2396 int n;
2397 int status;
2398 struct X400RediHist *hist = NULL;
2399
2400 for ( n=1; ;n++ ) {
2401 status = X400mtRediHistGetEnv (msg,n, &hist);
2402 if (status != X400_E_NOERROR)
2403 break;
2404
2406 redirection_time, BUFSIZ,&length);
2407
2408
2409 if ( status == X400_E_NOERROR ) {
2410 redirection_time[length] = '\0';
2411 printf ("Redirection time: %i %s\n",n,redirection_time);
2412 } else {
2413 fprintf (stderr, "Error in do_redirection_hist: %s\n",
2414 X400mtError (status));
2415 }
2416
2418 or_address, BUFSIZ , &length);
2419 if ( status == X400_E_NOERROR ) {
2420 or_address[length] = '\0';
2421 printf ("Redirection OR address %i :%s\n",n,or_address);
2422 } else {
2423 fprintf (stderr, "Error in do_trace_info: %s\n",
2424 X400mtError (status));
2425 }
2426
2428 dn, BUFSIZ , &length);
2429 if ( status == X400_E_NOERROR ) {
2430 dn[length] = '\0';
2431 printf ("Redirection DN %i :%s\n",n,dn);
2432 } else {
2433 fprintf (stderr, "Error in do_trace_info: %s\n",
2434 X400mtError (status));
2435 }
2436
2438 if ( status == X400_E_NOERROR ) {
2439 printf ("DSI routing action %d :%s\n",n,X400RediReason(rr));
2440 } else {
2441 fprintf (stderr, "Error in do_redirection_hist: %s\n",
2442 X400mtError (status));
2443 }
2444
2445 }
2446 if (n == 1) {
2447 printf("No Redirection histories found in message\n");
2448 } else {
2449 printf("%d Redirection histories entries found in message\n", n - 1);
2450 }
2451 return X400_E_NOERROR;
2452
2453}
2454
2455#ifdef HANDLING_MILITARY_IPN
2456
2457static int get_acp127_ali (
2458 struct X400ACP127Resp *resp
2459)
2460{
2461 struct X400ALI *ali = NULL;
2462 int n;
2463 char buffer[BUFSIZ];
2464 size_t length;
2465 int status;
2466 int int_param;
2467
2468 for ( n = 1; ; n++ ) {
2469 status = X400ACP127RespGetALI (resp,&ali,n);
2470 if ( status != X400_E_NOERROR )
2471 return status;
2472
2474 buffer, sizeof buffer , &length);
2475 if ( status == X400_E_NOERROR ) {
2476 printf ("P772 ACP127 response Notification "
2477 "ALI recipient OR address %d: %.*s\n",
2478 n, (int)length, buffer);
2479 } else if ( status == X400_E_NO_VALUE) {
2480 return X400_E_NO_VALUE;
2481 }
2482
2483
2485 buffer, sizeof buffer , &length);
2486 if ( status == X400_E_NOERROR ) {
2487 printf ("P772 ACP127 response Notification"
2488 " ALI recipient DN address %d: %.*s\n",
2489 n, (int)length, buffer);
2490 }
2491
2493 buffer, sizeof buffer , &length);
2494 if ( status == X400_E_NOERROR ) {
2495 printf ("P772 ACP127 response Notification"
2496 " ALI recipient free form name %d: %.*s\n",
2497 n, (int)length, buffer);
2498 }
2499
2501 buffer, sizeof buffer , &length);
2502 if ( status == X400_E_NOERROR ) {
2503 printf ("P772 ACP127 response Notification"
2504 "ALI recipient Tel number %d: %.*s\n",
2505 n, (int)length, buffer);
2506 }
2507
2508 status = X400ALIGetIntParam (ali,X400_N_ALI_TYPE , &int_param);
2509 if ( status == X400_E_NOERROR ) {
2510 printf ("P772 ACP127 response Notification"
2511 "ALI Type %d\n", int_param);
2512 }
2513
2515 &int_param);
2516 if ( status == X400_E_NOERROR ) {
2517 printf ("P772 ACP127 response Notification"
2518 "ALI Notification Request %d\n", int_param);
2519 }
2520
2521
2522 status = X400ALIGetIntParam (ali,X400_N_ALI_REPLY_REQUEST ,&int_param);
2523 if ( status == X400_E_NOERROR ) {
2524 printf ("P772 ACP127 response Notification"
2525 "ALI Notification Request %d\n", int_param);
2526 }
2527
2528
2529 }
2530}
2531#endif
2532
2533/* This is a very simple function to go through the P772 body parts only.
2534 * It's a modified version of what's in x400_msrcv.c
2535 */
2536static int get_body_parts(
2537 struct X400mtMessage *mp
2538)
2539{
2540#define INIT_BUFFER_SIZE 10000
2541 int status = X400_E_NOERROR;
2542 int type = 0;
2543 char *buf;
2544 size_t buflen;
2545 size_t ret_len;
2546 int i = 0;
2547
2548 struct X400Bodypart *bp;
2549
2550
2551 buf = (char *) malloc(INIT_BUFFER_SIZE);
2552 if (buf == NULL) {
2553 fprintf(stderr, "can't alloc %d bytes\n", INIT_BUFFER_SIZE);
2554 return X400_E_NOMEMORY;
2555 }
2556 buflen = INIT_BUFFER_SIZE;
2557
2558 for (i = 1; i <= num_atts ; i++) {
2559 printf ("Get attachment %d\n", i);
2560 status = X400mtMsgGetBodypart(mp, i, &type, &bp);
2561 if (status != X400_E_NOERROR &&
2562 status != X400_E_MESSAGE_BODY) {
2563 fprintf(stderr, "X400mtMsgGetBodypart %d failed %s\n", i,
2564 X400mtError (status));
2565 /* skip this bodypart.
2566 * The IA5text bodypart has already been fetched throught the
2567 * X400mtMsgGetStrParam interface.
2568 * So fetching that bodypart fails here.
2569 */
2570 break;
2571 }
2572
2573 printf("got Bodypart %d, type = %s\n", i,
2574 type == X400_T_IA5TEXT ? "IA5" :
2575 type == X400_T_ISO8859_1 ? "ISO8859-1" :
2576 type == X400_T_ISO8859_2 ? "ISO8859_2" :
2577 type == X400_T_BINARY ? "Binary" :
2578 type == X400_T_MESSAGE ? "Message" :
2579 type == X400_T_FTBP ? "File Transfer BP" :
2580 type == X400_T_GENERAL_TEXT ? "General Text" :
2581 type == X400_T_CORRECTIONS ? "P772 Correction" :
2582 type == X400_T_ACP127DATA ? "P772 ACP127 Data" :
2583 type == X400_T_MM ? "P772 Forwarded MM" :
2584 type == X400_T_FWDENC ? "P772 Forwarded Encrypted" :
2585 type == X400_T_FWD_CONTENT ? " Forwarded Content":
2586 type == X400_T_ADATP3 ? "P772 ADatP3" : "unknown"
2587 );
2588
2589 switch (type) {
2590 case X400_T_FWD_CONTENT:
2591 {
2592 /* Fetch a forwarded bodypart */
2593 char buffer[BUFSIZ];
2594 struct X400Message *fwd_content_env = NULL;
2595 size_t length = 0;
2596
2597 status = X400mtMsgGetMessageBody(mp,i,&fwd_content_env);
2598 if (status != X400_E_NOERROR) {
2599 fprintf(stderr, "X400mtMsgGetBodypart failed %s\n",
2600 X400mtError (status));
2601 free (buf);
2602 return status;
2603 }
2604
2605 status = X400MsgGetStrParam (fwd_content_env,
2607 buffer, sizeof buffer , &length);
2608
2609 if (status == X400_E_NOERROR) {
2610 printf ("Forwarded Content bodypart"
2611 " Message Delivery Time: %.*s\n",
2612 (int)length, buffer);
2613 } else {
2614 fprintf(stderr, "X400MsgGetStrParam failed %s\n",
2615 X400mtError (status));
2616 }
2617
2618 status = X400MsgGetStrParam (fwd_content_env,
2620 buffer, sizeof buffer , &length);
2621
2622 if (status == X400_E_NOERROR) {
2623 printf ("Forwarded Content bodypart"
2624 " Message identifier: %.*s\n",
2625 (int)length, buffer);
2626 } else {
2627 fprintf(stderr, "X400MsgGetStrParam failed %s\n",
2628 X400mtError (status));
2629 }
2630
2631 /* We currently don't support proof of submission */
2632
2633
2634 status = X400MsgGetStrParam (fwd_content_env,
2636 buffer, sizeof buffer , &length);
2637 if ( status == X400_E_NOERROR ) {
2638 printf ("Forwarded content bodypart data: %i bytes\n",
2639 (int)length);
2640 } else {
2641 fprintf(stderr, "X400MsgGetStrParam failed %s\n",
2642 X400mtError (status));
2643 }
2644 break;
2645
2646
2647 }
2648 case X400_T_FWDENC:
2649 {
2650 /* Fetch a forwarded bodypart */
2651 char buffer[BUFSIZ];
2652 struct X400Message *ENC_fwd = NULL;
2653 size_t length = 0;
2654
2655 status = X400mtMsgGetMessageBody(mp,i,&ENC_fwd);
2656 if (status != X400_E_NOERROR) {
2657 fprintf(stderr, "X400mtMsgGetBodypart failed %s\n",
2658 X400mtError (status));
2659 free (buf);
2660 return status;
2661 }
2662
2664 buffer, sizeof buffer , &length);
2665
2666 if (status == X400_E_NOERROR) {
2667 printf ("P772 Forwarded Encrypted bodypart"
2668 " Message Delivery Time: %.*s\n",
2669 (int)length, buffer);
2670 } else {
2671 fprintf(stderr, "X400MsgGetStrParam failed %s\n",
2672 X400mtError (status));
2673 }
2674
2675
2677 buffer, sizeof buffer , &length);
2678 if ( status == X400_E_NOERROR ) {
2679 printf ("P772 Forwarded encrypted bodypart data: %i bytes\n",
2680 (int)length);
2681 } else {
2682 fprintf(stderr, "X400MsgGetStrParam failed %s\n",
2683 X400mtError (status));
2684 }
2685 break;
2686 }
2687
2688 case X400_T_MM:
2689 {
2690 /* Fetch a forwarded bodypart */
2691 char buffer[BUFSIZ];
2692 struct X400Message *MM_fwd = NULL;
2693 size_t length = 0;
2694
2695 status = X400mtMsgGetMessageBody(mp,i,&MM_fwd);
2696 if (status != X400_E_NOERROR) {
2697 fprintf(stderr, "X400mtMsgGetBodypart failed %s\n",
2698 X400mtError (status));
2699 free (buf);
2700 return status;
2701 }
2702
2704 buffer, sizeof buffer , &length);
2705
2706 if (status == X400_E_NOERROR) {
2707 printf ("P772 MM bodypart Message Delivery Time: %.*s\n",
2708 (int)length, buffer);
2709 } else {
2710 fprintf(stderr, "X400MsgGetStrParam failed %s\n",
2711 X400mtError (status));
2712 }
2713
2714
2715 status = X400MsgGetStrParam (MM_fwd, X400_S_SUBJECT,
2716 buffer, sizeof buffer , &length);
2717 if ( status == X400_E_NOERROR ) {
2718 printf ("Subject: %.*s\n", (int)length, buffer);
2719 } else {
2720 fprintf(stderr, "X400MsgGetStrParam failed %s\n",
2721 X400mtError (status));
2722 }
2723 break;
2724 }
2725 case X400_T_ADATP3:
2726 {
2727 int parm_type;
2728
2729 status = X400BodypartGetIntParam(bp,
2730 X400_N_ADATP3_PARM, &parm_type);
2731 if (status == X400_E_NO_VALUE) {
2732 printf("No P772 ADatP3 parameters present\n");
2733 } else if (status != X400_E_NOERROR) {
2734 fprintf(stderr, "X400BodypartGetIntParam failed %s\n",
2735 X400mtError (status));
2736 free (buf);
2737 return status;
2738 }
2739
2740 printf("P772 ADatP3 Parm %d is %d\n",i,parm_type);
2741
2742 status = X400BodypartGetIntParam(bp,
2743 X400_N_ADATP3_CHOICE, &parm_type);
2744 if (status != X400_E_NOERROR) {
2745 fprintf(stderr, "X400BodypartGetIntParam failed %s\n",
2746 X400mtError (status));
2747 free (buf);
2748 return status;
2749 }
2750
2751 printf("P772 ADatP3 Choice %d is %d\n",i,parm_type);
2752
2753
2754 status = X400BodypartGetStrParam(bp,
2756 buf,
2757 buflen,
2758 &ret_len);
2759 if (status == X400_E_NOERROR)
2760 printf("P772 ADatP3 %i data: %.*s \n",
2761 i,(int)ret_len,buf);
2762 break;
2763 }
2764 case X400_T_CORRECTIONS:
2765 {
2766 int parm;
2767 char buffer [BUFSIZ];
2768 size_t length;
2769 status = X400BodypartGetIntParam(bp,
2771 &parm);
2772 if (status != X400_E_NOERROR) {
2773 fprintf(stderr, "X400BodypartGetIntParam failed %s\n",
2774 X400mtError (status));
2775 free (buf);
2776 return status;
2777 }
2778 printf("P772 Corrections Parm %d is %d\n",i,parm);
2779
2780 status = X400BodypartGetStrParam(bp,
2782 buffer,
2783 BUFSIZ,
2784 &length);
2785 if ( status == X400_E_NOERROR ) {
2786 printf("P772 Correction %i data: %.*s \n",i,(int)length,buffer);
2787 }
2788 break;
2789 }
2790
2791 case X400_T_ACP127DATA:
2792 {
2793 int parm;
2794 char buffer [BUFSIZ];
2795 size_t length;
2796 status = X400BodypartGetIntParam(bp,
2798 &parm);
2799 if (status != X400_E_NOERROR) {
2800 fprintf(stderr, "X400BodypartGetIntParam failed %s\n",
2801 X400mtError (status));
2802 free (buf);
2803 return status;
2804 }
2805 printf("P772 ACP127Data Parm %d is %d\n",i,parm);
2806
2807 status = X400BodypartGetStrParam(bp,
2809 buffer,
2810 BUFSIZ,
2811 &length);
2812 if ( status == X400_E_NOERROR ) {
2813 printf("P772 ACP127Data %i data: %.*s \n",i,(int)length,buffer);
2814 }
2815 break;
2816 }
2817
2818
2819 default:
2820 printf ("Skipping bodypart\n");
2821
2822 }
2823 }
2824 free (buf);
2825 return status;
2826}
2827
2828
2829
2830
2831static int do_orig_and_dl (
2832 struct X400mtMessage *mp
2833)
2834{
2835 char exp_time [BUFSIZ];
2836 char or_address [BUFSIZ];
2837 char dn_address [BUFSIZ];
2838
2839 size_t length;
2840 int n;
2841 int status;
2842
2843 struct X400ORandDL *orig_and_dl = NULL;
2844
2845 for ( n=1; ;n++ ) {
2846
2847 status = X400mtORandDLGet (mp,n,&orig_and_dl);
2848 if (status == X400_E_NO_VALUE) {
2849 printf("Finished getting originator and dl expansion history\n");
2850 return status;
2851 } else if (status != X400_E_NOERROR) {
2852 return status;
2853 }
2854
2855 status = X400ORandDLGetStrParam (orig_and_dl,
2857 exp_time, BUFSIZ,&length);
2858
2859 if ( status == X400_E_NOERROR ) {
2860 exp_time[length] = '\0';
2861 printf ("do_orig_and_dl: %i %s\n",n,exp_time);
2862 } else if(status != X400_E_MISSING_ATTR ) {
2863 fprintf (stderr, "Error in do_orig_and_dl: %s\n",
2864 X400mtError (status));
2865 }
2866
2867 status = X400ORandDLGetStrParam(orig_and_dl, X400_S_OR_ADDRESS,
2868 or_address, BUFSIZ , &length);
2869 if ( status == X400_E_NOERROR ) {
2870 or_address[length] = '\0';
2871 printf ("do_orig_and_dl OR address %i :%s\n",n,or_address);
2872 } else if(status != X400_E_MISSING_ATTR ) {
2873 fprintf (stderr, "Error in do_orig_and_dl: %s\n",
2874 X400mtError (status));
2875 }
2876
2877 status = X400ORandDLGetStrParam(orig_and_dl,
2879 dn_address, BUFSIZ , &length);
2880 if ( status == X400_E_NOERROR ) {
2881 dn_address[length] = '\0';
2882 printf ("originator and DL expansion DN %i :%s\n",n,dn_address);
2883 } else if(status != X400_E_MISSING_ATTR ) {
2884 fprintf (stderr, "Error in do_orig_and_dl: %s\n",
2885 X400mtError (status));
2886 }
2887
2888
2889 }
2890}
#define X400_N_CERT_ORADDRESS_STATUS
Definition x400_att.h:1561
#define X400_S_CERT_BER
Definition x400_att.h:1549
#define X400_S_CERT_ISSUER_DN
Definition x400_att.h:1555
#define X400_N_CERT_MSGTOK_CIC
Definition x400_att.h:1539
#define X400_N_CERT_MSGTOK
Definition x400_att.h:1533
#define X400_N_CERT_RECIP_CIC
Definition x400_att.h:1536
#define X400_S_CERT_SUBJECT_DN
Definition x400_att.h:1552
#define X400_S_CERT_SERIAL_NUM
Definition x400_att.h:1558
#define X400_N_MTA_SI_ROUTING_ACTION
Definition x400_att.h:1616
#define X400_S_MTA_SI_DEFERRED_TIME
Definition x400_att.h:1625
#define X400_MTA_SI_OTHER_ACTION_DLOPERATION
Definition x400_att.h:1652
#define X400_N_MTA_SI_OTHER_ACTIONS
Definition x400_att.h:1631
#define X400_S_MTA_NAME
Definition x400_att.h:1610
#define X400_MTA_SI_ROUTING_ACTION_RELAYED
Definition x400_att.h:1643
#define X400_MTA_SI_OTHER_ACTION_REDIRECTED
Definition x400_att.h:1649
#define X400_S_MTA_SI_ATTEMPTED_DOMAIN
Definition x400_att.h:1622
#define X400_MTA_SI_RA_MTA
Definition x400_att.h:1637
#define X400_N_MTA_SI_ATTEMPTED_ACTION
Definition x400_att.h:1634
#define X400_S_MTA_SI_ATTEMPTED_MTA
Definition x400_att.h:1619
#define X400_S_MTA_SI_CEIT
Definition x400_att.h:1628
#define X400_S_MTA_SI_TIME
Definition x400_att.h:1613
#define X400_N_ALI_REPLY_REQUEST
Definition x400_att.h:1669
#define X400_N_ALI_TYPE
Definition x400_att.h:1663
#define X400_N_ALI_NOTIFICATION_REQUEST
Definition x400_att.h:1666
#define X400_S_ACP127_NOTI_RESP_TIME
Definition x400_att.h:1697
#define X400_S_ACP127_NOTI_RESP_RECIPIENT
Definition x400_att.h:1703
#define X400_S_ACP127_NOTI_RESP_SUPP_INFO
Definition x400_att.h:1706
#define X400_ACP127_NOTI_TYPE_POS
Definition x400_att.h:1682
#define X400_ACP127_NOTI_TYPE_NEG
Definition x400_att.h:1679
#define X400_ACP127_NOTI_TYPE_TRANS
Definition x400_att.h:1685
#define X400_S_RECIP_CIC
Definition x400_att.h:1504
#define X400_N_RECIP_CIC_STATUS
Definition x400_att.h:1501
X400COMMON_CDECL int X400TraceInfoGetIntParam(struct X400TraceInfo *info, int paramtype, int *valuep)
Get int parameter from Trace Information object.
X400COMMON_CDECL int X400InternalTraceInfoGetIntParam(struct X400InternalTraceInfo *info, int paramtype, int *valuep)
Get int parameter from Internal Trace Information object.
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 X400CertGetStrParam(struct X400Certificate *cp, int paramtype, char *buffer, size_t buflen, size_t *paramlenp)
Return a string-valued parameter from the certificate object.
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.
X400COMMON_CDECL int X400ACP127RespGetIntParam(struct X400ACP127Resp *resp, int *value)
Get integer parameter from the ACP127 Notification Response object.
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.
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.
X400COMMON_CDECL int X400OtherRecipGetIntParam(struct X400OtherRecip *otherrecip, int *value)
Get integer parameter from the Other Recipient Indicator object.
X400COMMON_CDECL const char * X400RediReason(int redirection_reason)
Return a human readable string based on a redirection reason.
X400COMMON_CDECL int X400RediHistGetIntParam(struct X400RediHist *info, int paramtype, int *valuep)
Get int parameter from Redirection History object.
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 X400OtherRecipGetStrParam(struct X400OtherRecip *otherrecip, char *buffer, size_t buflen, size_t *paramlenp)
Get string parameter from Other Recipient object.
X400COMMON_CDECL int X400ACP127RespGetALI(struct X400ACP127Resp *resp, struct X400ALI **ali, int entry)
Get an Address List Indicator object associated with the X400ACP127 object.
X400COMMON_CDECL int X400CertGetIntParam(struct X400Certificate *cp, int paramtype, int *valp)
Return a integer-valued parameter from the certificate object.
X400COMMON_CDECL int X400ALIGetIntParam(struct X400ALI *ALI, int paramtype, int *valuep)
Get int parameter from Address List Indicator 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.
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.
X400COMMON_CDECL int X400RediHistGet(struct X400Recipient *recip, int entry, struct X400RediHist **hist)
Get the Redirection History object from a recipient.
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.
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.
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 ...
X400COMMON_CDECL int X400TraceInfoGetStrParam(struct X400TraceInfo *info, int paramtype, char *buffer, size_t buflen, size_t *paramlenp)
Get string parameter from Trace Information object.
X400COMMON_CDECL int X400BodypartGetIntParam(struct X400Bodypart *bp, int paramtype, int *valp)
Return a integer-valued parameter from the body part 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.
int X400mtTraceInfoGet(struct X400mtMessage *mp, int entry, struct X400TraceInfo **info, int type)
Get a Trace Info object for a message object.
int X400mtSetStrDefault(struct X400mtSession *sp, int paramtype, const char *value, size_t length)
Set a default string parameter value in a session.
int X400mtMsgDelete(struct X400mtMessage *mp)
Delete message object.
const char * X400mtError(int error)
Return string for error code.
int X400mtMsgGetIntParam(struct X400mtMessage *mp, int paramtype, int *valp)
Return a integer-valued parameter from the message object.
int X400mtOtherRecipGet(struct X400mtMessage *mp, int entry, struct X400OtherRecip **otherrecip)
Get a new P772 Other Recipient object for a message object.
int X400mtInternalTraceInfoGet(struct X400mtMessage *mp, int entry, struct X400InternalTraceInfo **info)
Get an Internal Trace Info object for a message object.
int X400mtORandDLGet(struct X400mtMessage *msg, int entry, struct X400ORandDL **or_and_dl)
Get Originator and DL expansion history object.
int X400mtSetIntDefault(struct X400mtSession *sp, int paramtype, int value)
Set a default integer parameter value in a session.
int X400mtALIGet(struct X400mtMessage *mp, int entry, struct X400ALI **ali)
Get a new Address List Indicator object for a message object.
int X400mtDLExpHistGet(struct X400mtMessage *mp, int entry, struct X400DLExpHist **hist)
Create a new DL Expansion History object from the message object.
int X400mtRecipGetIntParam(struct X400Recipient *rp, int paramtype, int *valp)
Return a integer-valued parameter from the recipient object.
int X400mtRecipGetStrParam(struct X400Recipient *rp, int paramtype, char *buffer, size_t buflen, size_t *paramlenp)
Return a string-valued parameter from the recipient object.
int X400mtPSSGet(struct X400mtMessage *mp, int type, int entry, struct X400PSS **pss)
Get a new Printable String Syntax object for a message object.
int X400mtRecipGet(struct X400mtMessage *mp, int type, int number, struct X400Recipient **rpp)
Get recipient object from message.
int X400mtMsgGetMessageBody(struct X400mtMessage *mp, int number, struct X400Message **mpp)
Return a pointer to a body part object.
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 X400mtRediHistGetEnv(struct X400mtMessage *msg, int entry, struct X400RediHist **hist)
Get the Redirection History object from a message envelope this is represented by 8....
int X400mtClose(struct X400mtSession *sp)
Close a X400 Session.
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 X400mtMsgGetBodypart(struct X400mtMessage *mp, int number, int *typep, struct X400Bodypart **bpp)
Return a pointer to a body part object.
#define X400_S_DIRECTORY_NAME
Definition x400_att.h:397
#define X400_S_OR_ADDRESS
Definition x400_att.h:349
#define X400_S_MESSAGE_INSTRUCTIONS
Definition x400_att.h:903
#define X400_N_SENSITIVITY
Definition x400_att.h:772
#define X400_S_DIST_CODES_EXT_VALUE
Definition x400_att.h:923
#define X400_S_ORIG_CERT
Definition x400_att.h:1001
#define X400_S_PILOT_FWD_INFO
Definition x400_att.h:929
#define X400_S_CORREC_DATA
Definition x400_att.h:962
#define X400_S_EXT_MSG_IDENTIFIER
Definition x400_att.h:1007
#define X400_N_EXT_PRIM_PREC
Definition x400_att.h:890
#define X400_N_EXT_CODRESS
Definition x400_att.h:884
#define X400_S_RELATED_IPMS
Definition x400_att.h:760
#define X400_S_ORIGINATORS_REFERENCE
Definition x400_att.h:785
#define X400_T_MESSAGE
Definition x400_att.h:854
#define X400_S_ADATP3_DATA
Definition x400_att.h:950
#define X400_T_ADATP3
Definition x400_att.h:953
#define X400_S_EXT_AUTH_INFO
Definition x400_att.h:881
#define X400_N_ADATP3_PARM
Definition x400_att.h:944
#define X400_S_DIST_CODES_SIC
Definition x400_att.h:914
#define X400_N_ACP127DATA_PARM
Definition x400_att.h:968
#define X400_S_DIST_CODES_EXT_OID
Definition x400_att.h:920
#define X400_S_ACP127_DATA
Definition x400_att.h:971
#define X400_S_INFO_SEC_LABEL
Definition x400_att.h:941
#define X400_T_FWD_CONTENT
Definition x400_att.h:992
#define X400_S_ORIG_OR_EXAP_TIME
Definition x400_att.h:995
#define X400_S_AUTHORIZATION_TIME
Definition x400_att.h:782
#define X400_N_IMPORTANCE
Definition x400_att.h:769
#define X400_S_HANDLING_INSTRUCTIONS
Definition x400_att.h:899
#define X400_S_IPM_IDENTIFIER
Definition x400_att.h:728
#define X400_S_SUBJECT
Definition x400_att.h:749
#define X400_S_ORIG_REF
Definition x400_att.h:908
#define X400_T_GENERAL_TEXT
Definition x400_att.h:867
#define X400_T_CORRECTIONS
Definition x400_att.h:956
#define X400_N_EXT_MSG_TYPE
Definition x400_att.h:887
#define X400_N_EXT_COPY_PREC
Definition x400_att.h:893
#define X400_S_ENCRYPTED_DATA_BYTES_ONLY
Definition x400_att.h:1010
#define X400_S_REPLIED_TO_IDENTIFIER
Definition x400_att.h:752
#define X400_S_EXPIRY_TIME
Definition x400_att.h:763
#define X400_N_ACP127_NOTI_TYPE
Definition x400_att.h:938
#define X400_S_CONTENT_FILENAME
Definition x400_att.h:798
#define X400_T_BINARY
Definition x400_att.h:851
#define X400_T_MM
Definition x400_att.h:974
#define X400_S_FWD_CONTENT_STRING
Definition x400_att.h:986
#define X400_N_ADATP3_CHOICE
Definition x400_att.h:947
#define X400_N_CORREC_PARM
Definition x400_att.h:959
#define X400_T_IA5TEXT
Definition x400_att.h:825
#define X400_S_OBSOLETED_IPMS
Definition x400_att.h:756
#define X400_T_ISO8859_2
Definition x400_att.h:843
#define X400_S_ORIG_PLAD
Definition x400_att.h:911
#define X400_N_NUM_ATTACHMENTS
Definition x400_att.h:822
#define X400_T_FWDENC
Definition x400_att.h:977
#define X400_T_ACP127DATA
Definition x400_att.h:965
#define X400_T_ISO8859_1
Definition x400_att.h:835
#define X400_T_FTBP
Definition x400_att.h:860
#define X400_N_AUTOFORWARDED
Definition x400_att.h:775
#define X400_S_REPLY_TIME
Definition x400_att.h:766
#define X400_S_ACP127_MSG_ID
Definition x400_att.h:932
#define X400_ADATP3_SEP
Definition x400_att.h:1137
#define X400_S_CONTENT_FILE_PATH
Definition x400_att.h:1102
#define X400_S_LOG_CONFIGURATION_FILE
Definition x400_att.h:1116
#define X400_N_OR_CANONICAL
Definition x400_att.h:1160
#define X400_N_PRIORITY
Definition x400_att.h:433
#define X400_S_MESSAGE_DELIVERY_TIME
Definition x400_att.h:451
#define X400_N_DL_EXPANSION_PROHIBITED
Definition x400_att.h:467
#define X400_N_RECIPIENT_REASSIGNMENT_PROHIBITED
Definition x400_att.h:464
#define X400_S_DSI_ATTEMPTED_DOMAIN
Definition x400_att.h:499
#define X400_S_DLEXP_TIME
Definition x400_att.h:488
#define X400_S_CONTENT_CORRELATOR_IA5_STRING
Definition x400_att.h:526
#define X400_S_DSI_ARRIVAL_TIME
Definition x400_att.h:493
#define X400_N_REDIRECTION_REASON
Definition x400_att.h:517
#define X400_S_CONTENT_CORRELATOR_OCTET_STRING
Definition x400_att.h:529
#define X400_S_CONTENT_IDENTIFIER
Definition x400_att.h:425
#define X400_S_LATEST_DELIVERY_TIME
Definition x400_att.h:473
#define X400_N_IMPLICIT_CONVERSION_PROHIBITED
Definition x400_att.h:439
#define X400_N_DSI_ROUTING_ACTION
Definition x400_att.h:496
#define X400_S_DSI_AA_DEF_TIME
Definition x400_att.h:502
#define X400_S_ORIGINATOR_RETURN_ADDRESS
Definition x400_att.h:476
#define X400_N_CONTENT_TYPE
Definition x400_att.h:419
#define X400_N_CONVERSION_WITH_LOSS_PROHIBITED
Definition x400_att.h:470
#define X400_S_CONTENT_CORRELATOR
Definition x400_att.h:514
#define X400_S_DSI_AA_CEIT
Definition x400_att.h:505
#define X400_S_ORIGINAL_ENCODED_INFORMATION_TYPES
Definition x400_att.h:428
#define X400_S_REDIRECTION_TIME
Definition x400_att.h:520
#define X400_N_CONTENT_RETURN_REQUEST
Definition x400_att.h:445
#define X400_S_MESSAGE_SUBMISSION_TIME
Definition x400_att.h:448
#define X400_S_GLOBAL_DOMAIN_ID
Definition x400_att.h:490
#define X400_N_CONTENT_LENGTH
Definition x400_att.h:422
#define X400_N_DISCLOSURE
Definition x400_att.h:436
#define X400_N_ALTERNATE_RECIPIENT_ALLOWED
Definition x400_att.h:442
#define X400_S_EXTERNAL_CONTENT_TYPE
Definition x400_att.h:456
#define X400_N_DSI_AA_DLOPERATION
Definition x400_att.h:511
#define X400_N_DSI_AA_REDIRECTED
Definition x400_att.h:508
#define X400_S_MESSAGE_IDENTIFIER
Definition x400_att.h:416
#define X400_TRACE_INFO
Definition x400_att.h:1373
#define X400_S_SECURITY_LABEL
Definition x400_att.h:1370
#define X400_E_MISSING_ATTR
Definition x400_att.h:88
#define X400_E_NO_MESSAGE
Definition x400_att.h:103
#define X400_E_NOMEMORY
Definition x400_att.h:52
#define X400_E_NOERROR
Definition x400_att.h:46
#define X400_E_NO_VALUE
Definition x400_att.h:100
#define X400_E_INVALID_ATTR
Definition x400_att.h:94
#define X400_E_MESSAGE_BODY
Definition x400_att.h:169
#define X400_E_ADDRESS_ERROR
Definition x400_att.h:118
#define X400_E_NO_RECIP
Definition x400_att.h:109
#define X400_MSG_REPORT
Definition x400_att.h:32
#define X400_MSG_PROBE
Definition x400_att.h:35
#define X400_MSG_MESSAGE
Definition x400_att.h:29
#define X400_N_REPORT_REQUEST
Definition x400_att.h:680
#define X400_N_NOTIFICATION_REQUEST
Definition x400_att.h:702
#define X400_S_ORIGINATOR_REQUESTED_ALTERNATE_RECIPIENT
Definition x400_att.h:688
#define X400_N_REPLY_REQUESTED
Definition x400_att.h:709
#define X400_S_ORIGINATOR_REQUESTED_ALTERNATE_RECIPIENT_DN
Definition x400_att.h:692
#define X400_N_MTA_REPORT_REQUEST
Definition x400_att.h:672
#define X400_S_CONVERTED_ENCODED_INFORMATION_TYPES
Definition x400_att.h:720
#define X400_N_RESPONSIBILITY
Definition x400_att.h:669
#define X400_S_TELEPHONE_NUMBER
Definition x400_att.h:699
#define X400_S_FREE_FORM_NAME
Definition x400_att.h:696
#define X400_RECIP_PRIMARY
Definition x400_att.h:296
#define X400_REPORTING_DL_NAME
Definition x400_att.h:320
#define X400_RECIP_BCC
Definition x400_att.h:302
#define X400_RECIP_CC
Definition x400_att.h:299
#define X400_RECIP_ENVELOPE
Definition x400_att.h:335
#define X400_RECIP_REPLY
Definition x400_att.h:311
#define X400_DL_EXEMPTED_RECIP
Definition x400_att.h:323
#define X400_EXEMPTED_ADDRESS
Definition x400_att.h:332
#define X400_AUTH_ORIG
Definition x400_att.h:308
#define X400_RECIP_REPORT
Definition x400_att.h:314
#define X400_S_SUPPLEMENTARY_INFO
Definition x400_att.h:1067
#define X400_S_SUBJECT_IDENTIFIER
Definition x400_att.h:1064
#define X400_N_TYPE_OF_USER
Definition x400_att.h:1070
#define X400_N_NON_DELIVERY_REASON
Definition x400_att.h:1076
#define X400_S_ARRIVAL_TIME
Definition x400_att.h:1073
#define X400_N_NON_DELIVERY_DIAGNOSTIC
Definition x400_att.h:1079
#define X400_N_MSGTOK_SEQ_NUM
Definition x400_att.h:1469
#define X400_S_MSGTOK_DER
Definition x400_att.h:1466
#define X400_N_MSGTOK_STATUS
Definition x400_att.h:1463
#define X400_S_MSGTOK_SEC_LAB
Definition x400_att.h:1475
#define X400_S_MSGTOK_CIC
Definition x400_att.h:1490
#define X400_S_MOAC
Definition x400_att.h:591
#define X400_S_MSGTOK_RECIP
Definition x400_att.h:1472
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 X400mtOpen(p1, p2)
Definition x400_mtapi.h:999
int X400mtACP127RespGet(struct X400mtMessage *mp, struct X400ACP127Resp **respp)
Get the ACP127 Notification Response object from a message.

All rights reserved © 2002 - 2024 Isode Ltd.