]> git.ipfire.org Git - thirdparty/sarg.git/blob - include/conf.h
The date range passed as argument is not restricted to the actual range covered by...
[thirdparty/sarg.git] / include / conf.h
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 gdImagePtr im;
69 gdPoint points[4];
70 #endif
71 #ifdef HAVE_GDFONTL_H
72 #include <gdfontl.h>
73 #endif
74 #ifdef HAVE_GDFONTT_H
75 #include <gdfontt.h>
76 #endif
77 #ifdef HAVE_GDFONTS_H
78 #include <gdfonts.h>
79 #endif
80 #ifdef HAVE_GDFONTMB_H
81 #include <gdfontmb.h>
82 #endif
83 #ifdef HAVE_GDFONTG_H
84 #include <gdfontg.h>
85 #endif
86 #ifdef HAVE_STDARG_H
87 #include <stdarg.h>
88 #endif
89 #ifdef HAVE_INTTYPES_H
90 #include <inttypes.h>
91 #endif
92 #ifdef HAVE_LIMITS_H
93 #include <limits.h>
94 #endif
95 #ifdef HAVE_WINSOCK_H
96 #include <winsock.h>
97 #endif
98 #ifdef HAVE_MATH_H
99 #include <math.h>
100 #endif
101 #ifdef HAVE_LOCALE_H
102 #include <locale.h>
103 #endif
104 #ifdef HAVE_EXECINFO_H
105 #include <execinfo.h>
106 #endif
107 #ifdef HAVE_LIBGEN_H
108 #include <libgen.h>
109 #endif
110 #ifdef HAVE_STDBOOL_H
111 #include <stdbool.h>
112 #else
113 typedef int bool;
114 #define true 1
115 #define false 0
116 #endif
117
118 #if defined(HAVE_FOPEN64)
119 #define _FILE_OFFSET_BITS 64
120 #define MY_FOPEN fopen64
121 #else
122 #define MY_FOPEN fopen
123 #endif
124
125 #if !defined(HAVE_BZERO)
126 #define bzero(mem,size) memset(mem,0,size)
127 #endif
128
129 #if defined(IBERTY_LIB) && !defined(HAVE_MKSTEMP)
130 int mkstemps(char *template, int suffixlen);
131 #define mkstemp(template) mkstemps(template,0)
132 #endif
133
134 #if defined(ENABLE_NLS) && defined(HAVE_LIBINTL_H)
135 #include <libintl.h>
136 #define _(String) gettext(String)
137 #ifdef gettext_noop
138 #define N_(String) gettext_noop(String)
139 #else
140 #define N_(String) (String)
141 #endif
142 #else /* No NLS */
143 #define _(String) (String)
144 #define N_(String) (String)
145 #define ngettext(String,Strings,num) (Strings)
146 #define textdomain(String)
147 #define bindtextdomain(Domain,Directory)
148 #endif //NLS
149
150 #if defined(__MINGW32__)
151 #define mkdir(p,m) _mkdir(p)
152
153 #ifndef WIFEXITED
154 #define WIFEXITED(S) 1
155 #endif
156
157 #ifndef WEXITSTATUS
158 #define WEXITSTATUS(S) (S)
159 #endif
160
161 #endif /*__MINGW32__*/
162
163 #ifndef __GNUC__
164 # define __attribute__(x)
165 #endif
166
167 #define MAXLEN 20000
168 #define MAX_URL_LEN 40000
169 #define MAX_TRUNCATED_URL 512
170 #define MAX_USER_LEN 256
171 #define MAX_USER_FNAME_LEN 128
172 #define MAX_IP_LEN 64
173 #define MAX_DATETIME_LEN 32
174 #define MAXLOGS 255
175
176 #define REPORT_TYPE_USERS_SITES 0x0001UL
177 #define REPORT_TYPE_SITE_USER_TIME_DATE 0x0002UL
178 #define REPORT_TYPE_TOPUSERS 0x0004UL
179 #define REPORT_TYPE_TOPSITES 0x0008UL
180 #define REPORT_TYPE_SITES_USERS 0x0010UL
181 #define REPORT_TYPE_DATE_TIME 0x0020UL
182 #define REPORT_TYPE_DENIED 0x0040UL
183 #define REPORT_TYPE_AUTH_FAILURES 0x0080UL
184 #define REPORT_TYPE_DOWNLOADS 0x0100UL
185
186 #define DATA_FIELD_USER 0x0001UL
187 #define DATA_FIELD_DATE 0x0002UL
188 #define DATA_FIELD_TIME 0x0004UL
189 #define DATA_FIELD_URL 0x0008UL
190 #define DATA_FIELD_CONNECT 0x0010UL
191 #define DATA_FIELD_BYTES 0x0020UL
192 #define DATA_FIELD_IN_CACHE 0x0040UL
193 #define DATA_FIELD_OUT_CACHE 0x0080UL
194 #define DATA_FIELD_ELAPSED 0x0100UL
195
196 #define TOPUSERFIELDS_NUM 0x0001UL
197 #define TOPUSERFIELDS_DATE_TIME 0x0002UL
198 #define TOPUSERFIELDS_USERID 0x0004UL
199 #define TOPUSERFIELDS_CONNECT 0x0008UL
200 #define TOPUSERFIELDS_BYTES 0x0010UL
201 #define TOPUSERFIELDS_SETYB 0x0020UL
202 #define TOPUSERFIELDS_IN_CACHE_OUT 0x0040UL
203 #define TOPUSERFIELDS_USED_TIME 0x0080UL
204 #define TOPUSERFIELDS_MILISEC 0x0100UL
205 #define TOPUSERFIELDS_PTIME 0x0200UL
206 #define TOPUSERFIELDS_TOTAL 0x0400UL
207 #define TOPUSERFIELDS_AVERAGE 0x0800UL
208
209 #define USERREPORTFIELDS_CONNECT 0x0001UL
210 #define USERREPORTFIELDS_BYTES 0x0002UL
211 #define USERREPORTFIELDS_SETYB 0x0004UL
212 #define USERREPORTFIELDS_IN_CACHE_OUT 0x0008UL
213 #define USERREPORTFIELDS_USED_TIME 0x0010UL
214 #define USERREPORTFIELDS_MILISEC 0x0020UL
215 #define USERREPORTFIELDS_PTIME 0x0040UL
216 #define USERREPORTFIELDS_TOTAL 0x0080UL
217 #define USERREPORTFIELDS_AVERAGE 0x0100UL
218
219 #define INDEX_YES 0x0001UL
220 #define INDEX_NO 0x0002UL
221 #define INDEX_ONLY 0x0004UL
222
223 #define INDEX_TREE_DATE 0x0001UL
224 #define INDEX_TREE_FILE 0x0002UL
225
226 #define NTLMUSERFORMAT_USER 0x0001UL
227 #define NTLMUSERFORMAT_DOMAINUSER 0x0002UL
228
229 #define RECORDWITHOUTUSER_IP 0x0001UL
230 #define RECORDWITHOUTUSER_IGNORE 0x0002UL
231 #define RECORDWITHOUTUSER_EVERYBODY 0x0004UL
232
233 #define DATAFILEURL_IP 0x0001UL
234 #define DATAFILEURL_NAME 0x0002UL
235
236 struct periodstruct
237 {
238 //! The first date of the period.
239 struct tm start;
240 //! The last date of the period.
241 struct tm end;
242 //! The textual representation of the date.
243 char text[40];
244 //! The HTML representation of the date.
245 char html[40];
246 };
247
248 char outdir[MAXLEN];
249 char outdirname[MAXLEN];
250 struct periodstruct period;
251 char code[MAXLEN];
252 char code2[MAXLEN];
253 char tmp[MAXLEN];
254 char parse_out[MAXLEN];
255 char arqtt[MAXLEN];
256 char html[MAXLEN];
257 char ConfigFile[MAXLEN];
258 char df[20];
259 int LastLog;
260 bool RemoveTempFiles;
261 char ReplaceIndex[256];
262 unsigned long int Index;
263 bool OverwriteReport;
264 unsigned long int RecordsWithoutUser;
265 bool UseComma;
266 char MailUtility[PATH_MAX];
267 int TopSitesNum;
268 int TopUsersNum;
269 char ExcludeCodes[256];
270 char TopsitesSortField[15];
271 char TopsitesSortType[20];
272 unsigned long int ReportType;
273 char UserTabFile[255];
274 char warea[MAXLEN];
275 char name[MAXLEN];
276 bool LongUrl;
277 bool Ip2Name;
278 int NAccessLog;
279 char AccessLog[MAXLOGS][MAXLEN];
280 int AccessLogFromCmdLine;
281 char Title[MAXLEN];
282 char BgColor[MAXLEN];
283 char BgImage[MAXLEN];
284 char TxColor[MAXLEN];
285 char TxBgColor[MAXLEN];
286 char TiColor[MAXLEN];
287 char LogoImage[MAXLEN];
288 char LogoText[MAXLEN];
289 char LogoTextColor[MAXLEN];
290 char Width[MAXLEN];
291 char Height[MAXLEN];
292 char FontFace[MAXLEN];
293 char HeaderColor[MAXLEN];
294 char HeaderBgColor[MAXLEN];
295 char FontSize[MAXLEN];
296 char PasswdFile[MAXLEN];
297 char TempDir[MAXLEN];
298 char OutputDir[MAXLEN];
299 char OutputEmail[MAXLEN];
300 char TopuserSortField[30];
301 char UserSortField[30];
302 char TopuserSortOrder[10];
303 char UserSortOrder[10];
304 char UserAgentLog[255];
305 char module[255];
306 char ExcludeHosts[255];
307 char ExcludeUsers[255];
308 char DateFormat[2];
309 char PerUserLimitFile[255];
310 int PerUserLimit;
311 bool UserIp;
312 char MaxElapsed[255];
313 char datetimeby[10];
314 char CharSet[255];
315 char UserInvalidChar[255];
316 bool Graphs;
317 char GraphDaysBytesBarColor[255];
318 bool Privacy;
319 char PrivacyString[255];
320 char PrivacyStringColor[30];
321 char IncludeUsers[MAXLEN];
322 char ExcludeString[MAXLEN];
323 bool SuccessfulMsg;
324 unsigned long int TopUserFields;
325 unsigned long int UserReportFields;
326 char DataFile[MAXLEN];
327 char DataFileDelimiter[3];
328 unsigned long int DataFileFields;
329 unsigned long int DataFileUrl;
330 bool ShowReadStatistics;
331 char IndexSortOrder[5];
332 char DansGuardianConf[MAXLEN];
333 bool DansguardianIgnoreDate;
334 char SquidGuardConf[MAXLEN];
335 char SquidGuarddbHome[255];
336 char SquidGuardLogFormat[MAXLEN];
337 char SquidGuardLogAlternate[MAXLEN];
338 bool SquidguardIgnoreDate;
339 bool ShowSargInfo;
340 bool BytesInSitesUsersReport;
341 bool ShowSargLogo;
342 char ParsedOutputLog[MAXLEN];
343 char ParsedOutputLogCompress[512];
344 char DisplayedValues[20];
345 char HeaderFontSize[5];
346 char TitleFontSize[5];
347 char wwwDocumentRoot[MAXLEN];
348 char ExternalCSSFile[MAXLEN];
349 char BlockIt[255];
350 unsigned long int NtlmUserFormat;
351 unsigned long int IndexTree;
352 bool UserAuthentication;
353 char AuthUserTemplateFile[1024];
354 char val1[MAXLEN];
355 char val2[MAXLEN];
356 char val3[MAXLEN];
357 char val4[MAXLEN];
358 char val5[MAXLEN];
359 char val6[MAXLEN];
360 char val7[MAXLEN];
361 char val8[MAXLEN];
362 char val9[MAXLEN];
363 char val10[MAXLEN];
364 char val11[MAXLEN];
365 char wwork1[MAXLEN];
366 char wwork2[MAXLEN];
367 char wwork3[MAXLEN];
368 char mask[MAXLEN];
369 char site[MAXLEN];
370 char us[50];
371 char email[MAXLEN];
372 char test[1];
373 char user2[MAXLEN];
374 char wentp[512];
375 char addr[MAXLEN];
376 char Ulimit[6];
377 char RealtimeTypes[1024];
378 char cmd[255];
379 char ImageFile[255];
380 char RealtimeUnauthRec[15];
381 char LDAPHost[255];
382 char LDAPBindDN[512];
383 char LDAPBindPW[255];
384 int LDAPPort;
385 int LDAPProtocolVersion;
386 char LDAPBaseSearch[255];
387 char LDAPFilterSearch[512];
388 char LDAPTargetAttr[64];
389 char GraphFont[MAXLEN];
390
391 int idate;
392 int smartfilter;
393 int denied_count;
394 int download_count;
395 int authfail_count;
396 int dansguardian_count;
397 int squidguard_count;
398 int useragent_count;
399 int limit_flag;
400 int color1;
401 int color2;
402 int color3;
403 int z1, z2, z3;
404 int ttopen;
405 int sarglog;
406 int isalog;
407 int dfrom;
408 int duntil;
409 int dataonly;
410 int indexonly;
411 bool iprel;
412 int langcode;
413 int debug;
414 int debugz;
415 int debugm;
416 int AuthfailReportLimit;
417 int DeniedReportLimit;
418 int DownloadReportLimit;
419 int SiteUsersReportLimit;
420 int DansGuardianReportLimit;
421 int SquidGuardReportLimit;
422 int UserReportLimit;
423 int realtime_refresh;
424 int realtime_access_log_lines;
425 int rc;
426 int ntopsites;
427 int nsitesusers;
428 int nrepday;
429 int ndownload;
430 int ntopuser;
431 bool squid24;
432
433 long long int nocost;
434 float cost;
435
436 typedef struct
437 { int list[ 24 ];
438 int len;
439 } numlist;
440
441 DIR *dirp;
442 struct dirent *direntp;