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