00001
00002
00003
00004
00009 #if HAVE_CONFIG_H
00010 #include <config.h>
00011 #endif
00012
00013 #include "odr-priv.h"
00014
00015 int odr_external(ODR o, Odr_external **p, int opt, const char *name)
00016 {
00017 Odr_external *pp;
00018 static Odr_arm arm[] =
00019 {
00020 {ODR_EXPLICIT, ODR_CONTEXT, 0, ODR_EXTERNAL_single,
00021 (Odr_fun)odr_any, "single"},
00022 {ODR_IMPLICIT, ODR_CONTEXT, 1, ODR_EXTERNAL_octet,
00023 (Odr_fun)odr_octetstring, "octet"},
00024 {ODR_IMPLICIT, ODR_CONTEXT, 2, ODR_EXTERNAL_arbitrary,
00025 (Odr_fun)odr_bitstring, "arbitrary"},
00026 {-1, -1, -1, -1, 0, 0}
00027 };
00028
00029 odr_implicit_settag(o, ODR_UNIVERSAL, ODR_EXTERNAL);
00030 if (!odr_sequence_begin(o, p, sizeof(Odr_external), name))
00031 return odr_missing(o, opt, name);
00032 pp = *p;
00033 return
00034 odr_oid(o, &pp->direct_reference, 1, "direct") &&
00035 odr_integer(o, &pp->indirect_reference, 1, "indirect") &&
00036 odr_graphicstring(o, &pp->descriptor, 1, "descriptor") &&
00037 odr_choice(o, arm, &pp->u, &pp->which, 0) &&
00038 odr_sequence_end(o);
00039 }
00040
00041 int odr_visiblestring(ODR o, char **p, int opt, const char *name)
00042 {
00043 return odr_implicit_tag(o, odr_cstring, p, ODR_UNIVERSAL,
00044 ODR_VISIBLESTRING, opt, name);
00045 }
00046
00047
00048
00049
00050
00051 int odr_generalstring(ODR o, char **p, int opt, const char *name)
00052 {
00053 return odr_implicit_tag(o, odr_iconv_string, p, ODR_UNIVERSAL,
00054 ODR_GENERALSTRING,opt, name);
00055 }
00056
00057 int odr_graphicstring(ODR o, char **p, int opt, const char *name)
00058 {
00059 return odr_implicit_tag(o, odr_cstring, p, ODR_UNIVERSAL,
00060 ODR_GRAPHICSTRING, opt, name);
00061 }
00062
00063 int odr_generalizedtime(ODR o, char **p, int opt, const char *name)
00064 {
00065 return odr_implicit_tag(o, odr_cstring, p, ODR_UNIVERSAL,
00066 ODR_GENERALIZEDTIME, opt, name);
00067 }
00068
00069
00070
00071
00072
00073
00074
00075
00076