2 * Copyright (c) 1995-1999, Index Data
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.61 1999-11-30 13:47:10 adam
8 * Improved installation. Moved header files to include/yaz.
10 * Revision 1.60 1999/06/11 16:45:59 adam
11 * Fixed minor bug in ScanRequest encoder.
13 * Revision 1.59 1999/04/21 11:46:00 adam
14 * Fixed bug in {en,de}coder for OtherInformation.
16 * Revision 1.58 1999/04/20 09:56:47 adam
17 * Added 'name' paramter to encoder/decoder routines (typedef Odr_fun).
18 * Modified all encoders/decoders to reflect this change.
20 * Revision 1.57 1998/10/20 13:55:37 quinn
21 * Fixed Scan bug in asn and client
23 * Revision 1.56 1998/08/19 16:10:04 adam
24 * Changed som member names of DeleteResultSetRequest/Response.
26 * Revision 1.55 1998/02/11 11:53:32 adam
27 * Changed code so that it compiles as C++.
29 * Revision 1.54 1996/11/11 13:14:46 adam
30 * Fixed tagging bug in z_ProximityOperator.
32 * Revision 1.53 1996/10/09 15:54:55 quinn
33 * Added SearchInfoReport
35 * Revision 1.52 1996/10/08 12:56:57 adam
36 * Bug fix: tagging of type 101 query.
38 * Revision 1.51 1996/07/26 14:07:21 quinn
41 * Revision 1.50 1996/07/26 13:36:15 quinn
44 * Revision 1.49 1996/07/06 19:58:28 quinn
45 * System headerfiles gathered in yconfig
47 * Revision 1.48 1996/06/10 08:53:33 quinn
48 * Added Summary,OPAC,ResourceReport
50 * Revision 1.47 1996/05/29 15:47:50 quinn
51 * Fixed in bug DiagRecs decoder. Thanks to Linda Harris.
53 * Revision 1.46 1996/04/10 11:39:42 quinn
54 * Fixed bug in UserInfo
56 * Revision 1.45 1996/02/23 10:00:25 quinn
59 * Revision 1.44 1996/02/20 12:51:41 quinn
60 * Completed SCAN. Fixed problems with EXTERNAL.
62 * Revision 1.43 1996/02/10 12:22:49 quinn
65 * Revision 1.42 1996/01/22 09:46:31 quinn
66 * Added Sort PDU. Moved StringList to main protocol file.
68 * Revision 1.41 1996/01/10 15:21:24 quinn
69 * Added links to access control PDUs
71 * Revision 1.40 1996/01/02 11:46:40 quinn
72 * Changed 'operator' to 'roperator' to avoid C++ conflict.
74 * Revision 1.39 1995/09/29 17:11:53 quinn
77 * Revision 1.38 1995/09/27 15:02:40 quinn
78 * Modified function heads & prototypes.
80 * Revision 1.37 1995/08/21 09:10:15 quinn
81 * Smallish fixes to suppport new formats.
83 * Revision 1.36 1995/08/15 11:59:39 quinn
86 * Revision 1.35 1995/08/10 08:53:59 quinn
89 * Revision 1.34 1995/06/19 17:01:48 quinn
90 * This should bring us in sync with the version distributed as 1.0b
92 * Revision 1.33 1995/06/19 13:39:56 quinn
93 * *** empty log message ***
95 * Revision 1.32 1995/06/19 12:37:28 quinn
96 * Fixed a bug in the compspec.
98 * Revision 1.31 1995/06/16 13:15:56 quinn
99 * Fixed Defaultdiagformat.
101 * Revision 1.30 1995/06/15 15:42:01 quinn
104 * Revision 1.29 1995/06/15 07:44:49 quinn
107 * Revision 1.28 1995/06/14 15:26:35 quinn
108 * *** empty log message ***
110 * Revision 1.27 1995/06/07 14:36:22 quinn
113 * Revision 1.26 1995/06/02 09:49:13 quinn
114 * Adding access control
116 * Revision 1.25 1995/05/25 11:00:08 quinn
117 * *** empty log message ***
119 * Revision 1.24 1995/05/22 13:58:18 quinn
120 * Fixed an ODR_NULLVAL.
122 * Revision 1.23 1995/05/22 11:30:18 quinn
123 * Adding Z39.50-1992 stuff to proto.c. Adding zget.c
125 * Revision 1.22 1995/05/17 08:40:56 quinn
126 * Added delete. Fixed some sequence_begins. Smallish.
128 * Revision 1.21 1995/05/16 08:50:24 quinn
129 * License, documentation, and memory fixes
131 * Revision 1.20 1995/05/15 11:55:25 quinn
134 * Revision 1.19 1995/04/11 11:58:35 quinn
137 * Revision 1.18 1995/04/11 11:52:02 quinn
138 * Fixed possible buf in proto.c
140 * Revision 1.17 1995/04/10 10:22:22 quinn
143 * Revision 1.16 1995/03/30 10:26:43 quinn
144 * Added Term structure
146 * Revision 1.15 1995/03/30 09:08:39 quinn
147 * Added Resource control protocol
149 * Revision 1.14 1995/03/29 08:06:13 quinn
150 * Added a few v3 elements
152 * Revision 1.13 1995/03/20 11:26:52 quinn
153 * *** empty log message ***
155 * Revision 1.12 1995/03/20 09:45:09 quinn
158 * Revision 1.11 1995/03/17 10:17:25 quinn
159 * Added memory management.
161 * Revision 1.10 1995/03/15 11:17:40 quinn
162 * Fixed some return-checks from choice.. need better ay to handle those..
164 * Revision 1.9 1995/03/15 08:37:06 quinn
165 * Fixed protocol bugs.
167 * Revision 1.8 1995/03/14 16:59:24 quinn
168 * Fixed OPTIONAL flag in attributeelement
170 * Revision 1.7 1995/03/07 16:29:33 quinn
171 * Added authentication stuff.
173 * Revision 1.6 1995/03/01 14:46:03 quinn
174 * Fixed protocol bug in 8777query.
176 * Revision 1.5 1995/02/14 11:54:22 quinn
179 * Revision 1.4 1995/02/10 15:54:30 quinn
182 * Revision 1.3 1995/02/09 15:51:39 quinn
185 * Revision 1.2 1995/02/06 21:26:07 quinn
186 * Repaired this evening's damages..
188 * Revision 1.1 1995/02/06 16:44:47 quinn
189 * First hack at Z/SR protocol
195 #include <yaz/proto.h>
197 /* ---------------------- GLOBAL DEFS ------------------- */
200 * We'll use a general octetstring here, since string operations are
201 * clumsy on long strings.
203 int z_SUTRS(ODR o, Odr_oct **p, int opt, const char *name)
205 return odr_implicit(o, odr_octetstring, p, ODR_UNIVERSAL,
206 ODR_GENERALSTRING, opt);
209 int z_ReferenceId(ODR o, Z_ReferenceId **p, int opt, const char *name)
211 return odr_implicit(o, odr_octetstring, (Odr_oct**) p, ODR_CONTEXT, 2,
215 int z_DatabaseName(ODR o, Z_DatabaseName **p, int opt, const char *name)
217 return odr_implicit(o, odr_visiblestring, (char **) p, ODR_CONTEXT, 105,
221 int z_ResultSetId(ODR o, char **p, int opt, const char *name)
223 return odr_implicit(o, odr_visiblestring, (char **) p, ODR_CONTEXT, 31,
227 int z_ElementSetName(ODR o, char **p, int opt, const char *name)
229 return odr_implicit(o, odr_visiblestring, p, ODR_CONTEXT, 103, opt);
232 int z_UserInformationField(ODR o, Z_External **p, int opt, const char *name)
234 return odr_explicit(o, z_External, (Z_External **)p, ODR_CONTEXT,
238 int z_InternationalString(ODR o, char **p, int opt, const char *name)
240 return odr_generalstring(o, p, opt, 0);
243 int z_InfoCategory(ODR o, Z_InfoCategory **p, int opt, const char *name)
245 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
246 return opt && odr_ok(o);
248 odr_implicit(o, odr_oid, &(*p)->categoryTypeId, ODR_CONTEXT, 1, 1) &&
249 odr_implicit(o, odr_integer, &(*p)->categoryValue, ODR_CONTEXT, 2,
254 int z_OtherInformationUnit(ODR o, Z_OtherInformationUnit **p, int opt,
257 static Odr_arm arm[] =
259 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_OtherInfo_characterInfo,
260 odr_visiblestring, 0},
261 {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_OtherInfo_binaryInfo,
262 (Odr_fun)odr_octetstring, 0},
263 {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_OtherInfo_externallyDefinedInfo,
264 (Odr_fun)z_External, 0},
265 {ODR_IMPLICIT, ODR_CONTEXT, 5, Z_OtherInfo_oid,
266 (Odr_fun)odr_oid, 0},
267 {-1, -1, -1, -1, 0, 0}
270 if (!odr_sequence_begin(o, p, sizeof(**p), name))
271 return opt && odr_ok(o);
273 odr_implicit(o, z_InfoCategory, &(*p)->category, ODR_CONTEXT, 1, 1) &&
274 odr_choice(o, arm, &(*p)->information, &(*p)->which, name) &&
278 int z_OtherInformation(ODR o, Z_OtherInformation **p, int opt,
281 if (!odr_initmember (o, p, sizeof(**p)))
282 return opt && odr_ok(o);
283 odr_implicit_settag(o, ODR_CONTEXT, 201);
284 if (odr_sequence_of(o, (Odr_fun)z_OtherInformationUnit, &(*p)->list,
285 &(*p)->num_elements, name))
288 return opt && odr_ok(o);
291 int z_StringOrNumeric(ODR o, Z_StringOrNumeric **p, int opt, const char *name)
293 static Odr_arm arm[] =
295 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_StringOrNumeric_string,
296 odr_visiblestring, 0},
297 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_StringOrNumeric_numeric,
298 (Odr_fun)odr_integer, 0},
299 {-1, -1, -1, -1, 0, 0}
302 if (o->direction == ODR_DECODE)
303 *p = (Z_StringOrNumeric *)odr_malloc(o, sizeof(**p));
306 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
309 return opt && odr_ok(o);
315 int z_Unit(ODR o, Z_Unit **p, int opt, const char *name)
317 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
318 return opt && odr_ok(o);
320 odr_explicit(o, z_InternationalString, &(*p)->unitSystem, ODR_CONTEXT,
322 odr_explicit(o, z_StringOrNumeric, &(*p)->unitType, ODR_CONTEXT,
324 odr_explicit(o, z_StringOrNumeric, &(*p)->unit, ODR_CONTEXT, 3, 1) &&
325 odr_implicit(o, odr_integer, &(*p)->scaleFactor, ODR_CONTEXT, 4, 1) &&
329 int z_IntUnit(ODR o, Z_IntUnit **p, int opt, const char *name)
331 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
332 return opt && odr_ok(o);
334 odr_implicit(o, odr_integer, &(*p)->value, ODR_CONTEXT, 1, 0) &&
335 odr_implicit(o, z_Unit, &(*p)->unitUsed, ODR_CONTEXT, 2, 0) &&
339 int z_StringList(ODR o, Z_StringList **p, int opt, const char *name)
341 if (o->direction == ODR_DECODE)
342 *p = (Z_StringList *)odr_malloc(o, sizeof(**p));
345 if (odr_sequence_of(o, (Odr_fun)z_InternationalString, &(*p)->strings,
346 &(*p)->num_strings, 0))
349 return opt && odr_ok(o);
352 /* ---------------------- INITIALIZE SERVICE ------------------- */
355 int z_NSRAuthentication(ODR o, Z_NSRAuthentication **p, int opt,
358 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
359 return opt && odr_ok(o);
361 odr_visiblestring(o, &(*p)->user, 0, 0) &&
362 odr_visiblestring(o, &(*p)->password, 0, 0) &&
363 odr_visiblestring(o, &(*p)->account, 0, 0) &&
368 int z_IdPass(ODR o, Z_IdPass **p, int opt, const char *name)
370 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
371 return opt && odr_ok(o);
373 odr_implicit(o, odr_visiblestring, &(*p)->groupId, ODR_CONTEXT, 0,
375 odr_implicit(o, odr_visiblestring, &(*p)->userId, ODR_CONTEXT, 1, 1) &&
376 odr_implicit(o, odr_visiblestring, &(*p)->password, ODR_CONTEXT, 2,
381 int z_StrAuthentication(ODR o, char **p, int opt, const char *name)
383 return odr_visiblestring(o, p, opt, 0);
386 int z_IdAuthentication(ODR o, Z_IdAuthentication **p, int opt,
389 static Odr_arm arm[] =
391 {-1, -1, -1, Z_IdAuthentication_open, z_StrAuthentication, 0},
392 {-1, -1, -1, Z_IdAuthentication_idPass, (Odr_fun)z_IdPass, 0},
393 {-1, -1, -1, Z_IdAuthentication_anonymous, (Odr_fun)odr_null, 0},
394 {-1, -1, -1, Z_IdAuthentication_other, (Odr_fun)z_External, 0},
395 {-1, -1, -1, -1, 0, 0}
398 if (o->direction == ODR_DECODE)
399 *p = (Z_IdAuthentication *)odr_malloc(o, sizeof(**p));
403 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
406 return opt && odr_ok(o);
409 int z_InitRequest(ODR o, Z_InitRequest **p, int opt, const char *name)
413 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
414 return opt && odr_ok(o);
417 z_ReferenceId(o, &pp->referenceId, 1, 0) &&
418 odr_implicit(o, odr_bitstring, &pp->protocolVersion,
419 ODR_CONTEXT, 3, 0) &&
420 odr_implicit(o, odr_bitstring, &pp->options, ODR_CONTEXT, 4, 0) &&
421 odr_implicit(o, odr_integer, &pp->preferredMessageSize, ODR_CONTEXT,
423 odr_implicit(o, odr_integer, &pp->maximumRecordSize,
424 ODR_CONTEXT, 6, 0) &&
425 odr_explicit(o, z_IdAuthentication, &pp->idAuthentication,
426 ODR_CONTEXT, 7, 1) &&
427 odr_implicit(o, odr_visiblestring, &pp->implementationId,
428 ODR_CONTEXT, 110, 1) &&
429 odr_implicit(o, odr_visiblestring, &pp->implementationName,
430 ODR_CONTEXT, 111, 1) &&
431 odr_implicit(o, odr_visiblestring, &pp->implementationVersion,
432 ODR_CONTEXT, 112, 1) &&
433 z_UserInformationField(o, &pp->userInformationField, 1, 0) &&
434 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
438 int z_InitResponse(ODR o, Z_InitResponse **p, int opt, const char *name)
442 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
443 return opt && odr_ok(o);
446 z_ReferenceId(o, &pp->referenceId, 1, 0) &&
447 odr_implicit(o, odr_bitstring, &pp->protocolVersion,
448 ODR_CONTEXT, 3, 0) &&
449 odr_implicit(o, odr_bitstring, &pp->options, ODR_CONTEXT, 4, 0) &&
450 odr_implicit(o, odr_integer, &pp->preferredMessageSize,
451 ODR_CONTEXT, 5, 0) &&
452 odr_implicit(o, odr_integer, &pp->maximumRecordSize,
453 ODR_CONTEXT, 6, 0) &&
454 odr_implicit(o, odr_bool, &pp->result, ODR_CONTEXT, 12, 0) &&
455 odr_implicit(o, odr_visiblestring, &pp->implementationId,
456 ODR_CONTEXT, 110, 1) &&
457 odr_implicit(o, odr_visiblestring, &pp->implementationName,
458 ODR_CONTEXT, 111, 1) &&
459 odr_implicit(o, odr_visiblestring, &pp->implementationVersion,
460 ODR_CONTEXT, 112, 1) &&
461 z_UserInformationField(o, &pp->userInformationField, 1, 0) &&
462 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
466 /* ------------------ RESOURCE CONTROL ----------------*/
468 int z_TriggerResourceControlRequest(ODR o, Z_TriggerResourceControlRequest **p,
469 int opt, const char *name)
471 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
472 return opt && odr_ok(o);
474 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
475 odr_implicit(o, odr_integer, &(*p)->requestedAction, ODR_CONTEXT,
477 odr_implicit(o, odr_oid, &(*p)->prefResourceReportFormat,
478 ODR_CONTEXT, 47, 1) &&
479 odr_implicit(o, odr_bool, &(*p)->resultSetWanted, ODR_CONTEXT,
481 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
485 int z_ResourceControlRequest(ODR o, Z_ResourceControlRequest **p, int opt,
488 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
489 return opt && odr_ok(o);
491 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
492 odr_implicit(o, odr_bool, &(*p)->suspendedFlag, ODR_CONTEXT, 39, 1)&&
493 odr_explicit(o, z_External, &(*p)->resourceReport, ODR_CONTEXT,
495 odr_implicit(o, odr_integer, &(*p)->partialResultsAvailable,
496 ODR_CONTEXT, 41, 1) &&
497 odr_implicit(o, odr_bool, &(*p)->responseRequired, ODR_CONTEXT,
499 odr_implicit(o, odr_bool, &(*p)->triggeredRequestFlag,
500 ODR_CONTEXT, 43, 1) &&
501 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
505 int z_ResourceControlResponse(ODR o, Z_ResourceControlResponse **p, int opt,
508 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
509 return opt && odr_ok(o);
511 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
512 odr_implicit(o, odr_bool, &(*p)->continueFlag, ODR_CONTEXT, 44, 0) &&
513 odr_implicit(o, odr_bool, &(*p)->resultSetWanted, ODR_CONTEXT,
515 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
519 /* ------------------------ SEARCH SERVICE ----------------------- */
521 int z_DatabaseSpecificUnit(ODR o, Z_DatabaseSpecificUnit **p, int opt,
524 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
525 return opt && odr_ok(o);
527 z_DatabaseName(o, &(*p)->databaseName, 0, 0) &&
528 z_ElementSetName(o, &(*p)->elementSetName, 0, 0) &&
532 int z_DatabaseSpecific(ODR o, Z_DatabaseSpecific **p, int opt,
535 if (o->direction == ODR_DECODE)
536 *p = (Z_DatabaseSpecific *)odr_malloc(o, sizeof(**p));
540 odr_implicit_settag(o, ODR_CONTEXT, 1);
541 if (odr_sequence_of(o, (Odr_fun)z_DatabaseSpecificUnit, &(*p)->elements,
542 &(*p)->num_elements, 0))
548 int z_ElementSetNames(ODR o, Z_ElementSetNames **p, int opt, const char *name)
550 static Odr_arm arm[] =
552 {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_ElementSetNames_generic,
553 z_ElementSetName, 0},
554 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ElementSetNames_databaseSpecific,
555 (Odr_fun)z_DatabaseSpecific, 0},
559 if (o->direction == ODR_DECODE)
560 *p = (Z_ElementSetNames *)odr_malloc(o, sizeof(**p));
562 return opt && odr_ok(o);
564 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
570 /* ----------------------- RPN QUERY -----------------------*/
572 int z_ComplexAttribute(ODR o, Z_ComplexAttribute **p, int opt,
575 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
576 return opt && odr_ok(o);
578 odr_implicit_settag(o, ODR_CONTEXT, 1) &&
579 odr_sequence_of(o, (Odr_fun)z_StringOrNumeric, &(*p)->list,
580 &(*p)->num_list, 0) &&
581 odr_implicit_settag(o, ODR_CONTEXT, 2) &&
582 (odr_sequence_of(o, (Odr_fun)odr_integer, &(*p)->semanticAction,
583 &(*p)->num_semanticAction, 0) || odr_ok(o)) &&
587 int z_AttributeElement(ODR o, Z_AttributeElement **p, int opt,
590 static Odr_arm arm[] =
592 {ODR_IMPLICIT, ODR_CONTEXT, 121, Z_AttributeValue_numeric,
593 (Odr_fun)odr_integer, 0},
594 {ODR_IMPLICIT, ODR_CONTEXT, 224, Z_AttributeValue_complex,
595 (Odr_fun)z_ComplexAttribute, 0},
596 {-1, -1, -1, -1, 0, 0}
598 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
599 return opt && odr_ok(o);
601 odr_implicit(o, odr_oid, &(*p)->attributeSet, ODR_CONTEXT, 1, 1) &&
602 odr_implicit(o, odr_integer, &(*p)->attributeType, ODR_CONTEXT,
604 odr_choice(o, arm, &(*p)->value, &(*p)->which, 0) &&
608 int z_Term(ODR o, Z_Term **p, int opt, const char *name)
610 static Odr_arm arm[] =
612 {ODR_IMPLICIT, ODR_CONTEXT, 45, Z_Term_general,
613 (Odr_fun)odr_octetstring, 0},
614 {ODR_IMPLICIT, ODR_CONTEXT, 215, Z_Term_numeric,
615 (Odr_fun)odr_integer, 0},
616 {ODR_IMPLICIT, ODR_CONTEXT, 216, Z_Term_characterString,
617 odr_visiblestring, 0},
618 {ODR_IMPLICIT, ODR_CONTEXT, 217, Z_Term_oid, (Odr_fun)odr_oid, 0},
619 {ODR_IMPLICIT, ODR_CONTEXT, 218, Z_Term_dateTime, odr_cstring, 0},
620 {ODR_IMPLICIT, ODR_CONTEXT, 219, Z_Term_external,
621 (Odr_fun) z_External, 0},
622 /* add intUnit here */
623 {ODR_IMPLICIT, ODR_CONTEXT, 221, Z_Term_null, (Odr_fun)odr_null, 0},
624 {-1, -1, -1, -1, 0, 0}
627 if (o->direction ==ODR_DECODE)
628 *p = (Z_Term *)odr_malloc(o, sizeof(**p));
631 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
634 return opt && odr_ok(o);
637 int z_AttributesPlusTerm(ODR o, Z_AttributesPlusTerm **p, int opt,
640 if (!(odr_implicit_settag(o, ODR_CONTEXT, 102) &&
641 odr_sequence_begin(o, p, sizeof(**p), 0)))
642 return opt && odr_ok(o);
644 odr_implicit_settag(o, ODR_CONTEXT, 44) &&
645 odr_sequence_of(o, (Odr_fun)z_AttributeElement, &(*p)->attributeList,
646 &(*p)->num_attributes, 0) &&
647 z_Term(o, &(*p)->term, 0, 0) &&
651 int z_ResultSetPlusAttributes(ODR o, Z_ResultSetPlusAttributes **p, int opt,
654 if (!(odr_implicit_settag(o, ODR_CONTEXT, 214) &&
655 odr_sequence_begin(o, p, sizeof(**p), 0)))
656 return opt && odr_ok(o);
658 z_ResultSetId(o, &(*p)->resultSet, 0, 0) &&
659 odr_implicit_settag(o, ODR_CONTEXT, 44) &&
660 odr_sequence_of(o, (Odr_fun)z_AttributeElement, &(*p)->attributeList,
661 &(*p)->num_attributes, 0) &&
665 int z_ProximityOperator(ODR o, Z_ProximityOperator **p, int opt,
668 static Odr_arm arm[] =
670 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ProxCode_known,
671 (Odr_fun)odr_integer, 0},
672 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ProxCode_private,
673 (Odr_fun)odr_integer, 0},
674 {-1, -1, -1, -1, 0, 0}
677 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
678 return opt && odr_ok(o);
680 odr_implicit(o, odr_bool, &(*p)->exclusion, ODR_CONTEXT, 1, 1) &&
681 odr_implicit(o, odr_integer, &(*p)->distance, ODR_CONTEXT, 2, 0) &&
682 odr_implicit(o, odr_bool, &(*p)->ordered, ODR_CONTEXT, 3, 0) &&
683 odr_implicit(o, odr_integer, &(*p)->relationType, ODR_CONTEXT, 4, 0) &&
684 odr_constructed_begin(o, &(*p)->proximityUnitCode,
685 ODR_CONTEXT, 5, 0) &&
686 odr_choice(o, arm, &(*p)->proximityUnitCode, &(*p)->which, 0) &&
687 odr_constructed_end(o) &&
691 int z_Operator(ODR o, Z_Operator **p, int opt, const char *name)
693 static Odr_arm arm[] =
695 {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_Operator_and, (Odr_fun)odr_null, 0},
696 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Operator_or, (Odr_fun)odr_null, 0},
697 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Operator_and_not,
698 (Odr_fun)odr_null, 0},
699 {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_Operator_prox,
700 (Odr_fun)z_ProximityOperator, 0},
701 {-1, -1, -1, -1, 0, 0}
704 if (!*p && o->direction != ODR_DECODE)
706 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 46, 0))
707 return opt && odr_ok(o);
708 if (o->direction == ODR_DECODE)
709 *p = (Z_Operator *)odr_malloc(o, sizeof(**p));
711 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0) &&
712 odr_constructed_end(o))
715 return opt && odr_ok(o);
718 int z_Operand(ODR o, Z_Operand **p, int opt, const char *name)
720 static Odr_arm arm[] =
722 {-1, -1, -1, Z_Operand_APT, (Odr_fun)z_AttributesPlusTerm, 0},
723 {-1, -1, -1, Z_Operand_resultSetId, (Odr_fun)z_ResultSetId, 0},
724 {-1, -1, -1, Z_Operand_resultAttr,
725 (Odr_fun)z_ResultSetPlusAttributes, 0},
726 {-1, -1, -1, -1, 0, 0}
729 if (o->direction == ODR_DECODE)
730 *p = (Z_Operand *)odr_malloc(o, sizeof(**p));
733 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
736 return opt && odr_ok(o);
739 int z_RPNStructure(ODR o, Z_RPNStructure **p, int opt, const char *name);
741 int z_Complex(ODR o, Z_Complex **p, int opt, const char *name)
743 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
744 return opt && odr_ok(o);
746 z_RPNStructure(o, &(*p)->s1, 0, 0) &&
747 z_RPNStructure(o, &(*p)->s2, 0, 0) &&
748 z_Operator(o, &(*p)->roperator, 0, 0) &&
752 int z_RPNStructure(ODR o, Z_RPNStructure **p, int opt, const char *name)
754 static Odr_arm arm[] =
756 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_RPNStructure_simple,
757 (Odr_fun)z_Operand, 0},
758 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_RPNStructure_complex,
759 (Odr_fun)z_Complex, 0},
760 {-1 -1, -1, -1, 0, 0}
763 if (o->direction == ODR_DECODE)
764 *p = (Z_RPNStructure *)odr_malloc(o, sizeof(**p));
767 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
770 return opt && odr_ok(o);
773 int z_RPNQuery(ODR o, Z_RPNQuery **p, int opt, const char *name)
775 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
776 return opt && odr_ok(o);
778 odr_oid(o, &(*p)->attributeSetId, 0, 0) &&
779 z_RPNStructure(o, &(*p)->RPNStructure, 0, 0) &&
783 /* -----------------------END RPN QUERY ----------------------- */
785 int z_Query(ODR o, Z_Query **p, int opt, const char *name)
787 static Odr_arm arm[] =
789 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Query_type_1,
790 (Odr_fun)z_RPNQuery, 0},
791 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_Query_type_2,
792 (Odr_fun)odr_octetstring, 0},
793 {ODR_IMPLICIT, ODR_CONTEXT, 101, Z_Query_type_101,
794 (Odr_fun)z_RPNQuery, 0},
795 {-1, -1, -1, -1, 0, 0}
798 if (o->direction == ODR_DECODE)
799 *p = (Z_Query *)odr_malloc(o, sizeof(**p));
802 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
805 return opt && odr_ok(o);
808 int z_SearchRequest(ODR o, Z_SearchRequest **p, int opt, const char *name)
812 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
813 return opt && odr_ok(o);
816 z_ReferenceId(o, &pp->referenceId, 1, 0) &&
817 odr_implicit(o, odr_integer, &pp->smallSetUpperBound, ODR_CONTEXT,
819 odr_implicit(o, odr_integer, &pp->largeSetLowerBound, ODR_CONTEXT,
821 odr_implicit(o, odr_integer, &pp->mediumSetPresentNumber, ODR_CONTEXT,
823 odr_implicit(o, odr_bool, &pp->replaceIndicator, ODR_CONTEXT, 16, 1) &&
824 odr_implicit(o, odr_visiblestring, &pp->resultSetName, ODR_CONTEXT,
826 odr_implicit_settag(o, ODR_CONTEXT, 18) &&
827 odr_sequence_of(o, z_DatabaseName, &pp->databaseNames,
828 &pp->num_databaseNames, 0) &&
829 odr_explicit(o, z_ElementSetNames, &pp->smallSetElementSetNames,
830 ODR_CONTEXT, 100, 1) &&
831 odr_explicit(o, z_ElementSetNames, &pp->mediumSetElementSetNames,
832 ODR_CONTEXT, 101, 1) &&
833 odr_implicit(o, odr_oid, &pp->preferredRecordSyntax,
834 ODR_CONTEXT, 104, 1) &&
835 odr_explicit(o, z_Query, &pp->query, ODR_CONTEXT, 21, 0) &&
836 odr_implicit_tag(o, z_OtherInformation, &(*p)->additionalSearchInfo,
837 ODR_CONTEXT, 203, 1, 0) &&
838 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
842 /* ------------------------ RECORD ------------------------- */
844 int z_DatabaseRecord(ODR o, Z_DatabaseRecord **p, int opt, const char *name)
846 return z_External(o, (Z_External **) p, opt, 0);
849 int z_DefaultDiagFormat(ODR o, Z_DefaultDiagFormat **p, int opt,
852 static Odr_arm arm[] =
854 {-1, -1, -1, Z_DiagForm_v2AddInfo, odr_visiblestring, 0},
855 {-1, -1, -1, Z_DiagForm_v3AddInfo, z_InternationalString, 0},
856 {ODR_IMPLICIT, ODR_CONTEXT, ODR_VISIBLESTRING, Z_DiagForm_v2AddInfo,
857 odr_visiblestring, 0}, /* To cater to a bug in the CNIDR servers */
858 {-1, -1, -1, -1, 0, 0}
860 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
861 return opt && odr_ok(o);
863 odr_oid(o, &(*p)->diagnosticSetId, 1, 0) && /* SHOULD NOT BE OPT! */
864 odr_integer(o, &(*p)->condition, 0, 0) &&
866 * I no longer recall what server tagged the addinfo.. but it isn't
867 * hurting anyone, so...
868 * We need to turn it into a choice, or something, because of
869 * that damn generalstring in v3.
871 odr_choice(o, arm, &(*p)->addinfo, &(*p)->which, 0) &&
875 int z_DiagRec(ODR o, Z_DiagRec **p, int opt, const char *name)
877 static Odr_arm arm[] =
879 {-1, -1, -1, Z_DiagRec_defaultFormat, (Odr_fun)z_DefaultDiagFormat, 0},
880 {-1, -1, -1, Z_DiagRec_externallyDefined, (Odr_fun)z_External, 0},
881 {-1, -1, -1, -1, 0, 0}
884 if (o->direction == ODR_DECODE)
885 *p = (Z_DiagRec *)odr_malloc(o, sizeof(**p));
888 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
891 return opt && odr_ok(o);
894 int z_DiagRecs(ODR o, Z_DiagRecs **p, int opt, const char *name)
896 if (o->direction == ODR_DECODE)
897 *p = (Z_DiagRecs *)odr_malloc(o, sizeof(**p));
901 if (odr_sequence_of(o, (Odr_fun)z_DiagRec, &(*p)->diagRecs,
902 &(*p)->num_diagRecs, 0))
905 return opt && odr_ok(o);
908 int z_NamePlusRecord(ODR o, Z_NamePlusRecord **p, int opt, const char *name)
910 static Odr_arm arm[] =
912 {ODR_EXPLICIT, ODR_CONTEXT, 1, Z_NamePlusRecord_databaseRecord,
913 (Odr_fun)z_DatabaseRecord, 0},
914 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_NamePlusRecord_surrogateDiagnostic,
915 (Odr_fun)z_DiagRec, 0},
916 {-1, -1, -1, -1, 0, 0}
919 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
920 return opt && odr_ok(o);
922 odr_implicit(o, z_DatabaseName, &(*p)->databaseName, ODR_CONTEXT,
924 odr_constructed_begin(o, &(*p)->u, ODR_CONTEXT, 1, 0) &&
925 odr_choice(o, arm, &(*p)->u, &(*p)->which, 0) &&
926 odr_constructed_end(o) &&
930 int z_NamePlusRecordList(ODR o, Z_NamePlusRecordList **p, int opt,
933 if (o->direction == ODR_DECODE)
934 *p = (Z_NamePlusRecordList *)odr_malloc(o, sizeof(**p));
937 if (odr_sequence_of(o, (Odr_fun)z_NamePlusRecord, &(*p)->records,
938 &(*p)->num_records, 0))
944 int z_Records(ODR o, Z_Records **p, int opt, const char *name)
946 static Odr_arm arm[] =
948 {ODR_IMPLICIT, ODR_CONTEXT, 28, Z_Records_DBOSD,
949 (Odr_fun)z_NamePlusRecordList, 0},
950 {ODR_IMPLICIT, ODR_CONTEXT, 130, Z_Records_NSD,
951 (Odr_fun)z_DiagRec, 0},
952 {ODR_IMPLICIT, ODR_CONTEXT, 205, Z_Records_multipleNSD,
953 (Odr_fun)z_DiagRecs, 0},
954 {-1, -1, -1, -1, 0, 0}
957 if (o->direction == ODR_DECODE)
958 *p = (Z_Records *)odr_malloc(o, sizeof(**p));
961 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
964 return opt && odr_ok(o);
967 /* ------------------------ ACCESS CTRL SERVICE ----------------------- */
969 int z_AccessControlRequest(ODR o, Z_AccessControlRequest **p, int opt,
972 static Odr_arm arm[] =
974 {ODR_IMPLICIT, ODR_CONTEXT, 37, Z_AccessRequest_simpleForm,
975 (Odr_fun)odr_octetstring, 0},
976 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_AccessRequest_externallyDefined,
977 (Odr_fun)z_External, 0},
978 {-1, -1, -1, -1, 0, 0}
980 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
981 return opt && odr_ok(o);
983 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
984 odr_choice(o, arm, &(*p)->u, &(*p)->which, 0) &&
985 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
989 int z_AccessControlResponse(ODR o, Z_AccessControlResponse **p, int opt,
992 static Odr_arm arm[] =
994 {ODR_IMPLICIT, ODR_CONTEXT, 38, Z_AccessResponse_simpleForm,
995 (Odr_fun)odr_octetstring, 0},
996 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_AccessResponse_externallyDefined,
997 (Odr_fun)z_External, 0},
998 {-1, -1, -1, -1, 0, 0}
1000 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1001 return opt && odr_ok(o);
1003 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
1004 odr_choice(o, arm, &(*p)->u, &(*p)->which, 0) &&
1005 odr_explicit(o, z_DiagRec, &(*p)->diagnostic, ODR_CONTEXT, 223, 1) &&
1006 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
1007 odr_sequence_end(o);
1010 /* ------------------------ SCAN SERVICE -------------------- */
1012 int z_AttributeList(ODR o, Z_AttributeList **p, int opt, const char *name)
1014 if (o->direction == ODR_DECODE)
1015 *p = (Z_AttributeList *)odr_malloc(o, sizeof(**p));
1019 odr_implicit_settag(o, ODR_CONTEXT, 44);
1020 if (odr_sequence_of(o, (Odr_fun)z_AttributeElement, &(*p)->attributes,
1021 &(*p)->num_attributes, 0))
1024 return opt && odr_ok(o);
1028 * This is a temporary hack. We don't know just *what* old version of the
1029 * protocol willow uses, so we'll just patiently wait for them to update
1031 static int willow_scan = 0;
1033 int z_WillowAttributesPlusTerm(ODR o, Z_AttributesPlusTerm **p, int opt,
1036 if (!*p && o->direction != ODR_DECODE)
1038 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 4, 0))
1041 return opt && odr_ok(o);
1043 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 1, 0))
1045 if (!odr_constructed_begin(o, p, ODR_UNIVERSAL, ODR_SEQUENCE, 0))
1047 if (!odr_implicit_settag(o, ODR_CONTEXT, 44))
1049 if (o->direction == ODR_DECODE)
1050 *p = (Z_AttributesPlusTerm*)odr_malloc(o, sizeof(**p));
1051 if (!odr_sequence_of(o, (Odr_fun)z_AttributeElement, &(*p)->attributeList,
1052 &(*p)->num_attributes, 0))
1054 if (!odr_sequence_end(o) || !odr_sequence_end(o))
1056 if (!z_Term(o, &(*p)->term, 0, 0))
1058 if (!odr_constructed_end(o))
1064 int z_AlternativeTerm(ODR o, Z_AlternativeTerm **p, int opt, const char *name)
1066 if (o->direction == ODR_DECODE)
1067 *p = (Z_AlternativeTerm *)odr_malloc(o, sizeof(**p));
1071 return opt && odr_ok(o);
1074 if (odr_sequence_of(o, (Odr_fun)z_AttributesPlusTerm, &(*p)->terms,
1075 &(*p)->num_terms, 0))
1078 return opt && !o->error;
1081 int z_ByDatabase(ODR o, Z_ByDatabase **p, int opt, const char *name)
1083 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1084 return opt && odr_ok(o);
1086 z_DatabaseName(o, &(*p)->db, 1, 0) &&
1087 odr_implicit(o, odr_integer, &(*p)->num, ODR_CONTEXT, 1, 1) &&
1088 z_OtherInformation(o, &(*p)->otherDbInfo, 1, 0) &&
1089 odr_sequence_end(o);
1092 int z_ByDatabaseList(ODR o, Z_ByDatabaseList **p, int opt, const char *name)
1094 if (!odr_initmember(o, p, sizeof(**p)))
1095 return opt && odr_ok(o);
1096 if (odr_sequence_of(o, (Odr_fun)z_ByDatabase, &(*p)->elements,
1097 &(*p)->num_elements, 0))
1100 return opt && odr_ok(o);
1103 int z_ScanOccurrences(ODR o, Z_ScanOccurrences **p, int opt, const char *name)
1107 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_ScanOccurrences_global,
1108 (Odr_fun)odr_integer, 0},
1109 {ODR_EXPLICIT, ODR_CONTEXT, 3, Z_ScanOccurrences_byDatabase,
1110 (Odr_fun)z_ByDatabaseList, 0},
1111 {-1, -1, -1, -1, 0, 0}
1114 if (!odr_initmember(o, p, sizeof(**p)))
1115 return opt && odr_ok(o);
1116 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
1119 return opt && odr_ok(o);
1122 int z_OccurrenceByAttributesElem(ODR o, Z_OccurrenceByAttributesElem **p,
1123 int opt, const char *name)
1125 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1126 return opt && odr_ok(o);
1128 odr_explicit(o, z_AttributeList, &(*p)->attributes, ODR_CONTEXT,
1130 z_ScanOccurrences(o, &(*p)->occurrences, 1, 0) &&
1131 z_OtherInformation(o, &(*p)->otherOccurInfo, 1, 0) &&
1132 odr_sequence_end(o);
1135 int z_OccurrenceByAttributes(ODR o, Z_OccurrenceByAttributes **p, int opt, const char *name)
1137 if (!odr_initmember(o, p, sizeof(**p)))
1138 return opt && odr_ok(o);
1139 if (!odr_sequence_of(o, (Odr_fun)z_OccurrenceByAttributesElem,
1140 &(*p)->elements, &(*p)->num_elements, 0))
1143 return opt && odr_ok(o);
1146 int z_TermInfo(ODR o, Z_TermInfo **p, int opt, const char *name)
1148 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1149 return opt && odr_ok(o);
1152 odr_implicit(o, z_Term, &(*p)->term, ODR_CONTEXT, 1, 0) :
1153 z_Term(o, &(*p)->term, 0, 0)) &&
1154 odr_implicit(o, z_InternationalString, &(*p)->displayTerm, ODR_CONTEXT,
1156 z_AttributeList(o, &(*p)->suggestedAttributes, 1, 0) &&
1157 odr_implicit(o, z_AlternativeTerm, &(*p)->alternativeTerm,
1158 ODR_CONTEXT, 4, 1) &&
1159 odr_implicit(o, odr_integer, &(*p)->globalOccurrences, ODR_CONTEXT,
1161 odr_implicit(o, z_OccurrenceByAttributes, &(*p)->byAttributes,
1162 ODR_CONTEXT, 3, 1) &&
1163 z_OtherInformation(o, &(*p)->otherTermInfo, 1, 0) &&
1164 odr_sequence_end(o);
1167 int z_Entry(ODR o, Z_Entry **p, int opt, const char *name)
1169 static Odr_arm arm[] =
1171 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Entry_termInfo,
1172 (Odr_fun)z_TermInfo, 0},
1173 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_Entry_surrogateDiagnostic,
1174 (Odr_fun)z_DiagRec, 0},
1175 {-1, -1, -1, -1, 0, 0}
1178 if (o->direction == ODR_DECODE)
1179 *p = (Z_Entry *)odr_malloc(o, sizeof(**p));
1183 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
1186 return opt && odr_ok(o);
1189 int z_ListEntries (ODR o, Z_ListEntries **p, int opt, const char *name)
1191 if (!odr_sequence_begin (o, p, sizeof(**p), 0))
1192 return opt && odr_ok (o);
1194 odr_implicit_settag (o, ODR_CONTEXT, 1) &&
1195 (odr_sequence_of(o, (Odr_fun) z_Entry, &(*p)->entries,
1196 &(*p)->num_entries, 0) || odr_ok(o)) &&
1197 odr_implicit_settag (o, ODR_CONTEXT, 2) &&
1198 (odr_sequence_of(o, (Odr_fun) z_DiagRec,
1199 &(*p)->nonsurrogateDiagnostics,
1200 &(*p)->num_nonsurrogateDiagnostics, 0)
1202 odr_sequence_end (o);
1205 int z_ScanRequest(ODR o, Z_ScanRequest **p, int opt, const char *name)
1207 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1208 return opt && odr_ok(o);
1211 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
1212 odr_implicit_settag(o, ODR_CONTEXT, 3) &&
1213 odr_sequence_of(o, z_DatabaseName, &(*p)->databaseNames,
1214 &(*p)->num_databaseNames, 0) &&
1215 odr_oid(o, &(*p)->attributeSet, 1, 0) &&
1216 (z_AttributesPlusTerm(o, &(*p)->termListAndStartPoint, 1, 0) ?
1217 ((*p)->termListAndStartPoint ? 1 :
1218 z_WillowAttributesPlusTerm(o, &(*p)->termListAndStartPoint, 0, 0))
1220 odr_implicit(o, odr_integer, &(*p)->stepSize, ODR_CONTEXT, 5, 1) &&
1221 odr_implicit(o, odr_integer, &(*p)->numberOfTermsRequested,
1222 ODR_CONTEXT, 6, 0) &&
1223 odr_implicit(o, odr_integer, &(*p)->preferredPositionInResponse,
1224 ODR_CONTEXT, 7, 1) &&
1225 z_OtherInformation(o, &(*p)->otherInfo, 1, "otherInfo") &&
1226 odr_sequence_end(o);
1229 int z_ScanResponse(ODR o, Z_ScanResponse **p, int opt, const char *name)
1231 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1232 return opt && odr_ok(o);
1234 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
1235 odr_implicit(o, odr_integer, &(*p)->stepSize, ODR_CONTEXT, 3, 1) &&
1236 odr_implicit(o, odr_integer, &(*p)->scanStatus, ODR_CONTEXT, 4, 0) &&
1237 odr_implicit(o, odr_integer, &(*p)->numberOfEntriesReturned,
1238 ODR_CONTEXT, 5, 0) &&
1239 odr_implicit(o, odr_integer, &(*p)->positionOfTerm,
1240 ODR_CONTEXT, 6, 1) &&
1241 odr_implicit(o, z_ListEntries, &(*p)->entries, ODR_CONTEXT, 7, 1) &&
1242 odr_implicit(o, odr_oid, &(*p)->attributeSet, ODR_CONTEXT, 8, 1) &&
1243 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
1244 odr_sequence_end(o);
1247 /* ------------------------ SEARCHRESPONSE ----------------*/
1249 int z_NumberOfRecordsReturned(ODR o, int **p, int opt, const char *name)
1251 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 24, opt);
1254 int z_NextResultSetPosition(ODR o, int **p, int opt, const char *name)
1256 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 25, opt);
1259 int z_PresentStatus(ODR o, int **p, int opt, const char *name)
1261 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 27, opt);
1264 int z_SearchResponse(ODR o, Z_SearchResponse **p, int opt, const char *name)
1266 Z_SearchResponse *pp;
1268 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1269 return opt && odr_ok(o);
1272 z_ReferenceId(o, &pp->referenceId, 1, 0) &&
1273 odr_implicit(o, odr_integer, &pp->resultCount, ODR_CONTEXT, 23, 0) &&
1274 z_NumberOfRecordsReturned(o, &pp->numberOfRecordsReturned, 0, 0) &&
1275 z_NextResultSetPosition(o, &pp->nextResultSetPosition, 0, 0) &&
1276 odr_implicit(o, odr_bool, &pp->searchStatus, ODR_CONTEXT, 22, 0) &&
1277 odr_implicit(o, odr_integer, &pp->resultSetStatus,
1278 ODR_CONTEXT, 26, 1) &&
1279 z_PresentStatus(o, &pp->presentStatus, 1, 0) &&
1280 z_Records(o, &pp->records, 1, 0) &&
1281 odr_implicit(o, z_OtherInformation, &(*p)->additionalSearchInfo,
1282 ODR_CONTEXT, 203, 1) &&
1283 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
1284 odr_sequence_end(o);
1287 /* --------------------- PRESENT SERVICE ---------------------- */
1289 int z_ElementSpec(ODR o, Z_ElementSpec **p, int opt, const char *name)
1291 static Odr_arm arm[] =
1293 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ElementSpec_elementSetName,
1294 odr_visiblestring, 0},
1295 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ElementSpec_externalSpec,
1296 (Odr_fun)z_External, 0},
1297 {-1, -1, -1, -1, 0, 0}
1300 if (o->direction == ODR_DECODE)
1301 *p = (Z_ElementSpec *)odr_malloc(o, sizeof(**p));
1305 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
1308 return opt && odr_ok(o);
1311 int z_Specification(ODR o, Z_Specification **p, int opt, const char *name)
1313 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1314 return opt && odr_ok(o);
1316 odr_implicit(o, odr_oid, &(*p)->schema, ODR_CONTEXT, 1, 1) &&
1317 z_ElementSpec(o, &(*p)->elementSpec, 1, 0) &&
1318 odr_sequence_end(o);
1321 int z_DbSpecific(ODR o, Z_DbSpecific **p, int opt, const char *name)
1323 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1324 return opt && odr_ok(o);
1326 odr_explicit(o, z_DatabaseName, &(*p)->databaseName, ODR_CONTEXT,
1328 odr_implicit(o, z_Specification, &(*p)->spec, ODR_CONTEXT, 2, 0) &&
1329 odr_sequence_end(o);
1332 int z_CompSpec(ODR o, Z_CompSpec **p, int opt, const char *name)
1334 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1335 return opt && odr_ok(o);
1337 odr_implicit(o, odr_bool, &(*p)->selectAlternativeSyntax, ODR_CONTEXT,
1339 odr_implicit(o, z_Specification, &(*p)->generic, ODR_CONTEXT, 2, 1) &&
1340 odr_implicit_settag(o, ODR_CONTEXT, 3) &&
1341 (odr_sequence_of(o, (Odr_fun)z_DbSpecific, &(*p)->dbSpecific,
1342 &(*p)->num_dbSpecific, 0) || odr_ok(o)) &&
1343 odr_implicit_settag(o, ODR_CONTEXT, 4) &&
1344 (odr_sequence_of(o, (Odr_fun)odr_oid, &(*p)->recordSyntax,
1345 &(*p)->num_recordSyntax, 0) || odr_ok(o)) &&
1346 odr_sequence_end(o);
1349 int z_RecordComposition(ODR o, Z_RecordComposition **p, int opt,
1352 static Odr_arm arm[] =
1354 {ODR_EXPLICIT, ODR_CONTEXT, 19, Z_RecordComp_simple,
1355 (Odr_fun)z_ElementSetNames, 0},
1356 {ODR_IMPLICIT, ODR_CONTEXT, 209, Z_RecordComp_complex,
1357 (Odr_fun)z_CompSpec, 0},
1358 {-1, -1, -1, -1, 0, 0}
1361 if (o->direction == ODR_DECODE)
1362 *p = (Z_RecordComposition *)odr_malloc(o, sizeof(**p));
1366 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
1369 return opt && odr_ok(o);
1372 int z_Range(ODR o, Z_Range **p, int opt, const char *name)
1374 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1375 return opt && odr_ok(o);
1377 odr_implicit(o, odr_integer, &(*p)->startingPosition,
1378 ODR_CONTEXT, 1, 0) &&
1379 odr_implicit(o, odr_integer, &(*p)->numberOfRecords,
1380 ODR_CONTEXT, 2, 0) &&
1381 odr_sequence_end(o);
1384 int z_PresentRequest(ODR o, Z_PresentRequest **p, int opt, const char *name)
1386 Z_PresentRequest *pp;
1388 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1389 return opt && odr_ok(o);
1392 z_ReferenceId(o, &pp->referenceId, 1, 0) &&
1393 z_ResultSetId(o, &pp->resultSetId, 0, 0) &&
1394 odr_implicit(o, odr_integer, &pp->resultSetStartPoint,
1395 ODR_CONTEXT, 30, 0) &&
1396 odr_implicit(o, odr_integer, &pp->numberOfRecordsRequested,
1397 ODR_CONTEXT, 29, 0) &&
1398 odr_implicit_settag(o, ODR_CONTEXT, 212) &&
1399 (odr_sequence_of(o, (Odr_fun)z_Range, &(*p)->additionalRanges,
1400 &(*p)->num_ranges, 0) || odr_ok(o)) &&
1401 z_RecordComposition(o, &(*p)->recordComposition, 1, 0) &&
1402 odr_implicit(o, odr_oid, &(*p)->preferredRecordSyntax, ODR_CONTEXT,
1404 odr_implicit(o, odr_integer, &(*p)->maxSegmentCount, ODR_CONTEXT,
1406 odr_implicit(o, odr_integer, &(*p)->maxRecordSize, ODR_CONTEXT,
1408 odr_implicit(o, odr_integer, &(*p)->maxSegmentSize, ODR_CONTEXT,
1410 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
1411 odr_sequence_end(o);
1414 int z_PresentResponse(ODR o, Z_PresentResponse **p, int opt, const char *name)
1416 Z_PresentResponse *pp;
1418 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1419 return opt && odr_ok(o);
1422 z_ReferenceId(o, &pp->referenceId, 1, 0) &&
1423 z_NumberOfRecordsReturned(o, &pp->numberOfRecordsReturned, 0, 0) &&
1424 z_NextResultSetPosition(o, &pp->nextResultSetPosition, 0, 0) &&
1425 z_PresentStatus(o, &pp->presentStatus, 0, 0) &&
1426 z_Records(o, &pp->records, 1, 0) &&
1427 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
1428 odr_sequence_end(o);
1431 /* ----------------------DELETE -------------------------- */
1433 int z_DeleteSetStatus(ODR o, int **p, int opt, const char *name)
1435 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 33, opt);
1438 int z_ListStatus(ODR o, Z_ListStatus **p, int opt, const char *name)
1440 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1441 return opt && odr_ok(o);
1443 z_ResultSetId(o, &(*p)->id, 0, 0) &&
1444 z_DeleteSetStatus(o, &(*p)->status, 0, 0) &&
1445 odr_sequence_end(o);
1448 int z_DeleteResultSetRequest(ODR o, Z_DeleteResultSetRequest **p, int opt,
1451 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1452 return opt && odr_ok(o);
1454 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
1455 odr_implicit(o, odr_integer, &(*p)->deleteFunction, ODR_CONTEXT, 32,
1457 (odr_sequence_of(o, z_ResultSetId, &(*p)->resultSetList,
1458 &(*p)->num_resultSetList, 0) || odr_ok(o)) &&
1459 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
1460 odr_sequence_end(o);
1463 int z_ListStatuses (ODR o, Z_ListStatuses **p, int opt, const char *name)
1465 if (!odr_initmember (o, p, sizeof(**p)))
1466 return opt && odr_ok(o);
1467 if (odr_sequence_of (o, (Odr_fun) z_ListStatus, &(*p)->elements,
1471 return opt && odr_ok(o);
1474 int z_DeleteResultSetResponse(ODR o, Z_DeleteResultSetResponse **p, int opt,
1477 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1478 return opt && odr_ok(o);
1480 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
1481 odr_implicit(o, z_DeleteSetStatus, &(*p)->deleteOperationStatus,
1482 ODR_CONTEXT, 0, 0) &&
1483 odr_implicit (o, z_ListStatuses,
1484 &(*p)->deleteListStatuses, ODR_CONTEXT, 1, 1) &&
1485 odr_implicit(o, odr_integer, &(*p)->numberNotDeleted, ODR_CONTEXT,
1487 odr_implicit (o, z_ListStatuses,
1488 &(*p)->bulkStatuses, ODR_CONTEXT, 35, 1) &&
1489 odr_implicit(o, odr_visiblestring, &(*p)->deleteMessage, ODR_CONTEXT,
1491 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
1492 odr_sequence_end(o);
1495 /* ------------------------ SEGMENT SERVICE -------------- */
1497 int z_Segment(ODR o, Z_Segment **p, int opt, const char *name)
1499 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1500 return opt && odr_ok(o);
1502 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
1503 odr_implicit(o, odr_integer, &(*p)->numberOfRecordsReturned,
1504 ODR_CONTEXT, 24, 0) &&
1505 odr_implicit_settag(o, ODR_CONTEXT, 0) &&
1506 odr_sequence_of(o, (Odr_fun)z_NamePlusRecord, &(*p)->segmentRecords,
1507 &(*p)->num_segmentRecords, 0) &&
1508 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
1509 odr_sequence_end(o);
1512 /* ------------------------ CLOSE SERVICE ---------------- */
1514 int z_Close(ODR o, Z_Close **p, int opt, const char *name)
1516 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1517 return opt && odr_ok(o);
1519 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
1520 odr_implicit(o, odr_integer, &(*p)->closeReason, ODR_CONTEXT, 211, 0)
1522 odr_implicit(o, odr_visiblestring, &(*p)->diagnosticInformation,
1523 ODR_CONTEXT, 3, 1) &&
1524 odr_implicit(o, odr_oid, &(*p)->resourceReportFormat, ODR_CONTEXT,
1526 odr_implicit(o, z_External, &(*p)->resourceReport, ODR_CONTEXT,
1528 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
1529 odr_sequence_end(o);
1532 /* ------------------------ APDU ------------------------- */
1534 int z_Permissions(ODR o, Z_Permissions **p, int opt, const char *name)
1536 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1537 return opt && odr_ok(o);
1539 odr_implicit(o, z_InternationalString, &(*p)->userId, ODR_CONTEXT,
1541 odr_implicit_settag(o, ODR_CONTEXT, 2) &&
1542 odr_sequence_of(o, (Odr_fun)odr_integer, &(*p)->allowableFunctions,
1543 &(*p)->num_allowableFunctions, 0) &&
1544 odr_sequence_end(o);
1547 int z_ExtendedServicesRequest(ODR o, Z_ExtendedServicesRequest **p, int opt,
1550 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1551 return opt && odr_ok(o);
1553 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
1554 odr_implicit(o, odr_integer, &(*p)->function, ODR_CONTEXT, 3, 0) &&
1555 odr_implicit(o, odr_oid, &(*p)->packageType, ODR_CONTEXT, 4, 0) &&
1556 odr_implicit(o, z_InternationalString, &(*p)->packageName,
1557 ODR_CONTEXT, 5, 1) &&
1558 odr_implicit(o, z_InternationalString, &(*p)->userId,
1559 ODR_CONTEXT, 6, 1) &&
1560 odr_implicit(o, z_IntUnit, &(*p)->retentionTime,
1561 ODR_CONTEXT, 7, 1) &&
1562 odr_implicit(o, z_Permissions, &(*p)->permissions,
1563 ODR_CONTEXT, 8, 1) &&
1564 odr_implicit(o, z_InternationalString, &(*p)->description,
1565 ODR_CONTEXT, 9, 1) &&
1566 odr_implicit(o, z_External, &(*p)->taskSpecificParameters,
1567 ODR_CONTEXT, 10, 1) &&
1568 odr_implicit(o, odr_integer, &(*p)->waitAction,
1569 ODR_CONTEXT, 11, 0) &&
1570 z_ElementSetName(o, &(*p)->elements, 1, 0) &&
1571 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
1572 odr_sequence_end(o);
1575 int z_ExtendedServicesResponse(ODR o, Z_ExtendedServicesResponse **p, int opt,
1578 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1579 return opt && odr_ok(o);
1581 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
1582 odr_implicit(o, odr_integer, &(*p)->operationStatus, ODR_CONTEXT,
1584 odr_implicit_settag(o, ODR_CONTEXT, 4) &&
1585 (odr_sequence_of(o, (Odr_fun)z_DiagRec, &(*p)->diagnostics,
1586 &(*p)->num_diagnostics, 0) || odr_ok(o)) &&
1587 odr_implicit(o, z_External, &(*p)->taskPackage, ODR_CONTEXT, 5, 1) &&
1588 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
1589 odr_sequence_end(o);
1592 /* ------------------------ SORT ------------------------- */
1594 int z_SortAttributes(ODR o, Z_SortAttributes **p, int opt, const char *name)
1596 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1597 return opt && odr_ok(o);
1599 odr_oid(o, &(*p)->id, 0, 0) &&
1600 z_AttributeList(o, &(*p)->list, 0, 0) &&
1601 odr_sequence_end(o);
1604 int z_SortKey(ODR o, Z_SortKey **p, int opt, const char *name)
1606 static Odr_arm arm[] =
1608 {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_SortKey_sortField,
1609 z_InternationalString, 0},
1610 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_SortKey_elementSpec,
1611 (Odr_fun)z_Specification, 0},
1612 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_SortKey_sortAttributes,
1613 (Odr_fun)z_SortAttributes, 0},
1617 if (!odr_initmember(o, p, sizeof(**p)))
1618 return opt && odr_ok(o);
1619 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
1622 return opt && odr_ok(o);
1625 int z_SortDbSpecific(ODR o, Z_SortDbSpecific **p, int opt, const char *name)
1627 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1628 return opt && odr_ok(o);
1630 z_DatabaseName(o, &(*p)->databaseName, 0, 0) &&
1631 z_SortKey(o, &(*p)->dbSort, 0, 0) &&
1632 odr_sequence_end(o);
1635 int z_SortDbSpecificList(ODR o, Z_SortDbSpecificList **p, int opt,
1638 if (!odr_initmember(o, p, sizeof(**p)))
1639 return opt && odr_ok(o);
1640 if (odr_sequence_of(o, (Odr_fun)z_SortDbSpecific, &(*p)->dbSpecific,
1641 &(*p)->num_dbSpecific, 0))
1644 return opt && odr_ok(o);
1647 int z_SortElement(ODR o, Z_SortElement **p, int opt, const char *name)
1649 static Odr_arm arm[] =
1651 {ODR_EXPLICIT, ODR_CONTEXT, 1, Z_SortElement_generic,
1652 (Odr_fun)z_SortKey, 0},
1653 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_SortElement_databaseSpecific,
1654 (Odr_fun)z_SortDbSpecificList, 0},
1655 {-1, -1, -1, -1, 0, 0}
1658 if (!odr_initmember(o, p, sizeof(**p)))
1659 return opt && odr_ok(o);
1660 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
1663 return opt && odr_ok(o);
1666 int z_SortMissingValueAction(ODR o, Z_SortMissingValueAction **p, int opt,
1669 static Odr_arm arm[] =
1671 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_SortMissingValAct_abort,
1672 (Odr_fun)odr_null, 0},
1673 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_SortMissingValAct_null,
1674 (Odr_fun)odr_null, 0},
1675 {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_SortMissingValAct_valData,
1676 (Odr_fun)odr_octetstring, 0},
1677 {-1, -1, -1, -1, 0, 0}
1680 if (!odr_initmember(o, p, sizeof(**p)))
1681 return opt && odr_ok(o);
1682 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
1685 return opt && odr_ok(o);
1688 int z_SortKeySpec(ODR o, Z_SortKeySpec **p, int opt, const char *name)
1690 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1691 return opt && odr_ok(o);
1693 z_SortElement(o, &(*p)->sortElement, 0, 0) &&
1694 odr_implicit(o, odr_integer, &(*p)->sortRelation, ODR_CONTEXT, 1, 0) &&
1695 odr_implicit(o, odr_integer, &(*p)->caseSensitivity,
1696 ODR_CONTEXT, 2, 0) &&
1697 odr_explicit(o, z_SortMissingValueAction, &(*p)->missingValueAction,
1698 ODR_CONTEXT, 3, 1) &&
1699 odr_sequence_end(o);
1702 int z_SortResponse(ODR o, Z_SortResponse **p, int opt, const char *name)
1704 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1705 return opt && odr_ok(o);
1707 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
1708 odr_implicit(o, odr_integer, &(*p)->sortStatus, ODR_CONTEXT,
1710 odr_implicit(o, odr_integer, &(*p)->resultSetStatus, ODR_CONTEXT,
1712 odr_implicit(o, z_DiagRecs, &(*p)->diagnostics, ODR_CONTEXT, 5, 1) &&
1713 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
1714 odr_sequence_end(o);
1717 int z_SortKeySpecList(ODR o, Z_SortKeySpecList **p, int opt, const char *name)
1719 if (!odr_initmember(o, p, sizeof(**p)))
1720 return opt && odr_ok(o);
1721 if (odr_sequence_of(o, (Odr_fun)z_SortKeySpec, &(*p)->specs,
1722 &(*p)->num_specs, 0))
1725 return opt && odr_ok(o);
1728 int z_SortRequest(ODR o, Z_SortRequest **p, int opt, const char *name)
1730 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1731 return opt && odr_ok(o);
1733 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
1734 odr_implicit(o, z_StringList, &(*p)->inputResultSetNames,
1735 ODR_CONTEXT, 3, 0) &&
1736 odr_implicit(o, z_InternationalString, &(*p)->sortedResultSetName,
1737 ODR_CONTEXT, 4, 0) &&
1738 odr_implicit(o, z_SortKeySpecList, &(*p)->sortSequence, ODR_CONTEXT,
1740 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
1741 odr_sequence_end(o);
1744 /* ---------------------- Resource Report ---------------- */
1746 int z_ResourceReportRequest(ODR o, Z_ResourceReportRequest **p, int opt,
1749 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1750 return opt && odr_ok(o);
1752 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
1753 odr_implicit(o, z_ReferenceId, &(*p)->opId, ODR_CONTEXT, 210, 1) &&
1754 odr_implicit(o, odr_oid, &(*p)->prefResourceReportFormat, ODR_CONTEXT,
1756 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
1757 odr_sequence_end(o);
1760 int z_ResourceReportResponse(ODR o, Z_ResourceReportResponse **p, int opt,
1763 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
1764 return opt && odr_ok(o);
1766 z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
1767 odr_implicit(o, odr_integer, &(*p)->resourceReportStatus,
1768 ODR_CONTEXT, 50, 0) &&
1769 odr_explicit(o, z_External, &(*p)->resourceReport, ODR_CONTEXT,
1771 z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
1772 odr_sequence_end(o);
1775 /* ------------------------ APDU ------------------------- */
1777 int z_APDU(ODR o, Z_APDU **p, int opt, const char *name)
1779 static Odr_arm arm[] =
1781 {ODR_IMPLICIT, ODR_CONTEXT, 20, Z_APDU_initRequest,
1782 (Odr_fun)z_InitRequest, 0},
1783 {ODR_IMPLICIT, ODR_CONTEXT, 21, Z_APDU_initResponse,
1784 (Odr_fun)z_InitResponse, 0},
1785 {ODR_IMPLICIT, ODR_CONTEXT, 22, Z_APDU_searchRequest,
1786 (Odr_fun)z_SearchRequest, 0},
1787 {ODR_IMPLICIT, ODR_CONTEXT, 23, Z_APDU_searchResponse,
1788 (Odr_fun)z_SearchResponse, 0},
1789 {ODR_IMPLICIT, ODR_CONTEXT, 24, Z_APDU_presentRequest,
1790 (Odr_fun)z_PresentRequest, 0},
1791 {ODR_IMPLICIT, ODR_CONTEXT, 25, Z_APDU_presentResponse,
1792 (Odr_fun)z_PresentResponse, 0},
1793 {ODR_IMPLICIT, ODR_CONTEXT, 26, Z_APDU_deleteResultSetRequest,
1794 (Odr_fun)z_DeleteResultSetRequest, 0},
1795 {ODR_IMPLICIT, ODR_CONTEXT, 27, Z_APDU_deleteResultSetResponse,
1796 (Odr_fun)z_DeleteResultSetResponse, 0},
1797 {ODR_IMPLICIT, ODR_CONTEXT, 28, Z_APDU_accessControlRequest,
1798 (Odr_fun)z_AccessControlRequest, 0},
1799 {ODR_IMPLICIT, ODR_CONTEXT, 29, Z_APDU_accessControlResponse,
1800 (Odr_fun)z_AccessControlResponse, 0},
1801 {ODR_IMPLICIT, ODR_CONTEXT, 30, Z_APDU_resourceControlRequest,
1802 (Odr_fun)z_ResourceControlRequest, 0},
1803 {ODR_IMPLICIT, ODR_CONTEXT, 31, Z_APDU_resourceControlResponse,
1804 (Odr_fun)z_ResourceControlResponse, 0},
1805 {ODR_IMPLICIT, ODR_CONTEXT, 32, Z_APDU_triggerResourceControlRequest,
1806 (Odr_fun)z_TriggerResourceControlRequest, 0},
1807 {ODR_IMPLICIT, ODR_CONTEXT, 33, Z_APDU_resourceReportRequest,
1808 (Odr_fun)z_ResourceReportRequest, 0},
1809 {ODR_IMPLICIT, ODR_CONTEXT, 34, Z_APDU_resourceReportResponse,
1810 (Odr_fun)z_ResourceReportResponse, 0},
1811 {ODR_IMPLICIT, ODR_CONTEXT, 35, Z_APDU_scanRequest,
1812 (Odr_fun)z_ScanRequest, 0},
1813 {ODR_IMPLICIT, ODR_CONTEXT, 36, Z_APDU_scanResponse,
1814 (Odr_fun)z_ScanResponse, 0},
1815 {ODR_IMPLICIT, ODR_CONTEXT, 43, Z_APDU_sortRequest,
1816 (Odr_fun)z_SortRequest, 0},
1817 {ODR_IMPLICIT, ODR_CONTEXT, 44, Z_APDU_sortResponse,
1818 (Odr_fun)z_SortResponse, 0},
1819 {ODR_IMPLICIT, ODR_CONTEXT, 45, Z_APDU_segmentRequest,
1820 (Odr_fun)z_Segment, 0},
1821 {ODR_IMPLICIT, ODR_CONTEXT, 46, Z_APDU_extendedServicesRequest,
1822 (Odr_fun)z_ExtendedServicesRequest, 0},
1823 {ODR_IMPLICIT, ODR_CONTEXT, 47, Z_APDU_extendedServicesResponse,
1824 (Odr_fun)z_ExtendedServicesResponse},
1825 {ODR_IMPLICIT, ODR_CONTEXT, 48, Z_APDU_close,
1826 (Odr_fun)z_Close, 0},
1827 {-1, -1, -1, -1, 0, 0}
1830 if (o->direction == ODR_DECODE)
1831 *p = (Z_APDU *)odr_malloc(o, sizeof(**p));
1832 odr_setlenlen(o, 5);
1833 if (!odr_choice(o, arm, &(*p)->u, &(*p)->which, name))
1835 if (o->direction == ODR_DECODE)
1837 return opt && odr_ok(o);