2 * Copyright (c) 1995-2003, Index Data
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
6 * $Id: odr_bit.c,v 1.1 2003-10-27 12:21:33 adam Exp $
16 * Top level bitstring string en/decoder.
17 * Returns 1 on success, 0 on error.
19 int odr_bitstring(ODR o, Odr_bitmask **p, int opt, const char *name)
27 o->t_class = ODR_UNIVERSAL;
28 o->t_tag = ODR_BITSTRING;
30 if ((res = ber_tag(o, p, o->t_class, o->t_tag, &cons, opt, name)) < 0)
33 return odr_missing(o, opt, name);
34 if (o->direction == ODR_PRINT)
37 fprintf(o->print, "BITSTRING(len=%d)\n",(*p)->top + 1);
40 if (o->direction == ODR_DECODE)
42 *p = (Odr_bitmask *)odr_malloc(o, sizeof(Odr_bitmask));
43 memset((*p)->bits, 0, ODR_BITMASK_SIZE);
47 /* ignoring the cons helps with at least one target.
48 * http://bugzilla.indexdata.dk/cgi-bin/bugzilla/show_bug.cgi?id=24
50 return ber_bitstring(o, *p, 0);
52 return ber_bitstring(o, *p, cons);