/*--------------------------------------------------------------------*/
void
-VRT_count(struct sess *sp, unsigned u)
+VRT_count(const struct sess *sp, unsigned u)
{
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
}
char *
-VRT_GetHdr(struct sess *sp, enum gethdr_e where, const char *n)
+VRT_GetHdr(const struct sess *sp, enum gethdr_e where, const char *n)
{
char *p;
struct http *hp;
/*--------------------------------------------------------------------*/
void
-VRT_SetHdr(struct sess *sp , enum gethdr_e where, const char *hdr, const char *p, ...)
+VRT_SetHdr(const struct sess *sp , enum gethdr_e where, const char *hdr, const char *p, ...)
{
struct http *hp;
va_list ap;
#define VRT_DO_HDR(obj, hdr, http, fld) \
void \
-VRT_l_##obj##_##hdr(struct sess *sp, const char *p, ...) \
+VRT_l_##obj##_##hdr(const struct sess *sp, const char *p, ...) \
{ \
va_list ap; \
\
VRT_DO_HDR(resp, response, sp->http, HTTP_HDR_RESPONSE)
void
-VRT_l_obj_status(struct sess *sp, int num)
+VRT_l_obj_status(const struct sess *sp, int num)
{
char *p;
}
int
-VRT_r_obj_status(struct sess *sp)
+VRT_r_obj_status(const struct sess *sp)
{
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);
}
void
-VRT_l_resp_status(struct sess *sp, int num)
+VRT_l_resp_status(const struct sess *sp, int num)
{
char *p;
*/
void
-VRT_l_obj_ttl(struct sess *sp, double a)
+VRT_l_obj_ttl(const struct sess *sp, double a)
{
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
}
double
-VRT_r_obj_ttl(struct sess *sp)
+VRT_r_obj_ttl(const struct sess *sp)
{
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC); /* XXX */
#define VOBJ(type,onm,field) \
void \
-VRT_l_obj_##onm(struct sess *sp, type a) \
+VRT_l_obj_##onm(const struct sess *sp, type a) \
{ \
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); \
CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC); /* XXX */ \
} \
\
type \
-VRT_r_obj_##onm(struct sess *sp) \
+VRT_r_obj_##onm(const struct sess *sp) \
{ \
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); \
CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC); /* XXX */ \
#define VREQ(n1, n2) \
const char * \
-VRT_r_req_##n1(struct sess *sp) \
+VRT_r_req_##n1(const struct sess *sp) \
{ \
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); \
CHECK_OBJ_NOTNULL(sp->http, HTTP_MAGIC); \
/*--------------------------------------------------------------------*/
const char *
-VRT_r_resp_proto(struct sess *sp)
+VRT_r_resp_proto(const struct sess *sp)
{
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);
}
const char *
-VRT_r_resp_response(struct sess *sp)
+VRT_r_resp_response(const struct sess *sp)
{
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);
}
int
-VRT_r_resp_status(struct sess *sp)
+VRT_r_resp_status(const struct sess *sp)
{
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);
/*--------------------------------------------------------------------*/
struct sockaddr *
-VRT_r_client_ip(struct sess *sp)
+VRT_r_client_ip(const struct sess *sp)
{
return (sp->sockaddr);
/*--------------------------------------------------------------------*/
double
-VRT_r_now(struct sess *sp)
+VRT_r_now(const struct sess *sp)
{
(void)sp;
}
double
-VRT_r_obj_lastuse(struct sess *sp)
+VRT_r_obj_lastuse(const struct sess *sp)
{
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
}
int
-VRT_r_backend_health(struct sess *sp)
+VRT_r_backend_health(const struct sess *sp)
{
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(sp->backend, BACKEND_MAGIC);
- return sp->backend->health;
+ return (sp->backend->health);
}
/*--------------------------------------------------------------------*/
char *
-VRT_IP_string(struct sess *sp, struct sockaddr *sa)
+VRT_IP_string(const struct sess *sp, const struct sockaddr *sa)
{
char h[64], p[8], *q;
socklen_t len = 0;
}
char *
-VRT_int_string(struct sess *sp, int num)
+VRT_int_string(const struct sess *sp, int num)
{
char *p;
int size = 12;
};
static int
-vrt_acl_vsl(struct sess *sp, const char *acln, struct vrt_acl *ap, int r)
+vrt_acl_vsl(const struct sess *sp, const char *acln, const struct vrt_acl *ap, int r)
{
AN(ap);
}
int
-VRT_acl_match(struct sess *sp, struct sockaddr *sa, const char *acln, struct vrt_acl *ap)
+VRT_acl_match(const struct sess *sp, struct sockaddr *sa, const char *acln, const struct vrt_acl *ap)
{
struct addrinfo *a1;
struct sockaddr_in *sin1, *sin2;
}
const char *
-VRT_regsub(struct sess *sp, const char *str, void *re, const char *sub)
+VRT_regsub(const struct sess *sp, const char *str, void *re, const char *sub)
{
regmatch_t pm[10];
regex_t *t;
};
/* ACL related */
-int VRT_acl_match(struct sess *, struct sockaddr *, const char *, struct vrt_acl *);
+int VRT_acl_match(const struct sess *, struct sockaddr *, const char *, const struct vrt_acl *);
void VRT_acl_init(struct vrt_acl *);
void VRT_acl_fini(struct vrt_acl *);
void VRT_re_fini(void *);
int VRT_re_match(const char *, void *re);
int VRT_re_test(struct vsb *, const char *, int sub);
-const char *VRT_regsub(struct sess *sp, const char *, void *, const char *);
+const char *VRT_regsub(const struct sess *sp, const char *, void *, const char *);
void VRT_purge(const char *, int hash);
-void VRT_count(struct sess *, unsigned);
+void VRT_count(const struct sess *, unsigned);
int VRT_rewrite(const char *, const char *);
void VRT_error(struct sess *, unsigned, const char *);
int VRT_switch_config(const char *);
enum gethdr_e { HDR_REQ, HDR_RESP, HDR_OBJ, HDR_BEREQ };
-char *VRT_GetHdr(struct sess *, enum gethdr_e where, const char *);
-void VRT_SetHdr(struct sess *, enum gethdr_e where, const char *, const char *, ...);
+char *VRT_GetHdr(const struct sess *, enum gethdr_e where, const char *);
+void VRT_SetHdr(const struct sess *, enum gethdr_e where, const char *, const char *, ...);
void VRT_handling(struct sess *sp, unsigned hand);
/* Simple stuff */
void VRT_init_random_backend(struct backend **, const struct vrt_random_backend *);
void VRT_fini_backend(struct backend *);
-char *VRT_IP_string(struct sess *sp, struct sockaddr *sa);
-char *VRT_int_string(struct sess *sp, int);
+char *VRT_IP_string(const struct sess *sp, const struct sockaddr *sa);
+char *VRT_int_string(const struct sess *sp, int);
#define VRT_done(sp, hand) \
do { \
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(struct sess *);
+struct sockaddr * VRT_r_client_ip(const struct sess *);
struct sockaddr * VRT_r_server_ip(struct sess *);
-const char * VRT_r_req_request(struct sess *);
-void VRT_l_req_request(struct sess *, const char *, ...);
-const char * VRT_r_req_url(struct sess *);
-void VRT_l_req_url(struct sess *, const char *, ...);
-const char * VRT_r_req_proto(struct sess *);
-void VRT_l_req_proto(struct sess *, const char *, ...);
+const char * VRT_r_req_request(const struct sess *);
+void VRT_l_req_request(const struct sess *, const char *, ...);
+const char * VRT_r_req_url(const struct sess *);
+void VRT_l_req_url(const struct sess *, const char *, ...);
+const char * VRT_r_req_proto(const struct sess *);
+void VRT_l_req_proto(const struct sess *, const char *, ...);
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_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 *);
-void VRT_l_obj_cacheable(struct sess *, unsigned);
-double VRT_r_obj_ttl(struct sess *);
-void VRT_l_obj_ttl(struct sess *, double);
-double VRT_r_obj_lastuse(struct sess *);
-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 *);
-void VRT_l_resp_response(struct sess *, const char *, ...);
-double VRT_r_now(struct sess *);
-int VRT_r_backend_health(struct sess *);
+const char * VRT_r_bereq_request(const struct sess *);
+void VRT_l_bereq_request(const struct sess *, const char *, ...);
+const char * VRT_r_bereq_url(const struct sess *);
+void VRT_l_bereq_url(const struct sess *, const char *, ...);
+const char * VRT_r_bereq_proto(const struct sess *);
+void VRT_l_bereq_proto(const struct sess *, const char *, ...);
+const char * VRT_r_obj_proto(const struct sess *);
+void VRT_l_obj_proto(const struct sess *, const char *, ...);
+int VRT_r_obj_status(const struct sess *);
+void VRT_l_obj_status(const struct sess *, int);
+const char * VRT_r_obj_response(const struct sess *);
+void VRT_l_obj_response(const struct sess *, const char *, ...);
+unsigned VRT_r_obj_valid(const struct sess *);
+void VRT_l_obj_valid(const struct sess *, unsigned);
+unsigned VRT_r_obj_cacheable(const struct sess *);
+void VRT_l_obj_cacheable(const struct sess *, unsigned);
+double VRT_r_obj_ttl(const struct sess *);
+void VRT_l_obj_ttl(const struct sess *, double);
+double VRT_r_obj_lastuse(const struct sess *);
+const char * VRT_r_resp_proto(const struct sess *);
+void VRT_l_resp_proto(const struct sess *, const char *, ...);
+int VRT_r_resp_status(const struct sess *);
+void VRT_l_resp_status(const struct sess *, int);
+const char * VRT_r_resp_response(const struct sess *);
+void VRT_l_resp_response(const struct sess *, const char *, ...);
+double VRT_r_now(const struct sess *);
+int VRT_r_backend_health(const struct sess *);
vcc_acl_top(struct tokenlist *tl, const char *acln)
{
- Fh(tl, 1, "\nstatic struct vrt_acl acl_%s[] = {\n", acln);
+ Fh(tl, 1, "\nstatic const struct vrt_acl acl_%s[] = {\n", acln);
tl->hindent += INDENT;
}
vsb_cat(sb, "};\n");
vsb_cat(sb, "\n");
vsb_cat(sb, "/* ACL related */\n");
- vsb_cat(sb, "int VRT_acl_match(struct sess *, struct sockaddr *, const char *, struct vrt_acl *);\n");
+ vsb_cat(sb, "int VRT_acl_match(const struct sess *, struct sockaddr *, const char *, const struct vrt_acl *);\n");
vsb_cat(sb, "void VRT_acl_init(struct vrt_acl *);\n");
vsb_cat(sb, "void VRT_acl_fini(struct vrt_acl *);\n");
vsb_cat(sb, "\n");
vsb_cat(sb, "void VRT_re_fini(void *);\n");
vsb_cat(sb, "int VRT_re_match(const char *, void *re);\n");
vsb_cat(sb, "int VRT_re_test(struct vsb *, const char *, int sub);\n");
- vsb_cat(sb, "const char *VRT_regsub(struct sess *sp, const char *, void *, const char *);\n");
+ vsb_cat(sb, "const char *VRT_regsub(const struct sess *sp, const char *, void *, const char *);\n");
vsb_cat(sb, "\n");
vsb_cat(sb, "void VRT_purge(const char *, int hash);\n");
vsb_cat(sb, "\n");
- vsb_cat(sb, "void VRT_count(struct sess *, unsigned);\n");
+ vsb_cat(sb, "void VRT_count(const struct sess *, unsigned);\n");
vsb_cat(sb, "int VRT_rewrite(const char *, const char *);\n");
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, 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_SetHdr(struct sess *, enum gethdr_e where, const char *, const char *, ...);\n");
+ vsb_cat(sb, "char *VRT_GetHdr(const struct sess *, enum gethdr_e where, const char *);\n");
+ vsb_cat(sb, "void VRT_SetHdr(const struct sess *, enum gethdr_e where, const char *, const char *, ...);\n");
vsb_cat(sb, "void VRT_handling(struct sess *sp, unsigned hand);\n");
vsb_cat(sb, "\n");
vsb_cat(sb, "/* Simple stuff */\n");
vsb_cat(sb, "void VRT_init_random_backend(struct backend **, const struct vrt_random_backend *);\n");
vsb_cat(sb, "void VRT_fini_backend(struct backend *);\n");
vsb_cat(sb, "\n");
- vsb_cat(sb, "char *VRT_IP_string(struct sess *sp, struct sockaddr *sa);\n");
- vsb_cat(sb, "char *VRT_int_string(struct sess *sp, int);\n");
+ vsb_cat(sb, "char *VRT_IP_string(const struct sess *sp, const struct sockaddr *sa);\n");
+ vsb_cat(sb, "char *VRT_int_string(const struct sess *sp, int);\n");
vsb_cat(sb, "\n");
vsb_cat(sb, "#define VRT_done(sp, hand) \\\n");
vsb_cat(sb, " do { \\\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(struct sess *);\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(struct sess *);\n");
- vsb_cat(sb, "void VRT_l_req_request(struct sess *, const char *, ...);\n");
- vsb_cat(sb, "const char * VRT_r_req_url(struct sess *);\n");
- vsb_cat(sb, "void VRT_l_req_url(struct sess *, const char *, ...);\n");
- vsb_cat(sb, "const char * VRT_r_req_proto(struct sess *);\n");
- vsb_cat(sb, "void VRT_l_req_proto(struct sess *, const char *, ...);\n");
+ vsb_cat(sb, "const char * VRT_r_req_request(const struct sess *);\n");
+ vsb_cat(sb, "void VRT_l_req_request(const struct sess *, const char *, ...);\n");
+ vsb_cat(sb, "const char * VRT_r_req_url(const struct sess *);\n");
+ vsb_cat(sb, "void VRT_l_req_url(const struct sess *, const char *, ...);\n");
+ vsb_cat(sb, "const char * VRT_r_req_proto(const struct sess *);\n");
+ vsb_cat(sb, "void VRT_l_req_proto(const struct sess *, const char *, ...);\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_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, "void VRT_l_obj_cacheable(struct sess *, unsigned);\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, "double VRT_r_obj_lastuse(struct sess *);\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, "void VRT_l_resp_response(struct sess *, const char *, ...);\n");
- vsb_cat(sb, "double VRT_r_now(struct sess *);\n");
- vsb_cat(sb, "int VRT_r_backend_health(struct sess *);\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");
+ vsb_cat(sb, "void VRT_l_bereq_url(const struct sess *, const char *, ...);\n");
+ vsb_cat(sb, "const char * VRT_r_bereq_proto(const struct sess *);\n");
+ vsb_cat(sb, "void VRT_l_bereq_proto(const struct sess *, const char *, ...);\n");
+ vsb_cat(sb, "const char * VRT_r_obj_proto(const struct sess *);\n");
+ vsb_cat(sb, "void VRT_l_obj_proto(const struct sess *, const char *, ...);\n");
+ vsb_cat(sb, "int VRT_r_obj_status(const struct sess *);\n");
+ vsb_cat(sb, "void VRT_l_obj_status(const struct sess *, int);\n");
+ vsb_cat(sb, "const char * VRT_r_obj_response(const struct sess *);\n");
+ vsb_cat(sb, "void VRT_l_obj_response(const struct sess *, const char *, ...);\n");
+ vsb_cat(sb, "unsigned VRT_r_obj_valid(const struct sess *);\n");
+ vsb_cat(sb, "void VRT_l_obj_valid(const struct sess *, unsigned);\n");
+ vsb_cat(sb, "unsigned VRT_r_obj_cacheable(const struct sess *);\n");
+ vsb_cat(sb, "void VRT_l_obj_cacheable(const struct sess *, unsigned);\n");
+ vsb_cat(sb, "double VRT_r_obj_ttl(const struct sess *);\n");
+ vsb_cat(sb, "void VRT_l_obj_ttl(const struct sess *, double);\n");
+ vsb_cat(sb, "double VRT_r_obj_lastuse(const struct sess *);\n");
+ vsb_cat(sb, "const char * VRT_r_resp_proto(const struct sess *);\n");
+ vsb_cat(sb, "void VRT_l_resp_proto(const struct sess *, const char *, ...);\n");
+ vsb_cat(sb, "int VRT_r_resp_status(const struct sess *);\n");
+ vsb_cat(sb, "void VRT_l_resp_status(const struct sess *, int);\n");
+ vsb_cat(sb, "const char * VRT_r_resp_response(const struct sess *);\n");
+ vsb_cat(sb, "void VRT_l_resp_response(const struct sess *, const char *, ...);\n");
+ vsb_cat(sb, "double VRT_r_now(const struct sess *);\n");
+ vsb_cat(sb, "int VRT_r_backend_health(const struct sess *);\n");
}
# Objects available in backends
set beobj {
- { backend.host WO HOSTNAME {} }
- { backend.port WO PORTNAME {} }
- { backend.dnsttl WO TIME {} }
- { backend.set WO SET {} }
+ { 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
{ client.ip
RO IP
{recv pipe pass hash miss hit fetch deliver }
+ "const struct sess *"
}
{ client.bandwidth # Not implemented yet
NO
+ { }
+ "const struct sess *"
}
{ server.ip
RO IP
{recv pipe pass hash miss hit fetch deliver }
+ "struct sess *"
}
# Request paramters
{ req.request
RW STRING
{recv pipe pass hash miss hit fetch }
+ "const struct sess *"
}
{ req.url
RW STRING
{recv pipe pass hash miss hit fetch }
+ "const struct sess *"
}
{ req.proto
RW STRING
{recv pipe pass hash miss hit fetch }
+ "const struct sess *"
}
{ req.http.
- RW HEADER
+ RW HDR_REQ
{recv pipe pass hash miss hit fetch }
- HDR_REQ
+ "const struct sess *"
}
# Possibly misnamed, not really part of the request
{ req.hash
WO HASH
{ hash }
+ "struct sess *"
}
{ req.backend
RW BACKEND
{recv pipe pass hash miss hit fetch }
+ "struct sess *"
}
# Request sent to backend
{ bereq.request
RW STRING
{ pipe pass miss }
+ "const struct sess *"
}
{ bereq.url
RW STRING
{ pipe pass miss }
+ "const struct sess *"
}
{ bereq.proto
RW STRING
{ pipe pass miss }
+ "const struct sess *"
}
{ bereq.http.
- RW HEADER
+ RW HDR_BEREQ
{ pipe pass miss }
- HDR_BEREQ
+ "const struct sess *"
}
# The (possibly) cached object
{ obj.proto
RW STRING
{ hit fetch }
+ "const struct sess *"
}
{ obj.status
RW INT
{ fetch }
+ "const struct sess *"
}
{ obj.response
RW STRING
{ fetch }
+ "const struct sess *"
}
{ obj.http.
- RW HEADER
+ RW HDR_OBJ
{ hit fetch }
- HDR_OBJ
+ "const struct sess *"
}
{ obj.valid
RW BOOL
{ hit fetch discard timeout}
+ "const struct sess *"
}
{ obj.cacheable
RW BOOL
{ hit fetch discard timeout}
+ "const struct sess *"
}
{ obj.ttl
RW TIME
{ hit fetch discard timeout}
+ "const struct sess *"
}
{ obj.lastuse
RO TIME
{ hit fetch deliver discard timeout}
+ "const struct sess *"
}
# The response we send back
{ resp.proto
RW STRING
{ deliver }
+ "const struct sess *"
}
{ resp.status
RW INT
{ deliver }
+ "const struct sess *"
}
{ resp.response
RW STRING
{ deliver }
+ "const struct sess *"
}
{ resp.http.
- RW HEADER
+ RW HDR_RESP
{ deliver }
- HDR_RESP
+ "const struct sess *"
}
# Miscellaneous
{ now
RO TIME
{recv pipe pass hash miss hit fetch deliver discard timeout}
+ "const struct sess *"
}
{ backend.health RO INT
{recv pipe pass hash miss hit fetch deliver discard timeout}
+ "const struct sess *"
}
}
-set tt(IP) "struct sockaddr *"
-set tt(STRING) "const char *"
-set tt(BOOL) "unsigned"
-set tt(BACKEND) "struct backend *"
-set tt(TIME) "double"
-set tt(INT) "int"
-set tt(HEADER) "const char *"
-set tt(HOSTNAME) "const char *"
-set tt(PORTNAME) "const char *"
-set tt(HASH) "const char *"
-set tt(SET) "struct vrt_backend_entry *"
+set tt(IP) "struct sockaddr *"
+set tt(STRING) "const char *"
+set tt(BOOL) "unsigned"
+set tt(BACKEND) "struct backend *"
+set tt(TIME) "double"
+set tt(INT) "int"
+set tt(HDR_RESP) "const char *"
+set tt(HDR_OBJ) "const char *"
+set tt(HDR_REQ) "const char *"
+set tt(HDR_BEREQ) "const char *"
+set tt(HOSTNAME) "const char *"
+set tt(PORTNAME) "const char *"
+set tt(HASH) "const char *"
+set tt(SET) "struct vrt_backend_entry *"
#----------------------------------------------------------------------
# Boilerplate warning for all generated files.
return [string range $l 3 end]
}
-proc vars {v ty pa} {
+proc vars {v pa} {
global tt fo fp
regsub -all "#\[^\n\]*\n" $v "" v
set a [lindex $v 1]
if {$a == "NO"} continue
set t [lindex $v 2]
- puts $fo "\t\{ \"$n\", $t, [string length $n],"
+ set ty [lindex $v 4]
+ if {[regexp HDR_ $t]} {
+ puts $fo "\t\{ \"$n\", HEADER, [string length $n],"
+ } else {
+ puts $fo "\t\{ \"$n\", $t, [string length $n],"
+ }
if {$a == "RO" || $a == "RW"} {
puts $fo "\t \"VRT_r_${m}($pa)\","
- if {$t != "HEADER"} {
+ if {![regexp HDR_ $t]} {
puts $fp "$tt($t) VRT_r_${m}($ty);"
}
} else {
}
if {$a == "WO" || $a == "RW"} {
puts $fo "\t \"VRT_l_${m}($pa, \","
- if {$t == "HEADER"} {
+ if {[regexp HDR_ $t]} {
} elseif {$t == "STRING"} {
puts $fp "void VRT_l_${m}($ty, $tt($t), ...);"
} else {
puts $fo "\t NULL,"
}
puts $fo "\t V_$a,"
- if {$t != "HEADER"} {
+ if {![regexp HDR_ $t]} {
puts $fo "\t 0,"
} else {
- puts $fo "\t \"[lindex $v 4]\","
+ puts $fo "\t \"$t\","
}
puts $fo "\t [method_map [lindex $v 3]]"
puts $fo "\t\},"
puts $fo ""
puts $fo "struct var vcc_be_vars\[\] = {"
-vars $beobj "struct backend *" "backend"
+vars $beobj "backend"
puts $fo "};"
puts $fo ""
puts $fo "struct var vcc_vars\[\] = {"
-vars $spobj "struct sess *" "sp"
+vars $spobj "sp"
puts $fo "};"
close $fp