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