2 * Copyright (C) 1994, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.18 1995-04-11 11:52:02 quinn
8 * Fixed possible buf in proto.c
10 * Revision 1.17 1995/04/10 10:22:22 quinn
13 * Revision 1.16 1995/03/30 10:26:43 quinn
14 * Added Term structure
16 * Revision 1.15 1995/03/30 09:08:39 quinn
17 * Added Resource control protocol
19 * Revision 1.14 1995/03/29 08:06:13 quinn
20 * Added a few v3 elements
22 * Revision 1.13 1995/03/20 11:26:52 quinn
23 * *** empty log message ***
25 * Revision 1.12 1995/03/20 09:45:09 quinn
28 * Revision 1.11 1995/03/17 10:17:25 quinn
29 * Added memory management.
31 * Revision 1.10 1995/03/15 11:17:40 quinn
32 * Fixed some return-checks from choice.. need better ay to handle those..
34 * Revision 1.9 1995/03/15 08:37:06 quinn
35 * Fixed protocol bugs.
37 * Revision 1.8 1995/03/14 16:59:24 quinn
38 * Fixed OPTIONAL flag in attributeelement
40 * Revision 1.7 1995/03/07 16:29:33 quinn
41 * Added authentication stuff.
43 * Revision 1.6 1995/03/01 14:46:03 quinn
44 * Fixed protocol bug in 8777query.
46 * Revision 1.5 1995/02/14 11:54:22 quinn
49 * Revision 1.4 1995/02/10 15:54:30 quinn
52 * Revision 1.3 1995/02/09 15:51:39 quinn
55 * Revision 1.2 1995/02/06 21:26:07 quinn
56 * Repaired this evening's damages..
58 * Revision 1.1 1995/02/06 16:44:47 quinn
59 * First hack at Z/SR protocol
67 /* ---------------------- GLOBAL DEFS ------------------- */
69 int z_ReferenceId(ODR o, Z_ReferenceId **p, int opt)
71 return odr_implicit(o, odr_octetstring, (Odr_oct**) p, ODR_CONTEXT, 2, opt);
74 int z_DatabaseName(ODR o, Z_DatabaseName **p, int opt)
76 return odr_implicit(o, odr_visiblestring, (char **) p, ODR_CONTEXT, 105,
80 int z_ResultSetId(ODR o, char **p, int opt)
82 return odr_implicit(o, odr_visiblestring, (char **) p, ODR_CONTEXT, 31,
86 int z_UserInformationField(ODR o, Z_UserInformationField **p, int opt)
88 return odr_explicit(o, odr_external, (Odr_external **)p, ODR_CONTEXT,
92 /* ---------------------- INITIALIZE SERVICE ------------------- */
94 int z_NSRAuthentication(ODR o, Z_NSRAuthentication **p, int opt)
96 if (!odr_sequence_begin(o, p, sizeof(**p)))
99 odr_visiblestring(o, &(*p)->user, 0) &&
100 odr_visiblestring(o, &(*p)->password, 0) &&
101 odr_visiblestring(o, &(*p)->account, 0) &&
105 int z_IdPass(ODR o, Z_IdPass **p, int opt)
107 if (!odr_sequence_begin(o, p, sizeof(**p)))
110 odr_implicit(o, odr_visiblestring, &(*p)->groupId, ODR_CONTEXT, 0, 0) &&
111 odr_implicit(o, odr_visiblestring, &(*p)->userId, ODR_CONTEXT, 1, 0) &&
112 odr_implicit(o, odr_visiblestring, &(*p)->password, ODR_CONTEXT, 2,
117 int z_StrAuthentication(ODR o, char **p, int opt)
119 return odr_visiblestring(o, p, opt);
122 int z_IdAuthentication(ODR o, Z_IdAuthentication **p, int opt)
124 static Odr_arm arm[] =
126 {-1, -1, -1, Z_IdAuthentication_open, z_StrAuthentication},
127 {-1, -1, -1, Z_IdAuthentication_idPass, z_NSRAuthentication},
128 {-1, -1, -1, Z_IdAuthentication_anonymous, odr_null},
129 {-1, -1, -1, Z_IdAuthentication_other, odr_external},
133 if (o->direction == ODR_DECODE)
134 *p = odr_malloc(o, sizeof(**p));
136 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
139 return opt && !o->error;
142 int z_InitRequest(ODR o, Z_InitRequest **p, int opt)
146 if (!odr_sequence_begin(o, p, sizeof(**p)))
150 z_ReferenceId(o, &pp->referenceId, 1) &&
151 odr_implicit(o, odr_bitstring, &pp->protocolVersion, ODR_CONTEXT,
153 odr_implicit(o, odr_bitstring, &pp->options, ODR_CONTEXT, 4, 0) &&
154 odr_implicit(o, odr_integer, &pp->preferredMessageSize, ODR_CONTEXT,
156 odr_implicit(o, odr_integer, &pp->maximumRecordSize, ODR_CONTEXT,
158 odr_explicit(o, z_IdAuthentication, &pp->idAuthentication, ODR_CONTEXT,
160 odr_implicit(o, odr_visiblestring, &pp->implementationId, ODR_CONTEXT,
162 odr_implicit(o, odr_visiblestring, &pp->implementationName, ODR_CONTEXT,
164 odr_implicit(o, odr_visiblestring, &pp->implementationVersion,
165 ODR_CONTEXT, 112, 1) &&
166 z_UserInformationField(o, &pp->userInformationField, 1) &&
170 int z_InitResponse(ODR o, Z_InitResponse **p, int opt)
174 if (!odr_sequence_begin(o, p, sizeof(**p)))
178 z_ReferenceId(o, &pp->referenceId, 1) &&
179 odr_implicit(o, odr_bitstring, &pp->protocolVersion, ODR_CONTEXT,
181 odr_implicit(o, odr_bitstring, &pp->options, ODR_CONTEXT, 4, 0) &&
182 odr_implicit(o, odr_integer, &pp->preferredMessageSize, ODR_CONTEXT,
184 odr_implicit(o, odr_integer, &pp->maximumRecordSize, ODR_CONTEXT,
186 odr_implicit(o, odr_bool, &pp->result, ODR_CONTEXT, 12, 0) &&
187 odr_implicit(o, odr_visiblestring, &pp->implementationId, ODR_CONTEXT,
189 odr_implicit(o, odr_visiblestring, &pp->implementationName, ODR_CONTEXT,
191 odr_implicit(o, odr_visiblestring, &pp->implementationVersion,
192 ODR_CONTEXT, 112, 1) &&
193 z_UserInformationField(o, &pp->userInformationField, 1) &&
197 /* ------------------ RESOURCE CONTROL ----------------*/
199 int z_TriggerResourceControlRequest(ODR o, Z_TriggerResourceControlRequest **p,
202 if (!odr_sequence_begin(o, p, sizeof(**p)))
205 z_ReferenceId(o, &(*p)->referenceId, 1) &&
206 odr_implicit(o, odr_integer, &(*p)->requestedAction, ODR_CONTEXT,
208 odr_implicit(o, odr_oid, &(*p)->prefResourceReportFormat,
209 ODR_CONTEXT, 47, 1) &&
210 odr_implicit(o, odr_bool, &(*p)->resultSetWanted, ODR_CONTEXT,
215 int z_ResourceControlRequest(ODR o, Z_ResourceControlRequest **p, int opt)
217 if (!odr_sequence_begin(o, p, sizeof(**p)))
220 z_ReferenceId(o, &(*p)->referenceId, 1) &&
221 odr_implicit(o, odr_bool, &(*p)->suspendedFlag, ODR_CONTEXT, 39, 1)&&
222 odr_explicit(o, odr_external, &(*p)->resourceReport, ODR_CONTEXT,
224 odr_implicit(o, odr_integer, &(*p)->partialResultsAvailable,
225 ODR_CONTEXT, 41, 1) &&
226 odr_implicit(o, odr_bool, &(*p)->responseRequired, ODR_CONTEXT,
228 odr_implicit(o, odr_bool, &(*p)->triggeredRequestFlag,
229 ODR_CONTEXT, 43, 1) &&
233 int z_ResourceControlResponse(ODR o, Z_ResourceControlResponse **p, int opt)
235 if (!odr_sequence_begin(o, p, sizeof(**p)))
238 z_ReferenceId(o, &(*p)->referenceId, 1) &&
239 odr_implicit(o, odr_bool, &(*p)->continueFlag, ODR_CONTEXT, 44, 0) &&
240 odr_implicit(o, odr_bool, &(*p)->resultSetWanted, ODR_CONTEXT,
245 /* ------------------------ SEARCH SERVICE ----------------------- */
247 int z_ElementSetName(ODR o, char **p, int opt)
249 return odr_implicit(o, odr_visiblestring, (char**) p, ODR_CONTEXT, 103,
253 int z_PreferredRecordSyntax(ODR o, Z_PreferredRecordSyntax **p, int opt)
255 return odr_implicit(o, odr_oid, (Odr_oid**) p, ODR_CONTEXT, 104, opt);
258 int z_DatabaseSpecificUnit(ODR o, Z_DatabaseSpecificUnit **p, int opt)
260 if (!odr_sequence_begin(o, p, sizeof(**p)))
263 z_DatabaseName(o, &(*p)->databaseName, 0) &&
264 z_ElementSetName(o, &(*p)->elementSetName, 0) &&
268 int z_DatabaseSpecific(ODR o, Z_DatabaseSpecific **p, int opt)
270 if (o->direction == ODR_DECODE)
271 *p = odr_malloc(o, sizeof(**p));
275 odr_implicit_settag(o, ODR_CONTEXT, 1);
276 if (odr_sequence_of(o, z_DatabaseSpecificUnit, &(*p)->elements,
277 &(*p)->num_elements))
283 int z_ElementSetNames(ODR o, Z_ElementSetNames **p, int opt)
285 static Odr_arm arm[] =
287 {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_ElementSetNames_generic,
289 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ElementSetNames_databaseSpecific,
294 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 19))
297 if (o->direction == ODR_DECODE)
298 *p = odr_malloc(o, sizeof(**p));
300 if (odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
301 odr_constructed_end(o))
307 /* ----------------------- RPN QUERY -----------------------*/
309 int z_AttributeElement(ODR o, Z_AttributeElement **p, int opt)
311 if (!odr_sequence_begin(o, p, sizeof(**p)))
314 odr_implicit(o, odr_integer, &(*p)->attributeType, ODR_CONTEXT,
316 odr_implicit(o, odr_integer, &(*p)->attributeValue, ODR_CONTEXT,
323 int z_Term(ODR o, Z_Term **p, int opt)
325 static Odr_arm arm[] =
327 {ODR_IMPLICIT, ODR_CONTEXT, 45, Z_Term_general, odr_octetstring},
328 {ODR_IMPLICIT, ODR_CONTEXT, 215, Z_Term_numeric, odr_integer},
329 {ODR_IMPLICIT, ODR_CONTEXT, 216, Z_Term_characterString,
331 {ODR_IMPLICIT, ODR_CONTEXT, 217, Z_Term_oid, odr_oid},
332 {ODR_IMPLICIT, ODR_CONTEXT, 218, Z_Term_dateTime, odr_cstring},
333 {ODR_IMPLICIT, ODR_CONTEXT, 219, Z_Term_external, odr_external},
334 /* add intUnit here */
335 {ODR_IMPLICIT, ODR_CONTEXT, 221, Z_Term_null, odr_null},
339 if (o->direction ==ODR_DECODE)
340 *p = odr_malloc(o, sizeof(**p));
343 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
346 return opt && !o->error;
351 int z_AttributesPlusTerm(ODR o, Z_AttributesPlusTerm **p, int opt)
353 if (!(odr_implicit_settag(o, ODR_CONTEXT, 102) &&
354 odr_sequence_begin(o, p, sizeof(**p))))
357 odr_implicit_settag(o, ODR_CONTEXT, 44) &&
358 odr_sequence_of(o, z_AttributeElement, &(*p)->attributeList,
359 &(*p)->num_attributes) &&
361 z_Term(o, &(*p)->term, 0) &&
363 odr_implicit(o, odr_octetstring, &(*p)->term, ODR_CONTEXT, 45, 0) &&
368 int z_Operator(ODR o, Z_Operator **p, int opt)
370 static Odr_arm arm[] =
372 {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_Operator_and, odr_null},
373 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Operator_or, odr_null},
374 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Operator_and_not, odr_null},
379 if (!*p && o->direction != ODR_DECODE)
381 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 46))
383 if (o->direction == ODR_DECODE)
384 *p = odr_malloc(o, sizeof(**p));
386 (*p)->u.and = &dummy;
388 if (odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
389 odr_constructed_end(o))
392 return opt && !o->error;
395 int z_Operand(ODR o, Z_Operand **p, int opt)
397 static Odr_arm arm[] =
399 {-1, -1, -1, Z_Operand_APT, z_AttributesPlusTerm},
400 {-1, -1, -1, Z_Operand_resultSetId, z_ResultSetId},
404 if (o->direction ==ODR_DECODE)
405 *p = odr_malloc(o, sizeof(**p));
408 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
411 return opt && !o->error;
414 int z_RPNStructure(ODR o, Z_RPNStructure **p, int opt);
416 int z_Complex(ODR o, Z_Complex **p, int opt)
418 if (!odr_sequence_begin(o, p, sizeof(**p)))
421 z_RPNStructure(o, &(*p)->s1, 0) &&
422 z_RPNStructure(o, &(*p)->s2, 0) &&
423 z_Operator(o, &(*p)->operator, 0) &&
427 int z_RPNStructure(ODR o, Z_RPNStructure **p, int opt)
429 static Odr_arm arm[] =
431 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_RPNStructure_simple, z_Operand},
432 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_RPNStructure_complex, z_Complex},
436 if (o->direction == ODR_DECODE)
437 *p = odr_malloc(o, sizeof(**p));
440 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
443 return opt && !o->error;
446 int z_RPNQuery(ODR o, Z_RPNQuery **p, int opt)
448 if (!odr_sequence_begin(o, p, sizeof(**p)))
451 odr_oid(o, &(*p)->attributeSetId, 0) &&
452 z_RPNStructure(o, &(*p)->RPNStructure, 0) &&
456 /* -----------------------END RPN QUERY ----------------------- */
458 int z_Query(ODR o, Z_Query **p, int opt)
460 static Odr_arm arm[] =
462 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Query_type_1, z_RPNQuery},
463 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_Query_type_2, odr_octetstring},
467 if (o->direction == ODR_DECODE)
468 *p = odr_malloc(o, sizeof(**p));
471 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
474 return opt && !o->error;
477 int z_SearchRequest(ODR o, Z_SearchRequest **p, int opt)
481 if (!odr_sequence_begin(o, p, sizeof(**p)))
485 z_ReferenceId(o, &pp->referenceId, 1) &&
486 odr_implicit(o, odr_integer, &pp->smallSetUpperBound, ODR_CONTEXT,
488 odr_implicit(o, odr_integer, &pp->largeSetLowerBound, ODR_CONTEXT,
490 odr_implicit(o, odr_integer, &pp->mediumSetPresentNumber, ODR_CONTEXT,
492 odr_implicit(o, odr_bool, &pp->replaceIndicator, ODR_CONTEXT, 16, 1) &&
493 odr_implicit(o, odr_visiblestring, &pp->resultSetName, ODR_CONTEXT,
495 odr_implicit_settag(o, ODR_CONTEXT, 18) &&
496 odr_sequence_of(o, z_DatabaseName, &pp->databaseNames,
497 &pp->num_databaseNames) &&
498 odr_explicit(o, z_ElementSetNames, &pp->smallSetElementSetNames,
499 ODR_CONTEXT, 100, 1) &&
500 odr_explicit(o, z_ElementSetNames, &pp->mediumSetElementSetNames,
501 ODR_CONTEXT, 101, 1) &&
502 z_PreferredRecordSyntax(o, &pp->preferredRecordSyntax, 1) &&
503 odr_explicit(o, z_Query, &pp->query, ODR_CONTEXT, 21, 0) &&
507 /* ------------------------ RECORD ------------------------- */
509 int z_DatabaseRecord(ODR o, Z_DatabaseRecord **p, int opt)
511 return odr_external(o, (Odr_external **) p, opt);
514 int z_DiagRec(ODR o, Z_DiagRec **p, int opt)
516 if (!odr_sequence_begin(o, p, sizeof(**p)))
519 odr_oid(o, &(*p)->diagnosticSetId, 1) && /* SHOULD NOT BE OPT */
520 odr_integer(o, &(*p)->condition, 0) &&
521 (odr_visiblestring(o, &(*p)->addinfo, 0) ||
522 odr_implicit(o, odr_cstring, &(*p)->addinfo, ODR_CONTEXT, ODR_VISIBLESTRING, 1)) &&
526 int z_NamePlusRecord(ODR o, Z_NamePlusRecord **p, int opt)
528 static Odr_arm arm[] =
530 {ODR_EXPLICIT, ODR_CONTEXT, 1, Z_NamePlusRecord_databaseRecord,
532 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_NamePlusRecord_surrogateDiagnostic,
537 if (!odr_sequence_begin(o, p, sizeof(**p)))
540 odr_implicit(o, z_DatabaseName, &(*p)->databaseName, ODR_CONTEXT,
542 odr_constructed_begin(o, &(*p)->u, ODR_CONTEXT, 1) &&
543 odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
544 odr_constructed_end(o) &&
548 int z_NamePlusRecordList(ODR o, Z_NamePlusRecordList **p, int opt)
550 if (o->direction == ODR_DECODE)
551 *p = odr_malloc(o, sizeof(**p));
552 if (odr_sequence_of(o, z_NamePlusRecord, &(*p)->records,
559 int z_Records(ODR o, Z_Records **p, int opt)
563 {ODR_IMPLICIT, ODR_CONTEXT, 28, Z_Records_DBOSD, z_NamePlusRecordList},
564 {ODR_IMPLICIT, ODR_CONTEXT, 130, Z_Records_NSD, z_DiagRec},
568 if (o->direction == ODR_DECODE)
569 *p = odr_malloc(o, sizeof(**p));
572 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
575 return opt && !o->error;
578 /* ------------------------ SCAN SERVICE -------------------- */
580 int z_AttributeList(ODR o, Z_AttributeList **p, int opt)
582 if (o->direction == ODR_DECODE)
583 *p = odr_malloc(o, sizeof(**p));
587 odr_implicit_settag(o, ODR_CONTEXT, 44);
588 if (odr_sequence_of(o, z_AttributeElement, &(*p)->attributes,
589 &(*p)->num_attributes))
596 * This is a temporary hack. We don't know just *what* old version of the
597 * protocol willow uses, so we'll just patiently wait for them to update
599 static int willow_scan = 0;
601 int z_WillowAttributesPlusTerm(ODR o, Z_AttributesPlusTerm **p, int opt)
603 if (!*p && o->direction != ODR_DECODE)
605 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 4))
610 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 1))
612 if (!odr_constructed_begin(o, p, ODR_UNIVERSAL, ODR_SEQUENCE))
614 if (!odr_implicit_settag(o, ODR_CONTEXT, 44))
616 if (o->direction == ODR_DECODE)
617 *p = odr_malloc(o, sizeof(**p));
618 if (!odr_sequence_of(o, z_AttributeElement, &(*p)->attributeList,
619 &(*p)->num_attributes))
621 if (!odr_sequence_end(o) || !odr_sequence_end(o))
623 if (!z_Term(o, &(*p)->term, 0))
625 if (!odr_constructed_end(o))
631 int z_AlternativeTerm(ODR o, Z_AlternativeTerm **p, int opt)
633 if (o->direction == ODR_DECODE)
634 *p = odr_malloc(o, sizeof(**p));
641 if (odr_sequence_of(o, z_AttributesPlusTerm, &(*p)->terms,
645 return opt && !o->error;
648 int z_OccurrenceByAttributes(ODR o, Z_OccurrenceByAttributes **p, int opt)
650 if (!odr_sequence_begin(o, p, sizeof(**p)))
653 odr_explicit(o, z_AttributeList, &(*p)->attributes, ODR_CONTEXT, 1, 1)&&
654 odr_explicit(o, odr_integer, &(*p)->global, ODR_CONTEXT, 2, 1) &&
658 int z_TermInfo(ODR o, Z_TermInfo **p, int opt)
660 if (!odr_sequence_begin(o, p, sizeof(**p)))
664 odr_implicit(o, z_Term, &(*p)->term, ODR_CONTEXT, 1, 0) :
665 z_Term(o, &(*p)->term, 0)) &&
666 z_AttributeList(o, &(*p)->suggestedAttributes, 1) &&
667 odr_implicit(o, z_AlternativeTerm, &(*p)->alternativeTerm,
668 ODR_CONTEXT, 4, 1) &&
669 odr_implicit(o, odr_integer, &(*p)->globalOccurrences, ODR_CONTEXT,
671 odr_implicit(o, z_OccurrenceByAttributes, &(*p)->byAttributes,
672 ODR_CONTEXT, 3, 1) &&
676 int z_Entry(ODR o, Z_Entry **p, int opt)
678 static Odr_arm arm[] =
680 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Entry_termInfo, z_TermInfo},
681 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_Entry_surrogateDiagnostic,
686 if (o->direction == ODR_DECODE)
687 *p = odr_malloc(o, sizeof(**p));
689 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
692 return opt && !o->error;
695 int z_Entries(ODR o, Z_Entries **p, int opt)
697 if (o->direction == ODR_DECODE)
698 *p = odr_malloc(o, sizeof(**p));
702 if (odr_sequence_of(o, z_Entry, &(*p)->entries,
709 int z_DiagRecs(ODR o, Z_DiagRecs **p, int opt)
711 if (o->direction == ODR_DECODE)
712 *p = odr_malloc(o, sizeof(**p));
716 if (odr_sequence_of(o, z_DiagRec, &(*p)->diagRecs,
717 &(*p)->num_diagRecs))
723 int z_ListEntries(ODR o, Z_ListEntries **p, int opt)
725 static Odr_arm arm[] =
727 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ListEntries_entries, z_Entries},
728 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ListEntries_nonSurrogateDiagnostics,
733 if (o->direction == ODR_DECODE)
734 *p = odr_malloc(o, sizeof(**p));
736 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
739 return opt && !o->error;
742 int z_ScanRequest(ODR o, Z_ScanRequest **p, int opt)
744 if (!odr_sequence_begin(o, p, sizeof(**p)))
748 z_ReferenceId(o, &(*p)->referenceId, 1) &&
749 odr_implicit_settag(o, ODR_CONTEXT, 3) &&
750 odr_sequence_of(o, z_DatabaseName, &(*p)->databaseNames,
751 &(*p)->num_databaseNames) &&
752 odr_oid(o, &(*p)->attributeSet, 1) &&
753 (z_AttributesPlusTerm(o, &(*p)->termListAndStartPoint, 1) ?
754 ((*p)->termListAndStartPoint ? 1 :
755 z_WillowAttributesPlusTerm(o, &(*p)->termListAndStartPoint, 0)) : 0) &&
756 odr_implicit(o, odr_integer, &(*p)->stepSize, ODR_CONTEXT, 5, 1) &&
757 odr_implicit(o, odr_integer, &(*p)->numberOfTermsRequested,
758 ODR_CONTEXT, 6, 0) &&
759 odr_implicit(o, odr_integer, &(*p)->preferredPositionInResponse,
760 ODR_CONTEXT, 7, 1) &&
764 int z_ScanResponse(ODR o, Z_ScanResponse **p, int opt)
766 if (!odr_sequence_begin(o, p, sizeof(**p)))
769 z_ReferenceId(o, &(*p)->referenceId, 1) &&
770 odr_implicit(o, odr_integer, &(*p)->stepSize, ODR_CONTEXT, 3, 1) &&
771 odr_implicit(o, odr_integer, &(*p)->scanStatus, ODR_CONTEXT, 4, 0) &&
772 odr_implicit(o, odr_integer, &(*p)->numberOfEntriesReturned,
773 ODR_CONTEXT, 5, 0) &&
774 odr_implicit(o, odr_integer, &(*p)->positionOfTerm, ODR_CONTEXT, 6, 1)&&
775 odr_explicit(o, z_ListEntries, &(*p)->entries, ODR_CONTEXT, 7, 1) &&
776 odr_implicit(o, odr_oid, &(*p)->attributeSet, ODR_CONTEXT, 8, 1) &&
780 /* ------------------------ SEARCHRESPONSE ----------------*/
782 int z_NumberOfRecordsReturned(ODR o, int **p, int opt)
784 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 24, opt);
787 int z_NextResultSetPosition(ODR o, int **p, int opt)
789 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 25, opt);
792 int z_PresentStatus(ODR o, int **p, int opt)
794 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 27, opt);
797 int z_SearchResponse(ODR o, Z_SearchResponse **p, int opt)
799 Z_SearchResponse *pp;
801 if (!odr_sequence_begin(o, p, sizeof(**p)))
805 z_ReferenceId(o, &pp->referenceId, 1) &&
806 odr_implicit(o, odr_integer, &pp->resultCount, ODR_CONTEXT, 23, 0) &&
807 z_NumberOfRecordsReturned(o, &pp->numberOfRecordsReturned, 0) &&
808 z_NextResultSetPosition(o, &pp->nextResultSetPosition, 0) &&
809 odr_implicit(o, odr_bool, &pp->searchStatus, ODR_CONTEXT, 22, 0) &&
810 odr_implicit(o, odr_integer, &pp->resultSetStatus, ODR_CONTEXT, 26, 1) &&
811 z_PresentStatus(o, &pp->presentStatus, 1) &&
812 z_Records(o, &pp->records, 1) &&
816 /* --------------------- PRESENT SERVICE ---------------------- */
818 int z_PresentRequest(ODR o, Z_PresentRequest **p, int opt)
820 Z_PresentRequest *pp;
822 if (!odr_sequence_begin(o, p, sizeof(**p)))
826 z_ReferenceId(o, &pp->referenceId, 1) &&
827 z_ResultSetId(o, &pp->resultSetId, 0) &&
828 odr_implicit(o, odr_integer, &pp->resultSetStartPoint, ODR_CONTEXT,
830 odr_implicit(o, odr_integer, &pp->numberOfRecordsRequested, ODR_CONTEXT,
832 z_ElementSetNames(o, &pp->elementSetNames, 1) &&
833 z_PreferredRecordSyntax(o, &pp->preferredRecordSyntax, 1) &&
837 int z_PresentResponse(ODR o, Z_PresentResponse **p, int opt)
839 Z_PresentResponse *pp;
841 if (!odr_sequence_begin(o, p, sizeof(**p)))
845 z_ReferenceId(o, &pp->referenceId, 1) &&
846 z_NumberOfRecordsReturned(o, &pp->numberOfRecordsReturned, 0) &&
847 z_NextResultSetPosition(o, &pp->nextResultSetPosition, 0) &&
848 z_PresentStatus(o, &pp->presentStatus, 0) &&
849 z_Records(o, &pp->records, 1) &&
853 /* ------------------------ APDU ------------------------- */
855 int z_APDU(ODR o, Z_APDU **p, int opt)
857 static Odr_arm arm[] =
859 {ODR_IMPLICIT, ODR_CONTEXT, 20, Z_APDU_initRequest, z_InitRequest},
860 {ODR_IMPLICIT, ODR_CONTEXT, 21, Z_APDU_initResponse, z_InitResponse},
861 {ODR_IMPLICIT, ODR_CONTEXT, 22, Z_APDU_searchRequest, z_SearchRequest},
862 {ODR_IMPLICIT, ODR_CONTEXT, 23, Z_APDU_searchResponse, z_SearchResponse},
863 {ODR_IMPLICIT, ODR_CONTEXT, 24, Z_APDU_presentRequest, z_PresentRequest},
864 {ODR_IMPLICIT, ODR_CONTEXT, 25, Z_APDU_presentResponse, z_PresentResponse},
865 {ODR_IMPLICIT, ODR_CONTEXT, 35, Z_APDU_scanRequest, z_ScanRequest},
866 {ODR_IMPLICIT, ODR_CONTEXT, 36, Z_APDU_scanResponse, z_ScanResponse},
871 if (o->direction == ODR_DECODE)
872 *p = odr_malloc(o, sizeof(**p));
873 if (!odr_choice(o, arm, &(*p)->u, &(*p)->which))
875 if (o->direction == ODR_DECODE)
877 return opt && !o->error;