YAZ  5.23.1
odr_use.c
Go to the documentation of this file.
1 /* This file is part of the YAZ toolkit.
2  * Copyright (C) Index Data
3  * See the file LICENSE for details.
4  */
9 #if HAVE_CONFIG_H
10 #include <config.h>
11 #endif
12 
13 #include "odr-priv.h"
14 
15 int odr_external(ODR o, Odr_external **p, int opt, const char *name)
16 {
17  Odr_external *pp;
18  static Odr_arm arm[] =
19  {
21  (Odr_fun)odr_any, "single"},
23  (Odr_fun)odr_octetstring, "octet"},
25  (Odr_fun)odr_bitstring, "arbitrary"},
26  {-1, -1, -1, -1, 0, 0}
27  };
28 
30  if (!odr_sequence_begin(o, p, sizeof(Odr_external), name))
31  return odr_missing(o, opt, name);
32  pp = *p;
33  return
34  odr_oid(o, &pp->direct_reference, 1, "direct") &&
35  odr_integer(o, &pp->indirect_reference, 1, "indirect") &&
36  odr_graphicstring(o, &pp->descriptor, 1, "descriptor") &&
37  odr_choice(o, arm, &pp->u, &pp->which, 0) &&
39 }
40 
41 int odr_visiblestring(ODR o, char **p, int opt, const char *name)
42 {
44  ODR_VISIBLESTRING, opt, name);
45 }
46 
47 /*
48  * a char may not be sufficient to hold a general string, but we'll deal
49  * with that once we start looking more closely at UniCode & co.
50  */
51 int odr_generalstring(ODR o, char **p, int opt, const char *name)
52 {
54  ODR_GENERALSTRING,opt, name);
55 }
56 
57 int odr_graphicstring(ODR o, char **p, int opt, const char *name)
58 {
60  ODR_GRAPHICSTRING, opt, name);
61 }
62 
63 int odr_generalizedtime(ODR o, char **p, int opt, const char *name)
64 {
66  ODR_GENERALIZEDTIME, opt, name);
67 }
68 /*
69  * Local variables:
70  * c-basic-offset: 4
71  * c-file-style: "Stroustrup"
72  * indent-tabs-mode: nil
73  * End:
74  * vim: shiftwidth=4 tabstop=8 expandtab
75  */
76 
int odr_cstring(ODR o, char **p, int opt, const char *name)
Definition: odr_oct.c:60
#define ODR_UNIVERSAL
Definition: odr.h:65
#define ODR_EXTERNAL_arbitrary
Definition: odr.h:301
#define odr_implicit_tag(o, t, p, cl, tg, opt, name)
Definition: odr.h:192
int odr_sequence_begin(ODR o, void *p, int size, const char *name)
Definition: odr_seq.c:15
char * name
Definition: initopt.c:18
int odr_graphicstring(ODR o, char **p, int opt, const char *name)
Definition: odr_use.c:57
int odr_visiblestring(ODR o, char **p, int opt, const char *name)
Definition: odr_use.c:41
#define ODR_EXTERNAL_octet
Definition: odr.h:300
int odr_any(ODR o, Odr_any **p, int opt, const char *name)
Definition: odr_any.c:23
Internal ODR definitions.
#define ODR_GENERALIZEDTIME
Definition: odr.h:87
#define ODR_VISIBLESTRING
Definition: odr.h:89
Odr_int * indirect_reference
Definition: odr.h:296
#define ODR_GENERALSTRING
Definition: odr.h:90
int odr_integer(ODR o, Odr_int **p, int opt, const char *name)
Definition: odr_int.c:19
char * descriptor
Definition: odr.h:297
int odr_choice(ODR o, Odr_arm arm[], void *p, void *whichp, const char *name)
Definition: odr_choice.c:17
int odr_generalstring(ODR o, char **p, int opt, const char *name)
Definition: odr_use.c:51
#define ODR_EXPLICIT
Definition: odr.h:60
int odr_external(ODR o, Odr_external **p, int opt, const char *name)
Definition: odr_use.c:15
int(* Odr_fun)(ODR, char **, int, const char *)
Definition: odr.h:135
Definition: odr.h:137
int odr_missing(ODR o, int opt, const char *name)
Definition: odr_util.c:82
Definition: odr.h:124
int odr_sequence_end(ODR o)
Definition: odr_seq.c:61
int opt
Definition: initopt.c:19
union Odr_external::@29 u
#define ODR_IMPLICIT
Definition: odr.h:59
int odr_oid(ODR o, Odr_oid **p, int opt, const char *name)
Definition: odr_oid.c:20
int which
Definition: odr.h:298
int odr_iconv_string(ODR o, char **p, int opt, const char *name)
Definition: odr_oct.c:107
#define ODR_EXTERNAL
Definition: odr.h:80
int odr_octetstring(ODR o, Odr_oct **p, int opt, const char *name)
Definition: odr_oct.c:19
#define ODR_EXTERNAL_single
Definition: odr.h:299
int odr_bitstring(ODR o, Odr_bitmask **p, int opt, const char *name)
Definition: odr_bit.c:22
#define ODR_GRAPHICSTRING
Definition: odr.h:88
int odr_generalizedtime(ODR o, char **p, int opt, const char *name)
Definition: odr_use.c:63
#define ODR_CONTEXT
Definition: odr.h:67
Odr_oid * direct_reference
Definition: odr.h:295
int odr_implicit_settag(ODR o, int zclass, int tag)
Definition: odr_tag.c:32