2 * Copyright (c) 1995, Index Data
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.30 1995-06-15 15:42:01 quinn
10 * Revision 1.29 1995/06/15 07:44:49 quinn
13 * Revision 1.28 1995/06/14 15:26:35 quinn
14 * *** empty log message ***
16 * Revision 1.27 1995/06/07 14:36:22 quinn
19 * Revision 1.26 1995/06/02 09:49:13 quinn
20 * Adding access control
22 * Revision 1.25 1995/05/25 11:00:08 quinn
23 * *** empty log message ***
25 * Revision 1.24 1995/05/22 13:58:18 quinn
26 * Fixed an ODR_NULLVAL.
28 * Revision 1.23 1995/05/22 11:30:18 quinn
29 * Adding Z39.50-1992 stuff to proto.c. Adding zget.c
31 * Revision 1.22 1995/05/17 08:40:56 quinn
32 * Added delete. Fixed some sequence_begins. Smallish.
34 * Revision 1.21 1995/05/16 08:50:24 quinn
35 * License, documentation, and memory fixes
37 * Revision 1.20 1995/05/15 11:55:25 quinn
40 * Revision 1.19 1995/04/11 11:58:35 quinn
43 * Revision 1.18 1995/04/11 11:52:02 quinn
44 * Fixed possible buf in proto.c
46 * Revision 1.17 1995/04/10 10:22:22 quinn
49 * Revision 1.16 1995/03/30 10:26:43 quinn
50 * Added Term structure
52 * Revision 1.15 1995/03/30 09:08:39 quinn
53 * Added Resource control protocol
55 * Revision 1.14 1995/03/29 08:06:13 quinn
56 * Added a few v3 elements
58 * Revision 1.13 1995/03/20 11:26:52 quinn
59 * *** empty log message ***
61 * Revision 1.12 1995/03/20 09:45:09 quinn
64 * Revision 1.11 1995/03/17 10:17:25 quinn
65 * Added memory management.
67 * Revision 1.10 1995/03/15 11:17:40 quinn
68 * Fixed some return-checks from choice.. need better ay to handle those..
70 * Revision 1.9 1995/03/15 08:37:06 quinn
71 * Fixed protocol bugs.
73 * Revision 1.8 1995/03/14 16:59:24 quinn
74 * Fixed OPTIONAL flag in attributeelement
76 * Revision 1.7 1995/03/07 16:29:33 quinn
77 * Added authentication stuff.
79 * Revision 1.6 1995/03/01 14:46:03 quinn
80 * Fixed protocol bug in 8777query.
82 * Revision 1.5 1995/02/14 11:54:22 quinn
85 * Revision 1.4 1995/02/10 15:54:30 quinn
88 * Revision 1.3 1995/02/09 15:51:39 quinn
91 * Revision 1.2 1995/02/06 21:26:07 quinn
92 * Repaired this evening's damages..
94 * Revision 1.1 1995/02/06 16:44:47 quinn
95 * First hack at Z/SR protocol
103 /* ---------------------- GLOBAL DEFS ------------------- */
105 int z_ReferenceId(ODR o, Z_ReferenceId **p, int opt)
107 return odr_implicit(o, odr_octetstring, (Odr_oct**) p, ODR_CONTEXT, 2, opt);
110 int z_DatabaseName(ODR o, Z_DatabaseName **p, int opt)
112 return odr_implicit(o, odr_visiblestring, (char **) p, ODR_CONTEXT, 105,
116 int z_ResultSetId(ODR o, char **p, int opt)
118 return odr_implicit(o, odr_visiblestring, (char **) p, ODR_CONTEXT, 31,
122 int z_UserInformationField(ODR o, Odr_external **p, int opt)
124 return odr_explicit(o, odr_external, (Odr_external **)p, ODR_CONTEXT,
128 int z_InfoCategory(ODR o, Z_InfoCategory **p, int opt)
130 if (!odr_sequence_begin(o, p, sizeof(**p)))
131 return opt && odr_ok(o);
133 odr_implicit(o, odr_oid, &(*p)->categoryTypeId, ODR_CONTEXT, 1, 1) &&
134 odr_implicit(o, odr_integer, &(*p)->categoryValue, ODR_CONTEXT, 2, 0) &&
138 int z_OtherInformationUnit(ODR o, Z_OtherInformationUnit **p, int opt)
140 static Odr_arm arm[] =
142 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_OtherInfo_characterInfo,
144 {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_OtherInfo_binaryInfo,
146 {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_OtherInfo_externallyDefinedInfo,
148 {ODR_IMPLICIT, ODR_CONTEXT, 5, Z_OtherInfo_oid, odr_oid},
152 if (!odr_sequence_begin(o, p, sizeof(**p)))
153 return opt && odr_ok(o);
155 odr_implicit(o, z_InfoCategory, &(*p)->category, ODR_CONTEXT, 1, 1) &&
156 odr_choice(o, arm, &(*p)->which, &(*p)->information) &&
160 int z_OtherInformation(ODR o, Z_OtherInformation **p, int opt)
162 if (o->direction == ODR_DECODE)
163 *p = odr_malloc(o, sizeof(**p));
166 odr_implicit_settag(o, ODR_CONTEXT, 201);
167 if (odr_sequence_of(o, z_OtherInformationUnit, &(*p)->list,
168 &(*p)->num_elements))
171 return opt && odr_ok(o);
174 int z_StringOrNumeric(ODR o, Z_StringOrNumeric **p, int opt)
176 static Odr_arm arm[] =
178 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_StringOrNumeric_string,
180 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_StringOrNumeric_numeric,
185 if (o->direction == ODR_DECODE)
186 *p = odr_malloc(o, sizeof(**p));
189 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
192 return opt && odr_ok(o);
198 int z_Unit(ODR o, Z_Unit **p, int opt)
200 if (!odr_sequence_begin(o, p, sizeof(**p)))
201 return opt && odr_ok(o);
203 odr_implicit(o, odr_visiblestring, &(*p)->unitSystem, ODR_CONTEXT,
205 odr_explicit(o, z_StringOrNumeric, &(*p)->unitType, ODR_CONTEXT,
207 odr_explicit(o, z_StringOrNumeric, &(*p)->unit, ODR_CONTEXT, 3, 1) &&
208 odr_implicit(o, odr_integer, &(*p)->scaleFactor, ODR_CONTEXT, 4, 1) &&
212 int z_IntUnit(ODR o, Z_IntUnit **p, int opt)
214 if (!odr_sequence_begin(o, p, sizeof(**p)))
215 return opt && odr_ok(o);
217 odr_implicit(o, odr_integer, &(*p)->value, ODR_CONTEXT, 1, 0) &&
218 odr_implicit(o, z_Unit, &(*p)->unitUsed, ODR_CONTEXT, 2, 0) &&
222 /* ---------------------- INITIALIZE SERVICE ------------------- */
225 int z_NSRAuthentication(ODR o, Z_NSRAuthentication **p, int opt)
227 if (!odr_sequence_begin(o, p, sizeof(**p)))
228 return opt && odr_ok(o);
230 odr_visiblestring(o, &(*p)->user, 0) &&
231 odr_visiblestring(o, &(*p)->password, 0) &&
232 odr_visiblestring(o, &(*p)->account, 0) &&
237 int z_IdPass(ODR o, Z_IdPass **p, int opt)
239 if (!odr_sequence_begin(o, p, sizeof(**p)))
240 return opt && odr_ok(o);
242 odr_implicit(o, odr_visiblestring, &(*p)->groupId, ODR_CONTEXT, 0, 1) &&
243 odr_implicit(o, odr_visiblestring, &(*p)->userId, ODR_CONTEXT, 1, 1) &&
244 odr_implicit(o, odr_visiblestring, &(*p)->password, ODR_CONTEXT, 2,
249 int z_StrAuthentication(ODR o, char **p, int opt)
251 return odr_visiblestring(o, p, opt);
254 int z_IdAuthentication(ODR o, Z_IdAuthentication **p, int opt)
256 static Odr_arm arm[] =
258 {-1, -1, -1, Z_IdAuthentication_open, z_StrAuthentication},
259 {-1, -1, -1, Z_IdAuthentication_idPass, z_IdPass},
260 {-1, -1, -1, Z_IdAuthentication_anonymous, odr_null},
261 {-1, -1, -1, Z_IdAuthentication_other, odr_external},
265 if (o->direction == ODR_DECODE)
266 *p = odr_malloc(o, sizeof(**p));
270 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
273 return opt && odr_ok(o);
276 int z_InitRequest(ODR o, Z_InitRequest **p, int opt)
280 if (!odr_sequence_begin(o, p, sizeof(**p)))
281 return opt && odr_ok(o);
284 z_ReferenceId(o, &pp->referenceId, 1) &&
285 odr_implicit(o, odr_bitstring, &pp->protocolVersion, ODR_CONTEXT,
287 odr_implicit(o, odr_bitstring, &pp->options, ODR_CONTEXT, 4, 0) &&
288 odr_implicit(o, odr_integer, &pp->preferredMessageSize, ODR_CONTEXT,
290 odr_implicit(o, odr_integer, &pp->maximumRecordSize, ODR_CONTEXT,
292 odr_explicit(o, z_IdAuthentication, &pp->idAuthentication, ODR_CONTEXT,
294 odr_implicit(o, odr_visiblestring, &pp->implementationId, ODR_CONTEXT,
296 odr_implicit(o, odr_visiblestring, &pp->implementationName, ODR_CONTEXT,
298 odr_implicit(o, odr_visiblestring, &pp->implementationVersion,
299 ODR_CONTEXT, 112, 1) &&
300 z_UserInformationField(o, &pp->userInformationField, 1) &&
302 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
307 int z_InitResponse(ODR o, Z_InitResponse **p, int opt)
311 if (!odr_sequence_begin(o, p, sizeof(**p)))
312 return opt && odr_ok(o);
315 z_ReferenceId(o, &pp->referenceId, 1) &&
316 odr_implicit(o, odr_bitstring, &pp->protocolVersion, ODR_CONTEXT,
318 odr_implicit(o, odr_bitstring, &pp->options, ODR_CONTEXT, 4, 0) &&
319 odr_implicit(o, odr_integer, &pp->preferredMessageSize, ODR_CONTEXT,
321 odr_implicit(o, odr_integer, &pp->maximumRecordSize, ODR_CONTEXT,
323 odr_implicit(o, odr_bool, &pp->result, ODR_CONTEXT, 12, 0) &&
324 odr_implicit(o, odr_visiblestring, &pp->implementationId, ODR_CONTEXT,
326 odr_implicit(o, odr_visiblestring, &pp->implementationName, ODR_CONTEXT,
328 odr_implicit(o, odr_visiblestring, &pp->implementationVersion,
329 ODR_CONTEXT, 112, 1) &&
330 z_UserInformationField(o, &pp->userInformationField, 1) &&
332 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
337 /* ------------------ RESOURCE CONTROL ----------------*/
339 int z_TriggerResourceControlRequest(ODR o, Z_TriggerResourceControlRequest **p,
342 if (!odr_sequence_begin(o, p, sizeof(**p)))
343 return opt && odr_ok(o);
345 z_ReferenceId(o, &(*p)->referenceId, 1) &&
346 odr_implicit(o, odr_integer, &(*p)->requestedAction, ODR_CONTEXT,
348 odr_implicit(o, odr_oid, &(*p)->prefResourceReportFormat,
349 ODR_CONTEXT, 47, 1) &&
350 odr_implicit(o, odr_bool, &(*p)->resultSetWanted, ODR_CONTEXT,
353 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
358 int z_ResourceControlRequest(ODR o, Z_ResourceControlRequest **p, int opt)
360 if (!odr_sequence_begin(o, p, sizeof(**p)))
361 return opt && odr_ok(o);
363 z_ReferenceId(o, &(*p)->referenceId, 1) &&
364 odr_implicit(o, odr_bool, &(*p)->suspendedFlag, ODR_CONTEXT, 39, 1)&&
365 odr_explicit(o, odr_external, &(*p)->resourceReport, ODR_CONTEXT,
367 odr_implicit(o, odr_integer, &(*p)->partialResultsAvailable,
368 ODR_CONTEXT, 41, 1) &&
369 odr_implicit(o, odr_bool, &(*p)->responseRequired, ODR_CONTEXT,
371 odr_implicit(o, odr_bool, &(*p)->triggeredRequestFlag,
372 ODR_CONTEXT, 43, 1) &&
374 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
379 int z_ResourceControlResponse(ODR o, Z_ResourceControlResponse **p, int opt)
381 if (!odr_sequence_begin(o, p, sizeof(**p)))
382 return opt && odr_ok(o);
384 z_ReferenceId(o, &(*p)->referenceId, 1) &&
385 odr_implicit(o, odr_bool, &(*p)->continueFlag, ODR_CONTEXT, 44, 0) &&
386 odr_implicit(o, odr_bool, &(*p)->resultSetWanted, ODR_CONTEXT,
389 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
394 /* ------------------------ SEARCH SERVICE ----------------------- */
396 int z_ElementSetName(ODR o, char **p, int opt)
398 return odr_implicit(o, odr_visiblestring, (char**) p, ODR_CONTEXT, 103,
402 int z_DatabaseSpecificUnit(ODR o, Z_DatabaseSpecificUnit **p, int opt)
404 if (!odr_sequence_begin(o, p, sizeof(**p)))
405 return opt && odr_ok(o);
407 z_DatabaseName(o, &(*p)->databaseName, 0) &&
408 z_ElementSetName(o, &(*p)->elementSetName, 0) &&
412 int z_DatabaseSpecific(ODR o, Z_DatabaseSpecific **p, int opt)
414 if (o->direction == ODR_DECODE)
415 *p = odr_malloc(o, sizeof(**p));
419 odr_implicit_settag(o, ODR_CONTEXT, 1);
420 if (odr_sequence_of(o, z_DatabaseSpecificUnit, &(*p)->elements,
421 &(*p)->num_elements))
427 int z_ElementSetNames(ODR o, Z_ElementSetNames **p, int opt)
429 static Odr_arm arm[] =
431 {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_ElementSetNames_generic,
433 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ElementSetNames_databaseSpecific,
438 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 19))
439 return opt && odr_ok(o);
441 if (o->direction == ODR_DECODE)
442 *p = odr_malloc(o, sizeof(**p));
444 if (odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
445 odr_constructed_end(o))
451 /* ----------------------- RPN QUERY -----------------------*/
453 int z_ComplexAttribute(ODR o, Z_ComplexAttribute **p, int opt)
455 if (!odr_sequence_begin(o, p, sizeof(**p)))
456 return opt && odr_ok(o);
458 odr_implicit_settag(o, ODR_CONTEXT, 1) &&
459 odr_sequence_of(o, z_StringOrNumeric, &(*p)->list,
461 odr_implicit_settag(o, ODR_CONTEXT, 2) &&
462 (odr_sequence_of(o, odr_integer, &(*p)->semanticAction,
463 &(*p)->num_semanticAction) || odr_ok(o)) &&
467 int z_AttributeElement(ODR o, Z_AttributeElement **p, int opt)
470 static Odr_arm arm[] =
472 {ODR_IMPLICIT, ODR_CONTEXT, 121, Z_AttributeValue_numeric,
474 {ODR_IMPLICIT, ODR_CONTEXT, 224, Z_AttributeValue_complex,
480 if (!odr_sequence_begin(o, p, sizeof(**p)))
481 return opt && odr_ok(o);
484 odr_implicit(o, odr_oid, &(*p)->attributeSet, ODR_CONTEXT, 1, 1) &&
486 odr_implicit(o, odr_integer, &(*p)->attributeType, ODR_CONTEXT,
489 odr_choice(o, arm, &(*p)->value, &(*p)->which) &&
491 odr_implicit(o, odr_integer, &(*p)->attributeValue, ODR_CONTEXT,
497 int z_Term(ODR o, Z_Term **p, int opt)
499 static Odr_arm arm[] =
501 {ODR_IMPLICIT, ODR_CONTEXT, 45, Z_Term_general, odr_octetstring},
502 {ODR_IMPLICIT, ODR_CONTEXT, 215, Z_Term_numeric, odr_integer},
503 {ODR_IMPLICIT, ODR_CONTEXT, 216, Z_Term_characterString,
505 {ODR_IMPLICIT, ODR_CONTEXT, 217, Z_Term_oid, odr_oid},
506 {ODR_IMPLICIT, ODR_CONTEXT, 218, Z_Term_dateTime, odr_cstring},
507 {ODR_IMPLICIT, ODR_CONTEXT, 219, Z_Term_external, odr_external},
508 /* add intUnit here */
509 {ODR_IMPLICIT, ODR_CONTEXT, 221, Z_Term_null, odr_null},
513 if (o->direction ==ODR_DECODE)
514 *p = odr_malloc(o, sizeof(**p));
517 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
520 return opt && odr_ok(o);
523 int z_AttributesPlusTerm(ODR o, Z_AttributesPlusTerm **p, int opt)
525 if (!(odr_implicit_settag(o, ODR_CONTEXT, 102) &&
526 odr_sequence_begin(o, p, sizeof(**p))))
527 return opt && odr_ok(o);
529 odr_implicit_settag(o, ODR_CONTEXT, 44) &&
530 odr_sequence_of(o, z_AttributeElement, &(*p)->attributeList,
531 &(*p)->num_attributes) &&
532 z_Term(o, &(*p)->term, 0) &&
536 int z_ResultSetPlusAttributes(ODR o, Z_ResultSetPlusAttributes **p, int opt)
538 if (!(odr_implicit_settag(o, ODR_CONTEXT, 214) &&
539 odr_sequence_begin(o, p, sizeof(**p))))
540 return opt && odr_ok(o);
542 z_ResultSetId(o, &(*p)->resultSet, 0) &&
543 odr_implicit_settag(o, ODR_CONTEXT, 44) &&
544 odr_sequence_of(o, z_AttributeElement, &(*p)->attributeList,
545 &(*p)->num_attributes) &&
549 int z_ProximityOperator(ODR o, Z_ProximityOperator **p, int opt)
551 static Odr_arm arm[] =
553 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ProxCode_known, odr_integer},
554 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ProxCode_private, odr_integer},
558 if (!odr_sequence_begin(o, p, sizeof(**p)))
559 return opt && odr_ok(o);
561 odr_implicit(o, odr_bool, &(*p)->exclusion, ODR_CONTEXT, 1, 1) &&
562 odr_implicit(o, odr_integer, &(*p)->distance, ODR_CONTEXT, 2, 0) &&
563 odr_implicit(o, odr_bool, &(*p)->ordered, ODR_CONTEXT, 3, 0) &&
564 odr_implicit(o, odr_integer, &(*p)->relationType, ODR_CONTEXT, 4, 0) &&
565 odr_constructed_begin(o, &(*p)->proximityUnitCode, ODR_CONTEXT, 5) &&
566 odr_choice(o, arm, &(*p)->proximityUnitCode, &(*p)->which) &&
567 odr_constructed_end(o) &&
571 int z_Operator(ODR o, Z_Operator **p, int opt)
573 static Odr_arm arm[] =
575 {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_Operator_and, odr_null},
576 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Operator_or, odr_null},
577 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Operator_and_not, odr_null},
578 {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_Operator_prox, z_ProximityOperator},
582 if (!*p && o->direction != ODR_DECODE)
584 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 46))
585 return opt && odr_ok(o);
586 if (o->direction == ODR_DECODE)
587 *p = odr_malloc(o, sizeof(**p));
589 if (odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
590 odr_constructed_end(o))
593 return opt && odr_ok(o);
596 int z_Operand(ODR o, Z_Operand **p, int opt)
598 static Odr_arm arm[] =
600 {-1, -1, -1, Z_Operand_APT, z_AttributesPlusTerm},
601 {-1, -1, -1, Z_Operand_resultSetId, z_ResultSetId},
602 {-1, -1, -1, Z_Operand_resultAttr, z_ResultSetPlusAttributes},
606 if (o->direction == ODR_DECODE)
607 *p = odr_malloc(o, sizeof(**p));
610 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
613 return opt && odr_ok(o);
616 int z_RPNStructure(ODR o, Z_RPNStructure **p, int opt);
618 int z_Complex(ODR o, Z_Complex **p, int opt)
620 if (!odr_sequence_begin(o, p, sizeof(**p)))
621 return opt && odr_ok(o);
623 z_RPNStructure(o, &(*p)->s1, 0) &&
624 z_RPNStructure(o, &(*p)->s2, 0) &&
625 z_Operator(o, &(*p)->operator, 0) &&
629 int z_RPNStructure(ODR o, Z_RPNStructure **p, int opt)
631 static Odr_arm arm[] =
633 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_RPNStructure_simple, z_Operand},
634 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_RPNStructure_complex, z_Complex},
638 if (o->direction == ODR_DECODE)
639 *p = odr_malloc(o, sizeof(**p));
642 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
645 return opt && odr_ok(o);
648 int z_RPNQuery(ODR o, Z_RPNQuery **p, int opt)
650 if (!odr_sequence_begin(o, p, sizeof(**p)))
651 return opt && odr_ok(o);
653 odr_oid(o, &(*p)->attributeSetId, 0) &&
654 z_RPNStructure(o, &(*p)->RPNStructure, 0) &&
658 /* -----------------------END RPN QUERY ----------------------- */
660 int z_Query(ODR o, Z_Query **p, int opt)
662 static Odr_arm arm[] =
664 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Query_type_1, z_RPNQuery},
665 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_Query_type_2, odr_octetstring},
666 {ODR_EXPLICIT, ODR_CONTEXT, 101, Z_Query_type_101, z_RPNQuery},
670 if (o->direction == ODR_DECODE)
671 *p = odr_malloc(o, sizeof(**p));
674 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
677 return opt && odr_ok(o);
680 int z_SearchRequest(ODR o, Z_SearchRequest **p, int opt)
684 if (!odr_sequence_begin(o, p, sizeof(**p)))
685 return opt && odr_ok(o);
688 z_ReferenceId(o, &pp->referenceId, 1) &&
689 odr_implicit(o, odr_integer, &pp->smallSetUpperBound, ODR_CONTEXT,
691 odr_implicit(o, odr_integer, &pp->largeSetLowerBound, ODR_CONTEXT,
693 odr_implicit(o, odr_integer, &pp->mediumSetPresentNumber, ODR_CONTEXT,
695 odr_implicit(o, odr_bool, &pp->replaceIndicator, ODR_CONTEXT, 16, 1) &&
696 odr_implicit(o, odr_visiblestring, &pp->resultSetName, ODR_CONTEXT,
698 odr_implicit_settag(o, ODR_CONTEXT, 18) &&
699 odr_sequence_of(o, z_DatabaseName, &pp->databaseNames,
700 &pp->num_databaseNames) &&
701 odr_explicit(o, z_ElementSetNames, &pp->smallSetElementSetNames,
702 ODR_CONTEXT, 100, 1) &&
703 odr_explicit(o, z_ElementSetNames, &pp->mediumSetElementSetNames,
704 ODR_CONTEXT, 101, 1) &&
705 odr_implicit(o, odr_oid, &pp->preferredRecordSyntax,
706 ODR_CONTEXT, 104, 1) &&
707 odr_explicit(o, z_Query, &pp->query, ODR_CONTEXT, 21, 0) &&
709 odr_implicit(o, z_OtherInformation, &(*p)->additionalSearchInfo,
710 ODR_CONTEXT, 203, 1) &&
711 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
716 /* ------------------------ RECORD ------------------------- */
718 int z_DatabaseRecord(ODR o, Z_DatabaseRecord **p, int opt)
720 return odr_external(o, (Odr_external **) p, opt);
725 int z_DefaultDiagFormat(ODR o, Z_DefaultDiagFormat **p, int opt)
727 if (!odr_sequence_begin(o, p, sizeof(**p)))
728 return opt && odr_ok(o);
730 odr_oid(o, &(*p)->diagnosticSetId, 1) && /* SHOULD NOT BE OPT! */
731 odr_integer(o, &(*p)->condition, 0) &&
733 * I no longer recall what server tagged the addinfo.. but it isn't
734 * hurting anyone, so...
735 * We need to turn it into a choice, or something, because of
736 * that damn generalstring in v3.
738 (odr_visiblestring(o, &(*p)->addinfo, 0) ||
739 odr_implicit(o, odr_cstring, &(*p)->addinfo, ODR_CONTEXT,
740 ODR_VISIBLESTRING, 1)) &&
744 int z_DiagRec(ODR o, Z_DiagRec **p, int opt)
746 static Odr_arm arm[] =
748 {-1, -1, -1, Z_DiagRec_defaultFormat, z_DefaultDiagFormat},
749 {-1, -1, -1, Z_DiagRec_externallyDefined, odr_external},
753 if (o->direction == ODR_DECODE)
754 *p = odr_malloc(o, sizeof(**p));
757 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
760 return opt && odr_ok(o);
765 int z_DiagRec(ODR o, Z_DiagRec **p, int opt)
767 if (!odr_sequence_begin(o, p, sizeof(**p)))
768 return opt && odr_ok(o);
770 odr_oid(o, &(*p)->diagnosticSetId, 1) && /* SHOULD NOT BE OPT! */
771 odr_integer(o, &(*p)->condition, 0) &&
773 * I no longer recall what server tagged the addinfo.. but it isn't
774 * hurting anyone, so...
775 * We need to turn it into a choice, or something, because of
776 * that damn generalstring in v3.
778 (odr_visiblestring(o, &(*p)->addinfo, 0) ||
779 odr_implicit(o, odr_cstring, &(*p)->addinfo, ODR_CONTEXT,
780 ODR_VISIBLESTRING, 1)) &&
786 int z_DiagRecs(ODR o, Z_DiagRecs **p, int opt)
788 if (o->direction == ODR_DECODE)
789 *p = odr_malloc(o, sizeof(**p));
793 if (odr_sequence_of(o, z_DiagRec, &(*p)->diagRecs,
794 &(*p)->num_diagRecs))
800 int z_NamePlusRecord(ODR o, Z_NamePlusRecord **p, int opt)
802 static Odr_arm arm[] =
804 {ODR_EXPLICIT, ODR_CONTEXT, 1, Z_NamePlusRecord_databaseRecord,
806 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_NamePlusRecord_surrogateDiagnostic,
811 if (!odr_sequence_begin(o, p, sizeof(**p)))
812 return opt && odr_ok(o);
814 odr_implicit(o, z_DatabaseName, &(*p)->databaseName, ODR_CONTEXT,
816 odr_constructed_begin(o, &(*p)->u, ODR_CONTEXT, 1) &&
817 odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
818 odr_constructed_end(o) &&
822 int z_NamePlusRecordList(ODR o, Z_NamePlusRecordList **p, int opt)
824 if (o->direction == ODR_DECODE)
825 *p = odr_malloc(o, sizeof(**p));
828 if (odr_sequence_of(o, z_NamePlusRecord, &(*p)->records,
835 int z_Records(ODR o, Z_Records **p, int opt)
837 static Odr_arm arm[] =
839 {ODR_IMPLICIT, ODR_CONTEXT, 28, Z_Records_DBOSD, z_NamePlusRecordList},
840 {ODR_IMPLICIT, ODR_CONTEXT, 130, Z_Records_NSD, z_DiagRec},
841 {ODR_IMPLICIT, ODR_CONTEXT, 205, Z_Records_multipleNSD,
846 if (o->direction == ODR_DECODE)
847 *p = odr_malloc(o, sizeof(**p));
850 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
853 return opt && odr_ok(o);
856 /* ------------------------ ACCESS CTRL SERVICE ----------------------- */
858 int z_AccessControlRequest(ODR o, Z_AccessControlRequest **p, int opt)
860 static Odr_arm arm[] =
862 {ODR_IMPLICIT, ODR_CONTEXT, 37, Z_AccessRequest_simpleForm,
864 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_AccessRequest_externallyDefined,
868 if (!odr_sequence_begin(o, p, sizeof(**p)))
869 return opt && odr_ok(o);
871 z_ReferenceId(o, &(*p)->referenceId, 1) &&
872 odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
874 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
879 int z_AccessControlResponse(ODR o, Z_AccessControlResponse **p, int opt)
881 static Odr_arm arm[] =
883 {ODR_IMPLICIT, ODR_CONTEXT, 38, Z_AccessResponse_simpleForm,
885 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_AccessResponse_externallyDefined,
889 if (!odr_sequence_begin(o, p, sizeof(**p)))
890 return opt && odr_ok(o);
892 z_ReferenceId(o, &(*p)->referenceId, 1) &&
893 odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
894 odr_explicit(o, z_DiagRec, &(*p)->diagnostic, ODR_CONTEXT, 223, 1) &&
896 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
901 /* ------------------------ SCAN SERVICE -------------------- */
903 int z_AttributeList(ODR o, Z_AttributeList **p, int opt)
905 if (o->direction == ODR_DECODE)
906 *p = odr_malloc(o, sizeof(**p));
910 odr_implicit_settag(o, ODR_CONTEXT, 44);
911 if (odr_sequence_of(o, z_AttributeElement, &(*p)->attributes,
912 &(*p)->num_attributes))
915 return opt && odr_ok(o);
919 * This is a temporary hack. We don't know just *what* old version of the
920 * protocol willow uses, so we'll just patiently wait for them to update
922 static int willow_scan = 0;
924 int z_WillowAttributesPlusTerm(ODR o, Z_AttributesPlusTerm **p, int opt)
926 if (!*p && o->direction != ODR_DECODE)
928 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 4))
931 return opt && odr_ok(o);
933 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 1))
935 if (!odr_constructed_begin(o, p, ODR_UNIVERSAL, ODR_SEQUENCE))
937 if (!odr_implicit_settag(o, ODR_CONTEXT, 44))
939 if (o->direction == ODR_DECODE)
940 *p = odr_malloc(o, sizeof(**p));
941 if (!odr_sequence_of(o, z_AttributeElement, &(*p)->attributeList,
942 &(*p)->num_attributes))
944 if (!odr_sequence_end(o) || !odr_sequence_end(o))
946 if (!z_Term(o, &(*p)->term, 0))
948 if (!odr_constructed_end(o))
954 int z_AlternativeTerm(ODR o, Z_AlternativeTerm **p, int opt)
956 if (o->direction == ODR_DECODE)
957 *p = odr_malloc(o, sizeof(**p));
961 return opt && odr_ok(o);
964 if (odr_sequence_of(o, z_AttributesPlusTerm, &(*p)->terms,
968 return opt && !o->error;
971 int z_OccurrenceByAttributes(ODR o, Z_OccurrenceByAttributes **p, int opt)
973 if (!odr_sequence_begin(o, p, sizeof(**p)))
974 return opt && odr_ok(o);
976 odr_explicit(o, z_AttributeList, &(*p)->attributes, ODR_CONTEXT, 1, 1)&&
977 odr_explicit(o, odr_integer, &(*p)->global, ODR_CONTEXT, 2, 1) &&
981 int z_TermInfo(ODR o, Z_TermInfo **p, int opt)
983 if (!odr_sequence_begin(o, p, sizeof(**p)))
984 return opt && odr_ok(o);
987 odr_implicit(o, z_Term, &(*p)->term, ODR_CONTEXT, 1, 0) :
988 z_Term(o, &(*p)->term, 0)) &&
989 z_AttributeList(o, &(*p)->suggestedAttributes, 1) &&
990 odr_implicit(o, z_AlternativeTerm, &(*p)->alternativeTerm,
991 ODR_CONTEXT, 4, 1) &&
992 odr_implicit(o, odr_integer, &(*p)->globalOccurrences, ODR_CONTEXT,
994 odr_implicit(o, z_OccurrenceByAttributes, &(*p)->byAttributes,
995 ODR_CONTEXT, 3, 1) &&
999 int z_Entry(ODR o, Z_Entry **p, int opt)
1001 static Odr_arm arm[] =
1003 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Entry_termInfo, z_TermInfo},
1004 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_Entry_surrogateDiagnostic,
1009 if (o->direction == ODR_DECODE)
1010 *p = odr_malloc(o, sizeof(**p));
1014 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
1017 return opt && odr_ok(o);
1020 int z_Entries(ODR o, Z_Entries **p, int opt)
1022 if (o->direction == ODR_DECODE)
1023 *p = odr_malloc(o, sizeof(**p));
1027 if (odr_sequence_of(o, z_Entry, &(*p)->entries,
1028 &(*p)->num_entries))
1034 int z_ListEntries(ODR o, Z_ListEntries **p, int opt)
1036 static Odr_arm arm[] =
1038 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ListEntries_entries, z_Entries},
1039 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ListEntries_nonSurrogateDiagnostics,
1044 if (o->direction == ODR_DECODE)
1045 *p = odr_malloc(o, sizeof(**p));
1049 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
1052 return opt && odr_ok(o);
1055 int z_ScanRequest(ODR o, Z_ScanRequest **p, int opt)
1057 if (!odr_sequence_begin(o, p, sizeof(**p)))
1058 return opt && odr_ok(o);
1061 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1062 odr_implicit_settag(o, ODR_CONTEXT, 3) &&
1063 odr_sequence_of(o, z_DatabaseName, &(*p)->databaseNames,
1064 &(*p)->num_databaseNames) &&
1065 odr_oid(o, &(*p)->attributeSet, 1) &&
1066 (z_AttributesPlusTerm(o, &(*p)->termListAndStartPoint, 1) ?
1067 ((*p)->termListAndStartPoint ? 1 :
1068 z_WillowAttributesPlusTerm(o, &(*p)->termListAndStartPoint, 0)) : 0) &&
1069 odr_implicit(o, odr_integer, &(*p)->stepSize, ODR_CONTEXT, 5, 1) &&
1070 odr_implicit(o, odr_integer, &(*p)->numberOfTermsRequested,
1071 ODR_CONTEXT, 6, 0) &&
1072 odr_implicit(o, odr_integer, &(*p)->preferredPositionInResponse,
1073 ODR_CONTEXT, 7, 1) &&
1074 odr_sequence_end(o);
1077 int z_ScanResponse(ODR o, Z_ScanResponse **p, int opt)
1079 if (!odr_sequence_begin(o, p, sizeof(**p)))
1080 return opt && odr_ok(o);
1082 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1083 odr_implicit(o, odr_integer, &(*p)->stepSize, ODR_CONTEXT, 3, 1) &&
1084 odr_implicit(o, odr_integer, &(*p)->scanStatus, ODR_CONTEXT, 4, 0) &&
1085 odr_implicit(o, odr_integer, &(*p)->numberOfEntriesReturned,
1086 ODR_CONTEXT, 5, 0) &&
1087 odr_implicit(o, odr_integer, &(*p)->positionOfTerm, ODR_CONTEXT, 6, 1)&&
1088 odr_explicit(o, z_ListEntries, &(*p)->entries, ODR_CONTEXT, 7, 1) &&
1089 odr_implicit(o, odr_oid, &(*p)->attributeSet, ODR_CONTEXT, 8, 1) &&
1090 odr_sequence_end(o);
1093 /* ------------------------ SEARCHRESPONSE ----------------*/
1095 int z_NumberOfRecordsReturned(ODR o, int **p, int opt)
1097 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 24, opt);
1100 int z_NextResultSetPosition(ODR o, int **p, int opt)
1102 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 25, opt);
1105 int z_PresentStatus(ODR o, int **p, int opt)
1107 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 27, opt);
1110 int z_SearchResponse(ODR o, Z_SearchResponse **p, int opt)
1112 Z_SearchResponse *pp;
1114 if (!odr_sequence_begin(o, p, sizeof(**p)))
1115 return opt && odr_ok(o);
1118 z_ReferenceId(o, &pp->referenceId, 1) &&
1119 odr_implicit(o, odr_integer, &pp->resultCount, ODR_CONTEXT, 23, 0) &&
1120 z_NumberOfRecordsReturned(o, &pp->numberOfRecordsReturned, 0) &&
1121 z_NextResultSetPosition(o, &pp->nextResultSetPosition, 0) &&
1122 odr_implicit(o, odr_bool, &pp->searchStatus, ODR_CONTEXT, 22, 0) &&
1123 odr_implicit(o, odr_integer, &pp->resultSetStatus, ODR_CONTEXT, 26,
1125 z_PresentStatus(o, &pp->presentStatus, 1) &&
1126 z_Records(o, &pp->records, 1) &&
1128 odr_implicit(o, z_OtherInformation, &(*p)->additionalSearchInfo,
1129 ODR_CONTEXT, 203, 1) &&
1130 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1132 odr_sequence_end(o);
1135 /* --------------------- PRESENT SERVICE ---------------------- */
1137 int z_ElementSpec(ODR o, Z_ElementSpec **p, int opt)
1139 static Odr_arm arm[] =
1141 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ElementSpec_elementSetName,
1143 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ElementSpec_externalSpec,
1148 if (o->direction == ODR_DECODE)
1149 *p = odr_malloc(o, sizeof(**p));
1153 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
1156 return opt && odr_ok(o);
1159 int z_Specification(ODR o, Z_Specification **p, int opt)
1161 if (!odr_sequence_begin(o, p, sizeof(**p)))
1162 return opt && odr_ok(o);
1164 odr_implicit(o, odr_oid, &(*p)->schema, ODR_CONTEXT, 1, 1) &&
1165 z_ElementSpec(o, &(*p)->elementSpec, 1) &&
1166 odr_sequence_end(o);
1169 int z_DbSpecific(ODR o, Z_DbSpecific **p, int opt)
1171 if (!odr_sequence_begin(o, p, sizeof(**p)))
1172 return opt && odr_ok(o);
1174 odr_explicit(o, z_DatabaseName, &(*p)->databaseName, ODR_CONTEXT,
1176 odr_implicit(o, z_Specification, &(*p)->spec, ODR_CONTEXT, 2, 0) &&
1177 odr_sequence_end(o);
1180 int z_CompSpec(ODR o, Z_CompSpec **p, int opt)
1182 if (!odr_sequence_begin(o, p, sizeof(**p)))
1183 return opt && odr_ok(o);
1185 odr_implicit(o, odr_bool, &(*p)->selectAlternativeSyntax, ODR_CONTEXT,
1187 odr_implicit(o, z_Specification, &(*p)->generic, ODR_CONTEXT, 2, 1) &&
1188 odr_implicit_settag(o, ODR_CONTEXT, 3) &&
1189 (odr_sequence_of(o, z_DbSpecific, &(*p)->dbSpecific,
1190 &(*p)->num_dbSpecific) || odr_ok(o)) &&
1191 odr_implicit_settag(o, ODR_CONTEXT, 4) &&
1192 (odr_sequence_of(o, odr_oid, &(*p)->recordSyntax,
1193 &(*p)->num_recordSyntax) || odr_ok(o)) &&
1194 odr_sequence_end(o);
1197 int z_RecordComposition(ODR o, Z_RecordComposition **p, int opt)
1199 static Odr_arm arm[] =
1201 {ODR_EXPLICIT, ODR_CONTEXT, 1, Z_RecordComp_simple,
1203 {ODR_IMPLICIT, ODR_CONTEXT, 209, Z_RecordComp_complex,
1208 if (o->direction == ODR_DECODE)
1209 *p = odr_malloc(o, sizeof(**p));
1213 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
1216 return opt && odr_ok(o);
1219 int z_Range(ODR o, Z_Range **p, int opt)
1221 if (!odr_sequence_begin(o, p, sizeof(**p)))
1222 return opt && odr_ok(o);
1224 odr_implicit(o, odr_integer, &(*p)->startingPosition, ODR_CONTEXT,
1226 odr_implicit(o, odr_integer, &(*p)->numberOfRecords, ODR_CONTEXT,
1228 odr_sequence_end(o);
1231 int z_PresentRequest(ODR o, Z_PresentRequest **p, int opt)
1233 Z_PresentRequest *pp;
1235 if (!odr_sequence_begin(o, p, sizeof(**p)))
1236 return opt && odr_ok(o);
1239 z_ReferenceId(o, &pp->referenceId, 1) &&
1240 z_ResultSetId(o, &pp->resultSetId, 0) &&
1241 odr_implicit(o, odr_integer, &pp->resultSetStartPoint, ODR_CONTEXT,
1243 odr_implicit(o, odr_integer, &pp->numberOfRecordsRequested, ODR_CONTEXT,
1246 odr_implicit_settag(o, ODR_CONTEXT, 212) &&
1247 (odr_sequence_of(o, z_Range, &(*p)->additionalRanges,
1248 &(*p)->num_ranges) || odr_ok(o)) &&
1249 z_RecordComposition(o, &(*p)->recordComposition, 1) &&
1251 z_ElementSetNames(o, &pp->elementSetNames, 1) &&
1253 odr_implicit(o, odr_oid, &(*p)->preferredRecordSyntax, ODR_CONTEXT,
1256 odr_implicit(o, odr_integer, &(*p)->maxSegmentCount, ODR_CONTEXT,
1258 odr_implicit(o, odr_integer, &(*p)->maxRecordSize, ODR_CONTEXT,
1260 odr_implicit(o, odr_integer, &(*p)->maxSegmentSize, ODR_CONTEXT,
1262 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1264 odr_sequence_end(o);
1267 int z_PresentResponse(ODR o, Z_PresentResponse **p, int opt)
1269 Z_PresentResponse *pp;
1271 if (!odr_sequence_begin(o, p, sizeof(**p)))
1272 return opt && odr_ok(o);
1275 z_ReferenceId(o, &pp->referenceId, 1) &&
1276 z_NumberOfRecordsReturned(o, &pp->numberOfRecordsReturned, 0) &&
1277 z_NextResultSetPosition(o, &pp->nextResultSetPosition, 0) &&
1278 z_PresentStatus(o, &pp->presentStatus, 0) &&
1279 z_Records(o, &pp->records, 1) &&
1281 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1283 odr_sequence_end(o);
1286 /* ----------------------DELETE -------------------------- */
1288 int z_DeleteSetStatus(ODR o, int **p, int opt)
1290 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 33, opt);
1293 int z_ListStatus(ODR o, Z_ListStatus **p, int opt)
1295 if (!odr_sequence_begin(o, p, sizeof(**p)))
1296 return opt && odr_ok(o);
1298 z_ResultSetId(o, &(*p)->id, 0) &&
1299 z_DeleteSetStatus(o, &(*p)->status, 0) &&
1300 odr_sequence_end(o);
1303 int z_DeleteResultSetRequest(ODR o, Z_DeleteResultSetRequest **p, int opt)
1305 if (!odr_sequence_begin(o, p, sizeof(**p)))
1306 return opt && odr_ok(o);
1308 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1309 odr_implicit(o, odr_integer, &(*p)->deleteFunction, ODR_CONTEXT, 32,
1311 (odr_sequence_of(o, z_ListStatus, &(*p)->resultSetList,
1312 &(*p)->num_ids) || odr_ok(o)) &&
1314 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1316 odr_sequence_end(o);
1319 int z_DeleteResultSetResponse(ODR o, Z_DeleteResultSetResponse **p, int opt)
1321 if (!odr_sequence_begin(o, p, sizeof(**p)))
1322 return opt && odr_ok(o);
1324 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1325 odr_implicit(o, z_DeleteSetStatus, &(*p)->deleteOperationStatus,
1326 ODR_CONTEXT, 0, 1) &&
1327 odr_implicit_settag(o, ODR_CONTEXT, 1) &&
1328 (odr_sequence_of(o, z_ListStatus, &(*p)->deleteListStatuses,
1329 &(*p)->num_statuses) || odr_ok(o)) &&
1330 odr_implicit(o, odr_integer, &(*p)->numberNotDeleted, ODR_CONTEXT,
1332 odr_implicit_settag(o, ODR_CONTEXT, 35) &&
1333 (odr_sequence_of(o, z_ListStatus, &(*p)->bulkStatuses,
1334 &(*p)->num_bulkStatuses) || odr_ok(o)) &&
1335 odr_implicit(o, odr_visiblestring, &(*p)->deleteMessage, ODR_CONTEXT,
1338 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1340 odr_sequence_end(o);
1343 /* ------------------------ SEGMENT SERVICE -------------- */
1345 int z_Segment(ODR o, Z_Segment **p, int opt)
1347 if (!odr_sequence_begin(o, p, sizeof(**p)))
1348 return opt && odr_ok(o);
1350 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1351 odr_implicit(o, odr_integer, &(*p)->numberOfRecordsReturned,
1352 ODR_CONTEXT, 24, 0) &&
1353 odr_implicit_settag(o, ODR_CONTEXT, 0) &&
1354 odr_sequence_of(o, z_NamePlusRecord, &(*p)->segmentRecords,
1355 &(*p)->num_segmentRecords) &&
1356 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1357 odr_sequence_end(o);
1360 /* ------------------------ CLOSE SERVICE ---------------- */
1362 int z_Close(ODR o, Z_Close **p, int opt)
1364 if (!odr_sequence_begin(o, p, sizeof(**p)))
1365 return opt && odr_ok(o);
1367 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1368 odr_implicit(o, odr_integer, &(*p)->closeReason, ODR_CONTEXT, 211, 0) &&
1369 odr_implicit(o, odr_visiblestring, &(*p)->diagnosticInformation,
1370 ODR_CONTEXT, 3, 1) &&
1371 odr_implicit(o, odr_oid, &(*p)->resourceReportFormat, ODR_CONTEXT,
1373 odr_implicit(o, odr_external, &(*p)->resourceReport, ODR_CONTEXT,
1376 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1378 odr_sequence_end(o);
1381 /* ------------------------ APDU ------------------------- */
1383 int z_APDU(ODR o, Z_APDU **p, int opt)
1385 static Odr_arm arm[] =
1387 {ODR_IMPLICIT, ODR_CONTEXT, 20, Z_APDU_initRequest, z_InitRequest},
1388 {ODR_IMPLICIT, ODR_CONTEXT, 21, Z_APDU_initResponse, z_InitResponse},
1389 {ODR_IMPLICIT, ODR_CONTEXT, 22, Z_APDU_searchRequest, z_SearchRequest},
1390 {ODR_IMPLICIT, ODR_CONTEXT, 23, Z_APDU_searchResponse,
1392 {ODR_IMPLICIT, ODR_CONTEXT, 24, Z_APDU_presentRequest,
1394 {ODR_IMPLICIT, ODR_CONTEXT, 25, Z_APDU_presentResponse,
1396 {ODR_IMPLICIT, ODR_CONTEXT, 26, Z_APDU_deleteResultSetRequest,
1397 z_DeleteResultSetRequest},
1398 {ODR_IMPLICIT, ODR_CONTEXT, 27, Z_APDU_deleteResultSetResponse,
1399 z_DeleteResultSetResponse},
1400 {ODR_IMPLICIT, ODR_CONTEXT, 30, Z_APDU_resourceControlRequest,
1401 z_ResourceControlRequest},
1402 {ODR_IMPLICIT, ODR_CONTEXT, 31, Z_APDU_resourceControlResponse,
1403 z_ResourceControlResponse},
1404 {ODR_IMPLICIT, ODR_CONTEXT, 32, Z_APDU_triggerResourceControlRequest,
1405 z_TriggerResourceControlRequest},
1406 {ODR_IMPLICIT, ODR_CONTEXT, 35, Z_APDU_scanRequest, z_ScanRequest},
1407 {ODR_IMPLICIT, ODR_CONTEXT, 36, Z_APDU_scanResponse, z_ScanResponse},
1408 {ODR_IMPLICIT, ODR_CONTEXT, 45, Z_APDU_segmentRequest, z_Segment},
1409 {ODR_IMPLICIT, ODR_CONTEXT, 48, Z_APDU_close, z_Close},
1414 if (o->direction == ODR_DECODE)
1415 *p = odr_malloc(o, sizeof(**p));
1416 if (!odr_choice(o, arm, &(*p)->u, &(*p)->which))
1418 if (o->direction == ODR_DECODE)
1420 return opt && odr_ok(o);