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
4ad414e2
Commit
4ad414e2
authored
Apr 19, 2018
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a proof-of-concept rot13 VFP
parent
c984e5d3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
vmod_debug.c
lib/libvmod_debug/vmod_debug.c
+39
-0
No files found.
lib/libvmod_debug/vmod_debug.c
View file @
4ad414e2
...
...
@@ -36,6 +36,7 @@
#include <unistd.h>
#include "cache/cache_varnishd.h"
#include "cache/cache_filter.h"
#include "vsa.h"
#include "vtim.h"
...
...
@@ -57,6 +58,37 @@ static pthread_mutex_t vsc_mtx = PTHREAD_MUTEX_INITIALIZER;
static
struct
vsc_seg
*
vsc_seg
=
NULL
;
static
struct
VSC_debug
*
vsc
=
NULL
;
/**********************************************************************/
static
enum
vfp_status
v_matchproto_
(
vfp_pull_f
)
xyzzy_rot13_pull
(
struct
vfp_ctx
*
vc
,
struct
vfp_entry
*
vfe
,
void
*
p
,
ssize_t
*
lp
)
{
enum
vfp_status
vp
;
char
*
q
;
ssize_t
l
;
(
void
)
vfe
;
vp
=
VFP_Suck
(
vc
,
p
,
lp
);
if
(
vp
==
VFP_ERROR
)
return
(
vp
);
q
=
p
;
for
(
l
=
0
;
l
<
*
lp
;
l
++
,
q
++
)
{
if
(
*
q
>=
'A'
&&
*
q
<=
'Z'
)
*
q
=
(((
*
q
-
'A'
)
+
13
)
%
26
)
+
'A'
;
if
(
*
q
>=
'a'
&&
*
q
<=
'z'
)
*
q
=
(((
*
q
-
'a'
)
+
13
)
%
26
)
+
'a'
;
}
return
(
vp
);
}
static
const
struct
vfp
xyzzy_rot13
=
{
.
name
=
"rot13"
,
.
pull
=
xyzzy_rot13_pull
,
};
/**********************************************************************/
VCL_STRING
v_matchproto_
(
td_debug_author
)
xyzzy_author
(
VRT_CTX
,
VCL_ENUM
person
,
VCL_ENUM
someone
)
{
...
...
@@ -241,6 +273,12 @@ event_load(VRT_CTX, struct vmod_priv *priv)
AN
(
priv_vcl
->
foo
);
priv
->
priv
=
priv_vcl
;
priv
->
free
=
priv_vcl_free
;
/*
* NB: This is a proof of concept, until we decide what the real
* API should look like, do NOT do this anywhere else.
*/
VRT_AddVFP
(
ctx
,
&
xyzzy_rot13
);
return
(
0
);
}
...
...
@@ -319,6 +357,7 @@ event_function(VRT_CTX, struct vmod_priv *priv, enum vcl_event_e e)
case
VCL_EVENT_WARM
:
return
(
event_warm
(
ctx
,
priv
));
case
VCL_EVENT_COLD
:
return
(
event_cold
(
ctx
,
priv
));
case
VCL_EVENT_DISCARD
:
VRT_RemoveVFP
(
ctx
,
&
xyzzy_rot13
);
if
(
vsc
)
VSC_debug_Destroy
(
&
vsc_seg
);
return
(
0
);
...
...
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