const char * VRT_r_req_request(struct sess *);
const char * VRT_r_req_url(struct sess *);
const char * VRT_r_req_proto(struct sess *);
+void VRT_l_req_hash(struct sess *, const char *);
struct backend * VRT_r_req_backend(struct sess *);
void VRT_l_req_backend(struct sess *, struct backend *);
-const char * VRT_r_req_http_(struct sess *);
-void VRT_l_req_hash(struct sess *, const char *);
+const char * VRT_r_bereq_request(struct sess *);
+void VRT_l_bereq_request(struct sess *, const char *);
+const char * VRT_r_bereq_url(struct sess *);
+void VRT_l_bereq_url(struct sess *, const char *);
+const char * VRT_r_bereq_proto(struct sess *);
+void VRT_l_bereq_proto(struct sess *, const char *);
+const char * VRT_r_obj_proto(struct sess *);
+void VRT_l_obj_proto(struct sess *, const char *);
+int VRT_r_obj_status(struct sess *);
+void VRT_l_obj_status(struct sess *, int);
+const char * VRT_r_obj_response(struct sess *);
+void VRT_l_obj_response(struct sess *, const char *);
unsigned VRT_r_obj_valid(struct sess *);
void VRT_l_obj_valid(struct sess *, unsigned);
unsigned VRT_r_obj_cacheable(struct sess *);
double VRT_r_obj_ttl(struct sess *);
void VRT_l_obj_ttl(struct sess *, double);
const char * VRT_r_resp_proto(struct sess *);
+void VRT_l_resp_proto(struct sess *, const char *);
int VRT_r_resp_status(struct sess *);
+void VRT_l_resp_status(struct sess *, int);
const char * VRT_r_resp_response(struct sess *);
-const char * VRT_r_resp_http_(struct sess *);
+void VRT_l_resp_response(struct sess *, const char *);
vsb_cat(sb, "const char * VRT_r_req_request(struct sess *);\n");
vsb_cat(sb, "const char * VRT_r_req_url(struct sess *);\n");
vsb_cat(sb, "const char * VRT_r_req_proto(struct sess *);\n");
+ vsb_cat(sb, "void VRT_l_req_hash(struct sess *, const char *);\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, "const char * VRT_r_req_http_(struct sess *);\n");
- vsb_cat(sb, "void VRT_l_req_hash(struct sess *, const char *);\n");
+ vsb_cat(sb, "const char * VRT_r_bereq_request(struct sess *);\n");
+ vsb_cat(sb, "void VRT_l_bereq_request(struct sess *, const char *);\n");
+ vsb_cat(sb, "const char * VRT_r_bereq_url(struct sess *);\n");
+ vsb_cat(sb, "void VRT_l_bereq_url(struct sess *, const char *);\n");
+ vsb_cat(sb, "const char * VRT_r_bereq_proto(struct sess *);\n");
+ vsb_cat(sb, "void VRT_l_bereq_proto(struct sess *, const char *);\n");
+ vsb_cat(sb, "const char * VRT_r_obj_proto(struct sess *);\n");
+ vsb_cat(sb, "void VRT_l_obj_proto(struct sess *, const char *);\n");
+ vsb_cat(sb, "int VRT_r_obj_status(struct sess *);\n");
+ vsb_cat(sb, "void VRT_l_obj_status(struct sess *, int);\n");
+ vsb_cat(sb, "const char * VRT_r_obj_response(struct sess *);\n");
+ vsb_cat(sb, "void VRT_l_obj_response(struct sess *, const char *);\n");
vsb_cat(sb, "unsigned VRT_r_obj_valid(struct sess *);\n");
vsb_cat(sb, "void VRT_l_obj_valid(struct sess *, unsigned);\n");
vsb_cat(sb, "unsigned VRT_r_obj_cacheable(struct sess *);\n");
vsb_cat(sb, "double VRT_r_obj_ttl(struct sess *);\n");
vsb_cat(sb, "void VRT_l_obj_ttl(struct sess *, double);\n");
vsb_cat(sb, "const char * VRT_r_resp_proto(struct sess *);\n");
+ vsb_cat(sb, "void VRT_l_resp_proto(struct sess *, const char *);\n");
vsb_cat(sb, "int VRT_r_resp_status(struct sess *);\n");
+ vsb_cat(sb, "void VRT_l_resp_status(struct sess *, int);\n");
vsb_cat(sb, "const char * VRT_r_resp_response(struct sess *);\n");
- vsb_cat(sb, "const char * VRT_r_resp_http_(struct sess *);\n");
+ vsb_cat(sb, "void VRT_l_resp_response(struct sess *, const char *);\n");
}
# Generate various .c and .h files for the VCL compiler and the interfaces
# for it.
-# Objects which operate on backends
+# Objects available in backends
set beobj {
{ backend.host WO HOSTNAME }
{ backend.port WO PORTNAME }
{ backend.dnsttl WO TIME }
}
-# Objects which operate on sessions
-
+# Variables available in sessions
+# Comments are stripped from #...\n
set spobj {
+
+ # Connection related parameters
{ client.ip
RO IP
- {recv pipe pass hash miss hit fetch }
+ {recv pipe pass hash miss hit fetch }
+ }
+ { client.bandwidth # Not implemented yet
+ NO
}
{ server.ip
RO IP
- {recv pipe pass hash miss hit fetch }
+ {recv pipe pass hash miss hit fetch }
}
+
+ # Request paramters
{ req.request
RO STRING
- {recv pipe pass hash miss hit fetch }
+ {recv pipe pass hash miss hit fetch }
}
{ req.url
RO STRING
- {recv pipe pass hash miss hit fetch }
+ {recv pipe pass hash miss hit fetch }
}
{ req.proto
RO STRING
- {recv pipe pass hash miss hit fetch }
- }
- { req.backend
- RW BACKEND
- {recv pipe pass hash miss hit fetch }
+ {recv pipe pass hash miss hit fetch }
}
{ req.http.
- RO HEADER
- {recv pipe pass hash miss hit fetch }
+ RW HEADER
+ {recv pipe pass hash miss hit fetch }
}
+
+ # Possibly misnamed, not really part of the request
{ req.hash
WO HASH
- { hash }
+ { hash }
+ }
+ { req.backend
+ RW BACKEND
+ {recv pipe pass hash miss hit fetch }
+ }
+
+ # Request sent to backend
+ { bereq.request
+ RW STRING
+ { pipe pass miss }
}
+ { bereq.url
+ RW STRING
+ { pipe pass miss }
+ }
+ { bereq.proto
+ RW STRING
+ { pipe pass miss }
+ }
+ { bereq.http.
+ RW HEADER
+ { pipe pass miss }
+ }
+
+ # The (possibly) cached object
+ { obj.proto
+ RW STRING
+ { hit fetch deliver }
+ }
+ { obj.status
+ RW INT
+ { fetch }
+ }
+ { obj.response
+ RW STRING
+ { fetch }
+ }
+ { obj.http.
+ RW HEADER
+ { hit fetch deliver }
+ }
+
{ obj.valid
RW BOOL
- { hit fetch discard timeout}
+ { hit fetch discard timeout}
}
{ obj.cacheable
RW BOOL
- { hit fetch discard timeout}
+ { hit fetch discard timeout}
}
{ obj.ttl
RW TIME
- { hit fetch discard timeout}
+ { hit fetch discard timeout}
}
+
+ # The response we send back
{ resp.proto
- RO STRING
- { fetch }
+ RW STRING
+ { fetch }
}
{ resp.status
- RO INT
- { fetch }
+ RW INT
+ { fetch }
}
{ resp.response
- RO STRING
- { fetch }
+ RW STRING
+ { fetch }
}
{ resp.http.
- RO HEADER
- { fetch }
+ RW HEADER
+ { fetch }
}
}
proc vars {v ty pa} {
global tt fo fp
+ regsub -all "#\[^\n\]*\n" $v "" v
foreach v $v {
set n [lindex $v 0]
regsub -all {[.]} $n "_" m
set a [lindex $v 1]
+ if {$a == "NO"} continue
set t [lindex $v 2]
puts $fo "\t\{ \"$n\", $t, [string length $n],"
if {$a == "RO" || $a == "RW"} {
puts $fo "\t \"VRT_r_${m}($pa)\","
- puts $fp "$tt($t) VRT_r_${m}($ty);"
+ if {$t != "HEADER"} {
+ puts $fp "$tt($t) VRT_r_${m}($ty);"
+ }
} else {
puts $fo "\t NULL,"
}
if {$a == "WO" || $a == "RW"} {
puts $fo "\t \"VRT_l_${m}($pa, \","
- puts $fp "void VRT_l_${m}($ty, $tt($t));"
+ if {$t != "HEADER"} {
+ puts $fp "void VRT_l_${m}($ty, $tt($t));"
+ }
} else {
puts $fo "\t NULL,"
}
V_RO,
VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH
},
- { "req.backend", BACKEND, 11,
- "VRT_r_req_backend(sp)",
- "VRT_l_req_backend(sp, ",
- V_RW,
- VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH
- },
{ "req.http.", HEADER, 9,
"VRT_r_req_http_(sp)",
- NULL,
- V_RO,
+ "VRT_l_req_http_(sp, ",
+ V_RW,
VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH
},
{ "req.hash", HASH, 8,
V_WO,
VCL_MET_HASH
},
+ { "req.backend", BACKEND, 11,
+ "VRT_r_req_backend(sp)",
+ "VRT_l_req_backend(sp, ",
+ V_RW,
+ VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH
+ },
+ { "bereq.request", STRING, 13,
+ "VRT_r_bereq_request(sp)",
+ "VRT_l_bereq_request(sp, ",
+ V_RW,
+ VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_MISS
+ },
+ { "bereq.url", STRING, 9,
+ "VRT_r_bereq_url(sp)",
+ "VRT_l_bereq_url(sp, ",
+ V_RW,
+ VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_MISS
+ },
+ { "bereq.proto", STRING, 11,
+ "VRT_r_bereq_proto(sp)",
+ "VRT_l_bereq_proto(sp, ",
+ V_RW,
+ VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_MISS
+ },
+ { "bereq.http.", HEADER, 11,
+ "VRT_r_bereq_http_(sp)",
+ "VRT_l_bereq_http_(sp, ",
+ V_RW,
+ VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_MISS
+ },
+ { "obj.proto", STRING, 9,
+ "VRT_r_obj_proto(sp)",
+ "VRT_l_obj_proto(sp, ",
+ V_RW,
+ VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER
+ },
+ { "obj.status", INT, 10,
+ "VRT_r_obj_status(sp)",
+ "VRT_l_obj_status(sp, ",
+ V_RW,
+ VCL_MET_FETCH
+ },
+ { "obj.response", STRING, 12,
+ "VRT_r_obj_response(sp)",
+ "VRT_l_obj_response(sp, ",
+ V_RW,
+ VCL_MET_FETCH
+ },
+ { "obj.http.", HEADER, 9,
+ "VRT_r_obj_http_(sp)",
+ "VRT_l_obj_http_(sp, ",
+ V_RW,
+ VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER
+ },
{ "obj.valid", BOOL, 9,
"VRT_r_obj_valid(sp)",
"VRT_l_obj_valid(sp, ",
},
{ "resp.proto", STRING, 10,
"VRT_r_resp_proto(sp)",
- NULL,
- V_RO,
+ "VRT_l_resp_proto(sp, ",
+ V_RW,
VCL_MET_FETCH
},
{ "resp.status", INT, 11,
"VRT_r_resp_status(sp)",
- NULL,
- V_RO,
+ "VRT_l_resp_status(sp, ",
+ V_RW,
VCL_MET_FETCH
},
{ "resp.response", STRING, 13,
"VRT_r_resp_response(sp)",
- NULL,
- V_RO,
+ "VRT_l_resp_response(sp, ",
+ V_RW,
VCL_MET_FETCH
},
{ "resp.http.", HEADER, 10,
"VRT_r_resp_http_(sp)",
- NULL,
- V_RO,
+ "VRT_l_resp_http_(sp, ",
+ V_RW,
VCL_MET_FETCH
},
{ NULL }