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