]> err.no Git - varnish/commitdiff
Add bitmap of methods where they are valid to all objects.
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 25 Jun 2007 07:14:08 +0000 (07:14 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 25 Jun 2007 07:14:08 +0000 (07:14 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1551 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/lib/libvcl/vcc_compile.h
varnish-cache/lib/libvcl/vcc_gen_obj.tcl
varnish-cache/lib/libvcl/vcc_obj.c

index 4b5898d09c13bf6f31b4d67b95b109984e7f1eb5..d6ec14370a9a4a0d1098ce78bdead33fa6d1b3ec 100644 (file)
@@ -121,6 +121,7 @@ struct var {
        const char              *rname;
        const char              *lname;
        unsigned                has_string;
+       unsigned                methods;
 };
 
 struct method {
index b188fbbe3226cbb1da2629772924071fdb0f5bb8..f47bb54f70a895cf734e261deab4ed0efef1d5c2 100755 (executable)
@@ -40,19 +40,45 @@ set beobj {
 # Objects which operate on sessions
 
 set spobj {
-       { client.ip             IP              1}
-       { server.ip             IP              1}
-       { req.request           STRING          1}
-       { req.host              STRING          1}
-        { req.url              STRING          1}
-        { req.proto            STRING          1}
-        { req.backend          BACKEND         0}
-        { req.hash             HASH            0}
-        { obj.valid            BOOL            0}
-        { obj.cacheable                BOOL            0}
-        { obj.ttl              TIME            0}
-        { req.http.            HEADER          1}
-        { resp.http.           HEADER          1}
+       { client.ip             IP              1
+           {recv pipe pass hash miss hit fetch}
+       }
+       { server.ip             IP              1
+           {recv pipe pass hash miss hit fetch}
+       }
+       { req.request           STRING          1
+           {recv pipe pass hash miss hit fetch}
+       }
+       { req.host              STRING          1
+           {recv pipe pass hash miss hit fetch}
+       }
+        { req.url              STRING          1
+           {recv pipe pass hash miss hit fetch}
+       }
+        { req.proto            STRING          1
+           {recv pipe pass hash miss hit fetch}
+       }
+        { req.backend          BACKEND         0
+           {recv pipe pass hash miss hit fetch}
+       }
+        { req.http.            HEADER          1
+           {recv pipe pass hash miss hit fetch}
+       }
+        { req.hash             HASH            0
+           {hash}
+       }
+        { obj.valid            BOOL            0
+           {hit fetch}
+       }
+        { obj.cacheable                BOOL            0
+           {hit fetch}
+       }
+        { obj.ttl              TIME            0
+           {hit fetch}
+       }
+        { resp.http.           HEADER          1
+           {fetch}
+       }
 }
 
 set tt(IP)     "struct sockaddr *"
@@ -85,6 +111,16 @@ warns $fo
 set fp [open ../../include/vrt_obj.h w]
 warns $fp
 
+proc method_map {m} {
+
+       set l ""
+       foreach i $m {
+               append l " | "
+               append l VCL_MET_[string toupper $i]
+       }
+       return [string range $l 3 end]
+}
+
 proc vars {v ty pa} {
        global tt fo fp
 
@@ -95,7 +131,8 @@ proc vars {v ty pa} {
                puts $fo  "\t\{ \"$n\", $t, [string length $n],"
                puts $fo  "\t    \"VRT_r_${m}($pa)\","
                puts $fo  "\t    \"VRT_l_${m}($pa, \","
-               puts $fo  "\t    [lindex $v 2]"
+               puts $fo  "\t    [lindex $v 2], "
+               puts $fo  "\t    [method_map [lindex $v 3]]"
                puts $fo "\t\},"
 
                puts $fp  "$tt($t) VRT_r_${m}($ty);"
index d5a74953cd778829b40bad705afaafca8c629e54..593e5388ebb98ea77d2a5b37713e45a07cca75c9 100644 (file)
@@ -13,17 +13,20 @@ struct var vcc_be_vars[] = {
        { "backend.host", HOSTNAME, 12,
            "VRT_r_backend_host(backend)",
            "VRT_l_backend_host(backend, ",
-           0
+           0, 
+           
        },
        { "backend.port", PORTNAME, 12,
            "VRT_r_backend_port(backend)",
            "VRT_l_backend_port(backend, ",
-           0
+           0, 
+           
        },
        { "backend.dnsttl", TIME, 14,
            "VRT_r_backend_dnsttl(backend)",
            "VRT_l_backend_dnsttl(backend, ",
-           0
+           0, 
+           
        },
        { NULL }
 };
@@ -32,67 +35,80 @@ struct var vcc_vars[] = {
        { "client.ip", IP, 9,
            "VRT_r_client_ip(sp)",
            "VRT_l_client_ip(sp, ",
-           1
+           1, 
+           VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH
        },
        { "server.ip", IP, 9,
            "VRT_r_server_ip(sp)",
            "VRT_l_server_ip(sp, ",
-           1
+           1, 
+           VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH
        },
        { "req.request", STRING, 11,
            "VRT_r_req_request(sp)",
            "VRT_l_req_request(sp, ",
-           1
+           1, 
+           VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH
        },
        { "req.host", STRING, 8,
            "VRT_r_req_host(sp)",
            "VRT_l_req_host(sp, ",
-           1
+           1, 
+           VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH
        },
        { "req.url", STRING, 7,
            "VRT_r_req_url(sp)",
            "VRT_l_req_url(sp, ",
-           1
+           1, 
+           VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH
        },
        { "req.proto", STRING, 9,
            "VRT_r_req_proto(sp)",
            "VRT_l_req_proto(sp, ",
-           1
+           1, 
+           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, ",
-           0
+           0, 
+           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)",
+           "VRT_l_req_http_(sp, ",
+           1, 
+           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,
            "VRT_r_req_hash(sp)",
            "VRT_l_req_hash(sp, ",
-           0
+           0, 
+           VCL_MET_HASH
        },
        { "obj.valid", BOOL, 9,
            "VRT_r_obj_valid(sp)",
            "VRT_l_obj_valid(sp, ",
-           0
+           0, 
+           VCL_MET_HIT | VCL_MET_FETCH
        },
        { "obj.cacheable", BOOL, 13,
            "VRT_r_obj_cacheable(sp)",
            "VRT_l_obj_cacheable(sp, ",
-           0
+           0, 
+           VCL_MET_HIT | VCL_MET_FETCH
        },
        { "obj.ttl", TIME, 7,
            "VRT_r_obj_ttl(sp)",
            "VRT_l_obj_ttl(sp, ",
-           0
-       },
-       { "req.http.", HEADER, 9,
-           "VRT_r_req_http_(sp)",
-           "VRT_l_req_http_(sp, ",
-           1
+           0, 
+           VCL_MET_HIT | VCL_MET_FETCH
        },
        { "resp.http.", HEADER, 10,
            "VRT_r_resp_http_(sp)",
            "VRT_l_resp_http_(sp, ",
-           1
+           1, 
+           VCL_MET_FETCH
        },
        { NULL }
 };