volta.h
changeset 1 823d42546cea
parent 0 eac7211fe522
child 2 8c88756f81b0
equal deleted inserted replaced
0:eac7211fe522 1:823d42546cea
    10 #include <stdio.h>
    10 #include <stdio.h>
    11 #include <stdlib.h>
    11 #include <stdlib.h>
    12 #include <stdarg.h>
    12 #include <stdarg.h>
    13 #include <string.h>
    13 #include <string.h>
    14 #include <unistd.h>
    14 #include <unistd.h>
       
    15 #include <time.h>
    15 
    16 
    16 #include <sys/types.h>
    17 #include <sys/types.h>
    17 #include <sys/socket.h>
    18 #include <sys/socket.h>
    18 #include <netinet/in.h>
    19 #include <netinet/in.h>
    19 #include <arpa/inet.h>
    20 #include <arpa/inet.h>
    20 
    21 
       
    22 #include <sqlite3.h>
       
    23 
    21 
    24 
    22 /* Maximum length per line from Squid */
    25 /* Maximum length per line from Squid */
    23 #define LINE_BUFSIZE 2048
    26 #define LINE_BUFSIZE 2048
    24 
    27 
    25 /* URL <SP> client_ip "/" fqdn <SP> user <SP> method [<SP> kvpairs]<NL> */
    28 /* Aid debugging */
       
    29 #define LOC __FILE__, __LINE__
       
    30 /* Global debug toggle */
       
    31 extern unsigned short int debugmode;
       
    32 
       
    33 /* The parsed attributes from the request line, as given to us by squid.
       
    34  * URL <SP> client_ip "/" fqdn <SP> user <SP> method [<SP> kvpairs]<NL> */
    26 typedef struct request {
    35 typedef struct request {
    27 	char   *url;
    36 	char   *url;
    28 	char   *host;
    37 	char   *host;
    29 	struct sockaddr_in ip;
    38 	struct sockaddr_in ip;
    30 	char   *ip_fqdn;
    39 	char   *ip_fqdn;
    34 } request;
    43 } request;
    35 
    44 
    36 /* An "empty" request struct used for re-assignment */
    45 /* An "empty" request struct used for re-assignment */
    37 static const struct request reset_request;
    46 static const struct request reset_request;
    38 
    47 
    39 /* Prototypes */
    48 /* Function prototypes */
    40 void usage( char *prg );
    49 void usage( char *prg );
    41 void debug( const char *fmt, ... );
    50 void debug( int level, char *file, int line, const char *fmt, ... );
    42 int  parse( char *p );
    51 int  parse( char *p );
    43 
    52 
    44 #endif
    53 #endif
    45 
    54