2 * Copyright (C) 1994, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.3 1995-02-03 17:04:34 quinn
8 * *** empty log message ***
10 * Revision 1.2 1995/02/02 20:38:50 quinn
13 * Revision 1.1 1995/02/02 16:21:52 quinn
20 int ber_octetstring(ODR o, Odr_oct *p, int cons)
23 unsigned char *base, *c;
28 if ((res = ber_declen(o->bp, &len)) < 0)
32 if (cons) /* fetch component strings */
35 while (odp_more_chunks(o, base, len))
36 if (!odr_octetstring(o, &p, 0))
40 /* primitive octetstring */
45 if (len > p->size - p->len)
47 c = nalloc(o, p->size += len + 1);
49 memcpy(c, p->buf, p->len);
52 memcpy(p->buf + p->len, o->bp, len);
58 if ((res = ber_enclen(o->bp, p->len, 5, 0)) < 0)
66 memcpy(o->bp, p->buf, p->len);
70 case ODR_PRINT: return 1;