volta.h
changeset 4 5701b7859a31
parent 2 8c88756f81b0
child 9 bdf20e6eefd7
--- a/volta.h	Tue Sep 13 22:16:11 2011 -0700
+++ b/volta.h	Wed Sep 14 16:49:28 2011 -0700
@@ -43,14 +43,13 @@
 #include <string.h>
 #include <unistd.h>
 #include <time.h>
+#include <sys/stat.h>
 
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
-#include <sqlite3.h>
-
 #ifdef DEBUG
 #include <google/profiler.h>
 #endif
@@ -60,8 +59,14 @@
 
 /* Aid debugging */
 #define LOC __FILE__, __LINE__
-/* Global debug toggle */
-extern unsigned short int debugmode;
+
+/* a global struct for easy access to common vars */
+struct v_globals {
+	unsigned short int debugmode; /* debug level */
+	char dbname[128];             /* path to database file */
+	struct sqlite3 *db;           /* database handle */
+};
+extern struct v_globals v;        /* defined in main.c */
 
 /* The parsed attributes from the request line, as given to us by squid.
  * URL <SP> client_ip "/" fqdn <SP> user <SP> method [<SP> kvpairs]<NL> */
@@ -75,9 +80,6 @@
 	char   *kvpairs;
 } request;
 
-/* FIXME: An "empty" request struct used for re-assignment */
-static const struct request reset_request;
-
 /*
  *
  * Function prototypes
@@ -86,10 +88,9 @@
 
 void usage( char *prg );
 void debug( int level, char *file, int line, const char *fmt, ... );
+char *slurp_file( char *file );
 char *extend_line( char *line, const char *buf );
 
-int db_initialize( void );
-
 int accept_loop( void );
 struct request *parse( char *p );