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