]> err.no Git - varnish/commitdiff
Update the list of variables in accordance with the new scheme.
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 2 Jul 2007 13:22:36 +0000 (13:22 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 2 Jul 2007 13:22:36 +0000 (13:22 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1616 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/include/vrt_obj.h
varnish-cache/lib/libvcl/vcc_fixed_token.c
varnish-cache/lib/libvcl/vcc_gen_obj.tcl
varnish-cache/lib/libvcl/vcc_obj.c

index 9ca434e331e51395e5f01136a4e64093b1e7cf21..c40483be755b55ecb06662330b03657b5ad7123c 100644 (file)
@@ -14,10 +14,21 @@ struct sockaddr * VRT_r_server_ip(struct sess *);
 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 *);
@@ -25,6 +36,8 @@ void VRT_l_obj_cacheable(struct sess *, unsigned);
 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 *);
index edad77f1b20ca32394bfa84bf0c9b5e24a50ddc4..b864afd51970d57b0c6d229919e769b5ce08ec73 100644 (file)
@@ -462,10 +462,21 @@ vcl_output_lang_h(struct vsb *sb)
        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");
@@ -473,7 +484,9 @@ vcl_output_lang_h(struct vsb *sb)
        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");
 }
index a718bd0cd74a76664099d96d30ffab72e694fc9c..079e208e616758dc4b16c74086502c53aa5520c1 100755 (executable)
 # 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                        }
        }
 }
 
@@ -146,21 +194,27 @@ proc method_map {m} {
 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,"
                }
index da9586b0a159315b509b9d1021b55ad9a2cf27a0..6c4b088e569c6e6944331cbad1fafafb22a84b51 100644 (file)
@@ -62,16 +62,10 @@ struct var vcc_vars[] = {
            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,
@@ -80,6 +74,60 @@ struct var vcc_vars[] = {
            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, ",
@@ -100,26 +148,26 @@ struct var vcc_vars[] = {
        },
        { "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 }