]> git.ipfire.org Git - thirdparty/sarg.git/blame - include/defs.h
The date range passed as argument is not restricted to the actual range covered by...
[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
f2ec8c75
FM
40struct userinfostruct
41{
42 //! The ID of the user as found in the input file.
43 char id[MAX_USER_LEN];
44 //! \c True if the ID is in fact the IP address from which the user connected.
987e8375 45 bool id_is_ip;
f2ec8c75
FM
46 //! The name of the user to display in the report.
47 char label[MAX_USER_LEN];
48 //! The mangled name to use in file names of that user.
49 char filename[MAX_USER_FNAME_LEN];
50};
51
5f3cfd1d 52// auth.c
d25d4e6a 53void htaccess(const struct userinfostruct *uinfo);
5f3cfd1d
FM
54
55// authfail.c
56void authfail_report(void);
57
58// charset.c
59void ccharset(char *CharSet);
60
61// convlog.c
62void convlog(const char *arq, char *df, int dfrom, int duntil);
63
64// css.c
65void css(FILE *fp_css);
66
67// dansguardian_log.c
68void dansguardian_log(void);
69
70// dansguardian_report.c
71void dansguardian_report(void);
72
73// datafile.c
74void data_file(char *tmp);
75
76// decomp.c
77void decomp(char *arq, char *zip, const char *tmp);
78void recomp(const char *arq, const char *zip) ;
79
80// denied.c
81void gen_denied_report(void);
82
83// download.c
84void download_report(void);
6e792ade
FM
85void free_download(void);
86void set_download_suffix(const char *list);
2824ec9b 87bool is_download_suffix(const char *url);
5f3cfd1d
FM
88
89// email.c
2824ec9b 90int geramail(const char *dirname, int debug, const char *outdir, const char *email, const char *TempDir);
5f3cfd1d
FM
91
92// exclude.c
43f18f45
FM
93void gethexclude(const char *hexfile, int debug);
94void getuexclude(const char *uexfile, int debug);
95int vhexclude(const char *url);
96int vuexclude(const char *user);
2824ec9b 97bool is_indexonly(void);
43f18f45 98void free_exclude(void);
5f3cfd1d
FM
99
100// getconf.c
101void getconf(void);
102
103// grepday.c
f2ec8c75 104void greport_day(const struct userinfostruct *user);
c274f011 105void greport_cleanup(void);
5f3cfd1d
FM
106
107// html.c
108void htmlrel(void);
109
110// indexonly.c
111void index_only(const char *dirname,int debug);
112
113// ip2name.c
114void ip2name(char *ip,int ip_len);
115void name2ip(char *name);
116
5f3cfd1d
FM
117// lastlog.c
118void mklastlog(const char *outdir);
119
afaa3b67 120// longline.c
fa6552b0 121__attribute__((warn_unused_result)) /*@null@*//*@only@*/longline longline_create(void);
afaa3b67
FM
122void longline_reset(longline line);
123/*@null@*/char *longline_read(FILE *fp_in,/*@null@*/longline line);
124void longline_destroy(/*@out@*//*@only@*//*@null@*/longline *line_ptr);
125
5f3cfd1d
FM
126// index.c
127void make_index(void);
128
129// realtime.c
130void realtime(void);
131
132// repday.c
f2ec8c75 133void report_day(const struct userinfostruct *user);
5f3cfd1d
FM
134
135// report.c
f2ec8c75 136void 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 137void gerarel(void);
2240dcea 138int ger_read(char *buffer,struct generalitemstruct *item,const char *filename);
5f3cfd1d
FM
139
140// siteuser.c
141void siteuser(void);
142
143// smartfilter.c
144void smartfilter_report(void);
145
146// sort.c
147void sort_users_log(const char *tmp, int debug);
148void tmpsort(void);
149
150// splitlog.c
151void splitlog(const char *arq, char *df, int dfrom, int duntil, char *convert);
152
153// squidguard_log.c
154void squidguard_log(void);
155
156// squidguard_report.c
157void squidguard_report(void);
158
159// topsites.c
160void topsites(void);
161
162// topuser.c
163void topuser(void);
164
165// totday.c
f2ec8c75 166void day_totalize(const char *tmp, const struct userinfostruct *uinfo, int indexonly);
5f3cfd1d
FM
167
168// totger.c
169int totalger(const char *dirname, int debug, const char *outdir);
170
171// usage.c
172void usage(const char *prog);
173
174// useragent.c
175void useragent(void);
176
f2ec8c75 177// userinfo.c
4ca814cc 178/*@shared@*/struct userinfostruct *userinfo_create(const char *userid);
f2ec8c75 179void userinfo_free(void);
4ca814cc
FM
180/*@shared@*/struct userinfostruct *userinfo_find_from_file(const char *filename);
181/*@shared@*/struct userinfostruct *userinfo_find_from_id(const char *id);
f2ec8c75 182
965c4a6f
FM
183// usertab.c
184void init_usertab(const char *UserTabFile);
185void user_find(char *mappedname, int namelen, const char *userlogin);
186void close_usertab(void);
187
5f3cfd1d 188// util.c
06b39c87 189void getword_start(/*@out@*/struct getwordstruct *gwarea, const char *line);
9c7c6346 190void getword_restart(struct getwordstruct *gwarea);
d5a1c7f9
FM
191__attribute__((warn_unused_result)) int getword(/*@out@*/char *word, int limit, struct getwordstruct *gwarea, char stop);
192__attribute__((warn_unused_result)) int getword_limit(/*@out@*/char *word, int limit, struct getwordstruct *gwarea, char stop);
193__attribute__((warn_unused_result)) int getword_multisep(/*@out@*/char *word, int limit, struct getwordstruct *gwarea, char stop);
194__attribute__((warn_unused_result)) int getword_skip(int limit, struct getwordstruct *gwarea, char stop);
195__attribute__((warn_unused_result)) int getword_atoll(/*@out@*/long long int *number, struct getwordstruct *gwarea, char stop);
196__attribute__((warn_unused_result)) int getword_ptr(char *orig_line,/*@out@*/char **word, struct getwordstruct *gwarea, char stop);
e6414a9d
FM
197long long int my_atoll (const char *nptr);
198int is_absolute(const char *path);
e3af0ae9 199int getnumlist(char *, numlist *, const int, const int);
5f3cfd1d 200void name_month(char *month,int month_len);
fa6552b0
FM
201int conv_month(const char *month);
202const char *conv_month_name(int month);
5f3cfd1d 203void buildymd(const char *dia, const char *mes, const char *ano, char *wdata);
42b117e3 204void date_from(char *date, int *dfrom, int *duntil);
5f3cfd1d
FM
205char *fixnum(long long int value, int n);
206char *fixnum2(long long int value, int n);
207void fixnone(char *str);
5f3cfd1d 208char *fixtime(long int elap);
2357ef77 209void fixendofline(char *str);
5f3cfd1d 210void show_info(FILE *fp_ou);
c0ec9cc7 211void show_sarg(FILE *fp_ou, int depth);
dfb337be 212void write_logo_image(FILE *fp_ou);
c0ec9cc7
FM
213void write_html_header(FILE *fp_ou, int depth, const char *title);
214void close_html_header(FILE *fp_ou);
fa6552b0 215__attribute__((warn_unused_result)) int write_html_trailer(FILE *fp_ou);
ac422f9b
FM
216void output_html_string(FILE *fp_ou,const char *str,int maxlen);
217void output_html_url(FILE *fp_ou,const char *url);
f0126186 218void debuga(const char *msg,...) __attribute__((format(printf,1,2)));
5f3cfd1d 219void debugaz(const char *head, const char *msg);
e5b2c6f0 220void my_lltoa(unsigned long long int n, char *s, int ssize, int len);
5f3cfd1d 221char *get_size(const char *path, const char *file);
f84a35a3 222void url_hostname(const char *url,char *hostname,int hostsize);
48864d28 223void url_module(const char *url, char *w2);
e5b2c6f0 224void url_to_file(const char *url,char *file,int filesize);
5f3cfd1d
FM
225void strip_latin(char *line);
226char *buildtime(long long int elap);
227void obtdate(const char *dirname, const char *name, char *data);
a1de61fe 228void formatdate(char *date,int date_size,int year,int month,int day,int hour,int minute,int second,int dst);
fa6552b0 229void computedate(int year,int month,int day,struct tm *t);
d25d4e6a
FM
230int obtuser(const char *dirname, const char *name);
231void obttotal(const char *dirname, const char *name, char *tbytes, int nuser, char *media);
5f3cfd1d
FM
232void version(void);
233int vercode(const char *code);
48864d28
FM
234void load_excludecodes(const char *ExcludeCodes);
235void free_excludecodes(void);
5f3cfd1d
FM
236void my_mkdir(const char *name);
237int testvaliduserchar(const char *user);
238char *strlow(char *string);
239char *strup(char *string);
fa6552b0
FM
240int month2num(const char *month);
241int builddia(int day, int month, int year);
242int vrfydir(const struct periodstruct *per1, const char *addr, const char *site, const char *us, const char *form);
243int getperiod_fromsarglog(const char *arqtt,struct periodstruct *period);
42b117e3 244void getperiod_fromrange(struct periodstruct *period,int dfrom,int duntil);
fa6552b0 245int getperiod_buildtext(struct periodstruct *period);
5f3cfd1d 246void removetmp(const char *outdir);
120d768c 247void zdate(char *ftime,int ftimesize, const char *DateFormat);
5f3cfd1d
FM
248void baddata(void);
249char *get_param_value(const char *param,char *line);
48864d28 250int compar( const void *, const void * );
51465d08 251void unlinkdir(const char *dir,int contentonly);