YAZ  5.23.1
zes-order.c
Go to the documentation of this file.
1 
6 #if HAVE_CONFIG_H
7 #include <config.h>
8 #endif
9 
10 #include <yaz/zes-order.h>
11 
12 int z_IORequest(ODR o, Z_IORequest **p, int opt, const char *name)
13 {
14  if (!odr_sequence_begin(o, p, sizeof(**p), name))
15  return odr_missing(o, opt, name) && odr_ok (o);
16  return
18  &(*p)->toKeep, ODR_CONTEXT, 1, 1, "toKeep") &&
20  &(*p)->notToKeep, ODR_CONTEXT, 2, 0, "notToKeep") &&
22 }
23 
24 int z_IOTaskPackage(ODR o, Z_IOTaskPackage **p, int opt, const char *name)
25 {
26  if (!odr_sequence_begin(o, p, sizeof(**p), name))
27  return odr_missing(o, opt, name) && odr_ok (o);
28  return
30  &(*p)->originPart, ODR_CONTEXT, 1, 1, "originPart") &&
32  &(*p)->targetPart, ODR_CONTEXT, 2, 0, "targetPart") &&
34 }
35 
36 int z_IOItemOrder(ODR o, Z_IOItemOrder **p, int opt, const char *name)
37 {
38  static Odr_arm arm[] = {
40  (Odr_fun) z_IORequest, "esRequest"},
42  (Odr_fun) z_IOTaskPackage, "taskPackage"},
43  {-1, -1, -1, -1, (Odr_fun) 0, 0}
44  };
45  if (!odr_initmember(o, p, sizeof(**p)))
46  return odr_missing(o, opt, name);
47  if (odr_choice(o, arm, &(*p)->u, &(*p)->which, name))
48  return 1;
49  if (o->direction == ODR_DECODE)
50  *p = 0;
51  return odr_missing(o, opt, name);
52 }
53 
54 int z_IOContact(ODR o, Z_IOContact **p, int opt, const char *name)
55 {
56  if (!odr_sequence_begin(o, p, sizeof(**p), name))
57  return odr_missing(o, opt, name) && odr_ok (o);
58  return
60  &(*p)->name, ODR_CONTEXT, 1, 1, "name") &&
62  &(*p)->phone, ODR_CONTEXT, 2, 1, "phone") &&
64  &(*p)->email, ODR_CONTEXT, 3, 1, "email") &&
66 }
67 
68 int z_IOBilling(ODR o, Z_IOBilling **p, int opt, const char *name)
69 {
70  static Odr_arm arm[] = {
72  (Odr_fun) odr_null, "billInvoice"},
74  (Odr_fun) odr_null, "prepay"},
76  (Odr_fun) odr_null, "depositAccount"},
78  (Odr_fun) z_IOCreditCardInfo, "creditCard"},
80  (Odr_fun) odr_null, "cardInfoPreviouslySupplied"},
82  (Odr_fun) odr_null, "privateKnown"},
84  (Odr_fun) z_External, "privateNotKnown"},
85  {-1, -1, -1, -1, (Odr_fun) 0, 0}
86  };
87  if (!odr_sequence_begin(o, p, sizeof(**p), name))
88  return odr_missing(o, opt, name) && odr_ok (o);
89  return
90  odr_constructed_begin(o, &(*p)->u, ODR_CONTEXT, 1, "paymentMethod") &&
91  odr_choice(o, arm, &(*p)->u, &(*p)->which, 0) &&
94  &(*p)->customerReference, ODR_CONTEXT, 2, 1, "customerReference") &&
96  &(*p)->customerPONumber, ODR_CONTEXT, 3, 1, "customerPONumber") &&
98 }
99 
100 int z_IOOriginPartToKeep(ODR o, Z_IOOriginPartToKeep **p, int opt, const char *name)
101 {
102  if (!odr_sequence_begin(o, p, sizeof(**p), name))
103  return odr_missing(o, opt, name) && odr_ok (o);
104  return
106  &(*p)->supplDescription, ODR_CONTEXT, 1, 1, "supplDescription") &&
108  &(*p)->contact, ODR_CONTEXT, 2, 1, "contact") &&
110  &(*p)->addlBilling, ODR_CONTEXT, 3, 1, "addlBilling") &&
111  odr_sequence_end(o);
112 }
113 
114 int z_IOCreditCardInfo(ODR o, Z_IOCreditCardInfo **p, int opt, const char *name)
115 {
116  if (!odr_sequence_begin(o, p, sizeof(**p), name))
117  return odr_missing(o, opt, name) && odr_ok (o);
118  return
120  &(*p)->nameOnCard, ODR_CONTEXT, 1, 0, "nameOnCard") &&
122  &(*p)->expirationDate, ODR_CONTEXT, 2, 0, "expirationDate") &&
124  &(*p)->cardNumber, ODR_CONTEXT, 3, 0, "cardNumber") &&
125  odr_sequence_end(o);
126 }
127 
128 int z_IOResultSetItem(ODR o, Z_IOResultSetItem **p, int opt, const char *name)
129 {
130  if (!odr_sequence_begin(o, p, sizeof(**p), name))
131  return odr_missing(o, opt, name) && odr_ok (o);
132  return
134  &(*p)->resultSetId, ODR_CONTEXT, 1, 0, "resultSetId") &&
136  &(*p)->item, ODR_CONTEXT, 2, 0, "item") &&
137  odr_sequence_end(o);
138 }
139 
141 {
142  if (!odr_sequence_begin(o, p, sizeof(**p), name))
143  return odr_missing(o, opt, name) && odr_ok (o);
144  return
146  &(*p)->resultSetItem, ODR_CONTEXT, 1, 1, "resultSetItem") &&
148  &(*p)->itemRequest, ODR_CONTEXT, 2, 1, "itemRequest") &&
149  odr_sequence_end(o);
150 }
151 
152 int z_IOTargetPart(ODR o, Z_IOTargetPart **p, int opt, const char *name)
153 {
154  if (!odr_sequence_begin(o, p, sizeof(**p), name))
155  return odr_missing(o, opt, name) && odr_ok (o);
156  return
158  &(*p)->itemRequest, ODR_CONTEXT, 1, 1, "itemRequest") &&
160  &(*p)->statusOrErrorReport, ODR_CONTEXT, 2, 1, "statusOrErrorReport") &&
162  &(*p)->auxiliaryStatus, ODR_CONTEXT, 3, 1, "auxiliaryStatus") &&
163  odr_sequence_end(o);
164 }
#define odr_ok(o)
Definition: odr.h:215
int z_IOBilling(ODR o, Z_IOBilling **p, int opt, const char *name)
Definition: zes-order.c:68
#define odr_explicit_tag(o, t, p, cl, tg, opt, name)
Definition: odr.h:195
#define Z_IOBilling_creditCard
Definition: zes-order.h:90
#define odr_implicit_tag(o, t, p, cl, tg, opt, name)
Definition: odr.h:192
int z_IOContact(ODR o, Z_IOContact **p, int opt, const char *name)
Definition: zes-order.c:54
int odr_sequence_begin(ODR o, void *p, int size, const char *name)
Definition: odr_seq.c:15
int z_IOItemOrder(ODR o, Z_IOItemOrder **p, int opt, const char *name)
Definition: zes-order.c:36
char * name
Definition: initopt.c:18
#define Z_IOBilling_privateKnown
Definition: zes-order.h:92
int z_External(ODR o, Z_External **p, int opt, const char *name)
codec for BER EXTERNAL
Definition: prt-ext.c:95
int odr_constructed_begin(ODR o, void *xxp, int zclass, int tag, const char *name)
Definition: odr_cons.c:24
int odr_initmember(ODR o, void *p, int size)
Definition: odr_tag.c:44
#define Z_IOItemOrder_taskPackage
Definition: zes-order.h:67
int direction
Definition: odr.h:126
int odr_integer(ODR o, Odr_int **p, int opt, const char *name)
Definition: odr_int.c:19
int z_IOOriginPartToKeep(ODR o, Z_IOOriginPartToKeep **p, int opt, const char *name)
Definition: zes-order.c:100
int odr_choice(ODR o, Odr_arm arm[], void *p, void *whichp, const char *name)
Definition: odr_choice.c:17
#define Z_IOBilling_depositAccount
Definition: zes-order.h:89
int(* Odr_fun)(ODR, char **, int, const char *)
Definition: odr.h:135
int which
Definition: odr.h:142
Definition: odr.h:137
int odr_null(ODR o, Odr_null **p, int opt, const char *name)
Definition: odr_null.c:19
int odr_missing(ODR o, int opt, const char *name)
Definition: odr_util.c:82
#define Z_IOItemOrder_esRequest
Definition: zes-order.h:66
int z_IOCreditCardInfo(ODR o, Z_IOCreditCardInfo **p, int opt, const char *name)
Definition: zes-order.c:114
Definition: odr.h:124
int odr_sequence_end(ODR o)
Definition: odr_seq.c:61
int z_IORequest(ODR o, Z_IORequest **p, int opt, const char *name)
Definition: zes-order.c:12
int opt
Definition: initopt.c:19
int z_IOTargetPart(ODR o, Z_IOTargetPart **p, int opt, const char *name)
Definition: zes-order.c:152
#define ODR_IMPLICIT
Definition: odr.h:59
#define Z_IOBilling_privateNotKnown
Definition: zes-order.h:93
int z_IOOriginPartNotToKeep(ODR o, Z_IOOriginPartNotToKeep **p, int opt, const char *name)
Definition: zes-order.c:140
#define Z_IOBilling_billInvoice
Definition: zes-order.h:87
#define Z_IOBilling_prepay
Definition: zes-order.h:88
int z_InternationalString(ODR o, Z_InternationalString **p, int opt, const char *name)
Definition: z-core.c:1598
int z_IOResultSetItem(ODR o, Z_IOResultSetItem **p, int opt, const char *name)
Definition: zes-order.c:128
#define Z_IOBilling_cardInfoPreviouslySupplied
Definition: zes-order.h:91
int odr_constructed_end(ODR o)
Definition: odr_cons.c:148
#define ODR_CONTEXT
Definition: odr.h:67
#define ODR_DECODE
Definition: odr.h:95
ASN.1 Module ESFormat-ItemOrder.
int z_IOTaskPackage(ODR o, Z_IOTaskPackage **p, int opt, const char *name)
Definition: zes-order.c:24