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