[master] 6e6edd0 Complete (?) the varnish API #include cleanup.

Poul-Henning Kamp phk at varnish-cache.org
Sun Oct 9 18:57:35 CEST 2011


commit 6e6edd08227b1ced1c0d15117e3ea9f0afde40e7
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Sun Oct 9 16:56:04 2011 +0000

    Complete (?) the varnish API #include cleanup.
    
    We now have
    	<vapi/vs[mcl].h> for the programmatic API
    
    	<vapi/vs[cl]_int.h> for the underlying structure,
    			    shared between API and varnishd

diff --git a/bin/varnishadm/varnishadm.c b/bin/varnishadm/varnishadm.c
index 68ebbf7..d371b9f 100644
--- a/bin/varnishadm/varnishadm.c
+++ b/bin/varnishadm/varnishadm.c
@@ -29,6 +29,9 @@
 
 #include "config.h"
 
+#include "vapi/vsm.h"
+#include "vapi/vsl.h"
+
 #include <fcntl.h>
 #include <poll.h>
 #include <stdio.h>
@@ -44,7 +47,6 @@
 #include "vcli.h"
 #include "cli_common.h"
 #include "libvarnish.h"
-#include "varnishapi.h"
 #include "vss.h"
 
 #ifdef HAVE_LIBEDIT
diff --git a/bin/varnishd/cache.h b/bin/varnishd/cache.h
index d3228a5..c5bc614 100644
--- a/bin/varnishd/cache.h
+++ b/bin/varnishd/cache.h
@@ -34,6 +34,9 @@
  */
 #define VARNISH_CACHE_CHILD	1
 
+#include "vapi/vsc_int.h"
+#include "vapi/vsl_int.h"
+
 #include <sys/socket.h>
 
 #include <pthread.h>
@@ -54,9 +57,6 @@
 
 #include "heritage.h"
 
