2 * Copyright (C) 1995-2005, Index Data ApS
3 * See the file LICENSE for details.
5 * $Id: odr_bit.c,v 1.5 2005-06-25 15:46:04 adam Exp $
10 * \brief Implements ODR BITSTRING codec
21 * Top level bitstring string en/decoder.
22 * Returns 1 on success, 0 on error.
24 int odr_bitstring(ODR o, Odr_bitmask **p, int opt, const char *name)
32 o->t_class = ODR_UNIVERSAL;
33 o->t_tag = ODR_BITSTRING;
35 if ((res = ber_tag(o, p, o->t_class, o->t_tag, &cons, opt, name)) < 0)
38 return odr_missing(o, opt, name);
39 if (o->direction == ODR_PRINT)
42 odr_printf(o, "BITSTRING(len=%d)\n",(*p)->top + 1);
45 if (o->direction == ODR_DECODE)
47 *p = (Odr_bitmask *)odr_malloc(o, sizeof(Odr_bitmask));
48 memset((*p)->bits, 0, ODR_BITMASK_SIZE);
52 /* ignoring the cons helps with at least one target.
53 * http://bugzilla.indexdata.dk/cgi-bin/bugzilla/show_bug.cgi?id=24
55 return ber_bitstring(o, *p, 0);
57 return ber_bitstring(o, *p, cons);
63 * indent-tabs-mode: nil
65 * vim: shiftwidth=4 tabstop=8 expandtab