Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
b7027d48
Commit
b7027d48
authored
Apr 16, 2013
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Encode the VRT prototype leading arguments, they're about to become
more complicated.
parent
9b091b5e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
71 deletions
+79
-71
cache_vrt_var.c
bin/varnishd/cache/cache_vrt_var.c
+2
-2
generate.py
lib/libvcl/generate.py
+77
-69
No files found.
bin/varnishd/cache/cache_vrt_var.c
View file @
b7027d48
...
...
@@ -232,8 +232,8 @@ VRT_l_client_identity(struct req *req, const char *str, ...)
/*--------------------------------------------------------------------*/
#define BEREQ_TIMEOUT(which) \
void
__match_proto__()
\
VRT_l_bereq_##which(struct req *req, double num) \
void
\
VRT_l_bereq_##which(
const
struct req *req, double num) \
{ \
\
CHECK_OBJ_NOTNULL(req, REQ_MAGIC); \
...
...
lib/libvcl/generate.py
View file @
b7027d48
...
...
@@ -103,385 +103,385 @@ sp_variables = (
'IP'
,
(
'proc'
,),
(
),
'
struct req *
'
'
R
'
),
(
'client.identity'
,
'STRING'
,
(
'proc'
,),
(
'proc'
,),
'
struct req *
'
'
R
'
),
(
'server.ip'
,
'IP'
,
(
'proc'
,),
(
),
'
struct req *
'
'
R
'
),
(
'server.hostname'
,
'STRING'
,
(
'proc'
,),
(
),
'
struct req *
'
'
R
'
),
(
'server.identity'
,
'STRING'
,
(
'proc'
,),
(
),
'
struct req *
'
'
R
'
),
(
'server.port'
,
'INT'
,
(
'proc'
,),
(
),
'
struct req *
'
'
R
'
),
(
'req.method'
,
'STRING'
,
(
'proc'
,),
(
'proc'
,),
'c
onst struct req *
'
'c
R
'
),
(
'req.request'
,
'STRING'
,
(
'proc'
,),
(
'proc'
,),
'c
onst struct req *
'
'c
R
'
),
(
'req.url'
,
'STRING'
,
(
'proc'
,),
(
'proc'
,),
'c
onst struct req *
'
'c
R
'
),
(
'req.proto'
,
'STRING'
,
(
'proc'
,),
(
'proc'
,),
'c
onst struct req *
'
'c
R
'
),
(
'req.http.'
,
'HEADER'
,
(
'proc'
,),
(
'proc'
,),
'c
onst struct req *
'
'c
R
'
),
(
'req.backend'
,
'BACKEND'
,
(
'proc'
,),
(
'proc'
,),
'
struct req *
'
'
R
'
),
(
'req.restarts'
,
'INT'
,
(
'proc'
,),
(
),
'c
onst struct req *
'
'c
R
'
),
(
'req.esi_level'
,
'INT'
,
(
'proc'
,),
(
),
'c
onst struct req *
'
'c
R
'
),
(
'req.ttl'
,
'DURATION'
,
(
'proc'
,),
(
'proc'
,),
'
struct req *
'
'
R
'
),
(
'req.grace'
,
'DURATION'
,
(
'proc'
,),
(
'proc'
,),
'
struct req *
'
'
R
'
),
(
'req.keep'
,
'DURATION'
,
(
'proc'
,),
(
'proc'
,),
'
struct req *
'
'
R
'
),
(
'req.xid'
,
'STRING'
,
(
'proc'
,),
(
),
'
struct req *
'
'
R
'
),
(
'req.esi'
,
'BOOL'
,
(
'recv'
,
'response'
,
'deliver'
,
'error'
,),
(
'recv'
,
'response'
,
'deliver'
,
'error'
,),
'
struct req *
'
'
R
'
),
(
'req.can_gzip'
,
'BOOL'
,
(
'proc'
,),
(
),
'
struct req *
'
'
R
'
),
(
'req.backend.healthy'
,
'BOOL'
,
(
'proc'
,),
(
),
'
struct req *
'
'
R
'
),
(
'req.hash_ignore_busy'
,
'BOOL'
,
(
'recv'
,),
(
'recv'
,),
'
struct req *
'
'
R
'
),
(
'req.hash_always_miss'
,
'BOOL'
,
(
'recv'
,),
(
'recv'
,),
'
struct req *
'
'
R
'
),
(
'bereq.method'
,
'STRING'
,
(
'pipe'
,
'fetch'
,
'pass'
,
'miss'
,
'response'
,),
(
'pipe'
,
'fetch'
,
'pass'
,
'miss'
,
'response'
,),
'c
onst struct req *
'
'c
R
'
),
(
'bereq.request'
,
'STRING'
,
(
'pipe'
,
'fetch'
,
'pass'
,
'miss'
,
'response'
,),
(
'pipe'
,
'fetch'
,
'pass'
,
'miss'
,
'response'
,),
'c
onst struct req *
'
'c
R
'
),
(
'bereq.url'
,
'STRING'
,
(
'pipe'
,
'fetch'
,
'pass'
,
'miss'
,
'response'
,),
(
'pipe'
,
'fetch'
,
'pass'
,
'miss'
,
'response'
,),
'c
onst struct req *
'
'c
R
'
),
(
'bereq.proto'
,
'STRING'
,
(
'pipe'
,
'fetch'
,
'pass'
,
'miss'
,
'response'
,),
(
'pipe'
,
'fetch'
,
'pass'
,
'miss'
,
'response'
,),
'c
onst struct req *
'
'c
R
'
),
(
'bereq.http.'
,
'HEADER'
,
(
'pipe'
,
'fetch'
,
'pass'
,
'miss'
,
'response'
,),
(
'pipe'
,
'fetch'
,
'pass'
,
'miss'
,
'response'
,),
'c
onst struct req *
'
'c
R
'
),
(
'bereq.connect_timeout'
,
'DURATION'
,
(
'pipe'
,
'fetch'
,
'pass'
,
'miss'
,),
(
'pipe'
,
'fetch'
,
'pass'
,
'miss'
,),
'
struct req *
'
'
cR
'
),
(
'bereq.first_byte_timeout'
,
'DURATION'
,
(
'fetch'
,
'pass'
,
'miss'
,),
(
'fetch'
,
'pass'
,
'miss'
,),
'
struct req *
'
'
cR
'
),
(
'bereq.between_bytes_timeout'
,
'DURATION'
,
(
'fetch'
,
'pass'
,
'miss'
,),
(
'fetch'
,
'pass'
,
'miss'
,),
'
struct req *
'
'
cR
'
),
(
'beresp.proto'
,
'STRING'
,
(
'response'
,),
(
'response'
,),
'c
onst struct req *
'
'c
R
'
),
(
'beresp.saintmode'
,
'DURATION'
,
(
),
(
'response'
,),
'c
onst struct req *
'
'c
R
'
),
(
'beresp.status'
,
'INT'
,
(
'response'
,),
(
'response'
,),
'c
onst struct req *
'
'c
R
'
),
(
'beresp.response'
,
'STRING'
,
(
'response'
,),
(
'response'
,),
'c
onst struct req *
'
'c
R
'
),
(
'beresp.http.'
,
'HEADER'
,
(
'response'
,),
(
'response'
,),
'c
onst struct req *
'
'c
R
'
),
(
'beresp.do_esi'
,
'BOOL'
,
(
'response'
,),
(
'response'
,),
'c
onst struct req *
'
'c
R
'
),
(
'beresp.do_stream'
,
'BOOL'
,
(
'response'
,),
(
'response'
,),
'c
onst struct req *
'
'c
R
'
),
(
'beresp.do_gzip'
,
'BOOL'
,
(
'response'
,),
(
'response'
,),
'c
onst struct req *
'
'c
R
'
),
(
'beresp.do_gunzip'
,
'BOOL'
,
(
'response'
,),
(
'response'
,),
'c
onst struct req *
'
'c
R
'
),
(
'beresp.do_pass'
,
'BOOL'
,
(
'response'
,),
(
'response'
,),
'c
onst struct req *
'
'c
R
'
),
(
'beresp.uncacheable'
,
'BOOL'
,
(
'response'
,),
(
'response'
,),
'c
onst struct req *
'
'c
R
'
),
(
'beresp.ttl'
,
'DURATION'
,
(
'response'
,),
(
'response'
,),
'
struct req *
'
'
R
'
),
(
'beresp.grace'
,
'DURATION'
,
(
'response'
,),
(
'response'
,),
'
struct req *
'
'
R
'
),
(
'beresp.keep'
,
'DURATION'
,
(
'response'
,),
(
'response'
,),
'
struct req *
'
'
R
'
),
(
'beresp.backend.name'
,
'STRING'
,
(
'response'
,),
(
),
'c
onst struct req *
'
'c
R
'
),
(
'beresp.backend.ip'
,
'IP'
,
(
'response'
,),
(
),
'c
onst struct req *
'
'c
R
'
),
(
'beresp.backend.port'
,
'INT'
,
(
'response'
,),
(
),
'c
onst struct req *
'
'c
R
'
),
(
'beresp.storage'
,
'STRING'
,
(
'response'
,),
(
'response'
,),
'
struct req *
'
'
R
'
),
(
'obj.proto'
,
'STRING'
,
(
'lookup'
,
'error'
,),
(
'lookup'
,
'error'
,),
'c
onst struct req *
'
'c
R
'
),
(
'obj.status'
,
'INT'
,
(
'error'
,),
(
'error'
,),
'c
onst struct req *
'
'c
R
'
),
(
'obj.response'
,
'STRING'
,
(
'error'
,),
(
'error'
,),
'c
onst struct req *
'
'c
R
'
),
(
'obj.hits'
,
'INT'
,
(
'lookup'
,
'deliver'
,),
(
),
'c
onst struct req *
'
'c
R
'
),
(
'obj.http.'
,
'HEADER'
,
(
'lookup'
,
'error'
,),
(
'error'
,),
# XXX ?
'c
onst struct req *
'
'c
R
'
),
(
'obj.ttl'
,
'DURATION'
,
(
'lookup'
,
'error'
,),
(
'lookup'
,
'error'
,),
'
struct req *
'
'
R
'
),
(
'obj.grace'
,
'DURATION'
,
(
'lookup'
,
'error'
,),
(
'lookup'
,
'error'
,),
'
struct req *
'
'
R
'
),
(
'obj.keep'
,
'DURATION'
,
(
'lookup'
,
'error'
,),
(
'lookup'
,
'error'
,),
'
struct req *
'
'
R
'
),
(
'obj.lastuse'
,
'DURATION'
,
(
'lookup'
,
'deliver'
,
'error'
,),
(
),
'c
onst struct req *
'
'c
R
'
),
(
'obj.uncacheable'
,
'BOOL'
,
(
'lookup'
,
'deliver'
,
'error'
,),
(
),
'c
onst struct req *
'
'c
R
'
),
(
'resp.proto'
,
'STRING'
,
(
'deliver'
,),
(
'deliver'
,),
'c
onst struct req *
'
'c
R
'
),
(
'resp.status'
,
'INT'
,
(
'deliver'
,),
(
'deliver'
,),
'c
onst struct req *
'
'c
R
'
),
(
'resp.response'
,
'STRING'
,
(
'deliver'
,),
(
'deliver'
,),
'c
onst struct req *
'
'c
R
'
),
(
'resp.http.'
,
'HEADER'
,
(
'deliver'
,),
(
'deliver'
,),
'c
onst struct req *
'
'c
R
'
),
(
'now'
,
'TIME'
,
(
'all'
,),
(
),
'c
onst struct req *
'
'c
R
'
),
)
...
...
@@ -849,6 +849,17 @@ fo.write("""
const struct var vcc_vars[] = {
"""
)
def
mk_proto
(
c
,
r
=
False
):
s
=
""
for
i
in
c
:
if
i
==
"c"
and
not
r
:
s
+=
" const"
if
i
==
"R"
:
if
r
:
s
+=
" const"
s
+=
" struct req *"
return
s
[
1
:]
for
i
in
sp_variables
:
typ
=
i
[
1
]
cnam
=
i
[
0
]
.
replace
(
"."
,
"_"
)
...
...
@@ -864,10 +875,7 @@ for i in sp_variables:
fo
.
write
(
'",
\n
'
)
else
:
fo
.
write
(
'
\t
"VRT_r_
%
s(req)",
\n
'
%
cnam
)
if
i
[
4
][:
5
]
!=
"const"
:
fh
.
write
(
ctyp
+
" VRT_r_
%
s(const
%
s);
\n
"
%
(
cnam
,
i
[
4
]))
else
:
fh
.
write
(
ctyp
+
" VRT_r_
%
s(
%
s);
\n
"
%
(
cnam
,
i
[
4
]))
fh
.
write
(
ctyp
+
" VRT_r_
%
s(
%
s);
\n
"
%
(
cnam
,
mk_proto
(
i
[
4
],
True
)))
restrict
(
fo
,
i
[
2
])
if
len
(
i
[
3
])
==
0
:
...
...
@@ -878,7 +886,7 @@ for i in sp_variables:
fo
.
write
(
'",
\n
'
)
else
:
fo
.
write
(
'
\t
"VRT_l_
%
s(req, ",
\n
'
%
cnam
)
fh
.
write
(
"void VRT_l_
%
s(
%
s, "
%
(
cnam
,
i
[
4
]
))
fh
.
write
(
"void VRT_l_
%
s(
%
s, "
%
(
cnam
,
mk_proto
(
i
[
4
],
False
)
))
if
typ
!=
"STRING"
:
fh
.
write
(
ctyp
+
");
\n
"
)
else
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment