2 * Copyright (C) 1994, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.6 1995-03-08 12:12:23 quinn
8 * Added better error checking.
10 * Revision 1.5 1995/02/10 18:57:25 quinn
11 * More in the way of error-checking.
13 * Revision 1.4 1995/02/10 15:55:29 quinn
16 * Revision 1.3 1995/02/09 15:51:48 quinn
19 * Revision 1.2 1995/02/07 17:52:59 quinn
20 * A damn mess, but now things work, I think.
22 * Revision 1.1 1995/02/02 16:21:53 quinn
29 int odr_constructed_begin(ODR o, void *p, int class, int tag)
41 if ((res = ber_tag(o, p, o->t_class, o->t_tag, &cons, 1)) < 0)
46 o->stack[++(o->stackp)].lenb = o->bp;
47 if (o->direction == ODR_ENCODE || o->direction == ODR_PRINT)
49 o->stack[o->stackp].lenlen = 1;
53 else if (o->direction == ODR_DECODE)
55 if ((res = ber_declen(o->bp, &o->stack[o->stackp].len)) < 0)
57 o->stack[o->stackp].lenlen = res;
63 o->stack[o->stackp].base = o->bp;
67 int odr_constructed_more(ODR o)
73 if (o->stack[o->stackp].len >= 0)
74 return o->bp - o->stack[o->stackp].base < o->stack[o->stackp].len;
76 return (!(*o->bp == 0 && *(o->bp + 1) == 0));
79 int odr_constructed_end(ODR o)
93 if (o->stack[o->stackp].len < 0)
95 if (*o->bp++ == 0 && *(o->bp++) == 0)
106 else if (o->bp - o->stack[o->stackp].base !=
107 o->stack[o->stackp].len)
115 if ((res = ber_enclen(o->stack[o->stackp].lenb,
116 o->bp - o->stack[o->stackp].base,
117 o->stack[o->stackp].lenlen, 1)) < 0)
122 if (res == 0) /* indefinite encoding */
124 *(o->bp++) = *(o->bp++) = 0;
129 case ODR_PRINT: return 1;