2 * Copyright (c) 1995-1999, Index Data
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.60 1999-06-11 16:45:59 adam
8 * Fixed minor bug in ScanRequest encoder.
10 * Revision 1.59 1999/04/21 11:46:00 adam
11 * Fixed bug in {en,de}coder for OtherInformation.
13 * Revision 1.58 1999/04/20 09:56:47 adam
14 * Added 'name' paramter to encoder/decoder routines (typedef Odr_fun).
15 * Modified all encoders/decoders to reflect this change.
17 * Revision 1.57 1998/10/20 13:55:37 quinn
18 * Fixed Scan bug in asn and client
20 * Revision 1.56 1998/08/19 16:10:04 adam
21 * Changed som member names of DeleteResultSetRequest/Response.
23 * Revision 1.55 1998/02/11 11:53:32 adam
24 * Changed code so that it compiles as C++.
26 * Revision 1.54 1996/11/11 13:14:46 adam
27 * Fixed tagging bug in z_ProximityOperator.
29 * Revision 1.53 1996/10/09 15:54:55 quinn
30 * Added SearchInfoReport
32 * Revision 1.52 1996/10/08 12:56:57 adam
33 * Bug fix: tagging of type 101 query.
35 * Revision 1.51 1996/07/26 14:07:21 quinn
38 * Revision 1.50 1996/07/26 13:36:15 quinn
41 * Revision 1.49 1996/07/06 19:58:28 quinn
42 * System headerfiles gathered in yconfig
44 * Revision 1.48 1996/06/10 08:53:33 quinn
45 * Added Summary,OPAC,ResourceReport
47 * Revision 1.47 1996/05/29 15:47:50 quinn
48 * Fixed in bug DiagRecs decoder. Thanks to Linda Harris.
50 * Revision 1.46 1996/04/10 11:39:42 quinn
51 * Fixed bug in UserInfo
53 * Revision 1.45 1996/02/23 10:00:25 quinn
56 * Revision 1.44 1996/02/20 12:51:41 quinn
57 * Completed SCAN. Fixed problems with EXTERNAL.
59 * Revision 1.43 1996/02/10 12:22:49 quinn
62 * Revision 1.42 1996/01/22 09:46:31 quinn
63 * Added Sort PDU. Moved StringList to main protocol file.
65 * Revision 1.41 1996/01/10 15:21:24 quinn
66 * Added links to access control PDUs
68 * Revision 1.40 1996/01/02 11:46:40 quinn
69 * Changed 'operator' to 'roperator' to avoid C++ conflict.
71 * Revision 1.39 1995/09/29 17:11:53 quinn
74 * Revision 1.38 1995/09/27 15:02:40 quinn
75 * Modified function heads & prototypes.
77 * Revision 1.37 1995/08/21 09:10:15 quinn
78 * Smallish fixes to suppport new formats.
80 * Revision 1.36 1995/08/15 11:59:39 quinn
83 * Revision 1.35 1995/08/10 08:53:59 quinn
86 * Revision 1.34 1995/06/19 17:01:48 quinn
87 * This should bring us in sync with the version distributed as 1.0b
89 * Revision 1.33 1995/06/19 13:39:56 quinn
90 * *** empty log message ***
92 * Revision 1.32 1995/06/19 12:37:28 quinn
93 * Fixed a bug in the compspec.
95 * Revision 1.31 1995/06/16 13:15:56 quinn
96 * Fixed Defaultdiagformat.
98 * Revision 1.30 1995/06/15 15:42:01 quinn
101 * Revision 1.29 1995/06/15 07:44:49 quinn
104 * Revision 1.28 1995/06/14 15:26:35 quinn
105 * *** empty log message ***
107 * Revision 1.27 1995/06/07 14:36:22 quinn
110 * Revision 1.26 1995/06/02 09:49:13 quinn
111 * Adding access control
113 * Revision 1.25 1995/05/25 11:00:08 quinn
114 * *** empty log message ***
116 * Revision 1.24 1995/05/22 13:58:18 quinn
117 * Fixed an ODR_NULLVAL.
119 * Revision 1.23 1995/05/22 11:30:18 quinn
120 * Adding Z39.50-1992 stuff to proto.c. Adding zget.c
122 * Revision 1.22 1995/05/17 08:40:56 quinn
123 * Added delete. Fixed some sequence_begins. Smallish.
125 * Revision 1.21 1995/05/16 08:50:24 quinn
126 * License, documentation, and memory fixes
128 * Revision 1.20 1995/05/15 11:55:25 quinn
131 * Revision 1.19 1995/04/11 11:58:35 quinn
134 * Revision 1.18 1995/04/11 11:52:02 quinn
135 * Fixed possible buf in proto.c
137 * Revision 1.17 1995/04/10 10:22:22 quinn
140 * Revision 1.16 1995/03/30 10:26:43 quinn
141 * Added Term structure
143 * Revision 1.15 1995/03/30 09:08:39 quinn
144 * Added Resource control protocol
146 * Revision 1.14 1995/03/29 08:06:13 quinn
147 * Added a few v3 elements
149 * Revision 1.13 1995/03/20 11:26:52 quinn
150 * *** empty log message ***
152 * Revision 1.12 1995/03/20 09:45:09 quinn
155 * Revision 1.11 1995/03/17 10:17:25 quinn
156 * Added memory management.
158 * Revision 1.10 1995/03/15 11:17:40 quinn
159 * Fixed some return-checks from choice.. need better ay to handle those..
161 * Revision 1.9 1995/03/15 08:37:06 quinn
162 * Fixed protocol bugs.
164 * Revision 1.8 1995/03/14 16:59:24 quinn
165 * Fixed OPTIONAL flag in attributeelement
167 * Revision 1.7 1995/03/07 16:29:33 quinn
168 * Added authentication stuff.
170 * Revision 1.6 1995/03/01 14:46:03 quinn
171 * Fixed protocol bug in 8777query.
173 * Revision 1.5 1995/02/14 11:54:22 quinn
176 * Revision 1.4 1995/02/10 15:54:30 quinn
179 * Revision 1.3 1995/02/09 15:51:39 quinn
182 * Revision 1.2 1995/02/06 21:26:07 quinn
183 * Repaired this evening's damages..
185 * Revision 1.1 1995/02/06 16:44:47 quinn
186 * First hack at Z/SR protocol
194 /* ---------------------- GLOBAL DEFS ------------------- */
197 * We'll use a general octetstring here, since string operations are
198 * clumsy on long strings.
200 int z_SUTRS(ODR o, Odr_oct **p, int opt, const char *name)
202 return odr_implicit(o, odr_octetstring, p, ODR_UNIVERSAL,
203 ODR_GENERALSTRING, opt);
206 int z_ReferenceId(ODR o, Z_ReferenceId **p, int opt, const char *name)
208 return odr_implicit(o, odr_octetstring, (Odr_oct**) p, ODR_CONTEXT, 2,
212 int z_DatabaseName(ODR o, Z_DatabaseName **p, int opt, const char *name)
214 return odr_implicit(o, odr_visiblestring, (char **) p, ODR_CONTEXT, 105,
218 int z_ResultSetId(ODR o, char **p, int opt, const char *name)
220 return odr_implicit(o, odr_visiblestring, (char **) p, ODR_CONTEXT, 31,
224 int z_ElementSetName(ODR o, char **p, int opt, const char *name)
226 return odr_implicit(o, odr_visiblestring, p, ODR_CONTEXT, 103, opt);
229 int z_UserInformationField(ODR o, Z_External **p, int opt, const char *name)
231 return odr_explicit(o, z_External, (Z_External **)p, ODR_CONTEXT,
235 int z_InternationalString(ODR o, char **p, int opt, const char *name)
237 return odr_generalstring(o, p, opt, 0);
240 int z_InfoCategory(ODR o, Z_InfoCategory **p, int opt, const char *name)
242 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
243 return opt && odr_ok(o);
245 odr_implicit(o, odr_oid, &(*p)->categoryTypeId, ODR_CONTEXT, 1, 1) &&
246 odr_implicit(o, odr_integer, &(*p)->categoryValue, ODR_CONTEXT, 2,
251 int z_OtherInformationUnit(ODR o, Z_OtherInformationUnit **p, int opt,
254 static Odr_arm arm[] =
256 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_OtherInfo_characterInfo,
257 odr_visiblestring, 0},
258 {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_OtherInfo_binaryInfo,
259 (Odr_fun)odr_octetstring, 0},
260 {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_OtherInfo_externallyDefinedInfo,
261 (Odr_fun)z_External, 0},
262 {ODR_IMPLICIT, ODR_CONTEXT, 5, Z_OtherInfo_oid,
263 (Odr_fun)odr_oid, 0},
264 {-1, -1, -1, -1, 0, 0}
267 if (!odr_sequence_begin(o, p, sizeof(**p), name))
268 return opt && odr_ok(o);
270 odr_implicit(o, z_InfoCategory, &(*p)->category, ODR_CONTEXT, 1, 1) &&
271 odr_choice(o, arm, &(*p)->information, &(*p)->which, name) &&
275 int z_OtherInformation(ODR o, Z_OtherInformation **p, int opt,
278 if (!odr_initmember (o, p, sizeof(**p)))
279 return opt && odr_ok(o);
280 odr_implicit_settag(o, ODR_CONTEXT, 201);
281 if (odr_sequence_of(o, (Odr_fun)z_OtherInformationUnit, &(*p)->list,
282 &(*p)->num_elements, name))
285 return opt && odr_ok(o);
288 int z_StringOrNumeric(ODR o, Z_StringOrNumeric **p, int opt, const char *name)
290 static Odr_arm arm[] =
292 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_StringOrNumeric_string,
293 odr_visiblestring, 0},
294 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_StringOrNumeric_numeric,
295 (Odr_fun)odr_integer, 0},
296 {-1, -1, -1, -1, 0, 0}
299 if (o->direction == ODR_DECODE)
300 *p = (Z_StringOrNumeric *)odr_malloc(o, sizeof(**p));
303 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
306 return opt && odr_ok(o);
312 int z_Unit(ODR o, Z_Unit **p, int opt, const char *name)
314 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
315 return opt && odr_ok(o);
317 odr_explicit(o, z_InternationalString, &(*p)->unitSystem, ODR_CONTEXT,
319 odr_explicit(o, z_StringOrNumeric, &(*p)->unitType, ODR_CONTEXT,
321 odr_explicit(o, z_StringOrNumeric, &(*p)->unit, ODR_CONTEXT, 3, 1) &&
322 odr_implicit(o, odr_integer, &(*p)->scaleFactor, ODR_CONTEXT, 4, 1) &&
326 int z_IntUnit(ODR o, Z_IntUnit **p, int opt, const char *name)
328 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
329 return opt && odr_ok(o);
331 odr_implicit(o, odr_integer, &(*p)->value, ODR_CONTEXT, 1, 0) &&
332 odr_implicit(o, z_Unit, &(*p)->unitUsed, ODR_CONTEXT, 2, 0) &&
336 int z_StringList(ODR o, Z_StringList **p, int opt, const char *name)
338 if (o->direction == ODR_DECODE)
339 *p = (Z_StringList *)odr_malloc(o, sizeof(**p));
342 if (odr_sequence_of(o, (Odr_fun)z_InternationalString, &(*p)->strings,
343 &(*p)->num_strings, 0))
346 return opt && odr_ok(o);
349 /* ---------------------- INITIALIZE SERVICE ------------------- */
352 int z_NSRAuthentication(ODR o, Z_NSRAuthentication **p, int opt,
355 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
356 return opt && odr_ok(o);
358 odr_visiblestring(o, &(*p)->user, 0, 0) &&
359 odr_visiblestring(o, &(*p)->password, 0, 0) &&
360 odr_visiblestring(o, &(*p)->account, 0, 0) &&
365 int z_IdPass(ODR o, Z_IdPass **p, int opt, const char *name)
367 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
368 return opt && odr_ok(o);
370 odr_implicit(o, odr_visiblestring, &(*p)->groupId, ODR_CONTEXT, 0,
372 odr_implicit(o, odr_visiblestring, &(*p)->userId, ODR_CONTEXT, 1, 1) &&
373 odr_implicit(o, odr_visiblestring, &(*p)->password, ODR_CONTEXT, 2,
378 int z_StrAuthentication(ODR o, char **p, int opt, const char *name)
380 return odr_visiblestring(o, p, opt, 0);
383 int z_IdAuthentication(ODR o, Z_IdAuthentication **p, int opt,
386 static Odr_arm arm[] =
388 {-1, -1, -1, Z_IdAuthentication_open, z_StrAuthentication, 0},
389 {-1, -1, -1, Z_IdAuthentication_idPass, (Odr_fun)z_IdPass, 0},
390 {-1, -1, -1, Z_IdAuthentication_anonymous, (Odr_fun)odr_null, 0},
391 {-1, -1, -1, Z_IdAuthentication_other, (Odr_fun)z_External, 0},
392 {-1, -1, -1, -1, 0, 0}
395 if (o->direction == ODR_DECODE)
396 *p = (Z_IdAuthentication *)odr_malloc(o, sizeof(**p));
400 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
403 return opt && odr_ok(o);
406 int z_InitRequest(ODR o, Z_InitRequest **p, int opt, const char *name)
410 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
411 return opt && odr_ok(o);
414 z_ReferenceId(o, &pp->referenceId, 1, 0) &&
415 odr_implicit(o, odr_bitstring, &pp->protocolVersion,
416 ODR_CONTEXT, 3, 0) &&
417 odr_implicit(o, odr_bitstring, &pp->options, ODR_CONTEXT, 4, 0) &&
418 odr_implicit(o, odr_integer, &pp->preferredMessageSize, ODR_CONTEXT,
420 odr_implicit(o, odr_integer, &pp->maximumRecordSize,
421 ODR_CONTEXT, 6, 0) &&
422 odr_explicit(o, z_IdAuthentication, &pp->idAuthentication,
423 ODR_CONTEXT, 7, 1) &&
424 odr_implicit(o, odr_visiblestring, &pp->implementationId,
425 ODR_CONTEXT, 110, 1) &&
426 odr_implicit(o, odr_visiblestring, &pp->implementationName,
427 ODR_CONTEXT, 111, 1) &&
428 odr_implicit(o, odr_visiblestring, &pp->implementationVersion,
429 ODR_CONTEXT, 112, 1) &&
430 z_UserInformationField(o, &pp->userInformationField, 1, 0) &&
431 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
435 int z_InitResponse(ODR o, Z_InitResponse **p, int opt, const char *name)
439 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
440 return opt && odr_ok(o);
443 z_ReferenceId(o, &pp->referenceId, 1, 0) &&
444 odr_implicit(o, odr_bitstring, &pp->protocolVersion,
445 ODR_CONTEXT, 3, 0) &&
446 odr_implicit(o, odr_bitstring, &pp->options, ODR_CONTEXT, 4, 0) &&
447 odr_implicit(o, odr_integer, &pp->preferredMessageSize,
448 ODR_CONTEXT, 5, 0) &&
449 odr_implicit(o, odr_integer, &pp->maximumRecordSize,
450 ODR_CONTEXT, 6, 0) &&
451 odr_implicit(o, odr_bool, &pp->result, ODR_CONTEXT, 12, 0) &&
452 odr_implicit(o, odr_visiblestring, &pp->implementationId,
453 ODR_CONTEXT, 110, 1) &&
454 odr_implicit(o, odr_visiblestring, &pp->implementationName,
455 ODR_CONTEXT, 111, 1) &&
456 odr_implicit(o, odr_visiblestring, &pp->implementationVersion,
457 ODR_CONTEXT, 112, 1) &&
458 z_UserInformationField(o, &pp->userInformationField, 1, 0) &&
459 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
463 /* ------------------ RESOURCE CONTROL ----------------*/
465 int z_TriggerResourceControlRequest(ODR o, Z_TriggerResourceControlRequest **p,
466 int opt, const char *name)
468 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
469 return opt && odr_ok(o);
471 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
472 odr_implicit(o, odr_integer, &(*p)->requestedAction, ODR_CONTEXT,
474 odr_implicit(o, odr_oid, &(*p)->prefResourceReportFormat,
475 ODR_CONTEXT, 47, 1) &&
476 odr_implicit(o, odr_bool, &(*p)->resultSetWanted, ODR_CONTEXT,
478 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
482 int z_ResourceControlRequest(ODR o, Z_ResourceControlRequest **p, int opt,
485 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
486 return opt && odr_ok(o);
488 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
489 odr_implicit(o, odr_bool, &(*p)->suspendedFlag, ODR_CONTEXT, 39, 1)&&
490 odr_explicit(o, z_External, &(*p)->resourceReport, ODR_CONTEXT,
492 odr_implicit(o, odr_integer, &(*p)->partialResultsAvailable,
493 ODR_CONTEXT, 41, 1) &&
494 odr_implicit(o, odr_bool, &(*p)->responseRequired, ODR_CONTEXT,
496 odr_implicit(o, odr_bool, &(*p)->triggeredRequestFlag,
497 ODR_CONTEXT, 43, 1) &&
498 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
502 int z_ResourceControlResponse(ODR o, Z_ResourceControlResponse **p, int opt,
505 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
506 return opt && odr_ok(o);
508 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
509 odr_implicit(o, odr_bool, &(*p)->continueFlag, ODR_CONTEXT, 44, 0) &&
510 odr_implicit(o, odr_bool, &(*p)->resultSetWanted, ODR_CONTEXT,
512 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
516 /* ------------------------ SEARCH SERVICE ----------------------- */
518 int z_DatabaseSpecificUnit(ODR o, Z_DatabaseSpecificUnit **p, int opt,
521 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
522 return opt && odr_ok(o);
524 z_DatabaseName(o, &(*p)->databaseName, 0, 0) &&
525 z_ElementSetName(o, &(*p)->elementSetName, 0, 0) &&
529 int z_DatabaseSpecific(ODR o, Z_DatabaseSpecific **p, int opt,
532 if (o->direction == ODR_DECODE)
533 *p = (Z_DatabaseSpecific *)odr_malloc(o, sizeof(**p));
537 odr_implicit_settag(o, ODR_CONTEXT, 1);
538 if (odr_sequence_of(o, (Odr_fun)z_DatabaseSpecificUnit, &(*p)->elements,
539 &(*p)->num_elements, 0))
545 int z_ElementSetNames(ODR o, Z_ElementSetNames **p, int opt, const char *name)
547 static Odr_arm arm[] =
549 {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_ElementSetNames_generic,
550 z_ElementSetName, 0},
551 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ElementSetNames_databaseSpecific,
552 (Odr_fun)z_DatabaseSpecific, 0},
556 if (o->direction == ODR_DECODE)
557 *p = (Z_ElementSetNames *)odr_malloc(o, sizeof(**p));
559 return opt && odr_ok(o);
561 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
567 /* ----------------------- RPN QUERY -----------------------*/
569 int z_ComplexAttribute(ODR o, Z_ComplexAttribute **p, int opt,
572 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
573 return opt && odr_ok(o);
575 odr_implicit_settag(o, ODR_CONTEXT, 1) &&
576 odr_sequence_of(o, (Odr_fun)z_StringOrNumeric, &(*p)->list,
577 &(*p)->num_list, 0) &&
578 odr_implicit_settag(o, ODR_CONTEXT, 2) &&
579 (odr_sequence_of(o, (Odr_fun)odr_integer, &(*p)->semanticAction,
580 &(*p)->num_semanticAction, 0) || odr_ok(o)) &&
584 int z_AttributeElement(ODR o, Z_AttributeElement **p, int opt,
587 static Odr_arm arm[] =
589 {ODR_IMPLICIT, ODR_CONTEXT, 121, Z_AttributeValue_numeric,
590 (Odr_fun)odr_integer, 0},
591 {ODR_IMPLICIT, ODR_CONTEXT, 224, Z_AttributeValue_complex,
592 (Odr_fun)z_ComplexAttribute, 0},
593 {-1, -1, -1, -1, 0, 0}
595 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
596 return opt && odr_ok(o);
598 odr_implicit(o, odr_oid, &(*p)->attributeSet, ODR_CONTEXT, 1, 1) &&
599 odr_implicit(o, odr_integer, &(*p)->attributeType, ODR_CONTEXT,
601 odr_choice(o, arm, &(*p)->value, &(*p)->which, 0) &&
605 int z_Term(ODR o, Z_Term **p, int opt, const char *name)
607 static Odr_arm arm[] =
609 {ODR_IMPLICIT, ODR_CONTEXT, 45, Z_Term_general,
610 (Odr_fun)odr_octetstring, 0},
611 {ODR_IMPLICIT, ODR_CONTEXT, 215, Z_Term_numeric,
612 (Odr_fun)odr_integer, 0},
613 {ODR_IMPLICIT, ODR_CONTEXT, 216, Z_Term_characterString,
614 odr_visiblestring, 0},
615 {ODR_IMPLICIT, ODR_CONTEXT, 217, Z_Term_oid, (Odr_fun)odr_oid, 0},
616 {ODR_IMPLICIT, ODR_CONTEXT, 218, Z_Term_dateTime, odr_cstring, 0},
617 {ODR_IMPLICIT, ODR_CONTEXT, 219, Z_Term_external,
618 (Odr_fun) z_External, 0},
619 /* add intUnit here */
620 {ODR_IMPLICIT, ODR_CONTEXT, 221, Z_Term_null, (Odr_fun)odr_null, 0},
621 {-1, -1, -1, -1, 0, 0}
624 if (o->direction ==ODR_DECODE)
625 *p = (Z_Term *)odr_malloc(o, sizeof(**p));
628 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
631 return opt && odr_ok(o);
634 int z_AttributesPlusTerm(ODR o, Z_AttributesPlusTerm **p, int opt,
637 if (!(odr_implicit_settag(o, ODR_CONTEXT, 102) &&
638 odr_sequence_begin(o, p, sizeof(**p), 0)))
639 return opt && odr_ok(o);
641 odr_implicit_settag(o, ODR_CONTEXT, 44) &&
642 odr_sequence_of(o, (Odr_fun)z_AttributeElement, &(*p)->attributeList,
643 &(*p)->num_attributes, 0) &&
644 z_Term(o, &(*p)->term, 0, 0) &&
648 int z_ResultSetPlusAttributes(ODR o, Z_ResultSetPlusAttributes **p, int opt,
651 if (!(odr_implicit_settag(o, ODR_CONTEXT, 214) &&
652 odr_sequence_begin(o, p, sizeof(**p), 0)))
653 return opt && odr_ok(o);
655 z_ResultSetId(o, &(*p)->resultSet, 0, 0) &&
656 odr_implicit_settag(o, ODR_CONTEXT, 44) &&
657 odr_sequence_of(o, (Odr_fun)z_AttributeElement, &(*p)->attributeList,
658 &(*p)->num_attributes, 0) &&
662 int z_ProximityOperator(ODR o, Z_ProximityOperator **p, int opt,
665 static Odr_arm arm[] =
667 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ProxCode_known,
668 (Odr_fun)odr_integer, 0},
669 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ProxCode_private,
670 (Odr_fun)odr_integer, 0},
671 {-1, -1, -1, -1, 0, 0}
674 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
675 return opt && odr_ok(o);
677 odr_implicit(o, odr_bool, &(*p)->exclusion, ODR_CONTEXT, 1, 1) &&
678 odr_implicit(o, odr_integer, &(*p)->distance, ODR_CONTEXT, 2, 0) &&
679 odr_implicit(o, odr_bool, &(*p)->ordered, ODR_CONTEXT, 3, 0) &&
680 odr_implicit(o, odr_integer, &(*p)->relationType, ODR_CONTEXT, 4, 0) &&
681 odr_constructed_begin(o, &(*p)->proximityUnitCode,
682 ODR_CONTEXT, 5, 0) &&
683 odr_choice(o, arm, &(*p)->proximityUnitCode, &(*p)->which, 0) &&
684 odr_constructed_end(o) &&
688 int z_Operator(ODR o, Z_Operator **p, int opt, const char *name)
690 static Odr_arm arm[] =
692 {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_Operator_and, (Odr_fun)odr_null, 0},
693 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Operator_or, (Odr_fun)odr_null, 0},
694 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Operator_and_not,
695 (Odr_fun)odr_null, 0},
696 {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_Operator_prox,
697 (Odr_fun)z_ProximityOperator, 0},
698 {-1, -1, -1, -1, 0, 0}
701 if (!*p && o->direction != ODR_DECODE)
703 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 46, 0))
704 return opt && odr_ok(o);
705 if (o->direction == ODR_DECODE)
706 *p = (Z_Operator *)odr_malloc(o, sizeof(**p));
708 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0) &&
709 odr_constructed_end(o))
712 return opt && odr_ok(o);
715 int z_Operand(ODR o, Z_Operand **p, int opt, const char *name)
717 static Odr_arm arm[] =
719 {-1, -1, -1, Z_Operand_APT, (Odr_fun)z_AttributesPlusTerm, 0},
720 {-1, -1, -1, Z_Operand_resultSetId, (Odr_fun)z_ResultSetId, 0},
721 {-1, -1, -1, Z_Operand_resultAttr,
722 (Odr_fun)z_ResultSetPlusAttributes, 0},
723 {-1, -1, -1, -1, 0, 0}
726 if (o->direction == ODR_DECODE)
727 *p = (Z_Operand *)odr_malloc(o, sizeof(**p));
730 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
733 return opt && odr_ok(o);
736 int z_RPNStructure(ODR o, Z_RPNStructure **p, int opt, const char *name);
738 int z_Complex(ODR o, Z_Complex **p, int opt, const char *name)
740 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
741 return opt && odr_ok(o);
743 z_RPNStructure(o, &(*p)->s1, 0, 0) &&
744 z_RPNStructure(o, &(*p)->s2, 0, 0) &&
745 z_Operator(o, &(*p)->roperator, 0, 0) &&
749 int z_RPNStructure(ODR o, Z_RPNStructure **p, int opt, const char *name)
751 static Odr_arm arm[] =
753 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_RPNStructure_simple,
754 (Odr_fun)z_Operand, 0},
755 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_RPNStructure_complex,
756 (Odr_fun)z_Complex, 0},
757 {-1 -1, -1, -1, 0, 0}
760 if (o->direction == ODR_DECODE)
761 *p = (Z_RPNStructure *)odr_malloc(o, sizeof(**p));
764 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
767 return opt && odr_ok(o);
770 int z_RPNQuery(ODR o, Z_RPNQuery **p, int opt, const char *name)
772 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
773 return opt && odr_ok(o);
775 odr_oid(o, &(*p)->attributeSetId, 0, 0) &&
776 z_RPNStructure(o, &(*p)->RPNStructure, 0, 0) &&
780 /* -----------------------END RPN QUERY ----------------------- */
782 int z_Query(ODR o, Z_Query **p, int opt, const char *name)
784 static Odr_arm arm[] =
786 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Query_type_1,
787 (Odr_fun)z_RPNQuery, 0},
788 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_Query_type_2,
789 (Odr_fun)odr_octetstring, 0},
790 {ODR_IMPLICIT, ODR_CONTEXT, 101, Z_Query_type_101,
791 (Odr_fun)z_RPNQuery, 0},
792 {-1, -1, -1, -1, 0, 0}
795 if (o->direction == ODR_DECODE)
796 *p = (Z_Query *)odr_malloc(o, sizeof(**p));
799 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
802 return opt && odr_ok(o);
805 int z_SearchRequest(ODR o, Z_SearchRequest **p, int opt, const char *name)
809 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
810 return opt && odr_ok(o);
813 z_ReferenceId(o, &pp->referenceId, 1, 0) &&
814 odr_implicit(o, odr_integer, &pp->smallSetUpperBound, ODR_CONTEXT,
816 odr_implicit(o, odr_integer, &pp->largeSetLowerBound, ODR_CONTEXT,
818 odr_implicit(o, odr_integer, &pp->mediumSetPresentNumber, ODR_CONTEXT,
820 odr_implicit(o, odr_bool, &pp->replaceIndicator, ODR_CONTEXT, 16, 1) &&
821 odr_implicit(o, odr_visiblestring, &pp->resultSetName, ODR_CONTEXT,
823 odr_implicit_settag(o, ODR_CONTEXT, 18) &&
824 odr_sequence_of(o, z_DatabaseName, &pp->databaseNames,
825 &pp->num_databaseNames, 0) &&
826 odr_explicit(o, z_ElementSetNames, &pp->smallSetElementSetNames,
827 ODR_CONTEXT, 100, 1) &&
828 odr_explicit(o, z_ElementSetNames, &pp->mediumSetElementSetNames,
829 ODR_CONTEXT, 101, 1) &&
830 odr_implicit(o, odr_oid, &pp->preferredRecordSyntax,
831 ODR_CONTEXT, 104, 1) &&
832 odr_explicit(o, z_Query, &pp->query, ODR_CONTEXT, 21, 0) &&
833 odr_implicit_tag(o, z_OtherInformation, &(*p)->additionalSearchInfo,
834 ODR_CONTEXT, 203, 1, 0) &&
835 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
839 /* ------------------------ RECORD ------------------------- */
841 int z_DatabaseRecord(ODR o, Z_DatabaseRecord **p, int opt, const char *name)
843 return z_External(o, (Z_External **) p, opt, 0);
846 int z_DefaultDiagFormat(ODR o, Z_DefaultDiagFormat **p, int opt,
849 static Odr_arm arm[] =
851 {-1, -1, -1, Z_DiagForm_v2AddInfo, odr_visiblestring, 0},
852 {-1, -1, -1, Z_DiagForm_v3AddInfo, z_InternationalString, 0},
853 {ODR_IMPLICIT, ODR_CONTEXT, ODR_VISIBLESTRING, Z_DiagForm_v2AddInfo,
854 odr_visiblestring, 0}, /* To cater to a bug in the CNIDR servers */
855 {-1, -1, -1, -1, 0, 0}
857 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
858 return opt && odr_ok(o);
860 odr_oid(o, &(*p)->diagnosticSetId, 1, 0) && /* SHOULD NOT BE OPT! */
861 odr_integer(o, &(*p)->condition, 0, 0) &&
863 * I no longer recall what server tagged the addinfo.. but it isn't
864 * hurting anyone, so...
865 * We need to turn it into a choice, or something, because of
866 * that damn generalstring in v3.
868 odr_choice(o, arm, &(*p)->addinfo, &(*p)->which, 0) &&
872 int z_DiagRec(ODR o, Z_DiagRec **p, int opt, const char *name)
874 static Odr_arm arm[] =
876 {-1, -1, -1, Z_DiagRec_defaultFormat, (Odr_fun)z_DefaultDiagFormat, 0},
877 {-1, -1, -1, Z_DiagRec_externallyDefined, (Odr_fun)z_External, 0},
878 {-1, -1, -1, -1, 0, 0}
881 if (o->direction == ODR_DECODE)
882 *p = (Z_DiagRec *)odr_malloc(o, sizeof(**p));
885 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
888 return opt && odr_ok(o);
891 int z_DiagRecs(ODR o, Z_DiagRecs **p, int opt, const char *name)
893 if (o->direction == ODR_DECODE)
894 *p = (Z_DiagRecs *)odr_malloc(o, sizeof(**p));
898 if (odr_sequence_of(o, (Odr_fun)z_DiagRec, &(*p)->diagRecs,
899 &(*p)->num_diagRecs, 0))
902 return opt && odr_ok(o);
905 int z_NamePlusRecord(ODR o, Z_NamePlusRecord **p, int opt, const char *name)
907 static Odr_arm arm[] =
909 {ODR_EXPLICIT, ODR_CONTEXT, 1, Z_NamePlusRecord_databaseRecord,
910 (Odr_fun)z_DatabaseRecord, 0},
911 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_NamePlusRecord_surrogateDiagnostic,
912 (Odr_fun)z_DiagRec, 0},
913 {-1, -1, -1, -1, 0, 0}
916 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
917 return opt && odr_ok(o);
919 odr_implicit(o, z_DatabaseName, &(*p)->databaseName, ODR_CONTEXT,
921 odr_constructed_begin(o, &(*p)->u, ODR_CONTEXT, 1, 0) &&
922 odr_choice(o, arm, &(*p)->u, &(*p)->which, 0) &&
923 odr_constructed_end(o) &&
927 int z_NamePlusRecordList(ODR o, Z_NamePlusRecordList **p, int opt,
930 if (o->direction == ODR_DECODE)
931 *p = (Z_NamePlusRecordList *)odr_malloc(o, sizeof(**p));
934 if (odr_sequence_of(o, (Odr_fun)z_NamePlusRecord, &(*p)->records,
935 &(*p)->num_records, 0))
941 int z_Records(ODR o, Z_Records **p, int opt, const char *name)
943 static Odr_arm arm[] =
945 {ODR_IMPLICIT, ODR_CONTEXT, 28, Z_Records_DBOSD,
946 (Odr_fun)z_NamePlusRecordList, 0},
947 {ODR_IMPLICIT, ODR_CONTEXT, 130, Z_Records_NSD,
948 (Odr_fun)z_DiagRec, 0},
949 {ODR_IMPLICIT, ODR_CONTEXT, 205, Z_Records_multipleNSD,
950 (Odr_fun)z_DiagRecs, 0},
951 {-1, -1, -1, -1, 0, 0}
954 if (o->direction == ODR_DECODE)
955 *p = (Z_Records *)odr_malloc(o, sizeof(**p));
958 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
961 return opt && odr_ok(o);
964 /* ------------------------ ACCESS CTRL SERVICE ----------------------- */
966 int z_AccessControlRequest(ODR o, Z_AccessControlRequest **p, int opt,
969 static Odr_arm arm[] =
971 {ODR_IMPLICIT, ODR_CONTEXT, 37, Z_AccessRequest_simpleForm,
972 (Odr_fun)odr_octetstring, 0},
973 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_AccessRequest_externallyDefined,
974 (Odr_fun)z_External, 0},
975 {-1, -1, -1, -1, 0, 0}
977 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
978 return opt && odr_ok(o);
980 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
981 odr_choice(o, arm, &(*p)->u, &(*p)->which, 0) &&
982 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
986 int z_AccessControlResponse(ODR o, Z_AccessControlResponse **p, int opt,
989 static Odr_arm arm[] =
991 {ODR_IMPLICIT, ODR_CONTEXT, 38, Z_AccessResponse_simpleForm,
992 (Odr_fun)odr_octetstring, 0},
993 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_AccessResponse_externallyDefined,
994 (Odr_fun)z_External, 0},
995 {-1, -1, -1, -1, 0, 0}
997 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
998 return opt && odr_ok(o);
1000 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
1001 odr_choice(o, arm, &(*p)->u, &(*p)->which, 0) &&
1002 odr_explicit(o, z_DiagRec, &(*p)->diagnostic, ODR_CONTEXT, 223, 1) &&
1003 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
1004 odr_sequence_end(o);
1007 /* ------------------------ SCAN SERVICE -------------------- */
1009 int z_AttributeList(ODR o, Z_AttributeList **p, int opt, const char *name)
1011 if (o->direction == ODR_DECODE)
1012 *p = (Z_AttributeList *)odr_malloc(o, sizeof(**p));
1016 odr_implicit_settag(o, ODR_CONTEXT, 44);
1017 if (odr_sequence_of(o, (Odr_fun)z_AttributeElement, &(*p)->attributes,
1018 &(*p)->num_attributes, 0))
1021 return opt && odr_ok(o);
1025 * This is a temporary hack. We don't know just *what* old version of the
1026 * protocol willow uses, so we'll just patiently wait for them to update
1028 static int willow_scan = 0;
1030 int z_WillowAttributesPlusTerm(ODR o, Z_AttributesPlusTerm **p, int opt,
1033 if (!*p && o->direction != ODR_DECODE)
1035 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 4, 0))
1038 return opt && odr_ok(o);
1040 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 1, 0))
1042 if (!odr_constructed_begin(o, p, ODR_UNIVERSAL, ODR_SEQUENCE, 0))
1044 if (!odr_implicit_settag(o, ODR_CONTEXT, 44))
1046 if (o->direction == ODR_DECODE)
1047 *p = (Z_AttributesPlusTerm*)odr_malloc(o, sizeof(**p));
1048 if (!odr_sequence_of(o, (Odr_fun)z_AttributeElement, &(*p)->attributeList,
1049 &(*p)->num_attributes, 0))
1051 if (!odr_sequence_end(o) || !odr_sequence_end(o))
1053 if (!z_Term(o, &(*p)->term, 0, 0))
1055 if (!odr_constructed_end(o))
1061 int z_AlternativeTerm(ODR o, Z_AlternativeTerm **p, int opt, const char *name)
1063 if (o->direction == ODR_DECODE)
1064 *p = (Z_AlternativeTerm *)odr_malloc(o, sizeof(**p));
1068 return opt && odr_ok(o);
1071 if (odr_sequence_of(o, (Odr_fun)z_AttributesPlusTerm, &(*p)->terms,
1072 &(*p)->num_terms, 0))
1075 return opt && !o->error;
1078 int z_ByDatabase(ODR o, Z_ByDatabase **p, int opt, const char *name)
1080 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1081 return opt && odr_ok(o);
1083 z_DatabaseName(o, &(*p)->db, 1, 0) &&
1084 odr_implicit(o, odr_integer, &(*p)->num, ODR_CONTEXT, 1, 1) &&
1085 z_OtherInformation(o, &(*p)->otherDbInfo, 1, 0) &&
1086 odr_sequence_end(o);
1089 int z_ByDatabaseList(ODR o, Z_ByDatabaseList **p, int opt, const char *name)
1091 if (!odr_initmember(o, p, sizeof(**p)))
1092 return opt && odr_ok(o);
1093 if (odr_sequence_of(o, (Odr_fun)z_ByDatabase, &(*p)->elements,
1094 &(*p)->num_elements, 0))
1097 return opt && odr_ok(o);
1100 int z_ScanOccurrences(ODR o, Z_ScanOccurrences **p, int opt, const char *name)
1104 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_ScanOccurrences_global,
1105 (Odr_fun)odr_integer, 0},
1106 {ODR_EXPLICIT, ODR_CONTEXT, 3, Z_ScanOccurrences_byDatabase,
1107 (Odr_fun)z_ByDatabaseList, 0},
1108 {-1, -1, -1, -1, 0, 0}
1111 if (!odr_initmember(o, p, sizeof(**p)))
1112 return opt && odr_ok(o);
1113 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
1116 return opt && odr_ok(o);
1119 int z_OccurrenceByAttributesElem(ODR o, Z_OccurrenceByAttributesElem **p,
1120 int opt, const char *name)
1122 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1123 return opt && odr_ok(o);
1125 odr_explicit(o, z_AttributeList, &(*p)->attributes, ODR_CONTEXT,
1127 z_ScanOccurrences(o, &(*p)->occurrences, 1, 0) &&
1128 z_OtherInformation(o, &(*p)->otherOccurInfo, 1, 0) &&
1129 odr_sequence_end(o);
1132 int z_OccurrenceByAttributes(ODR o, Z_OccurrenceByAttributes **p, int opt, const char *name)
1134 if (!odr_initmember(o, p, sizeof(**p)))
1135 return opt && odr_ok(o);
1136 if (!odr_sequence_of(o, (Odr_fun)z_OccurrenceByAttributesElem,
1137 &(*p)->elements, &(*p)->num_elements, 0))
1140 return opt && odr_ok(o);
1143 int z_TermInfo(ODR o, Z_TermInfo **p, int opt, const char *name)
1145 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1146 return opt && odr_ok(o);
1149 odr_implicit(o, z_Term, &(*p)->term, ODR_CONTEXT, 1, 0) :
1150 z_Term(o, &(*p)->term, 0, 0)) &&
1151 odr_implicit(o, z_InternationalString, &(*p)->displayTerm, ODR_CONTEXT,
1153 z_AttributeList(o, &(*p)->suggestedAttributes, 1, 0) &&
1154 odr_implicit(o, z_AlternativeTerm, &(*p)->alternativeTerm,
1155 ODR_CONTEXT, 4, 1) &&
1156 odr_implicit(o, odr_integer, &(*p)->globalOccurrences, ODR_CONTEXT,
1158 odr_implicit(o, z_OccurrenceByAttributes, &(*p)->byAttributes,
1159 ODR_CONTEXT, 3, 1) &&
1160 z_OtherInformation(o, &(*p)->otherTermInfo, 1, 0) &&
1161 odr_sequence_end(o);
1164 int z_Entry(ODR o, Z_Entry **p, int opt, const char *name)
1166 static Odr_arm arm[] =
1168 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Entry_termInfo,
1169 (Odr_fun)z_TermInfo, 0},
1170 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_Entry_surrogateDiagnostic,
1171 (Odr_fun)z_DiagRec, 0},
1172 {-1, -1, -1, -1, 0, 0}
1175 if (o->direction == ODR_DECODE)
1176 *p = (Z_Entry *)odr_malloc(o, sizeof(**p));
1180 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
1183 return opt && odr_ok(o);
1186 int z_ListEntries (ODR o, Z_ListEntries **p, int opt, const char *name)
1188 if (!odr_sequence_begin (o, p, sizeof(**p), 0))
1189 return opt && odr_ok (o);
1191 odr_implicit_settag (o, ODR_CONTEXT, 1) &&
1192 (odr_sequence_of(o, (Odr_fun) z_Entry, &(*p)->entries,
1193 &(*p)->num_entries, 0) || odr_ok(o)) &&
1194 odr_implicit_settag (o, ODR_CONTEXT, 2) &&
1195 (odr_sequence_of(o, (Odr_fun) z_DiagRec,
1196 &(*p)->nonsurrogateDiagnostics,
1197 &(*p)->num_nonsurrogateDiagnostics, 0)
1199 odr_sequence_end (o);
1202 int z_ScanRequest(ODR o, Z_ScanRequest **p, int opt, const char *name)
1204 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1205 return opt && odr_ok(o);
1208 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
1209 odr_implicit_settag(o, ODR_CONTEXT, 3) &&
1210 odr_sequence_of(o, z_DatabaseName, &(*p)->databaseNames,
1211 &(*p)->num_databaseNames, 0) &&
1212 odr_oid(o, &(*p)->attributeSet, 1, 0) &&
1213 (z_AttributesPlusTerm(o, &(*p)->termListAndStartPoint, 1, 0) ?
1214 ((*p)->termListAndStartPoint ? 1 :
1215 z_WillowAttributesPlusTerm(o, &(*p)->termListAndStartPoint, 0, 0))
1217 odr_implicit(o, odr_integer, &(*p)->stepSize, ODR_CONTEXT, 5, 1) &&
1218 odr_implicit(o, odr_integer, &(*p)->numberOfTermsRequested,
1219 ODR_CONTEXT, 6, 0) &&
1220 odr_implicit(o, odr_integer, &(*p)->preferredPositionInResponse,
1221 ODR_CONTEXT, 7, 1) &&
1222 z_OtherInformation(o, &(*p)->otherInfo, 1, "otherInfo") &&
1223 odr_sequence_end(o);
1226 int z_ScanResponse(ODR o, Z_ScanResponse **p, int opt, const char *name)
1228 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1229 return opt && odr_ok(o);
1231 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
1232 odr_implicit(o, odr_integer, &(*p)->stepSize, ODR_CONTEXT, 3, 1) &&
1233 odr_implicit(o, odr_integer, &(*p)->scanStatus, ODR_CONTEXT, 4, 0) &&
1234 odr_implicit(o, odr_integer, &(*p)->numberOfEntriesReturned,
1235 ODR_CONTEXT, 5, 0) &&
1236 odr_implicit(o, odr_integer, &(*p)->positionOfTerm,
1237 ODR_CONTEXT, 6, 1) &&
1238 odr_implicit(o, z_ListEntries, &(*p)->entries, ODR_CONTEXT, 7, 1) &&
1239 odr_implicit(o, odr_oid, &(*p)->attributeSet, ODR_CONTEXT, 8, 1) &&
1240 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
1241 odr_sequence_end(o);
1244 /* ------------------------ SEARCHRESPONSE ----------------*/
1246 int z_NumberOfRecordsReturned(ODR o, int **p, int opt, const char *name)
1248 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 24, opt);
1251 int z_NextResultSetPosition(ODR o, int **p, int opt, const char *name)
1253 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 25, opt);
1256 int z_PresentStatus(ODR o, int **p, int opt, const char *name)
1258 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 27, opt);
1261 int z_SearchResponse(ODR o, Z_SearchResponse **p, int opt, const char *name)
1263 Z_SearchResponse *pp;
1265 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1266 return opt && odr_ok(o);
1269 z_ReferenceId(o, &pp->referenceId, 1, 0) &&
1270 odr_implicit(o, odr_integer, &pp->resultCount, ODR_CONTEXT, 23, 0) &&
1271 z_NumberOfRecordsReturned(o, &pp->numberOfRecordsReturned, 0, 0) &&
1272 z_NextResultSetPosition(o, &pp->nextResultSetPosition, 0, 0) &&
1273 odr_implicit(o, odr_bool, &pp->searchStatus, ODR_CONTEXT, 22, 0) &&
1274 odr_implicit(o, odr_integer, &pp->resultSetStatus,
1275 ODR_CONTEXT, 26, 1) &&
1276 z_PresentStatus(o, &pp->presentStatus, 1, 0) &&
1277 z_Records(o, &pp->records, 1, 0) &&
1278 odr_implicit(o, z_OtherInformation, &(*p)->additionalSearchInfo,
1279 ODR_CONTEXT, 203, 1) &&
1280 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
1281 odr_sequence_end(o);
1284 /* --------------------- PRESENT SERVICE ---------------------- */
1286 int z_ElementSpec(ODR o, Z_ElementSpec **p, int opt, const char *name)
1288 static Odr_arm arm[] =
1290 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ElementSpec_elementSetName,
1291 odr_visiblestring, 0},
1292 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ElementSpec_externalSpec,
1293 (Odr_fun)z_External, 0},
1294 {-1, -1, -1, -1, 0, 0}
1297 if (o->direction == ODR_DECODE)
1298 *p = (Z_ElementSpec *)odr_malloc(o, sizeof(**p));
1302 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
1305 return opt && odr_ok(o);
1308 int z_Specification(ODR o, Z_Specification **p, int opt, const char *name)
1310 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1311 return opt && odr_ok(o);
1313 odr_implicit(o, odr_oid, &(*p)->schema, ODR_CONTEXT, 1, 1) &&
1314 z_ElementSpec(o, &(*p)->elementSpec, 1, 0) &&
1315 odr_sequence_end(o);
1318 int z_DbSpecific(ODR o, Z_DbSpecific **p, int opt, const char *name)
1320 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1321 return opt && odr_ok(o);
1323 odr_explicit(o, z_DatabaseName, &(*p)->databaseName, ODR_CONTEXT,
1325 odr_implicit(o, z_Specification, &(*p)->spec, ODR_CONTEXT, 2, 0) &&
1326 odr_sequence_end(o);
1329 int z_CompSpec(ODR o, Z_CompSpec **p, int opt, const char *name)
1331 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1332 return opt && odr_ok(o);
1334 odr_implicit(o, odr_bool, &(*p)->selectAlternativeSyntax, ODR_CONTEXT,
1336 odr_implicit(o, z_Specification, &(*p)->generic, ODR_CONTEXT, 2, 1) &&
1337 odr_implicit_settag(o, ODR_CONTEXT, 3) &&
1338 (odr_sequence_of(o, (Odr_fun)z_DbSpecific, &(*p)->dbSpecific,
1339 &(*p)->num_dbSpecific, 0) || odr_ok(o)) &&
1340 odr_implicit_settag(o, ODR_CONTEXT, 4) &&
1341 (odr_sequence_of(o, (Odr_fun)odr_oid, &(*p)->recordSyntax,
1342 &(*p)->num_recordSyntax, 0) || odr_ok(o)) &&
1343 odr_sequence_end(o);
1346 int z_RecordComposition(ODR o, Z_RecordComposition **p, int opt,
1349 static Odr_arm arm[] =
1351 {ODR_EXPLICIT, ODR_CONTEXT, 19, Z_RecordComp_simple,
1352 (Odr_fun)z_ElementSetNames, 0},
1353 {ODR_IMPLICIT, ODR_CONTEXT, 209, Z_RecordComp_complex,
1354 (Odr_fun)z_CompSpec, 0},
1355 {-1, -1, -1, -1, 0, 0}
1358 if (o->direction == ODR_DECODE)
1359 *p = (Z_RecordComposition *)odr_malloc(o, sizeof(**p));
1363 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
1366 return opt && odr_ok(o);
1369 int z_Range(ODR o, Z_Range **p, int opt, const char *name)
1371 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1372 return opt && odr_ok(o);
1374 odr_implicit(o, odr_integer, &(*p)->startingPosition,
1375 ODR_CONTEXT, 1, 0) &&
1376 odr_implicit(o, odr_integer, &(*p)->numberOfRecords,
1377 ODR_CONTEXT, 2, 0) &&
1378 odr_sequence_end(o);
1381 int z_PresentRequest(ODR o, Z_PresentRequest **p, int opt, const char *name)
1383 Z_PresentRequest *pp;
1385 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1386 return opt && odr_ok(o);
1389 z_ReferenceId(o, &pp->referenceId, 1, 0) &&
1390 z_ResultSetId(o, &pp->resultSetId, 0, 0) &&
1391 odr_implicit(o, odr_integer, &pp->resultSetStartPoint,
1392 ODR_CONTEXT, 30, 0) &&
1393 odr_implicit(o, odr_integer, &pp->numberOfRecordsRequested,
1394 ODR_CONTEXT, 29, 0) &&
1395 odr_implicit_settag(o, ODR_CONTEXT, 212) &&
1396 (odr_sequence_of(o, (Odr_fun)z_Range, &(*p)->additionalRanges,
1397 &(*p)->num_ranges, 0) || odr_ok(o)) &&
1398 z_RecordComposition(o, &(*p)->recordComposition, 1, 0) &&
1399 odr_implicit(o, odr_oid, &(*p)->preferredRecordSyntax, ODR_CONTEXT,
1401 odr_implicit(o, odr_integer, &(*p)->maxSegmentCount, ODR_CONTEXT,
1403 odr_implicit(o, odr_integer, &(*p)->maxRecordSize, ODR_CONTEXT,
1405 odr_implicit(o, odr_integer, &(*p)->maxSegmentSize, ODR_CONTEXT,
1407 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
1408 odr_sequence_end(o);
1411 int z_PresentResponse(ODR o, Z_PresentResponse **p, int opt, const char *name)
1413 Z_PresentResponse *pp;
1415 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1416 return opt && odr_ok(o);
1419 z_ReferenceId(o, &pp->referenceId, 1, 0) &&
1420 z_NumberOfRecordsReturned(o, &pp->numberOfRecordsReturned, 0, 0) &&
1421 z_NextResultSetPosition(o, &pp->nextResultSetPosition, 0, 0) &&
1422 z_PresentStatus(o, &pp->presentStatus, 0, 0) &&
1423 z_Records(o, &pp->records, 1, 0) &&
1424 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
1425 odr_sequence_end(o);
1428 /* ----------------------DELETE -------------------------- */
1430 int z_DeleteSetStatus(ODR o, int **p, int opt, const char *name)
1432 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 33, opt);
1435 int z_ListStatus(ODR o, Z_ListStatus **p, int opt, const char *name)
1437 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1438 return opt && odr_ok(o);
1440 z_ResultSetId(o, &(*p)->id, 0, 0) &&
1441 z_DeleteSetStatus(o, &(*p)->status, 0, 0) &&
1442 odr_sequence_end(o);
1445 int z_DeleteResultSetRequest(ODR o, Z_DeleteResultSetRequest **p, int opt,
1448 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1449 return opt && odr_ok(o);
1451 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
1452 odr_implicit(o, odr_integer, &(*p)->deleteFunction, ODR_CONTEXT, 32,
1454 (odr_sequence_of(o, z_ResultSetId, &(*p)->resultSetList,
1455 &(*p)->num_resultSetList, 0) || odr_ok(o)) &&
1456 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
1457 odr_sequence_end(o);
1460 int z_ListStatuses (ODR o, Z_ListStatuses **p, int opt, const char *name)
1462 if (!odr_initmember (o, p, sizeof(**p)))
1463 return opt && odr_ok(o);
1464 if (odr_sequence_of (o, (Odr_fun) z_ListStatus, &(*p)->elements,
1468 return opt && odr_ok(o);
1471 int z_DeleteResultSetResponse(ODR o, Z_DeleteResultSetResponse **p, int opt,
1474 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1475 return opt && odr_ok(o);
1477 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
1478 odr_implicit(o, z_DeleteSetStatus, &(*p)->deleteOperationStatus,
1479 ODR_CONTEXT, 0, 0) &&
1480 odr_implicit (o, z_ListStatuses,
1481 &(*p)->deleteListStatuses, ODR_CONTEXT, 1, 1) &&
1482 odr_implicit(o, odr_integer, &(*p)->numberNotDeleted, ODR_CONTEXT,
1484 odr_implicit (o, z_ListStatuses,
1485 &(*p)->bulkStatuses, ODR_CONTEXT, 35, 1) &&
1486 odr_implicit(o, odr_visiblestring, &(*p)->deleteMessage, ODR_CONTEXT,
1488 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
1489 odr_sequence_end(o);
1492 /* ------------------------ SEGMENT SERVICE -------------- */
1494 int z_Segment(ODR o, Z_Segment **p, int opt, const char *name)
1496 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1497 return opt && odr_ok(o);
1499 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
1500 odr_implicit(o, odr_integer, &(*p)->numberOfRecordsReturned,
1501 ODR_CONTEXT, 24, 0) &&
1502 odr_implicit_settag(o, ODR_CONTEXT, 0) &&
1503 odr_sequence_of(o, (Odr_fun)z_NamePlusRecord, &(*p)->segmentRecords,
1504 &(*p)->num_segmentRecords, 0) &&
1505 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
1506 odr_sequence_end(o);
1509 /* ------------------------ CLOSE SERVICE ---------------- */
1511 int z_Close(ODR o, Z_Close **p, int opt, const char *name)
1513 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1514 return opt && odr_ok(o);
1516 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
1517 odr_implicit(o, odr_integer, &(*p)->closeReason, ODR_CONTEXT, 211, 0)
1519 odr_implicit(o, odr_visiblestring, &(*p)->diagnosticInformation,
1520 ODR_CONTEXT, 3, 1) &&
1521 odr_implicit(o, odr_oid, &(*p)->resourceReportFormat, ODR_CONTEXT,
1523 odr_implicit(o, z_External, &(*p)->resourceReport, ODR_CONTEXT,
1525 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
1526 odr_sequence_end(o);
1529 /* ------------------------ APDU ------------------------- */
1531 int z_Permissions(ODR o, Z_Permissions **p, int opt, const char *name)
1533 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1534 return opt && odr_ok(o);
1536 odr_implicit(o, z_InternationalString, &(*p)->userId, ODR_CONTEXT,
1538 odr_implicit_settag(o, ODR_CONTEXT, 2) &&
1539 odr_sequence_of(o, (Odr_fun)odr_integer, &(*p)->allowableFunctions,
1540 &(*p)->num_allowableFunctions, 0) &&
1541 odr_sequence_end(o);
1544 int z_ExtendedServicesRequest(ODR o, Z_ExtendedServicesRequest **p, int opt,
1547 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1548 return opt && odr_ok(o);
1550 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
1551 odr_implicit(o, odr_integer, &(*p)->function, ODR_CONTEXT, 3, 0) &&
1552 odr_implicit(o, odr_oid, &(*p)->packageType, ODR_CONTEXT, 4, 0) &&
1553 odr_implicit(o, z_InternationalString, &(*p)->packageName,
1554 ODR_CONTEXT, 5, 1) &&
1555 odr_implicit(o, z_InternationalString, &(*p)->userId,
1556 ODR_CONTEXT, 6, 1) &&
1557 odr_implicit(o, z_IntUnit, &(*p)->retentionTime,
1558 ODR_CONTEXT, 7, 1) &&
1559 odr_implicit(o, z_Permissions, &(*p)->permissions,
1560 ODR_CONTEXT, 8, 1) &&
1561 odr_implicit(o, z_InternationalString, &(*p)->description,
1562 ODR_CONTEXT, 9, 1) &&
1563 odr_implicit(o, z_External, &(*p)->taskSpecificParameters,
1564 ODR_CONTEXT, 10, 1) &&
1565 odr_implicit(o, odr_integer, &(*p)->waitAction,
1566 ODR_CONTEXT, 11, 0) &&
1567 z_ElementSetName(o, &(*p)->elements, 1, 0) &&
1568 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
1569 odr_sequence_end(o);
1572 int z_ExtendedServicesResponse(ODR o, Z_ExtendedServicesResponse **p, int opt,
1575 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1576 return opt && odr_ok(o);
1578 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
1579 odr_implicit(o, odr_integer, &(*p)->operationStatus, ODR_CONTEXT,
1581 odr_implicit_settag(o, ODR_CONTEXT, 4) &&
1582 (odr_sequence_of(o, (Odr_fun)z_DiagRec, &(*p)->diagnostics,
1583 &(*p)->num_diagnostics, 0) || odr_ok(o)) &&
1584 odr_implicit(o, z_External, &(*p)->taskPackage, ODR_CONTEXT, 5, 1) &&
1585 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
1586 odr_sequence_end(o);
1589 /* ------------------------ SORT ------------------------- */
1591 int z_SortAttributes(ODR o, Z_SortAttributes **p, int opt, const char *name)
1593 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1594 return opt && odr_ok(o);
1596 odr_oid(o, &(*p)->id, 0, 0) &&
1597 z_AttributeList(o, &(*p)->list, 0, 0) &&
1598 odr_sequence_end(o);
1601 int z_SortKey(ODR o, Z_SortKey **p, int opt, const char *name)
1603 static Odr_arm arm[] =
1605 {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_SortKey_sortField,
1606 z_InternationalString, 0},
1607 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_SortKey_elementSpec,
1608 (Odr_fun)z_Specification, 0},
1609 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_SortKey_sortAttributes,
1610 (Odr_fun)z_SortAttributes, 0},
1614 if (!odr_initmember(o, p, sizeof(**p)))
1615 return opt && odr_ok(o);
1616 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
1619 return opt && odr_ok(o);
1622 int z_SortDbSpecific(ODR o, Z_SortDbSpecific **p, int opt, const char *name)
1624 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1625 return opt && odr_ok(o);
1627 z_DatabaseName(o, &(*p)->databaseName, 0, 0) &&
1628 z_SortKey(o, &(*p)->dbSort, 0, 0) &&
1629 odr_sequence_end(o);
1632 int z_SortDbSpecificList(ODR o, Z_SortDbSpecificList **p, int opt,
1635 if (!odr_initmember(o, p, sizeof(**p)))
1636 return opt && odr_ok(o);
1637 if (odr_sequence_of(o, (Odr_fun)z_SortDbSpecific, &(*p)->dbSpecific,
1638 &(*p)->num_dbSpecific, 0))
1641 return opt && odr_ok(o);
1644 int z_SortElement(ODR o, Z_SortElement **p, int opt, const char *name)
1646 static Odr_arm arm[] =
1648 {ODR_EXPLICIT, ODR_CONTEXT, 1, Z_SortElement_generic,
1649 (Odr_fun)z_SortKey, 0},
1650 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_SortElement_databaseSpecific,
1651 (Odr_fun)z_SortDbSpecificList, 0},
1652 {-1, -1, -1, -1, 0, 0}
1655 if (!odr_initmember(o, p, sizeof(**p)))
1656 return opt && odr_ok(o);
1657 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
1660 return opt && odr_ok(o);
1663 int z_SortMissingValueAction(ODR o, Z_SortMissingValueAction **p, int opt,
1666 static Odr_arm arm[] =
1668 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_SortMissingValAct_abort,
1669 (Odr_fun)odr_null, 0},
1670 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_SortMissingValAct_null,
1671 (Odr_fun)odr_null, 0},
1672 {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_SortMissingValAct_valData,
1673 (Odr_fun)odr_octetstring, 0},
1674 {-1, -1, -1, -1, 0, 0}
1677 if (!odr_initmember(o, p, sizeof(**p)))
1678 return opt && odr_ok(o);
1679 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
1682 return opt && odr_ok(o);
1685 int z_SortKeySpec(ODR o, Z_SortKeySpec **p, int opt, const char *name)
1687 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1688 return opt && odr_ok(o);
1690 z_SortElement(o, &(*p)->sortElement, 0, 0) &&
1691 odr_implicit(o, odr_integer, &(*p)->sortRelation, ODR_CONTEXT, 1, 0) &&
1692 odr_implicit(o, odr_integer, &(*p)->caseSensitivity,
1693 ODR_CONTEXT, 2, 0) &&
1694 odr_explicit(o, z_SortMissingValueAction, &(*p)->missingValueAction,
1695 ODR_CONTEXT, 3, 1) &&
1696 odr_sequence_end(o);
1699 int z_SortResponse(ODR o, Z_SortResponse **p, int opt, const char *name)
1701 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1702 return opt && odr_ok(o);
1704 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
1705 odr_implicit(o, odr_integer, &(*p)->sortStatus, ODR_CONTEXT,
1707 odr_implicit(o, odr_integer, &(*p)->resultSetStatus, ODR_CONTEXT,
1709 odr_implicit(o, z_DiagRecs, &(*p)->diagnostics, ODR_CONTEXT, 5, 1) &&
1710 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
1711 odr_sequence_end(o);
1714 int z_SortKeySpecList(ODR o, Z_SortKeySpecList **p, int opt, const char *name)
1716 if (!odr_initmember(o, p, sizeof(**p)))
1717 return opt && odr_ok(o);
1718 if (odr_sequence_of(o, (Odr_fun)z_SortKeySpec, &(*p)->specs,
1719 &(*p)->num_specs, 0))
1722 return opt && odr_ok(o);
1725 int z_SortRequest(ODR o, Z_SortRequest **p, int opt, const char *name)
1727 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1728 return opt && odr_ok(o);
1730 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
1731 odr_implicit(o, z_StringList, &(*p)->inputResultSetNames,
1732 ODR_CONTEXT, 3, 0) &&
1733 odr_implicit(o, z_InternationalString, &(*p)->sortedResultSetName,
1734 ODR_CONTEXT, 4, 0) &&
1735 odr_implicit(o, z_SortKeySpecList, &(*p)->sortSequence, ODR_CONTEXT,
1737 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
1738 odr_sequence_end(o);
1741 /* ---------------------- Resource Report ---------------- */
1743 int z_ResourceReportRequest(ODR o, Z_ResourceReportRequest **p, int opt,
1746 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1747 return opt && odr_ok(o);
1749 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
1750 odr_implicit(o, z_ReferenceId, &(*p)->opId, ODR_CONTEXT, 210, 1) &&
1751 odr_implicit(o, odr_oid, &(*p)->prefResourceReportFormat, ODR_CONTEXT,
1753 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
1754 odr_sequence_end(o);
1757 int z_ResourceReportResponse(ODR o, Z_ResourceReportResponse **p, int opt,
1760 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1761 return opt && odr_ok(o);
1763 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
1764 odr_implicit(o, odr_integer, &(*p)->resourceReportStatus,
1765 ODR_CONTEXT, 50, 0) &&
1766 odr_explicit(o, z_External, &(*p)->resourceReport, ODR_CONTEXT,
1768 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
1769 odr_sequence_end(o);
1772 /* ------------------------ APDU ------------------------- */
1774 int z_APDU(ODR o, Z_APDU **p, int opt, const char *name)
1776 static Odr_arm arm[] =
1778 {ODR_IMPLICIT, ODR_CONTEXT, 20, Z_APDU_initRequest,
1779 (Odr_fun)z_InitRequest, 0},
1780 {ODR_IMPLICIT, ODR_CONTEXT, 21, Z_APDU_initResponse,
1781 (Odr_fun)z_InitResponse, 0},
1782 {ODR_IMPLICIT, ODR_CONTEXT, 22, Z_APDU_searchRequest,
1783 (Odr_fun)z_SearchRequest, 0},
1784 {ODR_IMPLICIT, ODR_CONTEXT, 23, Z_APDU_searchResponse,
1785 (Odr_fun)z_SearchResponse, 0},
1786 {ODR_IMPLICIT, ODR_CONTEXT, 24, Z_APDU_presentRequest,
1787 (Odr_fun)z_PresentRequest, 0},
1788 {ODR_IMPLICIT, ODR_CONTEXT, 25, Z_APDU_presentResponse,
1789 (Odr_fun)z_PresentResponse, 0},
1790 {ODR_IMPLICIT, ODR_CONTEXT, 26, Z_APDU_deleteResultSetRequest,
1791 (Odr_fun)z_DeleteResultSetRequest, 0},
1792 {ODR_IMPLICIT, ODR_CONTEXT, 27, Z_APDU_deleteResultSetResponse,
1793 (Odr_fun)z_DeleteResultSetResponse, 0},
1794 {ODR_IMPLICIT, ODR_CONTEXT, 28, Z_APDU_accessControlRequest,
1795 (Odr_fun)z_AccessControlRequest, 0},
1796 {ODR_IMPLICIT, ODR_CONTEXT, 29, Z_APDU_accessControlResponse,
1797 (Odr_fun)z_AccessControlResponse, 0},
1798 {ODR_IMPLICIT, ODR_CONTEXT, 30, Z_APDU_resourceControlRequest,
1799 (Odr_fun)z_ResourceControlRequest, 0},
1800 {ODR_IMPLICIT, ODR_CONTEXT, 31, Z_APDU_resourceControlResponse,
1801 (Odr_fun)z_ResourceControlResponse, 0},
1802 {ODR_IMPLICIT, ODR_CONTEXT, 32, Z_APDU_triggerResourceControlRequest,
1803 (Odr_fun)z_TriggerResourceControlRequest, 0},
1804 {ODR_IMPLICIT, ODR_CONTEXT, 33, Z_APDU_resourceReportRequest,
1805 (Odr_fun)z_ResourceReportRequest, 0},
1806 {ODR_IMPLICIT, ODR_CONTEXT, 34, Z_APDU_resourceReportResponse,
1807 (Odr_fun)z_ResourceReportResponse, 0},
1808 {ODR_IMPLICIT, ODR_CONTEXT, 35, Z_APDU_scanRequest,
1809 (Odr_fun)z_ScanRequest, 0},
1810 {ODR_IMPLICIT, ODR_CONTEXT, 36, Z_APDU_scanResponse,
1811 (Odr_fun)z_ScanResponse, 0},
1812 {ODR_IMPLICIT, ODR_CONTEXT, 43, Z_APDU_sortRequest,
1813 (Odr_fun)z_SortRequest, 0},
1814 {ODR_IMPLICIT, ODR_CONTEXT, 44, Z_APDU_sortResponse,
1815 (Odr_fun)z_SortResponse, 0},
1816 {ODR_IMPLICIT, ODR_CONTEXT, 45, Z_APDU_segmentRequest,
1817 (Odr_fun)z_Segment, 0},
1818 {ODR_IMPLICIT, ODR_CONTEXT, 46, Z_APDU_extendedServicesRequest,
1819 (Odr_fun)z_ExtendedServicesRequest, 0},
1820 {ODR_IMPLICIT, ODR_CONTEXT, 47, Z_APDU_extendedServicesResponse,
1821 (Odr_fun)z_ExtendedServicesResponse},
1822 {ODR_IMPLICIT, ODR_CONTEXT, 48, Z_APDU_close,
1823 (Odr_fun)z_Close, 0},
1824 {-1, -1, -1, -1, 0, 0}
1827 if (o->direction == ODR_DECODE)
1828 *p = (Z_APDU *)odr_malloc(o, sizeof(**p));
1829 odr_setlenlen(o, 5);
1830 if (!odr_choice(o, arm, &(*p)->u, &(*p)->which, name))
1832 if (o->direction == ODR_DECODE)
1834 return opt && odr_ok(o);