2 * Copyright (c) 1995-2003, Index Data
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
6 * $Id: odr_enum.c,v 1.8 2003-03-11 11:03:31 adam Exp $
15 * Top level enum en/decoder.
16 * Returns 1 on success, 0 on error.
18 int odr_enum(ODR o, int **p, int opt, const char *name)
26 o->t_class = ODR_UNIVERSAL;
29 if ((res = ber_tag(o, p, o->t_class, o->t_tag, &cons, opt)) < 0)
33 if (o->direction == ODR_PRINT)
36 fprintf(o->print, "%d\n", **p);
41 odr_seterror(o, OPROTO, 54);
44 if (o->direction == ODR_DECODE)
45 *p = (int *)odr_malloc(o, sizeof(int));
46 return ber_integer(o, *p);