2 * Copyright (c) 1995-1998, Index Data
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.57 1998-10-20 13:55:37 quinn
8 * Fixed Scan bug in asn and client
10 * Revision 1.56 1998/08/19 16:10:04 adam
11 * Changed som member names of DeleteResultSetRequest/Response.
13 * Revision 1.55 1998/02/11 11:53:32 adam
14 * Changed code so that it compiles as C++.
16 * Revision 1.54 1996/11/11 13:14:46 adam
17 * Fixed tagging bug in z_ProximityOperator.
19 * Revision 1.53 1996/10/09 15:54:55 quinn
20 * Added SearchInfoReport
22 * Revision 1.52 1996/10/08 12:56:57 adam
23 * Bug fix: tagging of type 101 query.
25 * Revision 1.51 1996/07/26 14:07:21 quinn
28 * Revision 1.50 1996/07/26 13:36:15 quinn
31 * Revision 1.49 1996/07/06 19:58:28 quinn
32 * System headerfiles gathered in yconfig
34 * Revision 1.48 1996/06/10 08:53:33 quinn
35 * Added Summary,OPAC,ResourceReport
37 * Revision 1.47 1996/05/29 15:47:50 quinn
38 * Fixed in bug DiagRecs decoder. Thanks to Linda Harris.
40 * Revision 1.46 1996/04/10 11:39:42 quinn
41 * Fixed bug in UserInfo
43 * Revision 1.45 1996/02/23 10:00:25 quinn
46 * Revision 1.44 1996/02/20 12:51:41 quinn
47 * Completed SCAN. Fixed problems with EXTERNAL.
49 * Revision 1.43 1996/02/10 12:22:49 quinn
52 * Revision 1.42 1996/01/22 09:46:31 quinn
53 * Added Sort PDU. Moved StringList to main protocol file.
55 * Revision 1.41 1996/01/10 15:21:24 quinn
56 * Added links to access control PDUs
58 * Revision 1.40 1996/01/02 11:46:40 quinn
59 * Changed 'operator' to 'roperator' to avoid C++ conflict.
61 * Revision 1.39 1995/09/29 17:11:53 quinn
64 * Revision 1.38 1995/09/27 15:02:40 quinn
65 * Modified function heads & prototypes.
67 * Revision 1.37 1995/08/21 09:10:15 quinn
68 * Smallish fixes to suppport new formats.
70 * Revision 1.36 1995/08/15 11:59:39 quinn
73 * Revision 1.35 1995/08/10 08:53:59 quinn
76 * Revision 1.34 1995/06/19 17:01:48 quinn
77 * This should bring us in sync with the version distributed as 1.0b
79 * Revision 1.33 1995/06/19 13:39:56 quinn
80 * *** empty log message ***
82 * Revision 1.32 1995/06/19 12:37:28 quinn
83 * Fixed a bug in the compspec.
85 * Revision 1.31 1995/06/16 13:15:56 quinn
86 * Fixed Defaultdiagformat.
88 * Revision 1.30 1995/06/15 15:42:01 quinn
91 * Revision 1.29 1995/06/15 07:44:49 quinn
94 * Revision 1.28 1995/06/14 15:26:35 quinn
95 * *** empty log message ***
97 * Revision 1.27 1995/06/07 14:36:22 quinn
100 * Revision 1.26 1995/06/02 09:49:13 quinn
101 * Adding access control
103 * Revision 1.25 1995/05/25 11:00:08 quinn
104 * *** empty log message ***
106 * Revision 1.24 1995/05/22 13:58:18 quinn
107 * Fixed an ODR_NULLVAL.
109 * Revision 1.23 1995/05/22 11:30:18 quinn
110 * Adding Z39.50-1992 stuff to proto.c. Adding zget.c
112 * Revision 1.22 1995/05/17 08:40:56 quinn
113 * Added delete. Fixed some sequence_begins. Smallish.
115 * Revision 1.21 1995/05/16 08:50:24 quinn
116 * License, documentation, and memory fixes
118 * Revision 1.20 1995/05/15 11:55:25 quinn
121 * Revision 1.19 1995/04/11 11:58:35 quinn
124 * Revision 1.18 1995/04/11 11:52:02 quinn
125 * Fixed possible buf in proto.c
127 * Revision 1.17 1995/04/10 10:22:22 quinn
130 * Revision 1.16 1995/03/30 10:26:43 quinn
131 * Added Term structure
133 * Revision 1.15 1995/03/30 09:08:39 quinn
134 * Added Resource control protocol
136 * Revision 1.14 1995/03/29 08:06:13 quinn
137 * Added a few v3 elements
139 * Revision 1.13 1995/03/20 11:26:52 quinn
140 * *** empty log message ***
142 * Revision 1.12 1995/03/20 09:45:09 quinn
145 * Revision 1.11 1995/03/17 10:17:25 quinn
146 * Added memory management.
148 * Revision 1.10 1995/03/15 11:17:40 quinn
149 * Fixed some return-checks from choice.. need better ay to handle those..
151 * Revision 1.9 1995/03/15 08:37:06 quinn
152 * Fixed protocol bugs.
154 * Revision 1.8 1995/03/14 16:59:24 quinn
155 * Fixed OPTIONAL flag in attributeelement
157 * Revision 1.7 1995/03/07 16:29:33 quinn
158 * Added authentication stuff.
160 * Revision 1.6 1995/03/01 14:46:03 quinn
161 * Fixed protocol bug in 8777query.
163 * Revision 1.5 1995/02/14 11:54:22 quinn
166 * Revision 1.4 1995/02/10 15:54:30 quinn
169 * Revision 1.3 1995/02/09 15:51:39 quinn
172 * Revision 1.2 1995/02/06 21:26:07 quinn
173 * Repaired this evening's damages..
175 * Revision 1.1 1995/02/06 16:44:47 quinn
176 * First hack at Z/SR protocol
184 /* ---------------------- GLOBAL DEFS ------------------- */
187 * We'll use a general octetstring here, since string operations are
188 * clumsy on long strings.
190 int z_SUTRS(ODR o, Odr_oct **p, int opt)
192 return odr_implicit(o, odr_octetstring, p, ODR_UNIVERSAL,
193 ODR_GENERALSTRING, opt);
196 int z_ReferenceId(ODR o, Z_ReferenceId **p, int opt)
198 return odr_implicit(o, odr_octetstring, (Odr_oct**) p, ODR_CONTEXT, 2, opt);
201 int z_DatabaseName(ODR o, Z_DatabaseName **p, int opt)
203 return odr_implicit(o, odr_visiblestring, (char **) p, ODR_CONTEXT, 105,
207 int z_ResultSetId(ODR o, char **p, int opt)
209 return odr_implicit(o, odr_visiblestring, (char **) p, ODR_CONTEXT, 31,
213 int z_ElementSetName(ODR o, char **p, int opt)
215 return odr_implicit(o, odr_visiblestring, p, ODR_CONTEXT, 103, opt);
218 int z_UserInformationField(ODR o, Z_External **p, int opt)
220 return odr_explicit(o, z_External, (Z_External **)p, ODR_CONTEXT,
224 int z_InternationalString(ODR o, char **p, int opt)
226 return odr_generalstring(o, p, opt);
229 int z_InfoCategory(ODR o, Z_InfoCategory **p, int opt)
231 if (!odr_sequence_begin(o, p, sizeof(**p)))
232 return opt && odr_ok(o);
234 odr_implicit(o, odr_oid, &(*p)->categoryTypeId, ODR_CONTEXT, 1, 1) &&
235 odr_implicit(o, odr_integer, &(*p)->categoryValue, ODR_CONTEXT, 2, 0) &&
239 int z_OtherInformationUnit(ODR o, Z_OtherInformationUnit **p, int opt)
241 static Odr_arm arm[] =
243 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_OtherInfo_characterInfo,
245 {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_OtherInfo_binaryInfo,
246 (Odr_fun)odr_octetstring},
247 {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_OtherInfo_externallyDefinedInfo,
248 (Odr_fun)z_External},
249 {ODR_IMPLICIT, ODR_CONTEXT, 5, Z_OtherInfo_oid, (Odr_fun)odr_oid},
253 if (!odr_sequence_begin(o, p, sizeof(**p)))
254 return opt && odr_ok(o);
256 odr_implicit(o, z_InfoCategory, &(*p)->category, ODR_CONTEXT, 1, 1) &&
257 odr_choice(o, arm, &(*p)->information, &(*p)->which) &&
261 int z_OtherInformation(ODR o, Z_OtherInformation **p, int opt)
263 if (o->direction == ODR_DECODE)
264 *p = (Z_OtherInformation *)odr_malloc(o, sizeof(**p));
267 odr_implicit_settag(o, ODR_CONTEXT, 201);
268 if (odr_sequence_of(o, (Odr_fun)z_OtherInformationUnit, &(*p)->list,
269 &(*p)->num_elements))
272 return opt && odr_ok(o);
275 int z_StringOrNumeric(ODR o, Z_StringOrNumeric **p, int opt)
277 static Odr_arm arm[] =
279 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_StringOrNumeric_string,
281 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_StringOrNumeric_numeric,
282 (Odr_fun)odr_integer},
286 if (o->direction == ODR_DECODE)
287 *p = (Z_StringOrNumeric *)odr_malloc(o, sizeof(**p));
290 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
293 return opt && odr_ok(o);
299 int z_Unit(ODR o, Z_Unit **p, int opt)
301 if (!odr_sequence_begin(o, p, sizeof(**p)))
302 return opt && odr_ok(o);
304 odr_explicit(o, z_InternationalString, &(*p)->unitSystem, ODR_CONTEXT,
306 odr_explicit(o, z_StringOrNumeric, &(*p)->unitType, ODR_CONTEXT,
308 odr_explicit(o, z_StringOrNumeric, &(*p)->unit, ODR_CONTEXT, 3, 1) &&
309 odr_implicit(o, odr_integer, &(*p)->scaleFactor, ODR_CONTEXT, 4, 1) &&
313 int z_IntUnit(ODR o, Z_IntUnit **p, int opt)
315 if (!odr_sequence_begin(o, p, sizeof(**p)))
316 return opt && odr_ok(o);
318 odr_implicit(o, odr_integer, &(*p)->value, ODR_CONTEXT, 1, 0) &&
319 odr_implicit(o, z_Unit, &(*p)->unitUsed, ODR_CONTEXT, 2, 0) &&
323 int z_StringList(ODR o, Z_StringList **p, int opt)
325 if (o->direction == ODR_DECODE)
326 *p = (Z_StringList *)odr_malloc(o, sizeof(**p));
329 if (odr_sequence_of(o, (Odr_fun)z_InternationalString, &(*p)->strings,
333 return opt && odr_ok(o);
336 /* ---------------------- INITIALIZE SERVICE ------------------- */
339 int z_NSRAuthentication(ODR o, Z_NSRAuthentication **p, int opt)
341 if (!odr_sequence_begin(o, p, sizeof(**p)))
342 return opt && odr_ok(o);
344 odr_visiblestring(o, &(*p)->user, 0) &&
345 odr_visiblestring(o, &(*p)->password, 0) &&
346 odr_visiblestring(o, &(*p)->account, 0) &&
351 int z_IdPass(ODR o, Z_IdPass **p, int opt)
353 if (!odr_sequence_begin(o, p, sizeof(**p)))
354 return opt && odr_ok(o);
356 odr_implicit(o, odr_visiblestring, &(*p)->groupId, ODR_CONTEXT, 0, 1) &&
357 odr_implicit(o, odr_visiblestring, &(*p)->userId, ODR_CONTEXT, 1, 1) &&
358 odr_implicit(o, odr_visiblestring, &(*p)->password, ODR_CONTEXT, 2,
363 int z_StrAuthentication(ODR o, char **p, int opt)
365 return odr_visiblestring(o, p, opt);
368 int z_IdAuthentication(ODR o, Z_IdAuthentication **p, int opt)
370 static Odr_arm arm[] =
372 {-1, -1, -1, Z_IdAuthentication_open, z_StrAuthentication},
373 {-1, -1, -1, Z_IdAuthentication_idPass, (Odr_fun)z_IdPass},
374 {-1, -1, -1, Z_IdAuthentication_anonymous, (Odr_fun)odr_null},
375 {-1, -1, -1, Z_IdAuthentication_other, (Odr_fun)z_External},
379 if (o->direction == ODR_DECODE)
380 *p = (Z_IdAuthentication *)odr_malloc(o, sizeof(**p));
384 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
387 return opt && odr_ok(o);
390 int z_InitRequest(ODR o, Z_InitRequest **p, int opt)
394 if (!odr_sequence_begin(o, p, sizeof(**p)))
395 return opt && odr_ok(o);
398 z_ReferenceId(o, &pp->referenceId, 1) &&
399 odr_implicit(o, odr_bitstring, &pp->protocolVersion, ODR_CONTEXT,
401 odr_implicit(o, odr_bitstring, &pp->options, ODR_CONTEXT, 4, 0) &&
402 odr_implicit(o, odr_integer, &pp->preferredMessageSize, ODR_CONTEXT,
404 odr_implicit(o, odr_integer, &pp->maximumRecordSize, ODR_CONTEXT,
406 odr_explicit(o, z_IdAuthentication, &pp->idAuthentication, ODR_CONTEXT,
408 odr_implicit(o, odr_visiblestring, &pp->implementationId, ODR_CONTEXT,
410 odr_implicit(o, odr_visiblestring, &pp->implementationName, ODR_CONTEXT,
412 odr_implicit(o, odr_visiblestring, &pp->implementationVersion,
413 ODR_CONTEXT, 112, 1) &&
414 z_UserInformationField(o, &pp->userInformationField, 1) &&
416 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
421 int z_InitResponse(ODR o, Z_InitResponse **p, int opt)
425 if (!odr_sequence_begin(o, p, sizeof(**p)))
426 return opt && odr_ok(o);
429 z_ReferenceId(o, &pp->referenceId, 1) &&
430 odr_implicit(o, odr_bitstring, &pp->protocolVersion, ODR_CONTEXT,
432 odr_implicit(o, odr_bitstring, &pp->options, ODR_CONTEXT, 4, 0) &&
433 odr_implicit(o, odr_integer, &pp->preferredMessageSize, ODR_CONTEXT,
435 odr_implicit(o, odr_integer, &pp->maximumRecordSize, ODR_CONTEXT,
437 odr_implicit(o, odr_bool, &pp->result, ODR_CONTEXT, 12, 0) &&
438 odr_implicit(o, odr_visiblestring, &pp->implementationId, ODR_CONTEXT,
440 odr_implicit(o, odr_visiblestring, &pp->implementationName, ODR_CONTEXT,
442 odr_implicit(o, odr_visiblestring, &pp->implementationVersion,
443 ODR_CONTEXT, 112, 1) &&
444 z_UserInformationField(o, &pp->userInformationField, 1) &&
446 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
451 /* ------------------ RESOURCE CONTROL ----------------*/
453 int z_TriggerResourceControlRequest(ODR o, Z_TriggerResourceControlRequest **p,
456 if (!odr_sequence_begin(o, p, sizeof(**p)))
457 return opt && odr_ok(o);
459 z_ReferenceId(o, &(*p)->referenceId, 1) &&
460 odr_implicit(o, odr_integer, &(*p)->requestedAction, ODR_CONTEXT,
462 odr_implicit(o, odr_oid, &(*p)->prefResourceReportFormat,
463 ODR_CONTEXT, 47, 1) &&
464 odr_implicit(o, odr_bool, &(*p)->resultSetWanted, ODR_CONTEXT,
467 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
472 int z_ResourceControlRequest(ODR o, Z_ResourceControlRequest **p, int opt)
474 if (!odr_sequence_begin(o, p, sizeof(**p)))
475 return opt && odr_ok(o);
477 z_ReferenceId(o, &(*p)->referenceId, 1) &&
478 odr_implicit(o, odr_bool, &(*p)->suspendedFlag, ODR_CONTEXT, 39, 1)&&
479 odr_explicit(o, z_External, &(*p)->resourceReport, ODR_CONTEXT,
481 odr_implicit(o, odr_integer, &(*p)->partialResultsAvailable,
482 ODR_CONTEXT, 41, 1) &&
483 odr_implicit(o, odr_bool, &(*p)->responseRequired, ODR_CONTEXT,
485 odr_implicit(o, odr_bool, &(*p)->triggeredRequestFlag,
486 ODR_CONTEXT, 43, 1) &&
488 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
493 int z_ResourceControlResponse(ODR o, Z_ResourceControlResponse **p, int opt)
495 if (!odr_sequence_begin(o, p, sizeof(**p)))
496 return opt && odr_ok(o);
498 z_ReferenceId(o, &(*p)->referenceId, 1) &&
499 odr_implicit(o, odr_bool, &(*p)->continueFlag, ODR_CONTEXT, 44, 0) &&
500 odr_implicit(o, odr_bool, &(*p)->resultSetWanted, ODR_CONTEXT,
503 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
508 /* ------------------------ SEARCH SERVICE ----------------------- */
510 int z_DatabaseSpecificUnit(ODR o, Z_DatabaseSpecificUnit **p, int opt)
512 if (!odr_sequence_begin(o, p, sizeof(**p)))
513 return opt && odr_ok(o);
515 z_DatabaseName(o, &(*p)->databaseName, 0) &&
516 z_ElementSetName(o, &(*p)->elementSetName, 0) &&
520 int z_DatabaseSpecific(ODR o, Z_DatabaseSpecific **p, int opt)
522 if (o->direction == ODR_DECODE)
523 *p = (Z_DatabaseSpecific *)odr_malloc(o, sizeof(**p));
527 odr_implicit_settag(o, ODR_CONTEXT, 1);
528 if (odr_sequence_of(o, (Odr_fun)z_DatabaseSpecificUnit, &(*p)->elements,
529 &(*p)->num_elements))
535 int z_ElementSetNames(ODR o, Z_ElementSetNames **p, int opt)
537 static Odr_arm arm[] =
539 {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_ElementSetNames_generic,
541 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ElementSetNames_databaseSpecific,
542 (Odr_fun)z_DatabaseSpecific},
546 if (o->direction == ODR_DECODE)
547 *p = (Z_ElementSetNames *)odr_malloc(o, sizeof(**p));
549 return opt && odr_ok(o);
551 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
557 /* ----------------------- RPN QUERY -----------------------*/
559 int z_ComplexAttribute(ODR o, Z_ComplexAttribute **p, int opt)
561 if (!odr_sequence_begin(o, p, sizeof(**p)))
562 return opt && odr_ok(o);
564 odr_implicit_settag(o, ODR_CONTEXT, 1) &&
565 odr_sequence_of(o, (Odr_fun)z_StringOrNumeric, &(*p)->list,
567 odr_implicit_settag(o, ODR_CONTEXT, 2) &&
568 (odr_sequence_of(o, (Odr_fun)odr_integer, &(*p)->semanticAction,
569 &(*p)->num_semanticAction) || odr_ok(o)) &&
573 int z_AttributeElement(ODR o, Z_AttributeElement **p, int opt)
576 static Odr_arm arm[] =
578 {ODR_IMPLICIT, ODR_CONTEXT, 121, Z_AttributeValue_numeric,
579 (Odr_fun)odr_integer},
580 {ODR_IMPLICIT, ODR_CONTEXT, 224, Z_AttributeValue_complex,
581 (Odr_fun)z_ComplexAttribute},
586 if (!odr_sequence_begin(o, p, sizeof(**p)))
587 return opt && odr_ok(o);
590 odr_implicit(o, odr_oid, &(*p)->attributeSet, ODR_CONTEXT, 1, 1) &&
592 odr_implicit(o, odr_integer, &(*p)->attributeType, ODR_CONTEXT,
595 odr_choice(o, arm, &(*p)->value, &(*p)->which) &&
597 odr_implicit(o, odr_integer, &(*p)->attributeValue, ODR_CONTEXT,
603 int z_Term(ODR o, Z_Term **p, int opt)
605 static Odr_arm arm[] =
607 {ODR_IMPLICIT, ODR_CONTEXT, 45, Z_Term_general, (Odr_fun)odr_octetstring},
608 {ODR_IMPLICIT, ODR_CONTEXT, 215, Z_Term_numeric, (Odr_fun)odr_integer},
609 {ODR_IMPLICIT, ODR_CONTEXT, 216, Z_Term_characterString,
611 {ODR_IMPLICIT, ODR_CONTEXT, 217, Z_Term_oid, (Odr_fun)odr_oid},
612 {ODR_IMPLICIT, ODR_CONTEXT, 218, Z_Term_dateTime, odr_cstring},
613 {ODR_IMPLICIT, ODR_CONTEXT, 219, Z_Term_external, (Odr_fun)z_External},
614 /* add intUnit here */
615 {ODR_IMPLICIT, ODR_CONTEXT, 221, Z_Term_null, (Odr_fun)odr_null},
619 if (o->direction ==ODR_DECODE)
620 *p = (Z_Term *)odr_malloc(o, sizeof(**p));
623 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
626 return opt && odr_ok(o);
629 int z_AttributesPlusTerm(ODR o, Z_AttributesPlusTerm **p, int opt)
631 if (!(odr_implicit_settag(o, ODR_CONTEXT, 102) &&
632 odr_sequence_begin(o, p, sizeof(**p))))
633 return opt && odr_ok(o);
635 odr_implicit_settag(o, ODR_CONTEXT, 44) &&
636 odr_sequence_of(o, (Odr_fun)z_AttributeElement, &(*p)->attributeList,
637 &(*p)->num_attributes) &&
638 z_Term(o, &(*p)->term, 0) &&
642 int z_ResultSetPlusAttributes(ODR o, Z_ResultSetPlusAttributes **p, int opt)
644 if (!(odr_implicit_settag(o, ODR_CONTEXT, 214) &&
645 odr_sequence_begin(o, p, sizeof(**p))))
646 return opt && odr_ok(o);
648 z_ResultSetId(o, &(*p)->resultSet, 0) &&
649 odr_implicit_settag(o, ODR_CONTEXT, 44) &&
650 odr_sequence_of(o, (Odr_fun)z_AttributeElement, &(*p)->attributeList,
651 &(*p)->num_attributes) &&
655 int z_ProximityOperator(ODR o, Z_ProximityOperator **p, int opt)
657 static Odr_arm arm[] =
659 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ProxCode_known, (Odr_fun)odr_integer},
660 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ProxCode_private, (Odr_fun)odr_integer},
664 if (!odr_sequence_begin(o, p, sizeof(**p)))
665 return opt && odr_ok(o);
667 odr_implicit(o, odr_bool, &(*p)->exclusion, ODR_CONTEXT, 1, 1) &&
668 odr_implicit(o, odr_integer, &(*p)->distance, ODR_CONTEXT, 2, 0) &&
669 odr_implicit(o, odr_bool, &(*p)->ordered, ODR_CONTEXT, 3, 0) &&
670 odr_implicit(o, odr_integer, &(*p)->relationType, ODR_CONTEXT, 4, 0) &&
671 odr_constructed_begin(o, &(*p)->proximityUnitCode, ODR_CONTEXT, 5) &&
672 odr_choice(o, arm, &(*p)->proximityUnitCode, &(*p)->which) &&
673 odr_constructed_end(o) &&
677 int z_Operator(ODR o, Z_Operator **p, int opt)
679 static Odr_arm arm[] =
681 {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_Operator_and, (Odr_fun)odr_null},
682 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Operator_or, (Odr_fun)odr_null},
683 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Operator_and_not, (Odr_fun)odr_null},
684 {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_Operator_prox, (Odr_fun)z_ProximityOperator},
688 if (!*p && o->direction != ODR_DECODE)
690 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 46))
691 return opt && odr_ok(o);
692 if (o->direction == ODR_DECODE)
693 *p = (Z_Operator *)odr_malloc(o, sizeof(**p));
695 if (odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
696 odr_constructed_end(o))
699 return opt && odr_ok(o);
702 int z_Operand(ODR o, Z_Operand **p, int opt)
704 static Odr_arm arm[] =
706 {-1, -1, -1, Z_Operand_APT, (Odr_fun)z_AttributesPlusTerm},
707 {-1, -1, -1, Z_Operand_resultSetId, (Odr_fun)z_ResultSetId},
708 {-1, -1, -1, Z_Operand_resultAttr, (Odr_fun)z_ResultSetPlusAttributes},
712 if (o->direction == ODR_DECODE)
713 *p = (Z_Operand *)odr_malloc(o, sizeof(**p));
716 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
719 return opt && odr_ok(o);
722 int z_RPNStructure(ODR o, Z_RPNStructure **p, int opt);
724 int z_Complex(ODR o, Z_Complex **p, int opt)
726 if (!odr_sequence_begin(o, p, sizeof(**p)))
727 return opt && odr_ok(o);
729 z_RPNStructure(o, &(*p)->s1, 0) &&
730 z_RPNStructure(o, &(*p)->s2, 0) &&
731 z_Operator(o, &(*p)->roperator, 0) &&
735 int z_RPNStructure(ODR o, Z_RPNStructure **p, int opt)
737 static Odr_arm arm[] =
739 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_RPNStructure_simple, (Odr_fun)z_Operand},
740 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_RPNStructure_complex, (Odr_fun)z_Complex},
744 if (o->direction == ODR_DECODE)
745 *p = (Z_RPNStructure *)odr_malloc(o, sizeof(**p));
748 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
751 return opt && odr_ok(o);
754 int z_RPNQuery(ODR o, Z_RPNQuery **p, int opt)
756 if (!odr_sequence_begin(o, p, sizeof(**p)))
757 return opt && odr_ok(o);
759 odr_oid(o, &(*p)->attributeSetId, 0) &&
760 z_RPNStructure(o, &(*p)->RPNStructure, 0) &&
764 /* -----------------------END RPN QUERY ----------------------- */
766 int z_Query(ODR o, Z_Query **p, int opt)
768 static Odr_arm arm[] =
770 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Query_type_1, (Odr_fun)z_RPNQuery},
771 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_Query_type_2, (Odr_fun)odr_octetstring},
772 {ODR_IMPLICIT, ODR_CONTEXT, 101, Z_Query_type_101, (Odr_fun)z_RPNQuery},
776 if (o->direction == ODR_DECODE)
777 *p = (Z_Query *)odr_malloc(o, sizeof(**p));
780 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
783 return opt && odr_ok(o);
786 int z_SearchRequest(ODR o, Z_SearchRequest **p, int opt)
790 if (!odr_sequence_begin(o, p, sizeof(**p)))
791 return opt && odr_ok(o);
794 z_ReferenceId(o, &pp->referenceId, 1) &&
795 odr_implicit(o, odr_integer, &pp->smallSetUpperBound, ODR_CONTEXT,
797 odr_implicit(o, odr_integer, &pp->largeSetLowerBound, ODR_CONTEXT,
799 odr_implicit(o, odr_integer, &pp->mediumSetPresentNumber, ODR_CONTEXT,
801 odr_implicit(o, odr_bool, &pp->replaceIndicator, ODR_CONTEXT, 16, 1) &&
802 odr_implicit(o, odr_visiblestring, &pp->resultSetName, ODR_CONTEXT,
804 odr_implicit_settag(o, ODR_CONTEXT, 18) &&
805 odr_sequence_of(o, z_DatabaseName, &pp->databaseNames,
806 &pp->num_databaseNames) &&
807 odr_explicit(o, z_ElementSetNames, &pp->smallSetElementSetNames,
808 ODR_CONTEXT, 100, 1) &&
809 odr_explicit(o, z_ElementSetNames, &pp->mediumSetElementSetNames,
810 ODR_CONTEXT, 101, 1) &&
811 odr_implicit(o, odr_oid, &pp->preferredRecordSyntax,
812 ODR_CONTEXT, 104, 1) &&
813 odr_explicit(o, z_Query, &pp->query, ODR_CONTEXT, 21, 0) &&
815 odr_implicit(o, z_OtherInformation, &(*p)->additionalSearchInfo,
816 ODR_CONTEXT, 203, 1) &&
817 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
822 /* ------------------------ RECORD ------------------------- */
824 int z_DatabaseRecord(ODR o, Z_DatabaseRecord **p, int opt)
826 return z_External(o, (Z_External **) p, opt);
831 int z_DefaultDiagFormat(ODR o, Z_DefaultDiagFormat **p, int opt)
833 static Odr_arm arm[] =
835 {-1, -1, -1, Z_DiagForm_v2AddInfo, odr_visiblestring},
836 {-1, -1, -1, Z_DiagForm_v3AddInfo, z_InternationalString},
837 {ODR_IMPLICIT, ODR_CONTEXT, ODR_VISIBLESTRING, Z_DiagForm_v2AddInfo,
838 odr_visiblestring}, /* To cater to a bug in the CNIDR servers */
841 if (!odr_sequence_begin(o, p, sizeof(**p)))
842 return opt && odr_ok(o);
844 odr_oid(o, &(*p)->diagnosticSetId, 1) && /* SHOULD NOT BE OPT! */
845 odr_integer(o, &(*p)->condition, 0) &&
847 * I no longer recall what server tagged the addinfo.. but it isn't
848 * hurting anyone, so...
849 * We need to turn it into a choice, or something, because of
850 * that damn generalstring in v3.
852 odr_choice(o, arm, &(*p)->addinfo, &(*p)->which) &&
856 int z_DiagRec(ODR o, Z_DiagRec **p, int opt)
858 static Odr_arm arm[] =
860 {-1, -1, -1, Z_DiagRec_defaultFormat, (Odr_fun)z_DefaultDiagFormat},
861 {-1, -1, -1, Z_DiagRec_externallyDefined, (Odr_fun)z_External},
865 if (o->direction == ODR_DECODE)
866 *p = (Z_DiagRec *)odr_malloc(o, sizeof(**p));
869 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
872 return opt && odr_ok(o);
877 int z_DiagRec(ODR o, Z_DiagRec **p, int opt)
879 if (!odr_sequence_begin(o, p, sizeof(**p)))
880 return opt && odr_ok(o);
882 odr_oid(o, &(*p)->diagnosticSetId, 1) && /* SHOULD NOT BE OPT! */
883 odr_integer(o, &(*p)->condition, 0) &&
885 * I no longer recall what server tagged the addinfo.. but it isn't
886 * hurting anyone, so...
887 * We need to turn it into a choice, or something, because of
888 * that damn generalstring in v3.
890 (odr_visiblestring(o, &(*p)->addinfo, 0) ||
891 odr_implicit(o, odr_cstring, &(*p)->addinfo, ODR_CONTEXT,
892 ODR_VISIBLESTRING, 1)) &&
898 int z_DiagRecs(ODR o, Z_DiagRecs **p, int opt)
900 if (o->direction == ODR_DECODE)
901 *p = (Z_DiagRecs *)odr_malloc(o, sizeof(**p));
905 if (odr_sequence_of(o, (Odr_fun)z_DiagRec, &(*p)->diagRecs,
906 &(*p)->num_diagRecs))
909 return opt && odr_ok(o);
912 int z_NamePlusRecord(ODR o, Z_NamePlusRecord **p, int opt)
914 static Odr_arm arm[] =
916 {ODR_EXPLICIT, ODR_CONTEXT, 1, Z_NamePlusRecord_databaseRecord,
917 (Odr_fun)z_DatabaseRecord},
918 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_NamePlusRecord_surrogateDiagnostic,
923 if (!odr_sequence_begin(o, p, sizeof(**p)))
924 return opt && odr_ok(o);
926 odr_implicit(o, z_DatabaseName, &(*p)->databaseName, ODR_CONTEXT,
928 odr_constructed_begin(o, &(*p)->u, ODR_CONTEXT, 1) &&
929 odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
930 odr_constructed_end(o) &&
934 int z_NamePlusRecordList(ODR o, Z_NamePlusRecordList **p, int opt)
936 if (o->direction == ODR_DECODE)
937 *p = (Z_NamePlusRecordList *)odr_malloc(o, sizeof(**p));
940 if (odr_sequence_of(o, (Odr_fun)z_NamePlusRecord, &(*p)->records,
947 int z_Records(ODR o, Z_Records **p, int opt)
949 static Odr_arm arm[] =
951 {ODR_IMPLICIT, ODR_CONTEXT, 28, Z_Records_DBOSD, (Odr_fun)z_NamePlusRecordList},
952 {ODR_IMPLICIT, ODR_CONTEXT, 130, Z_Records_NSD, (Odr_fun)z_DiagRec},
953 {ODR_IMPLICIT, ODR_CONTEXT, 205, Z_Records_multipleNSD,
954 (Odr_fun)z_DiagRecs},
958 if (o->direction == ODR_DECODE)
959 *p = (Z_Records *)odr_malloc(o, sizeof(**p));
962 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
965 return opt && odr_ok(o);
968 /* ------------------------ ACCESS CTRL SERVICE ----------------------- */
970 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},
976 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_AccessRequest_externallyDefined,
977 (Odr_fun)z_External},
980 if (!odr_sequence_begin(o, p, sizeof(**p)))
981 return opt && odr_ok(o);
983 z_ReferenceId(o, &(*p)->referenceId, 1) &&
984 odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
986 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
991 int z_AccessControlResponse(ODR o, Z_AccessControlResponse **p, int opt)
993 static Odr_arm arm[] =
995 {ODR_IMPLICIT, ODR_CONTEXT, 38, Z_AccessResponse_simpleForm,
996 (Odr_fun)odr_octetstring},
997 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_AccessResponse_externallyDefined,
998 (Odr_fun)z_External},
1001 if (!odr_sequence_begin(o, p, sizeof(**p)))
1002 return opt && odr_ok(o);
1004 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1005 odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
1006 odr_explicit(o, z_DiagRec, &(*p)->diagnostic, ODR_CONTEXT, 223, 1) &&
1008 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1010 odr_sequence_end(o);
1013 /* ------------------------ SCAN SERVICE -------------------- */
1015 int z_AttributeList(ODR o, Z_AttributeList **p, int opt)
1017 if (o->direction == ODR_DECODE)
1018 *p = (Z_AttributeList *)odr_malloc(o, sizeof(**p));
1022 odr_implicit_settag(o, ODR_CONTEXT, 44);
1023 if (odr_sequence_of(o, (Odr_fun)z_AttributeElement, &(*p)->attributes,
1024 &(*p)->num_attributes))
1027 return opt && odr_ok(o);
1031 * This is a temporary hack. We don't know just *what* old version of the
1032 * protocol willow uses, so we'll just patiently wait for them to update
1034 static int willow_scan = 0;
1036 int z_WillowAttributesPlusTerm(ODR o, Z_AttributesPlusTerm **p, int opt)
1038 if (!*p && o->direction != ODR_DECODE)
1040 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 4))
1043 return opt && odr_ok(o);
1045 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 1))
1047 if (!odr_constructed_begin(o, p, ODR_UNIVERSAL, ODR_SEQUENCE))
1049 if (!odr_implicit_settag(o, ODR_CONTEXT, 44))
1051 if (o->direction == ODR_DECODE)
1052 *p = (Z_AttributesPlusTerm*)odr_malloc(o, sizeof(**p));
1053 if (!odr_sequence_of(o, (Odr_fun)z_AttributeElement, &(*p)->attributeList,
1054 &(*p)->num_attributes))
1056 if (!odr_sequence_end(o) || !odr_sequence_end(o))
1058 if (!z_Term(o, &(*p)->term, 0))
1060 if (!odr_constructed_end(o))
1066 int z_AlternativeTerm(ODR o, Z_AlternativeTerm **p, int opt)
1068 if (o->direction == ODR_DECODE)
1069 *p = (Z_AlternativeTerm *)odr_malloc(o, sizeof(**p));
1073 return opt && odr_ok(o);
1076 if (odr_sequence_of(o, (Odr_fun)z_AttributesPlusTerm, &(*p)->terms,
1080 return opt && !o->error;
1085 int z_ByDatabase(ODR o, Z_ByDatabase **p, int opt)
1087 if (!odr_sequence_begin(o, p, sizeof(**p)))
1088 return opt && odr_ok(o);
1090 z_DatabaseName(o, &(*p)->db, 1) &&
1091 odr_implicit(o, odr_integer, &(*p)->num, ODR_CONTEXT, 1, 1) &&
1092 z_OtherInformation(o, &(*p)->otherDbInfo, 1) &&
1093 odr_sequence_end(o);
1096 int z_ByDatabaseList(ODR o, Z_ByDatabaseList **p, int opt)
1098 if (!odr_initmember(o, p, sizeof(**p)))
1099 return opt && odr_ok(o);
1100 if (odr_sequence_of(o, (Odr_fun)z_ByDatabase, &(*p)->elements, &(*p)->num_elements))
1103 return opt && odr_ok(o);
1106 int z_ScanOccurrences(ODR o, Z_ScanOccurrences **p, int opt)
1110 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_ScanOccurrences_global, (Odr_fun)odr_integer},
1111 {ODR_EXPLICIT, ODR_CONTEXT, 3, Z_ScanOccurrences_byDatabase,
1112 (Odr_fun)z_ByDatabaseList},
1116 if (!odr_initmember(o, p, sizeof(**p)))
1117 return opt && odr_ok(o);
1118 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
1121 return opt && odr_ok(o);
1124 int z_OccurrenceByAttributesElem(ODR o, Z_OccurrenceByAttributesElem **p,
1127 if (!odr_sequence_begin(o, p, sizeof(**p)))
1128 return opt && odr_ok(o);
1130 odr_explicit(o, z_AttributeList, &(*p)->attributes, ODR_CONTEXT,
1132 z_ScanOccurrences(o, &(*p)->occurrences, 1) &&
1133 z_OtherInformation(o, &(*p)->otherOccurInfo, 1) &&
1134 odr_sequence_end(o);
1137 int z_OccurrenceByAttributes(ODR o, Z_OccurrenceByAttributes **p, int opt)
1139 if (!odr_initmember(o, p, sizeof(**p)))
1140 return opt && odr_ok(o);
1141 if (!odr_sequence_of(o, (Odr_fun)z_OccurrenceByAttributesElem, &(*p)->elements,
1142 &(*p)->num_elements))
1145 return opt && odr_ok(o);
1151 * Incomplete definition of occurencebyattributes.
1154 int z_OccurrenceByAttributes(ODR o, Z_OccurrenceByAttributes **p, int opt)
1156 if (!odr_sequence_begin(o, p, sizeof(**p)))
1157 return opt && odr_ok(o);
1159 odr_explicit(o, z_AttributeList, &(*p)->attributes, ODR_CONTEXT, 1, 1)&&
1160 odr_explicit(o, odr_integer, &(*p)->global, ODR_CONTEXT, 2, 1) &&
1161 odr_sequence_end(o);
1166 int z_TermInfo(ODR o, Z_TermInfo **p, int opt)
1168 if (!odr_sequence_begin(o, p, sizeof(**p)))
1169 return opt && odr_ok(o);
1172 odr_implicit(o, z_Term, &(*p)->term, ODR_CONTEXT, 1, 0) :
1173 z_Term(o, &(*p)->term, 0)) &&
1174 odr_implicit(o, z_InternationalString, &(*p)->displayTerm, ODR_CONTEXT,
1176 z_AttributeList(o, &(*p)->suggestedAttributes, 1) &&
1177 odr_implicit(o, z_AlternativeTerm, &(*p)->alternativeTerm,
1178 ODR_CONTEXT, 4, 1) &&
1179 odr_implicit(o, odr_integer, &(*p)->globalOccurrences, ODR_CONTEXT,
1181 odr_implicit(o, z_OccurrenceByAttributes, &(*p)->byAttributes,
1182 ODR_CONTEXT, 3, 1) &&
1183 z_OtherInformation(o, &(*p)->otherTermInfo, 1) &&
1184 odr_sequence_end(o);
1187 int z_Entry(ODR o, Z_Entry **p, int opt)
1189 static Odr_arm arm[] =
1191 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Entry_termInfo, (Odr_fun)z_TermInfo},
1192 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_Entry_surrogateDiagnostic,
1193 (Odr_fun)z_DiagRec},
1197 if (o->direction == ODR_DECODE)
1198 *p = (Z_Entry *)odr_malloc(o, sizeof(**p));
1202 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
1205 return opt && odr_ok(o);
1208 #ifdef BUGGY_LISTENTRIES
1210 int z_Entries(ODR o, Z_Entries **p, int opt)
1212 if (o->direction == ODR_DECODE)
1213 *p = (Z_Entries *)odr_malloc(o, sizeof(**p));
1217 if (odr_sequence_of(o, (Odr_fun)z_Entry, &(*p)->entries,
1218 &(*p)->num_entries))
1224 int z_ListEntries(ODR o, Z_ListEntries **p, int opt)
1226 static Odr_arm arm[] =
1228 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ListEntries_entries, (Odr_fun)z_Entries},
1229 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ListEntries_nonSurrogateDiagnostics,
1230 (Odr_fun)z_DiagRecs},
1234 if (o->direction == ODR_DECODE)
1235 *p = (Z_ListEntries *)odr_malloc(o, sizeof(**p));
1239 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
1242 return opt && odr_ok(o);
1247 int z_ListEntries (ODR o, Z_ListEntries **p, int opt)
1249 if (!odr_sequence_begin (o, p, sizeof(**p)))
1250 return opt && odr_ok (o);
1252 odr_implicit_settag (o, ODR_CONTEXT, 1) &&
1253 (odr_sequence_of(o, (Odr_fun) z_Entry, &(*p)->entries,
1254 &(*p)->num_entries) || odr_ok(o)) &&
1255 odr_implicit_settag (o, ODR_CONTEXT, 2) &&
1256 (odr_sequence_of(o, (Odr_fun) z_DiagRec, &(*p)->nonsurrogateDiagnostics,
1257 &(*p)->num_nonsurrogateDiagnostics) || odr_ok(o)) &&
1258 odr_sequence_end (o);
1261 int z_ScanRequest(ODR o, Z_ScanRequest **p, int opt)
1263 if (!odr_sequence_begin(o, p, sizeof(**p)))
1264 return opt && odr_ok(o);
1267 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1268 odr_implicit_settag(o, ODR_CONTEXT, 3) &&
1269 odr_sequence_of(o, z_DatabaseName, &(*p)->databaseNames,
1270 &(*p)->num_databaseNames) &&
1271 odr_oid(o, &(*p)->attributeSet, 1) &&
1272 (z_AttributesPlusTerm(o, &(*p)->termListAndStartPoint, 1) ?
1273 ((*p)->termListAndStartPoint ? 1 :
1274 z_WillowAttributesPlusTerm(o, &(*p)->termListAndStartPoint, 0)) : 0) &&
1275 odr_implicit(o, odr_integer, &(*p)->stepSize, ODR_CONTEXT, 5, 1) &&
1276 odr_implicit(o, odr_integer, &(*p)->numberOfTermsRequested,
1277 ODR_CONTEXT, 6, 0) &&
1278 odr_implicit(o, odr_integer, &(*p)->preferredPositionInResponse,
1279 ODR_CONTEXT, 7, 1) &&
1280 odr_sequence_end(o);
1283 int z_ScanResponse(ODR o, Z_ScanResponse **p, int opt)
1285 if (!odr_sequence_begin(o, p, sizeof(**p)))
1286 return opt && odr_ok(o);
1288 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1289 odr_implicit(o, odr_integer, &(*p)->stepSize, ODR_CONTEXT, 3, 1) &&
1290 odr_implicit(o, odr_integer, &(*p)->scanStatus, ODR_CONTEXT, 4, 0) &&
1291 odr_implicit(o, odr_integer, &(*p)->numberOfEntriesReturned,
1292 ODR_CONTEXT, 5, 0) &&
1293 odr_implicit(o, odr_integer, &(*p)->positionOfTerm, ODR_CONTEXT, 6, 1)&&
1294 odr_implicit(o, z_ListEntries, &(*p)->entries, ODR_CONTEXT, 7, 1) &&
1295 odr_implicit(o, odr_oid, &(*p)->attributeSet, ODR_CONTEXT, 8, 1) &&
1296 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1297 odr_sequence_end(o);
1300 /* ------------------------ SEARCHRESPONSE ----------------*/
1302 int z_NumberOfRecordsReturned(ODR o, int **p, int opt)
1304 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 24, opt);
1307 int z_NextResultSetPosition(ODR o, int **p, int opt)
1309 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 25, opt);
1312 int z_PresentStatus(ODR o, int **p, int opt)
1314 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 27, opt);
1317 int z_SearchResponse(ODR o, Z_SearchResponse **p, int opt)
1319 Z_SearchResponse *pp;
1321 if (!odr_sequence_begin(o, p, sizeof(**p)))
1322 return opt && odr_ok(o);
1325 z_ReferenceId(o, &pp->referenceId, 1) &&
1326 odr_implicit(o, odr_integer, &pp->resultCount, ODR_CONTEXT, 23, 0) &&
1327 z_NumberOfRecordsReturned(o, &pp->numberOfRecordsReturned, 0) &&
1328 z_NextResultSetPosition(o, &pp->nextResultSetPosition, 0) &&
1329 odr_implicit(o, odr_bool, &pp->searchStatus, ODR_CONTEXT, 22, 0) &&
1330 odr_implicit(o, odr_integer, &pp->resultSetStatus, ODR_CONTEXT, 26,
1332 z_PresentStatus(o, &pp->presentStatus, 1) &&
1333 z_Records(o, &pp->records, 1) &&
1335 odr_implicit(o, z_OtherInformation, &(*p)->additionalSearchInfo,
1336 ODR_CONTEXT, 203, 1) &&
1337 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1339 odr_sequence_end(o);
1342 /* --------------------- PRESENT SERVICE ---------------------- */
1344 int z_ElementSpec(ODR o, Z_ElementSpec **p, int opt)
1346 static Odr_arm arm[] =
1348 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ElementSpec_elementSetName,
1350 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ElementSpec_externalSpec,
1351 (Odr_fun)z_External},
1355 if (o->direction == ODR_DECODE)
1356 *p = (Z_ElementSpec *)odr_malloc(o, sizeof(**p));
1360 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
1363 return opt && odr_ok(o);
1366 int z_Specification(ODR o, Z_Specification **p, int opt)
1368 if (!odr_sequence_begin(o, p, sizeof(**p)))
1369 return opt && odr_ok(o);
1371 odr_implicit(o, odr_oid, &(*p)->schema, ODR_CONTEXT, 1, 1) &&
1372 z_ElementSpec(o, &(*p)->elementSpec, 1) &&
1373 odr_sequence_end(o);
1376 int z_DbSpecific(ODR o, Z_DbSpecific **p, int opt)
1378 if (!odr_sequence_begin(o, p, sizeof(**p)))
1379 return opt && odr_ok(o);
1381 odr_explicit(o, z_DatabaseName, &(*p)->databaseName, ODR_CONTEXT,
1383 odr_implicit(o, z_Specification, &(*p)->spec, ODR_CONTEXT, 2, 0) &&
1384 odr_sequence_end(o);
1387 int z_CompSpec(ODR o, Z_CompSpec **p, int opt)
1389 if (!odr_sequence_begin(o, p, sizeof(**p)))
1390 return opt && odr_ok(o);
1392 odr_implicit(o, odr_bool, &(*p)->selectAlternativeSyntax, ODR_CONTEXT,
1394 odr_implicit(o, z_Specification, &(*p)->generic, ODR_CONTEXT, 2, 1) &&
1395 odr_implicit_settag(o, ODR_CONTEXT, 3) &&
1396 (odr_sequence_of(o, (Odr_fun)z_DbSpecific, &(*p)->dbSpecific,
1397 &(*p)->num_dbSpecific) || odr_ok(o)) &&
1398 odr_implicit_settag(o, ODR_CONTEXT, 4) &&
1399 (odr_sequence_of(o, (Odr_fun)odr_oid, &(*p)->recordSyntax,
1400 &(*p)->num_recordSyntax) || odr_ok(o)) &&
1401 odr_sequence_end(o);
1404 int z_RecordComposition(ODR o, Z_RecordComposition **p, int opt)
1406 static Odr_arm arm[] =
1408 {ODR_EXPLICIT, ODR_CONTEXT, 19, Z_RecordComp_simple,
1409 (Odr_fun)z_ElementSetNames},
1410 {ODR_IMPLICIT, ODR_CONTEXT, 209, Z_RecordComp_complex,
1411 (Odr_fun)z_CompSpec},
1415 if (o->direction == ODR_DECODE)
1416 *p = (Z_RecordComposition *)odr_malloc(o, sizeof(**p));
1420 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
1423 return opt && odr_ok(o);
1426 int z_Range(ODR o, Z_Range **p, int opt)
1428 if (!odr_sequence_begin(o, p, sizeof(**p)))
1429 return opt && odr_ok(o);
1431 odr_implicit(o, odr_integer, &(*p)->startingPosition, ODR_CONTEXT,
1433 odr_implicit(o, odr_integer, &(*p)->numberOfRecords, ODR_CONTEXT,
1435 odr_sequence_end(o);
1438 int z_PresentRequest(ODR o, Z_PresentRequest **p, int opt)
1440 Z_PresentRequest *pp;
1442 if (!odr_sequence_begin(o, p, sizeof(**p)))
1443 return opt && odr_ok(o);
1446 z_ReferenceId(o, &pp->referenceId, 1) &&
1447 z_ResultSetId(o, &pp->resultSetId, 0) &&
1448 odr_implicit(o, odr_integer, &pp->resultSetStartPoint, ODR_CONTEXT,
1450 odr_implicit(o, odr_integer, &pp->numberOfRecordsRequested, ODR_CONTEXT,
1453 odr_implicit_settag(o, ODR_CONTEXT, 212) &&
1454 (odr_sequence_of(o, (Odr_fun)z_Range, &(*p)->additionalRanges,
1455 &(*p)->num_ranges) || odr_ok(o)) &&
1456 z_RecordComposition(o, &(*p)->recordComposition, 1) &&
1458 odr_explicit(o, z_ElementSetNames, &pp->elementSetNames, ODR_CONTEXT,
1461 odr_implicit(o, odr_oid, &(*p)->preferredRecordSyntax, ODR_CONTEXT,
1464 odr_implicit(o, odr_integer, &(*p)->maxSegmentCount, ODR_CONTEXT,
1466 odr_implicit(o, odr_integer, &(*p)->maxRecordSize, ODR_CONTEXT,
1468 odr_implicit(o, odr_integer, &(*p)->maxSegmentSize, ODR_CONTEXT,
1470 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1472 odr_sequence_end(o);
1475 int z_PresentResponse(ODR o, Z_PresentResponse **p, int opt)
1477 Z_PresentResponse *pp;
1479 if (!odr_sequence_begin(o, p, sizeof(**p)))
1480 return opt && odr_ok(o);
1483 z_ReferenceId(o, &pp->referenceId, 1) &&
1484 z_NumberOfRecordsReturned(o, &pp->numberOfRecordsReturned, 0) &&
1485 z_NextResultSetPosition(o, &pp->nextResultSetPosition, 0) &&
1486 z_PresentStatus(o, &pp->presentStatus, 0) &&
1487 z_Records(o, &pp->records, 1) &&
1489 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1491 odr_sequence_end(o);
1494 /* ----------------------DELETE -------------------------- */
1496 int z_DeleteSetStatus(ODR o, int **p, int opt)
1498 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 33, opt);
1501 int z_ListStatus(ODR o, Z_ListStatus **p, int opt)
1503 if (!odr_sequence_begin(o, p, sizeof(**p)))
1504 return opt && odr_ok(o);
1506 z_ResultSetId(o, &(*p)->id, 0) &&
1507 z_DeleteSetStatus(o, &(*p)->status, 0) &&
1508 odr_sequence_end(o);
1511 int z_DeleteResultSetRequest(ODR o, Z_DeleteResultSetRequest **p, int opt)
1513 if (!odr_sequence_begin(o, p, sizeof(**p)))
1514 return opt && odr_ok(o);
1516 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1517 odr_implicit(o, odr_integer, &(*p)->deleteFunction, ODR_CONTEXT, 32,
1519 (odr_sequence_of(o, z_ResultSetId, &(*p)->resultSetList,
1520 &(*p)->num_resultSetList) || odr_ok(o)) &&
1522 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1524 odr_sequence_end(o);
1527 int z_ListStatuses (ODR o, Z_ListStatuses **p, int opt)
1529 if (!odr_initmember (o, p, sizeof(**p)))
1530 return opt && odr_ok(o);
1531 if (odr_sequence_of (o, (Odr_fun) z_ListStatus, &(*p)->elements,
1535 return opt && odr_ok(o);
1538 int z_DeleteResultSetResponse(ODR o, Z_DeleteResultSetResponse **p, int opt)
1540 if (!odr_sequence_begin(o, p, sizeof(**p)))
1541 return opt && odr_ok(o);
1543 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1544 odr_implicit(o, z_DeleteSetStatus, &(*p)->deleteOperationStatus,
1545 ODR_CONTEXT, 0, 0) &&
1546 odr_implicit (o, z_ListStatuses,
1547 &(*p)->deleteListStatuses, ODR_CONTEXT, 1, 1) &&
1548 odr_implicit(o, odr_integer, &(*p)->numberNotDeleted, ODR_CONTEXT,
1550 odr_implicit (o, z_ListStatuses,
1551 &(*p)->bulkStatuses, ODR_CONTEXT, 35, 1) &&
1552 odr_implicit(o, odr_visiblestring, &(*p)->deleteMessage, ODR_CONTEXT,
1555 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1557 odr_sequence_end(o);
1560 /* ------------------------ SEGMENT SERVICE -------------- */
1562 int z_Segment(ODR o, Z_Segment **p, int opt)
1564 if (!odr_sequence_begin(o, p, sizeof(**p)))
1565 return opt && odr_ok(o);
1567 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1568 odr_implicit(o, odr_integer, &(*p)->numberOfRecordsReturned,
1569 ODR_CONTEXT, 24, 0) &&
1570 odr_implicit_settag(o, ODR_CONTEXT, 0) &&
1571 odr_sequence_of(o, (Odr_fun)z_NamePlusRecord, &(*p)->segmentRecords,
1572 &(*p)->num_segmentRecords) &&
1573 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1574 odr_sequence_end(o);
1577 /* ------------------------ CLOSE SERVICE ---------------- */
1579 int z_Close(ODR o, Z_Close **p, int opt)
1581 if (!odr_sequence_begin(o, p, sizeof(**p)))
1582 return opt && odr_ok(o);
1584 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1585 odr_implicit(o, odr_integer, &(*p)->closeReason, ODR_CONTEXT, 211, 0) &&
1586 odr_implicit(o, odr_visiblestring, &(*p)->diagnosticInformation,
1587 ODR_CONTEXT, 3, 1) &&
1588 odr_implicit(o, odr_oid, &(*p)->resourceReportFormat, ODR_CONTEXT,
1590 odr_implicit(o, z_External, &(*p)->resourceReport, ODR_CONTEXT,
1593 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1595 odr_sequence_end(o);
1598 /* ------------------------ APDU ------------------------- */
1600 int z_Permissions(ODR o, Z_Permissions **p, int opt)
1602 if (!odr_sequence_begin(o, p, sizeof(**p)))
1603 return opt && odr_ok(o);
1605 odr_implicit(o, z_InternationalString, &(*p)->userId, ODR_CONTEXT,
1607 odr_implicit_settag(o, ODR_CONTEXT, 2) &&
1608 odr_sequence_of(o, (Odr_fun)odr_integer, &(*p)->allowableFunctions,
1609 &(*p)->num_allowableFunctions) &&
1610 odr_sequence_end(o);
1613 int z_ExtendedServicesRequest(ODR o, Z_ExtendedServicesRequest **p, int opt)
1615 if (!odr_sequence_begin(o, p, sizeof(**p)))
1616 return opt && odr_ok(o);
1618 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1619 odr_implicit(o, odr_integer, &(*p)->function, ODR_CONTEXT, 3, 0) &&
1620 odr_implicit(o, odr_oid, &(*p)->packageType, ODR_CONTEXT, 4, 0) &&
1621 odr_implicit(o, z_InternationalString, &(*p)->packageName, ODR_CONTEXT, 5, 1) &&
1622 odr_implicit(o, z_InternationalString, &(*p)->userId, ODR_CONTEXT, 6, 1) &&
1623 odr_implicit(o, z_IntUnit, &(*p)->retentionTime, ODR_CONTEXT, 7, 1) &&
1624 odr_implicit(o, z_Permissions, &(*p)->permissions, ODR_CONTEXT, 8, 1) &&
1625 odr_implicit(o, z_InternationalString, &(*p)->description, ODR_CONTEXT, 9, 1) &&
1626 odr_implicit(o, z_External, &(*p)->taskSpecificParameters, ODR_CONTEXT, 10, 1) &&
1627 odr_implicit(o, odr_integer, &(*p)->waitAction, ODR_CONTEXT, 11, 0) &&
1628 z_ElementSetName(o, &(*p)->elements, 1) &&
1629 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1630 odr_sequence_end(o);
1633 int z_ExtendedServicesResponse(ODR o, Z_ExtendedServicesResponse **p, int opt)
1635 if (!odr_sequence_begin(o, p, sizeof(**p)))
1636 return opt && odr_ok(o);
1638 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1639 odr_implicit(o, odr_integer, &(*p)->operationStatus, ODR_CONTEXT, 3, 0) &&
1640 odr_implicit_settag(o, ODR_CONTEXT, 4) &&
1641 (odr_sequence_of(o, (Odr_fun)z_DiagRec, &(*p)->diagnostics,
1642 &(*p)->num_diagnostics) || odr_ok(o)) &&
1643 odr_implicit(o, z_External, &(*p)->taskPackage, ODR_CONTEXT, 5, 1) &&
1644 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1645 odr_sequence_end(o);
1648 /* ------------------------ SORT ------------------------- */
1650 int z_SortAttributes(ODR o, Z_SortAttributes **p, int opt)
1652 if (!odr_sequence_begin(o, p, sizeof(**p)))
1653 return opt && odr_ok(o);
1655 odr_oid(o, &(*p)->id, 0) &&
1656 z_AttributeList(o, &(*p)->list, 0) &&
1657 odr_sequence_end(o);
1660 int z_SortKey(ODR o, Z_SortKey **p, int opt)
1662 static Odr_arm arm[] =
1664 {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_SortKey_sortField,
1665 z_InternationalString},
1666 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_SortKey_elementSpec, (Odr_fun)z_Specification},
1667 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_SortKey_sortAttributes,
1668 (Odr_fun)z_SortAttributes},
1672 if (!odr_initmember(o, p, sizeof(**p)))
1673 return opt && odr_ok(o);
1674 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
1677 return opt && odr_ok(o);
1680 int z_SortDbSpecific(ODR o, Z_SortDbSpecific **p, int opt)
1682 if (!odr_sequence_begin(o, p, sizeof(**p)))
1683 return opt && odr_ok(o);
1685 z_DatabaseName(o, &(*p)->databaseName, 0) &&
1686 z_SortKey(o, &(*p)->dbSort, 0) &&
1687 odr_sequence_end(o);
1690 int z_SortDbSpecificList(ODR o, Z_SortDbSpecificList **p, int opt)
1692 if (!odr_initmember(o, p, sizeof(**p)))
1693 return opt && odr_ok(o);
1694 if (odr_sequence_of(o, (Odr_fun)z_SortDbSpecific, &(*p)->dbSpecific,
1695 &(*p)->num_dbSpecific))
1698 return opt && odr_ok(o);
1701 int z_SortElement(ODR o, Z_SortElement **p, int opt)
1703 static Odr_arm arm[] =
1705 {ODR_EXPLICIT, ODR_CONTEXT, 1, Z_SortElement_generic, (Odr_fun)z_SortKey},
1706 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_SortElement_databaseSpecific,
1707 (Odr_fun)z_SortDbSpecificList},
1711 if (!odr_initmember(o, p, sizeof(**p)))
1712 return opt && odr_ok(o);
1713 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
1716 return opt && odr_ok(o);
1719 int z_SortMissingValueAction(ODR o, Z_SortMissingValueAction **p, int opt)
1721 static Odr_arm arm[] =
1723 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_SortMissingValAct_abort, (Odr_fun)odr_null},
1724 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_SortMissingValAct_null, (Odr_fun)odr_null},
1725 {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_SortMissingValAct_valData,
1726 (Odr_fun)odr_octetstring},
1730 if (!odr_initmember(o, p, sizeof(**p)))
1731 return opt && odr_ok(o);
1732 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
1735 return opt && odr_ok(o);
1738 int z_SortKeySpec(ODR o, Z_SortKeySpec **p, int opt)
1740 if (!odr_sequence_begin(o, p, sizeof(**p)))
1741 return opt && odr_ok(o);
1743 z_SortElement(o, &(*p)->sortElement, 0) &&
1744 odr_implicit(o, odr_integer, &(*p)->sortRelation, ODR_CONTEXT, 1, 0) &&
1745 odr_implicit(o, odr_integer, &(*p)->caseSensitivity, ODR_CONTEXT,
1747 odr_explicit(o, z_SortMissingValueAction, &(*p)->missingValueAction,
1748 ODR_CONTEXT, 3, 1) &&
1749 odr_sequence_end(o);
1752 int z_SortResponse(ODR o, Z_SortResponse **p, int opt)
1754 if (!odr_sequence_begin(o, p, sizeof(**p)))
1755 return opt && odr_ok(o);
1757 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1758 odr_implicit(o, odr_integer, &(*p)->sortStatus, ODR_CONTEXT,
1760 odr_implicit(o, odr_integer, &(*p)->resultSetStatus, ODR_CONTEXT,
1762 odr_implicit(o, z_DiagRecs, &(*p)->diagnostics, ODR_CONTEXT, 5, 1) &&
1763 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1764 odr_sequence_end(o);
1767 int z_SortKeySpecList(ODR o, Z_SortKeySpecList **p, int opt)
1769 if (!odr_initmember(o, p, sizeof(**p)))
1770 return opt && odr_ok(o);
1771 if (odr_sequence_of(o, (Odr_fun)z_SortKeySpec, &(*p)->specs, &(*p)->num_specs))
1774 return opt && odr_ok(o);
1777 int z_SortRequest(ODR o, Z_SortRequest **p, int opt)
1779 if (!odr_sequence_begin(o, p, sizeof(**p)))
1780 return opt && odr_ok(o);
1782 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1783 odr_implicit(o, z_StringList, &(*p)->inputResultSetNames,
1784 ODR_CONTEXT, 3, 0) &&
1785 odr_implicit(o, z_InternationalString, &(*p)->sortedResultSetName,
1786 ODR_CONTEXT, 4, 0) &&
1787 odr_implicit(o, z_SortKeySpecList, &(*p)->sortSequence, ODR_CONTEXT,
1789 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1790 odr_sequence_end(o);
1793 /* ---------------------- Resource Report ---------------- */
1795 int z_ResourceReportRequest(ODR o, Z_ResourceReportRequest **p, int opt)
1797 if (!odr_sequence_begin(o, p, sizeof(**p)))
1798 return opt && odr_ok(o);
1800 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1801 odr_implicit(o, z_ReferenceId, &(*p)->opId, ODR_CONTEXT, 210, 1) &&
1802 odr_implicit(o, odr_oid, &(*p)->prefResourceReportFormat, ODR_CONTEXT,
1804 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1805 odr_sequence_end(o);
1808 int z_ResourceReportResponse(ODR o, Z_ResourceReportResponse **p, int opt)
1810 if (!odr_sequence_begin(o, p, sizeof(**p)))
1811 return opt && odr_ok(o);
1813 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1814 odr_implicit(o, odr_integer, &(*p)->resourceReportStatus,
1815 ODR_CONTEXT, 50, 0) &&
1816 odr_explicit(o, z_External, &(*p)->resourceReport, ODR_CONTEXT,
1818 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1819 odr_sequence_end(o);
1822 /* ------------------------ APDU ------------------------- */
1824 int z_APDU(ODR o, Z_APDU **p, int opt)
1826 static Odr_arm arm[] =
1828 {ODR_IMPLICIT, ODR_CONTEXT, 20, Z_APDU_initRequest, (Odr_fun)z_InitRequest},
1829 {ODR_IMPLICIT, ODR_CONTEXT, 21, Z_APDU_initResponse, (Odr_fun)z_InitResponse},
1830 {ODR_IMPLICIT, ODR_CONTEXT, 22, Z_APDU_searchRequest, (Odr_fun)z_SearchRequest},
1831 {ODR_IMPLICIT, ODR_CONTEXT, 23, Z_APDU_searchResponse,
1832 (Odr_fun)z_SearchResponse},
1833 {ODR_IMPLICIT, ODR_CONTEXT, 24, Z_APDU_presentRequest,
1834 (Odr_fun)z_PresentRequest},
1835 {ODR_IMPLICIT, ODR_CONTEXT, 25, Z_APDU_presentResponse,
1836 (Odr_fun)z_PresentResponse},
1837 {ODR_IMPLICIT, ODR_CONTEXT, 26, Z_APDU_deleteResultSetRequest,
1838 (Odr_fun)z_DeleteResultSetRequest},
1839 {ODR_IMPLICIT, ODR_CONTEXT, 27, Z_APDU_deleteResultSetResponse,
1840 (Odr_fun)z_DeleteResultSetResponse},
1841 {ODR_IMPLICIT, ODR_CONTEXT, 28, Z_APDU_accessControlRequest,
1842 (Odr_fun)z_AccessControlRequest},
1843 {ODR_IMPLICIT, ODR_CONTEXT, 29, Z_APDU_accessControlResponse,
1844 (Odr_fun)z_AccessControlResponse},
1845 {ODR_IMPLICIT, ODR_CONTEXT, 30, Z_APDU_resourceControlRequest,
1846 (Odr_fun)z_ResourceControlRequest},
1847 {ODR_IMPLICIT, ODR_CONTEXT, 31, Z_APDU_resourceControlResponse,
1848 (Odr_fun)z_ResourceControlResponse},
1849 {ODR_IMPLICIT, ODR_CONTEXT, 32, Z_APDU_triggerResourceControlRequest,
1850 (Odr_fun)z_TriggerResourceControlRequest},
1851 {ODR_IMPLICIT, ODR_CONTEXT, 33, Z_APDU_resourceReportRequest,
1852 (Odr_fun)z_ResourceReportRequest},
1853 {ODR_IMPLICIT, ODR_CONTEXT, 34, Z_APDU_resourceReportResponse,
1854 (Odr_fun)z_ResourceReportResponse},
1855 {ODR_IMPLICIT, ODR_CONTEXT, 35, Z_APDU_scanRequest, (Odr_fun)z_ScanRequest},
1856 {ODR_IMPLICIT, ODR_CONTEXT, 36, Z_APDU_scanResponse, (Odr_fun)z_ScanResponse},
1857 {ODR_IMPLICIT, ODR_CONTEXT, 43, Z_APDU_sortRequest, (Odr_fun)z_SortRequest},
1858 {ODR_IMPLICIT, ODR_CONTEXT, 44, Z_APDU_sortResponse, (Odr_fun)z_SortResponse},
1859 {ODR_IMPLICIT, ODR_CONTEXT, 45, Z_APDU_segmentRequest, (Odr_fun)z_Segment},
1860 {ODR_IMPLICIT, ODR_CONTEXT, 46, Z_APDU_extendedServicesRequest,
1861 (Odr_fun)z_ExtendedServicesRequest},
1862 {ODR_IMPLICIT, ODR_CONTEXT, 47, Z_APDU_extendedServicesResponse,
1863 (Odr_fun)z_ExtendedServicesResponse},
1864 {ODR_IMPLICIT, ODR_CONTEXT, 48, Z_APDU_close, (Odr_fun)z_Close},
1869 if (o->direction == ODR_DECODE)
1870 *p = (Z_APDU *)odr_malloc(o, sizeof(**p));
1871 odr_setlenlen(o, 5);
1872 if (!odr_choice(o, arm, &(*p)->u, &(*p)->which))
1874 if (o->direction == ODR_DECODE)
1876 return opt && odr_ok(o);