-
Notifications
You must be signed in to change notification settings - Fork 380
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
it actually just uses the TCP acceptor code, but tests plugging via an extension
- Loading branch information
Showing
6 changed files
with
210 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
varnishtest "Minimal acceptor VEXT test" | ||
|
||
shell -err -expect {Error: Acceptor foo not found} { | ||
varnishd -b None -a %foo,socket -n ${tmpdir} | ||
} | ||
|
||
shell -err -expect {Error: Acceptor bar not found} { | ||
varnishd -b None -a name=%bar,socket -n ${tmpdir} | ||
} | ||
|
||
varnish v1 \ | ||
-arg "-E ${topbuild}/vmod/.libs/libvmod_vext_debug.so" \ | ||
-arg "-a dbg=%dbg,${listen_addr}" \ | ||
-vcl { | ||
|
||
backend none none; | ||
|
||
sub vcl_recv { | ||
return (synth(200)); | ||
} | ||
} -start | ||
|
||
#client c1 -repeat 10 { | ||
client c1 { | ||
txreq | ||
rxresp | ||
} -run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
## Generated by vmodtool.py --boilerplate. | ||
|
||
vmod_vext_debug_vcc ?= $(srcdir)/vmod_vext_debug.vcc | ||
|
||
vmod_vcc_files += $(vmod_vext_debug_vcc) | ||
|
||
vmod_LTLIBRARIES += libvmod_vext_debug.la | ||
|
||
libvmod_vext_debug_la_SOURCES = \ | ||
vmod_vext_debug.c \ | ||
vmod_vext_debug_acceptor.c | ||
|
||
libvmod_vext_debug_la_CFLAGS = | ||
|
||
vmodtoolargs_vext_debug ?= --strict --boilerplate -o vcc_vext_debug_if | ||
vmod_vext_debug_symbols_regex ?= Vmod_vext_debug_Data | ||
|
||
libvmod_vext_debug_la_LDFLAGS = \ | ||
-export-symbols-regex $(vmod_vext_debug_symbols_regex) \ | ||
$(AM_LDFLAGS) \ | ||
$(VMOD_LDFLAGS) | ||
|
||
nodist_libvmod_vext_debug_la_SOURCES = vcc_vext_debug_if.c vcc_vext_debug_if.h | ||
|
||
EXTRA_libvmod_vext_debug_la_DEPENDENCIES = $(nodist_libvmod_vext_debug_la_SOURCES) | ||
|
||
EXTRA_DIST += automake_boilerplate_vext_debug.am | ||
|
||
$(libvmod_vext_debug_la_OBJECTS): vcc_vext_debug_if.h | ||
|
||
vcc_vext_debug_if.h vmod_vext_debug.rst vmod_vext_debug.man.rst: vcc_vext_debug_if.c | ||
|
||
# A doc-change will not update mtime on the .h and .c files, so a | ||
# touch(1) is necessary to signal that vmodtool was in fact run. | ||
vcc_vext_debug_if.c: $(VMODTOOL) $(srcdir)/vmod_vext_debug.vcc | ||
@PYTHON@ $(VMODTOOL) $(vmodtoolargs_vext_debug) $(srcdir)/vmod_vext_debug.vcc | ||
touch vcc_vext_debug_if.c | ||
|
||
clean-local: clean-vmod-vext_debug | ||
|
||
clean-vmod-vext_debug: | ||
rm -f $(nodist_libvmod_vext_debug_la_SOURCES) | ||
rm -f vmod_vext_debug.rst vmod_vext_debug.man.rst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include "config.h" | ||
#include "vdef.h" | ||
#include "vrt.h" | ||
#include "vcc_vext_debug_if.h" | ||
|
||
VCL_VOID | ||
dbgvext_dummy(VRT_CTX) | ||
{ | ||
(void) ctx; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Copyright 2024 UPLEX - Nils Goroll Systemoptimierung | ||
# All rights reserved. | ||
# | ||
# Author: Nils Goroll <[email protected]> | ||
# | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions | ||
# are met: | ||
# 1. Redistributions of source code must retain the above copyright | ||
# notice, this list of conditions and the following disclaimer. | ||
# 2. Redistributions in binary form must reproduce the above copyright | ||
# notice, this list of conditions and the following disclaimer in the | ||
# documentation and/or other materials provided with the distribution. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | ||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
# ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE | ||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
# SUCH DAMAGE. | ||
|
||
$ABI strict | ||
$Prefix dbgvext | ||
$Module vext_debug 3 "Varnish Extension development, test and debug" | ||
$Synopsis auto | ||
DESCRIPTION | ||
=========== | ||
|
||
At this point, this vmod does not expose any interface to VCL. | ||
|
||
It implements the "dbg" acceptor, which simply wraps the "tcp" acceptor. | ||
|
||
$Function VOID dummy() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/*- | ||
* Copyright 2024 UPLEX - Nils Goroll Systemoptimierung | ||
* All rights reserved. | ||
* | ||
* Author: Nils Goroll <[email protected]> | ||
* | ||
* SPDX-License-Identifier: BSD-2-Clause | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | ||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE | ||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
* SUCH DAMAGE. | ||
*/ | ||
|
||
#include "config.h" | ||
|
||
#include <stdio.h> | ||
|
||
#include "cache/cache_varnishd.h" | ||
#include "acceptor/cache_acceptor.h" | ||
#include "acceptor/mgt_acceptor.h" | ||
|
||
struct acceptor DBG_acceptor; | ||
|
||
// these callbacks are all noops, because we initialize our dbg acceptor as a | ||
// tcp acceptor, which keeps a list of its instances, so the respective | ||
// functions get already called through the tcp acceptor | ||
|
||
static int | ||
acc_dbg_reopen(void) | ||
{ | ||
return (0); | ||
} | ||
|
||
static void | ||
acc_dbg_start(struct cli *cli) | ||
{ | ||
(void) cli; | ||
} | ||
|
||
static void | ||
acc_dbg_accept(struct pool * pp) | ||
{ | ||
(void) pp; | ||
} | ||
|
||
static void | ||
acc_dbg_update(pthread_mutex_t * shut_mtx) | ||
{ | ||
(void) shut_mtx; | ||
} | ||
|
||
static void | ||
acc_dbg_shutdown(void) | ||
{ | ||
} | ||
|
||
static void __attribute__((constructor)) | ||
init_register_acceptor(void) { | ||
fprintf(stderr, "HELLO from dbg acceptor VEXT\n"); | ||
DBG_acceptor = TCP_acceptor; | ||
DBG_acceptor.name = "dbg"; | ||
DBG_acceptor.reopen = acc_dbg_reopen; | ||
DBG_acceptor.start = acc_dbg_start; | ||
DBG_acceptor.accept = acc_dbg_accept; | ||
DBG_acceptor.update = acc_dbg_update; | ||
DBG_acceptor.shutdown = acc_dbg_shutdown; | ||
|
||
VCA_Add(&DBG_acceptor); | ||
} |