2 * Copyright (c) 1995, Index Data
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.38 1995-09-27 15:02:40 quinn
8 * Modified function heads & prototypes.
10 * Revision 1.37 1995/08/21 09:10:15 quinn
11 * Smallish fixes to suppport new formats.
13 * Revision 1.36 1995/08/15 11:59:39 quinn
16 * Revision 1.35 1995/08/10 08:53:59 quinn
19 * Revision 1.34 1995/06/19 17:01:48 quinn
20 * This should bring us in sync with the version distributed as 1.0b
22 * Revision 1.33 1995/06/19 13:39:56 quinn
23 * *** empty log message ***
25 * Revision 1.32 1995/06/19 12:37:28 quinn
26 * Fixed a bug in the compspec.
28 * Revision 1.31 1995/06/16 13:15:56 quinn
29 * Fixed Defaultdiagformat.
31 * Revision 1.30 1995/06/15 15:42:01 quinn
34 * Revision 1.29 1995/06/15 07:44:49 quinn
37 * Revision 1.28 1995/06/14 15:26:35 quinn
38 * *** empty log message ***
40 * Revision 1.27 1995/06/07 14:36:22 quinn
43 * Revision 1.26 1995/06/02 09:49:13 quinn
44 * Adding access control
46 * Revision 1.25 1995/05/25 11:00:08 quinn
47 * *** empty log message ***
49 * Revision 1.24 1995/05/22 13:58:18 quinn
50 * Fixed an ODR_NULLVAL.
52 * Revision 1.23 1995/05/22 11:30:18 quinn
53 * Adding Z39.50-1992 stuff to proto.c. Adding zget.c
55 * Revision 1.22 1995/05/17 08:40:56 quinn
56 * Added delete. Fixed some sequence_begins. Smallish.
58 * Revision 1.21 1995/05/16 08:50:24 quinn
59 * License, documentation, and memory fixes
61 * Revision 1.20 1995/05/15 11:55:25 quinn
64 * Revision 1.19 1995/04/11 11:58:35 quinn
67 * Revision 1.18 1995/04/11 11:52:02 quinn
68 * Fixed possible buf in proto.c
70 * Revision 1.17 1995/04/10 10:22:22 quinn
73 * Revision 1.16 1995/03/30 10:26:43 quinn
74 * Added Term structure
76 * Revision 1.15 1995/03/30 09:08:39 quinn
77 * Added Resource control protocol
79 * Revision 1.14 1995/03/29 08:06:13 quinn
80 * Added a few v3 elements
82 * Revision 1.13 1995/03/20 11:26:52 quinn
83 * *** empty log message ***
85 * Revision 1.12 1995/03/20 09:45:09 quinn
88 * Revision 1.11 1995/03/17 10:17:25 quinn
89 * Added memory management.
91 * Revision 1.10 1995/03/15 11:17:40 quinn
92 * Fixed some return-checks from choice.. need better ay to handle those..
94 * Revision 1.9 1995/03/15 08:37:06 quinn
95 * Fixed protocol bugs.
97 * Revision 1.8 1995/03/14 16:59:24 quinn
98 * Fixed OPTIONAL flag in attributeelement
100 * Revision 1.7 1995/03/07 16:29:33 quinn
101 * Added authentication stuff.
103 * Revision 1.6 1995/03/01 14:46:03 quinn
104 * Fixed protocol bug in 8777query.
106 * Revision 1.5 1995/02/14 11:54:22 quinn
109 * Revision 1.4 1995/02/10 15:54:30 quinn
112 * Revision 1.3 1995/02/09 15:51:39 quinn
115 * Revision 1.2 1995/02/06 21:26:07 quinn
116 * Repaired this evening's damages..
118 * Revision 1.1 1995/02/06 16:44:47 quinn
119 * First hack at Z/SR protocol
127 /* ---------------------- GLOBAL DEFS ------------------- */
130 * We'll use a general octetstring here, since string operations are
131 * clumsy on long strings.
133 int MDF z_SUTRS(ODR o, Odr_oct **p, int opt)
135 return odr_implicit(o, odr_octetstring, p, ODR_UNIVERSAL,
136 ODR_GENERALSTRING, opt);
139 int z_ReferenceId(ODR o, Z_ReferenceId **p, int opt)
141 return odr_implicit(o, odr_octetstring, (Odr_oct**) p, ODR_CONTEXT, 2, opt);
144 int MDF z_DatabaseName(ODR o, Z_DatabaseName **p, int opt)
146 return odr_implicit(o, odr_visiblestring, (char **) p, ODR_CONTEXT, 105,
150 int z_ResultSetId(ODR o, char **p, int opt)
152 return odr_implicit(o, odr_visiblestring, (char **) p, ODR_CONTEXT, 31,
156 int MDF z_ElementSetName(ODR o, char **p, int opt)
158 return odr_implicit(o, odr_visiblestring, p, ODR_CONTEXT, 103, opt);
161 int z_UserInformationField(ODR o, Z_External **p, int opt)
163 return odr_explicit(o, z_External, (Z_External **)p, ODR_CONTEXT,
167 int MDF z_InternationalString(ODR o, char **p, int opt)
169 return odr_generalstring(o, p, opt);
172 int z_InfoCategory(ODR o, Z_InfoCategory **p, int opt)
174 if (!odr_sequence_begin(o, p, sizeof(**p)))
175 return opt && odr_ok(o);
177 odr_implicit(o, odr_oid, &(*p)->categoryTypeId, ODR_CONTEXT, 1, 1) &&
178 odr_implicit(o, odr_integer, &(*p)->categoryValue, ODR_CONTEXT, 2, 0) &&
182 int MDF z_OtherInformationUnit(ODR o, Z_OtherInformationUnit **p, int opt)
184 static Odr_arm arm[] =
186 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_OtherInfo_characterInfo,
188 {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_OtherInfo_binaryInfo,
190 {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_OtherInfo_externallyDefinedInfo,
192 {ODR_IMPLICIT, ODR_CONTEXT, 5, Z_OtherInfo_oid, odr_oid},
196 if (!odr_sequence_begin(o, p, sizeof(**p)))
197 return opt && odr_ok(o);
199 odr_implicit(o, z_InfoCategory, &(*p)->category, ODR_CONTEXT, 1, 1) &&
200 odr_choice(o, arm, &(*p)->which, &(*p)->information) &&
204 int MDF z_OtherInformation(ODR o, Z_OtherInformation **p, int opt)
206 if (o->direction == ODR_DECODE)
207 *p = odr_malloc(o, sizeof(**p));
210 odr_implicit_settag(o, ODR_CONTEXT, 201);
211 if (odr_sequence_of(o, z_OtherInformationUnit, &(*p)->list,
212 &(*p)->num_elements))
215 return opt && odr_ok(o);
218 int MDF z_StringOrNumeric(ODR o, Z_StringOrNumeric **p, int opt)
220 static Odr_arm arm[] =
222 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_StringOrNumeric_string,
224 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_StringOrNumeric_numeric,
229 if (o->direction == ODR_DECODE)
230 *p = odr_malloc(o, sizeof(**p));
233 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
236 return opt && odr_ok(o);
242 int MDF z_Unit(ODR o, Z_Unit **p, int opt)
244 if (!odr_sequence_begin(o, p, sizeof(**p)))
245 return opt && odr_ok(o);
247 odr_implicit(o, odr_visiblestring, &(*p)->unitSystem, ODR_CONTEXT,
249 odr_explicit(o, z_StringOrNumeric, &(*p)->unitType, ODR_CONTEXT,
251 odr_explicit(o, z_StringOrNumeric, &(*p)->unit, ODR_CONTEXT, 3, 1) &&
252 odr_implicit(o, odr_integer, &(*p)->scaleFactor, ODR_CONTEXT, 4, 1) &&
256 int MDF z_IntUnit(ODR o, Z_IntUnit **p, int opt)
258 if (!odr_sequence_begin(o, p, sizeof(**p)))
259 return opt && odr_ok(o);
261 odr_implicit(o, odr_integer, &(*p)->value, ODR_CONTEXT, 1, 0) &&
262 odr_implicit(o, z_Unit, &(*p)->unitUsed, ODR_CONTEXT, 2, 0) &&
266 /* ---------------------- INITIALIZE SERVICE ------------------- */
269 int MDF z_NSRAuthentication(ODR o, Z_NSRAuthentication **p, int opt)
271 if (!odr_sequence_begin(o, p, sizeof(**p)))
272 return opt && odr_ok(o);
274 odr_visiblestring(o, &(*p)->user, 0) &&
275 odr_visiblestring(o, &(*p)->password, 0) &&
276 odr_visiblestring(o, &(*p)->account, 0) &&
281 int z_IdPass(ODR o, Z_IdPass **p, int opt)
283 if (!odr_sequence_begin(o, p, sizeof(**p)))
284 return opt && odr_ok(o);
286 odr_implicit(o, odr_visiblestring, &(*p)->groupId, ODR_CONTEXT, 0, 1) &&
287 odr_implicit(o, odr_visiblestring, &(*p)->userId, ODR_CONTEXT, 1, 1) &&
288 odr_implicit(o, odr_visiblestring, &(*p)->password, ODR_CONTEXT, 2,
293 int MDF z_StrAuthentication(ODR o, char **p, int opt)
295 return odr_visiblestring(o, p, opt);
298 int z_IdAuthentication(ODR o, Z_IdAuthentication **p, int opt)
300 static Odr_arm arm[] =
302 {-1, -1, -1, Z_IdAuthentication_open, z_StrAuthentication},
303 {-1, -1, -1, Z_IdAuthentication_idPass, z_IdPass},
304 {-1, -1, -1, Z_IdAuthentication_anonymous, odr_null},
305 {-1, -1, -1, Z_IdAuthentication_other, z_External},
309 if (o->direction == ODR_DECODE)
310 *p = odr_malloc(o, sizeof(**p));
314 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
317 return opt && odr_ok(o);
320 int z_InitRequest(ODR o, Z_InitRequest **p, int opt)
324 if (!odr_sequence_begin(o, p, sizeof(**p)))
325 return opt && odr_ok(o);
328 z_ReferenceId(o, &pp->referenceId, 1) &&
329 odr_implicit(o, odr_bitstring, &pp->protocolVersion, ODR_CONTEXT,
331 odr_implicit(o, odr_bitstring, &pp->options, ODR_CONTEXT, 4, 0) &&
332 odr_implicit(o, odr_integer, &pp->preferredMessageSize, ODR_CONTEXT,
334 odr_implicit(o, odr_integer, &pp->maximumRecordSize, ODR_CONTEXT,
336 odr_explicit(o, z_IdAuthentication, &pp->idAuthentication, ODR_CONTEXT,
338 odr_implicit(o, odr_visiblestring, &pp->implementationId, ODR_CONTEXT,
340 odr_implicit(o, odr_visiblestring, &pp->implementationName, ODR_CONTEXT,
342 odr_implicit(o, odr_visiblestring, &pp->implementationVersion,
343 ODR_CONTEXT, 112, 1) &&
344 z_UserInformationField(o, &pp->userInformationField, 1) &&
346 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
351 int z_InitResponse(ODR o, Z_InitResponse **p, int opt)
355 if (!odr_sequence_begin(o, p, sizeof(**p)))
356 return opt && odr_ok(o);
359 z_ReferenceId(o, &pp->referenceId, 1) &&
360 odr_implicit(o, odr_bitstring, &pp->protocolVersion, ODR_CONTEXT,
362 odr_implicit(o, odr_bitstring, &pp->options, ODR_CONTEXT, 4, 0) &&
363 odr_implicit(o, odr_integer, &pp->preferredMessageSize, ODR_CONTEXT,
365 odr_implicit(o, odr_integer, &pp->maximumRecordSize, ODR_CONTEXT,
367 odr_implicit(o, odr_bool, &pp->result, ODR_CONTEXT, 12, 0) &&
368 odr_implicit(o, odr_visiblestring, &pp->implementationId, ODR_CONTEXT,
370 odr_implicit(o, odr_visiblestring, &pp->implementationName, ODR_CONTEXT,
372 odr_implicit(o, odr_visiblestring, &pp->implementationVersion,
373 ODR_CONTEXT, 112, 1) &&
374 z_UserInformationField(o, &pp->userInformationField, 1) &&
376 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
381 /* ------------------ RESOURCE CONTROL ----------------*/
383 int z_TriggerResourceControlRequest(ODR o, Z_TriggerResourceControlRequest **p,
386 if (!odr_sequence_begin(o, p, sizeof(**p)))
387 return opt && odr_ok(o);
389 z_ReferenceId(o, &(*p)->referenceId, 1) &&
390 odr_implicit(o, odr_integer, &(*p)->requestedAction, ODR_CONTEXT,
392 odr_implicit(o, odr_oid, &(*p)->prefResourceReportFormat,
393 ODR_CONTEXT, 47, 1) &&
394 odr_implicit(o, odr_bool, &(*p)->resultSetWanted, ODR_CONTEXT,
397 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
402 int z_ResourceControlRequest(ODR o, Z_ResourceControlRequest **p, int opt)
404 if (!odr_sequence_begin(o, p, sizeof(**p)))
405 return opt && odr_ok(o);
407 z_ReferenceId(o, &(*p)->referenceId, 1) &&
408 odr_implicit(o, odr_bool, &(*p)->suspendedFlag, ODR_CONTEXT, 39, 1)&&
409 odr_explicit(o, z_External, &(*p)->resourceReport, ODR_CONTEXT,
411 odr_implicit(o, odr_integer, &(*p)->partialResultsAvailable,
412 ODR_CONTEXT, 41, 1) &&
413 odr_implicit(o, odr_bool, &(*p)->responseRequired, ODR_CONTEXT,
415 odr_implicit(o, odr_bool, &(*p)->triggeredRequestFlag,
416 ODR_CONTEXT, 43, 1) &&
418 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
423 int z_ResourceControlResponse(ODR o, Z_ResourceControlResponse **p, int opt)
425 if (!odr_sequence_begin(o, p, sizeof(**p)))
426 return opt && odr_ok(o);
428 z_ReferenceId(o, &(*p)->referenceId, 1) &&
429 odr_implicit(o, odr_bool, &(*p)->continueFlag, ODR_CONTEXT, 44, 0) &&
430 odr_implicit(o, odr_bool, &(*p)->resultSetWanted, ODR_CONTEXT,
433 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
438 /* ------------------------ SEARCH SERVICE ----------------------- */
440 int z_DatabaseSpecificUnit(ODR o, Z_DatabaseSpecificUnit **p, int opt)
442 if (!odr_sequence_begin(o, p, sizeof(**p)))
443 return opt && odr_ok(o);
445 z_DatabaseName(o, &(*p)->databaseName, 0) &&
446 z_ElementSetName(o, &(*p)->elementSetName, 0) &&
450 int z_DatabaseSpecific(ODR o, Z_DatabaseSpecific **p, int opt)
452 if (o->direction == ODR_DECODE)
453 *p = odr_malloc(o, sizeof(**p));
457 odr_implicit_settag(o, ODR_CONTEXT, 1);
458 if (odr_sequence_of(o, z_DatabaseSpecificUnit, &(*p)->elements,
459 &(*p)->num_elements))
465 int z_ElementSetNames(ODR o, Z_ElementSetNames **p, int opt)
467 static Odr_arm arm[] =
469 {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_ElementSetNames_generic,
471 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ElementSetNames_databaseSpecific,
476 if (o->direction == ODR_DECODE)
477 *p = odr_malloc(o, sizeof(**p));
479 return opt && odr_ok(o);
481 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
487 /* ----------------------- RPN QUERY -----------------------*/
489 int z_ComplexAttribute(ODR o, Z_ComplexAttribute **p, int opt)
491 if (!odr_sequence_begin(o, p, sizeof(**p)))
492 return opt && odr_ok(o);
494 odr_implicit_settag(o, ODR_CONTEXT, 1) &&
495 odr_sequence_of(o, z_StringOrNumeric, &(*p)->list,
497 odr_implicit_settag(o, ODR_CONTEXT, 2) &&
498 (odr_sequence_of(o, odr_integer, &(*p)->semanticAction,
499 &(*p)->num_semanticAction) || odr_ok(o)) &&
503 int z_AttributeElement(ODR o, Z_AttributeElement **p, int opt)
506 static Odr_arm arm[] =
508 {ODR_IMPLICIT, ODR_CONTEXT, 121, Z_AttributeValue_numeric,
510 {ODR_IMPLICIT, ODR_CONTEXT, 224, Z_AttributeValue_complex,
516 if (!odr_sequence_begin(o, p, sizeof(**p)))
517 return opt && odr_ok(o);
520 odr_implicit(o, odr_oid, &(*p)->attributeSet, ODR_CONTEXT, 1, 1) &&
522 odr_implicit(o, odr_integer, &(*p)->attributeType, ODR_CONTEXT,
525 odr_choice(o, arm, &(*p)->value, &(*p)->which) &&
527 odr_implicit(o, odr_integer, &(*p)->attributeValue, ODR_CONTEXT,
533 int MDF z_Term(ODR o, Z_Term **p, int opt)
535 static Odr_arm arm[] =
537 {ODR_IMPLICIT, ODR_CONTEXT, 45, Z_Term_general, odr_octetstring},
538 {ODR_IMPLICIT, ODR_CONTEXT, 215, Z_Term_numeric, odr_integer},
539 {ODR_IMPLICIT, ODR_CONTEXT, 216, Z_Term_characterString,
541 {ODR_IMPLICIT, ODR_CONTEXT, 217, Z_Term_oid, odr_oid},
542 {ODR_IMPLICIT, ODR_CONTEXT, 218, Z_Term_dateTime, odr_cstring},
543 {ODR_IMPLICIT, ODR_CONTEXT, 219, Z_Term_external, z_External},
544 /* add intUnit here */
545 {ODR_IMPLICIT, ODR_CONTEXT, 221, Z_Term_null, odr_null},
549 if (o->direction ==ODR_DECODE)
550 *p = odr_malloc(o, sizeof(**p));
553 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
556 return opt && odr_ok(o);
559 int z_AttributesPlusTerm(ODR o, Z_AttributesPlusTerm **p, int opt)
561 if (!(odr_implicit_settag(o, ODR_CONTEXT, 102) &&
562 odr_sequence_begin(o, p, sizeof(**p))))
563 return opt && odr_ok(o);
565 odr_implicit_settag(o, ODR_CONTEXT, 44) &&
566 odr_sequence_of(o, z_AttributeElement, &(*p)->attributeList,
567 &(*p)->num_attributes) &&
568 z_Term(o, &(*p)->term, 0) &&
572 int z_ResultSetPlusAttributes(ODR o, Z_ResultSetPlusAttributes **p, int opt)
574 if (!(odr_implicit_settag(o, ODR_CONTEXT, 214) &&
575 odr_sequence_begin(o, p, sizeof(**p))))
576 return opt && odr_ok(o);
578 z_ResultSetId(o, &(*p)->resultSet, 0) &&
579 odr_implicit_settag(o, ODR_CONTEXT, 44) &&
580 odr_sequence_of(o, z_AttributeElement, &(*p)->attributeList,
581 &(*p)->num_attributes) &&
585 int z_ProximityOperator(ODR o, Z_ProximityOperator **p, int opt)
587 static Odr_arm arm[] =
589 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ProxCode_known, odr_integer},
590 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ProxCode_private, odr_integer},
594 if (!odr_sequence_begin(o, p, sizeof(**p)))
595 return opt && odr_ok(o);
597 odr_implicit(o, odr_bool, &(*p)->exclusion, ODR_CONTEXT, 1, 1) &&
598 odr_implicit(o, odr_integer, &(*p)->distance, ODR_CONTEXT, 2, 0) &&
599 odr_implicit(o, odr_bool, &(*p)->ordered, ODR_CONTEXT, 3, 0) &&
600 odr_implicit(o, odr_integer, &(*p)->relationType, ODR_CONTEXT, 4, 0) &&
601 odr_constructed_begin(o, &(*p)->proximityUnitCode, ODR_CONTEXT, 5) &&
602 odr_choice(o, arm, &(*p)->proximityUnitCode, &(*p)->which) &&
603 odr_constructed_end(o) &&
607 int z_Operator(ODR o, Z_Operator **p, int opt)
609 static Odr_arm arm[] =
611 {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_Operator_and, odr_null},
612 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Operator_or, odr_null},
613 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Operator_and_not, odr_null},
614 {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_Operator_prox, z_ProximityOperator},
618 if (!*p && o->direction != ODR_DECODE)
620 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 46))
621 return opt && odr_ok(o);
622 if (o->direction == ODR_DECODE)
623 *p = odr_malloc(o, sizeof(**p));
625 if (odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
626 odr_constructed_end(o))
629 return opt && odr_ok(o);
632 int z_Operand(ODR o, Z_Operand **p, int opt)
634 static Odr_arm arm[] =
636 {-1, -1, -1, Z_Operand_APT, z_AttributesPlusTerm},
637 {-1, -1, -1, Z_Operand_resultSetId, z_ResultSetId},
638 {-1, -1, -1, Z_Operand_resultAttr, z_ResultSetPlusAttributes},
642 if (o->direction == ODR_DECODE)
643 *p = odr_malloc(o, sizeof(**p));
646 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
649 return opt && odr_ok(o);
652 int z_RPNStructure(ODR o, Z_RPNStructure **p, int opt);
654 int z_Complex(ODR o, Z_Complex **p, int opt)
656 if (!odr_sequence_begin(o, p, sizeof(**p)))
657 return opt && odr_ok(o);
659 z_RPNStructure(o, &(*p)->s1, 0) &&
660 z_RPNStructure(o, &(*p)->s2, 0) &&
661 z_Operator(o, &(*p)->operator, 0) &&
665 int z_RPNStructure(ODR o, Z_RPNStructure **p, int opt)
667 static Odr_arm arm[] =
669 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_RPNStructure_simple, z_Operand},
670 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_RPNStructure_complex, z_Complex},
674 if (o->direction == ODR_DECODE)
675 *p = odr_malloc(o, sizeof(**p));
678 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
681 return opt && odr_ok(o);
684 int z_RPNQuery(ODR o, Z_RPNQuery **p, int opt)
686 if (!odr_sequence_begin(o, p, sizeof(**p)))
687 return opt && odr_ok(o);
689 odr_oid(o, &(*p)->attributeSetId, 0) &&
690 z_RPNStructure(o, &(*p)->RPNStructure, 0) &&
694 /* -----------------------END RPN QUERY ----------------------- */
696 int z_Query(ODR o, Z_Query **p, int opt)
698 static Odr_arm arm[] =
700 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Query_type_1, z_RPNQuery},
701 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_Query_type_2, odr_octetstring},
702 {ODR_EXPLICIT, ODR_CONTEXT, 101, Z_Query_type_101, z_RPNQuery},
706 if (o->direction == ODR_DECODE)
707 *p = odr_malloc(o, sizeof(**p));
710 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
713 return opt && odr_ok(o);
716 int z_SearchRequest(ODR o, Z_SearchRequest **p, int opt)
720 if (!odr_sequence_begin(o, p, sizeof(**p)))
721 return opt && odr_ok(o);
724 z_ReferenceId(o, &pp->referenceId, 1) &&
725 odr_implicit(o, odr_integer, &pp->smallSetUpperBound, ODR_CONTEXT,
727 odr_implicit(o, odr_integer, &pp->largeSetLowerBound, ODR_CONTEXT,
729 odr_implicit(o, odr_integer, &pp->mediumSetPresentNumber, ODR_CONTEXT,
731 odr_implicit(o, odr_bool, &pp->replaceIndicator, ODR_CONTEXT, 16, 1) &&
732 odr_implicit(o, odr_visiblestring, &pp->resultSetName, ODR_CONTEXT,
734 odr_implicit_settag(o, ODR_CONTEXT, 18) &&
735 odr_sequence_of(o, z_DatabaseName, &pp->databaseNames,
736 &pp->num_databaseNames) &&
737 odr_explicit(o, z_ElementSetNames, &pp->smallSetElementSetNames,
738 ODR_CONTEXT, 100, 1) &&
739 odr_explicit(o, z_ElementSetNames, &pp->mediumSetElementSetNames,
740 ODR_CONTEXT, 101, 1) &&
741 odr_implicit(o, odr_oid, &pp->preferredRecordSyntax,
742 ODR_CONTEXT, 104, 1) &&
743 odr_explicit(o, z_Query, &pp->query, ODR_CONTEXT, 21, 0) &&
745 odr_implicit(o, z_OtherInformation, &(*p)->additionalSearchInfo,
746 ODR_CONTEXT, 203, 1) &&
747 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
752 /* ------------------------ RECORD ------------------------- */
754 int z_DatabaseRecord(ODR o, Z_DatabaseRecord **p, int opt)
756 return z_External(o, (Z_External **) p, opt);
761 int MDF z_DefaultDiagFormat(ODR o, Z_DefaultDiagFormat **p, int opt)
763 static Odr_arm arm[] =
765 {-1, -1, -1, Z_DiagForm_v2AddInfo, odr_visiblestring},
766 {-1, -1, -1, Z_DiagForm_v3AddInfo, z_InternationalString},
767 {ODR_IMPLICIT, ODR_CONTEXT, ODR_VISIBLESTRING, Z_DiagForm_v2AddInfo,
768 odr_visiblestring}, /* To cater to a bug in the CNIDR servers */
771 if (!odr_sequence_begin(o, p, sizeof(**p)))
772 return opt && odr_ok(o);
774 odr_oid(o, &(*p)->diagnosticSetId, 1) && /* SHOULD NOT BE OPT! */
775 odr_integer(o, &(*p)->condition, 0) &&
777 * I no longer recall what server tagged the addinfo.. but it isn't
778 * hurting anyone, so...
779 * We need to turn it into a choice, or something, because of
780 * that damn generalstring in v3.
782 odr_choice(o, arm, &(*p)->addinfo, &(*p)->which) &&
786 int MDF z_DiagRec(ODR o, Z_DiagRec **p, int opt)
788 static Odr_arm arm[] =
790 {-1, -1, -1, Z_DiagRec_defaultFormat, z_DefaultDiagFormat},
791 {-1, -1, -1, Z_DiagRec_externallyDefined, z_External},
795 if (o->direction == ODR_DECODE)
796 *p = odr_malloc(o, sizeof(**p));
799 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
802 return opt && odr_ok(o);
807 int z_DiagRec(ODR o, Z_DiagRec **p, int opt)
809 if (!odr_sequence_begin(o, p, sizeof(**p)))
810 return opt && odr_ok(o);
812 odr_oid(o, &(*p)->diagnosticSetId, 1) && /* SHOULD NOT BE OPT! */
813 odr_integer(o, &(*p)->condition, 0) &&
815 * I no longer recall what server tagged the addinfo.. but it isn't
816 * hurting anyone, so...
817 * We need to turn it into a choice, or something, because of
818 * that damn generalstring in v3.
820 (odr_visiblestring(o, &(*p)->addinfo, 0) ||
821 odr_implicit(o, odr_cstring, &(*p)->addinfo, ODR_CONTEXT,
822 ODR_VISIBLESTRING, 1)) &&
828 int z_DiagRecs(ODR o, Z_DiagRecs **p, int opt)
830 if (o->direction == ODR_DECODE)
831 *p = odr_malloc(o, sizeof(**p));
835 if (odr_sequence_of(o, z_DiagRec, &(*p)->diagRecs,
836 &(*p)->num_diagRecs))
842 int z_NamePlusRecord(ODR o, Z_NamePlusRecord **p, int opt)
844 static Odr_arm arm[] =
846 {ODR_EXPLICIT, ODR_CONTEXT, 1, Z_NamePlusRecord_databaseRecord,
848 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_NamePlusRecord_surrogateDiagnostic,
853 if (!odr_sequence_begin(o, p, sizeof(**p)))
854 return opt && odr_ok(o);
856 odr_implicit(o, z_DatabaseName, &(*p)->databaseName, ODR_CONTEXT,
858 odr_constructed_begin(o, &(*p)->u, ODR_CONTEXT, 1) &&
859 odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
860 odr_constructed_end(o) &&
864 int z_NamePlusRecordList(ODR o, Z_NamePlusRecordList **p, int opt)
866 if (o->direction == ODR_DECODE)
867 *p = odr_malloc(o, sizeof(**p));
870 if (odr_sequence_of(o, z_NamePlusRecord, &(*p)->records,
877 int z_Records(ODR o, Z_Records **p, int opt)
879 static Odr_arm arm[] =
881 {ODR_IMPLICIT, ODR_CONTEXT, 28, Z_Records_DBOSD, z_NamePlusRecordList},
882 {ODR_IMPLICIT, ODR_CONTEXT, 130, Z_Records_NSD, z_DiagRec},
883 {ODR_IMPLICIT, ODR_CONTEXT, 205, Z_Records_multipleNSD,
888 if (o->direction == ODR_DECODE)
889 *p = odr_malloc(o, sizeof(**p));
892 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
895 return opt && odr_ok(o);
898 /* ------------------------ ACCESS CTRL SERVICE ----------------------- */
900 int z_AccessControlRequest(ODR o, Z_AccessControlRequest **p, int opt)
902 static Odr_arm arm[] =
904 {ODR_IMPLICIT, ODR_CONTEXT, 37, Z_AccessRequest_simpleForm,
906 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_AccessRequest_externallyDefined,
910 if (!odr_sequence_begin(o, p, sizeof(**p)))
911 return opt && odr_ok(o);
913 z_ReferenceId(o, &(*p)->referenceId, 1) &&
914 odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
916 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
921 int z_AccessControlResponse(ODR o, Z_AccessControlResponse **p, int opt)
923 static Odr_arm arm[] =
925 {ODR_IMPLICIT, ODR_CONTEXT, 38, Z_AccessResponse_simpleForm,
927 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_AccessResponse_externallyDefined,
931 if (!odr_sequence_begin(o, p, sizeof(**p)))
932 return opt && odr_ok(o);
934 z_ReferenceId(o, &(*p)->referenceId, 1) &&
935 odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
936 odr_explicit(o, z_DiagRec, &(*p)->diagnostic, ODR_CONTEXT, 223, 1) &&
938 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
943 /* ------------------------ SCAN SERVICE -------------------- */
945 int MDF z_AttributeList(ODR o, Z_AttributeList **p, int opt)
947 if (o->direction == ODR_DECODE)
948 *p = odr_malloc(o, sizeof(**p));
952 odr_implicit_settag(o, ODR_CONTEXT, 44);
953 if (odr_sequence_of(o, z_AttributeElement, &(*p)->attributes,
954 &(*p)->num_attributes))
957 return opt && odr_ok(o);
961 * This is a temporary hack. We don't know just *what* old version of the
962 * protocol willow uses, so we'll just patiently wait for them to update
964 static int willow_scan = 0;
966 int z_WillowAttributesPlusTerm(ODR o, Z_AttributesPlusTerm **p, int opt)
968 if (!*p && o->direction != ODR_DECODE)
970 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 4))
973 return opt && odr_ok(o);
975 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 1))
977 if (!odr_constructed_begin(o, p, ODR_UNIVERSAL, ODR_SEQUENCE))
979 if (!odr_implicit_settag(o, ODR_CONTEXT, 44))
981 if (o->direction == ODR_DECODE)
982 *p = odr_malloc(o, sizeof(**p));
983 if (!odr_sequence_of(o, z_AttributeElement, &(*p)->attributeList,
984 &(*p)->num_attributes))
986 if (!odr_sequence_end(o) || !odr_sequence_end(o))
988 if (!z_Term(o, &(*p)->term, 0))
990 if (!odr_constructed_end(o))
996 int z_AlternativeTerm(ODR o, Z_AlternativeTerm **p, int opt)
998 if (o->direction == ODR_DECODE)
999 *p = odr_malloc(o, sizeof(**p));
1003 return opt && odr_ok(o);
1006 if (odr_sequence_of(o, z_AttributesPlusTerm, &(*p)->terms,
1010 return opt && !o->error;
1013 int z_OccurrenceByAttributes(ODR o, Z_OccurrenceByAttributes **p, int opt)
1015 if (!odr_sequence_begin(o, p, sizeof(**p)))
1016 return opt && odr_ok(o);
1018 odr_explicit(o, z_AttributeList, &(*p)->attributes, ODR_CONTEXT, 1, 1)&&
1019 odr_explicit(o, odr_integer, &(*p)->global, ODR_CONTEXT, 2, 1) &&
1020 odr_sequence_end(o);
1023 int z_TermInfo(ODR o, Z_TermInfo **p, int opt)
1025 if (!odr_sequence_begin(o, p, sizeof(**p)))
1026 return opt && odr_ok(o);
1029 odr_implicit(o, z_Term, &(*p)->term, ODR_CONTEXT, 1, 0) :
1030 z_Term(o, &(*p)->term, 0)) &&
1031 z_AttributeList(o, &(*p)->suggestedAttributes, 1) &&
1032 odr_implicit(o, z_AlternativeTerm, &(*p)->alternativeTerm,
1033 ODR_CONTEXT, 4, 1) &&
1034 odr_implicit(o, odr_integer, &(*p)->globalOccurrences, ODR_CONTEXT,
1036 odr_implicit(o, z_OccurrenceByAttributes, &(*p)->byAttributes,
1037 ODR_CONTEXT, 3, 1) &&
1038 odr_sequence_end(o);
1041 int z_Entry(ODR o, Z_Entry **p, int opt)
1043 static Odr_arm arm[] =
1045 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Entry_termInfo, z_TermInfo},
1046 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_Entry_surrogateDiagnostic,
1051 if (o->direction == ODR_DECODE)
1052 *p = odr_malloc(o, sizeof(**p));
1056 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
1059 return opt && odr_ok(o);
1062 int z_Entries(ODR o, Z_Entries **p, int opt)
1064 if (o->direction == ODR_DECODE)
1065 *p = odr_malloc(o, sizeof(**p));
1069 if (odr_sequence_of(o, z_Entry, &(*p)->entries,
1070 &(*p)->num_entries))
1076 int z_ListEntries(ODR o, Z_ListEntries **p, int opt)
1078 static Odr_arm arm[] =
1080 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ListEntries_entries, z_Entries},
1081 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ListEntries_nonSurrogateDiagnostics,
1086 if (o->direction == ODR_DECODE)
1087 *p = odr_malloc(o, sizeof(**p));
1091 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
1094 return opt && odr_ok(o);
1097 int z_ScanRequest(ODR o, Z_ScanRequest **p, int opt)
1099 if (!odr_sequence_begin(o, p, sizeof(**p)))
1100 return opt && odr_ok(o);
1103 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1104 odr_implicit_settag(o, ODR_CONTEXT, 3) &&
1105 odr_sequence_of(o, z_DatabaseName, &(*p)->databaseNames,
1106 &(*p)->num_databaseNames) &&
1107 odr_oid(o, &(*p)->attributeSet, 1) &&
1108 (z_AttributesPlusTerm(o, &(*p)->termListAndStartPoint, 1) ?
1109 ((*p)->termListAndStartPoint ? 1 :
1110 z_WillowAttributesPlusTerm(o, &(*p)->termListAndStartPoint, 0)) : 0) &&
1111 odr_implicit(o, odr_integer, &(*p)->stepSize, ODR_CONTEXT, 5, 1) &&
1112 odr_implicit(o, odr_integer, &(*p)->numberOfTermsRequested,
1113 ODR_CONTEXT, 6, 0) &&
1114 odr_implicit(o, odr_integer, &(*p)->preferredPositionInResponse,
1115 ODR_CONTEXT, 7, 1) &&
1116 odr_sequence_end(o);
1119 int z_ScanResponse(ODR o, Z_ScanResponse **p, int opt)
1121 if (!odr_sequence_begin(o, p, sizeof(**p)))
1122 return opt && odr_ok(o);
1124 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1125 odr_implicit(o, odr_integer, &(*p)->stepSize, ODR_CONTEXT, 3, 1) &&
1126 odr_implicit(o, odr_integer, &(*p)->scanStatus, ODR_CONTEXT, 4, 0) &&
1127 odr_implicit(o, odr_integer, &(*p)->numberOfEntriesReturned,
1128 ODR_CONTEXT, 5, 0) &&
1129 odr_implicit(o, odr_integer, &(*p)->positionOfTerm, ODR_CONTEXT, 6, 1)&&
1130 odr_explicit(o, z_ListEntries, &(*p)->entries, ODR_CONTEXT, 7, 1) &&
1131 odr_implicit(o, odr_oid, &(*p)->attributeSet, ODR_CONTEXT, 8, 1) &&
1132 odr_sequence_end(o);
1135 /* ------------------------ SEARCHRESPONSE ----------------*/
1137 int z_NumberOfRecordsReturned(ODR o, int **p, int opt)
1139 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 24, opt);
1142 int z_NextResultSetPosition(ODR o, int **p, int opt)
1144 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 25, opt);
1147 int z_PresentStatus(ODR o, int **p, int opt)
1149 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 27, opt);
1152 int z_SearchResponse(ODR o, Z_SearchResponse **p, int opt)
1154 Z_SearchResponse *pp;
1156 if (!odr_sequence_begin(o, p, sizeof(**p)))
1157 return opt && odr_ok(o);
1160 z_ReferenceId(o, &pp->referenceId, 1) &&
1161 odr_implicit(o, odr_integer, &pp->resultCount, ODR_CONTEXT, 23, 0) &&
1162 z_NumberOfRecordsReturned(o, &pp->numberOfRecordsReturned, 0) &&
1163 z_NextResultSetPosition(o, &pp->nextResultSetPosition, 0) &&
1164 odr_implicit(o, odr_bool, &pp->searchStatus, ODR_CONTEXT, 22, 0) &&
1165 odr_implicit(o, odr_integer, &pp->resultSetStatus, ODR_CONTEXT, 26,
1167 z_PresentStatus(o, &pp->presentStatus, 1) &&
1168 z_Records(o, &pp->records, 1) &&
1170 odr_implicit(o, z_OtherInformation, &(*p)->additionalSearchInfo,
1171 ODR_CONTEXT, 203, 1) &&
1172 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1174 odr_sequence_end(o);
1177 /* --------------------- PRESENT SERVICE ---------------------- */
1179 int z_ElementSpec(ODR o, Z_ElementSpec **p, int opt)
1181 static Odr_arm arm[] =
1183 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ElementSpec_elementSetName,
1185 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ElementSpec_externalSpec,
1190 if (o->direction == ODR_DECODE)
1191 *p = odr_malloc(o, sizeof(**p));
1195 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
1198 return opt && odr_ok(o);
1201 int MDF z_Specification(ODR o, Z_Specification **p, int opt)
1203 if (!odr_sequence_begin(o, p, sizeof(**p)))
1204 return opt && odr_ok(o);
1206 odr_implicit(o, odr_oid, &(*p)->schema, ODR_CONTEXT, 1, 1) &&
1207 z_ElementSpec(o, &(*p)->elementSpec, 1) &&
1208 odr_sequence_end(o);
1211 int z_DbSpecific(ODR o, Z_DbSpecific **p, int opt)
1213 if (!odr_sequence_begin(o, p, sizeof(**p)))
1214 return opt && odr_ok(o);
1216 odr_explicit(o, z_DatabaseName, &(*p)->databaseName, ODR_CONTEXT,
1218 odr_implicit(o, z_Specification, &(*p)->spec, ODR_CONTEXT, 2, 0) &&
1219 odr_sequence_end(o);
1222 int z_CompSpec(ODR o, Z_CompSpec **p, int opt)
1224 if (!odr_sequence_begin(o, p, sizeof(**p)))
1225 return opt && odr_ok(o);
1227 odr_implicit(o, odr_bool, &(*p)->selectAlternativeSyntax, ODR_CONTEXT,
1229 odr_implicit(o, z_Specification, &(*p)->generic, ODR_CONTEXT, 2, 1) &&
1230 odr_implicit_settag(o, ODR_CONTEXT, 3) &&
1231 (odr_sequence_of(o, z_DbSpecific, &(*p)->dbSpecific,
1232 &(*p)->num_dbSpecific) || odr_ok(o)) &&
1233 odr_implicit_settag(o, ODR_CONTEXT, 4) &&
1234 (odr_sequence_of(o, odr_oid, &(*p)->recordSyntax,
1235 &(*p)->num_recordSyntax) || odr_ok(o)) &&
1236 odr_sequence_end(o);
1239 int z_RecordComposition(ODR o, Z_RecordComposition **p, int opt)
1241 static Odr_arm arm[] =
1243 {ODR_EXPLICIT, ODR_CONTEXT, 19, Z_RecordComp_simple,
1245 {ODR_IMPLICIT, ODR_CONTEXT, 209, Z_RecordComp_complex,
1250 if (o->direction == ODR_DECODE)
1251 *p = odr_malloc(o, sizeof(**p));
1255 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
1258 return opt && odr_ok(o);
1261 int z_Range(ODR o, Z_Range **p, int opt)
1263 if (!odr_sequence_begin(o, p, sizeof(**p)))
1264 return opt && odr_ok(o);
1266 odr_implicit(o, odr_integer, &(*p)->startingPosition, ODR_CONTEXT,
1268 odr_implicit(o, odr_integer, &(*p)->numberOfRecords, ODR_CONTEXT,
1270 odr_sequence_end(o);
1273 int z_PresentRequest(ODR o, Z_PresentRequest **p, int opt)
1275 Z_PresentRequest *pp;
1277 if (!odr_sequence_begin(o, p, sizeof(**p)))
1278 return opt && odr_ok(o);
1281 z_ReferenceId(o, &pp->referenceId, 1) &&
1282 z_ResultSetId(o, &pp->resultSetId, 0) &&
1283 odr_implicit(o, odr_integer, &pp->resultSetStartPoint, ODR_CONTEXT,
1285 odr_implicit(o, odr_integer, &pp->numberOfRecordsRequested, ODR_CONTEXT,
1288 odr_implicit_settag(o, ODR_CONTEXT, 212) &&
1289 (odr_sequence_of(o, z_Range, &(*p)->additionalRanges,
1290 &(*p)->num_ranges) || odr_ok(o)) &&
1291 z_RecordComposition(o, &(*p)->recordComposition, 1) &&
1293 odr_explicit(o, z_ElementSetNames, &pp->elementSetNames, ODR_CONTEXT,
1296 odr_implicit(o, odr_oid, &(*p)->preferredRecordSyntax, ODR_CONTEXT,
1299 odr_implicit(o, odr_integer, &(*p)->maxSegmentCount, ODR_CONTEXT,
1301 odr_implicit(o, odr_integer, &(*p)->maxRecordSize, ODR_CONTEXT,
1303 odr_implicit(o, odr_integer, &(*p)->maxSegmentSize, ODR_CONTEXT,
1305 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1307 odr_sequence_end(o);
1310 int z_PresentResponse(ODR o, Z_PresentResponse **p, int opt)
1312 Z_PresentResponse *pp;
1314 if (!odr_sequence_begin(o, p, sizeof(**p)))
1315 return opt && odr_ok(o);
1318 z_ReferenceId(o, &pp->referenceId, 1) &&
1319 z_NumberOfRecordsReturned(o, &pp->numberOfRecordsReturned, 0) &&
1320 z_NextResultSetPosition(o, &pp->nextResultSetPosition, 0) &&
1321 z_PresentStatus(o, &pp->presentStatus, 0) &&
1322 z_Records(o, &pp->records, 1) &&
1324 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1326 odr_sequence_end(o);
1329 /* ----------------------DELETE -------------------------- */
1331 int z_DeleteSetStatus(ODR o, int **p, int opt)
1333 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 33, opt);
1336 int z_ListStatus(ODR o, Z_ListStatus **p, int opt)
1338 if (!odr_sequence_begin(o, p, sizeof(**p)))
1339 return opt && odr_ok(o);
1341 z_ResultSetId(o, &(*p)->id, 0) &&
1342 z_DeleteSetStatus(o, &(*p)->status, 0) &&
1343 odr_sequence_end(o);
1346 int z_DeleteResultSetRequest(ODR o, Z_DeleteResultSetRequest **p, int opt)
1348 if (!odr_sequence_begin(o, p, sizeof(**p)))
1349 return opt && odr_ok(o);
1351 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1352 odr_implicit(o, odr_integer, &(*p)->deleteFunction, ODR_CONTEXT, 32,
1354 (odr_sequence_of(o, z_ListStatus, &(*p)->resultSetList,
1355 &(*p)->num_ids) || odr_ok(o)) &&
1357 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1359 odr_sequence_end(o);
1362 int z_DeleteResultSetResponse(ODR o, Z_DeleteResultSetResponse **p, int opt)
1364 if (!odr_sequence_begin(o, p, sizeof(**p)))
1365 return opt && odr_ok(o);
1367 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1368 odr_implicit(o, z_DeleteSetStatus, &(*p)->deleteOperationStatus,
1369 ODR_CONTEXT, 0, 1) &&
1370 odr_implicit_settag(o, ODR_CONTEXT, 1) &&
1371 (odr_sequence_of(o, z_ListStatus, &(*p)->deleteListStatuses,
1372 &(*p)->num_statuses) || odr_ok(o)) &&
1373 odr_implicit(o, odr_integer, &(*p)->numberNotDeleted, ODR_CONTEXT,
1375 odr_implicit_settag(o, ODR_CONTEXT, 35) &&
1376 (odr_sequence_of(o, z_ListStatus, &(*p)->bulkStatuses,
1377 &(*p)->num_bulkStatuses) || odr_ok(o)) &&
1378 odr_implicit(o, odr_visiblestring, &(*p)->deleteMessage, ODR_CONTEXT,
1381 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1383 odr_sequence_end(o);
1386 /* ------------------------ SEGMENT SERVICE -------------- */
1388 int z_Segment(ODR o, Z_Segment **p, int opt)
1390 if (!odr_sequence_begin(o, p, sizeof(**p)))
1391 return opt && odr_ok(o);
1393 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1394 odr_implicit(o, odr_integer, &(*p)->numberOfRecordsReturned,
1395 ODR_CONTEXT, 24, 0) &&
1396 odr_implicit_settag(o, ODR_CONTEXT, 0) &&
1397 odr_sequence_of(o, z_NamePlusRecord, &(*p)->segmentRecords,
1398 &(*p)->num_segmentRecords) &&
1399 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1400 odr_sequence_end(o);
1403 /* ------------------------ CLOSE SERVICE ---------------- */
1405 int z_Close(ODR o, Z_Close **p, int opt)
1407 if (!odr_sequence_begin(o, p, sizeof(**p)))
1408 return opt && odr_ok(o);
1410 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1411 odr_implicit(o, odr_integer, &(*p)->closeReason, ODR_CONTEXT, 211, 0) &&
1412 odr_implicit(o, odr_visiblestring, &(*p)->diagnosticInformation,
1413 ODR_CONTEXT, 3, 1) &&
1414 odr_implicit(o, odr_oid, &(*p)->resourceReportFormat, ODR_CONTEXT,
1416 odr_implicit(o, z_External, &(*p)->resourceReport, ODR_CONTEXT,
1419 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1421 odr_sequence_end(o);
1424 /* ------------------------ APDU ------------------------- */
1426 int MDF z_Permissions(ODR o, Z_Permissions **p, int opt)
1428 if (!odr_sequence_begin(o, p, sizeof(**p)))
1429 return opt && odr_ok(o);
1431 odr_implicit(o, z_InternationalString, &(*p)->userId, ODR_CONTEXT,
1433 odr_implicit_settag(o, ODR_CONTEXT, 2) &&
1434 odr_sequence_of(o, odr_integer, &(*p)->allowableFunctions,
1435 &(*p)->num_allowableFunctions) &&
1436 odr_sequence_end(o);
1439 int z_ExtendedServicesRequest(ODR o, Z_ExtendedServicesRequest **p, int opt)
1441 if (!odr_sequence_begin(o, p, sizeof(**p)))
1442 return opt && odr_ok(o);
1444 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1445 odr_implicit(o, odr_integer, &(*p)->function, ODR_CONTEXT, 3, 0) &&
1446 odr_implicit(o, odr_oid, &(*p)->packageType, ODR_CONTEXT, 4, 0) &&
1447 odr_implicit(o, z_InternationalString, &(*p)->packageName, ODR_CONTEXT, 5, 1) &&
1448 odr_implicit(o, z_InternationalString, &(*p)->userId, ODR_CONTEXT, 6, 1) &&
1449 odr_implicit(o, z_IntUnit, &(*p)->retentionTime, ODR_CONTEXT, 7, 1) &&
1450 odr_implicit(o, z_Permissions, &(*p)->permissions, ODR_CONTEXT, 8, 1) &&
1451 odr_implicit(o, z_InternationalString, &(*p)->description, ODR_CONTEXT, 9, 1) &&
1452 odr_implicit(o, z_External, &(*p)->taskSpecificParameters, ODR_CONTEXT, 10, 1) &&
1453 odr_implicit(o, odr_integer, &(*p)->waitAction, ODR_CONTEXT, 11, 0) &&
1454 z_ElementSetName(o, &(*p)->elements, 1) &&
1455 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1456 odr_sequence_end(o);
1459 int z_ExtendedServicesResponse(ODR o, Z_ExtendedServicesResponse **p, int opt)
1461 if (!odr_sequence_begin(o, p, sizeof(**p)))
1462 return opt && odr_ok(o);
1464 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1465 odr_implicit(o, odr_integer, &(*p)->operationStatus, ODR_CONTEXT, 3, 0) &&
1466 odr_implicit_settag(o, ODR_CONTEXT, 4) &&
1467 (odr_sequence_of(o, z_DiagRec, &(*p)->diagnostics,
1468 &(*p)->num_diagnostics) || odr_ok(o)) &&
1469 odr_implicit(o, z_External, &(*p)->taskPackage, ODR_CONTEXT, 5, 1) &&
1470 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1471 odr_sequence_end(o);
1474 /* ------------------------ APDU ------------------------- */
1476 int MDF z_APDU(ODR o, Z_APDU **p, int opt)
1478 static Odr_arm arm[] =
1480 {ODR_IMPLICIT, ODR_CONTEXT, 20, Z_APDU_initRequest, z_InitRequest},
1481 {ODR_IMPLICIT, ODR_CONTEXT, 21, Z_APDU_initResponse, z_InitResponse},
1482 {ODR_IMPLICIT, ODR_CONTEXT, 22, Z_APDU_searchRequest, z_SearchRequest},
1483 {ODR_IMPLICIT, ODR_CONTEXT, 23, Z_APDU_searchResponse,
1485 {ODR_IMPLICIT, ODR_CONTEXT, 24, Z_APDU_presentRequest,
1487 {ODR_IMPLICIT, ODR_CONTEXT, 25, Z_APDU_presentResponse,
1489 {ODR_IMPLICIT, ODR_CONTEXT, 26, Z_APDU_deleteResultSetRequest,
1490 z_DeleteResultSetRequest},
1491 {ODR_IMPLICIT, ODR_CONTEXT, 27, Z_APDU_deleteResultSetResponse,
1492 z_DeleteResultSetResponse},
1493 {ODR_IMPLICIT, ODR_CONTEXT, 30, Z_APDU_resourceControlRequest,
1494 z_ResourceControlRequest},
1495 {ODR_IMPLICIT, ODR_CONTEXT, 31, Z_APDU_resourceControlResponse,
1496 z_ResourceControlResponse},
1497 {ODR_IMPLICIT, ODR_CONTEXT, 32, Z_APDU_triggerResourceControlRequest,
1498 z_TriggerResourceControlRequest},
1499 {ODR_IMPLICIT, ODR_CONTEXT, 35, Z_APDU_scanRequest, z_ScanRequest},
1500 {ODR_IMPLICIT, ODR_CONTEXT, 36, Z_APDU_scanResponse, z_ScanResponse},
1501 {ODR_IMPLICIT, ODR_CONTEXT, 45, Z_APDU_segmentRequest, z_Segment},
1502 {ODR_IMPLICIT, ODR_CONTEXT, 46, Z_APDU_extendedServicesRequest,
1503 z_ExtendedServicesRequest},
1504 {ODR_IMPLICIT, ODR_CONTEXT, 47, Z_APDU_extendedServicesResponse,
1505 z_ExtendedServicesResponse},
1506 {ODR_IMPLICIT, ODR_CONTEXT, 48, Z_APDU_close, z_Close},
1511 if (o->direction == ODR_DECODE)
1512 *p = odr_malloc(o, sizeof(**p));
1513 if (!odr_choice(o, arm, &(*p)->u, &(*p)->which))
1515 if (o->direction == ODR_DECODE)
1517 return opt && odr_ok(o);