2 * Copyright (c) 1995-2004, Index Data
3 * See the file LICENSE for details.
5 * $Id: odr_oid.c,v 1.3 2004-08-13 07:30:06 adam Exp $
15 * Top level oid en/decoder.
16 * Returns 1 on success, 0 on error.
18 int odr_oid(ODR o, Odr_oid **p, int opt, const char *name)
26 o->t_class = ODR_UNIVERSAL;
29 if ((res = ber_tag(o, p, o->t_class, o->t_tag, &cons, opt, name)) < 0)
32 return odr_missing(o, opt, name);
35 odr_seterror(o, OPROTO, 46);
38 if (o->direction == ODR_PRINT)
43 odr_printf(o, "OID:");
44 for (i = 0; (*p)[i] > -1; i++)
45 odr_printf(o, " %d", (*p)[i]);
49 if (o->direction == ODR_DECODE)
50 *p = (int *)odr_malloc(o, OID_SIZE * sizeof(**p));
51 return ber_oidc(o, *p);