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