2 * Copyright (c) 1995, Index Data
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.29 1995-06-15 07:44:49 quinn
10 * Revision 1.28 1995/06/14 15:26:35 quinn
11 * *** empty log message ***
13 * Revision 1.27 1995/06/07 14:36:22 quinn
16 * Revision 1.26 1995/06/02 09:49:13 quinn
17 * Adding access control
19 * Revision 1.25 1995/05/25 11:00:08 quinn
20 * *** empty log message ***
22 * Revision 1.24 1995/05/22 13:58:18 quinn
23 * Fixed an ODR_NULLVAL.
25 * Revision 1.23 1995/05/22 11:30:18 quinn
26 * Adding Z39.50-1992 stuff to proto.c. Adding zget.c
28 * Revision 1.22 1995/05/17 08:40:56 quinn
29 * Added delete. Fixed some sequence_begins. Smallish.
31 * Revision 1.21 1995/05/16 08:50:24 quinn
32 * License, documentation, and memory fixes
34 * Revision 1.20 1995/05/15 11:55:25 quinn
37 * Revision 1.19 1995/04/11 11:58:35 quinn
40 * Revision 1.18 1995/04/11 11:52:02 quinn
41 * Fixed possible buf in proto.c
43 * Revision 1.17 1995/04/10 10:22:22 quinn
46 * Revision 1.16 1995/03/30 10:26:43 quinn
47 * Added Term structure
49 * Revision 1.15 1995/03/30 09:08:39 quinn
50 * Added Resource control protocol
52 * Revision 1.14 1995/03/29 08:06:13 quinn
53 * Added a few v3 elements
55 * Revision 1.13 1995/03/20 11:26:52 quinn
56 * *** empty log message ***
58 * Revision 1.12 1995/03/20 09:45:09 quinn
61 * Revision 1.11 1995/03/17 10:17:25 quinn
62 * Added memory management.
64 * Revision 1.10 1995/03/15 11:17:40 quinn
65 * Fixed some return-checks from choice.. need better ay to handle those..
67 * Revision 1.9 1995/03/15 08:37:06 quinn
68 * Fixed protocol bugs.
70 * Revision 1.8 1995/03/14 16:59:24 quinn
71 * Fixed OPTIONAL flag in attributeelement
73 * Revision 1.7 1995/03/07 16:29:33 quinn
74 * Added authentication stuff.
76 * Revision 1.6 1995/03/01 14:46:03 quinn
77 * Fixed protocol bug in 8777query.
79 * Revision 1.5 1995/02/14 11:54:22 quinn
82 * Revision 1.4 1995/02/10 15:54:30 quinn
85 * Revision 1.3 1995/02/09 15:51:39 quinn
88 * Revision 1.2 1995/02/06 21:26:07 quinn
89 * Repaired this evening's damages..
91 * Revision 1.1 1995/02/06 16:44:47 quinn
92 * First hack at Z/SR protocol
100 /* ---------------------- GLOBAL DEFS ------------------- */
102 int z_ReferenceId(ODR o, Z_ReferenceId **p, int opt)
104 return odr_implicit(o, odr_octetstring, (Odr_oct**) p, ODR_CONTEXT, 2, opt);
107 int z_DatabaseName(ODR o, Z_DatabaseName **p, int opt)
109 return odr_implicit(o, odr_visiblestring, (char **) p, ODR_CONTEXT, 105,
113 int z_ResultSetId(ODR o, char **p, int opt)
115 return odr_implicit(o, odr_visiblestring, (char **) p, ODR_CONTEXT, 31,
119 int z_UserInformationField(ODR o, Odr_external **p, int opt)
121 return odr_explicit(o, odr_external, (Odr_external **)p, ODR_CONTEXT,
125 int z_InfoCategory(ODR o, Z_InfoCategory **p, int opt)
127 if (!odr_sequence_begin(o, p, sizeof(**p)))
128 return opt && odr_ok(o);
130 odr_implicit(o, odr_oid, &(*p)->categoryTypeId, ODR_CONTEXT, 1, 1) &&
131 odr_implicit(o, odr_integer, &(*p)->categoryValue, ODR_CONTEXT, 2, 0) &&
135 int z_OtherInformationUnit(ODR o, Z_OtherInformationUnit **p, int opt)
137 static Odr_arm arm[] =
139 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_OtherInfo_characterInfo,
141 {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_OtherInfo_binaryInfo,
143 {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_OtherInfo_externallyDefinedInfo,
145 {ODR_IMPLICIT, ODR_CONTEXT, 5, Z_OtherInfo_oid, odr_oid},
149 if (!odr_sequence_begin(o, p, sizeof(**p)))
150 return opt && odr_ok(o);
152 odr_implicit(o, z_InfoCategory, &(*p)->category, ODR_CONTEXT, 1, 1) &&
153 odr_choice(o, arm, &(*p)->which, &(*p)->information) &&
157 int z_OtherInformation(ODR o, Z_OtherInformation **p, int opt)
159 if (o->direction == ODR_DECODE)
160 *p = odr_malloc(o, sizeof(**p));
163 odr_implicit_settag(o, ODR_CONTEXT, 201);
164 if (odr_sequence_of(o, z_OtherInformationUnit, &(*p)->list,
165 &(*p)->num_elements))
168 return opt && odr_ok(o);
171 int z_StringOrNumeric(ODR o, Z_StringOrNumeric **p, int opt)
173 static Odr_arm arm[] =
175 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_StringOrNumeric_string,
177 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_StringOrNumeric_numeric,
182 if (o->direction == ODR_DECODE)
183 *p = odr_malloc(o, sizeof(**p));
186 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
189 return opt && odr_ok(o);
195 int z_Unit(ODR o, Z_Unit **p, int opt)
197 if (!odr_sequence_begin(o, p, sizeof(**p)))
198 return opt && odr_ok(o);
200 odr_implicit(o, odr_visiblestring, &(*p)->unitSystem, ODR_CONTEXT,
202 odr_explicit(o, z_StringOrNumeric, &(*p)->unitType, ODR_CONTEXT,
204 odr_explicit(o, z_StringOrNumeric, &(*p)->unit, ODR_CONTEXT, 3, 1) &&
205 odr_implicit(o, odr_integer, &(*p)->scaleFactor, ODR_CONTEXT, 4, 1) &&
209 int z_IntUnit(ODR o, Z_IntUnit **p, int opt)
211 if (!odr_sequence_begin(o, p, sizeof(**p)))
212 return opt && odr_ok(o);
214 odr_implicit(o, odr_integer, &(*p)->value, ODR_CONTEXT, 1, 0) &&
215 odr_implicit(o, z_Unit, &(*p)->unitUsed, ODR_CONTEXT, 2, 0) &&
219 /* ---------------------- INITIALIZE SERVICE ------------------- */
222 int z_NSRAuthentication(ODR o, Z_NSRAuthentication **p, int opt)
224 if (!odr_sequence_begin(o, p, sizeof(**p)))
225 return opt && odr_ok(o);
227 odr_visiblestring(o, &(*p)->user, 0) &&
228 odr_visiblestring(o, &(*p)->password, 0) &&
229 odr_visiblestring(o, &(*p)->account, 0) &&
234 int z_IdPass(ODR o, Z_IdPass **p, int opt)
236 if (!odr_sequence_begin(o, p, sizeof(**p)))
237 return opt && odr_ok(o);
239 odr_implicit(o, odr_visiblestring, &(*p)->groupId, ODR_CONTEXT, 0, 1) &&
240 odr_implicit(o, odr_visiblestring, &(*p)->userId, ODR_CONTEXT, 1, 1) &&
241 odr_implicit(o, odr_visiblestring, &(*p)->password, ODR_CONTEXT, 2,
246 int z_StrAuthentication(ODR o, char **p, int opt)
248 return odr_visiblestring(o, p, opt);
251 int z_IdAuthentication(ODR o, Z_IdAuthentication **p, int opt)
253 static Odr_arm arm[] =
255 {-1, -1, -1, Z_IdAuthentication_open, z_StrAuthentication},
256 {-1, -1, -1, Z_IdAuthentication_idPass, z_IdPass},
257 {-1, -1, -1, Z_IdAuthentication_anonymous, odr_null},
258 {-1, -1, -1, Z_IdAuthentication_other, odr_external},
262 if (o->direction == ODR_DECODE)
263 *p = odr_malloc(o, sizeof(**p));
267 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
270 return opt && odr_ok(o);
273 int z_InitRequest(ODR o, Z_InitRequest **p, int opt)
277 if (!odr_sequence_begin(o, p, sizeof(**p)))
278 return opt && odr_ok(o);
281 z_ReferenceId(o, &pp->referenceId, 1) &&
282 odr_implicit(o, odr_bitstring, &pp->protocolVersion, ODR_CONTEXT,
284 odr_implicit(o, odr_bitstring, &pp->options, ODR_CONTEXT, 4, 0) &&
285 odr_implicit(o, odr_integer, &pp->preferredMessageSize, ODR_CONTEXT,
287 odr_implicit(o, odr_integer, &pp->maximumRecordSize, ODR_CONTEXT,
289 odr_explicit(o, z_IdAuthentication, &pp->idAuthentication, ODR_CONTEXT,
291 odr_implicit(o, odr_visiblestring, &pp->implementationId, ODR_CONTEXT,
293 odr_implicit(o, odr_visiblestring, &pp->implementationName, ODR_CONTEXT,
295 odr_implicit(o, odr_visiblestring, &pp->implementationVersion,
296 ODR_CONTEXT, 112, 1) &&
297 z_UserInformationField(o, &pp->userInformationField, 1) &&
299 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
304 int z_InitResponse(ODR o, Z_InitResponse **p, int opt)
308 if (!odr_sequence_begin(o, p, sizeof(**p)))
309 return opt && odr_ok(o);
312 z_ReferenceId(o, &pp->referenceId, 1) &&
313 odr_implicit(o, odr_bitstring, &pp->protocolVersion, ODR_CONTEXT,
315 odr_implicit(o, odr_bitstring, &pp->options, ODR_CONTEXT, 4, 0) &&
316 odr_implicit(o, odr_integer, &pp->preferredMessageSize, ODR_CONTEXT,
318 odr_implicit(o, odr_integer, &pp->maximumRecordSize, ODR_CONTEXT,
320 odr_implicit(o, odr_bool, &pp->result, ODR_CONTEXT, 12, 0) &&
321 odr_implicit(o, odr_visiblestring, &pp->implementationId, ODR_CONTEXT,
323 odr_implicit(o, odr_visiblestring, &pp->implementationName, ODR_CONTEXT,
325 odr_implicit(o, odr_visiblestring, &pp->implementationVersion,
326 ODR_CONTEXT, 112, 1) &&
327 z_UserInformationField(o, &pp->userInformationField, 1) &&
329 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
334 /* ------------------ RESOURCE CONTROL ----------------*/
336 int z_TriggerResourceControlRequest(ODR o, Z_TriggerResourceControlRequest **p,
339 if (!odr_sequence_begin(o, p, sizeof(**p)))
340 return opt && odr_ok(o);
342 z_ReferenceId(o, &(*p)->referenceId, 1) &&
343 odr_implicit(o, odr_integer, &(*p)->requestedAction, ODR_CONTEXT,
345 odr_implicit(o, odr_oid, &(*p)->prefResourceReportFormat,
346 ODR_CONTEXT, 47, 1) &&
347 odr_implicit(o, odr_bool, &(*p)->resultSetWanted, ODR_CONTEXT,
350 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
355 int z_ResourceControlRequest(ODR o, Z_ResourceControlRequest **p, int opt)
357 if (!odr_sequence_begin(o, p, sizeof(**p)))
358 return opt && odr_ok(o);
360 z_ReferenceId(o, &(*p)->referenceId, 1) &&
361 odr_implicit(o, odr_bool, &(*p)->suspendedFlag, ODR_CONTEXT, 39, 1)&&
362 odr_explicit(o, odr_external, &(*p)->resourceReport, ODR_CONTEXT,
364 odr_implicit(o, odr_integer, &(*p)->partialResultsAvailable,
365 ODR_CONTEXT, 41, 1) &&
366 odr_implicit(o, odr_bool, &(*p)->responseRequired, ODR_CONTEXT,
368 odr_implicit(o, odr_bool, &(*p)->triggeredRequestFlag,
369 ODR_CONTEXT, 43, 1) &&
371 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
376 int z_ResourceControlResponse(ODR o, Z_ResourceControlResponse **p, int opt)
378 if (!odr_sequence_begin(o, p, sizeof(**p)))
379 return opt && odr_ok(o);
381 z_ReferenceId(o, &(*p)->referenceId, 1) &&
382 odr_implicit(o, odr_bool, &(*p)->continueFlag, ODR_CONTEXT, 44, 0) &&
383 odr_implicit(o, odr_bool, &(*p)->resultSetWanted, ODR_CONTEXT,
386 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
391 /* ------------------------ SEARCH SERVICE ----------------------- */
393 int z_ElementSetName(ODR o, char **p, int opt)
395 return odr_implicit(o, odr_visiblestring, (char**) p, ODR_CONTEXT, 103,
399 int z_DatabaseSpecificUnit(ODR o, Z_DatabaseSpecificUnit **p, int opt)
401 if (!odr_sequence_begin(o, p, sizeof(**p)))
402 return opt && odr_ok(o);
404 z_DatabaseName(o, &(*p)->databaseName, 0) &&
405 z_ElementSetName(o, &(*p)->elementSetName, 0) &&
409 int z_DatabaseSpecific(ODR o, Z_DatabaseSpecific **p, int opt)
411 if (o->direction == ODR_DECODE)
412 *p = odr_malloc(o, sizeof(**p));
416 odr_implicit_settag(o, ODR_CONTEXT, 1);
417 if (odr_sequence_of(o, z_DatabaseSpecificUnit, &(*p)->elements,
418 &(*p)->num_elements))
424 int z_ElementSetNames(ODR o, Z_ElementSetNames **p, int opt)
426 static Odr_arm arm[] =
428 {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_ElementSetNames_generic,
430 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ElementSetNames_databaseSpecific,
435 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 19))
436 return opt && odr_ok(o);
438 if (o->direction == ODR_DECODE)
439 *p = odr_malloc(o, sizeof(**p));
441 if (odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
442 odr_constructed_end(o))
448 /* ----------------------- RPN QUERY -----------------------*/
450 int z_ComplexAttribute(ODR o, Z_ComplexAttribute **p, int opt)
452 if (!odr_sequence_begin(o, p, sizeof(**p)))
453 return opt && odr_ok(o);
455 odr_implicit_settag(o, ODR_CONTEXT, 1) &&
456 odr_sequence_of(o, z_StringOrNumeric, &(*p)->list,
458 odr_implicit_settag(o, ODR_CONTEXT, 2) &&
459 (odr_sequence_of(o, odr_integer, &(*p)->semanticAction,
460 &(*p)->num_semanticAction) || odr_ok(o)) &&
464 int z_AttributeElement(ODR o, Z_AttributeElement **p, int opt)
467 static Odr_arm arm[] =
469 {ODR_IMPLICIT, ODR_CONTEXT, 121, Z_AttributeValue_numeric,
471 {ODR_IMPLICIT, ODR_CONTEXT, 224, Z_AttributeValue_complex,
477 if (!odr_sequence_begin(o, p, sizeof(**p)))
478 return opt && odr_ok(o);
481 odr_implicit(o, odr_oid, &(*p)->attributeSet, ODR_CONTEXT, 1, 1) &&
483 odr_implicit(o, odr_integer, &(*p)->attributeType, ODR_CONTEXT,
486 odr_choice(o, arm, &(*p)->value, &(*p)->which) &&
488 odr_implicit(o, odr_integer, &(*p)->attributeValue, ODR_CONTEXT,
494 int z_Term(ODR o, Z_Term **p, int opt)
496 static Odr_arm arm[] =
498 {ODR_IMPLICIT, ODR_CONTEXT, 45, Z_Term_general, odr_octetstring},
499 {ODR_IMPLICIT, ODR_CONTEXT, 215, Z_Term_numeric, odr_integer},
500 {ODR_IMPLICIT, ODR_CONTEXT, 216, Z_Term_characterString,
502 {ODR_IMPLICIT, ODR_CONTEXT, 217, Z_Term_oid, odr_oid},
503 {ODR_IMPLICIT, ODR_CONTEXT, 218, Z_Term_dateTime, odr_cstring},
504 {ODR_IMPLICIT, ODR_CONTEXT, 219, Z_Term_external, odr_external},
505 /* add intUnit here */
506 {ODR_IMPLICIT, ODR_CONTEXT, 221, Z_Term_null, odr_null},
510 if (o->direction ==ODR_DECODE)
511 *p = odr_malloc(o, sizeof(**p));
514 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
517 return opt && odr_ok(o);
520 int z_AttributesPlusTerm(ODR o, Z_AttributesPlusTerm **p, int opt)
522 if (!(odr_implicit_settag(o, ODR_CONTEXT, 102) &&
523 odr_sequence_begin(o, p, sizeof(**p))))
524 return opt && odr_ok(o);
526 odr_implicit_settag(o, ODR_CONTEXT, 44) &&
527 odr_sequence_of(o, z_AttributeElement, &(*p)->attributeList,
528 &(*p)->num_attributes) &&
529 z_Term(o, &(*p)->term, 0) &&
533 int z_ResultSetPlusAttributes(ODR o, Z_ResultSetPlusAttributes **p, int opt)
535 if (!(odr_implicit_settag(o, ODR_CONTEXT, 214) &&
536 odr_sequence_begin(o, p, sizeof(**p))))
537 return opt && odr_ok(o);
539 z_ResultSetId(o, &(*p)->resultSet, 0) &&
540 odr_implicit_settag(o, ODR_CONTEXT, 44) &&
541 odr_sequence_of(o, z_AttributeElement, &(*p)->attributeList,
542 &(*p)->num_attributes) &&
546 int z_ProximityOperator(ODR o, Z_ProximityOperator **p, int opt)
548 static Odr_arm arm[] =
550 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ProxCode_known, odr_integer},
551 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ProxCode_private, odr_integer},
555 if (!odr_sequence_begin(o, p, sizeof(**p)))
556 return opt && odr_ok(o);
558 odr_implicit(o, odr_bool, &(*p)->exclusion, ODR_CONTEXT, 1, 1) &&
559 odr_implicit(o, odr_integer, &(*p)->distance, ODR_CONTEXT, 2, 0) &&
560 odr_implicit(o, odr_bool, &(*p)->ordered, ODR_CONTEXT, 3, 0) &&
561 odr_implicit(o, odr_integer, &(*p)->relationType, ODR_CONTEXT, 4, 0) &&
562 odr_constructed_begin(o, &(*p)->proximityUnitCode, ODR_CONTEXT, 5) &&
563 odr_choice(o, arm, &(*p)->proximityUnitCode, &(*p)->which) &&
564 odr_constructed_end(o) &&
568 int z_Operator(ODR o, Z_Operator **p, int opt)
570 static Odr_arm arm[] =
572 {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_Operator_and, odr_null},
573 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Operator_or, odr_null},
574 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Operator_and_not, odr_null},
575 {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_Operator_prox, z_ProximityOperator},
579 if (!*p && o->direction != ODR_DECODE)
581 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 46))
582 return opt && odr_ok(o);
583 if (o->direction == ODR_DECODE)
584 *p = odr_malloc(o, sizeof(**p));
586 if (odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
587 odr_constructed_end(o))
590 return opt && odr_ok(o);
593 int z_Operand(ODR o, Z_Operand **p, int opt)
595 static Odr_arm arm[] =
597 {-1, -1, -1, Z_Operand_APT, z_AttributesPlusTerm},
598 {-1, -1, -1, Z_Operand_resultSetId, z_ResultSetId},
599 {-1, -1, -1, Z_Operand_resultAttr, z_ResultSetPlusAttributes},
603 if (o->direction == ODR_DECODE)
604 *p = odr_malloc(o, sizeof(**p));
607 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
610 return opt && odr_ok(o);
613 int z_RPNStructure(ODR o, Z_RPNStructure **p, int opt);
615 int z_Complex(ODR o, Z_Complex **p, int opt)
617 if (!odr_sequence_begin(o, p, sizeof(**p)))
618 return opt && odr_ok(o);
620 z_RPNStructure(o, &(*p)->s1, 0) &&
621 z_RPNStructure(o, &(*p)->s2, 0) &&
622 z_Operator(o, &(*p)->operator, 0) &&
626 int z_RPNStructure(ODR o, Z_RPNStructure **p, int opt)
628 static Odr_arm arm[] =
630 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_RPNStructure_simple, z_Operand},
631 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_RPNStructure_complex, z_Complex},
635 if (o->direction == ODR_DECODE)
636 *p = odr_malloc(o, sizeof(**p));
639 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
642 return opt && odr_ok(o);
645 int z_RPNQuery(ODR o, Z_RPNQuery **p, int opt)
647 if (!odr_sequence_begin(o, p, sizeof(**p)))
648 return opt && odr_ok(o);
650 odr_oid(o, &(*p)->attributeSetId, 0) &&
651 z_RPNStructure(o, &(*p)->RPNStructure, 0) &&
655 /* -----------------------END RPN QUERY ----------------------- */
657 int z_Query(ODR o, Z_Query **p, int opt)
659 static Odr_arm arm[] =
661 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Query_type_1, z_RPNQuery},
662 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_Query_type_2, odr_octetstring},
663 {ODR_EXPLICIT, ODR_CONTEXT, 101, Z_Query_type_101, z_RPNQuery},
667 if (o->direction == ODR_DECODE)
668 *p = odr_malloc(o, sizeof(**p));
671 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
674 return opt && odr_ok(o);
677 int z_SearchRequest(ODR o, Z_SearchRequest **p, int opt)
681 if (!odr_sequence_begin(o, p, sizeof(**p)))
682 return opt && odr_ok(o);
685 z_ReferenceId(o, &pp->referenceId, 1) &&
686 odr_implicit(o, odr_integer, &pp->smallSetUpperBound, ODR_CONTEXT,
688 odr_implicit(o, odr_integer, &pp->largeSetLowerBound, ODR_CONTEXT,
690 odr_implicit(o, odr_integer, &pp->mediumSetPresentNumber, ODR_CONTEXT,
692 odr_implicit(o, odr_bool, &pp->replaceIndicator, ODR_CONTEXT, 16, 1) &&
693 odr_implicit(o, odr_visiblestring, &pp->resultSetName, ODR_CONTEXT,
695 odr_implicit_settag(o, ODR_CONTEXT, 18) &&
696 odr_sequence_of(o, z_DatabaseName, &pp->databaseNames,
697 &pp->num_databaseNames) &&
698 odr_explicit(o, z_ElementSetNames, &pp->smallSetElementSetNames,
699 ODR_CONTEXT, 100, 1) &&
700 odr_explicit(o, z_ElementSetNames, &pp->mediumSetElementSetNames,
701 ODR_CONTEXT, 101, 1) &&
702 odr_implicit(o, odr_oid, &pp->preferredRecordSyntax,
703 ODR_CONTEXT, 104, 1) &&
704 odr_explicit(o, z_Query, &pp->query, ODR_CONTEXT, 21, 0) &&
706 odr_implicit(o, z_OtherInformation, &(*p)->additionalSearchInfo,
707 ODR_CONTEXT, 203, 1) &&
708 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
713 /* ------------------------ RECORD ------------------------- */
715 int z_DatabaseRecord(ODR o, Z_DatabaseRecord **p, int opt)
717 return odr_external(o, (Odr_external **) p, opt);
722 int z_DefaultDiagFormat(ODR o, Z_DefaultDiagFormat **p, int opt)
724 if (!odr_sequence_begin(o, p, sizeof(**p)))
725 return opt && odr_ok(o);
727 odr_oid(o, &(*p)->diagnosticSetId, 1) && /* SHOULD NOT BE OPT! */
728 odr_integer(o, &(*p)->condition, 0) &&
730 * I no longer recall what server tagged the addinfo.. but it isn't
731 * hurting anyone, so...
732 * We need to turn it into a choice, or something, because of
733 * that damn generalstring in v3.
735 (odr_visiblestring(o, &(*p)->addinfo, 0) ||
736 odr_implicit(o, odr_cstring, &(*p)->addinfo, ODR_CONTEXT,
737 ODR_VISIBLESTRING, 1)) &&
741 int z_DiagRec(ODR o, Z_DiagRec **p, int opt)
743 static Odr_arm arm[] =
745 {-1, -1, -1, Z_DiagRec_defaultFormat, z_DefaultDiagFormat},
746 {-1, -1, -1, Z_DiagRec_externallyDefined, odr_external},
750 if (o->direction == ODR_DECODE)
751 *p = odr_malloc(o, sizeof(**p));
754 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
757 return opt && odr_ok(o);
762 int z_DiagRec(ODR o, Z_DiagRec **p, int opt)
764 if (!odr_sequence_begin(o, p, sizeof(**p)))
765 return opt && odr_ok(o);
767 odr_oid(o, &(*p)->diagnosticSetId, 1) && /* SHOULD NOT BE OPT! */
768 odr_integer(o, &(*p)->condition, 0) &&
770 * I no longer recall what server tagged the addinfo.. but it isn't
771 * hurting anyone, so...
772 * We need to turn it into a choice, or something, because of
773 * that damn generalstring in v3.
775 (odr_visiblestring(o, &(*p)->addinfo, 0) ||
776 odr_implicit(o, odr_cstring, &(*p)->addinfo, ODR_CONTEXT,
777 ODR_VISIBLESTRING, 1)) &&
783 int z_NamePlusRecord(ODR o, Z_NamePlusRecord **p, int opt)
785 static Odr_arm arm[] =
787 {ODR_EXPLICIT, ODR_CONTEXT, 1, Z_NamePlusRecord_databaseRecord,
789 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_NamePlusRecord_surrogateDiagnostic,
794 if (!odr_sequence_begin(o, p, sizeof(**p)))
795 return opt && odr_ok(o);
797 odr_implicit(o, z_DatabaseName, &(*p)->databaseName, ODR_CONTEXT,
799 odr_constructed_begin(o, &(*p)->u, ODR_CONTEXT, 1) &&
800 odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
801 odr_constructed_end(o) &&
805 int z_NamePlusRecordList(ODR o, Z_NamePlusRecordList **p, int opt)
807 if (o->direction == ODR_DECODE)
808 *p = odr_malloc(o, sizeof(**p));
811 if (odr_sequence_of(o, z_NamePlusRecord, &(*p)->records,
818 int z_Records(ODR o, Z_Records **p, int opt)
822 {ODR_IMPLICIT, ODR_CONTEXT, 28, Z_Records_DBOSD, z_NamePlusRecordList},
823 {ODR_IMPLICIT, ODR_CONTEXT, 130, Z_Records_NSD, z_DiagRec},
827 if (o->direction == ODR_DECODE)
828 *p = odr_malloc(o, sizeof(**p));
831 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
834 return opt && odr_ok(o);
837 /* ------------------------ ACCESS CTRL SERVICE ----------------------- */
839 int z_AccessControlRequest(ODR o, Z_AccessControlRequest **p, int opt)
841 static Odr_arm arm[] =
843 {ODR_IMPLICIT, ODR_CONTEXT, 37, Z_AccessRequest_simpleForm,
845 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_AccessRequest_externallyDefined,
849 if (!odr_sequence_begin(o, p, sizeof(**p)))
850 return opt && odr_ok(o);
852 z_ReferenceId(o, &(*p)->referenceId, 1) &&
853 odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
855 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
860 int z_AccessControlResponse(ODR o, Z_AccessControlResponse **p, int opt)
862 static Odr_arm arm[] =
864 {ODR_IMPLICIT, ODR_CONTEXT, 38, Z_AccessResponse_simpleForm,
866 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_AccessResponse_externallyDefined,
870 if (!odr_sequence_begin(o, p, sizeof(**p)))
871 return opt && odr_ok(o);
873 z_ReferenceId(o, &(*p)->referenceId, 1) &&
874 odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
875 odr_explicit(o, z_DiagRec, &(*p)->diagnostic, ODR_CONTEXT, 223, 1) &&
877 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
882 /* ------------------------ SCAN SERVICE -------------------- */
884 int z_AttributeList(ODR o, Z_AttributeList **p, int opt)
886 if (o->direction == ODR_DECODE)
887 *p = odr_malloc(o, sizeof(**p));
891 odr_implicit_settag(o, ODR_CONTEXT, 44);
892 if (odr_sequence_of(o, z_AttributeElement, &(*p)->attributes,
893 &(*p)->num_attributes))
896 return opt && odr_ok(o);
900 * This is a temporary hack. We don't know just *what* old version of the
901 * protocol willow uses, so we'll just patiently wait for them to update
903 static int willow_scan = 0;
905 int z_WillowAttributesPlusTerm(ODR o, Z_AttributesPlusTerm **p, int opt)
907 if (!*p && o->direction != ODR_DECODE)
909 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 4))
912 return opt && odr_ok(o);
914 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 1))
916 if (!odr_constructed_begin(o, p, ODR_UNIVERSAL, ODR_SEQUENCE))
918 if (!odr_implicit_settag(o, ODR_CONTEXT, 44))
920 if (o->direction == ODR_DECODE)
921 *p = odr_malloc(o, sizeof(**p));
922 if (!odr_sequence_of(o, z_AttributeElement, &(*p)->attributeList,
923 &(*p)->num_attributes))
925 if (!odr_sequence_end(o) || !odr_sequence_end(o))
927 if (!z_Term(o, &(*p)->term, 0))
929 if (!odr_constructed_end(o))
935 int z_AlternativeTerm(ODR o, Z_AlternativeTerm **p, int opt)
937 if (o->direction == ODR_DECODE)
938 *p = odr_malloc(o, sizeof(**p));
942 return opt && odr_ok(o);
945 if (odr_sequence_of(o, z_AttributesPlusTerm, &(*p)->terms,
949 return opt && !o->error;
952 int z_OccurrenceByAttributes(ODR o, Z_OccurrenceByAttributes **p, int opt)
954 if (!odr_sequence_begin(o, p, sizeof(**p)))
955 return opt && odr_ok(o);
957 odr_explicit(o, z_AttributeList, &(*p)->attributes, ODR_CONTEXT, 1, 1)&&
958 odr_explicit(o, odr_integer, &(*p)->global, ODR_CONTEXT, 2, 1) &&
962 int z_TermInfo(ODR o, Z_TermInfo **p, int opt)
964 if (!odr_sequence_begin(o, p, sizeof(**p)))
965 return opt && odr_ok(o);
968 odr_implicit(o, z_Term, &(*p)->term, ODR_CONTEXT, 1, 0) :
969 z_Term(o, &(*p)->term, 0)) &&
970 z_AttributeList(o, &(*p)->suggestedAttributes, 1) &&
971 odr_implicit(o, z_AlternativeTerm, &(*p)->alternativeTerm,
972 ODR_CONTEXT, 4, 1) &&
973 odr_implicit(o, odr_integer, &(*p)->globalOccurrences, ODR_CONTEXT,
975 odr_implicit(o, z_OccurrenceByAttributes, &(*p)->byAttributes,
976 ODR_CONTEXT, 3, 1) &&
980 int z_Entry(ODR o, Z_Entry **p, int opt)
982 static Odr_arm arm[] =
984 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Entry_termInfo, z_TermInfo},
985 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_Entry_surrogateDiagnostic,
990 if (o->direction == ODR_DECODE)
991 *p = odr_malloc(o, sizeof(**p));
995 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
998 return opt && odr_ok(o);
1001 int z_Entries(ODR o, Z_Entries **p, int opt)
1003 if (o->direction == ODR_DECODE)
1004 *p = odr_malloc(o, sizeof(**p));
1008 if (odr_sequence_of(o, z_Entry, &(*p)->entries,
1009 &(*p)->num_entries))
1015 int z_DiagRecs(ODR o, Z_DiagRecs **p, int opt)
1017 if (o->direction == ODR_DECODE)
1018 *p = odr_malloc(o, sizeof(**p));
1022 if (odr_sequence_of(o, z_DiagRec, &(*p)->diagRecs,
1023 &(*p)->num_diagRecs))
1029 int z_ListEntries(ODR o, Z_ListEntries **p, int opt)
1031 static Odr_arm arm[] =
1033 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ListEntries_entries, z_Entries},
1034 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ListEntries_nonSurrogateDiagnostics,
1039 if (o->direction == ODR_DECODE)
1040 *p = odr_malloc(o, sizeof(**p));
1044 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
1047 return opt && odr_ok(o);
1050 int z_ScanRequest(ODR o, Z_ScanRequest **p, int opt)
1052 if (!odr_sequence_begin(o, p, sizeof(**p)))
1053 return opt && odr_ok(o);
1056 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1057 odr_implicit_settag(o, ODR_CONTEXT, 3) &&
1058 odr_sequence_of(o, z_DatabaseName, &(*p)->databaseNames,
1059 &(*p)->num_databaseNames) &&
1060 odr_oid(o, &(*p)->attributeSet, 1) &&
1061 (z_AttributesPlusTerm(o, &(*p)->termListAndStartPoint, 1) ?
1062 ((*p)->termListAndStartPoint ? 1 :
1063 z_WillowAttributesPlusTerm(o, &(*p)->termListAndStartPoint, 0)) : 0) &&
1064 odr_implicit(o, odr_integer, &(*p)->stepSize, ODR_CONTEXT, 5, 1) &&
1065 odr_implicit(o, odr_integer, &(*p)->numberOfTermsRequested,
1066 ODR_CONTEXT, 6, 0) &&
1067 odr_implicit(o, odr_integer, &(*p)->preferredPositionInResponse,
1068 ODR_CONTEXT, 7, 1) &&
1069 odr_sequence_end(o);
1072 int z_ScanResponse(ODR o, Z_ScanResponse **p, int opt)
1074 if (!odr_sequence_begin(o, p, sizeof(**p)))
1075 return opt && odr_ok(o);
1077 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1078 odr_implicit(o, odr_integer, &(*p)->stepSize, ODR_CONTEXT, 3, 1) &&
1079 odr_implicit(o, odr_integer, &(*p)->scanStatus, ODR_CONTEXT, 4, 0) &&
1080 odr_implicit(o, odr_integer, &(*p)->numberOfEntriesReturned,
1081 ODR_CONTEXT, 5, 0) &&
1082 odr_implicit(o, odr_integer, &(*p)->positionOfTerm, ODR_CONTEXT, 6, 1)&&
1083 odr_explicit(o, z_ListEntries, &(*p)->entries, ODR_CONTEXT, 7, 1) &&
1084 odr_implicit(o, odr_oid, &(*p)->attributeSet, ODR_CONTEXT, 8, 1) &&
1085 odr_sequence_end(o);
1088 /* ------------------------ SEARCHRESPONSE ----------------*/
1090 int z_NumberOfRecordsReturned(ODR o, int **p, int opt)
1092 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 24, opt);
1095 int z_NextResultSetPosition(ODR o, int **p, int opt)
1097 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 25, opt);
1100 int z_PresentStatus(ODR o, int **p, int opt)
1102 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 27, opt);
1105 int z_SearchResponse(ODR o, Z_SearchResponse **p, int opt)
1107 Z_SearchResponse *pp;
1109 if (!odr_sequence_begin(o, p, sizeof(**p)))
1110 return opt && odr_ok(o);
1113 z_ReferenceId(o, &pp->referenceId, 1) &&
1114 odr_implicit(o, odr_integer, &pp->resultCount, ODR_CONTEXT, 23, 0) &&
1115 z_NumberOfRecordsReturned(o, &pp->numberOfRecordsReturned, 0) &&
1116 z_NextResultSetPosition(o, &pp->nextResultSetPosition, 0) &&
1117 odr_implicit(o, odr_bool, &pp->searchStatus, ODR_CONTEXT, 22, 0) &&
1118 odr_implicit(o, odr_integer, &pp->resultSetStatus, ODR_CONTEXT, 26,
1120 z_PresentStatus(o, &pp->presentStatus, 1) &&
1121 z_Records(o, &pp->records, 1) &&
1123 odr_implicit(o, z_OtherInformation, &(*p)->additionalSearchInfo,
1124 ODR_CONTEXT, 203, 1) &&
1125 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1127 odr_sequence_end(o);
1130 /* --------------------- PRESENT SERVICE ---------------------- */
1132 int z_ElementSpec(ODR o, Z_ElementSpec **p, int opt)
1134 static Odr_arm arm[] =
1136 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ElementSpec_elementSetName,
1138 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ElementSpec_externalSpec,
1143 if (o->direction == ODR_DECODE)
1144 *p = odr_malloc(o, sizeof(**p));
1148 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
1151 return opt && odr_ok(o);
1154 int z_Specification(ODR o, Z_Specification **p, int opt)
1156 if (!odr_sequence_begin(o, p, sizeof(**p)))
1157 return opt && odr_ok(o);
1159 odr_implicit(o, odr_oid, &(*p)->schema, ODR_CONTEXT, 1, 1) &&
1160 z_ElementSpec(o, &(*p)->elementSpec, 1) &&
1161 odr_sequence_end(o);
1164 int z_DbSpecific(ODR o, Z_DbSpecific **p, int opt)
1166 if (!odr_sequence_begin(o, p, sizeof(**p)))
1167 return opt && odr_ok(o);
1169 odr_explicit(o, z_DatabaseName, &(*p)->databaseName, ODR_CONTEXT,
1171 odr_implicit(o, z_Specification, &(*p)->spec, ODR_CONTEXT, 2, 0) &&
1172 odr_sequence_end(o);
1175 int z_CompSpec(ODR o, Z_CompSpec **p, int opt)
1177 if (!odr_sequence_begin(o, p, sizeof(**p)))
1178 return opt && odr_ok(o);
1180 odr_implicit(o, odr_bool, &(*p)->selectAlternativeSyntax, ODR_CONTEXT,
1182 odr_implicit(o, z_Specification, &(*p)->generic, ODR_CONTEXT, 2, 1) &&
1183 odr_implicit_settag(o, ODR_CONTEXT, 3) &&
1184 (odr_sequence_of(o, z_DbSpecific, &(*p)->dbSpecific,
1185 &(*p)->num_dbSpecific) || odr_ok(o)) &&
1186 odr_implicit_settag(o, ODR_CONTEXT, 4) &&
1187 (odr_sequence_of(o, odr_oid, &(*p)->recordSyntax,
1188 &(*p)->num_recordSyntax) || odr_ok(o)) &&
1189 odr_sequence_end(o);
1192 int z_RecordComposition(ODR o, Z_RecordComposition **p, int opt)
1194 static Odr_arm arm[] =
1196 {ODR_EXPLICIT, ODR_CONTEXT, 1, Z_RecordComp_simple,
1198 {ODR_IMPLICIT, ODR_CONTEXT, 209, Z_RecordComp_complex,
1203 if (o->direction == ODR_DECODE)
1204 *p = odr_malloc(o, sizeof(**p));
1208 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
1211 return opt && odr_ok(o);
1214 int z_Range(ODR o, Z_Range **p, int opt)
1216 if (!odr_sequence_begin(o, p, sizeof(**p)))
1217 return opt && odr_ok(o);
1219 odr_implicit(o, odr_integer, &(*p)->startingPosition, ODR_CONTEXT,
1221 odr_implicit(o, odr_integer, &(*p)->numberOfRecords, ODR_CONTEXT,
1223 odr_sequence_end(o);
1226 int z_PresentRequest(ODR o, Z_PresentRequest **p, int opt)
1228 Z_PresentRequest *pp;
1230 if (!odr_sequence_begin(o, p, sizeof(**p)))
1231 return opt && odr_ok(o);
1234 z_ReferenceId(o, &pp->referenceId, 1) &&
1235 z_ResultSetId(o, &pp->resultSetId, 0) &&
1236 odr_implicit(o, odr_integer, &pp->resultSetStartPoint, ODR_CONTEXT,
1238 odr_implicit(o, odr_integer, &pp->numberOfRecordsRequested, ODR_CONTEXT,
1241 odr_implicit_settag(o, ODR_CONTEXT, 212) &&
1242 (odr_sequence_of(o, z_Range, &(*p)->additionalRanges,
1243 &(*p)->num_ranges) || odr_ok(o)) &&
1244 z_RecordComposition(o, &(*p)->recordComposition, 1) &&
1246 z_ElementSetNames(o, &pp->elementSetNames, 1) &&
1248 odr_implicit(o, odr_oid, &(*p)->preferredRecordSyntax, ODR_CONTEXT,
1251 odr_implicit(o, odr_integer, &(*p)->maxSegmentCount, ODR_CONTEXT,
1253 odr_implicit(o, odr_integer, &(*p)->maxRecordSize, ODR_CONTEXT,
1255 odr_implicit(o, odr_integer, &(*p)->maxSegmentSize, ODR_CONTEXT,
1257 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1259 odr_sequence_end(o);
1262 int z_PresentResponse(ODR o, Z_PresentResponse **p, int opt)
1264 Z_PresentResponse *pp;
1266 if (!odr_sequence_begin(o, p, sizeof(**p)))
1267 return opt && odr_ok(o);
1270 z_ReferenceId(o, &pp->referenceId, 1) &&
1271 z_NumberOfRecordsReturned(o, &pp->numberOfRecordsReturned, 0) &&
1272 z_NextResultSetPosition(o, &pp->nextResultSetPosition, 0) &&
1273 z_PresentStatus(o, &pp->presentStatus, 0) &&
1274 z_Records(o, &pp->records, 1) &&
1276 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1278 odr_sequence_end(o);
1281 /* ----------------------DELETE -------------------------- */
1283 int z_DeleteSetStatus(ODR o, int **p, int opt)
1285 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 33, opt);
1288 int z_ListStatus(ODR o, Z_ListStatus **p, int opt)
1290 if (!odr_sequence_begin(o, p, sizeof(**p)))
1291 return opt && odr_ok(o);
1293 z_ResultSetId(o, &(*p)->id, 0) &&
1294 z_DeleteSetStatus(o, &(*p)->status, 0) &&
1295 odr_sequence_end(o);
1298 int z_DeleteResultSetRequest(ODR o, Z_DeleteResultSetRequest **p, int opt)
1300 if (!odr_sequence_begin(o, p, sizeof(**p)))
1301 return opt && odr_ok(o);
1303 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1304 odr_implicit(o, odr_integer, &(*p)->deleteFunction, ODR_CONTEXT, 32,
1306 (odr_sequence_of(o, z_ListStatus, &(*p)->resultSetList,
1307 &(*p)->num_ids) || odr_ok(o)) &&
1309 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1311 odr_sequence_end(o);
1314 int z_DeleteResultSetResponse(ODR o, Z_DeleteResultSetResponse **p, int opt)
1316 if (!odr_sequence_begin(o, p, sizeof(**p)))
1317 return opt && odr_ok(o);
1319 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1320 odr_implicit(o, z_DeleteSetStatus, &(*p)->deleteOperationStatus,
1321 ODR_CONTEXT, 0, 1) &&
1322 odr_implicit_settag(o, ODR_CONTEXT, 1) &&
1323 (odr_sequence_of(o, z_ListStatus, &(*p)->deleteListStatuses,
1324 &(*p)->num_statuses) || odr_ok(o)) &&
1325 odr_implicit(o, odr_integer, &(*p)->numberNotDeleted, ODR_CONTEXT,
1327 odr_implicit_settag(o, ODR_CONTEXT, 35) &&
1328 (odr_sequence_of(o, z_ListStatus, &(*p)->bulkStatuses,
1329 &(*p)->num_bulkStatuses) || odr_ok(o)) &&
1330 odr_implicit(o, odr_visiblestring, &(*p)->deleteMessage, ODR_CONTEXT,
1333 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1335 odr_sequence_end(o);
1338 /* ------------------------ SEGMENT SERVICE -------------- */
1340 int z_Segment(ODR o, Z_Segment **p, int opt)
1342 if (!odr_sequence_begin(o, p, sizeof(**p)))
1343 return opt && odr_ok(o);
1345 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1346 odr_implicit(o, odr_integer, &(*p)->numberOfRecordsReturned,
1347 ODR_CONTEXT, 24, 0) &&
1348 odr_implicit_settag(o, ODR_CONTEXT, 0) &&
1349 odr_sequence_of(o, z_NamePlusRecord, &(*p)->segmentRecords,
1350 &(*p)->num_segmentRecords) &&
1351 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1352 odr_sequence_end(o);
1355 /* ------------------------ CLOSE SERVICE ---------------- */
1357 int z_Close(ODR o, Z_Close **p, int opt)
1359 if (!odr_sequence_begin(o, p, sizeof(**p)))
1360 return opt && odr_ok(o);
1362 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1363 odr_implicit(o, odr_integer, &(*p)->closeReason, ODR_CONTEXT, 211, 0) &&
1364 odr_implicit(o, odr_visiblestring, &(*p)->diagnosticInformation,
1365 ODR_CONTEXT, 3, 1) &&
1366 odr_implicit(o, odr_oid, &(*p)->resourceReportFormat, ODR_CONTEXT,
1368 odr_implicit(o, odr_external, &(*p)->resourceReport, ODR_CONTEXT,
1371 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1373 odr_sequence_end(o);
1376 /* ------------------------ APDU ------------------------- */
1378 int z_APDU(ODR o, Z_APDU **p, int opt)
1380 static Odr_arm arm[] =
1382 {ODR_IMPLICIT, ODR_CONTEXT, 20, Z_APDU_initRequest, z_InitRequest},
1383 {ODR_IMPLICIT, ODR_CONTEXT, 21, Z_APDU_initResponse, z_InitResponse},
1384 {ODR_IMPLICIT, ODR_CONTEXT, 22, Z_APDU_searchRequest, z_SearchRequest},
1385 {ODR_IMPLICIT, ODR_CONTEXT, 23, Z_APDU_searchResponse,
1387 {ODR_IMPLICIT, ODR_CONTEXT, 24, Z_APDU_presentRequest,
1389 {ODR_IMPLICIT, ODR_CONTEXT, 25, Z_APDU_presentResponse,
1391 {ODR_IMPLICIT, ODR_CONTEXT, 26, Z_APDU_deleteResultSetRequest,
1392 z_DeleteResultSetRequest},
1393 {ODR_IMPLICIT, ODR_CONTEXT, 27, Z_APDU_deleteResultSetResponse,
1394 z_DeleteResultSetResponse},
1395 {ODR_IMPLICIT, ODR_CONTEXT, 30, Z_APDU_resourceControlRequest,
1396 z_ResourceControlRequest},
1397 {ODR_IMPLICIT, ODR_CONTEXT, 31, Z_APDU_resourceControlResponse,
1398 z_ResourceControlResponse},
1399 {ODR_IMPLICIT, ODR_CONTEXT, 32, Z_APDU_triggerResourceControlRequest,
1400 z_TriggerResourceControlRequest},
1401 {ODR_IMPLICIT, ODR_CONTEXT, 35, Z_APDU_scanRequest, z_ScanRequest},
1402 {ODR_IMPLICIT, ODR_CONTEXT, 36, Z_APDU_scanResponse, z_ScanResponse},
1403 {ODR_IMPLICIT, ODR_CONTEXT, 45, Z_APDU_segmentRequest, z_Segment},
1404 {ODR_IMPLICIT, ODR_CONTEXT, 48, Z_APDU_close, z_Close},
1409 if (o->direction == ODR_DECODE)
1410 *p = odr_malloc(o, sizeof(**p));
1411 if (!odr_choice(o, arm, &(*p)->u, &(*p)->which))
1413 if (o->direction == ODR_DECODE)
1415 return opt && odr_ok(o);