2 * Copyright (C) 1995-2005, Index Data ApS
3 * See the file LICENSE for details.
5 * $Id: ber_bool.c,v 1.3 2005-01-15 19:47:11 adam Exp $
10 * \brief Implements BER BOOLEAN encoding and decoding
12 * This source file implements BER encoding and decoding of
23 int ber_boolean(ODR o, int *val)
30 if (ber_enclen(o, 1, 1, 1) != 1)
32 if (odr_putc(o, *val) < 0)
35 fprintf(stderr, "[val=%d]\n", *val);
39 if ((res = ber_declen(o->bp, &len, odr_max(o))) < 0)
41 odr_seterror(o, OPROTO, 9);
45 if (len != 1 || odr_max(o) < len)
47 odr_seterror(o, OPROTO, 10);
53 fprintf(stderr, "[val=%d]\n", *val);
58 default: odr_seterror(o, OOTHER, 11); return 0;