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