YAZ  5.23.1
zes-update.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-update.h>
11 
12 int z_IUUpdateEsRequest(ODR o, Z_IUUpdateEsRequest **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, 0, "toKeep") &&
20  &(*p)->notToKeep, ODR_CONTEXT, 2, 0, "notToKeep") &&
22 }
23 
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, 0, "originPart") &&
32  &(*p)->targetPart, ODR_CONTEXT, 2, 0, "targetPart") &&
34 }
35 
36 int z_IUUpdate(ODR o, Z_IUUpdate **p, int opt, const char *name)
37 {
38  static Odr_arm arm[] = {
40  (Odr_fun) z_IUUpdateEsRequest, "esRequest"},
42  (Odr_fun) z_IUUpdateTaskPackage, "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_IUOriginPartToKeep(ODR o, Z_IUOriginPartToKeep **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)->action, ODR_CONTEXT, 1, 0, "action") &&
62  &(*p)->databaseName, ODR_CONTEXT, 2, 0, "databaseName") &&
64  &(*p)->schema, ODR_CONTEXT, 3, 1, "schema") &&
66  &(*p)->elementSetName, ODR_CONTEXT, 4, 1, "elementSetName") &&
68  &(*p)->actionQualifier, ODR_CONTEXT, 5, 1, "actionQualifier") &&
70 }
71 
73 {
74  return z_IUSuppliedRecords (o, p, opt, name);
75 }
76 
77 int z_IUTargetPart(ODR o, Z_IUTargetPart **p, int opt, const char *name)
78 {
79  if (!odr_sequence_begin(o, p, sizeof(**p), name))
80  return odr_missing(o, opt, name) && odr_ok (o);
81  return
83  &(*p)->updateStatus, ODR_CONTEXT, 1, 0, "updateStatus") &&
85  (odr_sequence_of(o, (Odr_fun) z_DiagRec, &(*p)->globalDiagnostics,
86  &(*p)->num_globalDiagnostics, "globalDiagnostics") || odr_ok(o)) &&
88  odr_sequence_of(o, (Odr_fun) z_IUTaskPackageRecordStructure, &(*p)->taskPackageRecords,
89  &(*p)->num_taskPackageRecords, "taskPackageRecords") &&
91 }
92 
94 {
95  static Odr_arm arm[] = {
97  (Odr_fun) odr_generalizedtime, "timeStamp"},
99  (Odr_fun) z_InternationalString, "versionNumber"},
101  (Odr_fun) z_External, "previousVersion"},
102  {-1, -1, -1, -1, (Odr_fun) 0, 0}
103  };
104  if (!odr_initmember(o, p, sizeof(**p)))
105  return odr_missing(o, opt, name);
106  if (odr_choice(o, arm, &(*p)->u, &(*p)->which, name))
107  return 1;
108  if (o->direction == ODR_DECODE)
109  *p = 0;
110  return odr_missing(o, opt, name);
111 }
112 
114 {
115  static Odr_arm arm[] = {
117  (Odr_fun) odr_integer, "number"},
119  (Odr_fun) z_InternationalString, "string"},
121  (Odr_fun) odr_octetstring, "opaque"},
122  {-1, -1, -1, -1, (Odr_fun) 0, 0}
123  };
124  if (!odr_sequence_begin(o, p, sizeof(**p), name))
125  return odr_missing(o, opt, name) && odr_ok (o);
126  return
127  ((odr_constructed_begin(o, &(*p)->u, ODR_CONTEXT, 1, "recordId") &&
128  odr_choice(o, arm, &(*p)->u, &(*p)->which, 0) &&
129  odr_constructed_end(o)) || odr_ok(o)) &&
131  &(*p)->supplementalId, ODR_CONTEXT, 2, 1, "supplementalId") &&
133  &(*p)->correlationInfo, ODR_CONTEXT, 3, 1, "correlationInfo") &&
135  &(*p)->record, ODR_CONTEXT, 4, 0, "record") &&
136  odr_sequence_end(o);
137 }
138 
139 int z_IUSuppliedRecords(ODR o, Z_IUSuppliedRecords **p, int opt, const char *name)
140 {
141  if (!odr_initmember(o, p, sizeof(**p)))
142  return odr_missing(o, opt, name);
143  if (odr_sequence_of(o, (Odr_fun) z_IUSuppliedRecords_elem, &(*p)->elements,
144  &(*p)->num, name))
145  return 1;
146  if (o->direction == ODR_DECODE)
147  *p = 0;
148  return odr_missing(o, opt, name);
149 }
150 
151 int z_IUCorrelationInfo(ODR o, Z_IUCorrelationInfo **p, int opt, const char *name)
152 {
153  if (!odr_sequence_begin(o, p, sizeof(**p), name))
154  return odr_missing(o, opt, name) && odr_ok (o);
155  return
157  &(*p)->note, ODR_CONTEXT, 1, 1, "note") &&
159  &(*p)->id, ODR_CONTEXT, 2, 1, "id") &&
160  odr_sequence_end(o);
161 }
162 
164 {
165  if (!odr_initmember(o, p, sizeof(**p)))
166  return odr_missing(o, opt, name);
167  if (odr_sequence_of(o, (Odr_fun) z_DiagRec, &(*p)->elements,
168  &(*p)->num, name))
169  return 1;
170  if (o->direction == ODR_DECODE)
171  *p = 0;
172  return odr_missing(o, opt, name);
173 }
174 
176 {
177  static Odr_arm arm[] = {
179  (Odr_fun) z_External, "record"},
182  {-1, -1, -1, -1, (Odr_fun) 0, 0}
183  };
184  if (!odr_sequence_begin(o, p, sizeof(**p), name))
185  return odr_missing(o, opt, name) && odr_ok (o);
186  return
187  ((odr_constructed_begin(o, &(*p)->u, ODR_CONTEXT, 1, "recordOrSurDiag") &&
188  odr_choice(o, arm, &(*p)->u, &(*p)->which, 0) &&
189  odr_constructed_end(o)) || odr_ok(o)) &&
191  &(*p)->correlationInfo, ODR_CONTEXT, 2, 1, "correlationInfo") &&
193  &(*p)->recordStatus, ODR_CONTEXT, 3, 0, "recordStatus") &&
195  (odr_sequence_of(o, (Odr_fun) z_DiagRec, &(*p)->supplementalDiagnostics,
196  &(*p)->num_supplementalDiagnostics, "supplementalDiagnostics") || odr_ok(o)) &&
197  odr_sequence_end(o);
198 }
#define odr_ok(o)
Definition: odr.h:215
int z_IUSuppliedRecords_elem(ODR o, Z_IUSuppliedRecords_elem **p, int opt, const char *name)
Definition: zes-update.c:113
#define odr_explicit_tag(o, t, p, cl, tg, opt, name)
Definition: odr.h:195
#define Z_IUUpdate_esRequest
Definition: zes-update.h:72
#define Z_IUSuppliedRecords_elem_string
Definition: zes-update.h:122
int z_IUUpdateTaskPackage(ODR o, Z_IUUpdateTaskPackage **p, int opt, const char *name)
Definition: zes-update.c:24
#define odr_implicit_tag(o, t, p, cl, tg, opt, name)
Definition: odr.h:192
int odr_sequence_begin(ODR o, void *p, int size, const char *name)
Definition: odr_seq.c:15
#define Z_IUUpdate_taskPackage
Definition: zes-update.h:73
int z_IUCorrelationInfo(ODR o, Z_IUCorrelationInfo **p, int opt, const char *name)
Definition: zes-update.c:151
char * name
Definition: initopt.c:18
int z_IUTaskPackageRecordStructure(ODR o, Z_IUTaskPackageRecordStructure **p, int opt, const char *name)
Definition: zes-update.c:175
ASN.1 Module ESFormat-Update.
#define Z_IUSuppliedRecordsId_versionNumber
Definition: zes-update.h:110
int z_IUUpdateEsRequest(ODR o, Z_IUUpdateEsRequest **p, int opt, const char *name)
Definition: zes-update.c:12
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
int direction
Definition: odr.h:126
#define Z_IUTaskPackageRecordStructure_surrogateDiagnostics
Definition: zes-update.h:151
int odr_integer(ODR o, Odr_int **p, int opt, const char *name)
Definition: odr_int.c:19
int odr_choice(ODR o, Odr_arm arm[], void *p, void *whichp, const char *name)
Definition: odr_choice.c:17
int odr_sequence_of(ODR o, Odr_fun type, void *p, int *num, const char *name)
Definition: odr_seq.c:134
int(* Odr_fun)(ODR, char **, int, const char *)
Definition: odr.h:135
int z_IUSuppliedRecords(ODR o, Z_IUSuppliedRecords **p, int opt, const char *name)
Definition: zes-update.c:139
int which
Definition: odr.h:142
Definition: odr.h:137
#define Z_IUSuppliedRecordsId_previousVersion
Definition: zes-update.h:111
int z_IUSuppliedRecordsId(ODR o, Z_IUSuppliedRecordsId **p, int opt, const char *name)
Definition: zes-update.c:93
int z_IUTaskPackageRecordStructureSurrogateDiagnostics(ODR o, Z_IUTaskPackageRecordStructureSurrogateDiagnostics **p, int opt, const char *name)
Definition: zes-update.c:163
int z_DiagRec(ODR o, Z_DiagRec **p, int opt, const char *name)
Definition: z-core.c:637
int odr_missing(ODR o, int opt, const char *name)
Definition: odr_util.c:82
Definition: odr.h:124
int z_IUOriginPartToKeep(ODR o, Z_IUOriginPartToKeep **p, int opt, const char *name)
Definition: zes-update.c:54
int odr_sequence_end(ODR o)
Definition: odr_seq.c:61
int z_IUUpdate(ODR o, Z_IUUpdate **p, int opt, const char *name)
Definition: zes-update.c:36
int opt
Definition: initopt.c:19
#define ODR_IMPLICIT
Definition: odr.h:59
int odr_oid(ODR o, Odr_oid **p, int opt, const char *name)
Definition: odr_oid.c:20
int z_IUTargetPart(ODR o, Z_IUTargetPart **p, int opt, const char *name)
Definition: zes-update.c:77
int z_InternationalString(ODR o, Z_InternationalString **p, int opt, const char *name)
Definition: z-core.c:1598
int odr_octetstring(ODR o, Odr_oct **p, int opt, const char *name)
Definition: odr_oct.c:19
#define Z_IUSuppliedRecords_elem_number
Definition: zes-update.h:121
#define Z_IUSuppliedRecords_elem_opaque
Definition: zes-update.h:123
int odr_generalizedtime(ODR o, char **p, int opt, const char *name)
Definition: odr_use.c:63
int z_IUOriginPartNotToKeep(ODR o, Z_IUOriginPartNotToKeep **p, int opt, const char *name)
Definition: zes-update.c:72
int odr_constructed_end(ODR o)
Definition: odr_cons.c:148
#define ODR_CONTEXT
Definition: odr.h:67
#define Z_IUSuppliedRecordsId_timeStamp
Definition: zes-update.h:109
#define ODR_DECODE
Definition: odr.h:95
#define Z_IUTaskPackageRecordStructure_record
Definition: zes-update.h:150
int odr_implicit_settag(ODR o, int zclass, int tag)
Definition: odr_tag.c:32