]> git.ipfire.org Git - thirdparty/sarg.git/blob - include/conf.h
Store the period internaly and get rid of the sarg-period file.
[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 struct tm start;
239 struct tm end;
240 char text[40];
241 };
242
243 char outdir[MAXLEN];
244 char outdirname[MAXLEN];
245 struct periodstruct period;
246 char code[MAXLEN];
247 char code2[MAXLEN];
248 char tmp[MAXLEN];
249 char parse_out[MAXLEN];
250 char arqtt[MAXLEN];
251 char html[MAXLEN];
252 char ConfigFile[MAXLEN];
253 char df[20];
254 char cdfrom[30];
255 char cduntil[30];
256 int LastLog;
257 bool RemoveTempFiles;
258 char ReplaceIndex[256];
259 unsigned long int Index;
260 bool OverwriteReport;
261 unsigned long int RecordsWithoutUser;
262 bool UseComma;
263 char MailUtility[PATH_MAX];
264 int TopSitesNum;
265 int TopUsersNum;
266 char ExcludeCodes[256];
267 char TopsitesSortField[15];
268 char TopsitesSortType[20];
269 unsigned long int ReportType;
270 char UserTabFile[255];
271 char warea[MAXLEN];
272 char name[MAXLEN];
273 bool LongUrl;
274 bool Ip2Name;
275 int NAccessLog;
276 char AccessLog[MAXLOGS][MAXLEN];
277 int AccessLogFromCmdLine;
278 char Title[MAXLEN];
279 char BgColor[MAXLEN];
280 char BgImage[MAXLEN];
281 char TxColor[MAXLEN];
282 char TxBgColor[MAXLEN];
283 char TiColor[MAXLEN];
284 char LogoImage[MAXLEN];
285 char LogoText[MAXLEN];
286 char LogoTextColor[MAXLEN];
287 char Width[MAXLEN];
288 char Height[MAXLEN];
289 char FontFace[MAXLEN];
290 char HeaderColor[MAXLEN];
291 char HeaderBgColor[MAXLEN];
292 char FontSize[MAXLEN];
293 char PasswdFile[MAXLEN];
294 char TempDir[MAXLEN];
295 char OutputDir[MAXLEN];
296 char OutputEmail[MAXLEN];
297 char TopuserSortField[30];
298 char UserSortField[30];
299 char TopuserSortOrder[10];
300 char UserSortOrder[10];
301 char UserAgentLog[255];
302 char module[255];
303 char ExcludeHosts[255];
304 char ExcludeUsers[255];
305 char DateFormat[2];
306 char PerUserLimitFile[255];
307 int PerUserLimit;
308 bool UserIp;
309 char MaxElapsed[255];
310 char datetimeby[10];
311 char CharSet[255];
312 char UserInvalidChar[255];
313 bool Graphs;
314 char GraphDaysBytesBarColor[255];
315 bool Privacy;
316 char PrivacyString[255];
317 char PrivacyStringColor[30];
318 char IncludeUsers[MAXLEN];
319 char ExcludeString[MAXLEN];
320 bool SuccessfulMsg;
321 unsigned long int TopUserFields;
322 unsigned long int UserReportFields;
323 char DataFile[MAXLEN];
324 char DataFileDelimiter[3];
325 unsigned long int DataFileFields;
326 unsigned long int DataFileUrl;
327 bool ShowReadStatistics;
328 char IndexSortOrder[5];
329 char DansGuardianConf[MAXLEN];
330 bool DansguardianIgnoreDate;
331 char SquidGuardConf[MAXLEN];
332 char SquidGuarddbHome[255];
333 char SquidGuardLogFormat[MAXLEN];
334 char SquidGuardLogAlternate[MAXLEN];
335 bool SquidguardIgnoreDate;
336 bool ShowSargInfo;
337 bool BytesInSitesUsersReport;
338 bool ShowSargLogo;
339 char ParsedOutputLog[MAXLEN];
340 char ParsedOutputLogCompress[512];
341 char DisplayedValues[20];
342 char HeaderFontSize[5];
343 char TitleFontSize[5];
344 char wwwDocumentRoot[MAXLEN];
345 char ExternalCSSFile[MAXLEN];
346 char BlockIt[255];
347 unsigned long int NtlmUserFormat;
348 unsigned long int IndexTree;
349 bool UserAuthentication;
350 char AuthUserTemplateFile[1024];
351 char val1[MAXLEN];
352 char val2[MAXLEN];
353 char val3[MAXLEN];
354 char val4[MAXLEN];
355 char val5[MAXLEN];
356 char val6[MAXLEN];
357 char val7[MAXLEN];
358 char val8[MAXLEN];
359 char val9[MAXLEN];
360 char val10[MAXLEN];
361 char val11[MAXLEN];
362 char wwork1[MAXLEN];
363 char wwork2[MAXLEN];
364 char wwork3[MAXLEN];
365 char mask[MAXLEN];
366 char site[MAXLEN];
367 char us[50];
368 char email[MAXLEN];
369 char test[1];
370 char user2[MAXLEN];
371 char wentp[512];
372 char addr[MAXLEN];
373 char Ulimit[6];
374 char RealtimeTypes[1024];
375 char cmd[255];
376 char ImageFile[255];
377 char RealtimeUnauthRec[15];
378 char LDAPHost[255];
379 char LDAPBindDN[512];
380 char LDAPBindPW[255];
381 int LDAPPort;
382 int LDAPProtocolVersion;
383 char LDAPBaseSearch[255];
384 char LDAPFilterSearch[512];
385 char LDAPTargetAttr[64];
386 char GraphFont[MAXLEN];
387
388 int idate;
389 int smartfilter;
390 int denied_count;
391 int download_count;
392 int authfail_count;
393 int dansguardian_count;
394 int squidguard_count;
395 int useragent_count;
396 int limit_flag;
397 int color1;
398 int color2;
399 int color3;
400 int z1, z2, z3;
401 int ttopen;
402 int sarglog;
403 int isalog;
404 int dfrom;
405 int duntil;
406 int dataonly;
407 int indexonly;
408 bool iprel;
409 bool userip;
410 int langcode;
411 int debug;
412 int debugz;
413 int debugm;
414 int AuthfailReportLimit;
415 int DeniedReportLimit;
416 int DownloadReportLimit;
417 int SiteUsersReportLimit;
418 int DansGuardianReportLimit;
419 int SquidGuardReportLimit;
420 int UserReportLimit;
421 int realtime_refresh;
422 int realtime_access_log_lines;
423 int rc;
424 int ntopsites;
425 int nsitesusers;
426 int nrepday;
427 int ndownload;
428 int ntopuser;
429 bool squid24;
430
431 long long int nocost;
432 float cost;
433
434 typedef struct
435 { int list[ 24 ];
436 int len;
437 } numlist;
438
439 DIR *dirp;
440 struct dirent *direntp;