"Fossies" - the Fresh Open Source Software Archive

Member "srg-1.3.6/include/srg.h" (5 Aug 2009, 3413 Bytes) of package /linux/privat/old/srg-1.3.6.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /*
    2     SRG - Squid Report Generator
    3     SRG header
    4     Copyright 2005 University of Waikato
    5 
    6     This file is part of SRG.
    7 
    8     SRG is free software; you can redistribute it and/or modify
    9     it under the terms of the GNU General Public License as published by
   10     the Free Software Foundation; either version 2 of the License, or
   11     (at your option) any later version.
   12 
   13     SRG is distributed in the hope that it will be useful,
   14     but WITHOUT ANY WARRANTY; without even the implied warranty of
   15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   16     GNU General Public License for more details.
   17 
   18     You should have received a copy of the GNU General Public License
   19     along with SRG; if not, write to the Free Software
   20     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
   21 
   22 */
   23 #ifndef SRG_H
   24 #define SRG_H
   25 
   26 #ifdef HAVE_CONFIG_H
   27 #include "config.h"
   28 #endif
   29 
   30 #include <iostream>
   31 #include <fstream>
   32 #include <unistd.h>
   33 #include <stdio.h>
   34 #include <stdlib.h>
   35 #include <list>
   36 #include <time.h>
   37 #include <sys/stat.h>
   38 #include <sys/types.h>
   39 #include <errno.h>
   40 #include "md5.h"
   41 #include <netdb.h>
   42 #include <netinet/in.h>
   43 #include <sys/socket.h>
   44 #include <arpa/inet.h>
   45 #include <regex.h>
   46 #include <assert.h>
   47 
   48 using namespace std;
   49 
   50 #include "getline.hh"
   51 #include "resolver.hh"
   52 
   53 // Constants
   54 #define HOME_URL "http://www.crc.net.nz/software/srg.php"
   55 
   56 #define BY_NONE 0
   57 #define BY_USER 1
   58 #define BY_IP 2
   59 #define BY_SUBNET 3
   60 #define BY_MAX 3
   61 
   62 #define SRG_CSS_FILE "style.css"
   63 #define SRG_JS_FILE "srg.js"
   64 #define SRG_HEADER_FILE "header.php"
   65 #define SRG_FOOTER_FILE "footer.php"
   66 
   67 #define CONFFILE SYSCONFDIR "/srg/srg.conf"
   68 #define RESOURCEDIR DATADIR "/srg"
   69 
   70 #define OUTPUT_PHP 1
   71 #define OUTPUT_HTML 2
   72 
   73 // Data Structures
   74 struct summary_info {
   75     unsigned long long  connects;
   76     unsigned long long  bytesTransferred;
   77     unsigned long long  hits;
   78     unsigned long long  misses;
   79     unsigned long long  bytesHit;
   80     unsigned long long  bytesMissed;
   81     unsigned long long  timeSpent;
   82     unsigned long long  deniedHits;
   83 };
   84 
   85 struct filter_info {
   86     int by;
   87     char *user;
   88     in_addr address;
   89     in_addr network;
   90     in_addr netmask;
   91 };
   92 
   93 struct config_info {
   94     
   95     /* General Options */
   96     int debug;
   97     int verbose;
   98     int groupBy;
   99     int showtimes;
  100     int showrates;
  101     int nonameshowip;
  102     time_t startTime;
  103     time_t endTime;
  104     time_t minTime;
  105     time_t maxTime;
  106     char * title;
  107     char * ip2user;
  108     char * sitefilter;
  109     int sortcolumns;
  110     unsigned int locationStats;
  111     unsigned int siteStats;
  112     unsigned int hideDeniedOnly;
  113     unsigned int authenticate;
  114     unsigned int lookupHosts;
  115     unsigned int emailreport; 
  116     unsigned int maxreportage;
  117     unsigned int minimumConnects;
  118     
  119     char * accessLog;
  120 
  121     /* Grouping & Filtering Options */
  122     filter_info filter;
  123     in_addr groupByNetmask;
  124     
  125     /* Output Options */
  126     char * outputDir;
  127     char * outputURL;
  128     int outputMode;
  129     char * resourceDir;
  130     int usejs;
  131     char *indexfname;
  132     char *phpheader;
  133     char *phpfooter;
  134     char *cssfile;
  135     char *jsfile;
  136 
  137 };
  138 
  139 struct url_request {
  140     char *protocol;
  141     char *user;
  142     char *password;
  143     char *site;
  144     char *port;
  145     char *location;
  146 };
  147 
  148 struct log_line {
  149     time_t timestamp;
  150     unsigned int elapsedTime;
  151     in_addr clientAddress;
  152     char * resultCode;
  153     unsigned long long  size;
  154     char * requestMethod;
  155     url_request *request;
  156     char * user;
  157     char * hierarchyData;
  158     char * contentType;
  159 };
  160 
  161 struct ip2user_line {
  162     in_addr ipaddress;
  163     in_addr netmask;
  164     char *username;
  165 };
  166 
  167 struct exclude_netblock {
  168     in_addr network;
  169     in_addr netmask;
  170 };
  171 
  172 #endif