void VRT_error(struct sess *, unsigned, const char *);
int VRT_switch_config(const char *);
-enum gethdr_e { HDR_REQ, HDR_RESP };
+enum gethdr_e { HDR_REQ, HDR_RESP, HDR_OBJ, HDR_BEREQ };
char *VRT_GetHdr(struct sess *, enum gethdr_e where, const char *);
void VRT_handling(struct sess *sp, unsigned hand);
vsb_cat(sb, "void VRT_error(struct sess *, unsigned, const char *);\n");
vsb_cat(sb, "int VRT_switch_config(const char *);\n");
vsb_cat(sb, "\n");
- vsb_cat(sb, "enum gethdr_e { HDR_REQ, HDR_RESP };\n");
+ vsb_cat(sb, "enum gethdr_e { HDR_REQ, HDR_RESP, HDR_OBJ, HDR_BEREQ };\n");
vsb_cat(sb, "char *VRT_GetHdr(struct sess *, enum gethdr_e where, const char *);\n");
vsb_cat(sb, "void VRT_handling(struct sess *sp, unsigned hand);\n");
vsb_cat(sb, "\n");
EncToken(tl->fb, tl->t);
vcc_NextToken(tl);
return;
- }
- ExpectErr(tl, VAR);
+ } else if (tl->t->tok != VAR) {
+ vsb_printf(tl->sb, "Expected string variable or constant\n");
+ vcc_ErrWhere(tl, tl->t);
+ return;
+ }
ERRCHK(tl);
vp = vcc_FindVar(tl, tl->t, vcc_vars);
ERRCHK(tl);
memcpy(p, t->b, i);
p[i] = '\0';
v->name = p;
+ v->access = V_RW;
v->fmt = STRING;
v->methods = vh->methods;
if (!memcmp(vh->name, "req.", 4))
wh = "HDR_REQ";
else if (!memcmp(vh->name, "resp.", 5))
wh = "HDR_RESP";
+ else if (!memcmp(vh->name, "obj.", 4))
+ wh = "HDR_OBJ";
+ else if (!memcmp(vh->name, "bereq.", 6))
+ wh = "HDR_BEREQ";
else
assert(0 == 1);
asprintf(&p, "VRT_GetHdr(sp, %s, \"\\%03o%s:\")", wh,
(unsigned)(strlen(v->name + vh->len) + 1), v->name + vh->len);
- assert(p != NULL);
+ AN(p);
v->rname = p;
+ asprintf(&p, "VRT_SetHdr(sp, %s, \"\\%03o%s:\")", wh,
+ (unsigned)(strlen(v->name + vh->len) + 1), v->name + vh->len);
+ AN(p);
+ v->lname = p;
return (v);
}