2 * Copyright (c) 1995-1999, Index Data
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.4 1999-11-30 13:47:11 adam
8 * Improved installation. Moved header files to include/yaz.
10 * Revision 1.3 1999/04/20 09:56:48 adam
11 * Added 'name' paramter to encoder/decoder routines (typedef Odr_fun).
12 * Modified all encoders/decoders to reflect this change.
14 * Revision 1.2 1999/01/08 11:23:27 adam
15 * Added const modifier to some of the BER/ODR encoding routines.
17 * Revision 1.1 1998/03/20 14:45:01 adam
18 * Implemented odr_enum and odr_set_of.
25 * Top level enum en/decoder.
26 * Returns 1 on success, 0 on error.
28 int odr_enum(ODR o, int **p, int opt, const char *name)
36 o->t_class = ODR_UNIVERSAL;
39 if ((res = ber_tag(o, p, o->t_class, o->t_tag, &cons, opt)) < 0)
43 if (o->direction == ODR_PRINT)
46 fprintf(o->print, "%d\n", **p);
54 if (o->direction == ODR_DECODE)
55 *p = (int *)odr_malloc(o, sizeof(int));
56 return ber_integer(o, *p);