3 #include "btree_cache.h"
20 #ifdef HAVE_SYS_TIME_H
26 #ifdef HAVE_SYS_RESOURCE_H
27 #include <sys/resource.h>
32 #if defined(HAVE_SYS_DIRENT_H) && !defined(HAVE_DIRENT_H)
33 #include <sys/dirent.h>
38 #ifdef HAVE_SYS_SOCKET_H
39 #include <sys/socket.h>
47 #ifdef HAVE_NETINET_IN_H
48 #include <netinet/in.h>
50 #ifdef HAVE_ARPA_INET_H
51 #include <arpa/inet.h>
53 #ifdef HAVE_SYS_STAT_H
62 #ifdef HAVE_SYS_WAIT_H
78 #ifdef HAVE_GDFONTMB_H
87 #ifdef HAVE_INTTYPES_H
102 #ifdef HAVE_EXECINFO_H
103 #include <execinfo.h>
108 #ifdef HAVE_STDBOOL_H
119 #if defined(HAVE_FOPEN64)
120 #define _FILE_OFFSET_BITS 64
121 #define MY_FOPEN fopen64
123 #define MY_FOPEN fopen
126 #if !defined(HAVE_BZERO)
127 #define bzero(mem,size) memset(mem,0,size)
130 #if defined(IBERTY_LIB) && !defined(HAVE_MKSTEMP)
131 int mkstemps(char *template, int suffixlen
);
132 #define mkstemp(template) mkstemps(template,0)
135 #if defined(ENABLE_NLS) && defined(HAVE_LIBINTL_H)
137 #define _(String) gettext(String)
139 #define N_(String) gettext_noop(String)
141 #define N_(String) (String)
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)
151 #if defined(__MINGW32__)
152 #define mkdir(p,m) _mkdir(p)
155 #define WIFEXITED(S) 1
159 #define WEXITSTATUS(S) (S)
162 #endif /*__MINGW32__*/
165 # define __attribute__(x)
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
176 #define MAX_LOG_FILELEN 1024
177 #define MAX_REDIRECTOR_LOGS 64
178 #define MAX_REDIRECTOR_FILELEN 1024
180 Arbitrary limit on the number of days that are accepted in the selected range of the log file.
181 Sarg will complain that there are too many days in the files if this limit is overrun.
183 #define MAX_DATETIME_DAYS 1000
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
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
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
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
228 #define INDEX_YES 0x0001UL
229 #define INDEX_NO 0x0002UL
230 #define INDEX_ONLY 0x0004UL
232 #define INDEX_TREE_DATE 0x0001UL
233 #define INDEX_TREE_FILE 0x0002UL
235 #define INDEXFIELDS_DIRSIZE 0x0001UL
237 #define NTLMUSERFORMAT_USER 0x0001UL
238 #define NTLMUSERFORMAT_DOMAINUSER 0x0002UL
240 #define RECORDWITHOUTUSER_IP 0x0001UL
241 #define RECORDWITHOUTUSER_IGNORE 0x0002UL
242 #define RECORDWITHOUTUSER_EVERYBODY 0x0004UL
244 #define DATAFILEURL_IP 0x0001UL
245 #define DATAFILEURL_NAME 0x0002UL
247 #define DISPLAY_BYTES 0x0001UL
248 #define DISPLAY_ABBREV 0x0002UL
250 #define DATETIME_ELAP 0x0001UL
251 #define DATETIME_BYTE 0x0002UL
253 #define REALTIME_UNAUTH_REC_SHOW 0x0001UL
254 #define REALTIME_UNAUTH_REC_IGNORE 0x0002UL
256 #define SORT_REVERSE 0x0001
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
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
269 #define USER_SORT_REVERSE SORT_REVERSE
270 #define USER_SORT_BYTES 0x0002UL
271 #define USER_SORT_SITE 0x0004UL
272 #define USER_SORT_CONNECT 0x0008UL
273 #define USER_SORT_TIME 0x0010UL
275 //! Value to exclude all the javascripts from the html page.
276 #define HTML_JS_NONE 0x0000
277 //! Bit to include sorttable.js in the html plage.
278 #define HTML_JS_SORTTABLE 0x0001
280 //! The character prefixed in front of the host names that are aliased.
281 #define ALIAS_PREFIX '*'
285 //! The first date of the period.
287 //! The last date of the period.
289 //! The textual representation of the date.
291 //! The HTML representation of the date.
296 char outdirname
[MAXLEN
];
297 struct periodstruct period
;
301 char parse_out
[MAXLEN
];
304 char ConfigFile
[MAXLEN
];
307 bool RemoveTempFiles
;
308 char ReplaceIndex
[256];
309 unsigned long int Index
;
310 bool OverwriteReport
;
311 unsigned long int RecordsWithoutUser
;
313 char MailUtility
[PATH_MAX
];
316 char ExcludeCodes
[256];
317 unsigned long int TopsitesSort
;
318 unsigned long int ReportType
;
319 char UserTabFile
[255];
325 char AccessLog
[MAXLOGS
][MAX_LOG_FILELEN
];
326 int AccessLogFromCmdLine
;
328 char BgColor
[MAXLEN
];
329 char BgImage
[MAXLEN
];
330 char TxColor
[MAXLEN
];
331 char TxBgColor
[MAXLEN
];
332 char TiColor
[MAXLEN
];
333 char LogoImage
[MAXLEN
];
334 char LogoText
[MAXLEN
];
335 char LogoTextColor
[MAXLEN
];
338 char FontFace
[MAXLEN
];
339 char HeaderColor
[MAXLEN
];
340 char HeaderBgColor
[MAXLEN
];
341 char FontSize
[MAXLEN
];
342 char PasswdFile
[MAXLEN
];
343 char TempDir
[MAXLEN
];
344 char OutputDir
[MAXLEN
];
345 char OutputEmail
[MAXLEN
];
346 unsigned long int TopuserSort
;
347 unsigned long int UserSort
;
348 char UserAgentLog
[255];
350 char ExcludeHosts
[255];
351 char ExcludeUsers
[255];
353 char PerUserLimitFile
[255];
356 char MaxElapsed
[255];
357 unsigned long int datetimeby
;
359 char UserInvalidChar
[255];
361 char GraphDaysBytesBarColor
[255];
363 char PrivacyString
[255];
364 char PrivacyStringColor
[30];
365 char IncludeUsers
[MAXLEN
];
366 char ExcludeString
[MAXLEN
];
368 unsigned long int TopUserFields
;
369 unsigned long int UserReportFields
;
370 char DataFile
[MAXLEN
];
371 char DataFileDelimiter
[3];
372 unsigned long int DataFileFields
;
373 unsigned long int DataFileUrl
;
374 bool ShowReadStatistics
;
375 char IndexSortOrder
[5];
376 char DansGuardianConf
[MAXLEN
];
377 bool DansguardianFilterOutDate
;
378 char SquidGuardConf
[MAXLEN
];
379 char SquidGuarddbHome
[255];
380 char RedirectorLogFormat
[4096];
382 char RedirectorLogs
[MAX_REDIRECTOR_LOGS
][MAX_REDIRECTOR_FILELEN
];
383 int RedirectorLogFromCmdLine
;
384 bool RedirectorFilterOutDate
;
386 bool BytesInSitesUsersReport
;
388 char ParsedOutputLog
[MAXLEN
];
389 char ParsedOutputLogCompress
[512];
390 unsigned long int DisplayedValues
;
391 char HeaderFontSize
[5];
392 char TitleFontSize
[5];
393 char wwwDocumentRoot
[MAXLEN
];
394 char ExternalCSSFile
[MAXLEN
];
396 unsigned long int NtlmUserFormat
;
397 //! How to display the index of the reports.
398 unsigned long int IndexTree
;
399 //! The columns to show in the index of the reports.
400 unsigned long int IndexFields
;
401 bool UserAuthentication
;
402 char AuthUserTemplateFile
[1024];
403 //! \c True to use anonymous file and directory names in the report.
404 bool AnonymousOutputFiles
;
423 char RealtimeTypes
[1024];
426 unsigned long int RealtimeUnauthRec
;
428 char LDAPBindDN
[512];
429 char LDAPBindPW
[255];
431 int LDAPProtocolVersion
;
432 char LDAPBaseSearch
[255];
433 char LDAPFilterSearch
[512];
434 char LDAPTargetAttr
[64];
435 char GraphFont
[MAXLEN
];
436 //! The full path to sorttable.js if the table in the reports must be dynamicaly sorted.
437 char SortTableJs
[256];
438 //! The name of the file containing the host names to replace by an alias in the report.
439 char HostAliasFile
[512];
446 int dansguardian_count
;
447 int redirector_count
;
463 int AuthfailReportLimit
;
464 int DeniedReportLimit
;
465 int DownloadReportLimit
;
466 int SiteUsersReportLimit
;
467 int DansGuardianReportLimit
;
468 int SquidGuardReportLimit
;
470 int realtime_refresh
;
471 int realtime_access_log_lines
;
479 long long int nocost
;