* Edit vcc_gen_obj.tcl instead
*/
-void VRT_l_backend_host(struct backend *, const char *);
-void VRT_l_backend_port(struct backend *, const char *);
-void VRT_l_backend_dnsttl(struct backend *, double);
-void VRT_l_backend_set(struct backend *, struct vrt_backend_entry *);
struct sockaddr * VRT_r_client_ip(const struct sess *);
struct sockaddr * VRT_r_server_ip(struct sess *);
const char * VRT_r_req_request(const struct sess *);
void
VCC_InitCompile(const char *default_vcl)
{
- struct var *v;
vcc_default_vcl_b = default_vcl;
vcc_default_vcl_e = strchr(default_vcl, '\0');
assert(vcc_default_vcl_e != NULL);
vcl_init_tnames();
- for (v = vcc_vars; v->name != NULL; v++)
- v->len = strlen(v->name);
- for (v = vcc_be_vars; v->name != NULL; v++)
- v->len = strlen(v->name);
}
RTIME,
STRING,
IP,
- HOSTNAME,
- PORTNAME,
HASH,
- HEADER,
- SET
+ HEADER
};
enum var_access {
void *TlAlloc(struct tokenlist *tl, unsigned len);
/* vcc_obj.c */
-extern struct var vcc_be_vars[];
extern struct var vcc_vars[];
/* vcc_parse.c */
vsb_cat(sb, " * Edit vcc_gen_obj.tcl instead\n");
vsb_cat(sb, " */\n");
vsb_cat(sb, "\n");
- vsb_cat(sb, "void VRT_l_backend_host(struct backend *, const char *);\n");
- vsb_cat(sb, "void VRT_l_backend_port(struct backend *, const char *);\n");
- vsb_cat(sb, "void VRT_l_backend_dnsttl(struct backend *, double);\n");
- vsb_cat(sb, "void VRT_l_backend_set(struct backend *, struct vrt_backend_entry *);\n");
vsb_cat(sb, "struct sockaddr * VRT_r_client_ip(const struct sess *);\n");
vsb_cat(sb, "struct sockaddr * VRT_r_server_ip(struct sess *);\n");
vsb_cat(sb, "const char * VRT_r_req_request(const struct sess *);\n");
vsb_cat(sb, "struct backend * VRT_r_req_backend(struct sess *);\n");
vsb_cat(sb, "void VRT_l_req_backend(struct sess *, struct backend *);\n");
vsb_cat(sb, "int VRT_r_req_restarts(const struct sess *);\n");
- vsb_cat(sb, "double VRT_r_req_grace(const struct sess *);\n");
- vsb_cat(sb, "void VRT_l_req_grace(const struct sess *, double);\n");
+ vsb_cat(sb, "double VRT_r_req_grace(struct sess *);\n");
+ vsb_cat(sb, "void VRT_l_req_grace(struct sess *, double);\n");
vsb_cat(sb, "const char * VRT_r_bereq_request(const struct sess *);\n");
vsb_cat(sb, "void VRT_l_bereq_request(const struct sess *, const char *, ...);\n");
vsb_cat(sb, "const char * VRT_r_bereq_url(const struct sess *);\n");
# Generate various .c and .h files for the VCL compiler and the interfaces
# for it.
-# Objects available in backends
-set beobj {
- { backend.host WO HOSTNAME {} "struct backend *"}
- { backend.port WO PORTNAME {} "struct backend *"}
- { backend.dnsttl WO TIME {} "struct backend *"}
- { backend.set WO SET {} "struct backend *"}
-}
# Variables available in sessions
# Comments are stripped from #...\n
puts $fo "#include \"vcc_compile.h\""
puts $fo ""
-puts $fo "struct var vcc_be_vars\[\] = {"
-vars $beobj "backend"
-puts $fo "};"
-
-puts $fo ""
-
puts $fo "struct var vcc_vars\[\] = {"
vars $spobj "sp"
puts $fo "};"
#include <stdio.h>
#include "vcc_compile.h"
-struct var vcc_be_vars[] = {
- { "backend.host", HOSTNAME, 12,
- NULL,
- "VRT_l_backend_host(backend, ",
- V_WO,
- 0,
- 0
- },
- { "backend.port", PORTNAME, 12,
- NULL,
- "VRT_l_backend_port(backend, ",
- V_WO,
- 0,
- 0
- },
- { "backend.dnsttl", TIME, 14,
- NULL,
- "VRT_l_backend_dnsttl(backend, ",
- V_WO,
- 0,
- 0
- },
- { "backend.set", SET, 11,
- NULL,
- "VRT_l_backend_set(backend, ",
- V_WO,
- 0,
- 0
- },
- { NULL }
-};
-
struct var vcc_vars[] = {
{ "client.ip", IP, 9,
"VRT_r_client_ip(sp)",