]> git.ipfire.org Git - thirdparty/sarg.git/blame - include/conf.h
Alias IP addresses in the URL using the CIDR notation
[thirdparty/sarg.git] / include / conf.h
CommitLineData
b3695c67 1#include "config.h"
25697a35 2#include "info.h"
e3af0ae9 3#include "btree_cache.h"
25697a35 4
b3695c67
FM
5#ifdef HAVE_WINDOWS_H
6#include <windows.h>
7#endif
8#ifdef HAVE_STDIO_H
25697a35
GS
9#include <stdio.h>
10#endif
b3695c67 11#ifdef HAVE_STDLIB_H
25697a35
GS
12#include <stdlib.h>
13#endif
b3695c67 14#ifdef HAVE_STRING_H
25697a35
GS
15#include <string.h>
16#endif
b3695c67 17#ifdef HAVE_STRINGS_H
25697a35
GS
18#include <strings.h>
19#endif
b3695c67 20#ifdef HAVE_SYS_TIME_H
25697a35
GS
21#include <sys/time.h>
22#endif
b3695c67 23#ifdef HAVE_TIME_H
25697a35
GS
24#include <time.h>
25#endif
b3695c67 26#ifdef HAVE_SYS_RESOURCE_H
25697a35
GS
27#include <sys/resource.h>
28#endif
b3695c67 29#ifdef HAVE_UNISTD_H
25697a35
GS
30#include <unistd.h>
31#endif
b3695c67 32#if defined(HAVE_SYS_DIRENT_H) && !defined(HAVE_DIRENT_H)
25697a35
GS
33#include <sys/dirent.h>
34#endif
b3695c67 35#ifdef HAVE_DIRENT_H
25697a35
GS
36#include <dirent.h>
37#endif
b3695c67 38#ifdef HAVE_SYS_SOCKET_H
25697a35
GS
39#include <sys/socket.h>
40#endif
b3695c67 41#ifdef HAVE_NETDB_H
25697a35
GS
42#include <netdb.h>
43#endif
b3695c67 44#ifdef HAVE_TYPES_H
25697a35
GS
45#include <types.h>
46#endif
b3695c67 47#ifdef HAVE_NETINET_IN_H
25697a35
GS
48#include <netinet/in.h>
49#endif
b3695c67 50#ifdef HAVE_ARPA_INET_H
25697a35
GS
51#include <arpa/inet.h>
52#endif
b3695c67 53#ifdef HAVE_SYS_STAT_H
25697a35
GS
54#include <sys/stat.h>
55#endif
b3695c67 56#ifdef HAVE_CTYPE_H
25697a35
GS
57#include <ctype.h>
58#endif
b3695c67 59#ifdef HAVE_ERRNO_H
25697a35
GS
60#include <errno.h>
61#endif
b3695c67 62#ifdef HAVE_SYS_WAIT_H
d96e3ba6
FM
63#include <sys/wait.h>
64#endif
b3695c67 65#ifdef HAVE_GD_H
2824ec9b 66#define HAVE_GD 1
25697a35 67#include <gd.h>
25697a35 68#endif
b3695c67 69#ifdef HAVE_GDFONTL_H
25697a35
GS
70#include <gdfontl.h>
71#endif
b3695c67 72#ifdef HAVE_GDFONTT_H
25697a35
GS
73#include <gdfontt.h>
74#endif
b3695c67 75#ifdef HAVE_GDFONTS_H
25697a35
GS
76#include <gdfonts.h>
77#endif
b3695c67 78#ifdef HAVE_GDFONTMB_H
25697a35
GS
79#include <gdfontmb.h>
80#endif
b3695c67 81#ifdef HAVE_GDFONTG_H
25697a35
GS
82#include <gdfontg.h>
83#endif
b3695c67 84#ifdef HAVE_STDARG_H
d2fe0c32
FM
85#include <stdarg.h>
86#endif
b3695c67 87#ifdef HAVE_INTTYPES_H
2357ef77
FM
88#include <inttypes.h>
89#endif
b3695c67 90#ifdef HAVE_LIMITS_H
4af2f8ff
FM
91#include <limits.h>
92#endif
b3695c67
FM
93#ifdef HAVE_WINSOCK_H
94#include <winsock.h>
95#endif
e3af0ae9
PO
96#ifdef HAVE_MATH_H
97#include <math.h>
98#endif
a1de61fe
FM
99#ifdef HAVE_LOCALE_H
100#include <locale.h>
101#endif
e6414a9d
FM
102#ifdef HAVE_EXECINFO_H
103#include <execinfo.h>
104#endif
d5d021c5
FM
105#ifdef HAVE_LIBGEN_H
106#include <libgen.h>
107#endif
06b39c87
FM
108#ifdef HAVE_STDBOOL_H
109#include <stdbool.h>
110#else
111typedef int bool;
112#define true 1
113#define false 0
114#endif
25697a35 115
b3695c67 116#if defined(HAVE_FOPEN64)
25697a35 117#define _FILE_OFFSET_BITS 64
936c9905 118#define MY_FOPEN fopen64
25697a35
GS
119#else
120#define MY_FOPEN fopen
121#endif
122
b3695c67
FM
123#if !defined(HAVE_BZERO)
124#define bzero(mem,size) memset(mem,0,size)
125#endif
126
127#if defined(IBERTY_LIB) && !defined(HAVE_MKSTEMP)
128int mkstemps(char *template, int suffixlen);
129#define mkstemp(template) mkstemps(template,0)
130#endif
131
eca2cec9 132#if defined(ENABLE_NLS) && defined(HAVE_LIBINTL_H)
c0ec9cc7
FM
133#include <libintl.h>
134#define _(String) gettext(String)
135#ifdef gettext_noop
136#define N_(String) gettext_noop(String)
137#else
138#define N_(String) (String)
139#endif
140#else /* No NLS */
141#define _(String) (String)
142#define N_(String) (String)
06b39c87 143#define ngettext(String,Strings,num) (Strings)
c0ec9cc7
FM
144#define textdomain(String)
145#define bindtextdomain(Domain,Directory)
eca2cec9 146#endif //NLS
c0ec9cc7 147
b3695c67
FM
148#if defined(__MINGW32__)
149#define mkdir(p,m) _mkdir(p)
150
151#ifndef WIFEXITED
152 #define WIFEXITED(S) 1
153#endif
154
155#ifndef WEXITSTATUS
156 #define WEXITSTATUS(S) (S)
157#endif
158
159#endif /*__MINGW32__*/
25697a35 160
f0126186
FM
161#ifndef __GNUC__
162# define __attribute__(x)
163#endif
164
25697a35 165#define MAXLEN 20000
ac422f9b 166#define MAX_URL_LEN 40000
e5b2c6f0 167#define MAX_TRUNCATED_URL 512
f2ec8c75
FM
168#define MAX_USER_LEN 256
169#define MAX_USER_FNAME_LEN 128
2240dcea
FM
170#define MAX_IP_LEN 64
171#define MAX_DATETIME_LEN 32
0a4e18e1 172#define MAXLOGS 255
1f482a8d
FM
173#define MAX_LOG_FILELEN 1024
174#define MAX_REDIRECTOR_LOGS 64
175#define MAX_REDIRECTOR_FILELEN 1024
324ba7f3 176#define MAX_DATETIME_DAYS 90
25697a35 177
085c1e1f
FM
178#define REPORT_TYPE_USERS_SITES 0x0001UL
179#define REPORT_TYPE_SITE_USER_TIME_DATE 0x0002UL
180#define REPORT_TYPE_TOPUSERS 0x0004UL
181#define REPORT_TYPE_TOPSITES 0x0008UL
182#define REPORT_TYPE_SITES_USERS 0x0010UL
183#define REPORT_TYPE_DATE_TIME 0x0020UL
184#define REPORT_TYPE_DENIED 0x0040UL
185#define REPORT_TYPE_AUTH_FAILURES 0x0080UL
186#define REPORT_TYPE_DOWNLOADS 0x0100UL
187
188#define DATA_FIELD_USER 0x0001UL
189#define DATA_FIELD_DATE 0x0002UL
190#define DATA_FIELD_TIME 0x0004UL
191#define DATA_FIELD_URL 0x0008UL
192#define DATA_FIELD_CONNECT 0x0010UL
193#define DATA_FIELD_BYTES 0x0020UL
194#define DATA_FIELD_IN_CACHE 0x0040UL
195#define DATA_FIELD_OUT_CACHE 0x0080UL
196#define DATA_FIELD_ELAPSED 0x0100UL
197
198#define TOPUSERFIELDS_NUM 0x0001UL
199#define TOPUSERFIELDS_DATE_TIME 0x0002UL
200#define TOPUSERFIELDS_USERID 0x0004UL
201#define TOPUSERFIELDS_CONNECT 0x0008UL
202#define TOPUSERFIELDS_BYTES 0x0010UL
203#define TOPUSERFIELDS_SETYB 0x0020UL
204#define TOPUSERFIELDS_IN_CACHE_OUT 0x0040UL
205#define TOPUSERFIELDS_USED_TIME 0x0080UL
206#define TOPUSERFIELDS_MILISEC 0x0100UL
207#define TOPUSERFIELDS_PTIME 0x0200UL
208#define TOPUSERFIELDS_TOTAL 0x0400UL
209#define TOPUSERFIELDS_AVERAGE 0x0800UL
210
211#define USERREPORTFIELDS_CONNECT 0x0001UL
212#define USERREPORTFIELDS_BYTES 0x0002UL
213#define USERREPORTFIELDS_SETYB 0x0004UL
214#define USERREPORTFIELDS_IN_CACHE_OUT 0x0008UL
215#define USERREPORTFIELDS_USED_TIME 0x0010UL
216#define USERREPORTFIELDS_MILISEC 0x0020UL
217#define USERREPORTFIELDS_PTIME 0x0040UL
218#define USERREPORTFIELDS_TOTAL 0x0080UL
219#define USERREPORTFIELDS_AVERAGE 0x0100UL
220
0349fa24
FM
221#define INDEX_YES 0x0001UL
222#define INDEX_NO 0x0002UL
223#define INDEX_ONLY 0x0004UL
224
225#define INDEX_TREE_DATE 0x0001UL
226#define INDEX_TREE_FILE 0x0002UL
227
9aaa3361
FM
228#define INDEXFIELDS_DIRSIZE 0x0001UL
229
f2ec8c75
FM
230#define NTLMUSERFORMAT_USER 0x0001UL
231#define NTLMUSERFORMAT_DOMAINUSER 0x0002UL
232
233#define RECORDWITHOUTUSER_IP 0x0001UL
234#define RECORDWITHOUTUSER_IGNORE 0x0002UL
235#define RECORDWITHOUTUSER_EVERYBODY 0x0004UL
236
f84a35a3
FM
237#define DATAFILEURL_IP 0x0001UL
238#define DATAFILEURL_NAME 0x0002UL
239
e43854ef
FM
240#define DISPLAY_BYTES 0x0001UL
241#define DISPLAY_ABBREV 0x0002UL
242
43cc1649
FM
243#define DATETIME_ELAP 0x0001UL
244#define DATETIME_BYTE 0x0002UL
245
c02d38bb
FM
246#define REALTIME_UNAUTH_REC_SHOW 0x0001UL
247#define REALTIME_UNAUTH_REC_IGNORE 0x0002UL
71d78774 248
15d5372b
FM
249#define SORT_REVERSE 0x0001
250
251#define TOPUSER_SORT_REVERSE SORT_REVERSE
252#define TOPUSER_SORT_BYTES 0x0002UL
253#define TOPUSER_SORT_USER 0x0004UL
254#define TOPUSER_SORT_CONNECT 0x0008UL
255#define TOPUSER_SORT_TIME 0x0010UL
256
257#define TOPSITE_SORT_REVERSE SORT_REVERSE
258#define TOPSITE_SORT_BYTES 0x0002UL
259#define TOPSITE_SORT_CONNECT 0x0004UL
70cab1a4 260#define TOPSITE_SORT_TIME 0x0008UL
15d5372b
FM
261
262#define USER_SORT_REVERSE SORT_REVERSE
263#define USER_SORT_BYTES 0x0002UL
264#define USER_SORT_SITE 0x0004UL
265#define USER_SORT_CONNECT 0x0008UL
266#define USER_SORT_TIME 0x0010UL
267
2e96438d
FM
268//! Value to exclude all the javascripts from the html page.
269#define HTML_JS_NONE 0x0000
270//! Bit to include sorttable.js in the html plage.
271#define HTML_JS_SORTTABLE 0x0001
272
67a93701
FM
273//! The character prefixed in front of the host names that are aliased.
274#define ALIAS_PREFIX '*'
275
fa6552b0
FM
276struct periodstruct
277{
fd46f082 278 //! The first date of the period.
fa6552b0 279 struct tm start;
fd46f082 280 //! The last date of the period.
fa6552b0 281 struct tm end;
fd46f082 282 //! The textual representation of the date.
fa6552b0 283 char text[40];
fd46f082
FM
284 //! The HTML representation of the date.
285 char html[40];
fa6552b0
FM
286};
287
25697a35 288char outdir[MAXLEN];
d5d021c5 289char outdirname[MAXLEN];
fa6552b0 290struct periodstruct period;
d6e703cc
FM
291char code[MAXLEN];
292char code2[MAXLEN];
25697a35 293char tmp[MAXLEN];
25697a35
GS
294char parse_out[MAXLEN];
295char arqtt[MAXLEN];
296char html[MAXLEN];
25697a35 297char ConfigFile[MAXLEN];
25697a35 298char df[20];
0511cf2d 299int LastLog;
06b39c87 300bool RemoveTempFiles;
25697a35 301char ReplaceIndex[256];
0349fa24 302unsigned long int Index;
06b39c87 303bool OverwriteReport;
f2ec8c75 304unsigned long int RecordsWithoutUser;
06b39c87 305bool UseComma;
4af2f8ff 306char MailUtility[PATH_MAX];
c0ec9cc7 307int TopSitesNum;
fb7c5f27 308int TopUsersNum;
25697a35 309char ExcludeCodes[256];
15d5372b 310unsigned long int TopsitesSort;
085c1e1f 311unsigned long int ReportType;
25697a35
GS
312char UserTabFile[255];
313char warea[MAXLEN];
314char name[MAXLEN];
06b39c87
FM
315bool LongUrl;
316bool Ip2Name;
0a4e18e1 317int NAccessLog;
1f482a8d 318char AccessLog[MAXLOGS][MAX_LOG_FILELEN];
0a4e18e1 319int AccessLogFromCmdLine;
25697a35
GS
320char Title[MAXLEN];
321char BgColor[MAXLEN];
322char BgImage[MAXLEN];
323char TxColor[MAXLEN];
324char TxBgColor[MAXLEN];
325char TiColor[MAXLEN];
326char LogoImage[MAXLEN];
327char LogoText[MAXLEN];
328char LogoTextColor[MAXLEN];
329char Width[MAXLEN];
330char Height[MAXLEN];
331char FontFace[MAXLEN];
332char HeaderColor[MAXLEN];
333char HeaderBgColor[MAXLEN];
334char FontSize[MAXLEN];
335char PasswdFile[MAXLEN];
336char TempDir[MAXLEN];
337char OutputDir[MAXLEN];
338char OutputEmail[MAXLEN];
15d5372b
FM
339unsigned long int TopuserSort;
340unsigned long int UserSort;
25697a35
GS
341char UserAgentLog[255];
342char module[255];
343char ExcludeHosts[255];
344char ExcludeUsers[255];
345char DateFormat[2];
346char PerUserLimitFile[255];
e6414a9d 347int PerUserLimit;
06b39c87 348bool UserIp;
25697a35 349char MaxElapsed[255];
43cc1649 350unsigned long int datetimeby;
25697a35
GS
351char CharSet[255];
352char UserInvalidChar[255];
06b39c87 353bool Graphs;
25697a35 354char GraphDaysBytesBarColor[255];
06b39c87 355bool Privacy;
25697a35
GS
356char PrivacyString[255];
357char PrivacyStringColor[30];
358char IncludeUsers[MAXLEN];
359char ExcludeString[MAXLEN];
06b39c87 360bool SuccessfulMsg;
085c1e1f
FM
361unsigned long int TopUserFields;
362unsigned long int UserReportFields;
25697a35
GS
363char DataFile[MAXLEN];
364char DataFileDelimiter[3];
085c1e1f 365unsigned long int DataFileFields;
f84a35a3 366unsigned long int DataFileUrl;
06b39c87 367bool ShowReadStatistics;
25697a35
GS
368char IndexSortOrder[5];
369char DansGuardianConf[MAXLEN];
64dfb824 370bool DansguardianFilterOutDate;
25697a35
GS
371char SquidGuardConf[MAXLEN];
372char SquidGuarddbHome[255];
1f482a8d
FM
373char RedirectorLogFormat[4096];
374int NRedirectorLogs;
375char RedirectorLogs[MAX_REDIRECTOR_LOGS][MAX_REDIRECTOR_FILELEN];
376int RedirectorLogFromCmdLine;
64dfb824 377bool RedirectorFilterOutDate;
06b39c87
FM
378bool ShowSargInfo;
379bool BytesInSitesUsersReport;
380bool ShowSargLogo;
25697a35 381char ParsedOutputLog[MAXLEN];
ff8d5836 382char ParsedOutputLogCompress[512];
e43854ef 383unsigned long int DisplayedValues;
933aca19 384char HeaderFontSize[5];
491b862f 385char TitleFontSize[5];
25697a35
GS
386char wwwDocumentRoot[MAXLEN];
387char ExternalCSSFile[MAXLEN];
388char BlockIt[255];
f2ec8c75 389unsigned long int NtlmUserFormat;
9aaa3361 390//! How to display the index of the reports.
0349fa24 391unsigned long int IndexTree;
9aaa3361
FM
392//! The columns to show in the index of the reports.
393unsigned long int IndexFields;
06b39c87 394bool UserAuthentication;
d5d021c5 395char AuthUserTemplateFile[1024];
829a53c2
FM
396//! \c True to use anonymous file and directory names in the report.
397bool AnonymousOutputFiles;
25697a35
GS
398char val1[MAXLEN];
399char val2[MAXLEN];
400char val3[MAXLEN];
401char val4[MAXLEN];
402char val5[MAXLEN];
403char val6[MAXLEN];
404char val7[MAXLEN];
405char val8[MAXLEN];
406char val9[MAXLEN];
407char val10[MAXLEN];
408char val11[MAXLEN];
25697a35 409char mask[MAXLEN];
25697a35
GS
410char site[MAXLEN];
411char us[50];
412char email[MAXLEN];
413char test[1];
25697a35
GS
414char user2[MAXLEN];
415char wentp[512];
416char addr[MAXLEN];
491b862f
GS
417char Ulimit[6];
418char RealtimeTypes[1024];
25697a35 419char cmd[255];
491b862f 420char ImageFile[255];
71d78774 421unsigned long int RealtimeUnauthRec;
e3af0ae9
PO
422char LDAPHost[255];
423char LDAPBindDN[512];
424char LDAPBindPW[255];
965c4a6f
FM
425int LDAPPort;
426int LDAPProtocolVersion;
e3af0ae9
PO
427char LDAPBaseSearch[255];
428char LDAPFilterSearch[512];
429char LDAPTargetAttr[64];
3becf85c 430char GraphFont[MAXLEN];
ea275279
FM
431//! The full path to sorttable.js if the table in the reports must be dynamicaly sorted.
432char SortTableJs[256];
22715352
FM
433//! The name of the file containing the host names to replace by an alias in the report.
434char HostAliasFile[512];
491b862f 435
25697a35
GS
436int idate;
437int smartfilter;
438int denied_count;
439int download_count;
440int authfail_count;
441int dansguardian_count;
330b1c52 442int redirector_count;
c0ec9cc7 443int useragent_count;
25697a35 444int limit_flag;
25697a35
GS
445int z1, z2, z3;
446int ttopen;
25697a35
GS
447int sarglog;
448int isalog;
2357ef77 449int dfrom;
25697a35
GS
450int duntil;
451int dataonly;
6588b137 452bool indexonly;
2824ec9b 453bool iprel;
25697a35
GS
454int langcode;
455int debug;
456int debugz;
457int debugm;
458int AuthfailReportLimit;
459int DeniedReportLimit;
94ff9470 460int DownloadReportLimit;
25697a35
GS
461int SiteUsersReportLimit;
462int DansGuardianReportLimit;
463int SquidGuardReportLimit;
464int UserReportLimit;
491b862f
GS
465int realtime_refresh;
466int realtime_access_log_lines;
491b862f 467int rc;
d6e703cc
FM
468int ntopsites;
469int nsitesusers;
470int nrepday;
471int ndownload;
472int ntopuser;
2824ec9b 473bool squid24;
25697a35 474
491b862f
GS
475long long int nocost;
476float cost;
25697a35
GS
477
478typedef struct
479{ int list[ 24 ];
480 int len;
481} numlist;