2 * Copyright (c) 1995-2003, Index Data
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
6 * $Id: odr_oid.c,v 1.2 2004-08-11 12:15:38 adam Exp $
16 * Top level oid en/decoder.
17 * Returns 1 on success, 0 on error.
19 int odr_oid(ODR o, Odr_oid **p, int opt, const char *name)
27 o->t_class = ODR_UNIVERSAL;
30 if ((res = ber_tag(o, p, o->t_class, o->t_tag, &cons, opt, name)) < 0)
33 return odr_missing(o, opt, name);
36 odr_seterror(o, OPROTO, 46);
39 if (o->direction == ODR_PRINT)
44 odr_printf(o, "OID:");
45 for (i = 0; (*p)[i] > -1; i++)
46 odr_printf(o, " %d", (*p)[i]);
50 if (o->direction == ODR_DECODE)
51 *p = (int *)odr_malloc(o, OID_SIZE * sizeof(**p));
52 return ber_oidc(o, *p);