4da0edfb3432036b6f28570091e2f1999c81e445
[yaz-moved-to-github.git] / z39.50 / zes-exps.c
1 /* YC 0.2 Tue Feb 29 16:45:07 CET 2000 */
2 /* Module-C: ESFormat-ExportSpecification */
3
4 #include <yaz/zes-exps.h>
5
6 int z_ESExportSpecificationEsRequest (ODR o, Z_ESExportSpecificationEsRequest **p, int opt, const char *name)
7 {
8         if (!odr_sequence_begin (o, p, sizeof(**p), name))
9                 return opt && odr_ok (o);
10         return
11                 odr_explicit_tag (o, z_ESOriginPartToKeep,
12                         &(*p)->toKeep, ODR_CONTEXT, 1, 0, "toKeep") &&
13                 odr_implicit_tag (o, odr_null,
14                         &(*p)->notToKeep, ODR_CONTEXT, 2, 0, "notToKeep") &&
15                 odr_sequence_end (o);
16 }
17
18 int z_ESExportSpecificationTaskPackage (ODR o, Z_ESExportSpecificationTaskPackage **p, int opt, const char *name)
19 {
20         if (!odr_sequence_begin (o, p, sizeof(**p), name))
21                 return opt && odr_ok (o);
22         return
23                 odr_explicit_tag (o, z_ESOriginPartToKeep,
24                         &(*p)->originPart, ODR_CONTEXT, 1, 0, "originPart") &&
25                 odr_implicit_tag (o, odr_null,
26                         &(*p)->targetPart, ODR_CONTEXT, 2, 0, "targetPart") &&
27                 odr_sequence_end (o);
28 }
29
30 int z_ESExportSpecification (ODR o, Z_ESExportSpecification **p, int opt, const char *name)
31 {
32         static Odr_arm arm[] = {
33                 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ESExportSpecification_esRequest,
34                 (Odr_fun) z_ESExportSpecificationEsRequest, "esRequest"},
35                 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ESExportSpecification_taskPackage,
36                 (Odr_fun) z_ESExportSpecificationTaskPackage, "taskPackage"},
37                 {-1, -1, -1, -1, (Odr_fun) 0, 0}
38         };
39         if (!odr_initmember(o, p, sizeof(**p)))
40                 return opt && odr_ok(o);
41         if (odr_choice(o, arm, &(*p)->u, &(*p)->which, name))
42                 return 1;
43         *p = 0;
44         return opt && odr_ok(o);
45 }
46
47 int z_ESOriginPartToKeep (ODR o, Z_ESOriginPartToKeep **p, int opt, const char *name)
48 {
49         if (!odr_sequence_begin (o, p, sizeof(**p), name))
50                 return opt && odr_ok (o);
51         return
52                 odr_implicit_tag (o, z_CompSpec,
53                         &(*p)->composition, ODR_CONTEXT, 1, 0, "composition") &&
54                 odr_explicit_tag (o, z_ESDestination,
55                         &(*p)->exportDestination, ODR_CONTEXT, 2, 0, "exportDestination") &&
56                 odr_sequence_end (o);
57 }
58
59 int z_ESDestinationOther (ODR o, Z_ESDestinationOther **p, int opt, const char *name)
60 {
61         if (!odr_sequence_begin (o, p, sizeof(**p), name))
62                 return opt && odr_ok (o);
63         return
64                 odr_implicit_tag (o, z_InternationalString,
65                         &(*p)->vehicle, ODR_CONTEXT, 1, 1, "vehicle") &&
66                 odr_implicit_tag (o, z_InternationalString,
67                         &(*p)->destination, ODR_CONTEXT, 2, 0, "destination") &&
68                 odr_sequence_end (o);
69 }
70
71 int z_ESDestination (ODR o, Z_ESDestination **p, int opt, const char *name)
72 {
73         static Odr_arm arm[] = {
74                 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ESDestination_phoneNumber,
75                 (Odr_fun) z_InternationalString, "phoneNumber"},
76                 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ESDestination_faxNumber,
77                 (Odr_fun) z_InternationalString, "faxNumber"},
78                 {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_ESDestination_x400address,
79                 (Odr_fun) z_InternationalString, "x400address"},
80                 {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_ESDestination_emailAddress,
81                 (Odr_fun) z_InternationalString, "emailAddress"},
82                 {ODR_IMPLICIT, ODR_CONTEXT, 5, Z_ESDestination_pagerNumber,
83                 (Odr_fun) z_InternationalString, "pagerNumber"},
84                 {ODR_IMPLICIT, ODR_CONTEXT, 6, Z_ESDestination_ftpAddress,
85                 (Odr_fun) z_InternationalString, "ftpAddress"},
86                 {ODR_IMPLICIT, ODR_CONTEXT, 7, Z_ESDestination_ftamAddress,
87                 (Odr_fun) z_InternationalString, "ftamAddress"},
88                 {ODR_IMPLICIT, ODR_CONTEXT, 8, Z_ESDestination_printerAddress,
89                 (Odr_fun) z_InternationalString, "printerAddress"},
90                 {ODR_IMPLICIT, ODR_CONTEXT, 100, Z_ESDestination_other,
91                 (Odr_fun) z_ESDestinationOther, "other"},
92                 {-1, -1, -1, -1, (Odr_fun) 0, 0}
93         };
94         if (!odr_initmember(o, p, sizeof(**p)))
95                 return opt && odr_ok(o);
96         if (odr_choice(o, arm, &(*p)->u, &(*p)->which, name))
97                 return 1;
98         *p = 0;
99         return opt && odr_ok(o);
100 }