00001
00002
00003
00004
00005
00010 #if HAVE_CONFIG_H
00011 #include <config.h>
00012 #endif
00013
00014 #include <stdio.h>
00015 #include "odr-priv.h"
00016
00017
00018
00019
00020
00021 int odr_bool(ODR o, Odr_bool **p, int opt, const char *name)
00022 {
00023 int res, cons = 0;
00024
00025 if (o->error)
00026 return 0;
00027 if (o->op->t_class < 0)
00028 {
00029 o->op->t_class = ODR_UNIVERSAL;
00030 o->op->t_tag = ODR_BOOLEAN;
00031 }
00032 res = ber_tag(o, p, o->op->t_class, o->op->t_tag, &cons, opt, name);
00033 if (res < 0)
00034 return 0;
00035 if (!res)
00036 return odr_missing(o, opt, name);
00037 if (o->direction == ODR_PRINT)
00038 {
00039 odr_prname(o, name);
00040 odr_printf(o, "%s\n", (**p ? "TRUE" : "FALSE"));
00041 return 1;
00042 }
00043 if (cons)
00044 return 0;
00045 if (o->direction == ODR_DECODE)
00046 *p = (int *)odr_malloc(o, sizeof(int));
00047 return ber_boolean(o, *p);
00048 }
00049
00050
00051
00052
00053
00054
00055
00056
00057