2 * Copyright (c) 1995-2003, Index Data
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
6 * $Id: odr_use.c,v 1.14 2003-05-20 19:55:30 adam Exp $
14 int odr_external(ODR o, Odr_external **p, int opt, const char *name)
17 static Odr_arm arm[] =
19 {ODR_EXPLICIT, ODR_CONTEXT, 0, ODR_EXTERNAL_single,
20 (Odr_fun)odr_any, "single"},
21 {ODR_IMPLICIT, ODR_CONTEXT, 1, ODR_EXTERNAL_octet,
22 (Odr_fun)odr_octetstring, "octet"},
23 {ODR_IMPLICIT, ODR_CONTEXT, 2, ODR_EXTERNAL_arbitrary,
24 (Odr_fun)odr_bitstring, "arbitrary"},
25 {-1, -1, -1, -1, 0, 0}
28 odr_implicit_settag(o, ODR_UNIVERSAL, ODR_EXTERNAL);
29 if (!odr_sequence_begin(o, p, sizeof(Odr_external), name))
30 return odr_missing(o, opt, name);
33 odr_oid(o, &pp->direct_reference, 1, "direct") &&
34 odr_integer(o, &pp->indirect_reference, 1, "indirect") &&
35 odr_graphicstring(o, &pp->descriptor, 1, "descriptor") &&
36 odr_choice(o, arm, &pp->u, &pp->which, 0) &&
40 int odr_visiblestring(ODR o, char **p, int opt, const char *name)
42 return odr_implicit_tag(o, odr_cstring, p, ODR_UNIVERSAL,
43 ODR_VISIBLESTRING, opt, name);
47 * a char may not be sufficient to hold a general string, but we'll deal
48 * with that once we start looking more closely at UniCode & co.
50 int odr_generalstring(ODR o, char **p, int opt, const char *name)
52 return odr_implicit_tag(o, odr_iconv_string, p, ODR_UNIVERSAL,
53 ODR_GENERALSTRING,opt, name);
56 int odr_graphicstring(ODR o, char **p, int opt, const char *name)
58 return odr_implicit_tag(o, odr_cstring, p, ODR_UNIVERSAL,
59 ODR_GRAPHICSTRING, opt, name);
62 int odr_generalizedtime(ODR o, char **p, int opt, const char *name)
64 return odr_implicit_tag(o, odr_cstring, p, ODR_UNIVERSAL,
65 ODR_GENERALIZEDTIME, opt, name);