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