2 * Copyright (C) 1995-2007, Index Data ApS
3 * See the file LICENSE for details.
5 * $Id: odr_bool.c,v 1.7 2007-03-19 21:08:13 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)
29 if (o->op->t_class < 0)
31 o->op->t_class = ODR_UNIVERSAL;
32 o->op->t_tag = ODR_BOOLEAN;
34 res = ber_tag(o, p, o->op->t_class, o->op->t_tag, &cons, opt, name);
38 return odr_missing(o, opt, name);
39 if (o->direction == ODR_PRINT)
42 odr_printf(o, "%s\n", (**p ? "TRUE" : "FALSE"));
47 if (o->direction == ODR_DECODE)
48 *p = (int *)odr_malloc(o, sizeof(int));
49 return ber_boolean(o, *p);
54 * indent-tabs-mode: nil
56 * vim: shiftwidth=4 tabstop=8 expandtab