2 * Copyright (C) 1995-2005, Index Data ApS
3 * See the file LICENSE for details.
5 * $Id: odr_oid.c,v 1.7 2005/06/25 15:46:04 adam Exp $
9 * \brief Implements ODR OID codec
19 * Top level oid en/decoder.
20 * Returns 1 on success, 0 on error.
22 int odr_oid(ODR o, Odr_oid **p, int opt, const char *name)
30 o->t_class = ODR_UNIVERSAL;
33 if ((res = ber_tag(o, p, o->t_class, o->t_tag, &cons, opt, name)) < 0)
36 return odr_missing(o, opt, name);
39 odr_seterror(o, OPROTO, 46);
42 if (o->direction == ODR_PRINT)
47 odr_printf(o, "OID:");
48 for (i = 0; (*p)[i] > -1; i++)
49 odr_printf(o, " %d", (*p)[i]);
53 if (o->direction == ODR_DECODE)
54 *p = (int *)odr_malloc(o, OID_SIZE * sizeof(**p));
55 return ber_oidc(o, *p, OID_SIZE);
60 * indent-tabs-mode: nil
62 * vim: shiftwidth=4 tabstop=8 expandtab