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.16 2003-01-06 08:20:27 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)) < 0)
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);
46 return ber_bitstring(o, *p, cons);