Permalink
Browse files

Basic renaming && dummy command.

  • Loading branch information...
nand2 committed Sep 21, 2012
1 parent b6f64c4 commit 39e7ef830cbe82e2e47ae830f2804e1bffd7c8b9
Showing with 42 additions and 164 deletions.
  1. +0 −2 COPYING
  2. +2 −2 Makefile.am
  3. +7 −94 README.rst
  4. +2 −2 configure.ac
  5. +7 −7 src/Makefile.am
  6. +0 −22 src/tests/test01.vtc
  7. +0 −32 src/vmod_example.c
  8. +0 −3 src/vmod_example.vcc
  9. +21 −0 src/vmod_throttle.c
  10. +3 −0 src/vmod_throttle.vcc
View
@@ -1,5 +1,3 @@
-Copyright (c) 2011 Varnish Software AS
-...
See LICENSE for details.
You're free to use and distribute this under terms in the
View
@@ -4,10 +4,10 @@ SUBDIRS = src
EXTRA_DIST = README.rst
-dist_man_MANS = vmod_example.3
+dist_man_MANS = vmod_throttle.3
MAINTAINERCLEANFILES = $(dist_man_MANS)
-vmod_example.3: README.rst
+vmod_throttle.3: README.rst
%.1 %.2 %.3 %.4 %.5 %.6 %.7 %.8 %.9:
if HAVE_RST2MAN
View
@@ -1,96 +1,9 @@
-============
-vmod_example
-============
+=============
+vmod_throttle
+=============
-----------------------
-Varnish Example Module
-----------------------
+-------------------------
+Varnish Throttling Module
+-------------------------
-:Author: Martin Blix Grydeland
-:Date: 2011-05-26
-:Version: 1.0
-:Manual section: 3
-
-SYNOPSIS
-========
-
-import example;
-
-DESCRIPTION
-===========
-
-Example Varnish vmod demonstrating how to write an out-of-tree Varnish vmod.
-
-Implements the traditional Hello World as a vmod.
-
-FUNCTIONS
-=========
-
-hello
------
-
-Prototype
- ::
-
- hello(STRING S)
-Return value
- STRING
-Description
- Returns "Hello, " prepended to S
-Example
- ::
-
- set resp.http.hello = example.hello("World");
-
-INSTALLATION
-============
-
-This is an example skeleton for developing out-of-tree Varnish
-vmods. It implements the "Hello, World!" as a vmod callback. Not
-particularly useful in good hello world tradition, but demonstrates how
-to get the glue around a vmod working.
-
-The source tree is based on autotools to configure the building, and
-does also have the necessary bits in place to do functional unit tests
-using the varnishtest tool.
-
-Usage::
-
- ./configure VARNISHSRC=DIR [VMODDIR=DIR]
-
-`VARNISHSRC` is the directory of the Varnish source tree for which to
-compile your vmod. Both the `VARNISHSRC` and `VARNISHSRC/include`
-will be added to the include search paths for your module.
-
-Optionally you can also set the vmod install directory by adding
-`VMODDIR=DIR` (defaults to the pkg-config discovered directory from your
-Varnish installation).
-
-Make targets:
-
-* make - builds the vmod
-* make install - installs your vmod in `VMODDIR`
-* make check - runs the unit tests in ``src/tests/*.vtc``
-
-In your VCL you could then use this vmod along the following lines::
-
- import example;
-
- sub vcl_deliver {
- # This sets resp.http.hello to "Hello, World"
- set resp.http.hello = example.hello("World");
- }
-
-HISTORY
-=======
-
-This manual page was released as part of the libvmod-example package,
-demonstrating how to create an out-of-tree Varnish vmod.
-
-COPYRIGHT
-=========
-
-This document is licensed under the same license as the
-libvmod-example project. See LICENSE for details.
-
-* Copyright (c) 2011 Varnish Software
+In progress...
View
@@ -1,8 +1,8 @@
AC_PREREQ(2.59)
AC_COPYRIGHT([Copyright (c) 2011 Varnish Software AS])
-AC_INIT([libvmod-example], [trunk])
+AC_INIT([libvmod-throttle], [trunk])
AC_CONFIG_MACRO_DIR([m4])
-AC_CONFIG_SRCDIR(src/vmod_example.vcc)
+AC_CONFIG_SRCDIR(src/vmod_throttle.vcc)
AM_CONFIG_HEADER(config.h)
AC_CANONICAL_SYSTEM
View
@@ -1,17 +1,17 @@
INCLUDES = -I$(VARNISHSRC)/include -I$(VARNISHSRC)
vmoddir = $(VMODDIR)
-vmod_LTLIBRARIES = libvmod_example.la
+vmod_LTLIBRARIES = libvmod_throttle.la
-libvmod_example_la_LDFLAGS = -module -export-dynamic -avoid-version
+libvmod_throttle_la_LDFLAGS = -module -export-dynamic -avoid-version
-libvmod_example_la_SOURCES = \
+libvmod_throttle_la_SOURCES = \
vcc_if.c \
vcc_if.h \
- vmod_example.c
+ vmod_throttle.c
-vcc_if.c vcc_if.h: $(VARNISHSRC)/lib/libvmod_std/vmod.py $(top_srcdir)/src/vmod_example.vcc
- @PYTHON@ $(VARNISHSRC)/lib/libvmod_std/vmod.py $(top_srcdir)/src/vmod_example.vcc
+vcc_if.c vcc_if.h: $(VARNISHSRC)/lib/libvmod_std/vmod.py $(top_srcdir)/src/vmod_throttle.vcc
+ @PYTHON@ $(VARNISHSRC)/lib/libvmod_std/vmod.py $(top_srcdir)/src/vmod_throttle.vcc
VMOD_TESTS = tests/*.vtc
.PHONY: $(VMOD_TESTS)
@@ -22,7 +22,7 @@ tests/*.vtc:
check: $(VMOD_TESTS)
EXTRA_DIST = \
- vmod_example.vcc \
+ vmod_throttle.vcc \
$(VMOD_TESTS)
CLEANFILES = $(builddir)/vcc_if.c $(builddir)/vcc_if.h
View
@@ -1,22 +0,0 @@
-varnishtest "Test example vmod"
-
-server s1 {
- rxreq
- txresp
-} -start
-
-varnish v1 -vcl+backend {
- import example from "${vmod_topbuild}/src/.libs/libvmod_example.so";
-
- sub vcl_deliver {
- set resp.http.hello = example.hello("World");
- }
-} -start
-
-client c1 {
- txreq -url "/"
- rxresp
- expect resp.http.hello == "Hello, World"
-}
-
-client c1 -run
View
@@ -1,32 +0,0 @@
-#include <stdlib.h>
-
-#include "vrt.h"
-#include "bin/varnishd/cache.h"
-
-#include "vcc_if.h"
-
-int
-init_function(struct vmod_priv *priv, const struct VCL_conf *conf)
-{
- return (0);
-}
-
-const char *
-vmod_hello(struct sess *sp, const char *name)
-{
- char *p;
- unsigned u, v;
-
- u = WS_Reserve(sp->wrk->ws, 0); /* Reserve some work space */
- p = sp->wrk->ws->f; /* Front of workspace area */
- v = snprintf(p, u, "Hello, %s", name);
- v++;
- if (v > u) {
- /* No space, reset and leave */
- WS_Release(sp->wrk->ws, 0);
- return (NULL);
- }
- /* Update work space with what we've used */
- WS_Release(sp->wrk->ws, v);
- return (p);
-}
View
@@ -1,3 +0,0 @@
-Module example
-Init init_function
-Function STRING hello(STRING)
View
@@ -0,0 +1,21 @@
+#include <stdlib.h>
+
+#include "vrt.h"
+#include "bin/varnishd/cache.h"
+
+#include "vcc_if.h"
+
+int
+init_function(struct vmod_priv *priv, const struct VCL_conf *conf)
+{
+ return (0);
+}
+
+int
+vmod_is_allowed(struct sess *sp)
+{
+ char *p;
+ unsigned u, v;
+
+ return 1;
+}
View
@@ -0,0 +1,3 @@
+Module throttle
+Init init_function
+Function INT is_allowed()

0 comments on commit 39e7ef8

Please sign in to comment.