From 1479613746f448a437ecbb61a55d9ba39da81efe Mon Sep 17 00:00:00 2001 From: phk Date: Mon, 27 Mar 2006 11:21:18 +0000 Subject: [PATCH] Stuff VCL programs needs to know about. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@74 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/include/vcl_lang.h | 74 ++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 varnish-cache/include/vcl_lang.h diff --git a/varnish-cache/include/vcl_lang.h b/varnish-cache/include/vcl_lang.h new file mode 100644 index 00000000..4e74e474 --- /dev/null +++ b/varnish-cache/include/vcl_lang.h @@ -0,0 +1,74 @@ +/* + * Stuff necessary to compile a VCL programs C code + * + * XXX: When this file is changed, lib/libvcl/vcl_gen_fixed_token.tcl + * XXX: *MUST* be rerun. + */ + + +struct vcl_ref { + unsigned line; + unsigned pos; + unsigned count; + const char *token; +}; + +struct vcl_acl { + unsigned ip; + unsigned mask; +}; + +struct client { + unsigned ip; +}; + +struct req { + char *req; + char *useragent; + struct { + char *path; + char *host; + } url; + double ttlfactor; + struct backend *backend; +}; + +struct backend { + unsigned ip; + double responsetime; + double timeout; + double bandwidth; + int down; +}; + +struct obj { + int exists; + double ttl; + unsigned result; + unsigned size; + unsigned usage; +}; + +#define VCL_FARGS struct client *client, struct obj *obj, struct req *req, struct backend *backend +#define VCL_PASS_ARGS client, obj, req, backend + +void VCL_count(unsigned); +void VCL_no_cache(); +void VCL_no_new_cache(); +int ip_match(unsigned, struct vcl_acl *); +int string_match(const char *, const char *); +int VCL_rewrite(const char *, const char *); +int VCL_error(unsigned, const char *); +int VCL_fetch(void); +int VCL_switch_config(const char *); + +typedef void vcl_init_f(void); + +struct VCL_conf { + unsigned magic; +#define VCL_CONF_MAGIC 0x7406c509 /* from /dev/random */ + vcl_init_f *init_func; + struct backend *default_backend; + struct vcl_ref *ref; + unsigned nref; +}; -- 2.39.5