2 * Copyright (c) 1995, Index Data
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.41 1996-01-10 15:21:24 quinn
8 * Added links to access control PDUs
10 * Revision 1.40 1996/01/02 11:46:40 quinn
11 * Changed 'operator' to 'roperator' to avoid C++ conflict.
13 * Revision 1.39 1995/09/29 17:11:53 quinn
16 * Revision 1.38 1995/09/27 15:02:40 quinn
17 * Modified function heads & prototypes.
19 * Revision 1.37 1995/08/21 09:10:15 quinn
20 * Smallish fixes to suppport new formats.
22 * Revision 1.36 1995/08/15 11:59:39 quinn
25 * Revision 1.35 1995/08/10 08:53:59 quinn
28 * Revision 1.34 1995/06/19 17:01:48 quinn
29 * This should bring us in sync with the version distributed as 1.0b
31 * Revision 1.33 1995/06/19 13:39:56 quinn
32 * *** empty log message ***
34 * Revision 1.32 1995/06/19 12:37:28 quinn
35 * Fixed a bug in the compspec.
37 * Revision 1.31 1995/06/16 13:15:56 quinn
38 * Fixed Defaultdiagformat.
40 * Revision 1.30 1995/06/15 15:42:01 quinn
43 * Revision 1.29 1995/06/15 07:44:49 quinn
46 * Revision 1.28 1995/06/14 15:26:35 quinn
47 * *** empty log message ***
49 * Revision 1.27 1995/06/07 14:36:22 quinn
52 * Revision 1.26 1995/06/02 09:49:13 quinn
53 * Adding access control
55 * Revision 1.25 1995/05/25 11:00:08 quinn
56 * *** empty log message ***
58 * Revision 1.24 1995/05/22 13:58:18 quinn
59 * Fixed an ODR_NULLVAL.
61 * Revision 1.23 1995/05/22 11:30:18 quinn
62 * Adding Z39.50-1992 stuff to proto.c. Adding zget.c
64 * Revision 1.22 1995/05/17 08:40:56 quinn
65 * Added delete. Fixed some sequence_begins. Smallish.
67 * Revision 1.21 1995/05/16 08:50:24 quinn
68 * License, documentation, and memory fixes
70 * Revision 1.20 1995/05/15 11:55:25 quinn
73 * Revision 1.19 1995/04/11 11:58:35 quinn
76 * Revision 1.18 1995/04/11 11:52:02 quinn
77 * Fixed possible buf in proto.c
79 * Revision 1.17 1995/04/10 10:22:22 quinn
82 * Revision 1.16 1995/03/30 10:26:43 quinn
83 * Added Term structure
85 * Revision 1.15 1995/03/30 09:08:39 quinn
86 * Added Resource control protocol
88 * Revision 1.14 1995/03/29 08:06:13 quinn
89 * Added a few v3 elements
91 * Revision 1.13 1995/03/20 11:26:52 quinn
92 * *** empty log message ***
94 * Revision 1.12 1995/03/20 09:45:09 quinn
97 * Revision 1.11 1995/03/17 10:17:25 quinn
98 * Added memory management.
100 * Revision 1.10 1995/03/15 11:17:40 quinn
101 * Fixed some return-checks from choice.. need better ay to handle those..
103 * Revision 1.9 1995/03/15 08:37:06 quinn
104 * Fixed protocol bugs.
106 * Revision 1.8 1995/03/14 16:59:24 quinn
107 * Fixed OPTIONAL flag in attributeelement
109 * Revision 1.7 1995/03/07 16:29:33 quinn
110 * Added authentication stuff.
112 * Revision 1.6 1995/03/01 14:46:03 quinn
113 * Fixed protocol bug in 8777query.
115 * Revision 1.5 1995/02/14 11:54:22 quinn
118 * Revision 1.4 1995/02/10 15:54:30 quinn
121 * Revision 1.3 1995/02/09 15:51:39 quinn
124 * Revision 1.2 1995/02/06 21:26:07 quinn
125 * Repaired this evening's damages..
127 * Revision 1.1 1995/02/06 16:44:47 quinn
128 * First hack at Z/SR protocol
136 /* ---------------------- GLOBAL DEFS ------------------- */
139 * We'll use a general octetstring here, since string operations are
140 * clumsy on long strings.
142 int z_SUTRS(ODR o, Odr_oct **p, int opt)
144 return odr_implicit(o, odr_octetstring, p, ODR_UNIVERSAL,
145 ODR_GENERALSTRING, opt);
148 int z_ReferenceId(ODR o, Z_ReferenceId **p, int opt)
150 return odr_implicit(o, odr_octetstring, (Odr_oct**) p, ODR_CONTEXT, 2, opt);
153 int z_DatabaseName(ODR o, Z_DatabaseName **p, int opt)
155 return odr_implicit(o, odr_visiblestring, (char **) p, ODR_CONTEXT, 105,
159 int z_ResultSetId(ODR o, char **p, int opt)
161 return odr_implicit(o, odr_visiblestring, (char **) p, ODR_CONTEXT, 31,
165 int z_ElementSetName(ODR o, char **p, int opt)
167 return odr_implicit(o, odr_visiblestring, p, ODR_CONTEXT, 103, opt);
170 int z_UserInformationField(ODR o, Z_External **p, int opt)
172 return odr_explicit(o, z_External, (Z_External **)p, ODR_CONTEXT,
176 int z_InternationalString(ODR o, char **p, int opt)
178 return odr_generalstring(o, p, opt);
181 int z_InfoCategory(ODR o, Z_InfoCategory **p, int opt)
183 if (!odr_sequence_begin(o, p, sizeof(**p)))
184 return opt && odr_ok(o);
186 odr_implicit(o, odr_oid, &(*p)->categoryTypeId, ODR_CONTEXT, 1, 1) &&
187 odr_implicit(o, odr_integer, &(*p)->categoryValue, ODR_CONTEXT, 2, 0) &&
191 int z_OtherInformationUnit(ODR o, Z_OtherInformationUnit **p, int opt)
193 static Odr_arm arm[] =
195 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_OtherInfo_characterInfo,
197 {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_OtherInfo_binaryInfo,
199 {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_OtherInfo_externallyDefinedInfo,
201 {ODR_IMPLICIT, ODR_CONTEXT, 5, Z_OtherInfo_oid, odr_oid},
205 if (!odr_sequence_begin(o, p, sizeof(**p)))
206 return opt && odr_ok(o);
208 odr_implicit(o, z_InfoCategory, &(*p)->category, ODR_CONTEXT, 1, 1) &&
209 odr_choice(o, arm, &(*p)->which, &(*p)->information) &&
213 int z_OtherInformation(ODR o, Z_OtherInformation **p, int opt)
215 if (o->direction == ODR_DECODE)
216 *p = odr_malloc(o, sizeof(**p));
219 odr_implicit_settag(o, ODR_CONTEXT, 201);
220 if (odr_sequence_of(o, z_OtherInformationUnit, &(*p)->list,
221 &(*p)->num_elements))
224 return opt && odr_ok(o);
227 int z_StringOrNumeric(ODR o, Z_StringOrNumeric **p, int opt)
229 static Odr_arm arm[] =
231 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_StringOrNumeric_string,
233 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_StringOrNumeric_numeric,
238 if (o->direction == ODR_DECODE)
239 *p = odr_malloc(o, sizeof(**p));
242 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
245 return opt && odr_ok(o);
251 int z_Unit(ODR o, Z_Unit **p, int opt)
253 if (!odr_sequence_begin(o, p, sizeof(**p)))
254 return opt && odr_ok(o);
256 odr_implicit(o, odr_visiblestring, &(*p)->unitSystem, ODR_CONTEXT,
258 odr_explicit(o, z_StringOrNumeric, &(*p)->unitType, ODR_CONTEXT,
260 odr_explicit(o, z_StringOrNumeric, &(*p)->unit, ODR_CONTEXT, 3, 1) &&
261 odr_implicit(o, odr_integer, &(*p)->scaleFactor, ODR_CONTEXT, 4, 1) &&
265 int z_IntUnit(ODR o, Z_IntUnit **p, int opt)
267 if (!odr_sequence_begin(o, p, sizeof(**p)))
268 return opt && odr_ok(o);
270 odr_implicit(o, odr_integer, &(*p)->value, ODR_CONTEXT, 1, 0) &&
271 odr_implicit(o, z_Unit, &(*p)->unitUsed, ODR_CONTEXT, 2, 0) &&
275 /* ---------------------- INITIALIZE SERVICE ------------------- */
278 int z_NSRAuthentication(ODR o, Z_NSRAuthentication **p, int opt)
280 if (!odr_sequence_begin(o, p, sizeof(**p)))
281 return opt && odr_ok(o);
283 odr_visiblestring(o, &(*p)->user, 0) &&
284 odr_visiblestring(o, &(*p)->password, 0) &&
285 odr_visiblestring(o, &(*p)->account, 0) &&
290 int z_IdPass(ODR o, Z_IdPass **p, int opt)
292 if (!odr_sequence_begin(o, p, sizeof(**p)))
293 return opt && odr_ok(o);
295 odr_implicit(o, odr_visiblestring, &(*p)->groupId, ODR_CONTEXT, 0, 1) &&
296 odr_implicit(o, odr_visiblestring, &(*p)->userId, ODR_CONTEXT, 1, 1) &&
297 odr_implicit(o, odr_visiblestring, &(*p)->password, ODR_CONTEXT, 2,
302 int z_StrAuthentication(ODR o, char **p, int opt)
304 return odr_visiblestring(o, p, opt);
307 int z_IdAuthentication(ODR o, Z_IdAuthentication **p, int opt)
309 static Odr_arm arm[] =
311 {-1, -1, -1, Z_IdAuthentication_open, z_StrAuthentication},
312 {-1, -1, -1, Z_IdAuthentication_idPass, z_IdPass},
313 {-1, -1, -1, Z_IdAuthentication_anonymous, odr_null},
314 {-1, -1, -1, Z_IdAuthentication_other, z_External},
318 if (o->direction == ODR_DECODE)
319 *p = odr_malloc(o, sizeof(**p));
323 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
326 return opt && odr_ok(o);
329 int z_InitRequest(ODR o, Z_InitRequest **p, int opt)
333 if (!odr_sequence_begin(o, p, sizeof(**p)))
334 return opt && odr_ok(o);
337 z_ReferenceId(o, &pp->referenceId, 1) &&
338 odr_implicit(o, odr_bitstring, &pp->protocolVersion, ODR_CONTEXT,
340 odr_implicit(o, odr_bitstring, &pp->options, ODR_CONTEXT, 4, 0) &&
341 odr_implicit(o, odr_integer, &pp->preferredMessageSize, ODR_CONTEXT,
343 odr_implicit(o, odr_integer, &pp->maximumRecordSize, ODR_CONTEXT,
345 odr_explicit(o, z_IdAuthentication, &pp->idAuthentication, ODR_CONTEXT,
347 odr_implicit(o, odr_visiblestring, &pp->implementationId, ODR_CONTEXT,
349 odr_implicit(o, odr_visiblestring, &pp->implementationName, ODR_CONTEXT,
351 odr_implicit(o, odr_visiblestring, &pp->implementationVersion,
352 ODR_CONTEXT, 112, 1) &&
353 z_UserInformationField(o, &pp->userInformationField, 1) &&
355 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
360 int z_InitResponse(ODR o, Z_InitResponse **p, int opt)
364 if (!odr_sequence_begin(o, p, sizeof(**p)))
365 return opt && odr_ok(o);
368 z_ReferenceId(o, &pp->referenceId, 1) &&
369 odr_implicit(o, odr_bitstring, &pp->protocolVersion, ODR_CONTEXT,
371 odr_implicit(o, odr_bitstring, &pp->options, ODR_CONTEXT, 4, 0) &&
372 odr_implicit(o, odr_integer, &pp->preferredMessageSize, ODR_CONTEXT,
374 odr_implicit(o, odr_integer, &pp->maximumRecordSize, ODR_CONTEXT,
376 odr_implicit(o, odr_bool, &pp->result, ODR_CONTEXT, 12, 0) &&
377 odr_implicit(o, odr_visiblestring, &pp->implementationId, ODR_CONTEXT,
379 odr_implicit(o, odr_visiblestring, &pp->implementationName, ODR_CONTEXT,
381 odr_implicit(o, odr_visiblestring, &pp->implementationVersion,
382 ODR_CONTEXT, 112, 1) &&
383 z_UserInformationField(o, &pp->userInformationField, 1) &&
385 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
390 /* ------------------ RESOURCE CONTROL ----------------*/
392 int z_TriggerResourceControlRequest(ODR o, Z_TriggerResourceControlRequest **p,
395 if (!odr_sequence_begin(o, p, sizeof(**p)))
396 return opt && odr_ok(o);
398 z_ReferenceId(o, &(*p)->referenceId, 1) &&
399 odr_implicit(o, odr_integer, &(*p)->requestedAction, ODR_CONTEXT,
401 odr_implicit(o, odr_oid, &(*p)->prefResourceReportFormat,
402 ODR_CONTEXT, 47, 1) &&
403 odr_implicit(o, odr_bool, &(*p)->resultSetWanted, ODR_CONTEXT,
406 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
411 int z_ResourceControlRequest(ODR o, Z_ResourceControlRequest **p, int opt)
413 if (!odr_sequence_begin(o, p, sizeof(**p)))
414 return opt && odr_ok(o);
416 z_ReferenceId(o, &(*p)->referenceId, 1) &&
417 odr_implicit(o, odr_bool, &(*p)->suspendedFlag, ODR_CONTEXT, 39, 1)&&
418 odr_explicit(o, z_External, &(*p)->resourceReport, ODR_CONTEXT,
420 odr_implicit(o, odr_integer, &(*p)->partialResultsAvailable,
421 ODR_CONTEXT, 41, 1) &&
422 odr_implicit(o, odr_bool, &(*p)->responseRequired, ODR_CONTEXT,
424 odr_implicit(o, odr_bool, &(*p)->triggeredRequestFlag,
425 ODR_CONTEXT, 43, 1) &&
427 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
432 int z_ResourceControlResponse(ODR o, Z_ResourceControlResponse **p, int opt)
434 if (!odr_sequence_begin(o, p, sizeof(**p)))
435 return opt && odr_ok(o);
437 z_ReferenceId(o, &(*p)->referenceId, 1) &&
438 odr_implicit(o, odr_bool, &(*p)->continueFlag, ODR_CONTEXT, 44, 0) &&
439 odr_implicit(o, odr_bool, &(*p)->resultSetWanted, ODR_CONTEXT,
442 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
447 /* ------------------------ SEARCH SERVICE ----------------------- */
449 int z_DatabaseSpecificUnit(ODR o, Z_DatabaseSpecificUnit **p, int opt)
451 if (!odr_sequence_begin(o, p, sizeof(**p)))
452 return opt && odr_ok(o);
454 z_DatabaseName(o, &(*p)->databaseName, 0) &&
455 z_ElementSetName(o, &(*p)->elementSetName, 0) &&
459 int z_DatabaseSpecific(ODR o, Z_DatabaseSpecific **p, int opt)
461 if (o->direction == ODR_DECODE)
462 *p = odr_malloc(o, sizeof(**p));
466 odr_implicit_settag(o, ODR_CONTEXT, 1);
467 if (odr_sequence_of(o, z_DatabaseSpecificUnit, &(*p)->elements,
468 &(*p)->num_elements))
474 int z_ElementSetNames(ODR o, Z_ElementSetNames **p, int opt)
476 static Odr_arm arm[] =
478 {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_ElementSetNames_generic,
480 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ElementSetNames_databaseSpecific,
485 if (o->direction == ODR_DECODE)
486 *p = odr_malloc(o, sizeof(**p));
488 return opt && odr_ok(o);
490 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
496 /* ----------------------- RPN QUERY -----------------------*/
498 int z_ComplexAttribute(ODR o, Z_ComplexAttribute **p, int opt)
500 if (!odr_sequence_begin(o, p, sizeof(**p)))
501 return opt && odr_ok(o);
503 odr_implicit_settag(o, ODR_CONTEXT, 1) &&
504 odr_sequence_of(o, z_StringOrNumeric, &(*p)->list,
506 odr_implicit_settag(o, ODR_CONTEXT, 2) &&
507 (odr_sequence_of(o, odr_integer, &(*p)->semanticAction,
508 &(*p)->num_semanticAction) || odr_ok(o)) &&
512 int z_AttributeElement(ODR o, Z_AttributeElement **p, int opt)
515 static Odr_arm arm[] =
517 {ODR_IMPLICIT, ODR_CONTEXT, 121, Z_AttributeValue_numeric,
519 {ODR_IMPLICIT, ODR_CONTEXT, 224, Z_AttributeValue_complex,
525 if (!odr_sequence_begin(o, p, sizeof(**p)))
526 return opt && odr_ok(o);
529 odr_implicit(o, odr_oid, &(*p)->attributeSet, ODR_CONTEXT, 1, 1) &&
531 odr_implicit(o, odr_integer, &(*p)->attributeType, ODR_CONTEXT,
534 odr_choice(o, arm, &(*p)->value, &(*p)->which) &&
536 odr_implicit(o, odr_integer, &(*p)->attributeValue, ODR_CONTEXT,
542 int z_Term(ODR o, Z_Term **p, int opt)
544 static Odr_arm arm[] =
546 {ODR_IMPLICIT, ODR_CONTEXT, 45, Z_Term_general, odr_octetstring},
547 {ODR_IMPLICIT, ODR_CONTEXT, 215, Z_Term_numeric, odr_integer},
548 {ODR_IMPLICIT, ODR_CONTEXT, 216, Z_Term_characterString,
550 {ODR_IMPLICIT, ODR_CONTEXT, 217, Z_Term_oid, odr_oid},
551 {ODR_IMPLICIT, ODR_CONTEXT, 218, Z_Term_dateTime, odr_cstring},
552 {ODR_IMPLICIT, ODR_CONTEXT, 219, Z_Term_external, z_External},
553 /* add intUnit here */
554 {ODR_IMPLICIT, ODR_CONTEXT, 221, Z_Term_null, odr_null},
558 if (o->direction ==ODR_DECODE)
559 *p = odr_malloc(o, sizeof(**p));
562 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
565 return opt && odr_ok(o);
568 int z_AttributesPlusTerm(ODR o, Z_AttributesPlusTerm **p, int opt)
570 if (!(odr_implicit_settag(o, ODR_CONTEXT, 102) &&
571 odr_sequence_begin(o, p, sizeof(**p))))
572 return opt && odr_ok(o);
574 odr_implicit_settag(o, ODR_CONTEXT, 44) &&
575 odr_sequence_of(o, z_AttributeElement, &(*p)->attributeList,
576 &(*p)->num_attributes) &&
577 z_Term(o, &(*p)->term, 0) &&
581 int z_ResultSetPlusAttributes(ODR o, Z_ResultSetPlusAttributes **p, int opt)
583 if (!(odr_implicit_settag(o, ODR_CONTEXT, 214) &&
584 odr_sequence_begin(o, p, sizeof(**p))))
585 return opt && odr_ok(o);
587 z_ResultSetId(o, &(*p)->resultSet, 0) &&
588 odr_implicit_settag(o, ODR_CONTEXT, 44) &&
589 odr_sequence_of(o, z_AttributeElement, &(*p)->attributeList,
590 &(*p)->num_attributes) &&
594 int z_ProximityOperator(ODR o, Z_ProximityOperator **p, int opt)
596 static Odr_arm arm[] =
598 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ProxCode_known, odr_integer},
599 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ProxCode_private, odr_integer},
603 if (!odr_sequence_begin(o, p, sizeof(**p)))
604 return opt && odr_ok(o);
606 odr_implicit(o, odr_bool, &(*p)->exclusion, ODR_CONTEXT, 1, 1) &&
607 odr_implicit(o, odr_integer, &(*p)->distance, ODR_CONTEXT, 2, 0) &&
608 odr_implicit(o, odr_bool, &(*p)->ordered, ODR_CONTEXT, 3, 0) &&
609 odr_implicit(o, odr_integer, &(*p)->relationType, ODR_CONTEXT, 4, 0) &&
610 odr_constructed_begin(o, &(*p)->proximityUnitCode, ODR_CONTEXT, 5) &&
611 odr_choice(o, arm, &(*p)->proximityUnitCode, &(*p)->which) &&
612 odr_constructed_end(o) &&
616 int z_Operator(ODR o, Z_Operator **p, int opt)
618 static Odr_arm arm[] =
620 {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_Operator_and, odr_null},
621 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Operator_or, odr_null},
622 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Operator_and_not, odr_null},
623 {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_Operator_prox, z_ProximityOperator},
627 if (!*p && o->direction != ODR_DECODE)
629 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 46))
630 return opt && odr_ok(o);
631 if (o->direction == ODR_DECODE)
632 *p = odr_malloc(o, sizeof(**p));
634 if (odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
635 odr_constructed_end(o))
638 return opt && odr_ok(o);
641 int z_Operand(ODR o, Z_Operand **p, int opt)
643 static Odr_arm arm[] =
645 {-1, -1, -1, Z_Operand_APT, z_AttributesPlusTerm},
646 {-1, -1, -1, Z_Operand_resultSetId, z_ResultSetId},
647 {-1, -1, -1, Z_Operand_resultAttr, z_ResultSetPlusAttributes},
651 if (o->direction == ODR_DECODE)
652 *p = odr_malloc(o, sizeof(**p));
655 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
658 return opt && odr_ok(o);
661 int z_RPNStructure(ODR o, Z_RPNStructure **p, int opt);
663 int z_Complex(ODR o, Z_Complex **p, int opt)
665 if (!odr_sequence_begin(o, p, sizeof(**p)))
666 return opt && odr_ok(o);
668 z_RPNStructure(o, &(*p)->s1, 0) &&
669 z_RPNStructure(o, &(*p)->s2, 0) &&
670 z_Operator(o, &(*p)->roperator, 0) &&
674 int z_RPNStructure(ODR o, Z_RPNStructure **p, int opt)
676 static Odr_arm arm[] =
678 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_RPNStructure_simple, z_Operand},
679 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_RPNStructure_complex, z_Complex},
683 if (o->direction == ODR_DECODE)
684 *p = odr_malloc(o, sizeof(**p));
687 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
690 return opt && odr_ok(o);
693 int z_RPNQuery(ODR o, Z_RPNQuery **p, int opt)
695 if (!odr_sequence_begin(o, p, sizeof(**p)))
696 return opt && odr_ok(o);
698 odr_oid(o, &(*p)->attributeSetId, 0) &&
699 z_RPNStructure(o, &(*p)->RPNStructure, 0) &&
703 /* -----------------------END RPN QUERY ----------------------- */
705 int z_Query(ODR o, Z_Query **p, int opt)
707 static Odr_arm arm[] =
709 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Query_type_1, z_RPNQuery},
710 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_Query_type_2, odr_octetstring},
711 {ODR_EXPLICIT, ODR_CONTEXT, 101, Z_Query_type_101, z_RPNQuery},
715 if (o->direction == ODR_DECODE)
716 *p = odr_malloc(o, sizeof(**p));
719 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
722 return opt && odr_ok(o);
725 int z_SearchRequest(ODR o, Z_SearchRequest **p, int opt)
729 if (!odr_sequence_begin(o, p, sizeof(**p)))
730 return opt && odr_ok(o);
733 z_ReferenceId(o, &pp->referenceId, 1) &&
734 odr_implicit(o, odr_integer, &pp->smallSetUpperBound, ODR_CONTEXT,
736 odr_implicit(o, odr_integer, &pp->largeSetLowerBound, ODR_CONTEXT,
738 odr_implicit(o, odr_integer, &pp->mediumSetPresentNumber, ODR_CONTEXT,
740 odr_implicit(o, odr_bool, &pp->replaceIndicator, ODR_CONTEXT, 16, 1) &&
741 odr_implicit(o, odr_visiblestring, &pp->resultSetName, ODR_CONTEXT,
743 odr_implicit_settag(o, ODR_CONTEXT, 18) &&
744 odr_sequence_of(o, z_DatabaseName, &pp->databaseNames,
745 &pp->num_databaseNames) &&
746 odr_explicit(o, z_ElementSetNames, &pp->smallSetElementSetNames,
747 ODR_CONTEXT, 100, 1) &&
748 odr_explicit(o, z_ElementSetNames, &pp->mediumSetElementSetNames,
749 ODR_CONTEXT, 101, 1) &&
750 odr_implicit(o, odr_oid, &pp->preferredRecordSyntax,
751 ODR_CONTEXT, 104, 1) &&
752 odr_explicit(o, z_Query, &pp->query, ODR_CONTEXT, 21, 0) &&
754 odr_implicit(o, z_OtherInformation, &(*p)->additionalSearchInfo,
755 ODR_CONTEXT, 203, 1) &&
756 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
761 /* ------------------------ RECORD ------------------------- */
763 int z_DatabaseRecord(ODR o, Z_DatabaseRecord **p, int opt)
765 return z_External(o, (Z_External **) p, opt);
770 int z_DefaultDiagFormat(ODR o, Z_DefaultDiagFormat **p, int opt)
772 static Odr_arm arm[] =
774 {-1, -1, -1, Z_DiagForm_v2AddInfo, odr_visiblestring},
775 {-1, -1, -1, Z_DiagForm_v3AddInfo, z_InternationalString},
776 {ODR_IMPLICIT, ODR_CONTEXT, ODR_VISIBLESTRING, Z_DiagForm_v2AddInfo,
777 odr_visiblestring}, /* To cater to a bug in the CNIDR servers */
780 if (!odr_sequence_begin(o, p, sizeof(**p)))
781 return opt && odr_ok(o);
783 odr_oid(o, &(*p)->diagnosticSetId, 1) && /* SHOULD NOT BE OPT! */
784 odr_integer(o, &(*p)->condition, 0) &&
786 * I no longer recall what server tagged the addinfo.. but it isn't
787 * hurting anyone, so...
788 * We need to turn it into a choice, or something, because of
789 * that damn generalstring in v3.
791 odr_choice(o, arm, &(*p)->addinfo, &(*p)->which) &&
795 int z_DiagRec(ODR o, Z_DiagRec **p, int opt)
797 static Odr_arm arm[] =
799 {-1, -1, -1, Z_DiagRec_defaultFormat, z_DefaultDiagFormat},
800 {-1, -1, -1, Z_DiagRec_externallyDefined, z_External},
804 if (o->direction == ODR_DECODE)
805 *p = odr_malloc(o, sizeof(**p));
808 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
811 return opt && odr_ok(o);
816 int z_DiagRec(ODR o, Z_DiagRec **p, int opt)
818 if (!odr_sequence_begin(o, p, sizeof(**p)))
819 return opt && odr_ok(o);
821 odr_oid(o, &(*p)->diagnosticSetId, 1) && /* SHOULD NOT BE OPT! */
822 odr_integer(o, &(*p)->condition, 0) &&
824 * I no longer recall what server tagged the addinfo.. but it isn't
825 * hurting anyone, so...
826 * We need to turn it into a choice, or something, because of
827 * that damn generalstring in v3.
829 (odr_visiblestring(o, &(*p)->addinfo, 0) ||
830 odr_implicit(o, odr_cstring, &(*p)->addinfo, ODR_CONTEXT,
831 ODR_VISIBLESTRING, 1)) &&
837 int z_DiagRecs(ODR o, Z_DiagRecs **p, int opt)
839 if (o->direction == ODR_DECODE)
840 *p = odr_malloc(o, sizeof(**p));
844 if (odr_sequence_of(o, z_DiagRec, &(*p)->diagRecs,
845 &(*p)->num_diagRecs))
851 int z_NamePlusRecord(ODR o, Z_NamePlusRecord **p, int opt)
853 static Odr_arm arm[] =
855 {ODR_EXPLICIT, ODR_CONTEXT, 1, Z_NamePlusRecord_databaseRecord,
857 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_NamePlusRecord_surrogateDiagnostic,
862 if (!odr_sequence_begin(o, p, sizeof(**p)))
863 return opt && odr_ok(o);
865 odr_implicit(o, z_DatabaseName, &(*p)->databaseName, ODR_CONTEXT,
867 odr_constructed_begin(o, &(*p)->u, ODR_CONTEXT, 1) &&
868 odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
869 odr_constructed_end(o) &&
873 int z_NamePlusRecordList(ODR o, Z_NamePlusRecordList **p, int opt)
875 if (o->direction == ODR_DECODE)
876 *p = odr_malloc(o, sizeof(**p));
879 if (odr_sequence_of(o, z_NamePlusRecord, &(*p)->records,
886 int z_Records(ODR o, Z_Records **p, int opt)
888 static Odr_arm arm[] =
890 {ODR_IMPLICIT, ODR_CONTEXT, 28, Z_Records_DBOSD, z_NamePlusRecordList},
891 {ODR_IMPLICIT, ODR_CONTEXT, 130, Z_Records_NSD, z_DiagRec},
892 {ODR_IMPLICIT, ODR_CONTEXT, 205, Z_Records_multipleNSD,
897 if (o->direction == ODR_DECODE)
898 *p = odr_malloc(o, sizeof(**p));
901 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
904 return opt && odr_ok(o);
907 /* ------------------------ ACCESS CTRL SERVICE ----------------------- */
909 int z_AccessControlRequest(ODR o, Z_AccessControlRequest **p, int opt)
911 static Odr_arm arm[] =
913 {ODR_IMPLICIT, ODR_CONTEXT, 37, Z_AccessRequest_simpleForm,
915 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_AccessRequest_externallyDefined,
919 if (!odr_sequence_begin(o, p, sizeof(**p)))
920 return opt && odr_ok(o);
922 z_ReferenceId(o, &(*p)->referenceId, 1) &&
923 odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
925 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
930 int z_AccessControlResponse(ODR o, Z_AccessControlResponse **p, int opt)
932 static Odr_arm arm[] =
934 {ODR_IMPLICIT, ODR_CONTEXT, 38, Z_AccessResponse_simpleForm,
936 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_AccessResponse_externallyDefined,
940 if (!odr_sequence_begin(o, p, sizeof(**p)))
941 return opt && odr_ok(o);
943 z_ReferenceId(o, &(*p)->referenceId, 1) &&
944 odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
945 odr_explicit(o, z_DiagRec, &(*p)->diagnostic, ODR_CONTEXT, 223, 1) &&
947 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
952 /* ------------------------ SCAN SERVICE -------------------- */
954 int z_AttributeList(ODR o, Z_AttributeList **p, int opt)
956 if (o->direction == ODR_DECODE)
957 *p = odr_malloc(o, sizeof(**p));
961 odr_implicit_settag(o, ODR_CONTEXT, 44);
962 if (odr_sequence_of(o, z_AttributeElement, &(*p)->attributes,
963 &(*p)->num_attributes))
966 return opt && odr_ok(o);
970 * This is a temporary hack. We don't know just *what* old version of the
971 * protocol willow uses, so we'll just patiently wait for them to update
973 static int willow_scan = 0;
975 int z_WillowAttributesPlusTerm(ODR o, Z_AttributesPlusTerm **p, int opt)
977 if (!*p && o->direction != ODR_DECODE)
979 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 4))
982 return opt && odr_ok(o);
984 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 1))
986 if (!odr_constructed_begin(o, p, ODR_UNIVERSAL, ODR_SEQUENCE))
988 if (!odr_implicit_settag(o, ODR_CONTEXT, 44))
990 if (o->direction == ODR_DECODE)
991 *p = odr_malloc(o, sizeof(**p));
992 if (!odr_sequence_of(o, z_AttributeElement, &(*p)->attributeList,
993 &(*p)->num_attributes))
995 if (!odr_sequence_end(o) || !odr_sequence_end(o))
997 if (!z_Term(o, &(*p)->term, 0))
999 if (!odr_constructed_end(o))
1005 int z_AlternativeTerm(ODR o, Z_AlternativeTerm **p, int opt)
1007 if (o->direction == ODR_DECODE)
1008 *p = odr_malloc(o, sizeof(**p));
1012 return opt && odr_ok(o);
1015 if (odr_sequence_of(o, z_AttributesPlusTerm, &(*p)->terms,
1019 return opt && !o->error;
1022 int z_OccurrenceByAttributes(ODR o, Z_OccurrenceByAttributes **p, int opt)
1024 if (!odr_sequence_begin(o, p, sizeof(**p)))
1025 return opt && odr_ok(o);
1027 odr_explicit(o, z_AttributeList, &(*p)->attributes, ODR_CONTEXT, 1, 1)&&
1028 odr_explicit(o, odr_integer, &(*p)->global, ODR_CONTEXT, 2, 1) &&
1029 odr_sequence_end(o);
1032 int z_TermInfo(ODR o, Z_TermInfo **p, int opt)
1034 if (!odr_sequence_begin(o, p, sizeof(**p)))
1035 return opt && odr_ok(o);
1038 odr_implicit(o, z_Term, &(*p)->term, ODR_CONTEXT, 1, 0) :
1039 z_Term(o, &(*p)->term, 0)) &&
1040 z_AttributeList(o, &(*p)->suggestedAttributes, 1) &&
1041 odr_implicit(o, z_AlternativeTerm, &(*p)->alternativeTerm,
1042 ODR_CONTEXT, 4, 1) &&
1043 odr_implicit(o, odr_integer, &(*p)->globalOccurrences, ODR_CONTEXT,
1045 odr_implicit(o, z_OccurrenceByAttributes, &(*p)->byAttributes,
1046 ODR_CONTEXT, 3, 1) &&
1047 odr_sequence_end(o);
1050 int z_Entry(ODR o, Z_Entry **p, int opt)
1052 static Odr_arm arm[] =
1054 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Entry_termInfo, z_TermInfo},
1055 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_Entry_surrogateDiagnostic,
1060 if (o->direction == ODR_DECODE)
1061 *p = odr_malloc(o, sizeof(**p));
1065 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
1068 return opt && odr_ok(o);
1071 int z_Entries(ODR o, Z_Entries **p, int opt)
1073 if (o->direction == ODR_DECODE)
1074 *p = odr_malloc(o, sizeof(**p));
1078 if (odr_sequence_of(o, z_Entry, &(*p)->entries,
1079 &(*p)->num_entries))
1085 int z_ListEntries(ODR o, Z_ListEntries **p, int opt)
1087 static Odr_arm arm[] =
1089 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ListEntries_entries, z_Entries},
1090 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ListEntries_nonSurrogateDiagnostics,
1095 if (o->direction == ODR_DECODE)
1096 *p = odr_malloc(o, sizeof(**p));
1100 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
1103 return opt && odr_ok(o);
1106 int z_ScanRequest(ODR o, Z_ScanRequest **p, int opt)
1108 if (!odr_sequence_begin(o, p, sizeof(**p)))
1109 return opt && odr_ok(o);
1112 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1113 odr_implicit_settag(o, ODR_CONTEXT, 3) &&
1114 odr_sequence_of(o, z_DatabaseName, &(*p)->databaseNames,
1115 &(*p)->num_databaseNames) &&
1116 odr_oid(o, &(*p)->attributeSet, 1) &&
1117 (z_AttributesPlusTerm(o, &(*p)->termListAndStartPoint, 1) ?
1118 ((*p)->termListAndStartPoint ? 1 :
1119 z_WillowAttributesPlusTerm(o, &(*p)->termListAndStartPoint, 0)) : 0) &&
1120 odr_implicit(o, odr_integer, &(*p)->stepSize, ODR_CONTEXT, 5, 1) &&
1121 odr_implicit(o, odr_integer, &(*p)->numberOfTermsRequested,
1122 ODR_CONTEXT, 6, 0) &&
1123 odr_implicit(o, odr_integer, &(*p)->preferredPositionInResponse,
1124 ODR_CONTEXT, 7, 1) &&
1125 odr_sequence_end(o);
1128 int z_ScanResponse(ODR o, Z_ScanResponse **p, int opt)
1130 if (!odr_sequence_begin(o, p, sizeof(**p)))
1131 return opt && odr_ok(o);
1133 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1134 odr_implicit(o, odr_integer, &(*p)->stepSize, ODR_CONTEXT, 3, 1) &&
1135 odr_implicit(o, odr_integer, &(*p)->scanStatus, ODR_CONTEXT, 4, 0) &&
1136 odr_implicit(o, odr_integer, &(*p)->numberOfEntriesReturned,
1137 ODR_CONTEXT, 5, 0) &&
1138 odr_implicit(o, odr_integer, &(*p)->positionOfTerm, ODR_CONTEXT, 6, 1)&&
1139 odr_explicit(o, z_ListEntries, &(*p)->entries, ODR_CONTEXT, 7, 1) &&
1140 odr_implicit(o, odr_oid, &(*p)->attributeSet, ODR_CONTEXT, 8, 1) &&
1141 odr_sequence_end(o);
1144 /* ------------------------ SEARCHRESPONSE ----------------*/
1146 int z_NumberOfRecordsReturned(ODR o, int **p, int opt)
1148 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 24, opt);
1151 int z_NextResultSetPosition(ODR o, int **p, int opt)
1153 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 25, opt);
1156 int z_PresentStatus(ODR o, int **p, int opt)
1158 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 27, opt);
1161 int z_SearchResponse(ODR o, Z_SearchResponse **p, int opt)
1163 Z_SearchResponse *pp;
1165 if (!odr_sequence_begin(o, p, sizeof(**p)))
1166 return opt && odr_ok(o);
1169 z_ReferenceId(o, &pp->referenceId, 1) &&
1170 odr_implicit(o, odr_integer, &pp->resultCount, ODR_CONTEXT, 23, 0) &&
1171 z_NumberOfRecordsReturned(o, &pp->numberOfRecordsReturned, 0) &&
1172 z_NextResultSetPosition(o, &pp->nextResultSetPosition, 0) &&
1173 odr_implicit(o, odr_bool, &pp->searchStatus, ODR_CONTEXT, 22, 0) &&
1174 odr_implicit(o, odr_integer, &pp->resultSetStatus, ODR_CONTEXT, 26,
1176 z_PresentStatus(o, &pp->presentStatus, 1) &&
1177 z_Records(o, &pp->records, 1) &&
1179 odr_implicit(o, z_OtherInformation, &(*p)->additionalSearchInfo,
1180 ODR_CONTEXT, 203, 1) &&
1181 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1183 odr_sequence_end(o);
1186 /* --------------------- PRESENT SERVICE ---------------------- */
1188 int z_ElementSpec(ODR o, Z_ElementSpec **p, int opt)
1190 static Odr_arm arm[] =
1192 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ElementSpec_elementSetName,
1194 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ElementSpec_externalSpec,
1199 if (o->direction == ODR_DECODE)
1200 *p = odr_malloc(o, sizeof(**p));
1204 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
1207 return opt && odr_ok(o);
1210 int z_Specification(ODR o, Z_Specification **p, int opt)
1212 if (!odr_sequence_begin(o, p, sizeof(**p)))
1213 return opt && odr_ok(o);
1215 odr_implicit(o, odr_oid, &(*p)->schema, ODR_CONTEXT, 1, 1) &&
1216 z_ElementSpec(o, &(*p)->elementSpec, 1) &&
1217 odr_sequence_end(o);
1220 int z_DbSpecific(ODR o, Z_DbSpecific **p, int opt)
1222 if (!odr_sequence_begin(o, p, sizeof(**p)))
1223 return opt && odr_ok(o);
1225 odr_explicit(o, z_DatabaseName, &(*p)->databaseName, ODR_CONTEXT,
1227 odr_implicit(o, z_Specification, &(*p)->spec, ODR_CONTEXT, 2, 0) &&
1228 odr_sequence_end(o);
1231 int z_CompSpec(ODR o, Z_CompSpec **p, int opt)
1233 if (!odr_sequence_begin(o, p, sizeof(**p)))
1234 return opt && odr_ok(o);
1236 odr_implicit(o, odr_bool, &(*p)->selectAlternativeSyntax, ODR_CONTEXT,
1238 odr_implicit(o, z_Specification, &(*p)->generic, ODR_CONTEXT, 2, 1) &&
1239 odr_implicit_settag(o, ODR_CONTEXT, 3) &&
1240 (odr_sequence_of(o, z_DbSpecific, &(*p)->dbSpecific,
1241 &(*p)->num_dbSpecific) || odr_ok(o)) &&
1242 odr_implicit_settag(o, ODR_CONTEXT, 4) &&
1243 (odr_sequence_of(o, odr_oid, &(*p)->recordSyntax,
1244 &(*p)->num_recordSyntax) || odr_ok(o)) &&
1245 odr_sequence_end(o);
1248 int z_RecordComposition(ODR o, Z_RecordComposition **p, int opt)
1250 static Odr_arm arm[] =
1252 {ODR_EXPLICIT, ODR_CONTEXT, 19, Z_RecordComp_simple,
1254 {ODR_IMPLICIT, ODR_CONTEXT, 209, Z_RecordComp_complex,
1259 if (o->direction == ODR_DECODE)
1260 *p = odr_malloc(o, sizeof(**p));
1264 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
1267 return opt && odr_ok(o);
1270 int z_Range(ODR o, Z_Range **p, int opt)
1272 if (!odr_sequence_begin(o, p, sizeof(**p)))
1273 return opt && odr_ok(o);
1275 odr_implicit(o, odr_integer, &(*p)->startingPosition, ODR_CONTEXT,
1277 odr_implicit(o, odr_integer, &(*p)->numberOfRecords, ODR_CONTEXT,
1279 odr_sequence_end(o);
1282 int z_PresentRequest(ODR o, Z_PresentRequest **p, int opt)
1284 Z_PresentRequest *pp;
1286 if (!odr_sequence_begin(o, p, sizeof(**p)))
1287 return opt && odr_ok(o);
1290 z_ReferenceId(o, &pp->referenceId, 1) &&
1291 z_ResultSetId(o, &pp->resultSetId, 0) &&
1292 odr_implicit(o, odr_integer, &pp->resultSetStartPoint, ODR_CONTEXT,
1294 odr_implicit(o, odr_integer, &pp->numberOfRecordsRequested, ODR_CONTEXT,
1297 odr_implicit_settag(o, ODR_CONTEXT, 212) &&
1298 (odr_sequence_of(o, z_Range, &(*p)->additionalRanges,
1299 &(*p)->num_ranges) || odr_ok(o)) &&
1300 z_RecordComposition(o, &(*p)->recordComposition, 1) &&
1302 odr_explicit(o, z_ElementSetNames, &pp->elementSetNames, ODR_CONTEXT,
1305 odr_implicit(o, odr_oid, &(*p)->preferredRecordSyntax, ODR_CONTEXT,
1308 odr_implicit(o, odr_integer, &(*p)->maxSegmentCount, ODR_CONTEXT,
1310 odr_implicit(o, odr_integer, &(*p)->maxRecordSize, ODR_CONTEXT,
1312 odr_implicit(o, odr_integer, &(*p)->maxSegmentSize, ODR_CONTEXT,
1314 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1316 odr_sequence_end(o);
1319 int z_PresentResponse(ODR o, Z_PresentResponse **p, int opt)
1321 Z_PresentResponse *pp;
1323 if (!odr_sequence_begin(o, p, sizeof(**p)))
1324 return opt && odr_ok(o);
1327 z_ReferenceId(o, &pp->referenceId, 1) &&
1328 z_NumberOfRecordsReturned(o, &pp->numberOfRecordsReturned, 0) &&
1329 z_NextResultSetPosition(o, &pp->nextResultSetPosition, 0) &&
1330 z_PresentStatus(o, &pp->presentStatus, 0) &&
1331 z_Records(o, &pp->records, 1) &&
1333 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1335 odr_sequence_end(o);
1338 /* ----------------------DELETE -------------------------- */
1340 int z_DeleteSetStatus(ODR o, int **p, int opt)
1342 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 33, opt);
1345 int z_ListStatus(ODR o, Z_ListStatus **p, int opt)
1347 if (!odr_sequence_begin(o, p, sizeof(**p)))
1348 return opt && odr_ok(o);
1350 z_ResultSetId(o, &(*p)->id, 0) &&
1351 z_DeleteSetStatus(o, &(*p)->status, 0) &&
1352 odr_sequence_end(o);
1355 int z_DeleteResultSetRequest(ODR o, Z_DeleteResultSetRequest **p, int opt)
1357 if (!odr_sequence_begin(o, p, sizeof(**p)))
1358 return opt && odr_ok(o);
1360 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1361 odr_implicit(o, odr_integer, &(*p)->deleteFunction, ODR_CONTEXT, 32,
1363 (odr_sequence_of(o, z_ListStatus, &(*p)->resultSetList,
1364 &(*p)->num_ids) || odr_ok(o)) &&
1366 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1368 odr_sequence_end(o);
1371 int z_DeleteResultSetResponse(ODR o, Z_DeleteResultSetResponse **p, int opt)
1373 if (!odr_sequence_begin(o, p, sizeof(**p)))
1374 return opt && odr_ok(o);
1376 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1377 odr_implicit(o, z_DeleteSetStatus, &(*p)->deleteOperationStatus,
1378 ODR_CONTEXT, 0, 1) &&
1379 odr_implicit_settag(o, ODR_CONTEXT, 1) &&
1380 (odr_sequence_of(o, z_ListStatus, &(*p)->deleteListStatuses,
1381 &(*p)->num_statuses) || odr_ok(o)) &&
1382 odr_implicit(o, odr_integer, &(*p)->numberNotDeleted, ODR_CONTEXT,
1384 odr_implicit_settag(o, ODR_CONTEXT, 35) &&
1385 (odr_sequence_of(o, z_ListStatus, &(*p)->bulkStatuses,
1386 &(*p)->num_bulkStatuses) || odr_ok(o)) &&
1387 odr_implicit(o, odr_visiblestring, &(*p)->deleteMessage, ODR_CONTEXT,
1390 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1392 odr_sequence_end(o);
1395 /* ------------------------ SEGMENT SERVICE -------------- */
1397 int z_Segment(ODR o, Z_Segment **p, int opt)
1399 if (!odr_sequence_begin(o, p, sizeof(**p)))
1400 return opt && odr_ok(o);
1402 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1403 odr_implicit(o, odr_integer, &(*p)->numberOfRecordsReturned,
1404 ODR_CONTEXT, 24, 0) &&
1405 odr_implicit_settag(o, ODR_CONTEXT, 0) &&
1406 odr_sequence_of(o, z_NamePlusRecord, &(*p)->segmentRecords,
1407 &(*p)->num_segmentRecords) &&
1408 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1409 odr_sequence_end(o);
1412 /* ------------------------ CLOSE SERVICE ---------------- */
1414 int z_Close(ODR o, Z_Close **p, int opt)
1416 if (!odr_sequence_begin(o, p, sizeof(**p)))
1417 return opt && odr_ok(o);
1419 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1420 odr_implicit(o, odr_integer, &(*p)->closeReason, ODR_CONTEXT, 211, 0) &&
1421 odr_implicit(o, odr_visiblestring, &(*p)->diagnosticInformation,
1422 ODR_CONTEXT, 3, 1) &&
1423 odr_implicit(o, odr_oid, &(*p)->resourceReportFormat, ODR_CONTEXT,
1425 odr_implicit(o, z_External, &(*p)->resourceReport, ODR_CONTEXT,
1428 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1430 odr_sequence_end(o);
1433 /* ------------------------ APDU ------------------------- */
1435 int z_Permissions(ODR o, Z_Permissions **p, int opt)
1437 if (!odr_sequence_begin(o, p, sizeof(**p)))
1438 return opt && odr_ok(o);
1440 odr_implicit(o, z_InternationalString, &(*p)->userId, ODR_CONTEXT,
1442 odr_implicit_settag(o, ODR_CONTEXT, 2) &&
1443 odr_sequence_of(o, odr_integer, &(*p)->allowableFunctions,
1444 &(*p)->num_allowableFunctions) &&
1445 odr_sequence_end(o);
1448 int z_ExtendedServicesRequest(ODR o, Z_ExtendedServicesRequest **p, int opt)
1450 if (!odr_sequence_begin(o, p, sizeof(**p)))
1451 return opt && odr_ok(o);
1453 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1454 odr_implicit(o, odr_integer, &(*p)->function, ODR_CONTEXT, 3, 0) &&
1455 odr_implicit(o, odr_oid, &(*p)->packageType, ODR_CONTEXT, 4, 0) &&
1456 odr_implicit(o, z_InternationalString, &(*p)->packageName, ODR_CONTEXT, 5, 1) &&
1457 odr_implicit(o, z_InternationalString, &(*p)->userId, ODR_CONTEXT, 6, 1) &&
1458 odr_implicit(o, z_IntUnit, &(*p)->retentionTime, ODR_CONTEXT, 7, 1) &&
1459 odr_implicit(o, z_Permissions, &(*p)->permissions, ODR_CONTEXT, 8, 1) &&
1460 odr_implicit(o, z_InternationalString, &(*p)->description, ODR_CONTEXT, 9, 1) &&
1461 odr_implicit(o, z_External, &(*p)->taskSpecificParameters, ODR_CONTEXT, 10, 1) &&
1462 odr_implicit(o, odr_integer, &(*p)->waitAction, ODR_CONTEXT, 11, 0) &&
1463 z_ElementSetName(o, &(*p)->elements, 1) &&
1464 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1465 odr_sequence_end(o);
1468 int z_ExtendedServicesResponse(ODR o, Z_ExtendedServicesResponse **p, int opt)
1470 if (!odr_sequence_begin(o, p, sizeof(**p)))
1471 return opt && odr_ok(o);
1473 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1474 odr_implicit(o, odr_integer, &(*p)->operationStatus, ODR_CONTEXT, 3, 0) &&
1475 odr_implicit_settag(o, ODR_CONTEXT, 4) &&
1476 (odr_sequence_of(o, z_DiagRec, &(*p)->diagnostics,
1477 &(*p)->num_diagnostics) || odr_ok(o)) &&
1478 odr_implicit(o, z_External, &(*p)->taskPackage, ODR_CONTEXT, 5, 1) &&
1479 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1480 odr_sequence_end(o);
1483 /* ------------------------ APDU ------------------------- */
1485 int z_APDU(ODR o, Z_APDU **p, int opt)
1487 static Odr_arm arm[] =
1489 {ODR_IMPLICIT, ODR_CONTEXT, 20, Z_APDU_initRequest, z_InitRequest},
1490 {ODR_IMPLICIT, ODR_CONTEXT, 21, Z_APDU_initResponse, z_InitResponse},
1491 {ODR_IMPLICIT, ODR_CONTEXT, 22, Z_APDU_searchRequest, z_SearchRequest},
1492 {ODR_IMPLICIT, ODR_CONTEXT, 23, Z_APDU_searchResponse,
1494 {ODR_IMPLICIT, ODR_CONTEXT, 24, Z_APDU_presentRequest,
1496 {ODR_IMPLICIT, ODR_CONTEXT, 25, Z_APDU_presentResponse,
1498 {ODR_IMPLICIT, ODR_CONTEXT, 26, Z_APDU_deleteResultSetRequest,
1499 z_DeleteResultSetRequest},
1500 {ODR_IMPLICIT, ODR_CONTEXT, 27, Z_APDU_deleteResultSetResponse,
1501 z_DeleteResultSetResponse},
1502 {ODR_IMPLICIT, ODR_CONTEXT, 28, Z_APDU_accessControlRequest,
1503 z_AccessControlRequest},
1504 {ODR_IMPLICIT, ODR_CONTEXT, 29, Z_APDU_accessControlResponse,
1505 z_AccessControlResponse},
1506 {ODR_IMPLICIT, ODR_CONTEXT, 30, Z_APDU_resourceControlRequest,
1507 z_ResourceControlRequest},
1508 {ODR_IMPLICIT, ODR_CONTEXT, 31, Z_APDU_resourceControlResponse,
1509 z_ResourceControlResponse},
1510 {ODR_IMPLICIT, ODR_CONTEXT, 32, Z_APDU_triggerResourceControlRequest,
1511 z_TriggerResourceControlRequest},
1512 {ODR_IMPLICIT, ODR_CONTEXT, 35, Z_APDU_scanRequest, z_ScanRequest},
1513 {ODR_IMPLICIT, ODR_CONTEXT, 36, Z_APDU_scanResponse, z_ScanResponse},
1514 {ODR_IMPLICIT, ODR_CONTEXT, 45, Z_APDU_segmentRequest, z_Segment},
1515 {ODR_IMPLICIT, ODR_CONTEXT, 46, Z_APDU_extendedServicesRequest,
1516 z_ExtendedServicesRequest},
1517 {ODR_IMPLICIT, ODR_CONTEXT, 47, Z_APDU_extendedServicesResponse,
1518 z_ExtendedServicesResponse},
1519 {ODR_IMPLICIT, ODR_CONTEXT, 48, Z_APDU_close, z_Close},
1524 if (o->direction == ODR_DECODE)
1525 *p = odr_malloc(o, sizeof(**p));
1526 if (!odr_choice(o, arm, &(*p)->u, &(*p)->which))
1528 if (o->direction == ODR_DECODE)
1530 return opt && odr_ok(o);