r1616 - in trunk/varnish-cache: include lib/libvcl

phk at projects.linpro.no phk at projects.linpro.no
Mon Jul 2 15:22:37 CEST 2007


Author: phk
Date: 2007-07-02 15:22:36 +0200 (Mon, 02 Jul 2007)
New Revision: 1616

Modified:
   trunk/varnish-cache/include/vrt_obj.h
   trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c
   trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl
   trunk/varnish-cache/lib/libvcl/vcc_obj.c
Log:
Update the list of variables in accordance with the new scheme.


Modified: trunk/varnish-cache/include/vrt_obj.h
===================================================================
--- trunk/varnish-cache/include/vrt_obj.h	2007-07-02 13:18:03 UTC (rev 1615)
+++ trunk/varnish-cache/include/vrt_obj.h	2007-07-02 13:22:36 UTC (rev 1616)
@@ -14,10 +14,21 @@
 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 @@
 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 *);

Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c	2007-07-02 13:18:03 UTC (rev 1615)
+++ trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c	2007-07-02 13:22:36 UTC (rev 1616)
@@ -462,10 +462,21 @@
 	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 @@
 	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");
 }

Modified: trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl	2007-07-02 13:18:03 UTC (rev 1615)
+++ trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl	2007-07-02 13:22:36 UTC (rev 1616)
@@ -30,75 +30,123 @@
 # 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 {
 
-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                }
+		{recv pipe pass hash miss hit fetch                        }
 	}
-	{ req.backend
-		RW BACKEND
-		{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 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,"
 		}

Modified: trunk/varnish-cache/lib/libvcl/vcc_obj.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_obj.c	2007-07-02 13:18:03 UTC (rev 1615)
+++ trunk/varnish-cache/lib/libvcl/vcc_obj.c	2007-07-02 13:22:36 UTC (rev 1616)
@@ -62,16 +62,10 @@
 	    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 @@
 	    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 @@
 	},
 	{ "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 }




More information about the varnish-commit mailing list