]> git.ipfire.org Git - thirdparty/sarg.git/blame - include/conf.h
Apply a few more recommandation from splint
[thirdparty/sarg.git] / include / conf.h
CommitLineData
b3695c67 1#include "config.h"
25697a35 2#include "info.h"
e3af0ae9 3#include "btree_cache.h"
25697a35 4
b3695c67
FM
5#ifdef HAVE_WINDOWS_H
6#include <windows.h>
7#endif
8#ifdef HAVE_STDIO_H
25697a35
GS
9#include <stdio.h>
10#endif
b3695c67 11#ifdef HAVE_STDLIB_H
25697a35
GS
12#include <stdlib.h>
13#endif
b3695c67 14#ifdef HAVE_STRING_H
25697a35
GS
15#include <string.h>
16#endif
b3695c67 17#ifdef HAVE_STRINGS_H
25697a35
GS
18#include <strings.h>
19#endif
b3695c67 20#ifdef HAVE_SYS_TIME_H
25697a35
GS
21#include <sys/time.h>
22#endif
b3695c67 23#ifdef HAVE_TIME_H
25697a35
GS
24#include <time.h>
25#endif
b3695c67 26#ifdef HAVE_SYS_RESOURCE_H
25697a35
GS
27#include <sys/resource.h>
28#endif
b3695c67 29#ifdef HAVE_UNISTD_H
25697a35
GS
30#include <unistd.h>
31#endif
b3695c67 32#if defined(HAVE_SYS_DIRENT_H) && !defined(HAVE_DIRENT_H)
25697a35
GS
33#include <sys/dirent.h>
34#endif
b3695c67 35#ifdef HAVE_DIRENT_H
25697a35
GS
36#include <dirent.h>
37#endif
b3695c67 38#ifdef HAVE_SYS_SOCKET_H
25697a35
GS
39#include <sys/socket.h>
40#endif
b3695c67 41#ifdef HAVE_NETDB_H
25697a35
GS
42#include <netdb.h>
43#endif
b3695c67 44#ifdef HAVE_TYPES_H
25697a35
GS
45#include <types.h>
46#endif
b3695c67 47#ifdef HAVE_NETINET_IN_H
25697a35
GS
48#include <netinet/in.h>
49#endif
b3695c67 50#ifdef HAVE_ARPA_INET_H
25697a35
GS
51#include <arpa/inet.h>
52#endif
b3695c67 53#ifdef HAVE_SYS_STAT_H
25697a35
GS
54#include <sys/stat.h>
55#endif
b3695c67 56#ifdef HAVE_CTYPE_H
25697a35
GS
57#include <ctype.h>
58#endif
b3695c67 59#ifdef HAVE_ERRNO_H
25697a35
GS
60#include <errno.h>
61#endif
b3695c67 62#ifdef HAVE_SYS_WAIT_H
d96e3ba6
FM
63#include <sys/wait.h>
64#endif
b3695c67 65#ifdef HAVE_GD_H
2824ec9b 66#define HAVE_GD 1
25697a35 67#include <gd.h>
25697a35
GS
68gdImagePtr im;
69gdPoint points[4];
70#endif
b3695c67 71#ifdef HAVE_GDFONTL_H
25697a35
GS
72#include <gdfontl.h>
73#endif
b3695c67 74#ifdef HAVE_GDFONTT_H
25697a35
GS
75#include <gdfontt.h>
76#endif
b3695c67 77#ifdef HAVE_GDFONTS_H
25697a35
GS
78#include <gdfonts.h>
79#endif
b3695c67 80#ifdef HAVE_GDFONTMB_H
25697a35
GS
81#include <gdfontmb.h>
82#endif
b3695c67 83#ifdef HAVE_GDFONTG_H
25697a35
GS
84#include <gdfontg.h>
85#endif
b3695c67 86#ifdef HAVE_STDARG_H
d2fe0c32
FM
87#include <stdarg.h>
88#endif
b3695c67 89#ifdef HAVE_INTTYPES_H
2357ef77
FM
90#include <inttypes.h>
91#endif
b3695c67 92#ifdef HAVE_LIMITS_H
4af2f8ff
FM
93#include <limits.h>
94#endif
b3695c67
FM
95#ifdef HAVE_WINSOCK_H
96#include <winsock.h>
97#endif
e3af0ae9
PO
98#ifdef HAVE_MATH_H
99#include <math.h>
100#endif
a1de61fe
FM
101#ifdef HAVE_LOCALE_H
102#include <locale.h>
103#endif
e6414a9d
FM
104#ifdef HAVE_EXECINFO_H
105#include <execinfo.h>
106#endif
d5d021c5
FM
107#ifdef HAVE_LIBGEN_H
108#include <libgen.h>
109#endif
06b39c87
FM
110#ifdef HAVE_STDBOOL_H
111#include <stdbool.h>
112#else
113typedef int bool;
114#define true 1
115#define false 0
116#endif
25697a35 117
b3695c67 118#if defined(HAVE_FOPEN64)
25697a35 119#define _FILE_OFFSET_BITS 64
936c9905 120#define MY_FOPEN fopen64
25697a35
GS
121#else
122#define MY_FOPEN fopen
123#endif
124
b3695c67
FM
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)
130int mkstemps(char *template, int suffixlen);
131#define mkstemp(template) mkstemps(template,0)
132#endif
133
eca2cec9 134#if defined(ENABLE_NLS) && defined(HAVE_LIBINTL_H)
c0ec9cc7
FM
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)
06b39c87 145#define ngettext(String,Strings,num) (Strings)
c0ec9cc7
FM
146#define textdomain(String)
147#define bindtextdomain(Domain,Directory)
eca2cec9 148#endif //NLS
c0ec9cc7 149
b3695c67
FM
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__*/
25697a35 162
f0126186
FM
163#ifndef __GNUC__
164# define __attribute__(x)
165#endif
166
25697a35 167#define MAXLEN 20000
ac422f9b 168#define MAX_URL_LEN 40000
e5b2c6f0 169#define MAX_TRUNCATED_URL 512
f2ec8c75
FM
170#define MAX_USER_LEN 256
171#define MAX_USER_FNAME_LEN 128
2240dcea
FM
172#define MAX_IP_LEN 64
173#define MAX_DATETIME_LEN 32
0a4e18e1 174#define MAXLOGS 255
25697a35 175
085c1e1f
FM
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
0349fa24
FM
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
f2ec8c75
FM
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
f84a35a3
FM
233#define DATAFILEURL_IP 0x0001UL
234#define DATAFILEURL_NAME 0x0002UL
235
25697a35 236char outdir[MAXLEN];
d5d021c5 237char outdirname[MAXLEN];
d6e703cc 238char period[MAXLEN];
d6e703cc
FM
239char code[MAXLEN];
240char code2[MAXLEN];
25697a35 241char tmp[MAXLEN];
25697a35
GS
242char parse_out[MAXLEN];
243char arqtt[MAXLEN];
244char html[MAXLEN];
25697a35 245char ConfigFile[MAXLEN];
25697a35 246char df[20];
25697a35
GS
247char cdfrom[30];
248char cduntil[30];
0511cf2d 249int LastLog;
06b39c87 250bool RemoveTempFiles;
25697a35 251char ReplaceIndex[256];
0349fa24 252unsigned long int Index;
06b39c87 253bool OverwriteReport;
f2ec8c75 254unsigned long int RecordsWithoutUser;
06b39c87 255bool UseComma;
4af2f8ff 256char MailUtility[PATH_MAX];
c0ec9cc7 257int TopSitesNum;
fb7c5f27 258int TopUsersNum;
25697a35
GS
259char ExcludeCodes[256];
260char TopsitesSortField[15];
491b862f 261char TopsitesSortType[20];
085c1e1f 262unsigned long int ReportType;
25697a35
GS
263char UserTabFile[255];
264char warea[MAXLEN];
265char name[MAXLEN];
06b39c87
FM
266bool LongUrl;
267bool Ip2Name;
0a4e18e1
FM
268int NAccessLog;
269char AccessLog[MAXLOGS][MAXLEN];
270int AccessLogFromCmdLine;
25697a35
GS
271char Title[MAXLEN];
272char BgColor[MAXLEN];
273char BgImage[MAXLEN];
274char TxColor[MAXLEN];
275char TxBgColor[MAXLEN];
276char TiColor[MAXLEN];
277char LogoImage[MAXLEN];
278char LogoText[MAXLEN];
279char LogoTextColor[MAXLEN];
280char Width[MAXLEN];
281char Height[MAXLEN];
282char FontFace[MAXLEN];
283char HeaderColor[MAXLEN];
284char HeaderBgColor[MAXLEN];
285char FontSize[MAXLEN];
286char PasswdFile[MAXLEN];
287char TempDir[MAXLEN];
288char OutputDir[MAXLEN];
289char OutputEmail[MAXLEN];
290char TopuserSortField[30];
291char UserSortField[30];
292char TopuserSortOrder[10];
293char UserSortOrder[10];
294char UserAgentLog[255];
295char module[255];
296char ExcludeHosts[255];
297char ExcludeUsers[255];
298char DateFormat[2];
299char PerUserLimitFile[255];
e6414a9d 300int PerUserLimit;
06b39c87 301bool UserIp;
25697a35
GS
302char MaxElapsed[255];
303char datetimeby[10];
25697a35
GS
304char CharSet[255];
305char UserInvalidChar[255];
06b39c87 306bool Graphs;
25697a35 307char GraphDaysBytesBarColor[255];
06b39c87 308bool Privacy;
25697a35
GS
309char PrivacyString[255];
310char PrivacyStringColor[30];
311char IncludeUsers[MAXLEN];
312char ExcludeString[MAXLEN];
06b39c87 313bool SuccessfulMsg;
085c1e1f
FM
314unsigned long int TopUserFields;
315unsigned long int UserReportFields;
25697a35
GS
316char DataFile[MAXLEN];
317char DataFileDelimiter[3];
085c1e1f 318unsigned long int DataFileFields;
f84a35a3 319unsigned long int DataFileUrl;
06b39c87 320bool ShowReadStatistics;
25697a35
GS
321char IndexSortOrder[5];
322char DansGuardianConf[MAXLEN];
06b39c87 323bool DansguardianIgnoreDate;
25697a35
GS
324char SquidGuardConf[MAXLEN];
325char SquidGuarddbHome[255];
326char SquidGuardLogFormat[MAXLEN];
491b862f 327char SquidGuardLogAlternate[MAXLEN];
06b39c87
FM
328bool SquidguardIgnoreDate;
329bool ShowSargInfo;
330bool BytesInSitesUsersReport;
331bool ShowSargLogo;
25697a35 332char ParsedOutputLog[MAXLEN];
ff8d5836 333char ParsedOutputLogCompress[512];
25697a35 334char DisplayedValues[20];
933aca19 335char HeaderFontSize[5];
491b862f 336char TitleFontSize[5];
25697a35
GS
337char wwwDocumentRoot[MAXLEN];
338char ExternalCSSFile[MAXLEN];
339char BlockIt[255];
f2ec8c75 340unsigned long int NtlmUserFormat;
0349fa24 341unsigned long int IndexTree;
06b39c87 342bool UserAuthentication;
d5d021c5 343char AuthUserTemplateFile[1024];
25697a35
GS
344char val1[MAXLEN];
345char val2[MAXLEN];
346char val3[MAXLEN];
347char val4[MAXLEN];
348char val5[MAXLEN];
349char val6[MAXLEN];
350char val7[MAXLEN];
351char val8[MAXLEN];
352char val9[MAXLEN];
353char val10[MAXLEN];
354char val11[MAXLEN];
355char wwork1[MAXLEN];
356char wwork2[MAXLEN];
357char wwork3[MAXLEN];
25697a35 358char mask[MAXLEN];
25697a35
GS
359char site[MAXLEN];
360char us[50];
361char email[MAXLEN];
362char test[1];
25697a35
GS
363char user2[MAXLEN];
364char wentp[512];
365char addr[MAXLEN];
491b862f
GS
366char Ulimit[6];
367char RealtimeTypes[1024];
25697a35 368char cmd[255];
491b862f 369char ImageFile[255];
491b862f 370char RealtimeUnauthRec[15];
e3af0ae9
PO
371char LDAPHost[255];
372char LDAPBindDN[512];
373char LDAPBindPW[255];
965c4a6f
FM
374int LDAPPort;
375int LDAPProtocolVersion;
e3af0ae9
PO
376char LDAPBaseSearch[255];
377char LDAPFilterSearch[512];
378char LDAPTargetAttr[64];
3becf85c 379char GraphFont[MAXLEN];
491b862f 380
25697a35
GS
381int idate;
382int smartfilter;
383int denied_count;
384int download_count;
385int authfail_count;
386int dansguardian_count;
387int squidguard_count;
c0ec9cc7 388int useragent_count;
25697a35
GS
389int limit_flag;
390int color1;
391int color2;
392int color3;
393int z1, z2, z3;
394int ttopen;
25697a35
GS
395int sarglog;
396int isalog;
2357ef77 397int dfrom;
25697a35
GS
398int duntil;
399int dataonly;
400int indexonly;
2824ec9b
FM
401bool iprel;
402bool userip;
25697a35
GS
403int langcode;
404int debug;
405int debugz;
406int debugm;
407int AuthfailReportLimit;
408int DeniedReportLimit;
94ff9470 409int DownloadReportLimit;
25697a35
GS
410int SiteUsersReportLimit;
411int DansGuardianReportLimit;
412int SquidGuardReportLimit;
413int UserReportLimit;
491b862f
GS
414int realtime_refresh;
415int realtime_access_log_lines;
491b862f 416int rc;
d6e703cc
FM
417int ntopsites;
418int nsitesusers;
419int nrepday;
420int ndownload;
421int ntopuser;
2824ec9b 422bool squid24;
25697a35 423
491b862f
GS
424long long int nocost;
425float cost;
25697a35
GS
426
427typedef struct
428{ int list[ 24 ];
429 int len;
430} numlist;
431
432DIR *dirp;
433struct dirent *direntp;