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
116 #if defined(HAVE_FOPEN64)
117 #define _FILE_OFFSET_BITS 64
118 #define MY_FOPEN fopen64
120 #define MY_FOPEN fopen
123 #if !defined(HAVE_BZERO)
124 #define bzero(mem,size) memset(mem,0,size)
127 #if defined(IBERTY_LIB) && !defined(HAVE_MKSTEMP)
128 int mkstemps(char *template, int suffixlen
);
129 #define mkstemp(template) mkstemps(template,0)
132 #if defined(ENABLE_NLS) && defined(HAVE_LIBINTL_H)
134 #define _(String) gettext(String)
136 #define N_(String) gettext_noop(String)
138 #define N_(String) (String)
141 #define _(String) (String)
142 #define N_(String) (String)
143 #define ngettext(String,Strings,num) (Strings)
144 #define textdomain(String)
145 #define bindtextdomain(Domain,Directory)
148 #if defined(__MINGW32__)
149 #define mkdir(p,m) _mkdir(p)
152 #define WIFEXITED(S) 1
156 #define WEXITSTATUS(S) (S)
159 #endif /*__MINGW32__*/
162 # define __attribute__(x)
166 #define MAX_URL_LEN 40000
167 #define MAX_TRUNCATED_URL 512
168 #define MAX_USER_LEN 256
169 #define MAX_USER_FNAME_LEN 128
170 #define MAX_IP_LEN 64
171 #define MAX_DATETIME_LEN 32
173 #define MAX_LOG_FILELEN 1024
174 #define MAX_REDIRECTOR_LOGS 64
175 #define MAX_REDIRECTOR_FILELEN 1024
176 #define MAX_DATETIME_DAYS 90
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
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
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
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
221 #define INDEX_YES 0x0001UL
222 #define INDEX_NO 0x0002UL
223 #define INDEX_ONLY 0x0004UL
225 #define INDEX_TREE_DATE 0x0001UL
226 #define INDEX_TREE_FILE 0x0002UL
228 #define INDEXFIELDS_DIRSIZE 0x0001UL
230 #define NTLMUSERFORMAT_USER 0x0001UL
231 #define NTLMUSERFORMAT_DOMAINUSER 0x0002UL
233 #define RECORDWITHOUTUSER_IP 0x0001UL
234 #define RECORDWITHOUTUSER_IGNORE 0x0002UL
235 #define RECORDWITHOUTUSER_EVERYBODY 0x0004UL
237 #define DATAFILEURL_IP 0x0001UL
238 #define DATAFILEURL_NAME 0x0002UL
240 #define DISPLAY_BYTES 0x0001UL
241 #define DISPLAY_ABBREV 0x0002UL
243 #define DATETIME_ELAP 0x0001UL
244 #define DATETIME_BYTE 0x0002UL
246 #define REALTIME_UNAUTH_REC_SHOW 0x0001UL
247 #define REALTIME_UNAUTH_REC_IGNORE 0x0002UL
249 #define SORT_REVERSE 0x0001
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
257 #define TOPSITE_SORT_REVERSE SORT_REVERSE
258 #define TOPSITE_SORT_BYTES 0x0002UL
259 #define TOPSITE_SORT_CONNECT 0x0004UL
260 #define TOPSITE_SORT_TIME 0x0008UL
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
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
273 //! The character prefixed in front of the host names that are aliased.
274 #define ALIAS_PREFIX '*'
278 //! The first date of the period.
280 //! The last date of the period.
282 //! The textual representation of the date.
284 //! The HTML representation of the date.
289 char outdirname
[MAXLEN
];
290 struct periodstruct period
;
294 char parse_out
[MAXLEN
];
297 char ConfigFile
[MAXLEN
];
300 bool RemoveTempFiles
;
301 char ReplaceIndex
[256];
302 unsigned long int Index
;
303 bool OverwriteReport
;
304 unsigned long int RecordsWithoutUser
;
306 char MailUtility
[PATH_MAX
];
309 char ExcludeCodes
[256];
310 unsigned long int TopsitesSort
;
311 unsigned long int ReportType
;
312 char UserTabFile
[255];
318 char AccessLog
[MAXLOGS
][MAX_LOG_FILELEN
];
319 int AccessLogFromCmdLine
;
321 char BgColor
[MAXLEN
];
322 char BgImage
[MAXLEN
];
323 char TxColor
[MAXLEN
];
324 char TxBgColor
[MAXLEN
];
325 char TiColor
[MAXLEN
];
326 char LogoImage
[MAXLEN
];
327 char LogoText
[MAXLEN
];
328 char LogoTextColor
[MAXLEN
];
331 char FontFace
[MAXLEN
];
332 char HeaderColor
[MAXLEN
];
333 char HeaderBgColor
[MAXLEN
];
334 char FontSize
[MAXLEN
];
335 char PasswdFile
[MAXLEN
];
336 char TempDir
[MAXLEN
];
337 char OutputDir
[MAXLEN
];
338 char OutputEmail
[MAXLEN
];
339 unsigned long int TopuserSort
;
340 unsigned long int UserSort
;
341 char UserAgentLog
[255];
343 char ExcludeHosts
[255];
344 char ExcludeUsers
[255];
346 char PerUserLimitFile
[255];
349 char MaxElapsed
[255];
350 unsigned long int datetimeby
;
352 char UserInvalidChar
[255];
354 char GraphDaysBytesBarColor
[255];
356 char PrivacyString
[255];
357 char PrivacyStringColor
[30];
358 char IncludeUsers
[MAXLEN
];
359 char ExcludeString
[MAXLEN
];
361 unsigned long int TopUserFields
;
362 unsigned long int UserReportFields
;
363 char DataFile
[MAXLEN
];
364 char DataFileDelimiter
[3];
365 unsigned long int DataFileFields
;
366 unsigned long int DataFileUrl
;
367 bool ShowReadStatistics
;
368 char IndexSortOrder
[5];
369 char DansGuardianConf
[MAXLEN
];
370 bool DansguardianFilterOutDate
;
371 char SquidGuardConf
[MAXLEN
];
372 char SquidGuarddbHome
[255];
373 char RedirectorLogFormat
[4096];
375 char RedirectorLogs
[MAX_REDIRECTOR_LOGS
][MAX_REDIRECTOR_FILELEN
];
376 int RedirectorLogFromCmdLine
;
377 bool RedirectorFilterOutDate
;
379 bool BytesInSitesUsersReport
;
381 char ParsedOutputLog
[MAXLEN
];
382 char ParsedOutputLogCompress
[512];
383 unsigned long int DisplayedValues
;
384 char HeaderFontSize
[5];
385 char TitleFontSize
[5];
386 char wwwDocumentRoot
[MAXLEN
];
387 char ExternalCSSFile
[MAXLEN
];
389 unsigned long int NtlmUserFormat
;
390 //! How to display the index of the reports.
391 unsigned long int IndexTree
;
392 //! The columns to show in the index of the reports.
393 unsigned long int IndexFields
;
394 bool UserAuthentication
;
395 char AuthUserTemplateFile
[1024];
396 //! \c True to use anonymous file and directory names in the report.
397 bool AnonymousOutputFiles
;
418 char RealtimeTypes
[1024];
421 unsigned long int RealtimeUnauthRec
;
423 char LDAPBindDN
[512];
424 char LDAPBindPW
[255];
426 int LDAPProtocolVersion
;
427 char LDAPBaseSearch
[255];
428 char LDAPFilterSearch
[512];
429 char LDAPTargetAttr
[64];
430 char GraphFont
[MAXLEN
];
431 //! The full path to sorttable.js if the table in the reports must be dynamicaly sorted.
432 char SortTableJs
[256];
433 //! The name of the file containing the host names to replace by an alias in the report.
434 char HostAliasFile
[512];
441 int dansguardian_count
;
442 int redirector_count
;
458 int AuthfailReportLimit
;
459 int DeniedReportLimit
;
460 int DownloadReportLimit
;
461 int SiteUsersReportLimit
;
462 int DansGuardianReportLimit
;
463 int SquidGuardReportLimit
;
465 int realtime_refresh
;
466 int realtime_access_log_lines
;
475 long long int nocost
;