2 * Copyright (C) 1995-2007, Index Data ApS
3 * See the file LICENSE for details.
5 * $Id: odr_enum.c,v 1.7 2007/03/19 21:08:13 adam Exp $
9 * \brief Implements ODR ENUM codec
18 * Top level enum en/decoder.
19 * Returns 1 on success, 0 on error.
21 int odr_enum(ODR o, int **p, int opt, const char *name)
27 if (o->op->t_class < 0)
29 o->op->t_class = ODR_UNIVERSAL;
30 o->op->t_tag = ODR_ENUM;
32 res = ber_tag(o, p, o->op->t_class, o->op->t_tag, &cons, opt, name);
36 return odr_missing(o, opt, name);
37 if (o->direction == ODR_PRINT)
40 odr_printf(o, "%d\n", **p);
45 odr_seterror(o, OPROTO, 54);
48 if (o->direction == ODR_DECODE)
49 *p = (int *)odr_malloc(o, sizeof(int));
50 return ber_integer(o, *p);
55 * indent-tabs-mode: nil
57 * vim: shiftwidth=4 tabstop=8 expandtab