2 * Copyright (C) 1995-2005, Index Data ApS
3 * See the file LICENSE for details.
5 * $Id: odr_use.c,v 1.3 2005-01-15 19:47:14 adam Exp $
9 * \brief Implements misc ODR types.
17 int odr_external(ODR o, Odr_external **p, int opt, const char *name)
20 static Odr_arm arm[] =
22 {ODR_EXPLICIT, ODR_CONTEXT, 0, ODR_EXTERNAL_single,
23 (Odr_fun)odr_any, "single"},
24 {ODR_IMPLICIT, ODR_CONTEXT, 1, ODR_EXTERNAL_octet,
25 (Odr_fun)odr_octetstring, "octet"},
26 {ODR_IMPLICIT, ODR_CONTEXT, 2, ODR_EXTERNAL_arbitrary,
27 (Odr_fun)odr_bitstring, "arbitrary"},
28 {-1, -1, -1, -1, 0, 0}
31 odr_implicit_settag(o, ODR_UNIVERSAL, ODR_EXTERNAL);
32 if (!odr_sequence_begin(o, p, sizeof(Odr_external), name))
33 return odr_missing(o, opt, name);
36 odr_oid(o, &pp->direct_reference, 1, "direct") &&
37 odr_integer(o, &pp->indirect_reference, 1, "indirect") &&
38 odr_graphicstring(o, &pp->descriptor, 1, "descriptor") &&
39 odr_choice(o, arm, &pp->u, &pp->which, 0) &&
43 int odr_visiblestring(ODR o, char **p, int opt, const char *name)
45 return odr_implicit_tag(o, odr_cstring, p, ODR_UNIVERSAL,
46 ODR_VISIBLESTRING, opt, name);
50 * a char may not be sufficient to hold a general string, but we'll deal
51 * with that once we start looking more closely at UniCode & co.
53 int odr_generalstring(ODR o, char **p, int opt, const char *name)
55 return odr_implicit_tag(o, odr_iconv_string, p, ODR_UNIVERSAL,
56 ODR_GENERALSTRING,opt, name);
59 int odr_graphicstring(ODR o, char **p, int opt, const char *name)
61 return odr_implicit_tag(o, odr_cstring, p, ODR_UNIVERSAL,
62 ODR_GRAPHICSTRING, opt, name);
65 int odr_generalizedtime(ODR o, char **p, int opt, const char *name)
67 return odr_implicit_tag(o, odr_cstring, p, ODR_UNIVERSAL,
68 ODR_GENERALIZEDTIME, opt, name);