r63 - trunk/varnish-cache/include

phk at projects.linpro.no phk at projects.linpro.no
Fri Mar 24 09:43:48 CET 2006


Author: phk
Date: 2006-03-24 09:43:48 +0100 (Fri, 24 Mar 2006)
New Revision: 63

Added:
   trunk/varnish-cache/include/shmlog.h
   trunk/varnish-cache/include/shmlog_tags.h
Modified:
   trunk/varnish-cache/include/cli.h
   trunk/varnish-cache/include/libvarnish.h
Log:
Move the SHM tags into a resuable .h file.

Minor nits


Modified: trunk/varnish-cache/include/cli.h
===================================================================
--- trunk/varnish-cache/include/cli.h	2006-03-23 15:31:20 UTC (rev 62)
+++ trunk/varnish-cache/include/cli.h	2006-03-24 08:43:48 UTC (rev 63)
@@ -3,6 +3,12 @@
  *
  * Public definition of the CLI protocol, part of the published Varnish-API.
  *
+ * The overall structure of the protocol is a command-line like 
+ * "command+arguments" request and a IETF style "number + string" response.
+ *
+ * Arguments can contain arbitrary sequences of bytes which are encoded
+ * in back-slash notation in double-quoted, if necessary.
+ *
  */
 
 /*

Modified: trunk/varnish-cache/include/libvarnish.h
===================================================================
--- trunk/varnish-cache/include/libvarnish.h	2006-03-23 15:31:20 UTC (rev 62)
+++ trunk/varnish-cache/include/libvarnish.h	2006-03-24 08:43:48 UTC (rev 63)
@@ -5,3 +5,8 @@
 /* from libvarnish/argv.c */
 void FreeArgv(char **argv);
 char **ParseArgv(const char *s, int comment);
+
+
+/* Assert zero return value */
+#define AZ(foo)	do { assert((foo) == 0); } while (0)
+

Added: trunk/varnish-cache/include/shmlog.h
===================================================================
--- trunk/varnish-cache/include/shmlog.h	2006-03-23 15:31:20 UTC (rev 62)
+++ trunk/varnish-cache/include/shmlog.h	2006-03-24 08:43:48 UTC (rev 63)
@@ -0,0 +1,48 @@
+/*
+ * $Id$
+ *
+ * Define the layout of the shared memory log segment.
+ *
+ * NB: THIS IS NOT A PUBLIC API TO VARNISH!
+ *
+ */
+
+#define SHMLOG_FILENAME		"/tmp/_.vsl"
+
+struct shmloghead {
+#define SHMLOGHEAD_MAGIC	4185512498U	/* From /dev/random */
+	unsigned	magic;
+
+	/*
+	 * Byte offset into the file where the fifolog starts
+ 	 * This allows the header to expand later.
+	 */
+	unsigned	start;
+
+	/* Length of the fifolog area in bytes */
+	unsigned	size;
+
+	/* Current write position relative to the beginning of start */
+	unsigned	ptr;
+};
+
+/*
+ * Record format is as follows:
+ *
+ *	1 byte		field type (enum shmlogtag)
+ *	1 byte		length of contents
+ *	2 byte		record identifier
+ *	n bytes		field contents (isgraph(c) || isspace(c)) allowed.
+ */
+
+/*
+ * 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 shmlogtag {
+	SLT_ENDMARKER = 0,
+#define SLTM(foo)	SLT_##foo,
+#include "shmlog_tags.h"
+#undef SLTM
+	SLT_WRAPMARKER = 255
+};

Added: trunk/varnish-cache/include/shmlog_tags.h
===================================================================
--- trunk/varnish-cache/include/shmlog_tags.h	2006-03-23 15:31:20 UTC (rev 62)
+++ trunk/varnish-cache/include/shmlog_tags.h	2006-03-24 08:43:48 UTC (rev 63)
@@ -0,0 +1,14 @@
+/*
+ * $Id$
+ *
+ * Define the tags in the shared memory in a reusable format.
+ * Whoever includes this get to define what the SLTM macro does.
+ *
+ */
+
+SLTM(CLI)
+SLTM(SessionId)
+SLTM(ClientAddr)
+SLTM(Request)
+SLTM(URL)
+SLTM(Protocol)




More information about the varnish-commit mailing list