]> err.no Git - varnish/commitdiff
Move the SHM tags into a resuable .h file.
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 24 Mar 2006 08:43:48 +0000 (08:43 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 24 Mar 2006 08:43:48 +0000 (08:43 +0000)
Minor nits

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@63 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/include/cli.h
varnish-cache/include/libvarnish.h
varnish-cache/include/shmlog.h [new file with mode: 0644]
varnish-cache/include/shmlog_tags.h [new file with mode: 0644]

index c79350aa16ea637c3910c0c9dfdd13b20cc697aa..0d910682f8a06674962490a8bbe8422df17e1d76 100644 (file)
@@ -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.
+ *
  */
 
 /*
index b50fcd2597af15df1f4b163bc76255b4adce3df1..4ce0313e5166b122e15f1f9767728a0f8df27da0 100644 (file)
@@ -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)
+
diff --git a/varnish-cache/include/shmlog.h b/varnish-cache/include/shmlog.h
new file mode 100644 (file)
index 0000000..52603af
--- /dev/null
@@ -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
+};
diff --git a/varnish-cache/include/shmlog_tags.h b/varnish-cache/include/shmlog_tags.h
new file mode 100644 (file)
index 0000000..ce4885c
--- /dev/null
@@ -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)