00001
00002
00003
00004
00005
00011 #if HAVE_CONFIG_H
00012 #include <config.h>
00013 #endif
00014
00015 #include <string.h>
00016 #include "odr-priv.h"
00017
00018
00019
00020
00021
00022 int odr_bitstring(ODR o, Odr_bitmask **p, int opt, const char *name)
00023 {
00024 int res, cons = 0;
00025
00026 if (o->error)
00027 return 0;
00028 if (o->op->t_class < 0)
00029 {
00030 o->op->t_class = ODR_UNIVERSAL;
00031 o->op->t_tag = ODR_BITSTRING;
00032 }
00033 res = ber_tag(o, p, o->op->t_class, o->op->t_tag, &cons, opt, name);
00034 if (res < 0)
00035 return 0;
00036 if (!res)
00037 return odr_missing(o, opt, name);
00038 if (o->direction == ODR_PRINT)
00039 {
00040 odr_prname(o, name);
00041 odr_printf(o, "BITSTRING(len=%d)\n",(*p)->top + 1);
00042 return 1;
00043 }
00044 if (o->direction == ODR_DECODE)
00045 {
00046 *p = (Odr_bitmask *)odr_malloc(o, sizeof(Odr_bitmask));
00047 memset((*p)->bits, 0, ODR_BITMASK_SIZE);
00048 (*p)->top = -1;
00049 }
00050 #if 0
00051
00052
00053
00054 return ber_bitstring(o, *p, 0);
00055 #else
00056 return ber_bitstring(o, *p, cons);
00057 #endif
00058 }
00059
00060
00061
00062
00063
00064
00065
00066