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