2 * Copyright (c) 1995, Index Data
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.31 1995-06-16 13:15:56 quinn
8 * Fixed Defaultdiagformat.
10 * Revision 1.30 1995/06/15 15:42:01 quinn
13 * Revision 1.29 1995/06/15 07:44:49 quinn
16 * Revision 1.28 1995/06/14 15:26:35 quinn
17 * *** empty log message ***
19 * Revision 1.27 1995/06/07 14:36:22 quinn
22 * Revision 1.26 1995/06/02 09:49:13 quinn
23 * Adding access control
25 * Revision 1.25 1995/05/25 11:00:08 quinn
26 * *** empty log message ***
28 * Revision 1.24 1995/05/22 13:58:18 quinn
29 * Fixed an ODR_NULLVAL.
31 * Revision 1.23 1995/05/22 11:30:18 quinn
32 * Adding Z39.50-1992 stuff to proto.c. Adding zget.c
34 * Revision 1.22 1995/05/17 08:40:56 quinn
35 * Added delete. Fixed some sequence_begins. Smallish.
37 * Revision 1.21 1995/05/16 08:50:24 quinn
38 * License, documentation, and memory fixes
40 * Revision 1.20 1995/05/15 11:55:25 quinn
43 * Revision 1.19 1995/04/11 11:58:35 quinn
46 * Revision 1.18 1995/04/11 11:52:02 quinn
47 * Fixed possible buf in proto.c
49 * Revision 1.17 1995/04/10 10:22:22 quinn
52 * Revision 1.16 1995/03/30 10:26:43 quinn
53 * Added Term structure
55 * Revision 1.15 1995/03/30 09:08:39 quinn
56 * Added Resource control protocol
58 * Revision 1.14 1995/03/29 08:06:13 quinn
59 * Added a few v3 elements
61 * Revision 1.13 1995/03/20 11:26:52 quinn
62 * *** empty log message ***
64 * Revision 1.12 1995/03/20 09:45:09 quinn
67 * Revision 1.11 1995/03/17 10:17:25 quinn
68 * Added memory management.
70 * Revision 1.10 1995/03/15 11:17:40 quinn
71 * Fixed some return-checks from choice.. need better ay to handle those..
73 * Revision 1.9 1995/03/15 08:37:06 quinn
74 * Fixed protocol bugs.
76 * Revision 1.8 1995/03/14 16:59:24 quinn
77 * Fixed OPTIONAL flag in attributeelement
79 * Revision 1.7 1995/03/07 16:29:33 quinn
80 * Added authentication stuff.
82 * Revision 1.6 1995/03/01 14:46:03 quinn
83 * Fixed protocol bug in 8777query.
85 * Revision 1.5 1995/02/14 11:54:22 quinn
88 * Revision 1.4 1995/02/10 15:54:30 quinn
91 * Revision 1.3 1995/02/09 15:51:39 quinn
94 * Revision 1.2 1995/02/06 21:26:07 quinn
95 * Repaired this evening's damages..
97 * Revision 1.1 1995/02/06 16:44:47 quinn
98 * First hack at Z/SR protocol
106 /* ---------------------- GLOBAL DEFS ------------------- */
108 int z_ReferenceId(ODR o, Z_ReferenceId **p, int opt)
110 return odr_implicit(o, odr_octetstring, (Odr_oct**) p, ODR_CONTEXT, 2, opt);
113 int z_DatabaseName(ODR o, Z_DatabaseName **p, int opt)
115 return odr_implicit(o, odr_visiblestring, (char **) p, ODR_CONTEXT, 105,
119 int z_ResultSetId(ODR o, char **p, int opt)
121 return odr_implicit(o, odr_visiblestring, (char **) p, ODR_CONTEXT, 31,
125 int z_UserInformationField(ODR o, Odr_external **p, int opt)
127 return odr_explicit(o, odr_external, (Odr_external **)p, ODR_CONTEXT,
131 int z_InternationalString(ODR o, char **p, int opt)
133 return odr_generalstring(o, p, opt);
136 int z_InfoCategory(ODR o, Z_InfoCategory **p, int opt)
138 if (!odr_sequence_begin(o, p, sizeof(**p)))
139 return opt && odr_ok(o);
141 odr_implicit(o, odr_oid, &(*p)->categoryTypeId, ODR_CONTEXT, 1, 1) &&
142 odr_implicit(o, odr_integer, &(*p)->categoryValue, ODR_CONTEXT, 2, 0) &&
146 int z_OtherInformationUnit(ODR o, Z_OtherInformationUnit **p, int opt)
148 static Odr_arm arm[] =
150 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_OtherInfo_characterInfo,
152 {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_OtherInfo_binaryInfo,
154 {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_OtherInfo_externallyDefinedInfo,
156 {ODR_IMPLICIT, ODR_CONTEXT, 5, Z_OtherInfo_oid, odr_oid},
160 if (!odr_sequence_begin(o, p, sizeof(**p)))
161 return opt && odr_ok(o);
163 odr_implicit(o, z_InfoCategory, &(*p)->category, ODR_CONTEXT, 1, 1) &&
164 odr_choice(o, arm, &(*p)->which, &(*p)->information) &&
168 int z_OtherInformation(ODR o, Z_OtherInformation **p, int opt)
170 if (o->direction == ODR_DECODE)
171 *p = odr_malloc(o, sizeof(**p));
174 odr_implicit_settag(o, ODR_CONTEXT, 201);
175 if (odr_sequence_of(o, z_OtherInformationUnit, &(*p)->list,
176 &(*p)->num_elements))
179 return opt && odr_ok(o);
182 int z_StringOrNumeric(ODR o, Z_StringOrNumeric **p, int opt)
184 static Odr_arm arm[] =
186 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_StringOrNumeric_string,
188 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_StringOrNumeric_numeric,
193 if (o->direction == ODR_DECODE)
194 *p = odr_malloc(o, sizeof(**p));
197 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
200 return opt && odr_ok(o);
206 int z_Unit(ODR o, Z_Unit **p, int opt)
208 if (!odr_sequence_begin(o, p, sizeof(**p)))
209 return opt && odr_ok(o);
211 odr_implicit(o, odr_visiblestring, &(*p)->unitSystem, ODR_CONTEXT,
213 odr_explicit(o, z_StringOrNumeric, &(*p)->unitType, ODR_CONTEXT,
215 odr_explicit(o, z_StringOrNumeric, &(*p)->unit, ODR_CONTEXT, 3, 1) &&
216 odr_implicit(o, odr_integer, &(*p)->scaleFactor, ODR_CONTEXT, 4, 1) &&
220 int z_IntUnit(ODR o, Z_IntUnit **p, int opt)
222 if (!odr_sequence_begin(o, p, sizeof(**p)))
223 return opt && odr_ok(o);
225 odr_implicit(o, odr_integer, &(*p)->value, ODR_CONTEXT, 1, 0) &&
226 odr_implicit(o, z_Unit, &(*p)->unitUsed, ODR_CONTEXT, 2, 0) &&
230 /* ---------------------- INITIALIZE SERVICE ------------------- */
233 int z_NSRAuthentication(ODR o, Z_NSRAuthentication **p, int opt)
235 if (!odr_sequence_begin(o, p, sizeof(**p)))
236 return opt && odr_ok(o);
238 odr_visiblestring(o, &(*p)->user, 0) &&
239 odr_visiblestring(o, &(*p)->password, 0) &&
240 odr_visiblestring(o, &(*p)->account, 0) &&
245 int z_IdPass(ODR o, Z_IdPass **p, int opt)
247 if (!odr_sequence_begin(o, p, sizeof(**p)))
248 return opt && odr_ok(o);
250 odr_implicit(o, odr_visiblestring, &(*p)->groupId, ODR_CONTEXT, 0, 1) &&
251 odr_implicit(o, odr_visiblestring, &(*p)->userId, ODR_CONTEXT, 1, 1) &&
252 odr_implicit(o, odr_visiblestring, &(*p)->password, ODR_CONTEXT, 2,
257 int z_StrAuthentication(ODR o, char **p, int opt)
259 return odr_visiblestring(o, p, opt);
262 int z_IdAuthentication(ODR o, Z_IdAuthentication **p, int opt)
264 static Odr_arm arm[] =
266 {-1, -1, -1, Z_IdAuthentication_open, z_StrAuthentication},
267 {-1, -1, -1, Z_IdAuthentication_idPass, z_IdPass},
268 {-1, -1, -1, Z_IdAuthentication_anonymous, odr_null},
269 {-1, -1, -1, Z_IdAuthentication_other, odr_external},
273 if (o->direction == ODR_DECODE)
274 *p = odr_malloc(o, sizeof(**p));
278 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
281 return opt && odr_ok(o);
284 int z_InitRequest(ODR o, Z_InitRequest **p, int opt)
288 if (!odr_sequence_begin(o, p, sizeof(**p)))
289 return opt && odr_ok(o);
292 z_ReferenceId(o, &pp->referenceId, 1) &&
293 odr_implicit(o, odr_bitstring, &pp->protocolVersion, ODR_CONTEXT,
295 odr_implicit(o, odr_bitstring, &pp->options, ODR_CONTEXT, 4, 0) &&
296 odr_implicit(o, odr_integer, &pp->preferredMessageSize, ODR_CONTEXT,
298 odr_implicit(o, odr_integer, &pp->maximumRecordSize, ODR_CONTEXT,
300 odr_explicit(o, z_IdAuthentication, &pp->idAuthentication, ODR_CONTEXT,
302 odr_implicit(o, odr_visiblestring, &pp->implementationId, ODR_CONTEXT,
304 odr_implicit(o, odr_visiblestring, &pp->implementationName, ODR_CONTEXT,
306 odr_implicit(o, odr_visiblestring, &pp->implementationVersion,
307 ODR_CONTEXT, 112, 1) &&
308 z_UserInformationField(o, &pp->userInformationField, 1) &&
310 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
315 int z_InitResponse(ODR o, Z_InitResponse **p, int opt)
319 if (!odr_sequence_begin(o, p, sizeof(**p)))
320 return opt && odr_ok(o);
323 z_ReferenceId(o, &pp->referenceId, 1) &&
324 odr_implicit(o, odr_bitstring, &pp->protocolVersion, ODR_CONTEXT,
326 odr_implicit(o, odr_bitstring, &pp->options, ODR_CONTEXT, 4, 0) &&
327 odr_implicit(o, odr_integer, &pp->preferredMessageSize, ODR_CONTEXT,
329 odr_implicit(o, odr_integer, &pp->maximumRecordSize, ODR_CONTEXT,
331 odr_implicit(o, odr_bool, &pp->result, ODR_CONTEXT, 12, 0) &&
332 odr_implicit(o, odr_visiblestring, &pp->implementationId, ODR_CONTEXT,
334 odr_implicit(o, odr_visiblestring, &pp->implementationName, ODR_CONTEXT,
336 odr_implicit(o, odr_visiblestring, &pp->implementationVersion,
337 ODR_CONTEXT, 112, 1) &&
338 z_UserInformationField(o, &pp->userInformationField, 1) &&
340 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
345 /* ------------------ RESOURCE CONTROL ----------------*/
347 int z_TriggerResourceControlRequest(ODR o, Z_TriggerResourceControlRequest **p,
350 if (!odr_sequence_begin(o, p, sizeof(**p)))
351 return opt && odr_ok(o);
353 z_ReferenceId(o, &(*p)->referenceId, 1) &&
354 odr_implicit(o, odr_integer, &(*p)->requestedAction, ODR_CONTEXT,
356 odr_implicit(o, odr_oid, &(*p)->prefResourceReportFormat,
357 ODR_CONTEXT, 47, 1) &&
358 odr_implicit(o, odr_bool, &(*p)->resultSetWanted, ODR_CONTEXT,
361 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
366 int z_ResourceControlRequest(ODR o, Z_ResourceControlRequest **p, int opt)
368 if (!odr_sequence_begin(o, p, sizeof(**p)))
369 return opt && odr_ok(o);
371 z_ReferenceId(o, &(*p)->referenceId, 1) &&
372 odr_implicit(o, odr_bool, &(*p)->suspendedFlag, ODR_CONTEXT, 39, 1)&&
373 odr_explicit(o, odr_external, &(*p)->resourceReport, ODR_CONTEXT,
375 odr_implicit(o, odr_integer, &(*p)->partialResultsAvailable,
376 ODR_CONTEXT, 41, 1) &&
377 odr_implicit(o, odr_bool, &(*p)->responseRequired, ODR_CONTEXT,
379 odr_implicit(o, odr_bool, &(*p)->triggeredRequestFlag,
380 ODR_CONTEXT, 43, 1) &&
382 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
387 int z_ResourceControlResponse(ODR o, Z_ResourceControlResponse **p, int opt)
389 if (!odr_sequence_begin(o, p, sizeof(**p)))
390 return opt && odr_ok(o);
392 z_ReferenceId(o, &(*p)->referenceId, 1) &&
393 odr_implicit(o, odr_bool, &(*p)->continueFlag, ODR_CONTEXT, 44, 0) &&
394 odr_implicit(o, odr_bool, &(*p)->resultSetWanted, ODR_CONTEXT,
397 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
402 /* ------------------------ SEARCH SERVICE ----------------------- */
404 int z_ElementSetName(ODR o, char **p, int opt)
406 return odr_implicit(o, odr_visiblestring, (char**) p, ODR_CONTEXT, 103,
410 int z_DatabaseSpecificUnit(ODR o, Z_DatabaseSpecificUnit **p, int opt)
412 if (!odr_sequence_begin(o, p, sizeof(**p)))
413 return opt && odr_ok(o);
415 z_DatabaseName(o, &(*p)->databaseName, 0) &&
416 z_ElementSetName(o, &(*p)->elementSetName, 0) &&
420 int z_DatabaseSpecific(ODR o, Z_DatabaseSpecific **p, int opt)
422 if (o->direction == ODR_DECODE)
423 *p = odr_malloc(o, sizeof(**p));
427 odr_implicit_settag(o, ODR_CONTEXT, 1);
428 if (odr_sequence_of(o, z_DatabaseSpecificUnit, &(*p)->elements,
429 &(*p)->num_elements))
435 int z_ElementSetNames(ODR o, Z_ElementSetNames **p, int opt)
437 static Odr_arm arm[] =
439 {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_ElementSetNames_generic,
441 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ElementSetNames_databaseSpecific,
446 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 19))
447 return opt && odr_ok(o);
449 if (o->direction == ODR_DECODE)
450 *p = odr_malloc(o, sizeof(**p));
452 if (odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
453 odr_constructed_end(o))
459 /* ----------------------- RPN QUERY -----------------------*/
461 int z_ComplexAttribute(ODR o, Z_ComplexAttribute **p, int opt)
463 if (!odr_sequence_begin(o, p, sizeof(**p)))
464 return opt && odr_ok(o);
466 odr_implicit_settag(o, ODR_CONTEXT, 1) &&
467 odr_sequence_of(o, z_StringOrNumeric, &(*p)->list,
469 odr_implicit_settag(o, ODR_CONTEXT, 2) &&
470 (odr_sequence_of(o, odr_integer, &(*p)->semanticAction,
471 &(*p)->num_semanticAction) || odr_ok(o)) &&
475 int z_AttributeElement(ODR o, Z_AttributeElement **p, int opt)
478 static Odr_arm arm[] =
480 {ODR_IMPLICIT, ODR_CONTEXT, 121, Z_AttributeValue_numeric,
482 {ODR_IMPLICIT, ODR_CONTEXT, 224, Z_AttributeValue_complex,
488 if (!odr_sequence_begin(o, p, sizeof(**p)))
489 return opt && odr_ok(o);
492 odr_implicit(o, odr_oid, &(*p)->attributeSet, ODR_CONTEXT, 1, 1) &&
494 odr_implicit(o, odr_integer, &(*p)->attributeType, ODR_CONTEXT,
497 odr_choice(o, arm, &(*p)->value, &(*p)->which) &&
499 odr_implicit(o, odr_integer, &(*p)->attributeValue, ODR_CONTEXT,
505 int z_Term(ODR o, Z_Term **p, int opt)
507 static Odr_arm arm[] =
509 {ODR_IMPLICIT, ODR_CONTEXT, 45, Z_Term_general, odr_octetstring},
510 {ODR_IMPLICIT, ODR_CONTEXT, 215, Z_Term_numeric, odr_integer},
511 {ODR_IMPLICIT, ODR_CONTEXT, 216, Z_Term_characterString,
513 {ODR_IMPLICIT, ODR_CONTEXT, 217, Z_Term_oid, odr_oid},
514 {ODR_IMPLICIT, ODR_CONTEXT, 218, Z_Term_dateTime, odr_cstring},
515 {ODR_IMPLICIT, ODR_CONTEXT, 219, Z_Term_external, odr_external},
516 /* add intUnit here */
517 {ODR_IMPLICIT, ODR_CONTEXT, 221, Z_Term_null, odr_null},
521 if (o->direction ==ODR_DECODE)
522 *p = odr_malloc(o, sizeof(**p));
525 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
528 return opt && odr_ok(o);
531 int z_AttributesPlusTerm(ODR o, Z_AttributesPlusTerm **p, int opt)
533 if (!(odr_implicit_settag(o, ODR_CONTEXT, 102) &&
534 odr_sequence_begin(o, p, sizeof(**p))))
535 return opt && odr_ok(o);
537 odr_implicit_settag(o, ODR_CONTEXT, 44) &&
538 odr_sequence_of(o, z_AttributeElement, &(*p)->attributeList,
539 &(*p)->num_attributes) &&
540 z_Term(o, &(*p)->term, 0) &&
544 int z_ResultSetPlusAttributes(ODR o, Z_ResultSetPlusAttributes **p, int opt)
546 if (!(odr_implicit_settag(o, ODR_CONTEXT, 214) &&
547 odr_sequence_begin(o, p, sizeof(**p))))
548 return opt && odr_ok(o);
550 z_ResultSetId(o, &(*p)->resultSet, 0) &&
551 odr_implicit_settag(o, ODR_CONTEXT, 44) &&
552 odr_sequence_of(o, z_AttributeElement, &(*p)->attributeList,
553 &(*p)->num_attributes) &&
557 int z_ProximityOperator(ODR o, Z_ProximityOperator **p, int opt)
559 static Odr_arm arm[] =
561 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ProxCode_known, odr_integer},
562 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ProxCode_private, odr_integer},
566 if (!odr_sequence_begin(o, p, sizeof(**p)))
567 return opt && odr_ok(o);
569 odr_implicit(o, odr_bool, &(*p)->exclusion, ODR_CONTEXT, 1, 1) &&
570 odr_implicit(o, odr_integer, &(*p)->distance, ODR_CONTEXT, 2, 0) &&
571 odr_implicit(o, odr_bool, &(*p)->ordered, ODR_CONTEXT, 3, 0) &&
572 odr_implicit(o, odr_integer, &(*p)->relationType, ODR_CONTEXT, 4, 0) &&
573 odr_constructed_begin(o, &(*p)->proximityUnitCode, ODR_CONTEXT, 5) &&
574 odr_choice(o, arm, &(*p)->proximityUnitCode, &(*p)->which) &&
575 odr_constructed_end(o) &&
579 int z_Operator(ODR o, Z_Operator **p, int opt)
581 static Odr_arm arm[] =
583 {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_Operator_and, odr_null},
584 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Operator_or, odr_null},
585 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Operator_and_not, odr_null},
586 {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_Operator_prox, z_ProximityOperator},
590 if (!*p && o->direction != ODR_DECODE)
592 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 46))
593 return opt && odr_ok(o);
594 if (o->direction == ODR_DECODE)
595 *p = odr_malloc(o, sizeof(**p));
597 if (odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
598 odr_constructed_end(o))
601 return opt && odr_ok(o);
604 int z_Operand(ODR o, Z_Operand **p, int opt)
606 static Odr_arm arm[] =
608 {-1, -1, -1, Z_Operand_APT, z_AttributesPlusTerm},
609 {-1, -1, -1, Z_Operand_resultSetId, z_ResultSetId},
610 {-1, -1, -1, Z_Operand_resultAttr, z_ResultSetPlusAttributes},
614 if (o->direction == ODR_DECODE)
615 *p = odr_malloc(o, sizeof(**p));
618 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
621 return opt && odr_ok(o);
624 int z_RPNStructure(ODR o, Z_RPNStructure **p, int opt);
626 int z_Complex(ODR o, Z_Complex **p, int opt)
628 if (!odr_sequence_begin(o, p, sizeof(**p)))
629 return opt && odr_ok(o);
631 z_RPNStructure(o, &(*p)->s1, 0) &&
632 z_RPNStructure(o, &(*p)->s2, 0) &&
633 z_Operator(o, &(*p)->operator, 0) &&
637 int z_RPNStructure(ODR o, Z_RPNStructure **p, int opt)
639 static Odr_arm arm[] =
641 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_RPNStructure_simple, z_Operand},
642 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_RPNStructure_complex, z_Complex},
646 if (o->direction == ODR_DECODE)
647 *p = odr_malloc(o, sizeof(**p));
650 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
653 return opt && odr_ok(o);
656 int z_RPNQuery(ODR o, Z_RPNQuery **p, int opt)
658 if (!odr_sequence_begin(o, p, sizeof(**p)))
659 return opt && odr_ok(o);
661 odr_oid(o, &(*p)->attributeSetId, 0) &&
662 z_RPNStructure(o, &(*p)->RPNStructure, 0) &&
666 /* -----------------------END RPN QUERY ----------------------- */
668 int z_Query(ODR o, Z_Query **p, int opt)
670 static Odr_arm arm[] =
672 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Query_type_1, z_RPNQuery},
673 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_Query_type_2, odr_octetstring},
674 {ODR_EXPLICIT, ODR_CONTEXT, 101, Z_Query_type_101, z_RPNQuery},
678 if (o->direction == ODR_DECODE)
679 *p = odr_malloc(o, sizeof(**p));
682 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
685 return opt && odr_ok(o);
688 int z_SearchRequest(ODR o, Z_SearchRequest **p, int opt)
692 if (!odr_sequence_begin(o, p, sizeof(**p)))
693 return opt && odr_ok(o);
696 z_ReferenceId(o, &pp->referenceId, 1) &&
697 odr_implicit(o, odr_integer, &pp->smallSetUpperBound, ODR_CONTEXT,
699 odr_implicit(o, odr_integer, &pp->largeSetLowerBound, ODR_CONTEXT,
701 odr_implicit(o, odr_integer, &pp->mediumSetPresentNumber, ODR_CONTEXT,
703 odr_implicit(o, odr_bool, &pp->replaceIndicator, ODR_CONTEXT, 16, 1) &&
704 odr_implicit(o, odr_visiblestring, &pp->resultSetName, ODR_CONTEXT,
706 odr_implicit_settag(o, ODR_CONTEXT, 18) &&
707 odr_sequence_of(o, z_DatabaseName, &pp->databaseNames,
708 &pp->num_databaseNames) &&
709 odr_explicit(o, z_ElementSetNames, &pp->smallSetElementSetNames,
710 ODR_CONTEXT, 100, 1) &&
711 odr_explicit(o, z_ElementSetNames, &pp->mediumSetElementSetNames,
712 ODR_CONTEXT, 101, 1) &&
713 odr_implicit(o, odr_oid, &pp->preferredRecordSyntax,
714 ODR_CONTEXT, 104, 1) &&
715 odr_explicit(o, z_Query, &pp->query, ODR_CONTEXT, 21, 0) &&
717 odr_implicit(o, z_OtherInformation, &(*p)->additionalSearchInfo,
718 ODR_CONTEXT, 203, 1) &&
719 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
724 /* ------------------------ RECORD ------------------------- */
726 int z_DatabaseRecord(ODR o, Z_DatabaseRecord **p, int opt)
728 return odr_external(o, (Odr_external **) p, opt);
733 int z_DefaultDiagFormat(ODR o, Z_DefaultDiagFormat **p, int opt)
735 static Odr_arm arm[] =
737 {-1, -1, -1, Z_DiagForm_v2AddInfo, odr_visiblestring},
738 {-1, -1, -1, Z_DiagForm_v3AddInfo, z_InternationalString},
739 {ODR_IMPLICIT, ODR_CONTEXT, ODR_VISIBLESTRING, Z_DiagForm_v2AddInfo,
740 odr_visiblestring}, /* to match some weird server.. */
743 if (!odr_sequence_begin(o, p, sizeof(**p)))
744 return opt && odr_ok(o);
746 odr_oid(o, &(*p)->diagnosticSetId, 1) && /* SHOULD NOT BE OPT! */
747 odr_integer(o, &(*p)->condition, 0) &&
749 * I no longer recall what server tagged the addinfo.. but it isn't
750 * hurting anyone, so...
751 * We need to turn it into a choice, or something, because of
752 * that damn generalstring in v3.
754 odr_choice(o, arm, &(*p)->addinfo, &(*p)->which) &&
758 int z_DiagRec(ODR o, Z_DiagRec **p, int opt)
760 static Odr_arm arm[] =
762 {-1, -1, -1, Z_DiagRec_defaultFormat, z_DefaultDiagFormat},
763 {-1, -1, -1, Z_DiagRec_externallyDefined, odr_external},
767 if (o->direction == ODR_DECODE)
768 *p = odr_malloc(o, sizeof(**p));
771 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
774 return opt && odr_ok(o);
779 int z_DiagRec(ODR o, Z_DiagRec **p, int opt)
781 if (!odr_sequence_begin(o, p, sizeof(**p)))
782 return opt && odr_ok(o);
784 odr_oid(o, &(*p)->diagnosticSetId, 1) && /* SHOULD NOT BE OPT! */
785 odr_integer(o, &(*p)->condition, 0) &&
787 * I no longer recall what server tagged the addinfo.. but it isn't
788 * hurting anyone, so...
789 * We need to turn it into a choice, or something, because of
790 * that damn generalstring in v3.
792 (odr_visiblestring(o, &(*p)->addinfo, 0) ||
793 odr_implicit(o, odr_cstring, &(*p)->addinfo, ODR_CONTEXT,
794 ODR_VISIBLESTRING, 1)) &&
800 int z_DiagRecs(ODR o, Z_DiagRecs **p, int opt)
802 if (o->direction == ODR_DECODE)
803 *p = odr_malloc(o, sizeof(**p));
807 if (odr_sequence_of(o, z_DiagRec, &(*p)->diagRecs,
808 &(*p)->num_diagRecs))
814 int z_NamePlusRecord(ODR o, Z_NamePlusRecord **p, int opt)
816 static Odr_arm arm[] =
818 {ODR_EXPLICIT, ODR_CONTEXT, 1, Z_NamePlusRecord_databaseRecord,
820 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_NamePlusRecord_surrogateDiagnostic,
825 if (!odr_sequence_begin(o, p, sizeof(**p)))
826 return opt && odr_ok(o);
828 odr_implicit(o, z_DatabaseName, &(*p)->databaseName, ODR_CONTEXT,
830 odr_constructed_begin(o, &(*p)->u, ODR_CONTEXT, 1) &&
831 odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
832 odr_constructed_end(o) &&
836 int z_NamePlusRecordList(ODR o, Z_NamePlusRecordList **p, int opt)
838 if (o->direction == ODR_DECODE)
839 *p = odr_malloc(o, sizeof(**p));
842 if (odr_sequence_of(o, z_NamePlusRecord, &(*p)->records,
849 int z_Records(ODR o, Z_Records **p, int opt)
851 static Odr_arm arm[] =
853 {ODR_IMPLICIT, ODR_CONTEXT, 28, Z_Records_DBOSD, z_NamePlusRecordList},
854 {ODR_IMPLICIT, ODR_CONTEXT, 130, Z_Records_NSD, z_DiagRec},
855 {ODR_IMPLICIT, ODR_CONTEXT, 205, Z_Records_multipleNSD,
860 if (o->direction == ODR_DECODE)
861 *p = odr_malloc(o, sizeof(**p));
864 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
867 return opt && odr_ok(o);
870 /* ------------------------ ACCESS CTRL SERVICE ----------------------- */
872 int z_AccessControlRequest(ODR o, Z_AccessControlRequest **p, int opt)
874 static Odr_arm arm[] =
876 {ODR_IMPLICIT, ODR_CONTEXT, 37, Z_AccessRequest_simpleForm,
878 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_AccessRequest_externallyDefined,
882 if (!odr_sequence_begin(o, p, sizeof(**p)))
883 return opt && odr_ok(o);
885 z_ReferenceId(o, &(*p)->referenceId, 1) &&
886 odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
888 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
893 int z_AccessControlResponse(ODR o, Z_AccessControlResponse **p, int opt)
895 static Odr_arm arm[] =
897 {ODR_IMPLICIT, ODR_CONTEXT, 38, Z_AccessResponse_simpleForm,
899 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_AccessResponse_externallyDefined,
903 if (!odr_sequence_begin(o, p, sizeof(**p)))
904 return opt && odr_ok(o);
906 z_ReferenceId(o, &(*p)->referenceId, 1) &&
907 odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
908 odr_explicit(o, z_DiagRec, &(*p)->diagnostic, ODR_CONTEXT, 223, 1) &&
910 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
915 /* ------------------------ SCAN SERVICE -------------------- */
917 int z_AttributeList(ODR o, Z_AttributeList **p, int opt)
919 if (o->direction == ODR_DECODE)
920 *p = odr_malloc(o, sizeof(**p));
924 odr_implicit_settag(o, ODR_CONTEXT, 44);
925 if (odr_sequence_of(o, z_AttributeElement, &(*p)->attributes,
926 &(*p)->num_attributes))
929 return opt && odr_ok(o);
933 * This is a temporary hack. We don't know just *what* old version of the
934 * protocol willow uses, so we'll just patiently wait for them to update
936 static int willow_scan = 0;
938 int z_WillowAttributesPlusTerm(ODR o, Z_AttributesPlusTerm **p, int opt)
940 if (!*p && o->direction != ODR_DECODE)
942 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 4))
945 return opt && odr_ok(o);
947 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 1))
949 if (!odr_constructed_begin(o, p, ODR_UNIVERSAL, ODR_SEQUENCE))
951 if (!odr_implicit_settag(o, ODR_CONTEXT, 44))
953 if (o->direction == ODR_DECODE)
954 *p = odr_malloc(o, sizeof(**p));
955 if (!odr_sequence_of(o, z_AttributeElement, &(*p)->attributeList,
956 &(*p)->num_attributes))
958 if (!odr_sequence_end(o) || !odr_sequence_end(o))
960 if (!z_Term(o, &(*p)->term, 0))
962 if (!odr_constructed_end(o))
968 int z_AlternativeTerm(ODR o, Z_AlternativeTerm **p, int opt)
970 if (o->direction == ODR_DECODE)
971 *p = odr_malloc(o, sizeof(**p));
975 return opt && odr_ok(o);
978 if (odr_sequence_of(o, z_AttributesPlusTerm, &(*p)->terms,
982 return opt && !o->error;
985 int z_OccurrenceByAttributes(ODR o, Z_OccurrenceByAttributes **p, int opt)
987 if (!odr_sequence_begin(o, p, sizeof(**p)))
988 return opt && odr_ok(o);
990 odr_explicit(o, z_AttributeList, &(*p)->attributes, ODR_CONTEXT, 1, 1)&&
991 odr_explicit(o, odr_integer, &(*p)->global, ODR_CONTEXT, 2, 1) &&
995 int z_TermInfo(ODR o, Z_TermInfo **p, int opt)
997 if (!odr_sequence_begin(o, p, sizeof(**p)))
998 return opt && odr_ok(o);
1001 odr_implicit(o, z_Term, &(*p)->term, ODR_CONTEXT, 1, 0) :
1002 z_Term(o, &(*p)->term, 0)) &&
1003 z_AttributeList(o, &(*p)->suggestedAttributes, 1) &&
1004 odr_implicit(o, z_AlternativeTerm, &(*p)->alternativeTerm,
1005 ODR_CONTEXT, 4, 1) &&
1006 odr_implicit(o, odr_integer, &(*p)->globalOccurrences, ODR_CONTEXT,
1008 odr_implicit(o, z_OccurrenceByAttributes, &(*p)->byAttributes,
1009 ODR_CONTEXT, 3, 1) &&
1010 odr_sequence_end(o);
1013 int z_Entry(ODR o, Z_Entry **p, int opt)
1015 static Odr_arm arm[] =
1017 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Entry_termInfo, z_TermInfo},
1018 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_Entry_surrogateDiagnostic,
1023 if (o->direction == ODR_DECODE)
1024 *p = odr_malloc(o, sizeof(**p));
1028 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
1031 return opt && odr_ok(o);
1034 int z_Entries(ODR o, Z_Entries **p, int opt)
1036 if (o->direction == ODR_DECODE)
1037 *p = odr_malloc(o, sizeof(**p));
1041 if (odr_sequence_of(o, z_Entry, &(*p)->entries,
1042 &(*p)->num_entries))
1048 int z_ListEntries(ODR o, Z_ListEntries **p, int opt)
1050 static Odr_arm arm[] =
1052 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ListEntries_entries, z_Entries},
1053 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ListEntries_nonSurrogateDiagnostics,
1058 if (o->direction == ODR_DECODE)
1059 *p = odr_malloc(o, sizeof(**p));
1063 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
1066 return opt && odr_ok(o);
1069 int z_ScanRequest(ODR o, Z_ScanRequest **p, int opt)
1071 if (!odr_sequence_begin(o, p, sizeof(**p)))
1072 return opt && odr_ok(o);
1075 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1076 odr_implicit_settag(o, ODR_CONTEXT, 3) &&
1077 odr_sequence_of(o, z_DatabaseName, &(*p)->databaseNames,
1078 &(*p)->num_databaseNames) &&
1079 odr_oid(o, &(*p)->attributeSet, 1) &&
1080 (z_AttributesPlusTerm(o, &(*p)->termListAndStartPoint, 1) ?
1081 ((*p)->termListAndStartPoint ? 1 :
1082 z_WillowAttributesPlusTerm(o, &(*p)->termListAndStartPoint, 0)) : 0) &&
1083 odr_implicit(o, odr_integer, &(*p)->stepSize, ODR_CONTEXT, 5, 1) &&
1084 odr_implicit(o, odr_integer, &(*p)->numberOfTermsRequested,
1085 ODR_CONTEXT, 6, 0) &&
1086 odr_implicit(o, odr_integer, &(*p)->preferredPositionInResponse,
1087 ODR_CONTEXT, 7, 1) &&
1088 odr_sequence_end(o);
1091 int z_ScanResponse(ODR o, Z_ScanResponse **p, int opt)
1093 if (!odr_sequence_begin(o, p, sizeof(**p)))
1094 return opt && odr_ok(o);
1096 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1097 odr_implicit(o, odr_integer, &(*p)->stepSize, ODR_CONTEXT, 3, 1) &&
1098 odr_implicit(o, odr_integer, &(*p)->scanStatus, ODR_CONTEXT, 4, 0) &&
1099 odr_implicit(o, odr_integer, &(*p)->numberOfEntriesReturned,
1100 ODR_CONTEXT, 5, 0) &&
1101 odr_implicit(o, odr_integer, &(*p)->positionOfTerm, ODR_CONTEXT, 6, 1)&&
1102 odr_explicit(o, z_ListEntries, &(*p)->entries, ODR_CONTEXT, 7, 1) &&
1103 odr_implicit(o, odr_oid, &(*p)->attributeSet, ODR_CONTEXT, 8, 1) &&
1104 odr_sequence_end(o);
1107 /* ------------------------ SEARCHRESPONSE ----------------*/
1109 int z_NumberOfRecordsReturned(ODR o, int **p, int opt)
1111 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 24, opt);
1114 int z_NextResultSetPosition(ODR o, int **p, int opt)
1116 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 25, opt);
1119 int z_PresentStatus(ODR o, int **p, int opt)
1121 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 27, opt);
1124 int z_SearchResponse(ODR o, Z_SearchResponse **p, int opt)
1126 Z_SearchResponse *pp;
1128 if (!odr_sequence_begin(o, p, sizeof(**p)))
1129 return opt && odr_ok(o);
1132 z_ReferenceId(o, &pp->referenceId, 1) &&
1133 odr_implicit(o, odr_integer, &pp->resultCount, ODR_CONTEXT, 23, 0) &&
1134 z_NumberOfRecordsReturned(o, &pp->numberOfRecordsReturned, 0) &&
1135 z_NextResultSetPosition(o, &pp->nextResultSetPosition, 0) &&
1136 odr_implicit(o, odr_bool, &pp->searchStatus, ODR_CONTEXT, 22, 0) &&
1137 odr_implicit(o, odr_integer, &pp->resultSetStatus, ODR_CONTEXT, 26,
1139 z_PresentStatus(o, &pp->presentStatus, 1) &&
1140 z_Records(o, &pp->records, 1) &&
1142 odr_implicit(o, z_OtherInformation, &(*p)->additionalSearchInfo,
1143 ODR_CONTEXT, 203, 1) &&
1144 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1146 odr_sequence_end(o);
1149 /* --------------------- PRESENT SERVICE ---------------------- */
1151 int z_ElementSpec(ODR o, Z_ElementSpec **p, int opt)
1153 static Odr_arm arm[] =
1155 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ElementSpec_elementSetName,
1157 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ElementSpec_externalSpec,
1162 if (o->direction == ODR_DECODE)
1163 *p = odr_malloc(o, sizeof(**p));
1167 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
1170 return opt && odr_ok(o);
1173 int z_Specification(ODR o, Z_Specification **p, int opt)
1175 if (!odr_sequence_begin(o, p, sizeof(**p)))
1176 return opt && odr_ok(o);
1178 odr_implicit(o, odr_oid, &(*p)->schema, ODR_CONTEXT, 1, 1) &&
1179 z_ElementSpec(o, &(*p)->elementSpec, 1) &&
1180 odr_sequence_end(o);
1183 int z_DbSpecific(ODR o, Z_DbSpecific **p, int opt)
1185 if (!odr_sequence_begin(o, p, sizeof(**p)))
1186 return opt && odr_ok(o);
1188 odr_explicit(o, z_DatabaseName, &(*p)->databaseName, ODR_CONTEXT,
1190 odr_implicit(o, z_Specification, &(*p)->spec, ODR_CONTEXT, 2, 0) &&
1191 odr_sequence_end(o);
1194 int z_CompSpec(ODR o, Z_CompSpec **p, int opt)
1196 if (!odr_sequence_begin(o, p, sizeof(**p)))
1197 return opt && odr_ok(o);
1199 odr_implicit(o, odr_bool, &(*p)->selectAlternativeSyntax, ODR_CONTEXT,
1201 odr_implicit(o, z_Specification, &(*p)->generic, ODR_CONTEXT, 2, 1) &&
1202 odr_implicit_settag(o, ODR_CONTEXT, 3) &&
1203 (odr_sequence_of(o, z_DbSpecific, &(*p)->dbSpecific,
1204 &(*p)->num_dbSpecific) || odr_ok(o)) &&
1205 odr_implicit_settag(o, ODR_CONTEXT, 4) &&
1206 (odr_sequence_of(o, odr_oid, &(*p)->recordSyntax,
1207 &(*p)->num_recordSyntax) || odr_ok(o)) &&
1208 odr_sequence_end(o);
1211 int z_RecordComposition(ODR o, Z_RecordComposition **p, int opt)
1213 static Odr_arm arm[] =
1215 {ODR_EXPLICIT, ODR_CONTEXT, 1, Z_RecordComp_simple,
1217 {ODR_IMPLICIT, ODR_CONTEXT, 209, Z_RecordComp_complex,
1222 if (o->direction == ODR_DECODE)
1223 *p = odr_malloc(o, sizeof(**p));
1227 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
1230 return opt && odr_ok(o);
1233 int z_Range(ODR o, Z_Range **p, int opt)
1235 if (!odr_sequence_begin(o, p, sizeof(**p)))
1236 return opt && odr_ok(o);
1238 odr_implicit(o, odr_integer, &(*p)->startingPosition, ODR_CONTEXT,
1240 odr_implicit(o, odr_integer, &(*p)->numberOfRecords, ODR_CONTEXT,
1242 odr_sequence_end(o);
1245 int z_PresentRequest(ODR o, Z_PresentRequest **p, int opt)
1247 Z_PresentRequest *pp;
1249 if (!odr_sequence_begin(o, p, sizeof(**p)))
1250 return opt && odr_ok(o);
1253 z_ReferenceId(o, &pp->referenceId, 1) &&
1254 z_ResultSetId(o, &pp->resultSetId, 0) &&
1255 odr_implicit(o, odr_integer, &pp->resultSetStartPoint, ODR_CONTEXT,
1257 odr_implicit(o, odr_integer, &pp->numberOfRecordsRequested, ODR_CONTEXT,
1260 odr_implicit_settag(o, ODR_CONTEXT, 212) &&
1261 (odr_sequence_of(o, z_Range, &(*p)->additionalRanges,
1262 &(*p)->num_ranges) || odr_ok(o)) &&
1263 z_RecordComposition(o, &(*p)->recordComposition, 1) &&
1265 z_ElementSetNames(o, &pp->elementSetNames, 1) &&
1267 odr_implicit(o, odr_oid, &(*p)->preferredRecordSyntax, ODR_CONTEXT,
1270 odr_implicit(o, odr_integer, &(*p)->maxSegmentCount, ODR_CONTEXT,
1272 odr_implicit(o, odr_integer, &(*p)->maxRecordSize, ODR_CONTEXT,
1274 odr_implicit(o, odr_integer, &(*p)->maxSegmentSize, ODR_CONTEXT,
1276 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1278 odr_sequence_end(o);
1281 int z_PresentResponse(ODR o, Z_PresentResponse **p, int opt)
1283 Z_PresentResponse *pp;
1285 if (!odr_sequence_begin(o, p, sizeof(**p)))
1286 return opt && odr_ok(o);
1289 z_ReferenceId(o, &pp->referenceId, 1) &&
1290 z_NumberOfRecordsReturned(o, &pp->numberOfRecordsReturned, 0) &&
1291 z_NextResultSetPosition(o, &pp->nextResultSetPosition, 0) &&
1292 z_PresentStatus(o, &pp->presentStatus, 0) &&
1293 z_Records(o, &pp->records, 1) &&
1295 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1297 odr_sequence_end(o);
1300 /* ----------------------DELETE -------------------------- */
1302 int z_DeleteSetStatus(ODR o, int **p, int opt)
1304 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 33, opt);
1307 int z_ListStatus(ODR o, Z_ListStatus **p, int opt)
1309 if (!odr_sequence_begin(o, p, sizeof(**p)))
1310 return opt && odr_ok(o);
1312 z_ResultSetId(o, &(*p)->id, 0) &&
1313 z_DeleteSetStatus(o, &(*p)->status, 0) &&
1314 odr_sequence_end(o);
1317 int z_DeleteResultSetRequest(ODR o, Z_DeleteResultSetRequest **p, int opt)
1319 if (!odr_sequence_begin(o, p, sizeof(**p)))
1320 return opt && odr_ok(o);
1322 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1323 odr_implicit(o, odr_integer, &(*p)->deleteFunction, ODR_CONTEXT, 32,
1325 (odr_sequence_of(o, z_ListStatus, &(*p)->resultSetList,
1326 &(*p)->num_ids) || odr_ok(o)) &&
1328 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1330 odr_sequence_end(o);
1333 int z_DeleteResultSetResponse(ODR o, Z_DeleteResultSetResponse **p, int opt)
1335 if (!odr_sequence_begin(o, p, sizeof(**p)))
1336 return opt && odr_ok(o);
1338 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1339 odr_implicit(o, z_DeleteSetStatus, &(*p)->deleteOperationStatus,
1340 ODR_CONTEXT, 0, 1) &&
1341 odr_implicit_settag(o, ODR_CONTEXT, 1) &&
1342 (odr_sequence_of(o, z_ListStatus, &(*p)->deleteListStatuses,
1343 &(*p)->num_statuses) || odr_ok(o)) &&
1344 odr_implicit(o, odr_integer, &(*p)->numberNotDeleted, ODR_CONTEXT,
1346 odr_implicit_settag(o, ODR_CONTEXT, 35) &&
1347 (odr_sequence_of(o, z_ListStatus, &(*p)->bulkStatuses,
1348 &(*p)->num_bulkStatuses) || odr_ok(o)) &&
1349 odr_implicit(o, odr_visiblestring, &(*p)->deleteMessage, ODR_CONTEXT,
1352 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1354 odr_sequence_end(o);
1357 /* ------------------------ SEGMENT SERVICE -------------- */
1359 int z_Segment(ODR o, Z_Segment **p, int opt)
1361 if (!odr_sequence_begin(o, p, sizeof(**p)))
1362 return opt && odr_ok(o);
1364 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1365 odr_implicit(o, odr_integer, &(*p)->numberOfRecordsReturned,
1366 ODR_CONTEXT, 24, 0) &&
1367 odr_implicit_settag(o, ODR_CONTEXT, 0) &&
1368 odr_sequence_of(o, z_NamePlusRecord, &(*p)->segmentRecords,
1369 &(*p)->num_segmentRecords) &&
1370 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1371 odr_sequence_end(o);
1374 /* ------------------------ CLOSE SERVICE ---------------- */
1376 int z_Close(ODR o, Z_Close **p, int opt)
1378 if (!odr_sequence_begin(o, p, sizeof(**p)))
1379 return opt && odr_ok(o);
1381 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1382 odr_implicit(o, odr_integer, &(*p)->closeReason, ODR_CONTEXT, 211, 0) &&
1383 odr_implicit(o, odr_visiblestring, &(*p)->diagnosticInformation,
1384 ODR_CONTEXT, 3, 1) &&
1385 odr_implicit(o, odr_oid, &(*p)->resourceReportFormat, ODR_CONTEXT,
1387 odr_implicit(o, odr_external, &(*p)->resourceReport, ODR_CONTEXT,
1390 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1392 odr_sequence_end(o);
1395 /* ------------------------ APDU ------------------------- */
1397 int z_APDU(ODR o, Z_APDU **p, int opt)
1399 static Odr_arm arm[] =
1401 {ODR_IMPLICIT, ODR_CONTEXT, 20, Z_APDU_initRequest, z_InitRequest},
1402 {ODR_IMPLICIT, ODR_CONTEXT, 21, Z_APDU_initResponse, z_InitResponse},
1403 {ODR_IMPLICIT, ODR_CONTEXT, 22, Z_APDU_searchRequest, z_SearchRequest},
1404 {ODR_IMPLICIT, ODR_CONTEXT, 23, Z_APDU_searchResponse,
1406 {ODR_IMPLICIT, ODR_CONTEXT, 24, Z_APDU_presentRequest,
1408 {ODR_IMPLICIT, ODR_CONTEXT, 25, Z_APDU_presentResponse,
1410 {ODR_IMPLICIT, ODR_CONTEXT, 26, Z_APDU_deleteResultSetRequest,
1411 z_DeleteResultSetRequest},
1412 {ODR_IMPLICIT, ODR_CONTEXT, 27, Z_APDU_deleteResultSetResponse,
1413 z_DeleteResultSetResponse},
1414 {ODR_IMPLICIT, ODR_CONTEXT, 30, Z_APDU_resourceControlRequest,
1415 z_ResourceControlRequest},
1416 {ODR_IMPLICIT, ODR_CONTEXT, 31, Z_APDU_resourceControlResponse,
1417 z_ResourceControlResponse},
1418 {ODR_IMPLICIT, ODR_CONTEXT, 32, Z_APDU_triggerResourceControlRequest,
1419 z_TriggerResourceControlRequest},
1420 {ODR_IMPLICIT, ODR_CONTEXT, 35, Z_APDU_scanRequest, z_ScanRequest},
1421 {ODR_IMPLICIT, ODR_CONTEXT, 36, Z_APDU_scanResponse, z_ScanResponse},
1422 {ODR_IMPLICIT, ODR_CONTEXT, 45, Z_APDU_segmentRequest, z_Segment},
1423 {ODR_IMPLICIT, ODR_CONTEXT, 48, Z_APDU_close, z_Close},
1428 if (o->direction == ODR_DECODE)
1429 *p = odr_malloc(o, sizeof(**p));
1430 if (!odr_choice(o, arm, &(*p)->u, &(*p)->which))
1432 if (o->direction == ODR_DECODE)
1434 return opt && odr_ok(o);