2 * Copyright (c) 1995, Index Data.
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.2 1995-08-17 12:45:00 quinn
8 * Fixed minor problems with GRS-1. Added support in c&s.
10 * Revision 1.1 1995/08/15 13:37:41 quinn
18 int z_External(ODR o, Z_External **p, int opt)
22 static Odr_arm arm[] =
24 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_single, odr_any},
25 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_External_octet, odr_octetstring},
26 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_External_arbitrary, odr_bitstring},
28 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_sutrs, z_SUTRS},
29 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_explainRecord,
31 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_resourceReport1,
33 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_resourceReport2,
35 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_promptObject1,
37 {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_grs1, z_GenericRecord},
41 * The table below should be moved to the ODR structure itself and
42 * be an image of the association context: To help
43 * map indirect references when they show up.
48 int what; /* discriminator value for the external CHOICE */
51 {VAL_SUTRS, Z_External_sutrs},
52 {VAL_EXPLAIN, Z_External_explainRecord},
53 {VAL_RESOURCE1, Z_External_resourceReport1},
54 {VAL_RESOURCE2, Z_External_resourceReport2},
55 {VAL_PROMPT1, Z_External_promptObject1},
56 {VAL_GRS1, Z_External_grs1},
60 odr_implicit_settag(o, ODR_UNIVERSAL, ODR_EXTERNAL);
61 if (!odr_sequence_begin(o, p, sizeof(**p)))
62 return opt && odr_ok(o);
63 if (!(odr_oid(o, &(*p)->direct_reference, 1) &&
64 odr_integer(o, &(*p)->indirect_reference, 1) &&
65 odr_graphicstring(o, &(*p)->descriptor, 1)))
68 * Do we know this beast?
70 if (o->direction == ODR_DECODE && (*p)->direct_reference &&
71 (oid = oid_getentbyoid((*p)->direct_reference)))
75 for (i = 0; tab[i].dref != VAL_NONE; i++)
76 if (oid->value == tab[i].dref)
78 odr_choice_bias(o, tab[i].what);
83 odr_choice(o, arm, &(*p)->u, &(*p)->which) &&