2 * Copyright (C) 1995-2005, Index Data ApS
3 * See the file LICENSE for details.
5 * $Id: odr_bool.c,v 1.5 2005-06-25 15:46:04 adam Exp $
10 * \brief Implements ODR BOOLEAN codec
20 * Top level boolean en/decoder.
21 * Returns 1 on success, 0 on error.
23 int odr_bool(ODR o, int **p, int opt, const char *name)
31 o->t_class = ODR_UNIVERSAL;
32 o->t_tag = ODR_BOOLEAN;
34 if ((res = ber_tag(o, p, o->t_class, o->t_tag, &cons, opt, name)) < 0)
37 return odr_missing(o, opt, name);
38 if (o->direction == ODR_PRINT)
41 odr_printf(o, "%s\n", (**p ? "TRUE" : "FALSE"));
46 if (o->direction == ODR_DECODE)
47 *p = (int *)odr_malloc(o, sizeof(int));
48 return ber_boolean(o, *p);
53 * indent-tabs-mode: nil
55 * vim: shiftwidth=4 tabstop=8 expandtab