2 * Copyright (c) 1995-1999, Index Data
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.9 1999-04-20 09:56:48 adam
8 * Added 'name' paramter to encoder/decoder routines (typedef Odr_fun).
9 * Modified all encoders/decoders to reflect this change.
11 * Revision 1.8 1998/02/11 11:53:34 adam
12 * Changed code so that it compiles as C++.
14 * Revision 1.7 1995/09/29 17:12:27 quinn
17 * Revision 1.6 1995/09/27 15:03:00 quinn
18 * Modified function heads & prototypes.
20 * Revision 1.5 1995/08/10 08:54:47 quinn
23 * Revision 1.4 1995/06/16 13:16:12 quinn
24 * Fixed Defaultdiagformat.
26 * Revision 1.3 1995/05/16 08:51:00 quinn
27 * License, documentation, and memory fixes
29 * Revision 1.2 1995/02/09 15:51:50 quinn
32 * Revision 1.1 1995/02/03 17:04:39 quinn
40 int odr_external(ODR o, Odr_external **p, int opt, const char *name)
43 static Odr_arm arm[] =
45 {ODR_EXPLICIT, ODR_CONTEXT, 0, ODR_EXTERNAL_single,
46 (Odr_fun)odr_any, "single"},
47 {ODR_IMPLICIT, ODR_CONTEXT, 1, ODR_EXTERNAL_octet,
48 (Odr_fun)odr_octetstring, "octet"},
49 {ODR_IMPLICIT, ODR_CONTEXT, 2, ODR_EXTERNAL_arbitrary,
50 (Odr_fun)odr_bitstring, "arbitrary"},
51 {-1, -1, -1, -1, 0, 0}
54 odr_implicit_settag(o, ODR_UNIVERSAL, ODR_EXTERNAL);
55 if (!odr_sequence_begin(o, p, sizeof(Odr_external), name))
59 odr_oid(o, &pp->direct_reference, 1, "direct") &&
60 odr_integer(o, &pp->indirect_reference, 1, "indirect") &&
61 odr_graphicstring(o, &pp->descriptor, 1, "descriptor") &&
62 odr_choice(o, arm, &pp->u, &pp->which, 0) &&
66 int odr_visiblestring(ODR o, char **p, int opt, const char *name)
68 return odr_implicit_tag(o, odr_cstring, p, ODR_UNIVERSAL,
69 ODR_VISIBLESTRING, opt, name);
73 * a char may not be sufficient to hold a general string, but we'll deal
74 * with that once we start looking more closely at UniCode & co.
76 int odr_generalstring(ODR o, char **p, int opt, const char *name)
78 return odr_implicit_tag(o, odr_cstring, p, ODR_UNIVERSAL,
79 ODR_GENERALSTRING,opt, name);
82 int odr_graphicstring(ODR o, char **p, int opt, const char *name)
84 return odr_implicit_tag(o, odr_cstring, p, ODR_UNIVERSAL,
85 ODR_GRAPHICSTRING, opt, name);
88 int odr_generalizedtime(ODR o, char **p, int opt, const char *name)
90 return odr_implicit_tag(o, odr_cstring, p, ODR_UNIVERSAL,
91 ODR_GENERALIZEDTIME, opt, name);