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