{
vsb_printf(v, "\t.ident =");
- if (qual != NULL) {
+ if (serial != 0 && qual != NULL) {
vsb_printf(v, "\n\t \"%.*s \"", PF(qual));
qual = VTAILQ_NEXT(qual, list);
vsb_printf(v, "\n\t \"%.*s \"", PF(qual));
ExpectErr(tl, '}');
vcc_EmitBeIdent(tl->fh, qual, serial, t_first, tl->t);
- Fh(tl, 0, "};\n");
+ Fh(tl, 0, "\t.vcl_name = \"%.*s", PF(qual));
+ if (serial)
+ Fh(tl, 0, "[%d]", serial);
+ Fh(tl, 0, "\"\n};\n");
vcc_NextToken(tl);
}
void
vcc_ParseBackend(struct tokenlist *tl)
{
- struct token *t_first;
struct host *h;
int nbh;
h = TlAlloc(tl, sizeof *h);
- t_first = tl->t; /* T_BACKEND */
vcc_NextToken(tl);
h->name = tl->t;
vcc_NextToken(tl);
- vcc_ParseBackendHost(tl, &nbh, NULL, 0);
+ vcc_ParseBackendHost(tl, &nbh, h->name, 0);
ERRCHK(tl);
h->hnum = nbh;
PF(h->name));
Fc(tl, 0, "\t.name = \"%.*s\",\n", PF(h->name));
Fc(tl, 0, "\t.host = &bh_%d,\n", nbh);
- vcc_EmitBeIdent(tl->fc, NULL, 0, t_first, tl->t);
Fc(tl, 0, "};\n");
tl->nbackend++;
*/
static void
-vcc_ParseRandomDirector(struct tokenlist *tl, const struct token *t_first, struct token *t_dir)
+vcc_ParseRandomDirector(struct tokenlist *tl, struct token *t_dir)
{
struct token *t_field;
int nbh, nelem;
Fc(tl, 0, "\t.name = \"%.*s\",\n", PF(t_dir));
Fc(tl, 0, "\t.nmember = %d,\n", nelem);
Fc(tl, 0, "\t.members = vdre_%.*s,\n", PF(t_dir));
- vcc_EmitBeIdent(tl->fc, NULL, 0, t_first, tl->t);
Fc(tl, 0, "};\n");
vcc_NextToken(tl);
Fi(tl, 0,
ExpectErr(tl, ID); /* ID: policy */
if (vcc_IdIs(tl->t, "random"))
- vcc_ParseRandomDirector(tl, t_first, t_dir);
+ vcc_ParseRandomDirector(tl, t_dir);
else {
vsb_printf(tl->sb, "Unknown director policy: ");
vcc_ErrToken(tl, tl->t);
vsb_cat(sb, "struct vrt_backend {\n");
vsb_cat(sb, " const char *portname;\n");
vsb_cat(sb, " const char *hostname;\n");
+ vsb_cat(sb, " const char *vcl_name;\n");
vsb_cat(sb, " const char *ident;\n");
vsb_cat(sb, "};\n");
vsb_cat(sb, "\n");
vsb_cat(sb, " */\n");
vsb_cat(sb, "\n");
vsb_cat(sb, "struct vrt_dir_simple {\n");
- vsb_cat(sb, " const char *ident;\n");
vsb_cat(sb, " const char *name;\n");
vsb_cat(sb, " const struct vrt_backend *host;\n");
vsb_cat(sb, "};\n");
vsb_cat(sb, "};\n");
vsb_cat(sb, "\n");
vsb_cat(sb, "struct vrt_dir_random {\n");
- vsb_cat(sb, " const char *ident;\n");
vsb_cat(sb, " const char *name;\n");
vsb_cat(sb, " unsigned nmember;\n");
vsb_cat(sb, " const struct vrt_dir_random_entry *members;\n");