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