
Messaging and Directory Server software used around the world in the
Government, Military, Aviation and Commercial sectors.
|
examples/x400_mtsend_rep.cThis is an example program which transfers a report into the MTA.
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065 #include <stdio.h>
00066 #include <stdlib.h>
00067
00068 #include <x400_mtapi.h>
00069 #include "example.h"
00070
00071
00072 static int send_report (
00073 int drtype
00074 );
00075 static int add_recips_positive(
00076 struct X400mtMessage *mp
00077 );
00078 static int add_recips_negative(
00079 struct X400mtMessage *mp
00080 );
00081 static int build_env(
00082 struct X400mtMessage *mp
00083 );
00084 static int add_env_recip_info(
00085 struct X400Recipient *rp
00086 );
00087 static void usage(void);
00088
00089 static int rno = 1;
00090
00091 static int do_redi_hist(
00092 struct X400Recipient *rp
00093 );
00094
00095 static int do_redi_hist_env(
00096 struct X400mtMessage *msg
00097 );
00098
00099 static void do_origandl(
00100 struct X400mtMessage *msg
00101 );
00102
00103 static int add_reporting_dl_name(
00104 struct X400mtMessage *mp
00105 );
00106
00107
00108
00109
00110
00111
00112 #define HOSTNAME "dhcp-164"
00113
00114 static char *optstr = "uo:O:r:g:G:c:l:R:y:C:iaqsAv";
00115
00116
00117 static const char orig_s[] = "/S=x400test-orig/OU="HOSTNAME"/O=GatewayMTA/PRMD=TestPRMD/ADMD=TestADMD/C=GB/";
00118 static const char *orig = orig_s;
00119
00120
00121 static const char recip_s[] = "/S=x400test-recip2/OU="HOSTNAME"/O=GatewayMTA/PRMD=TestPRMD/ADMD=TestADMD/C=GB/";
00122 static const char *recip = recip_s;
00123
00124
00125
00126 static int def_content_type = 2;
00127 static int def_bool = 0;
00128 static int def_priority = 2;
00129
00130
00131 static const char def_utc[] = "080924120000";
00132 static const char msg_id[] = "/PRMD=TestPRMD/ADMD=TestADMD/C=GB/;"HOSTNAME".2810401-030924.140212";
00133 static const char content_id[] = "030924.140212";
00134 static const char latest_del_time[] = "080927120000Z";
00135
00136
00137 static const int importance = 2;
00138 static const int sensitivity = 3;
00139 static const int autoforwarded = 1;
00140
00141
00142 static const char subject[] = "A Test Message";
00143 static const char text[] = "First line\r\nSecond line\r\n";
00144 static const char ipm_id[] = "1064400656.24922*";
00145 static const char ipm_rep_id[] = "1064400656.24923*";
00146 static const char ipm_obs_id[] = "1064400656.24924*";
00147 static const char ipm_rel_id[] = "1064400656.24925*";
00148 static const char orig_ref[] = "orig-ref-val";
00149
00153 int main(
00154 int argc,
00155 char **argv
00156 )
00157 {
00158 int drtype;
00159
00160 orig = strdup(x400_default_gw_originator);
00161 recip = strdup(x400_default_gw_recipient);
00162
00163 if (get_args(argc, argv, optstr)) {
00164 usage();
00165 exit(-1);
00166 }
00167
00168 if (x400_channel == NULL) {
00169 printf("You must specify an X.400 channel\n");
00170 usage();
00171 exit(-1);
00172 }
00173
00174 printf("Delivery Report type (0 = Positive, 1 = Negative): ");
00175 drtype = ic_fgetc(x400_contype, stdin);
00176 if ((drtype != '0') && (drtype != '1'))
00177 exit(1);
00178
00179 drtype -= '0';
00180
00181 return send_report(drtype);
00182 }
00183
00184 static int send_report (
00185 int drtype
00186 )
00187 {
00188 int status;
00189 struct X400mtSession *sp;
00190 struct X400mtMessage *mp;
00191
00192 if (x400_channel == NULL) {
00193 fprintf (stderr, "No x400_channel value set in x400tailor file");
00194 exit(1);
00195 }
00196
00197
00198 status = X400mtOpen (x400_channel, &sp);
00199 if ( status != X400_E_NOERROR ) {
00200 fprintf (stderr, "Error in Open: %s\n", X400mtError (status));
00201 exit (status);
00202 }
00203
00204
00205 status = X400mtMsgNew (sp, X400_MSG_REPORT, &mp);
00206
00207 if ( status != X400_E_NOERROR ) exit (status);
00208
00209
00210 status = X400mtMsgAddStrParam (mp, X400_S_OR_ADDRESS, orig, -1);
00211 if ( status != X400_E_NOERROR ) exit (status);
00212
00213
00214 status = add_reporting_dl_name(mp);
00215 if ( status != X400_E_NOERROR ) exit (status);
00216
00217
00218 if (drtype == 0)
00219 status = add_recips_positive(mp);
00220 else
00221 status = add_recips_negative(mp);
00222 if ( status != X400_E_NOERROR ) exit (status);
00223
00224 #define ADD_TRACE_INFO 1
00225 #ifdef ADD_TRACE_INFO
00226 {
00227 struct X400TraceInfo *info1;
00228
00229 int status;
00230
00231 status = X400mtTraceInfoNew(mp,&info1,X400_SUBJECT_TRACE_INFO);
00232 if (status !=X400_E_NOERROR) {
00233 fprintf(stderr,"Failed to allocate new trace info object \n");
00234 exit(status);
00235 }
00236
00237
00238 status = X400TraceInfoAddStrParam (info1,
00239 X400_S_GLOBAL_DOMAIN_ID,
00240 "/PRMD=wibble/ADMD=TestADMD/C=GB/",
00241 -1);
00242 if (status !=X400_E_NOERROR) {
00243 fprintf(stderr,
00244 "Failed to add X400_S_GLOBAL_DOMAIN_ID to trace info\n");
00245 exit(status);
00246 }
00247
00248 status = X400TraceInfoAddStrParam (info1,
00249 X400_S_DSI_ARRIVAL_TIME,
00250 "071121125704Z",
00251 -1);
00252 if (status !=X400_E_NOERROR) {
00253 fprintf(stderr,
00254 "Failed to add X400_S_DSI_ARRIVAL_TIME to trace info\n");
00255 exit(status);
00256 }
00257
00258
00259 status = X400TraceInfoAddStrParam (info1,
00260 X400_S_DSI_ATTEMPTED_DOMAIN,
00261 "/PRMD=atmpdom/ADMD=TestADMD/C=GB/",
00262 -1);
00263 if (status !=X400_E_NOERROR) {
00264 fprintf(stderr,
00265 "Failed to add X400_S_DSI_ATTEMPTED_DOMAIN to trace info\n");
00266 exit(status);
00267 }
00268
00269
00270
00271 status = X400TraceInfoAddStrParam (info1,
00272 X400_S_DSI_AA_DEF_TIME,
00273 "071122125704Z",
00274 -1);
00275 if (status !=X400_E_NOERROR) {
00276 fprintf(stderr,
00277 "Failed to add X400_S_DSI_AA_DEF_TIME to trace info\n");
00278 exit(status);
00279 }
00280 }
00281 #endif
00282
00283
00284
00285
00286 status = build_env(mp);
00287 if ( status != X400_E_NOERROR ) exit (status);
00288
00289
00290
00291 status = X400mtMsgSend (mp);
00292 if ( status != X400_E_NOERROR ) {
00293 fprintf (stderr, "Error in MsgSend: %s\n", X400mtError (status));
00294 exit (status);
00295 }
00296
00297
00298 status = X400mtMsgDelete (mp);
00299 if ( status != X400_E_NOERROR ) exit (status);
00300
00301 mp = NULL;
00302
00303
00304 return X400mtClose (sp);
00305 }
00306
00307 static int add_recips_positive(
00308 struct X400mtMessage *mp
00309 )
00310 {
00311 struct X400Recipient *rp;
00312 int status;
00313
00314
00315 status = X400mtRecipNew (mp, X400_RECIP_ENVELOPE, &rp);
00316 if ( status != X400_E_NOERROR ) return (status);
00317
00318 status = X400mtRecipAddStrParam (rp, X400_S_OR_ADDRESS, recip, -1);
00319 if ( status != X400_E_NOERROR ) return (status);
00320
00321 status = add_env_recip_info (rp);
00322 if ( status != X400_E_NOERROR ) return (status);
00323
00324
00325 status = X400mtRecipNew (mp, X400_RECIP_REPORT, &rp);
00326 if ( status != X400_E_NOERROR ) return (status);
00327
00328 status = X400mtRecipAddStrParam (rp, X400_S_OR_ADDRESS, recip, -1);
00329 if ( status != X400_E_NOERROR ) return (status);
00330
00331 status = add_env_recip_info (rp);
00332 if ( status != X400_E_NOERROR ) return (status);
00333
00334
00335 status = X400mtRecipAddStrParam (rp, X400_S_ARRIVAL_TIME, "070701140026+0100", -1);
00336 if ( status != X400_E_NOERROR ) {
00337 fprintf (stderr, "X400mtMsgAddStrParam returned error: %s\n", X400mtError (status));
00338 return (status);
00339 }
00340
00341
00342 status = X400mtRecipAddStrParam (rp, X400_S_MESSAGE_DELIVERY_TIME, "040701140026+0100", -1);
00343 if ( status != X400_E_NOERROR ) {
00344 fprintf (stderr, "X400mtMsgAddStrParam returned error: %s\n", X400mtError (status));
00345 return (status);
00346 }
00347
00348
00349 status = X400mtRecipAddStrParam (rp,X400_S_CONVERTED_ENCODED_INFORMATION_TYPES, "ia5-text", -1);
00350 if ( status != X400_E_NOERROR ) {
00351 fprintf (stderr, "X400mtMsgAddStrParam returned error: %s\n", X400mtError (status));
00352 return (status);
00353 }
00354 #define USE_REDIRECTION_HISTORY 1
00355 #ifdef USE_REDIRECTION_HISTORY
00356
00357 do_redi_hist(rp);
00358
00359
00360 #endif
00361
00362 return X400_E_NOERROR;
00363 }
00364
00365
00366 static int add_recips_negative(
00367 struct X400mtMessage *mp
00368 )
00369 {
00370 struct X400Recipient *rp;
00371 int status;
00372
00373
00374 status = X400mtRecipNew (mp, X400_RECIP_ENVELOPE, &rp);
00375 if ( status != X400_E_NOERROR ) return (status);
00376
00377 status = X400mtRecipAddStrParam (rp, X400_S_OR_ADDRESS, recip, -1);
00378 if ( status != X400_E_NOERROR ) return (status);
00379
00380 status = add_env_recip_info (rp);
00381 if ( status != X400_E_NOERROR ) return (status);
00382
00383
00384 status = X400mtRecipNew (mp, X400_RECIP_REPORT, &rp);
00385 if ( status != X400_E_NOERROR ) return (status);
00386
00387 status = X400mtRecipAddStrParam (rp, X400_S_OR_ADDRESS, recip, -1);
00388 if ( status != X400_E_NOERROR ) return (status);
00389
00390 status = add_env_recip_info (rp);
00391 if ( status != X400_E_NOERROR ) return (status);
00392
00393
00394 status = X400mtRecipAddStrParam (rp, X400_S_ARRIVAL_TIME, "070701140026+0100", -1);
00395 if ( status != X400_E_NOERROR ) {
00396 fprintf (stderr, "X400mtMsgAddStrParam returned error: %s\n", X400mtError (status));
00397 return (status);
00398 }
00399
00400
00401 status = X400mtRecipAddStrParam (rp, X400_S_SUPPLEMENTARY_INFO, "Couldn't delivery message", -1);
00402 if ( status != X400_E_NOERROR ) {
00403 fprintf (stderr, "X400mtMsgAddStrParam returned error: %s\n", X400mtError (status));
00404 return (status);
00405 }
00406
00407
00408 status = X400mtRecipAddIntParam (rp, X400_N_NON_DELIVERY_REASON, 1);
00409 if ( status != X400_E_NOERROR ) {
00410 fprintf (stderr, "X400mtMsgAddIntParam returned error: %s\n", X400mtError (status));
00411 return (status);
00412 }
00413
00414
00415 status = X400mtRecipAddIntParam (rp, X400_N_NON_DELIVERY_DIAGNOSTIC, 2);
00416 if ( status != X400_E_NOERROR ) {
00417 fprintf (stderr, "X400mtMsgAddIntParam returned error: %s\n", X400mtError (status));
00418 return (status);
00419 }
00420
00421 return X400_E_NOERROR;
00422 }
00423
00424 static int build_env(
00425 struct X400mtMessage *mp
00426 )
00427 {
00428 int status;
00429
00430
00431
00432
00433 status = X400mtMsgAddIntParam (mp, X400_N_CONTENT_TYPE, def_content_type);
00434 if ( status != X400_E_NOERROR ) return (status);
00435
00436
00437
00438
00439 status = X400mtMsgAddIntParam (mp, X400_N_PRIORITY, def_priority);
00440 if ( status != X400_E_NOERROR ) return (status);
00441
00442
00443 status = X400mtMsgAddIntParam (mp, X400_N_DISCLOSURE, 1);
00444 if ( status != X400_E_NOERROR ) return (status);
00445
00446
00447 status = X400mtMsgAddIntParam (mp, X400_N_IMPLICIT_CONVERSION_PROHIBITED, def_bool);
00448 if ( status != X400_E_NOERROR ) return (status);
00449
00450
00451 status = X400mtMsgAddIntParam (mp, X400_N_ALTERNATE_RECIPIENT_ALLOWED, def_bool);
00452 if ( status != X400_E_NOERROR ) return (status);
00453
00454
00455
00456 status = X400mtMsgAddIntParam (mp, X400_N_CONTENT_RETURN_REQUEST, 1);
00457 if ( status != X400_E_NOERROR ) return (status);
00458
00459
00460 status = X400mtMsgAddIntParam (mp, X400_N_RECIPIENT_REASSIGNMENT_PROHIBITED, def_bool);
00461 if ( status != X400_E_NOERROR ) return (status);
00462
00463
00464 status = X400mtMsgAddIntParam (mp, X400_N_DL_EXPANSION_PROHIBITED, def_bool);
00465 if ( status != X400_E_NOERROR ) return (status);
00466
00467
00468 status = X400mtMsgAddIntParam (mp, X400_N_CONVERSION_WITH_LOSS_PROHIBITED, def_bool);
00469 if ( status != X400_E_NOERROR ) return (status);
00470
00471
00472
00473
00474 status = X400mtMsgAddStrParam (mp, X400_S_MESSAGE_IDENTIFIER, msg_id, -1);
00475 if ( status != X400_E_NOERROR ) return (status);
00476
00477
00478 status = X400mtMsgAddStrParam (mp, X400_S_CONTENT_IDENTIFIER, content_id, -1);
00479 if ( status != X400_E_NOERROR ) return (status);
00480
00481
00482 status = X400mtMsgAddStrParam (mp, X400_S_SUBJECT_IDENTIFIER, msg_id, -1);
00483 if ( status != X400_E_NOERROR ) return (status);
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493 status = X400mtMsgAddStrParam (mp, X400_S_LATEST_DELIVERY_TIME, latest_del_time, -1);
00494 if ( status != X400_E_NOERROR ) return (status);
00495
00496
00497 #ifdef USE_REDIRECTION_HISTORY
00498
00499 do_redi_hist_env(mp);
00500 #endif
00501
00502 do_origandl(mp);
00503
00504
00505 return X400_E_NOERROR;
00506 }
00507
00508
00509 static int add_env_recip_info(
00510 struct X400Recipient *rp
00511 )
00512 {
00513 int status;
00514
00515
00516 status = X400mtRecipAddIntParam (rp, X400_N_RESPONSIBILITY, 1);
00517 if ( status != X400_E_NOERROR ) return (status);
00518
00519 status = X400mtRecipAddIntParam (rp, X400_N_MTA_REPORT_REQUEST, 3);
00520 if ( status != X400_E_NOERROR ) return (status);
00521
00522 status = X400mtRecipAddIntParam (rp, X400_N_REPORT_REQUEST, 2);
00523 if ( status != X400_E_NOERROR ) return (status);
00524
00525 status = X400mtRecipAddIntParam (rp, X400_N_ORIGINAL_RECIPIENT_NUMBER, rno);
00526 rno++;
00527 if ( status != X400_E_NOERROR ) return (status);
00528
00529 return X400_E_NOERROR;
00530 }
00531
00532
00533 static void usage(void) {
00534 printf("usage: %s\n", optstr);
00535 printf("\t where:\n");
00536 printf("\t -u : Don't prompt to override defaults \n");
00537 printf("\t -o : Originator \n");
00538 printf("\t -O : Originator Return Address \n");
00539 printf("\t -r : Recipient\n");
00540 printf("\t -c : X.400 passive channel\n");
00541 printf("\t -l : Logline\n");
00542 printf("\t -R : Reports (0 - never, 1 - always, 2 - always NDR \n");
00543 printf("\t -y : Priority (0 - normal, 1 - non-urgent, 2 - urgent \n");
00544 printf("\t -C : Content Type (2/22/772/OID) \n");
00545 printf("\t -i : Implicit conversion prohibited = TRUE \n");
00546 printf("\t -a : Alternate Recipient Prohibited = TRUE \n");
00547 printf("\t -q : Content Return Request = TRUE \n");
00548 printf("\t -s : Disclosure of Recipient = FALSE \n");
00549 printf("\t -A : Recipient Reassignment Prohibited = FALSE \n");
00550 printf("\t -v : Conversion with Loss Prohibited = FALSE \n");
00551 return;
00552 }
00553
00554
00555 static int do_redi_hist(
00556 struct X400Recipient *rp
00557 )
00558 {
00559 struct X400RediHist *hist1;
00560 struct X400RediHist *hist2;
00561 int status;
00562
00563 status = X400RediHistNew(rp,&hist1);
00564 if (status !=X400_E_NOERROR) {
00565 fprintf(stderr,"Failed to allocate new trace info object \n");
00566 exit(status);
00567 }
00568
00569
00570 status = X400RediHistAddStrParam (hist1,
00571 X400_S_REDIRECTION_TIME,
00572 "071121125704Z",
00573 -1);
00574 if (status !=X400_E_NOERROR) {
00575 fprintf(stderr,
00576 "Failed to add X400_S_REDIRECTION_TIME to Redirection Hist\n");
00577 exit(status);
00578 }
00579
00580 status = X400RediHistAddStrParam (hist1,
00581 X400_S_OR_ADDRESS,
00582 "/cn=redihist/prmd=TestPRMD/admd=TestPRMD/C=gb",
00583 -1);
00584 if (status !=X400_E_NOERROR) {
00585 fprintf(stderr,
00586 "Failed to add X400_S_OR_ADDRESS to Redirection Hist\n");
00587 exit(status);
00588 }
00589
00590 status = X400RediHistAddStrParam (hist1,
00591 X400_S_DIRECTORY_NAME,
00592 "CN=redihist,c=GB",
00593 -1);
00594 if (status !=X400_E_NOERROR) {
00595 fprintf(stderr,
00596 "Failed to add X400_S_DIRECTORY_NAME to Redirection Hist\n");
00597 exit(status);
00598 }
00599
00600
00601 status = X400RediHistAddIntParam(hist1,
00602 X400_N_REDIRECTION_REASON,
00603 X400_RR_ALIAS);
00604 if (status !=X400_E_NOERROR) {
00605 fprintf(stderr,
00606 "Failed to add X400_N_REDIRECTION_REASON to trace info\n");
00607 exit(status);
00608 }
00609
00610
00611
00612 status = X400RediHistNew(rp,&hist2);
00613 if (status !=X400_E_NOERROR) {
00614 fprintf(stderr,"Failed to allocate new trace info object \n");
00615 exit(status);
00616 }
00617
00618
00619 status = X400RediHistAddStrParam (hist2,
00620 X400_S_REDIRECTION_TIME,
00621 "071121125714Z",
00622 -1);
00623 if (status !=X400_E_NOERROR) {
00624 fprintf(stderr,
00625 "Failed to add X400_S_REDIRECTION_TIME to Redirection Hist\n");
00626 exit(status);
00627 }
00628
00629 status = X400RediHistAddStrParam (hist2,
00630 X400_S_OR_ADDRESS,
00631 "/cn=redihist2/prmd=TestPRMD/admd=TestPRMD/C=gb",
00632 -1);
00633 if (status !=X400_E_NOERROR) {
00634 fprintf(stderr,
00635 "Failed to add X400_S_OR_ADDRESS to Redirection Hist\n");
00636 exit(status);
00637 }
00638
00639 status = X400RediHistAddStrParam (hist2,
00640 X400_S_DIRECTORY_NAME,
00641 "CN=redihist2,c=GB",
00642 -1);
00643 if (status !=X400_E_NOERROR) {
00644 fprintf(stderr,
00645 "Failed to add X400_S_DIRECTORY_NAME to Redirection Hist\n");
00646 exit(status);
00647 }
00648
00649
00650 status = X400RediHistAddIntParam(hist2,
00651 X400_N_REDIRECTION_REASON,
00652 X400_RR_RECIP_ASSIGNED_ALT_RECIP);
00653 if (status !=X400_E_NOERROR) {
00654 fprintf(stderr,
00655 "Failed to add X400_N_REDIRECTION_REASON to "
00656 "Redirection Hist\n");
00657 exit(status);
00658 }
00659 return X400_E_NOERROR;
00660 }
00661
00662 static int do_redi_hist_env(
00663 struct X400mtMessage *msg
00664 )
00665 {
00666 struct X400RediHist *hist1;
00667 struct X400RediHist *hist2;
00668 int status;
00669
00670 status = X400mtRediHistNewEnv(msg,&hist1);
00671 if (status !=X400_E_NOERROR) {
00672 fprintf(stderr,"Failed to allocate new trace info object \n");
00673 exit(status);
00674 }
00675
00676
00677 status = X400RediHistAddStrParam (hist1,
00678 X400_S_REDIRECTION_TIME,
00679 "071121125704Z",
00680 -1);
00681 if (status !=X400_E_NOERROR) {
00682 fprintf(stderr,
00683 "Failed to add X400_S_REDIRECTION_TIME to Redirection Hist\n");
00684 exit(status);
00685 }
00686
00687 status = X400RediHistAddStrParam (hist1,
00688 X400_S_OR_ADDRESS,
00689 "/cn=redihist/prmd=TestPRMD/admd=TestPRMD/C=gb",
00690 -1);
00691 if (status !=X400_E_NOERROR) {
00692 fprintf(stderr,
00693 "Failed to add X400_S_OR_ADDRESS to Redirection Hist\n");
00694 exit(status);
00695 }
00696
00697 status = X400RediHistAddStrParam (hist1,
00698 X400_S_DIRECTORY_NAME,
00699 "CN=redihist,c=GB",
00700 -1);
00701 if (status !=X400_E_NOERROR) {
00702 fprintf(stderr,
00703 "Failed to add X400_S_DIRECTORY_NAME to Redirection Hist\n");
00704 exit(status);
00705 }
00706
00707
00708 status = X400RediHistAddIntParam(hist1,
00709 X400_N_REDIRECTION_REASON,
00710 X400_RR_ALIAS);
00711 if (status !=X400_E_NOERROR) {
00712 fprintf(stderr,
00713 "Failed to add X400_N_REDIRECTION_REASON to trace info\n");
00714 exit(status);
00715 }
00716
00717
00718
00719 status = X400mtRediHistNewEnv(msg,&hist2);
00720 if (status !=X400_E_NOERROR) {
00721 fprintf(stderr,"Failed to allocate new trace info object \n");
00722 exit(status);
00723 }
00724
00725
00726 status = X400RediHistAddStrParam (hist2,
00727 X400_S_REDIRECTION_TIME,
00728 "071121125714Z",
00729 -1);
00730 if (status !=X400_E_NOERROR) {
00731 fprintf(stderr,
00732 "Failed to add X400_S_REDIRECTION_TIME to Redirection Hist\n");
00733 exit(status);
00734 }
00735
00736 status = X400RediHistAddStrParam (hist2,
00737 X400_S_OR_ADDRESS,
00738 "/cn=redihist2/prmd=TestPRMD/admd=TestPRMD/C=gb",
00739 -1);
00740 if (status !=X400_E_NOERROR) {
00741 fprintf(stderr,
00742 "Failed to add X400_S_OR_ADDRESS to Redirection Hist\n");
00743 exit(status);
00744 }
00745
00746 status = X400RediHistAddStrParam (hist2,
00747 X400_S_DIRECTORY_NAME,
00748 "CN=redihist2,c=GB",
00749 -1);
00750 if (status !=X400_E_NOERROR) {
00751 fprintf(stderr,
00752 "Failed to add X400_S_DIRECTORY_NAME to Redirection Hist\n");
00753 exit(status);
00754 }
00755
00756
00757 status = X400RediHistAddIntParam(hist2,
00758 X400_N_REDIRECTION_REASON,
00759 X400_RR_RECIP_ASSIGNED_ALT_RECIP);
00760 if (status !=X400_E_NOERROR) {
00761 fprintf(stderr,
00762 "Failed to add X400_N_REDIRECTION_REASON to "
00763 "Redirection Hist\n");
00764 exit(status);
00765 }
00766 return X400_E_NOERROR;
00767 }
00768
00769 static void do_origandl(
00770 struct X400mtMessage *msg
00771 )
00772 {
00773 struct X400ORandDL *or_and_dl1;
00774 struct X400ORandDL *or_and_dl2;
00775
00776 const char *origin_or_address = "/cn=origandlorig/prmd=TestPRMD/admd=TestPRMD/C=gb";
00777 const char *origin_dn_address = "CN=origandlorig,c=GB";
00778 int status;
00779
00780 status = X400mtORandDLNew(msg,&or_and_dl1);
00781 if (status !=X400_E_NOERROR) {
00782 fprintf(stderr,"Failed to allocate new OR Address and DL "
00783 "expansion object \n");
00784 exit(status);
00785 }
00786
00787
00788 status = X400ORandDLAddStrParam (or_and_dl1,
00789 X400_S_ORIG_OR_EXAP_TIME,
00790 "071121125704Z",
00791 -1);
00792 if (status != X400_E_NOERROR) {
00793 fprintf(stderr,
00794 "Failed to add X400_S_ORIG_OR_EXAP_TIME "
00795 "to X400ORandDL\n");
00796 exit(status);
00797 }
00798
00799
00800
00801
00802 status = X400ORandDLAddStrParam (or_and_dl1,
00803 X400_S_OR_ADDRESS,
00804 origin_or_address,
00805 -1);
00806 if (status != X400_E_NOERROR) {
00807 fprintf(stderr,
00808 "Failed to add X400_S_OR_ADDRESS "
00809 "to X400ORandDL\n");
00810 exit(status);
00811 }
00812
00813
00814 status = X400ORandDLAddStrParam (or_and_dl1,
00815 X400_S_DIRECTORY_NAME,
00816 origin_dn_address,
00817 -1);
00818 if (status != X400_E_NOERROR) {
00819 fprintf(stderr,
00820 "Failed to add X400_S_DIRECTORY_NAME "
00821 "to X400ORandDL\n");
00822 exit(status);
00823 }
00824 status = X400mtORandDLNew(msg,&or_and_dl2);
00825 if (status !=X400_E_NOERROR) {
00826 fprintf(stderr,"Failed to allocate new OR Address and DL "
00827 "expansion object \n");
00828 exit(status);
00829 }
00830
00831
00832 status = X400ORandDLAddStrParam (or_and_dl2,
00833 X400_S_ORIG_OR_EXAP_TIME,
00834 "091121125704Z",
00835 -1);
00836 if (status != X400_E_NOERROR) {
00837 fprintf(stderr,
00838 "Failed to add X400_S_ORIG_OR_EXAP_TIME "
00839 "to X400ORandDL\n");
00840 exit(status);
00841 }
00842
00843
00844
00845
00846 status = X400ORandDLAddStrParam (or_and_dl2,
00847 X400_S_OR_ADDRESS,
00848 origin_or_address,
00849 -1);
00850 if (status != X400_E_NOERROR) {
00851 fprintf(stderr,
00852 "Failed to add X400_S_OR_ADDRESS "
00853 "to X400ORandDL\n");
00854 exit(status);
00855 }
00856
00857
00858 status = X400ORandDLAddStrParam (or_and_dl2,
00859 X400_S_DIRECTORY_NAME,
00860 origin_dn_address,
00861 -1);
00862 if (status != X400_E_NOERROR) {
00863 fprintf(stderr,
00864 "Failed to add X400_S_DIRECTORY_NAME "
00865 "to X400ORandDL\n");
00866 exit(status);
00867 }
00868 }
00869
00870
00871 static int add_reporting_dl_name(
00872 struct X400mtMessage *mp
00873 )
00874 {
00875 int status;
00876 struct X400Recipient *rp = NULL;
00877
00878
00879 status = X400mtRecipNew (mp, X400_REPORTING_DL_NAME, &rp);
00880 if ( status != X400_E_NOERROR ) return (status);
00881
00882
00883 status = X400mtRecipAddStrParam (rp,
00884 X400_S_OR_ADDRESS,
00885 "cn=reportdlname/prmd=TestPRMD/admd=TestPRMD/C=gb",
00886 -1);
00887 if ( status != X400_E_NOERROR ) return (status);
00888
00889 status = X400mtRecipAddStrParam (rp,
00890 X400_S_DIRECTORY_NAME,
00891 "ou=reportingdlname,C=gb",
00892 -1);
00893 if ( status != X400_E_NOERROR ) return (status);
00894
00895
00896 return X400_E_NOERROR;
00897 }
|