X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=include%2Fconf.h;h=3e8582c70b5a4b9d210ba5f6d44c61c303f8ba0a;hb=8d811f76568c9cad93ff76ebbd1802ea6ab898fb;hp=c7afeaf1730ee3db572b11ff9b5afb5f541db151;hpb=4157aa09582bbfcce405719e42d7e5873123067c;p=thirdparty%2Fsarg.git diff --git a/include/conf.h b/include/conf.h index c7afeaf..3e8582c 100755 --- a/include/conf.h +++ b/include/conf.h @@ -1,159 +1,326 @@ - +#include "config.h" #include "info.h" +#include "btree_cache.h" -#if HAVE_STDIO_H +#ifdef HAVE_WINDOWS_H +#include +#endif +#ifdef HAVE_STDIO_H #include #endif -#if HAVE_STDLIB_H +#ifdef HAVE_STDLIB_H #include #endif -#if HAVE_STRING_H +#ifdef HAVE_STRING_H #include #endif -#if HAVE_STRINGS_H +#ifdef HAVE_STRINGS_H #include #endif -#if HAVE_SYS_TIME_H +#ifdef HAVE_SYS_TIME_H #include #endif -#if HAVE_TIME_H +#ifdef HAVE_TIME_H #include #endif -#if HAVE_SYS_RESOURCE_H +#ifdef HAVE_SYS_RESOURCE_H #include #endif -#if HAVE_UNISTD_H +#ifdef HAVE_UNISTD_H #include #endif -#if HAVE_SYS_DIRENT_H && !HAVE_DIRENT_H +#if defined(HAVE_SYS_DIRENT_H) && !defined(HAVE_DIRENT_H) #include #endif -#if HAVE_DIRENT_H +#ifdef HAVE_DIRENT_H #include #endif -#if HAVE_SYS_SOCKET_H +#ifdef HAVE_SYS_SOCKET_H #include #endif -#if HAVE_NETDB_H +#ifdef HAVE_NETDB_H #include #endif -#if HAVE_TYPES_H +#ifdef HAVE_TYPES_H #include #endif -#if HAVE_NETINET_IN_H +#ifdef HAVE_NETINET_IN_H #include #endif -#if HAVE_ARPA_INET_H +#ifdef HAVE_ARPA_INET_H #include #endif -#if HAVE_SYS_STAT_H +#ifdef HAVE_SYS_STAT_H #include #endif -#if HAVE_CTYPE_H +#ifdef HAVE_CTYPE_H #include #endif -#if HAVE_ERRNO_H +#ifdef HAVE_ERRNO_H #include #endif -#if HAVE_SYS_WAIT_H +#ifdef HAVE_SYS_WAIT_H #include #endif -#if HAVE_GD_H +#ifdef HAVE_GD_H +#define HAVE_GD 1 #include -#define HAVE_GD -gdImagePtr im; -gdPoint points[4]; #endif -#if HAVE_GDFONTL_H +#ifdef HAVE_GDFONTL_H #include #endif -#if HAVE_GDFONTT_H +#ifdef HAVE_GDFONTT_H #include #endif -#if HAVE_GDFONTS_H +#ifdef HAVE_GDFONTS_H #include #endif -#if HAVE_GDFONTMB_H +#ifdef HAVE_GDFONTMB_H #include #endif -#if HAVE_GDFONTG_H +#ifdef HAVE_GDFONTG_H #include #endif -#if HAVE_STDARG_H +#ifdef HAVE_STDARG_H #include #endif -#if HAVE_INTTYPES_H +#ifdef HAVE_INTTYPES_H #include #endif +#ifdef HAVE_LIMITS_H +#include +#endif +#ifdef HAVE_WINSOCK_H +#include +#endif +#ifdef HAVE_MATH_H +#include +#endif +#ifdef HAVE_LOCALE_H +#include +#endif +#ifdef HAVE_EXECINFO_H +#include +#endif +#ifdef HAVE_LIBGEN_H +#include +#endif +#ifdef HAVE_STDBOOL_H +#include +#else +typedef int bool; +#define true 1 +#define false 0 +#endif -#if HAVE_FOPEN64 +#if defined(HAVE_FOPEN64) #define _FILE_OFFSET_BITS 64 #define MY_FOPEN fopen64 #else #define MY_FOPEN fopen #endif +#if !defined(HAVE_BZERO) +#define bzero(mem,size) memset(mem,0,size) +#endif + +#if defined(IBERTY_LIB) && !defined(HAVE_MKSTEMP) +int mkstemps(char *template, int suffixlen); +#define mkstemp(template) mkstemps(template,0) +#endif + +#if defined(ENABLE_NLS) && defined(HAVE_LIBINTL_H) +#include +#define _(String) gettext(String) +#ifdef gettext_noop +#define N_(String) gettext_noop(String) +#else +#define N_(String) (String) +#endif +#else /* No NLS */ +#define _(String) (String) +#define N_(String) (String) +#define ngettext(String,Strings,num) (Strings) +#define textdomain(String) +#define bindtextdomain(Domain,Directory) +#endif //NLS + +#if defined(__MINGW32__) +#define mkdir(p,m) _mkdir(p) + +#ifndef WIFEXITED + #define WIFEXITED(S) 1 +#endif + +#ifndef WEXITSTATUS + #define WEXITSTATUS(S) (S) +#endif + +#endif /*__MINGW32__*/ + +#ifndef __GNUC__ +# define __attribute__(x) +#endif #define MAXLEN 20000 -long long int my_atoll (const char *nptr); +#define MAX_URL_LEN 40000 +#define MAX_TRUNCATED_URL 512 +#define MAX_USER_LEN 256 +#define MAX_USER_FNAME_LEN 128 +#define MAX_IP_LEN 64 +#define MAX_DATETIME_LEN 32 +#define MAXLOGS 255 +#define MAX_LOG_FILELEN 1024 +#define MAX_REDIRECTOR_LOGS 64 +#define MAX_REDIRECTOR_FILELEN 1024 +/*! +Arbitrary limit on the number of days that are accepted in the selected range of the log file. +Sarg will complain that there are too many days in the files if this limit is overrun. +*/ +#define MAX_DATETIME_DAYS 1000 + +#define REPORT_TYPE_USERS_SITES 0x0001UL +#define REPORT_TYPE_SITE_USER_TIME_DATE 0x0002UL +#define REPORT_TYPE_TOPUSERS 0x0004UL +#define REPORT_TYPE_TOPSITES 0x0008UL +#define REPORT_TYPE_SITES_USERS 0x0010UL +#define REPORT_TYPE_DATE_TIME 0x0020UL +#define REPORT_TYPE_DENIED 0x0040UL +#define REPORT_TYPE_AUTH_FAILURES 0x0080UL +#define REPORT_TYPE_DOWNLOADS 0x0100UL + +#define DATA_FIELD_USER 0x0001UL +#define DATA_FIELD_DATE 0x0002UL +#define DATA_FIELD_TIME 0x0004UL +#define DATA_FIELD_URL 0x0008UL +#define DATA_FIELD_CONNECT 0x0010UL +#define DATA_FIELD_BYTES 0x0020UL +#define DATA_FIELD_IN_CACHE 0x0040UL +#define DATA_FIELD_OUT_CACHE 0x0080UL +#define DATA_FIELD_ELAPSED 0x0100UL + +#define TOPUSERFIELDS_NUM 0x0001UL +#define TOPUSERFIELDS_DATE_TIME 0x0002UL +#define TOPUSERFIELDS_USERID 0x0004UL +#define TOPUSERFIELDS_CONNECT 0x0008UL +#define TOPUSERFIELDS_BYTES 0x0010UL +#define TOPUSERFIELDS_SETYB 0x0020UL +#define TOPUSERFIELDS_IN_CACHE_OUT 0x0040UL +#define TOPUSERFIELDS_USED_TIME 0x0080UL +#define TOPUSERFIELDS_MILISEC 0x0100UL +#define TOPUSERFIELDS_PTIME 0x0200UL +#define TOPUSERFIELDS_TOTAL 0x0400UL +#define TOPUSERFIELDS_AVERAGE 0x0800UL + +#define USERREPORTFIELDS_CONNECT 0x0001UL +#define USERREPORTFIELDS_BYTES 0x0002UL +#define USERREPORTFIELDS_SETYB 0x0004UL +#define USERREPORTFIELDS_IN_CACHE_OUT 0x0008UL +#define USERREPORTFIELDS_USED_TIME 0x0010UL +#define USERREPORTFIELDS_MILISEC 0x0020UL +#define USERREPORTFIELDS_PTIME 0x0040UL +#define USERREPORTFIELDS_TOTAL 0x0080UL +#define USERREPORTFIELDS_AVERAGE 0x0100UL + +#define INDEX_YES 0x0001UL +#define INDEX_NO 0x0002UL +#define INDEX_ONLY 0x0004UL + +#define INDEX_TREE_DATE 0x0001UL +#define INDEX_TREE_FILE 0x0002UL + +#define INDEXFIELDS_DIRSIZE 0x0001UL + +#define NTLMUSERFORMAT_USER 0x0001UL +#define NTLMUSERFORMAT_DOMAINUSER 0x0002UL + +#define RECORDWITHOUTUSER_IP 0x0001UL +#define RECORDWITHOUTUSER_IGNORE 0x0002UL +#define RECORDWITHOUTUSER_EVERYBODY 0x0004UL -FILE *fp_tt; +#define DATAFILEURL_IP 0x0001UL +#define DATAFILEURL_NAME 0x0002UL + +#define DISPLAY_BYTES 0x0001UL +#define DISPLAY_ABBREV 0x0002UL + +#define DATETIME_ELAP 0x0001UL +#define DATETIME_BYTE 0x0002UL + +#define REALTIME_UNAUTH_REC_SHOW 0x0001UL +#define REALTIME_UNAUTH_REC_IGNORE 0x0002UL + +#define SORT_REVERSE 0x0001 + +#define TOPUSER_SORT_REVERSE SORT_REVERSE +#define TOPUSER_SORT_BYTES 0x0002UL +#define TOPUSER_SORT_USER 0x0004UL +#define TOPUSER_SORT_CONNECT 0x0008UL +#define TOPUSER_SORT_TIME 0x0010UL + +#define TOPSITE_SORT_REVERSE SORT_REVERSE +#define TOPSITE_SORT_BYTES 0x0002UL +#define TOPSITE_SORT_CONNECT 0x0004UL +#define TOPSITE_SORT_TIME 0x0008UL + +#define USER_SORT_REVERSE SORT_REVERSE +#define USER_SORT_BYTES 0x0002UL +#define USER_SORT_SITE 0x0004UL +#define USER_SORT_CONNECT 0x0008UL +#define USER_SORT_TIME 0x0010UL + +//! Value to exclude all the javascripts from the html page. +#define HTML_JS_NONE 0x0000 +//! Bit to include sorttable.js in the html plage. +#define HTML_JS_SORTTABLE 0x0001 + +//! The character prefixed in front of the host names that are aliased. +#define ALIAS_PREFIX '*' + +struct periodstruct +{ + //! The first date of the period. + struct tm start; + //! The last date of the period. + struct tm end; + //! The textual representation of the date. + char text[40]; + //! The HTML representation of the date. + char html[40]; +}; char outdir[MAXLEN]; -char dirname[MAXLEN]; -char buf[MAXLEN]; -char url[MAXLEN]; -char urly[MAXLEN]; -char user[MAXLEN]; -char period[MAXLEN]; -char msg[1024]; -char per_hour[128]; +char outdirname[MAXLEN]; +struct periodstruct period; char code[MAXLEN]; char code2[MAXLEN]; char tmp[MAXLEN]; -char tmp2[MAXLEN]; -char tmp3[MAXLEN]; -char tmp4[MAXLEN]; -char tmp5[MAXLEN]; -char tmp6[MAXLEN]; -char tmp7[MAXLEN]; char parse_out[MAXLEN]; char arqtt[MAXLEN]; char html[MAXLEN]; -char datestimes[MAXLEN]; char ConfigFile[MAXLEN]; -char href[MAXLEN]; -char href2[MAXLEN]; -char href3[MAXLEN]; char df[20]; -char day[3], month[4], year[5]; -char nmonth[30]; -char ltext110[50]; -char cdfrom[30]; -char cduntil[30]; -char LastLog[5]; -char RemoveTempFiles[4]; +int LastLog; +bool RemoveTempFiles; char ReplaceIndex[256]; -char Index[20]; -char OverwriteReport[4]; -char u2[255]; -char RecordsWithoutUser[20]; -char UseComma[4]; -char MailUtility[6]; -char TopSitesNum[20]; -char TopUsersNum[20]; +unsigned long int Index; +bool OverwriteReport; +unsigned long int RecordsWithoutUser; +bool UseComma; +char MailUtility[PATH_MAX]; +int TopSitesNum; +int TopUsersNum; char ExcludeCodes[256]; -char TopsitesSortField[15]; -char TopsitesSortType[20]; -char ReportType[255]; +unsigned long int TopsitesSort; +unsigned long int ReportType; char UserTabFile[255]; char warea[MAXLEN]; char name[MAXLEN]; -char LongUrl[20]; -char Ip2Name[20]; -char language[255]; -char bufy[MAXLEN]; -char AccessLog[MAXLEN]; +bool LongUrl; +bool Ip2Name; +int NAccessLog; +char AccessLog[MAXLOGS][MAX_LOG_FILELEN]; +int AccessLogFromCmdLine; char Title[MAXLEN]; char BgColor[MAXLEN]; char BgImage[MAXLEN]; @@ -173,85 +340,67 @@ char PasswdFile[MAXLEN]; char TempDir[MAXLEN]; char OutputDir[MAXLEN]; char OutputEmail[MAXLEN]; -char TopuserSortField[30]; -char UserSortField[30]; -char TopuserSortOrder[10]; -char UserSortOrder[10]; +unsigned long int TopuserSort; +unsigned long int UserSort; char UserAgentLog[255]; char module[255]; char ExcludeHosts[255]; char ExcludeUsers[255]; char DateFormat[2]; char PerUserLimitFile[255]; -char PerUserLimit[20]; -char UserIp[5]; +int PerUserLimit; +bool UserIp; char MaxElapsed[255]; -char datetimeby[10]; -char csort[255]; +unsigned long int datetimeby; char CharSet[255]; char UserInvalidChar[255]; -char Graphs[5]; +bool Graphs; char GraphDaysBytesBarColor[255]; -char Privacy[10]; +bool Privacy; char PrivacyString[255]; char PrivacyStringColor[30]; char IncludeUsers[MAXLEN]; char ExcludeString[MAXLEN]; -char SuccessfulMsg[5]; -char TopUserFields[255]; -char UserReportFields[255]; +bool SuccessfulMsg; +unsigned long int TopUserFields; +unsigned long int UserReportFields; char DataFile[MAXLEN]; char DataFileDelimiter[3]; -char DataFileFields[MAXLEN]; -char DataFileUrl[20]; -char SiteUserTimeDateType[10]; -char ShowReadStatistics[5]; +unsigned long int DataFileFields; +unsigned long int DataFileUrl; +bool ShowReadStatistics; char IndexSortOrder[5]; char DansGuardianConf[MAXLEN]; -char DansguardianIgnoreDate[10]; +bool DansguardianFilterOutDate; char SquidGuardConf[MAXLEN]; char SquidGuarddbHome[255]; -char SquidGuardLogFormat[MAXLEN]; -char SquidGuardLogAlternate[MAXLEN]; -char SquidguardIgnoreDate[10]; -char ShowSargInfo[5]; -char BytesInSitesUsersReport[10]; -char ShowSargLogo[5]; +char RedirectorLogFormat[4096]; +int NRedirectorLogs; +char RedirectorLogs[MAX_REDIRECTOR_LOGS][MAX_REDIRECTOR_FILELEN]; +int RedirectorLogFromCmdLine; +bool RedirectorFilterOutDate; +bool ShowSargInfo; +bool BytesInSitesUsersReport; +bool ShowSargLogo; char ParsedOutputLog[MAXLEN]; -char ParsedOutputLogCompress[255]; -char DisplayedValues[20]; +char ParsedOutputLogCompress[512]; +unsigned long int DisplayedValues; char HeaderFontSize[5]; char TitleFontSize[5]; char wwwDocumentRoot[MAXLEN]; char ExternalCSSFile[MAXLEN]; char BlockIt[255]; -char BlockImage[512]; -char NtlmUserFormat[30]; -char hbc1[30]; -char hbc2[255]; -char hbc3[30]; -char hbc4[30]; -char hbc5[30]; -char hbc6[30]; -char hbc7[30]; -char hbc8[30]; -char hbc9[30]; -char hbc10[30]; -char IndexTree[10]; -char UserAuthentication[10]; -char AuthUserFile[255]; -char AuthName[512]; -char AuthType[255]; -char Require[512]; -char DownloadSuffix[MAXLEN]; -char *userfile; -char *str; -char *str2; -char text[200][255]; +unsigned long int NtlmUserFormat; +//! How to display the index of the reports. +unsigned long int IndexTree; +//! The columns to show in the index of the reports. +unsigned long int IndexFields; +bool UserAuthentication; +char AuthUserTemplateFile[1024]; +//! \c True to use anonymous file and directory names in the report. +bool AnonymousOutputFiles; char val1[MAXLEN]; -char val2[MAXLEN]; char val3[MAXLEN]; -char val4[MAXLEN]; char val5[MAXLEN]; char val6[MAXLEN]; char val7[MAXLEN]; @@ -259,18 +408,11 @@ char val8[MAXLEN]; char val9[MAXLEN]; char val10[MAXLEN]; char val11[MAXLEN]; -char wwork1[MAXLEN]; -char wwork2[MAXLEN]; -char wwork3[MAXLEN]; -char ftime[128]; char mask[MAXLEN]; -char httplink[MAXLEN]; -char html_old[MAXLEN]; char site[MAXLEN]; char us[50]; char email[MAXLEN]; char test[1]; -char ouser2[255]; char user2[MAXLEN]; char wentp[512]; char addr[MAXLEN]; @@ -278,9 +420,20 @@ char Ulimit[6]; char RealtimeTypes[1024]; char cmd[255]; char ImageFile[255]; -char tbuf[128]; -char ip[25]; -char RealtimeUnauthRec[15]; +unsigned long int RealtimeUnauthRec; +char LDAPHost[255]; +char LDAPBindDN[512]; +char LDAPBindPW[255]; +int LDAPPort; +int LDAPProtocolVersion; +char LDAPBaseSearch[255]; +char LDAPFilterSearch[512]; +char LDAPTargetAttr[64]; +char GraphFont[MAXLEN]; +//! The full path to sorttable.js if the table in the reports must be dynamicaly sorted. +char SortTableJs[256]; +//! The name of the file containing the host names to replace by an alias in the report. +char HostAliasFile[512]; int idate; int smartfilter; @@ -288,22 +441,18 @@ int denied_count; int download_count; int authfail_count; int dansguardian_count; -int squidguard_count; +int redirector_count; +int useragent_count; int limit_flag; -int color1; -int color2; -int color3; int z1, z2, z3; int ttopen; -int ind2; int sarglog; int isalog; int dfrom; int duntil; int dataonly; -int indexonly; -int iprel; -int userip; +bool indexonly; +bool iprel; int langcode; int debug; int debugz; @@ -315,18 +464,15 @@ int SiteUsersReportLimit; int DansGuardianReportLimit; int SquidGuardReportLimit; int UserReportLimit; -int dotinuser; int realtime_refresh; int realtime_access_log_lines; -int realt; int rc; int ntopsites; int nsitesusers; int nrepday; int ndownload; int ntopuser; -int squid24; -float perc; +bool squid24; long long int nocost; float cost; @@ -335,6 +481,3 @@ typedef struct { int list[ 24 ]; int len; } numlist; - -DIR *dirp; -struct dirent *direntp;