]> git.ipfire.org Git - thirdparty/sarg.git/blame - include/defs.h
Be sure no return codes from getword and friends are ignored (thanks to Markus Elfring)
[thirdparty/sarg.git] / include / defs.h
CommitLineData
f2ec8c75
FM
1/*!\file
2\brief Declaration of the structures and functions.
3*/
9c7c6346
FM
4
5struct getwordstruct
6{
7 const char *current;
8 const char *beginning;
e5b2c6f0 9 int modified;
9c7c6346
FM
10};
11
ac422f9b
FM
12struct longlinestruct
13{
14 //! The buffer to store the data read from the log file.
15 char *buffer;
16 //! The size of the buffer.
17 size_t size;
18 //! The number of bytes stored in the buffer.
19 size_t length;
20 //! The position of the beginning of the current string.
21 size_t start;
22 //! The position of the end of the current string.
23 size_t end;
24};
25
2240dcea
FM
26struct generalitemstruct
27{
28 //! \c True if the entry is for the total of the file or \c false if it is a single line.
29 int total;
30 //! The user to which the entry apply. The length is limited to ::MAX_USER_LEN.
31 char *user;
32 //! The number of accesses performed by the user.
33 long long nacc;
34 //! The number of bytes transfered.
35 long long nbytes;
36 //! The URL accessed by the user. The length is not limited.
37 char *url;
38 //! The source IP address of the user. The length is limited to ::MAX_IP_LEN.
39 char *ip;
40 //! The time of the access. The length is limited to ::MAX_DATETIME_LEN.
41 char *time;
42 //! The date of the access. The length is limited to ::MAX_DATETIME_LEN.
43 char *date;
44 //! The number of milliseconds spend processing the request.
45 long long nelap;
46 //! The number of bytes fetched from the cache of the proxy (cache hit).
47 long long incache;
48 //! The number of bytes fetched from the site (cache miss).
49 long long oucache;
50};
51
f2ec8c75
FM
52struct userinfostruct
53{
54 //! The ID of the user as found in the input file.
55 char id[MAX_USER_LEN];
56 //! \c True if the ID is in fact the IP address from which the user connected.
57 int id_is_ip;
58 //! The name of the user to display in the report.
59 char label[MAX_USER_LEN];
60 //! The mangled name to use in file names of that user.
61 char filename[MAX_USER_FNAME_LEN];
62};
63
5f3cfd1d 64// auth.c
d25d4e6a 65void htaccess(const struct userinfostruct *uinfo);
5f3cfd1d
FM
66
67// authfail.c
68void authfail_report(void);
69
70// charset.c
71void ccharset(char *CharSet);
72
73// convlog.c
74void convlog(const char *arq, char *df, int dfrom, int duntil);
75
76// css.c
77void css(FILE *fp_css);
78
79// dansguardian_log.c
80void dansguardian_log(void);
81
82// dansguardian_report.c
83void dansguardian_report(void);
84
85// datafile.c
86void data_file(char *tmp);
87
88// decomp.c
89void decomp(char *arq, char *zip, const char *tmp);
90void recomp(const char *arq, const char *zip) ;
91
92// denied.c
93void gen_denied_report(void);
94
95// download.c
96void download_report(void);
6e792ade
FM
97void free_download(void);
98void set_download_suffix(const char *list);
99int is_download_suffix(const char *url);
5f3cfd1d
FM
100
101// email.c
102int geramail(const char *dirname, int debug, const char *outdir, int userip, const char *email, const char *TempDir);
103
104// exclude.c
43f18f45
FM
105void gethexclude(const char *hexfile, int debug);
106void getuexclude(const char *uexfile, int debug);
107int vhexclude(const char *url);
108int vuexclude(const char *user);
109int is_indexonly(void);
110void free_exclude(void);
5f3cfd1d
FM
111
112// getconf.c
113void getconf(void);
114
115// grepday.c
f2ec8c75 116void greport_day(const struct userinfostruct *user);
c274f011 117void greport_cleanup(void);
5f3cfd1d
FM
118
119// html.c
120void htmlrel(void);
121
122// indexonly.c
123void index_only(const char *dirname,int debug);
124
125// ip2name.c
126void ip2name(char *ip,int ip_len);
127void name2ip(char *name);
128
5f3cfd1d
FM
129// lastlog.c
130void mklastlog(const char *outdir);
131
132// index.c
133void make_index(void);
134
135// realtime.c
136void realtime(void);
137
138// repday.c
f2ec8c75 139void report_day(const struct userinfostruct *user);
5f3cfd1d
FM
140
141// report.c
f2ec8c75 142void gravatmp(const struct userinfostruct *uinfo, const char *oldurl, long long int nacc, long long int nbytes, const char *oldmsg, long long int nelap, int indexonly, long long int incache, long long int oucache);
5f3cfd1d 143void gerarel(void);
2240dcea 144int ger_read(char *buffer,struct generalitemstruct *item,const char *filename);
5f3cfd1d
FM
145
146// siteuser.c
147void siteuser(void);
148
149// smartfilter.c
150void smartfilter_report(void);
151
152// sort.c
153void sort_users_log(const char *tmp, int debug);
154void tmpsort(void);
155
156// splitlog.c
157void splitlog(const char *arq, char *df, int dfrom, int duntil, char *convert);
158
159// squidguard_log.c
160void squidguard_log(void);
161
162// squidguard_report.c
163void squidguard_report(void);
164
165// topsites.c
166void topsites(void);
167
168// topuser.c
169void topuser(void);
170
171// totday.c
f2ec8c75 172void day_totalize(const char *tmp, const struct userinfostruct *uinfo, int indexonly);
5f3cfd1d
FM
173
174// totger.c
175int totalger(const char *dirname, int debug, const char *outdir);
176
177// usage.c
178void usage(const char *prog);
179
180// useragent.c
181void useragent(void);
182
f2ec8c75
FM
183// userinfo.c
184struct userinfostruct *userinfo_create(const char *userid);
185void userinfo_free(void);
186struct userinfostruct *userinfo_find_from_file(const char *filename);
187struct userinfostruct *userinfo_find_from_id(const char *id);
188
965c4a6f
FM
189// usertab.c
190void init_usertab(const char *UserTabFile);
191void user_find(char *mappedname, int namelen, const char *userlogin);
192void close_usertab(void);
193
5f3cfd1d 194// util.c
06b39c87 195void getword_start(/*@out@*/struct getwordstruct *gwarea, const char *line);
9c7c6346 196void getword_restart(struct getwordstruct *gwarea);
d5a1c7f9
FM
197__attribute__((warn_unused_result)) int getword(/*@out@*/char *word, int limit, struct getwordstruct *gwarea, char stop);
198__attribute__((warn_unused_result)) int getword_limit(/*@out@*/char *word, int limit, struct getwordstruct *gwarea, char stop);
199__attribute__((warn_unused_result)) int getword_multisep(/*@out@*/char *word, int limit, struct getwordstruct *gwarea, char stop);
200__attribute__((warn_unused_result)) int getword_skip(int limit, struct getwordstruct *gwarea, char stop);
201__attribute__((warn_unused_result)) int getword_atoll(/*@out@*/long long int *number, struct getwordstruct *gwarea, char stop);
202__attribute__((warn_unused_result)) int getword_ptr(char *orig_line,/*@out@*/char **word, struct getwordstruct *gwarea, char stop);
e6414a9d
FM
203long long int my_atoll (const char *nptr);
204int is_absolute(const char *path);
e3af0ae9 205int getnumlist(char *, numlist *, const int, const int);
5f3cfd1d
FM
206void name_month(char *month,int month_len);
207void conv_month_name(char *month);
208void buildymd(const char *dia, const char *mes, const char *ano, char *wdata);
209void date_from(char *date, char *dfrom, char *duntil);
5f3cfd1d
FM
210char *fixnum(long long int value, int n);
211char *fixnum2(long long int value, int n);
212void fixnone(char *str);
213void fixper(char *tbuf, char *period, const char *duntil);
214char *fixtime(long int elap);
2357ef77 215void fixendofline(char *str);
5f3cfd1d 216void show_info(FILE *fp_ou);
c0ec9cc7 217void show_sarg(FILE *fp_ou, int depth);
dfb337be 218void write_logo_image(FILE *fp_ou);
c0ec9cc7
FM
219void write_html_header(FILE *fp_ou, int depth, const char *title);
220void close_html_header(FILE *fp_ou);
5f3cfd1d 221void write_html_trailer(FILE *fp_ou);
ac422f9b
FM
222void output_html_string(FILE *fp_ou,const char *str,int maxlen);
223void output_html_url(FILE *fp_ou,const char *url);
5f3cfd1d 224void conv_month(char *month);
d2fe0c32 225void debuga(const char *msg,...);
5f3cfd1d 226void debugaz(const char *head, const char *msg);
e5b2c6f0 227void my_lltoa(unsigned long long int n, char *s, int ssize, int len);
5f3cfd1d 228char *get_size(const char *path, const char *file);
f84a35a3 229void url_hostname(const char *url,char *hostname,int hostsize);
48864d28 230void url_module(const char *url, char *w2);
e5b2c6f0 231void url_to_file(const char *url,char *file,int filesize);
5f3cfd1d
FM
232void strip_latin(char *line);
233char *buildtime(long long int elap);
234void obtdate(const char *dirname, const char *name, char *data);
a1de61fe 235void formatdate(char *date,int date_size,int year,int month,int day,int hour,int minute,int second,int dst);
9426efec 236time_t computedate(const char *year,const char *month,const char *day);
d25d4e6a
FM
237int obtuser(const char *dirname, const char *name);
238void obttotal(const char *dirname, const char *name, char *tbytes, int nuser, char *media);
5f3cfd1d
FM
239void version(void);
240int vercode(const char *code);
48864d28
FM
241void load_excludecodes(const char *ExcludeCodes);
242void free_excludecodes(void);
5f3cfd1d
FM
243void my_mkdir(const char *name);
244int testvaliduserchar(const char *user);
245char *strlow(char *string);
246char *strup(char *string);
247void builddia(char *dia, const char *mes, const char *ano, const char *df, char *wdata);
e6414a9d 248void vrfydir(const char *per1, const char *addr, const char *site, const char *us, const char *form);
48864d28 249void gperiod(const char *dirname, const char *period);
5f3cfd1d 250void removetmp(const char *outdir);
120d768c 251void zdate(char *ftime,int ftimesize, const char *DateFormat);
5f3cfd1d
FM
252void baddata(void);
253char *get_param_value(const char *param,char *line);
48864d28 254int compar( const void *, const void * );
51465d08 255void unlinkdir(const char *dir,int contentonly);
06b39c87 256int longline_prepare(/*@out@*/struct longlinestruct *line);
ac422f9b
FM
257char *longline_read(FILE *fp_in,struct longlinestruct *line);
258void longline_free(struct longlinestruct *line);