-#include "vsc.h"
-#include "vsl.h"
-
 enum body_status {
 #define BODYSTATUS(U,l)	BS_##U,
 #include "tbl/body_status.h"
diff --git a/bin/varnishd/mgt_shmem.c b/bin/varnishd/mgt_shmem.c
index 17789f8..5b717b0 100644
--- a/bin/varnishd/mgt_shmem.c
+++ b/bin/varnishd/mgt_shmem.c
@@ -86,6 +86,9 @@
 
 #include "config.h"
 
+#include "vapi/vsl_int.h"
+#include "vapi/vsc_int.h"
+
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -95,8 +98,6 @@
 #include <sys/mman.h>
 #include <sys/stat.h>
 
-#include "vsc.h"
-#include "vsl.h"
 #include "mgt.h"
 #include "heritage.h"
 #include "vmb.h"
diff --git a/bin/varnishhist/varnishhist.c b/bin/varnishhist/varnishhist.c
index 75f7bd9..9485df7 100644
--- a/bin/varnishhist/varnishhist.c
+++ b/bin/varnishhist/varnishhist.c
@@ -32,6 +32,9 @@
 
 #include "config.h"
 
+#include "vapi/vsm.h"
+#include "vapi/vsl.h"
+
 #include <sys/types.h>
 #include <curses.h>
 #include <errno.h>
@@ -46,8 +49,6 @@
 #include <unistd.h>
 
 #include "libvarnish.h"
-#include "vsl.h"
-#include "varnishapi.h"
 
 #define HIST_N 2000 /* how far back we remember */
 #define HIST_LOW -6 /* low end of log range */
diff --git a/bin/varnishlog/varnishlog.c b/bin/varnishlog/varnishlog.c
index c7749cb..c67432d 100644
--- a/bin/varnishlog/varnishlog.c
+++ b/bin/varnishlog/varnishlog.c
@@ -31,6 +31,9 @@
 
 #include "config.h"
 
+#include "vapi/vsm.h"
+#include "vapi/vsl.h"
+
 #include <errno.h>
 #include <fcntl.h>
 #include <signal.h>
@@ -45,8 +48,6 @@
 #include "vpf.h"
 
 #include "libvarnish.h"
-#include "vsl.h"
-#include "varnishapi.h"
 
 static int	b_flag, c_flag;
 
diff --git a/bin/varnishncsa/base64.c b/bin/varnishncsa/base64.c
index 23dae14..3758604 100644
--- a/bin/varnishncsa/base64.c
+++ b/bin/varnishncsa/base64.c
@@ -6,8 +6,10 @@
 
 #include "config.h"
 
+#include "vapi/vsm.h"
+#include "vapi/vsl.h"
+
 #include <sys/types.h>
-#include "varnishapi.h"
 #include "base64.h"
 
 static const char b64[] =
diff --git a/bin/varnishncsa/varnishncsa.c b/bin/varnishncsa/varnishncsa.c
index 7c35c3e..bbaa366 100644
--- a/bin/varnishncsa/varnishncsa.c
+++ b/bin/varnishncsa/varnishncsa.c
@@ -59,6 +59,9 @@
 
 #include "config.h"
 
+#include "vapi/vsm.h"
+#include "vapi/vsl.h"
+
 #include <ctype.h>
 #include <signal.h>
 #include <stdio.h>
@@ -74,9 +77,7 @@
 #include "vqueue.h"
 
 #include "libvarnish.h"
-#include "vsl.h"
 #include "vre.h"
-#include "varnishapi.h"
 #include "base64.h"
 
 static volatile sig_atomic_t reopen;
diff --git a/bin/varnishreplay/varnishreplay.c b/bin/varnishreplay/varnishreplay.c
index f7355cb..dbb6f51 100644
--- a/bin/varnishreplay/varnishreplay.c
+++ b/bin/varnishreplay/varnishreplay.c
@@ -28,6 +28,9 @@
 
 #include "config.h"
 
+#include "vapi/vsm.h"
+#include "vapi/vsl.h"
+
 #include <sys/types.h>
 #include <sys/signal.h>
 #include <sys/uio.h>
@@ -46,7 +49,6 @@
 #include "vqueue.h"
 
 #include "libvarnish.h"
-#include "varnishapi.h"
 #include "vss.h"
 
 #define freez(x) do { if (x) free(x); x = NULL; } while (0);
diff --git a/bin/varnishsizes/varnishsizes.c b/bin/varnishsizes/varnishsizes.c
index ccff669..ac9dbf8 100644
--- a/bin/varnishsizes/varnishsizes.c
+++ b/bin/varnishsizes/varnishsizes.c
@@ -32,6 +32,9 @@
 
 #include "config.h"
 
+#include "vapi/vsm.h"
+#include "vapi/vsl.h"
+
 #include <sys/types.h>
 #include <curses.h>
 #include <errno.h>
@@ -46,8 +49,6 @@
 #include <unistd.h>
 
 #include "libvarnish.h"
-#include "vsl.h"
-#include "varnishapi.h"
 
 #define HIST_N 2000 /* how far back we remember */
 #define HIST_LOW 1 /* low end of log range */
diff --git a/bin/varnishstat/varnishstat.c b/bin/varnishstat/varnishstat.c
index a8b1d5f..76a2e03 100644
--- a/bin/varnishstat/varnishstat.c
+++ b/bin/varnishstat/varnishstat.c
@@ -32,6 +32,9 @@
 
 #include "config.h"
 
+#include "vapi/vsm.h"
+#include "vapi/vsc.h"
+
 #include <sys/time.h>
 
 #include <errno.h>
@@ -42,8 +45,6 @@
 #include <unistd.h>
 
 #include "libvarnish.h"
-#include "vsc.h"
-#include "varnishapi.h"
 #include "varnishstat.h"
 
 /*--------------------------------------------------------------------*/
diff --git a/bin/varnishstat/varnishstat_curses.c b/bin/varnishstat/varnishstat_curses.c
index 22d21fc..fc948e9 100644
--- a/bin/varnishstat/varnishstat_curses.c
+++ b/bin/varnishstat/varnishstat_curses.c
@@ -32,6 +32,9 @@
 
 #include "config.h"
 
+#include "vapi/vsm.h"
+#include "vapi/vsc.h"
+
 #include <sys/time.h>
 
 #ifdef HAVE_NCURSES_CURSES_H
@@ -48,9 +51,7 @@
 #include <unistd.h>
 
 #include "libvarnish.h"
-#include "vsc.h"
 #include "vqueue.h"
-#include "varnishapi.h"
 #include "varnishstat.h"
 
 #if 0
diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c
index aea29a4..7362f1f 100644
--- a/bin/varnishtest/vtc_varnish.c
+++ b/bin/varnishtest/vtc_varnish.c
@@ -28,6 +28,10 @@
 
 #include "config.h"
 
+#include "vapi/vsm.h"
+#include "vapi/vsc.h"
+#include "vapi/vsl.h"
+
 #include <stdio.h>
 
 #include <fcntl.h>
@@ -44,7 +48,6 @@
 #include "vtc.h"
 
 #include "libvarnish.h"
-#include "varnishapi.h"
 
 #include "vcli.h"
 #include "vss.h"
diff --git a/bin/varnishtop/varnishtop.c b/bin/varnishtop/varnishtop.c
index 8459ab5..de3789f 100644
--- a/bin/varnishtop/varnishtop.c
+++ b/bin/varnishtop/varnishtop.c
@@ -32,6 +32,9 @@
 
 #include "config.h"
 
+#include "vapi/vsm.h"
+#include "vapi/vsl.h"
+
 #include <ctype.h>
 #include <curses.h>
 #include <errno.h>
@@ -48,8 +51,6 @@
 #include "vsb.h"
 
 #include "libvarnish.h"
-#include "vsl.h"
-#include "varnishapi.h"
 
 #if 0
 #define AC(x) assert((x) != ERR)
diff --git a/configure.ac b/configure.ac
index ef7d76c..cf1f566 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,7 +3,7 @@ AC_COPYRIGHT([Copyright (c) 2006 Verdens Gang AS
 Copyright (c) 2006-2011 Varnish Software AS])
 AC_REVISION([$Id$])
 AC_INIT([Varnish], [trunk], [varnish-dev at varnish-cache.org])
-AC_CONFIG_SRCDIR(include/varnishapi.h)
+AC_CONFIG_SRCDIR(include/miniobj.h)
 AM_CONFIG_HEADER(config.h)
 
 # save command line CFLAGS for use in VCC_CC (to pass through things like -m64)
diff --git a/include/Makefile.am b/include/Makefile.am
index 47fede9..0f1782f 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -17,10 +17,10 @@ pkginclude_HEADERS = \
 	tbl/vsl_tags.h \
 	vapi/vsm.h \
 	vapi/vsc.h \
-	varnishapi.h \
+	vapi/vsc_int.h \
+	vapi/vsl.h \
+	vapi/vsl_int.h \
 	vcli.h \
-	vsc.h \
-	vsl.h \
 	vsm.h
 
 nobase_noinst_HEADERS = \
diff --git a/include/vapi/vsc.h b/include/vapi/vsc.h
index 290db9d..1101e53 100644
--- a/include/vapi/vsc.h
+++ b/include/vapi/vsc.h
@@ -31,6 +31,8 @@
 #ifndef VAPI_VSC_H_INCLUDED
 #define VAPI_VSC_H_INCLUDED
 
+#include "vapi/vsc_int.h"
+
 /*---------------------------------------------------------------------
  * VSC level access functions
  */
diff --git a/include/vapi/vsc_int.h b/include/vapi/vsc_int.h
new file mode 100644
index 0000000..0a9cbf9
--- /dev/null
+++ b/include/vapi/vsc_int.h
@@ -0,0 +1,50 @@
+/*-
+ * Copyright (c) 2006 Verdens Gang AS
+ * Copyright (c) 2006-2010 Varnish Software AS
+ * All rights reserved.
+ *
+ * Author: Poul-Henning Kamp <phk at phk.freebsd.dk>
+ *
+ * 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 <stdint.h>
+
+#define VSC_CLASS          "Stat"
+
+#define VSC_TYPE_MAIN		""
+#define VSC_TYPE_SMA	"SMA"
+#define VSC_TYPE_SMF	"SMF"
+#define VSC_TYPE_VBE	"VBE"
+#define VSC_TYPE_LCK	"LCK"
+
+#define VSC_F(n, t, l, f, e, d)	t n;
+
+#define VSC_DO(u,l,t) struct VSC_C_##l {
+#define VSC_DONE(u,l,t) };
+
+#include "tbl/vsc_all.h"
+
+#undef VSC_DO
+#undef VSC_F
+#undef VSC_DONE
diff --git a/include/vapi/vsl.h b/include/vapi/vsl.h
new file mode 100644
index 0000000..5068f1c
--- /dev/null
+++ b/include/vapi/vsl.h
@@ -0,0 +1,105 @@
+/*-
+ * Copyright (c) 2006 Verdens Gang AS
+ * Copyright (c) 2006-2011 Varnish Software AS
+ * All rights reserved.
+ *
+ * Author: Poul-Henning Kamp <phk at phk.freebsd.dk>
+ *
+ * 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.
+ *
+ */
+
+#ifndef VAPI_VSL_H_INCLUDED
+#define VAPI_VSL_H_INCLUDED
+
+#include <stdint.h>
+
+#include "vapi/vsl_int.h"
+
+/*---------------------------------------------------------------------
+ * VSL level access functions
+ */
+
+void VSL_Setup(struct VSM_data *vd);
+	/*
+	 * Setup vd for use with VSL functions.
+	 */
+
+int VSL_Open(struct VSM_data *vd, int diag);
+	/*
+	 * Attempt to open and map the shared memory file.
+	 * If diag is non-zero, diagnostics are emitted.
+	 * Returns:
+	 *	0 on success
+	 *	!= 0 on failure
+	 */
+
+#define VSL_ARGS	"bCcdI:i:k:n:r:s:X:x:m:"
+#define VSL_b_USAGE	"[-b]"
+#define VSL_c_USAGE	"[-c]"
+#define VSL_C_USAGE	"[-C]"
+#define VSL_d_USAGE	"[-d]"
+#define VSL_i_USAGE	"[-i tag]"
+#define VSL_I_USAGE	"[-I regexp]"
+#define VSL_k_USAGE	"[-k keep]"
+#define VSL_m_USAGE	"[-m tag:regex]"
+#define VSL_n_USAGE	VSM_n_USAGE
+#define VSL_r_USAGE	"[-r file]"
+#define VSL_s_USAGE	"[-s skip]"
+#define VSL_x_USAGE	"[-x tag]"
+#define VSL_X_USAGE	"[-X regexp]"
+#define VSL_USAGE	"[-bCcd] "		\
+			VSL_i_USAGE " "		\
+			VSL_I_USAGE " "		\
+			VSL_k_USAGE " "		\
+			VSL_m_USAGE " "		\
+			VSL_n_USAGE " "		\
+			VSL_r_USAGE " "		\
+			VSL_s_USAGE " "		\
+			VSL_X_USAGE " "		\
+			VSL_x_USAGE
+
+int VSL_Arg(struct VSM_data *vd, int arg, const char *opt);
+	/*
+	 * Handle standard log-presenter arguments
+	 * Return:
+	 *	-1 error
+	 *	 0 not handled
+	 *	 1 Handled.
+	 */
+
+typedef int VSL_handler_f(void *priv, enum VSL_tag_e tag, unsigned fd,
+    unsigned len, unsigned spec, const char *ptr, uint64_t bitmap);
+
+#define VSL_S_CLIENT	(1 << 0)
+#define VSL_S_BACKEND	(1 << 1)
+VSL_handler_f VSL_H_Print;
+struct VSM_data;
+void VSL_Select(const struct VSM_data *vd, unsigned tag);
+void VSL_NonBlocking(const struct VSM_data *vd, int nb);
+int VSL_Dispatch(struct VSM_data *vd, VSL_handler_f *func, void *priv);
+int VSL_NextLog(const struct VSM_data *lh, uint32_t **pp, uint64_t *bitmap);
+int VSL_Matched(const struct VSM_data *vd, uint64_t bitmap);
+int VSL_Name2Tag(const char *name, int l);
+extern const char *VSL_tags[256];
+
+#endif /* VAPI_VSL_H_INCLUDED */
diff --git a/include/vapi/vsl_int.h b/include/vapi/vsl_int.h
new file mode 100644
index 0000000..8176cce
--- /dev/null
+++ b/include/vapi/vsl_int.h
@@ -0,0 +1,82 @@
+/*-
+ * Copyright (c) 2006 Verdens Gang AS
+ * Copyright (c) 2006-2010 Varnish Software AS
+ * All rights reserved.
+ *
+ * Author: Poul-Henning Kamp <phk at phk.freebsd.dk>
+ *
+ * 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.
+ *
+ * Define the layout of the shared memory log segment.
+ *
+ * NB: THIS IS NOT A PUBLIC API TO VARNISH!
+ */
+
+#ifndef VAPI_VSL_FMT_H_INCLUDED
+#define VAPI_VSL_FMT_H_INCLUDED
+
+#define VSL_CLASS		"Log"
+
+/*
+ * Shared memory log format
+ *
+ * The log is structured as an array of 32bit unsigned integers.
+ *
+ * The first integer contains a non-zero serial number, which changes
+ * whenever writing the log starts from the front.
+ *
+ * Each logrecord consist of:
+ *	[n]		= ((type & 0xff) << 24) | (length & 0xffff)
+ *	[n + 1]		= identifier
+ *	[n + 2] ... [m]	= content
+ */
+
+#define VSL_CLIENTMARKER	(1U<<30)
+#define VSL_BACKENDMARKER	(1U<<31)
+#define VSL_IDENTMASK		(~(3U<<30))
+
+#define VSL_WORDS(len)		(((len) + 3) / 4)
+#define VSL_END(ptr, len)	((ptr) + 2 + VSL_WORDS(len))
+#define VSL_NEXT(ptr)		VSL_END(ptr, VSL_LEN(ptr))
+#define VSL_LEN(ptr)		((ptr)[0] & 0xffff)
+#define VSL_TAG(ptr)		((ptr)[0] >> 24)
+#define VSL_ID(ptr)		(((ptr)[1]) & VSL_IDENTMASK)
+#define VSL_CLIENT(ptr)		(((ptr)[1]) & VSL_CLIENTMARKER)
+#define VSL_BACKEND(ptr)	(((ptr)[1]) & VSL_BACKENDMARKER)
+#define VSL_DATA(ptr)		((char*)((ptr)+2))
+
+#define VSL_ENDMARKER	(((uint32_t)SLT_Reserved << 24) | 0x454545) /* "EEE" */
+#define VSL_WRAPMARKER	(((uint32_t)SLT_Reserved << 24) | 0x575757) /* "WWW" */
+
+/*
+ * The identifiers in shmlogtag are "SLT_" + XML tag.  A script may be run
+ * on this file to extract the table rather than handcode it
+ */
+enum VSL_tag_e {
+	SLT_Bogus = 0,
+#define SLTM(foo)	SLT_##foo,
+#include "tbl/vsl_tags.h"
+#undef SLTM
+	SLT_Reserved = 255
+};
+
+#endif /* VAPI_VSL_FMT_H_INCLUDED */
diff --git a/include/vapi/vsm.h b/include/vapi/vsm.h
index 8948028..0b7cdd8 100644
--- a/include/vapi/vsm.h
+++ b/include/vapi/vsm.h
@@ -31,8 +31,6 @@
 #ifndef VAPI_VSM_H_INCLUDED
 #define VAPI_VSM_H_INCLUDED
 
-// #include <stdint.h>
-
 /*---------------------------------------------------------------------
  * VSM level access functions
  */
diff --git a/include/varnishapi.h b/include/varnishapi.h
deleted file mode 100644
index 6960720..0000000
--- a/include/varnishapi.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/*-
- * Copyright (c) 2006 Verdens Gang AS
- * Copyright (c) 2006-2011 Varnish Software AS
- * All rights reserved.
- *
- * Author: Poul-Henning Kamp <phk at phk.freebsd.dk>
- *
- * 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.
- *
- */
-
-#ifndef VARNISHAPI_H_INCLUDED
-#define VARNISHAPI_H_INCLUDED
-
-#include <vapi/vsm.h>
-#include <vapi/vsc.h>
-
-#include <stdint.h>
-
-#include "vsl.h"
-
-/*
- * Various notes:
- *	All malloc failures will result in assert tripping.
- *	API use failures will trip assert.
- */
-
-/*---------------------------------------------------------------------
- * VSL level access functions
- */
-
-void VSL_Setup(struct VSM_data *vd);
-	/*
-	 * Setup vd for use with VSL functions.
-	 */
-
-int VSL_Open(struct VSM_data *vd, int diag);
-	/*
-	 * Attempt to open and map the shared memory file.
-	 * If diag is non-zero, diagnostics are emitted.
-	 * Returns:
-	 *	0 on success
-	 *	!= 0 on failure
-	 */
-
-#define VSL_ARGS	"bCcdI:i:k:n:r:s:X:x:m:"
-#define VSL_b_USAGE	"[-b]"
-#define VSL_c_USAGE	"[-c]"
-#define VSL_C_USAGE	"[-C]"
-#define VSL_d_USAGE	"[-d]"
-#define VSL_i_USAGE	"[-i tag]"
-#define VSL_I_USAGE	"[-I regexp]"
-#define VSL_k_USAGE	"[-k keep]"
-#define VSL_m_USAGE	"[-m tag:regex]"
-#define VSL_n_USAGE	VSM_n_USAGE
-#define VSL_r_USAGE	"[-r file]"
-#define VSL_s_USAGE	"[-s skip]"
-#define VSL_x_USAGE	"[-x tag]"
-#define VSL_X_USAGE	"[-X regexp]"
-#define VSL_USAGE	"[-bCcd] "		\
-			VSL_i_USAGE " "		\
-			VSL_I_USAGE " "		\
-			VSL_k_USAGE " "		\
-			VSL_m_USAGE " "		\
-			VSL_n_USAGE " "		\
-			VSL_r_USAGE " "		\
-			VSL_s_USAGE " "		\
-			VSL_X_USAGE " "		\
-			VSL_x_USAGE
-
-int VSL_Arg(struct VSM_data *vd, int arg, const char *opt);
-	/*
-	 * Handle standard log-presenter arguments
-	 * Return:
-	 *	-1 error
-	 *	 0 not handled
-	 *	 1 Handled.
-	 */
-
-typedef int VSL_handler_f(void *priv, enum VSL_tag_e tag, unsigned fd,
-    unsigned len, unsigned spec, const char *ptr, uint64_t bitmap);
-
-#define VSL_S_CLIENT	(1 << 0)
-#define VSL_S_BACKEND	(1 << 1)
-VSL_handler_f VSL_H_Print;
-struct VSM_data;
-void VSL_Select(const struct VSM_data *vd, unsigned tag);
-void VSL_NonBlocking(const struct VSM_data *vd, int nb);
-int VSL_Dispatch(struct VSM_data *vd, VSL_handler_f *func, void *priv);
-int VSL_NextLog(const struct VSM_data *lh, uint32_t **pp, uint64_t *bitmap);
-int VSL_Matched(const struct VSM_data *vd, uint64_t bitmap);
-int VSL_Name2Tag(const char *name, int l);
-extern const char *VSL_tags[256];
-
-#endif
diff --git a/include/vsc.h b/include/vsc.h
deleted file mode 100644
index 0a9cbf9..0000000
--- a/include/vsc.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*-
- * Copyright (c) 2006 Verdens Gang AS
- * Copyright (c) 2006-2010 Varnish Software AS
- * All rights reserved.
- *
- * Author: Poul-Henning Kamp <phk at phk.freebsd.dk>
- *
- * 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 <stdint.h>
-
-#define VSC_CLASS          "Stat"
-
-#define VSC_TYPE_MAIN		""
-#define VSC_TYPE_SMA	"SMA"
-#define VSC_TYPE_SMF	"SMF"
-#define VSC_TYPE_VBE	"VBE"
-#define VSC_TYPE_LCK	"LCK"
-
-#define VSC_F(n, t, l, f, e, d)	t n;
-
-#define VSC_DO(u,l,t) struct VSC_C_##l {
-#define VSC_DONE(u,l,t) };
-
-#include "tbl/vsc_all.h"
-
-#undef VSC_DO
-#undef VSC_F
-#undef VSC_DONE
diff --git a/include/vsl.h b/include/vsl.h
deleted file mode 100644
index 64b0516..0000000
--- a/include/vsl.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*-
- * Copyright (c) 2006 Verdens Gang AS
- * Copyright (c) 2006-2010 Varnish Software AS
- * All rights reserved.
- *
- * Author: Poul-Henning Kamp <phk at phk.freebsd.dk>
- *
- * 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.
- *
- * Define the layout of the shared memory log segment.
- *
- * NB: THIS IS NOT A PUBLIC API TO VARNISH!
- */
-
-#ifndef SHMLOG_H_INCLUDED
-#define SHMLOG_H_INCLUDED
-
-#define VSL_CLASS		"Log"
-
-/*
- * Shared memory log format
- *
- * The log is structured as an array of 32bit unsigned integers.
- *
- * The first integer contains a non-zero serial number, which changes
- * whenever writing the log starts from the front.
- *
- * Each logrecord consist of:
- *	[n]		= ((type & 0xff) << 24) | (length & 0xffff)
- *	[n + 1]		= identifier
- *	[n + 2] ... [m]	= content
- */
-
-#define VSL_CLIENTMARKER	(1U<<30)
-#define VSL_BACKENDMARKER	(1U<<31)
-#define VSL_IDENTMASK		(~(3U<<30))
-
-#define VSL_WORDS(len)		(((len) + 3) / 4)
-#define VSL_END(ptr, len)	((ptr) + 2 + VSL_WORDS(len))
-#define VSL_NEXT(ptr)		VSL_END(ptr, VSL_LEN(ptr))
-#define VSL_LEN(ptr)		((ptr)[0] & 0xffff)
-#define VSL_TAG(ptr)		((ptr)[0] >> 24)
-#define VSL_ID(ptr)		(((ptr)[1]) & VSL_IDENTMASK)
-#define VSL_CLIENT(ptr)		(((ptr)[1]) & VSL_CLIENTMARKER)
-#define VSL_BACKEND(ptr)	(((ptr)[1]) & VSL_BACKENDMARKER)
-#define VSL_DATA(ptr)		((char*)((ptr)+2))
-
-#define VSL_ENDMARKER	(((uint32_t)SLT_Reserved << 24) | 0x454545) /* "EEE" */
-#define VSL_WRAPMARKER	(((uint32_t)SLT_Reserved << 24) | 0x575757) /* "WWW" */
-
-/*
- * The identifiers in shmlogtag are "SLT_" + XML tag.  A script may be run
- * on this file to extract the table rather than handcode it
- */
-enum VSL_tag_e {
-	SLT_Bogus = 0,
-#define SLTM(foo)	SLT_##foo,
-#include "tbl/vsl_tags.h"
-#undef SLTM
-	SLT_Reserved = 255
-};
-
-#endif
diff --git a/lib/libvarnishapi/vsc.c b/lib/libvarnishapi/vsc.c
index 18f1fc7..74cf286 100644
--- a/lib/libvarnishapi/vsc.c
+++ b/lib/libvarnishapi/vsc.c
@@ -29,6 +29,9 @@
 
 #include "config.h"
 
+#include "vapi/vsm.h"
+#include "vapi/vsc.h"
+
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <string.h>
@@ -37,10 +40,8 @@
 #include "vas.h"
 #include "vav.h"
 #include "vsm.h"
-#include "vsc.h"
 #include "vqueue.h"
 #include "miniobj.h"
-#include "varnishapi.h"
 
 #include "vsm_api.h"
 
diff --git a/lib/libvarnishapi/vsl.c b/lib/libvarnishapi/vsl.c
index ab538c5..a2efc5d 100644
--- a/lib/libvarnishapi/vsl.c
+++ b/lib/libvarnishapi/vsl.c
@@ -29,6 +29,9 @@
 
 #include "config.h"
 
+#include "vapi/vsm.h"
+#include "vapi/vsl.h"
+
 #include <sys/types.h>
 #include <sys/stat.h>
 
@@ -39,11 +42,9 @@
 
 #include "vas.h"
 #include "vsm.h"
-#include "vsl.h"
 #include "vre.h"
 #include "vbm.h"
 #include "miniobj.h"
-#include "varnishapi.h"
 
 #include "vsm_api.h"
 #include "vsl_api.h"
diff --git a/lib/libvarnishapi/vsl_arg.c b/lib/libvarnishapi/vsl_arg.c
index 21cd8e9..f41129b 100644
--- a/lib/libvarnishapi/vsl_arg.c
+++ b/lib/libvarnishapi/vsl_arg.c
@@ -29,6 +29,9 @@
 
 #include "config.h"
 
+#include "vapi/vsm.h"
+#include "vapi/vsl.h"
+
 #include <sys/types.h>
 #include <sys/stat.h>
 
@@ -44,7 +47,6 @@
 #include "vre.h"
 #include "vbm.h"
 #include "miniobj.h"
-#include "varnishapi.h"
 
 #include "vsm_api.h"
 #include "vsl_api.h"
diff --git a/lib/libvarnishapi/vsm.c b/lib/libvarnishapi/vsm.c
index 888a0d7..422bc74 100644
--- a/lib/libvarnishapi/vsm.c
+++ b/lib/libvarnishapi/vsm.c
@@ -29,6 +29,8 @@
 
 #include "config.h"
 
+#include "vapi/vsm.h"
+
 #include <sys/types.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
@@ -45,7 +47,6 @@
 #include "vsm.h"
 #include "vbm.h"
 #include "miniobj.h"
-#include "varnishapi.h"
 
 #include "vsm_api.h"
 



More information about the varnish-commit mailing list