2 * Copyright (c) 1995, Index Data
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.40 1996-01-02 11:46:40 quinn
8 * Changed 'operator' to 'roperator' to avoid C++ conflict.
10 * Revision 1.39 1995/09/29 17:11:53 quinn
13 * Revision 1.38 1995/09/27 15:02:40 quinn
14 * Modified function heads & prototypes.
16 * Revision 1.37 1995/08/21 09:10:15 quinn
17 * Smallish fixes to suppport new formats.
19 * Revision 1.36 1995/08/15 11:59:39 quinn
22 * Revision 1.35 1995/08/10 08:53:59 quinn
25 * Revision 1.34 1995/06/19 17:01:48 quinn
26 * This should bring us in sync with the version distributed as 1.0b
28 * Revision 1.33 1995/06/19 13:39:56 quinn
29 * *** empty log message ***
31 * Revision 1.32 1995/06/19 12:37:28 quinn
32 * Fixed a bug in the compspec.
34 * Revision 1.31 1995/06/16 13:15:56 quinn
35 * Fixed Defaultdiagformat.
37 * Revision 1.30 1995/06/15 15:42:01 quinn
40 * Revision 1.29 1995/06/15 07:44:49 quinn
43 * Revision 1.28 1995/06/14 15:26:35 quinn
44 * *** empty log message ***
46 * Revision 1.27 1995/06/07 14:36:22 quinn
49 * Revision 1.26 1995/06/02 09:49:13 quinn
50 * Adding access control
52 * Revision 1.25 1995/05/25 11:00:08 quinn
53 * *** empty log message ***
55 * Revision 1.24 1995/05/22 13:58:18 quinn
56 * Fixed an ODR_NULLVAL.
58 * Revision 1.23 1995/05/22 11:30:18 quinn
59 * Adding Z39.50-1992 stuff to proto.c. Adding zget.c
61 * Revision 1.22 1995/05/17 08:40:56 quinn
62 * Added delete. Fixed some sequence_begins. Smallish.
64 * Revision 1.21 1995/05/16 08:50:24 quinn
65 * License, documentation, and memory fixes
67 * Revision 1.20 1995/05/15 11:55:25 quinn
70 * Revision 1.19 1995/04/11 11:58:35 quinn
73 * Revision 1.18 1995/04/11 11:52:02 quinn
74 * Fixed possible buf in proto.c
76 * Revision 1.17 1995/04/10 10:22:22 quinn
79 * Revision 1.16 1995/03/30 10:26:43 quinn
80 * Added Term structure
82 * Revision 1.15 1995/03/30 09:08:39 quinn
83 * Added Resource control protocol
85 * Revision 1.14 1995/03/29 08:06:13 quinn
86 * Added a few v3 elements
88 * Revision 1.13 1995/03/20 11:26:52 quinn
89 * *** empty log message ***
91 * Revision 1.12 1995/03/20 09:45:09 quinn
94 * Revision 1.11 1995/03/17 10:17:25 quinn
95 * Added memory management.
97 * Revision 1.10 1995/03/15 11:17:40 quinn
98 * Fixed some return-checks from choice.. need better ay to handle those..
100 * Revision 1.9 1995/03/15 08:37:06 quinn
101 * Fixed protocol bugs.
103 * Revision 1.8 1995/03/14 16:59:24 quinn
104 * Fixed OPTIONAL flag in attributeelement
106 * Revision 1.7 1995/03/07 16:29:33 quinn
107 * Added authentication stuff.
109 * Revision 1.6 1995/03/01 14:46:03 quinn
110 * Fixed protocol bug in 8777query.
112 * Revision 1.5 1995/02/14 11:54:22 quinn
115 * Revision 1.4 1995/02/10 15:54:30 quinn
118 * Revision 1.3 1995/02/09 15:51:39 quinn
121 * Revision 1.2 1995/02/06 21:26:07 quinn
122 * Repaired this evening's damages..
124 * Revision 1.1 1995/02/06 16:44:47 quinn
125 * First hack at Z/SR protocol
133 /* ---------------------- GLOBAL DEFS ------------------- */
136 * We'll use a general octetstring here, since string operations are
137 * clumsy on long strings.
139 int z_SUTRS(ODR o, Odr_oct **p, int opt)
141 return odr_implicit(o, odr_octetstring, p, ODR_UNIVERSAL,
142 ODR_GENERALSTRING, opt);
145 int z_ReferenceId(ODR o, Z_ReferenceId **p, int opt)
147 return odr_implicit(o, odr_octetstring, (Odr_oct**) p, ODR_CONTEXT, 2, opt);
150 int z_DatabaseName(ODR o, Z_DatabaseName **p, int opt)
152 return odr_implicit(o, odr_visiblestring, (char **) p, ODR_CONTEXT, 105,
156 int z_ResultSetId(ODR o, char **p, int opt)
158 return odr_implicit(o, odr_visiblestring, (char **) p, ODR_CONTEXT, 31,
162 int z_ElementSetName(ODR o, char **p, int opt)
164 return odr_implicit(o, odr_visiblestring, p, ODR_CONTEXT, 103, opt);
167 int z_UserInformationField(ODR o, Z_External **p, int opt)
169 return odr_explicit(o, z_External, (Z_External **)p, ODR_CONTEXT,
173 int z_InternationalString(ODR o, char **p, int opt)
175 return odr_generalstring(o, p, opt);
178 int z_InfoCategory(ODR o, Z_InfoCategory **p, int opt)
180 if (!odr_sequence_begin(o, p, sizeof(**p)))
181 return opt && odr_ok(o);
183 odr_implicit(o, odr_oid, &(*p)->categoryTypeId, ODR_CONTEXT, 1, 1) &&
184 odr_implicit(o, odr_integer, &(*p)->categoryValue, ODR_CONTEXT, 2, 0) &&
188 int z_OtherInformationUnit(ODR o, Z_OtherInformationUnit **p, int opt)
190 static Odr_arm arm[] =
192 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_OtherInfo_characterInfo,
194 {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_OtherInfo_binaryInfo,
196 {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_OtherInfo_externallyDefinedInfo,
198 {ODR_IMPLICIT, ODR_CONTEXT, 5, Z_OtherInfo_oid, odr_oid},
202 if (!odr_sequence_begin(o, p, sizeof(**p)))
203 return opt && odr_ok(o);
205 odr_implicit(o, z_InfoCategory, &(*p)->category, ODR_CONTEXT, 1, 1) &&
206 odr_choice(o, arm, &(*p)->which, &(*p)->information) &&
210 int z_OtherInformation(ODR o, Z_OtherInformation **p, int opt)
212 if (o->direction == ODR_DECODE)
213 *p = odr_malloc(o, sizeof(**p));
216 odr_implicit_settag(o, ODR_CONTEXT, 201);
217 if (odr_sequence_of(o, z_OtherInformationUnit, &(*p)->list,
218 &(*p)->num_elements))
221 return opt && odr_ok(o);
224 int z_StringOrNumeric(ODR o, Z_StringOrNumeric **p, int opt)
226 static Odr_arm arm[] =
228 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_StringOrNumeric_string,
230 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_StringOrNumeric_numeric,
235 if (o->direction == ODR_DECODE)
236 *p = odr_malloc(o, sizeof(**p));
239 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
242 return opt && odr_ok(o);
248 int z_Unit(ODR o, Z_Unit **p, int opt)
250 if (!odr_sequence_begin(o, p, sizeof(**p)))
251 return opt && odr_ok(o);
253 odr_implicit(o, odr_visiblestring, &(*p)->unitSystem, ODR_CONTEXT,
255 odr_explicit(o, z_StringOrNumeric, &(*p)->unitType, ODR_CONTEXT,
257 odr_explicit(o, z_StringOrNumeric, &(*p)->unit, ODR_CONTEXT, 3, 1) &&
258 odr_implicit(o, odr_integer, &(*p)->scaleFactor, ODR_CONTEXT, 4, 1) &&
262 int z_IntUnit(ODR o, Z_IntUnit **p, int opt)
264 if (!odr_sequence_begin(o, p, sizeof(**p)))
265 return opt && odr_ok(o);
267 odr_implicit(o, odr_integer, &(*p)->value, ODR_CONTEXT, 1, 0) &&
268 odr_implicit(o, z_Unit, &(*p)->unitUsed, ODR_CONTEXT, 2, 0) &&
272 /* ---------------------- INITIALIZE SERVICE ------------------- */
275 int z_NSRAuthentication(ODR o, Z_NSRAuthentication **p, int opt)
277 if (!odr_sequence_begin(o, p, sizeof(**p)))
278 return opt && odr_ok(o);
280 odr_visiblestring(o, &(*p)->user, 0) &&
281 odr_visiblestring(o, &(*p)->password, 0) &&
282 odr_visiblestring(o, &(*p)->account, 0) &&
287 int z_IdPass(ODR o, Z_IdPass **p, int opt)
289 if (!odr_sequence_begin(o, p, sizeof(**p)))
290 return opt && odr_ok(o);
292 odr_implicit(o, odr_visiblestring, &(*p)->groupId, ODR_CONTEXT, 0, 1) &&
293 odr_implicit(o, odr_visiblestring, &(*p)->userId, ODR_CONTEXT, 1, 1) &&
294 odr_implicit(o, odr_visiblestring, &(*p)->password, ODR_CONTEXT, 2,
299 int z_StrAuthentication(ODR o, char **p, int opt)
301 return odr_visiblestring(o, p, opt);
304 int z_IdAuthentication(ODR o, Z_IdAuthentication **p, int opt)
306 static Odr_arm arm[] =
308 {-1, -1, -1, Z_IdAuthentication_open, z_StrAuthentication},
309 {-1, -1, -1, Z_IdAuthentication_idPass, z_IdPass},
310 {-1, -1, -1, Z_IdAuthentication_anonymous, odr_null},
311 {-1, -1, -1, Z_IdAuthentication_other, z_External},
315 if (o->direction == ODR_DECODE)
316 *p = odr_malloc(o, sizeof(**p));
320 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
323 return opt && odr_ok(o);
326 int z_InitRequest(ODR o, Z_InitRequest **p, int opt)
330 if (!odr_sequence_begin(o, p, sizeof(**p)))
331 return opt && odr_ok(o);
334 z_ReferenceId(o, &pp->referenceId, 1) &&
335 odr_implicit(o, odr_bitstring, &pp->protocolVersion, ODR_CONTEXT,
337 odr_implicit(o, odr_bitstring, &pp->options, ODR_CONTEXT, 4, 0) &&
338 odr_implicit(o, odr_integer, &pp->preferredMessageSize, ODR_CONTEXT,
340 odr_implicit(o, odr_integer, &pp->maximumRecordSize, ODR_CONTEXT,
342 odr_explicit(o, z_IdAuthentication, &pp->idAuthentication, ODR_CONTEXT,
344 odr_implicit(o, odr_visiblestring, &pp->implementationId, ODR_CONTEXT,
346 odr_implicit(o, odr_visiblestring, &pp->implementationName, ODR_CONTEXT,
348 odr_implicit(o, odr_visiblestring, &pp->implementationVersion,
349 ODR_CONTEXT, 112, 1) &&
350 z_UserInformationField(o, &pp->userInformationField, 1) &&
352 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
357 int z_InitResponse(ODR o, Z_InitResponse **p, int opt)
361 if (!odr_sequence_begin(o, p, sizeof(**p)))
362 return opt && odr_ok(o);
365 z_ReferenceId(o, &pp->referenceId, 1) &&
366 odr_implicit(o, odr_bitstring, &pp->protocolVersion, ODR_CONTEXT,
368 odr_implicit(o, odr_bitstring, &pp->options, ODR_CONTEXT, 4, 0) &&
369 odr_implicit(o, odr_integer, &pp->preferredMessageSize, ODR_CONTEXT,
371 odr_implicit(o, odr_integer, &pp->maximumRecordSize, ODR_CONTEXT,
373 odr_implicit(o, odr_bool, &pp->result, ODR_CONTEXT, 12, 0) &&
374 odr_implicit(o, odr_visiblestring, &pp->implementationId, ODR_CONTEXT,
376 odr_implicit(o, odr_visiblestring, &pp->implementationName, ODR_CONTEXT,
378 odr_implicit(o, odr_visiblestring, &pp->implementationVersion,
379 ODR_CONTEXT, 112, 1) &&
380 z_UserInformationField(o, &pp->userInformationField, 1) &&
382 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
387 /* ------------------ RESOURCE CONTROL ----------------*/
389 int z_TriggerResourceControlRequest(ODR o, Z_TriggerResourceControlRequest **p,
392 if (!odr_sequence_begin(o, p, sizeof(**p)))
393 return opt && odr_ok(o);
395 z_ReferenceId(o, &(*p)->referenceId, 1) &&
396 odr_implicit(o, odr_integer, &(*p)->requestedAction, ODR_CONTEXT,
398 odr_implicit(o, odr_oid, &(*p)->prefResourceReportFormat,
399 ODR_CONTEXT, 47, 1) &&
400 odr_implicit(o, odr_bool, &(*p)->resultSetWanted, ODR_CONTEXT,
403 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
408 int z_ResourceControlRequest(ODR o, Z_ResourceControlRequest **p, int opt)
410 if (!odr_sequence_begin(o, p, sizeof(**p)))
411 return opt && odr_ok(o);
413 z_ReferenceId(o, &(*p)->referenceId, 1) &&
414 odr_implicit(o, odr_bool, &(*p)->suspendedFlag, ODR_CONTEXT, 39, 1)&&
415 odr_explicit(o, z_External, &(*p)->resourceReport, ODR_CONTEXT,
417 odr_implicit(o, odr_integer, &(*p)->partialResultsAvailable,
418 ODR_CONTEXT, 41, 1) &&
419 odr_implicit(o, odr_bool, &(*p)->responseRequired, ODR_CONTEXT,
421 odr_implicit(o, odr_bool, &(*p)->triggeredRequestFlag,
422 ODR_CONTEXT, 43, 1) &&
424 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
429 int z_ResourceControlResponse(ODR o, Z_ResourceControlResponse **p, int opt)
431 if (!odr_sequence_begin(o, p, sizeof(**p)))
432 return opt && odr_ok(o);
434 z_ReferenceId(o, &(*p)->referenceId, 1) &&
435 odr_implicit(o, odr_bool, &(*p)->continueFlag, ODR_CONTEXT, 44, 0) &&
436 odr_implicit(o, odr_bool, &(*p)->resultSetWanted, ODR_CONTEXT,
439 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
444 /* ------------------------ SEARCH SERVICE ----------------------- */
446 int z_DatabaseSpecificUnit(ODR o, Z_DatabaseSpecificUnit **p, int opt)
448 if (!odr_sequence_begin(o, p, sizeof(**p)))
449 return opt && odr_ok(o);
451 z_DatabaseName(o, &(*p)->databaseName, 0) &&
452 z_ElementSetName(o, &(*p)->elementSetName, 0) &&
456 int z_DatabaseSpecific(ODR o, Z_DatabaseSpecific **p, int opt)
458 if (o->direction == ODR_DECODE)
459 *p = odr_malloc(o, sizeof(**p));
463 odr_implicit_settag(o, ODR_CONTEXT, 1);
464 if (odr_sequence_of(o, z_DatabaseSpecificUnit, &(*p)->elements,
465 &(*p)->num_elements))
471 int z_ElementSetNames(ODR o, Z_ElementSetNames **p, int opt)
473 static Odr_arm arm[] =
475 {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_ElementSetNames_generic,
477 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ElementSetNames_databaseSpecific,
482 if (o->direction == ODR_DECODE)
483 *p = odr_malloc(o, sizeof(**p));
485 return opt && odr_ok(o);
487 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
493 /* ----------------------- RPN QUERY -----------------------*/
495 int z_ComplexAttribute(ODR o, Z_ComplexAttribute **p, int opt)
497 if (!odr_sequence_begin(o, p, sizeof(**p)))
498 return opt && odr_ok(o);
500 odr_implicit_settag(o, ODR_CONTEXT, 1) &&
501 odr_sequence_of(o, z_StringOrNumeric, &(*p)->list,
503 odr_implicit_settag(o, ODR_CONTEXT, 2) &&
504 (odr_sequence_of(o, odr_integer, &(*p)->semanticAction,
505 &(*p)->num_semanticAction) || odr_ok(o)) &&
509 int z_AttributeElement(ODR o, Z_AttributeElement **p, int opt)
512 static Odr_arm arm[] =
514 {ODR_IMPLICIT, ODR_CONTEXT, 121, Z_AttributeValue_numeric,
516 {ODR_IMPLICIT, ODR_CONTEXT, 224, Z_AttributeValue_complex,
522 if (!odr_sequence_begin(o, p, sizeof(**p)))
523 return opt && odr_ok(o);
526 odr_implicit(o, odr_oid, &(*p)->attributeSet, ODR_CONTEXT, 1, 1) &&
528 odr_implicit(o, odr_integer, &(*p)->attributeType, ODR_CONTEXT,
531 odr_choice(o, arm, &(*p)->value, &(*p)->which) &&
533 odr_implicit(o, odr_integer, &(*p)->attributeValue, ODR_CONTEXT,
539 int z_Term(ODR o, Z_Term **p, int opt)
541 static Odr_arm arm[] =
543 {ODR_IMPLICIT, ODR_CONTEXT, 45, Z_Term_general, odr_octetstring},
544 {ODR_IMPLICIT, ODR_CONTEXT, 215, Z_Term_numeric, odr_integer},
545 {ODR_IMPLICIT, ODR_CONTEXT, 216, Z_Term_characterString,
547 {ODR_IMPLICIT, ODR_CONTEXT, 217, Z_Term_oid, odr_oid},
548 {ODR_IMPLICIT, ODR_CONTEXT, 218, Z_Term_dateTime, odr_cstring},
549 {ODR_IMPLICIT, ODR_CONTEXT, 219, Z_Term_external, z_External},
550 /* add intUnit here */
551 {ODR_IMPLICIT, ODR_CONTEXT, 221, Z_Term_null, odr_null},
555 if (o->direction ==ODR_DECODE)
556 *p = odr_malloc(o, sizeof(**p));
559 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
562 return opt && odr_ok(o);
565 int z_AttributesPlusTerm(ODR o, Z_AttributesPlusTerm **p, int opt)
567 if (!(odr_implicit_settag(o, ODR_CONTEXT, 102) &&
568 odr_sequence_begin(o, p, sizeof(**p))))
569 return opt && odr_ok(o);
571 odr_implicit_settag(o, ODR_CONTEXT, 44) &&
572 odr_sequence_of(o, z_AttributeElement, &(*p)->attributeList,
573 &(*p)->num_attributes) &&
574 z_Term(o, &(*p)->term, 0) &&
578 int z_ResultSetPlusAttributes(ODR o, Z_ResultSetPlusAttributes **p, int opt)
580 if (!(odr_implicit_settag(o, ODR_CONTEXT, 214) &&
581 odr_sequence_begin(o, p, sizeof(**p))))
582 return opt && odr_ok(o);
584 z_ResultSetId(o, &(*p)->resultSet, 0) &&
585 odr_implicit_settag(o, ODR_CONTEXT, 44) &&
586 odr_sequence_of(o, z_AttributeElement, &(*p)->attributeList,
587 &(*p)->num_attributes) &&
591 int z_ProximityOperator(ODR o, Z_ProximityOperator **p, int opt)
593 static Odr_arm arm[] =
595 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ProxCode_known, odr_integer},
596 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ProxCode_private, odr_integer},
600 if (!odr_sequence_begin(o, p, sizeof(**p)))
601 return opt && odr_ok(o);
603 odr_implicit(o, odr_bool, &(*p)->exclusion, ODR_CONTEXT, 1, 1) &&
604 odr_implicit(o, odr_integer, &(*p)->distance, ODR_CONTEXT, 2, 0) &&
605 odr_implicit(o, odr_bool, &(*p)->ordered, ODR_CONTEXT, 3, 0) &&
606 odr_implicit(o, odr_integer, &(*p)->relationType, ODR_CONTEXT, 4, 0) &&
607 odr_constructed_begin(o, &(*p)->proximityUnitCode, ODR_CONTEXT, 5) &&
608 odr_choice(o, arm, &(*p)->proximityUnitCode, &(*p)->which) &&
609 odr_constructed_end(o) &&
613 int z_Operator(ODR o, Z_Operator **p, int opt)
615 static Odr_arm arm[] =
617 {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_Operator_and, odr_null},
618 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Operator_or, odr_null},
619 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Operator_and_not, odr_null},
620 {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_Operator_prox, z_ProximityOperator},
624 if (!*p && o->direction != ODR_DECODE)
626 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 46))
627 return opt && odr_ok(o);
628 if (o->direction == ODR_DECODE)
629 *p = odr_malloc(o, sizeof(**p));
631 if (odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
632 odr_constructed_end(o))
635 return opt && odr_ok(o);
638 int z_Operand(ODR o, Z_Operand **p, int opt)
640 static Odr_arm arm[] =
642 {-1, -1, -1, Z_Operand_APT, z_AttributesPlusTerm},
643 {-1, -1, -1, Z_Operand_resultSetId, z_ResultSetId},
644 {-1, -1, -1, Z_Operand_resultAttr, z_ResultSetPlusAttributes},
648 if (o->direction == ODR_DECODE)
649 *p = odr_malloc(o, sizeof(**p));
652 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
655 return opt && odr_ok(o);
658 int z_RPNStructure(ODR o, Z_RPNStructure **p, int opt);
660 int z_Complex(ODR o, Z_Complex **p, int opt)
662 if (!odr_sequence_begin(o, p, sizeof(**p)))
663 return opt && odr_ok(o);
665 z_RPNStructure(o, &(*p)->s1, 0) &&
666 z_RPNStructure(o, &(*p)->s2, 0) &&
667 z_Operator(o, &(*p)->roperator, 0) &&
671 int z_RPNStructure(ODR o, Z_RPNStructure **p, int opt)
673 static Odr_arm arm[] =
675 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_RPNStructure_simple, z_Operand},
676 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_RPNStructure_complex, z_Complex},
680 if (o->direction == ODR_DECODE)
681 *p = odr_malloc(o, sizeof(**p));
684 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
687 return opt && odr_ok(o);
690 int z_RPNQuery(ODR o, Z_RPNQuery **p, int opt)
692 if (!odr_sequence_begin(o, p, sizeof(**p)))
693 return opt && odr_ok(o);
695 odr_oid(o, &(*p)->attributeSetId, 0) &&
696 z_RPNStructure(o, &(*p)->RPNStructure, 0) &&
700 /* -----------------------END RPN QUERY ----------------------- */
702 int z_Query(ODR o, Z_Query **p, int opt)
704 static Odr_arm arm[] =
706 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Query_type_1, z_RPNQuery},
707 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_Query_type_2, odr_octetstring},
708 {ODR_EXPLICIT, ODR_CONTEXT, 101, Z_Query_type_101, z_RPNQuery},
712 if (o->direction == ODR_DECODE)
713 *p = odr_malloc(o, sizeof(**p));
716 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
719 return opt && odr_ok(o);
722 int z_SearchRequest(ODR o, Z_SearchRequest **p, int opt)
726 if (!odr_sequence_begin(o, p, sizeof(**p)))
727 return opt && odr_ok(o);
730 z_ReferenceId(o, &pp->referenceId, 1) &&
731 odr_implicit(o, odr_integer, &pp->smallSetUpperBound, ODR_CONTEXT,
733 odr_implicit(o, odr_integer, &pp->largeSetLowerBound, ODR_CONTEXT,
735 odr_implicit(o, odr_integer, &pp->mediumSetPresentNumber, ODR_CONTEXT,
737 odr_implicit(o, odr_bool, &pp->replaceIndicator, ODR_CONTEXT, 16, 1) &&
738 odr_implicit(o, odr_visiblestring, &pp->resultSetName, ODR_CONTEXT,
740 odr_implicit_settag(o, ODR_CONTEXT, 18) &&
741 odr_sequence_of(o, z_DatabaseName, &pp->databaseNames,
742 &pp->num_databaseNames) &&
743 odr_explicit(o, z_ElementSetNames, &pp->smallSetElementSetNames,
744 ODR_CONTEXT, 100, 1) &&
745 odr_explicit(o, z_ElementSetNames, &pp->mediumSetElementSetNames,
746 ODR_CONTEXT, 101, 1) &&
747 odr_implicit(o, odr_oid, &pp->preferredRecordSyntax,
748 ODR_CONTEXT, 104, 1) &&
749 odr_explicit(o, z_Query, &pp->query, ODR_CONTEXT, 21, 0) &&
751 odr_implicit(o, z_OtherInformation, &(*p)->additionalSearchInfo,
752 ODR_CONTEXT, 203, 1) &&
753 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
758 /* ------------------------ RECORD ------------------------- */
760 int z_DatabaseRecord(ODR o, Z_DatabaseRecord **p, int opt)
762 return z_External(o, (Z_External **) p, opt);
767 int z_DefaultDiagFormat(ODR o, Z_DefaultDiagFormat **p, int opt)
769 static Odr_arm arm[] =
771 {-1, -1, -1, Z_DiagForm_v2AddInfo, odr_visiblestring},
772 {-1, -1, -1, Z_DiagForm_v3AddInfo, z_InternationalString},
773 {ODR_IMPLICIT, ODR_CONTEXT, ODR_VISIBLESTRING, Z_DiagForm_v2AddInfo,
774 odr_visiblestring}, /* To cater to a bug in the CNIDR servers */
777 if (!odr_sequence_begin(o, p, sizeof(**p)))
778 return opt && odr_ok(o);
780 odr_oid(o, &(*p)->diagnosticSetId, 1) && /* SHOULD NOT BE OPT! */
781 odr_integer(o, &(*p)->condition, 0) &&
783 * I no longer recall what server tagged the addinfo.. but it isn't
784 * hurting anyone, so...
785 * We need to turn it into a choice, or something, because of
786 * that damn generalstring in v3.
788 odr_choice(o, arm, &(*p)->addinfo, &(*p)->which) &&
792 int z_DiagRec(ODR o, Z_DiagRec **p, int opt)
794 static Odr_arm arm[] =
796 {-1, -1, -1, Z_DiagRec_defaultFormat, z_DefaultDiagFormat},
797 {-1, -1, -1, Z_DiagRec_externallyDefined, z_External},
801 if (o->direction == ODR_DECODE)
802 *p = odr_malloc(o, sizeof(**p));
805 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
808 return opt && odr_ok(o);
813 int z_DiagRec(ODR o, Z_DiagRec **p, int opt)
815 if (!odr_sequence_begin(o, p, sizeof(**p)))
816 return opt && odr_ok(o);
818 odr_oid(o, &(*p)->diagnosticSetId, 1) && /* SHOULD NOT BE OPT! */
819 odr_integer(o, &(*p)->condition, 0) &&
821 * I no longer recall what server tagged the addinfo.. but it isn't
822 * hurting anyone, so...
823 * We need to turn it into a choice, or something, because of
824 * that damn generalstring in v3.
826 (odr_visiblestring(o, &(*p)->addinfo, 0) ||
827 odr_implicit(o, odr_cstring, &(*p)->addinfo, ODR_CONTEXT,
828 ODR_VISIBLESTRING, 1)) &&
834 int z_DiagRecs(ODR o, Z_DiagRecs **p, int opt)
836 if (o->direction == ODR_DECODE)
837 *p = odr_malloc(o, sizeof(**p));
841 if (odr_sequence_of(o, z_DiagRec, &(*p)->diagRecs,
842 &(*p)->num_diagRecs))
848 int z_NamePlusRecord(ODR o, Z_NamePlusRecord **p, int opt)
850 static Odr_arm arm[] =
852 {ODR_EXPLICIT, ODR_CONTEXT, 1, Z_NamePlusRecord_databaseRecord,
854 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_NamePlusRecord_surrogateDiagnostic,
859 if (!odr_sequence_begin(o, p, sizeof(**p)))
860 return opt && odr_ok(o);
862 odr_implicit(o, z_DatabaseName, &(*p)->databaseName, ODR_CONTEXT,
864 odr_constructed_begin(o, &(*p)->u, ODR_CONTEXT, 1) &&
865 odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
866 odr_constructed_end(o) &&
870 int z_NamePlusRecordList(ODR o, Z_NamePlusRecordList **p, int opt)
872 if (o->direction == ODR_DECODE)
873 *p = odr_malloc(o, sizeof(**p));
876 if (odr_sequence_of(o, z_NamePlusRecord, &(*p)->records,
883 int z_Records(ODR o, Z_Records **p, int opt)
885 static Odr_arm arm[] =
887 {ODR_IMPLICIT, ODR_CONTEXT, 28, Z_Records_DBOSD, z_NamePlusRecordList},
888 {ODR_IMPLICIT, ODR_CONTEXT, 130, Z_Records_NSD, z_DiagRec},
889 {ODR_IMPLICIT, ODR_CONTEXT, 205, Z_Records_multipleNSD,
894 if (o->direction == ODR_DECODE)
895 *p = odr_malloc(o, sizeof(**p));
898 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
901 return opt && odr_ok(o);
904 /* ------------------------ ACCESS CTRL SERVICE ----------------------- */
906 int z_AccessControlRequest(ODR o, Z_AccessControlRequest **p, int opt)
908 static Odr_arm arm[] =
910 {ODR_IMPLICIT, ODR_CONTEXT, 37, Z_AccessRequest_simpleForm,
912 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_AccessRequest_externallyDefined,
916 if (!odr_sequence_begin(o, p, sizeof(**p)))
917 return opt && odr_ok(o);
919 z_ReferenceId(o, &(*p)->referenceId, 1) &&
920 odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
922 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
927 int z_AccessControlResponse(ODR o, Z_AccessControlResponse **p, int opt)
929 static Odr_arm arm[] =
931 {ODR_IMPLICIT, ODR_CONTEXT, 38, Z_AccessResponse_simpleForm,
933 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_AccessResponse_externallyDefined,
937 if (!odr_sequence_begin(o, p, sizeof(**p)))
938 return opt && odr_ok(o);
940 z_ReferenceId(o, &(*p)->referenceId, 1) &&
941 odr_choice(o, arm, &(*p)->u, &(*p)->which) &&
942 odr_explicit(o, z_DiagRec, &(*p)->diagnostic, ODR_CONTEXT, 223, 1) &&
944 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
949 /* ------------------------ SCAN SERVICE -------------------- */
951 int z_AttributeList(ODR o, Z_AttributeList **p, int opt)
953 if (o->direction == ODR_DECODE)
954 *p = odr_malloc(o, sizeof(**p));
958 odr_implicit_settag(o, ODR_CONTEXT, 44);
959 if (odr_sequence_of(o, z_AttributeElement, &(*p)->attributes,
960 &(*p)->num_attributes))
963 return opt && odr_ok(o);
967 * This is a temporary hack. We don't know just *what* old version of the
968 * protocol willow uses, so we'll just patiently wait for them to update
970 static int willow_scan = 0;
972 int z_WillowAttributesPlusTerm(ODR o, Z_AttributesPlusTerm **p, int opt)
974 if (!*p && o->direction != ODR_DECODE)
976 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 4))
979 return opt && odr_ok(o);
981 if (!odr_constructed_begin(o, p, ODR_CONTEXT, 1))
983 if (!odr_constructed_begin(o, p, ODR_UNIVERSAL, ODR_SEQUENCE))
985 if (!odr_implicit_settag(o, ODR_CONTEXT, 44))
987 if (o->direction == ODR_DECODE)
988 *p = odr_malloc(o, sizeof(**p));
989 if (!odr_sequence_of(o, z_AttributeElement, &(*p)->attributeList,
990 &(*p)->num_attributes))
992 if (!odr_sequence_end(o) || !odr_sequence_end(o))
994 if (!z_Term(o, &(*p)->term, 0))
996 if (!odr_constructed_end(o))
1002 int z_AlternativeTerm(ODR o, Z_AlternativeTerm **p, int opt)
1004 if (o->direction == ODR_DECODE)
1005 *p = odr_malloc(o, sizeof(**p));
1009 return opt && odr_ok(o);
1012 if (odr_sequence_of(o, z_AttributesPlusTerm, &(*p)->terms,
1016 return opt && !o->error;
1019 int z_OccurrenceByAttributes(ODR o, Z_OccurrenceByAttributes **p, int opt)
1021 if (!odr_sequence_begin(o, p, sizeof(**p)))
1022 return opt && odr_ok(o);
1024 odr_explicit(o, z_AttributeList, &(*p)->attributes, ODR_CONTEXT, 1, 1)&&
1025 odr_explicit(o, odr_integer, &(*p)->global, ODR_CONTEXT, 2, 1) &&
1026 odr_sequence_end(o);
1029 int z_TermInfo(ODR o, Z_TermInfo **p, int opt)
1031 if (!odr_sequence_begin(o, p, sizeof(**p)))
1032 return opt && odr_ok(o);
1035 odr_implicit(o, z_Term, &(*p)->term, ODR_CONTEXT, 1, 0) :
1036 z_Term(o, &(*p)->term, 0)) &&
1037 z_AttributeList(o, &(*p)->suggestedAttributes, 1) &&
1038 odr_implicit(o, z_AlternativeTerm, &(*p)->alternativeTerm,
1039 ODR_CONTEXT, 4, 1) &&
1040 odr_implicit(o, odr_integer, &(*p)->globalOccurrences, ODR_CONTEXT,
1042 odr_implicit(o, z_OccurrenceByAttributes, &(*p)->byAttributes,
1043 ODR_CONTEXT, 3, 1) &&
1044 odr_sequence_end(o);
1047 int z_Entry(ODR o, Z_Entry **p, int opt)
1049 static Odr_arm arm[] =
1051 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Entry_termInfo, z_TermInfo},
1052 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_Entry_surrogateDiagnostic,
1057 if (o->direction == ODR_DECODE)
1058 *p = odr_malloc(o, sizeof(**p));
1062 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
1065 return opt && odr_ok(o);
1068 int z_Entries(ODR o, Z_Entries **p, int opt)
1070 if (o->direction == ODR_DECODE)
1071 *p = odr_malloc(o, sizeof(**p));
1075 if (odr_sequence_of(o, z_Entry, &(*p)->entries,
1076 &(*p)->num_entries))
1082 int z_ListEntries(ODR o, Z_ListEntries **p, int opt)
1084 static Odr_arm arm[] =
1086 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ListEntries_entries, z_Entries},
1087 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ListEntries_nonSurrogateDiagnostics,
1092 if (o->direction == ODR_DECODE)
1093 *p = odr_malloc(o, sizeof(**p));
1097 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
1100 return opt && odr_ok(o);
1103 int z_ScanRequest(ODR o, Z_ScanRequest **p, int opt)
1105 if (!odr_sequence_begin(o, p, sizeof(**p)))
1106 return opt && odr_ok(o);
1109 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1110 odr_implicit_settag(o, ODR_CONTEXT, 3) &&
1111 odr_sequence_of(o, z_DatabaseName, &(*p)->databaseNames,
1112 &(*p)->num_databaseNames) &&
1113 odr_oid(o, &(*p)->attributeSet, 1) &&
1114 (z_AttributesPlusTerm(o, &(*p)->termListAndStartPoint, 1) ?
1115 ((*p)->termListAndStartPoint ? 1 :
1116 z_WillowAttributesPlusTerm(o, &(*p)->termListAndStartPoint, 0)) : 0) &&
1117 odr_implicit(o, odr_integer, &(*p)->stepSize, ODR_CONTEXT, 5, 1) &&
1118 odr_implicit(o, odr_integer, &(*p)->numberOfTermsRequested,
1119 ODR_CONTEXT, 6, 0) &&
1120 odr_implicit(o, odr_integer, &(*p)->preferredPositionInResponse,
1121 ODR_CONTEXT, 7, 1) &&
1122 odr_sequence_end(o);
1125 int z_ScanResponse(ODR o, Z_ScanResponse **p, int opt)
1127 if (!odr_sequence_begin(o, p, sizeof(**p)))
1128 return opt && odr_ok(o);
1130 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1131 odr_implicit(o, odr_integer, &(*p)->stepSize, ODR_CONTEXT, 3, 1) &&
1132 odr_implicit(o, odr_integer, &(*p)->scanStatus, ODR_CONTEXT, 4, 0) &&
1133 odr_implicit(o, odr_integer, &(*p)->numberOfEntriesReturned,
1134 ODR_CONTEXT, 5, 0) &&
1135 odr_implicit(o, odr_integer, &(*p)->positionOfTerm, ODR_CONTEXT, 6, 1)&&
1136 odr_explicit(o, z_ListEntries, &(*p)->entries, ODR_CONTEXT, 7, 1) &&
1137 odr_implicit(o, odr_oid, &(*p)->attributeSet, ODR_CONTEXT, 8, 1) &&
1138 odr_sequence_end(o);
1141 /* ------------------------ SEARCHRESPONSE ----------------*/
1143 int z_NumberOfRecordsReturned(ODR o, int **p, int opt)
1145 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 24, opt);
1148 int z_NextResultSetPosition(ODR o, int **p, int opt)
1150 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 25, opt);
1153 int z_PresentStatus(ODR o, int **p, int opt)
1155 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 27, opt);
1158 int z_SearchResponse(ODR o, Z_SearchResponse **p, int opt)
1160 Z_SearchResponse *pp;
1162 if (!odr_sequence_begin(o, p, sizeof(**p)))
1163 return opt && odr_ok(o);
1166 z_ReferenceId(o, &pp->referenceId, 1) &&
1167 odr_implicit(o, odr_integer, &pp->resultCount, ODR_CONTEXT, 23, 0) &&
1168 z_NumberOfRecordsReturned(o, &pp->numberOfRecordsReturned, 0) &&
1169 z_NextResultSetPosition(o, &pp->nextResultSetPosition, 0) &&
1170 odr_implicit(o, odr_bool, &pp->searchStatus, ODR_CONTEXT, 22, 0) &&
1171 odr_implicit(o, odr_integer, &pp->resultSetStatus, ODR_CONTEXT, 26,
1173 z_PresentStatus(o, &pp->presentStatus, 1) &&
1174 z_Records(o, &pp->records, 1) &&
1176 odr_implicit(o, z_OtherInformation, &(*p)->additionalSearchInfo,
1177 ODR_CONTEXT, 203, 1) &&
1178 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1180 odr_sequence_end(o);
1183 /* --------------------- PRESENT SERVICE ---------------------- */
1185 int z_ElementSpec(ODR o, Z_ElementSpec **p, int opt)
1187 static Odr_arm arm[] =
1189 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ElementSpec_elementSetName,
1191 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ElementSpec_externalSpec,
1196 if (o->direction == ODR_DECODE)
1197 *p = odr_malloc(o, sizeof(**p));
1201 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
1204 return opt && odr_ok(o);
1207 int z_Specification(ODR o, Z_Specification **p, int opt)
1209 if (!odr_sequence_begin(o, p, sizeof(**p)))
1210 return opt && odr_ok(o);
1212 odr_implicit(o, odr_oid, &(*p)->schema, ODR_CONTEXT, 1, 1) &&
1213 z_ElementSpec(o, &(*p)->elementSpec, 1) &&
1214 odr_sequence_end(o);
1217 int z_DbSpecific(ODR o, Z_DbSpecific **p, int opt)
1219 if (!odr_sequence_begin(o, p, sizeof(**p)))
1220 return opt && odr_ok(o);
1222 odr_explicit(o, z_DatabaseName, &(*p)->databaseName, ODR_CONTEXT,
1224 odr_implicit(o, z_Specification, &(*p)->spec, ODR_CONTEXT, 2, 0) &&
1225 odr_sequence_end(o);
1228 int z_CompSpec(ODR o, Z_CompSpec **p, int opt)
1230 if (!odr_sequence_begin(o, p, sizeof(**p)))
1231 return opt && odr_ok(o);
1233 odr_implicit(o, odr_bool, &(*p)->selectAlternativeSyntax, ODR_CONTEXT,
1235 odr_implicit(o, z_Specification, &(*p)->generic, ODR_CONTEXT, 2, 1) &&
1236 odr_implicit_settag(o, ODR_CONTEXT, 3) &&
1237 (odr_sequence_of(o, z_DbSpecific, &(*p)->dbSpecific,
1238 &(*p)->num_dbSpecific) || odr_ok(o)) &&
1239 odr_implicit_settag(o, ODR_CONTEXT, 4) &&
1240 (odr_sequence_of(o, odr_oid, &(*p)->recordSyntax,
1241 &(*p)->num_recordSyntax) || odr_ok(o)) &&
1242 odr_sequence_end(o);
1245 int z_RecordComposition(ODR o, Z_RecordComposition **p, int opt)
1247 static Odr_arm arm[] =
1249 {ODR_EXPLICIT, ODR_CONTEXT, 19, Z_RecordComp_simple,
1251 {ODR_IMPLICIT, ODR_CONTEXT, 209, Z_RecordComp_complex,
1256 if (o->direction == ODR_DECODE)
1257 *p = odr_malloc(o, sizeof(**p));
1261 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
1264 return opt && odr_ok(o);
1267 int z_Range(ODR o, Z_Range **p, int opt)
1269 if (!odr_sequence_begin(o, p, sizeof(**p)))
1270 return opt && odr_ok(o);
1272 odr_implicit(o, odr_integer, &(*p)->startingPosition, ODR_CONTEXT,
1274 odr_implicit(o, odr_integer, &(*p)->numberOfRecords, ODR_CONTEXT,
1276 odr_sequence_end(o);
1279 int z_PresentRequest(ODR o, Z_PresentRequest **p, int opt)
1281 Z_PresentRequest *pp;
1283 if (!odr_sequence_begin(o, p, sizeof(**p)))
1284 return opt && odr_ok(o);
1287 z_ReferenceId(o, &pp->referenceId, 1) &&
1288 z_ResultSetId(o, &pp->resultSetId, 0) &&
1289 odr_implicit(o, odr_integer, &pp->resultSetStartPoint, ODR_CONTEXT,
1291 odr_implicit(o, odr_integer, &pp->numberOfRecordsRequested, ODR_CONTEXT,
1294 odr_implicit_settag(o, ODR_CONTEXT, 212) &&
1295 (odr_sequence_of(o, z_Range, &(*p)->additionalRanges,
1296 &(*p)->num_ranges) || odr_ok(o)) &&
1297 z_RecordComposition(o, &(*p)->recordComposition, 1) &&
1299 odr_explicit(o, z_ElementSetNames, &pp->elementSetNames, ODR_CONTEXT,
1302 odr_implicit(o, odr_oid, &(*p)->preferredRecordSyntax, ODR_CONTEXT,
1305 odr_implicit(o, odr_integer, &(*p)->maxSegmentCount, ODR_CONTEXT,
1307 odr_implicit(o, odr_integer, &(*p)->maxRecordSize, ODR_CONTEXT,
1309 odr_implicit(o, odr_integer, &(*p)->maxSegmentSize, ODR_CONTEXT,
1311 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1313 odr_sequence_end(o);
1316 int z_PresentResponse(ODR o, Z_PresentResponse **p, int opt)
1318 Z_PresentResponse *pp;
1320 if (!odr_sequence_begin(o, p, sizeof(**p)))
1321 return opt && odr_ok(o);
1324 z_ReferenceId(o, &pp->referenceId, 1) &&
1325 z_NumberOfRecordsReturned(o, &pp->numberOfRecordsReturned, 0) &&
1326 z_NextResultSetPosition(o, &pp->nextResultSetPosition, 0) &&
1327 z_PresentStatus(o, &pp->presentStatus, 0) &&
1328 z_Records(o, &pp->records, 1) &&
1330 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1332 odr_sequence_end(o);
1335 /* ----------------------DELETE -------------------------- */
1337 int z_DeleteSetStatus(ODR o, int **p, int opt)
1339 return odr_implicit(o, odr_integer, p, ODR_CONTEXT, 33, opt);
1342 int z_ListStatus(ODR o, Z_ListStatus **p, int opt)
1344 if (!odr_sequence_begin(o, p, sizeof(**p)))
1345 return opt && odr_ok(o);
1347 z_ResultSetId(o, &(*p)->id, 0) &&
1348 z_DeleteSetStatus(o, &(*p)->status, 0) &&
1349 odr_sequence_end(o);
1352 int z_DeleteResultSetRequest(ODR o, Z_DeleteResultSetRequest **p, int opt)
1354 if (!odr_sequence_begin(o, p, sizeof(**p)))
1355 return opt && odr_ok(o);
1357 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1358 odr_implicit(o, odr_integer, &(*p)->deleteFunction, ODR_CONTEXT, 32,
1360 (odr_sequence_of(o, z_ListStatus, &(*p)->resultSetList,
1361 &(*p)->num_ids) || odr_ok(o)) &&
1363 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1365 odr_sequence_end(o);
1368 int z_DeleteResultSetResponse(ODR o, Z_DeleteResultSetResponse **p, int opt)
1370 if (!odr_sequence_begin(o, p, sizeof(**p)))
1371 return opt && odr_ok(o);
1373 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1374 odr_implicit(o, z_DeleteSetStatus, &(*p)->deleteOperationStatus,
1375 ODR_CONTEXT, 0, 1) &&
1376 odr_implicit_settag(o, ODR_CONTEXT, 1) &&
1377 (odr_sequence_of(o, z_ListStatus, &(*p)->deleteListStatuses,
1378 &(*p)->num_statuses) || odr_ok(o)) &&
1379 odr_implicit(o, odr_integer, &(*p)->numberNotDeleted, ODR_CONTEXT,
1381 odr_implicit_settag(o, ODR_CONTEXT, 35) &&
1382 (odr_sequence_of(o, z_ListStatus, &(*p)->bulkStatuses,
1383 &(*p)->num_bulkStatuses) || odr_ok(o)) &&
1384 odr_implicit(o, odr_visiblestring, &(*p)->deleteMessage, ODR_CONTEXT,
1387 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1389 odr_sequence_end(o);
1392 /* ------------------------ SEGMENT SERVICE -------------- */
1394 int z_Segment(ODR o, Z_Segment **p, int opt)
1396 if (!odr_sequence_begin(o, p, sizeof(**p)))
1397 return opt && odr_ok(o);
1399 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1400 odr_implicit(o, odr_integer, &(*p)->numberOfRecordsReturned,
1401 ODR_CONTEXT, 24, 0) &&
1402 odr_implicit_settag(o, ODR_CONTEXT, 0) &&
1403 odr_sequence_of(o, z_NamePlusRecord, &(*p)->segmentRecords,
1404 &(*p)->num_segmentRecords) &&
1405 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1406 odr_sequence_end(o);
1409 /* ------------------------ CLOSE SERVICE ---------------- */
1411 int z_Close(ODR o, Z_Close **p, int opt)
1413 if (!odr_sequence_begin(o, p, sizeof(**p)))
1414 return opt && odr_ok(o);
1416 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1417 odr_implicit(o, odr_integer, &(*p)->closeReason, ODR_CONTEXT, 211, 0) &&
1418 odr_implicit(o, odr_visiblestring, &(*p)->diagnosticInformation,
1419 ODR_CONTEXT, 3, 1) &&
1420 odr_implicit(o, odr_oid, &(*p)->resourceReportFormat, ODR_CONTEXT,
1422 odr_implicit(o, z_External, &(*p)->resourceReport, ODR_CONTEXT,
1425 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1427 odr_sequence_end(o);
1430 /* ------------------------ APDU ------------------------- */
1432 int z_Permissions(ODR o, Z_Permissions **p, int opt)
1434 if (!odr_sequence_begin(o, p, sizeof(**p)))
1435 return opt && odr_ok(o);
1437 odr_implicit(o, z_InternationalString, &(*p)->userId, ODR_CONTEXT,
1439 odr_implicit_settag(o, ODR_CONTEXT, 2) &&
1440 odr_sequence_of(o, odr_integer, &(*p)->allowableFunctions,
1441 &(*p)->num_allowableFunctions) &&
1442 odr_sequence_end(o);
1445 int z_ExtendedServicesRequest(ODR o, Z_ExtendedServicesRequest **p, int opt)
1447 if (!odr_sequence_begin(o, p, sizeof(**p)))
1448 return opt && odr_ok(o);
1450 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1451 odr_implicit(o, odr_integer, &(*p)->function, ODR_CONTEXT, 3, 0) &&
1452 odr_implicit(o, odr_oid, &(*p)->packageType, ODR_CONTEXT, 4, 0) &&
1453 odr_implicit(o, z_InternationalString, &(*p)->packageName, ODR_CONTEXT, 5, 1) &&
1454 odr_implicit(o, z_InternationalString, &(*p)->userId, ODR_CONTEXT, 6, 1) &&
1455 odr_implicit(o, z_IntUnit, &(*p)->retentionTime, ODR_CONTEXT, 7, 1) &&
1456 odr_implicit(o, z_Permissions, &(*p)->permissions, ODR_CONTEXT, 8, 1) &&
1457 odr_implicit(o, z_InternationalString, &(*p)->description, ODR_CONTEXT, 9, 1) &&
1458 odr_implicit(o, z_External, &(*p)->taskSpecificParameters, ODR_CONTEXT, 10, 1) &&
1459 odr_implicit(o, odr_integer, &(*p)->waitAction, ODR_CONTEXT, 11, 0) &&
1460 z_ElementSetName(o, &(*p)->elements, 1) &&
1461 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1462 odr_sequence_end(o);
1465 int z_ExtendedServicesResponse(ODR o, Z_ExtendedServicesResponse **p, int opt)
1467 if (!odr_sequence_begin(o, p, sizeof(**p)))
1468 return opt && odr_ok(o);
1470 z_ReferenceId(o, &(*p)->referenceId, 1) &&
1471 odr_implicit(o, odr_integer, &(*p)->operationStatus, ODR_CONTEXT, 3, 0) &&
1472 odr_implicit_settag(o, ODR_CONTEXT, 4) &&
1473 (odr_sequence_of(o, z_DiagRec, &(*p)->diagnostics,
1474 &(*p)->num_diagnostics) || odr_ok(o)) &&
1475 odr_implicit(o, z_External, &(*p)->taskPackage, ODR_CONTEXT, 5, 1) &&
1476 z_OtherInformation(o, &(*p)->otherInfo, 1) &&
1477 odr_sequence_end(o);
1480 /* ------------------------ APDU ------------------------- */
1482 int z_APDU(ODR o, Z_APDU **p, int opt)
1484 static Odr_arm arm[] =
1486 {ODR_IMPLICIT, ODR_CONTEXT, 20, Z_APDU_initRequest, z_InitRequest},
1487 {ODR_IMPLICIT, ODR_CONTEXT, 21, Z_APDU_initResponse, z_InitResponse},
1488 {ODR_IMPLICIT, ODR_CONTEXT, 22, Z_APDU_searchRequest, z_SearchRequest},
1489 {ODR_IMPLICIT, ODR_CONTEXT, 23, Z_APDU_searchResponse,
1491 {ODR_IMPLICIT, ODR_CONTEXT, 24, Z_APDU_presentRequest,
1493 {ODR_IMPLICIT, ODR_CONTEXT, 25, Z_APDU_presentResponse,
1495 {ODR_IMPLICIT, ODR_CONTEXT, 26, Z_APDU_deleteResultSetRequest,
1496 z_DeleteResultSetRequest},
1497 {ODR_IMPLICIT, ODR_CONTEXT, 27, Z_APDU_deleteResultSetResponse,
1498 z_DeleteResultSetResponse},
1499 {ODR_IMPLICIT, ODR_CONTEXT, 30, Z_APDU_resourceControlRequest,
1500 z_ResourceControlRequest},
1501 {ODR_IMPLICIT, ODR_CONTEXT, 31, Z_APDU_resourceControlResponse,
1502 z_ResourceControlResponse},
1503 {ODR_IMPLICIT, ODR_CONTEXT, 32, Z_APDU_triggerResourceControlRequest,
1504 z_TriggerResourceControlRequest},
1505 {ODR_IMPLICIT, ODR_CONTEXT, 35, Z_APDU_scanRequest, z_ScanRequest},
1506 {ODR_IMPLICIT, ODR_CONTEXT, 36, Z_APDU_scanResponse, z_ScanResponse},
1507 {ODR_IMPLICIT, ODR_CONTEXT, 45, Z_APDU_segmentRequest, z_Segment},
1508 {ODR_IMPLICIT, ODR_CONTEXT, 46, Z_APDU_extendedServicesRequest,
1509 z_ExtendedServicesRequest},
1510 {ODR_IMPLICIT, ODR_CONTEXT, 47, Z_APDU_extendedServicesResponse,
1511 z_ExtendedServicesResponse},
1512 {ODR_IMPLICIT, ODR_CONTEXT, 48, Z_APDU_close, z_Close},
1517 if (o->direction == ODR_DECODE)
1518 *p = odr_malloc(o, sizeof(**p));
1519 if (!odr_choice(o, arm, &(*p)->u, &(*p)->which))
1521 if (o->direction == ODR_DECODE)
1523 return opt && odr_ok(o);