* Sebastian Hammer, Adam Dickmeiss
*
* $Log: ber_int.c,v $
- * Revision 1.1 1995-02-02 16:21:52 quinn
+ * Revision 1.2 1995-02-07 17:52:58 quinn
+ * A damn mess, but now things work, I think.
+ *
+ * Revision 1.1 1995/02/02 16:21:52 quinn
* First kick.
*
*/
b += len;
if (ber_enclen(lenpos, len, 1, 1) != 1)
return -1;
- fprintf(stderr, "[val=%d]\n", val);
+ fprintf(stderr, "[val=%d]", val);
return b - buf;
}
*val = ntohl(tmp.i);
b += len;
- fprintf(stderr, "[val=%d]\n", *val);
+ fprintf(stderr, "[val=%d]", *val);
return b - buf;
}
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: ber_tag.c,v $
- * Revision 1.1 1995-02-02 16:21:53 quinn
+ * Revision 1.2 1995-02-07 17:52:59 quinn
+ * A damn mess, but now things work, I think.
+ *
+ * Revision 1.1 1995/02/02 16:21:53 quinn
* First kick.
*
*/
return -1;
o->bp += rd;
o->left -= rd;
- fprintf(stderr, "[class=%d,tag=%d,cons=%d]", class, tag,
+ fprintf(stderr, "\n[class=%d,tag=%d,cons=%d]", class, tag,
*constructed);
return 1;
case ODR_DECODE:
{
if ((br = ber_dectag(o->bp, &lclass, <ag, &lcons)) <= 0)
return -1;
- fprintf(stderr, "[class=%d,tag=%d,cons=%d]", lclass, ltag,
+ fprintf(stderr, "\n[class=%d,tag=%d,cons=%d]", lclass, ltag,
lcons);
}
if (class == lclass && tag == ltag)
--- /dev/null
+/*
+ * Copyright (C) 1994, Index Data I/S
+ * All rights reserved.
+ * Sebastian Hammer, Adam Dickmeiss
+ *
+ * $Log: odr_choice.c,v $
+ * Revision 1.1 1995-02-07 17:52:59 quinn
+ * A damn mess, but now things work, I think.
+ *
+ */
+
+#include <odr.h>
+
+int odr_choice(ODR o, Odr_arm arm[], void *p, int *which)
+{
+ int i, cl = -1, tg, cn;
+
+ if (o->direction != ODR_DECODE && !*(char*)p)
+ return 0;
+ for (i = 0; arm[i].fun; i++)
+ {
+ if (o->direction == ODR_DECODE)
+ *which = arm[i].which;
+ else if (*which != arm[i].which)
+ continue;
+
+ if (arm[i].tagmode != ODR_NONE)
+ {
+ if (o->direction == ODR_DECODE && cl < 0)
+ {
+ if (ber_dectag(o->bp, &cl, &tg, &cn) <= 0)
+ return 0;
+ }
+ else if (o->direction != ODR_DECODE)
+ {
+ cl = arm[i].class;
+ tg = arm[i].tag;
+ }
+ if (tg == arm[i].tag && cl == arm[i].class)
+ {
+ if (arm[i].tagmode == ODR_IMPLICIT)
+ {
+ odr_implicit_settag(o, cl, tg);
+ return (*arm[i].fun)(o, p, 0);
+ }
+ /* explicit */
+ if (!odr_constructed_begin(o, p, cl, tg))
+ return 0;
+ return (*arm[i].fun)(o, p, 0) &&
+ odr_constructed_end(o);
+ }
+ }
+ else /* no tagging. Have to poll type */
+ if ((*arm[i].fun)(o, p, 0))
+ return 1;
+ }
+ *which = -1;
+ *(char*)p = 0;
+ return 0;
+}
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: odr_cons.c,v $
- * Revision 1.1 1995-02-02 16:21:53 quinn
+ * Revision 1.2 1995-02-07 17:52:59 quinn
+ * A damn mess, but now things work, I think.
+ *
+ * Revision 1.1 1995/02/02 16:21:53 quinn
* First kick.
*
*/
#include <odr.h>
-int odr_constructed_begin(ODR o, void *p, int class, int tag, int opt)
+int odr_constructed_begin(ODR o, void *p, int class, int tag)
{
int res;
int cons = 1;
- if (o->direction == ODR_ENCODE && !*(char*)p)
- return opt;
if (o->t_class < 0)
{
o->t_class = class;
o->t_tag = tag;
}
- if ((res = ber_tag(o, p, o->t_class, o->t_tag, &cons)) < 0)
+ if ((res = ber_tag(o, *(char**)p, o->t_class, o->t_tag, &cons)) < 0)
return 0;
if (!res || !cons)
- return opt;
+ return 0;
o->stack[++(o->stackp)].lenb = o->bp;
if (o->direction == ODR_ENCODE || o->direction == ODR_PRINT)
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: odr_seq.c,v $
- * Revision 1.3 1995-02-07 14:13:46 quinn
+ * Revision 1.4 1995-02-07 17:53:00 quinn
+ * A damn mess, but now things work, I think.
+ *
+ * Revision 1.3 1995/02/07 14:13:46 quinn
* Bug fixes.
*
* Revision 1.2 1995/02/06 16:45:03 quinn
o->t_tag = ODR_SEQUENCE;
}
- if (odr_constructed_begin(o, p, o->t_class, o->t_tag, 0))
+ if (odr_constructed_begin(o, p, o->t_class, o->t_tag))
{
if (o->direction == ODR_DECODE && size)
*pp = nalloc(o, size);
{
char ***pp = (char***) p; /* for dereferencing */
char **tmp;
+ char *dummy;
int size = 0, i;
- if (!odr_sequence_begin(o, p, 0))
+ if (!odr_sequence_begin(o, &dummy, 0))
return 0;
switch (o->direction)