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
9488a2ad
Commit
9488a2ad
authored
Jul 08, 2019
by
Federico G. Schwindt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update to mention STRANDS and reword
parent
54e7d45b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
25 deletions
+24
-25
vmod.rst
doc/sphinx/reference/vmod.rst
+24
-25
No files found.
doc/sphinx/reference/vmod.rst
View file @
9488a2ad
...
@@ -50,35 +50,36 @@ data structures that do all the hard work.
...
@@ -50,35 +50,36 @@ data structures that do all the hard work.
The std VMODs vmod.vcc file looks somewhat like this::
The std VMODs vmod.vcc file looks somewhat like this::
$Module std 3
$ABI strict
$ABI strict
$Module std 3 "Varnish Standard Module"
$Event event_function
$Event event_function
$Function STRING toupper(STR
ING_LIST
)
$Function STRING toupper(STR
ANDS s
)
$Function STRING tolower(STR
ING_LIST
)
$Function STRING tolower(STR
ANDS s
)
$Function VOID set_ip_tos(INT)
$Function VOID set_ip_tos(INT)
The first line gives the name of the module and the manual section where
The ``$ABI`` line is optional. Possible values are ``strict``
the documentation will reside.
(default) and ``vrt``. It allows to specify that a vmod is integrating
with the blessed ``vrt`` interface provided by ``varnishd`` or go
deeper in the stack.
The ``$ABI`` line is optional (possible values ``strict`` (default)
As a rule of thumb you, if the VMOD uses more than the VRT (Varnish
and ``vrt``) and allows to specify that a vmod is integrating with the
RunTime), in which case it needs to be built for the exact Varnish
blessed ``vrt`` interface provided by ``varnishd`` or go deeper in the
version, use ``strict``. If it complies to the VRT and only needs
stack. As a general rule of thumb you are considered "on your own" if
to be rebuilt when breaking changes are introduced to the VRT API,
your VMOD uses more than the VRT (Varnish RunTime), in which case it
use ``vrt``.
needs to be built for the exact Varnish version.
``$ABI vrt`` means that a module complies to the VRT and only needs to
The ``$Module`` line gives the name of the module, the manual section
be rebuilt when breaking changes are introduced to the VRT API
.
where the documentation will reside, and the description
.
The
third line specifies an optional "Event" function, which will be
The
``$Event`` line specifies an optional "Event" function, which
called whenever a VCL program which imports this VMOD is loaded or
will be called whenever a VCL program which imports this VMOD is
transitions to any of the warm, active, cold or discarded states.
loaded or transitions to any of the warm, active, cold or discarded
More on this below.
states.
More on this below.
The
next three lines define three functions in the VMOD, along with the
The
``$Function`` lines define three functions in the VMOD, along
types of the arguments, and that is probably where the hardest bit of
with the types of the arguments, and that is probably where the
writing a VMOD is to be found, so we will talk about that at length in
hardest bit of writing a VMOD is to be found, so we will talk about
a moment.
that at length in
a moment.
Notice that the third function returns VOID, that makes it a "procedure"
Notice that the third function returns VOID, that makes it a "procedure"
in VCL lingo, meaning that it cannot be used in expressions, right side
in VCL lingo, meaning that it cannot be used in expressions, right side
...
@@ -102,10 +103,8 @@ the functions you want to export to VCL.
...
@@ -102,10 +103,8 @@ the functions you want to export to VCL.
For the std VMOD, the compiled vcc_if.h file looks like this::
For the std VMOD, the compiled vcc_if.h file looks like this::
struct vmod_priv;
VCL_STRING vmod_toupper(VRT_CTX, VCL_STRANDS);
VCL_STRING vmod_tolower(VRT_CTX, VCL_STRANDS);
VCL_STRING vmod_toupper(VRT_CTX, const char *, ...);
VCL_STRING vmod_tolower(VRT_CTX, const char *, ...);
VCL_VOID vmod_set_ip_tos(VRT_CTX, VCL_INT);
VCL_VOID vmod_set_ip_tos(VRT_CTX, VCL_INT);
vmod_event_f event_function;
vmod_event_f event_function;
...
...
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