]> git.ipfire.org Git - thirdparty/sarg.git/blob - include/defs.h
Keep the user name intact in the report.
[thirdparty/sarg.git] / include / defs.h
1 /*!\file
2 \brief Declaration of the structures and functions.
3 */
4
5 struct getwordstruct
6 {
7 const char *current;
8 const char *beginning;
9 int modified;
10 };
11
12 struct 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
26 struct 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
52 struct 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
64 // auth.c
65 void htaccess(const char *name);
66
67 // authfail.c
68 void authfail_report(void);
69
70 // charset.c
71 void ccharset(char *CharSet);
72
73 // convlog.c
74 void convlog(const char *arq, char *df, int dfrom, int duntil);
75
76 // css.c
77 void css(FILE *fp_css);
78
79 // dansguardian_log.c
80 void dansguardian_log(void);
81
82 // dansguardian_report.c
83 void dansguardian_report(void);
84
85 // datafile.c
86 void data_file(char *tmp);
87
88 // decomp.c
89 void decomp(char *arq, char *zip, const char *tmp);
90 void recomp(const char *arq, const char *zip) ;
91
92 // denied.c
93 void gen_denied_report(void);
94
95 // download.c
96 void download_report(void);
97 void free_download(void);
98 void set_download_suffix(const char *list);
99 int is_download_suffix(const char *url);
100
101 // email.c
102 int geramail(const char *dirname, int debug, const char *outdir, int userip, const char *email, const char *TempDir);
103
104 // exclude.c
105 void gethexclude(const char *hexfile, int debug);
106 void getuexclude(const char *uexfile, int debug);
107 int vhexclude(const char *url);
108 int vuexclude(const char *user);
109 int is_indexonly(void);
110 void free_exclude(void);
111
112 // getconf.c
113 void getconf(void);
114
115 // grepday.c
116 void greport_day(const struct userinfostruct *user);
117 void greport_cleanup(void);
118
119 // html.c
120 void htmlrel(void);
121
122 // indexonly.c
123 void index_only(const char *dirname,int debug);
124
125 // ip2name.c
126 void ip2name(char *ip,int ip_len);
127 void name2ip(char *name);
128
129 // language.c
130 void language_load(const char *language);
131
132 // lastlog.c
133 void mklastlog(const char *outdir);
134
135 // index.c
136 void make_index(void);
137
138 // realtime.c
139 void realtime(void);
140
141 // repday.c
142 void report_day(const struct userinfostruct *user);
143
144 // report.c
145 void 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);
146 void gerarel(void);
147 int ger_read(char *buffer,struct generalitemstruct *item,const char *filename);
148
149 // siteuser.c
150 void siteuser(void);
151
152 // smartfilter.c
153 void smartfilter_report(void);
154
155 // sort.c
156 void sort_users_log(const char *tmp, int debug);
157 void tmpsort(void);
158
159 // splitlog.c
160 void splitlog(const char *arq, char *df, int dfrom, int duntil, char *convert);
161
162 // squidguard_log.c
163 void squidguard_log(void);
164
165 // squidguard_report.c
166 void squidguard_report(void);
167
168 // topsites.c
169 void topsites(void);
170
171 // topuser.c
172 void topuser(void);
173
174 // totday.c
175 void day_totalize(const char *tmp, const struct userinfostruct *uinfo, int indexonly);
176
177 // totger.c
178 int totalger(const char *dirname, int debug, const char *outdir);
179
180 // usage.c
181 void usage(const char *prog);
182
183 // useragent.c
184 void useragent(void);
185
186 // userinfo.c
187 struct userinfostruct *userinfo_create(const char *userid);
188 void userinfo_free(void);
189 struct userinfostruct *userinfo_find_from_file(const char *filename);
190 struct userinfostruct *userinfo_find_from_id(const char *id);
191
192 // usertab.c
193 void init_usertab(const char *UserTabFile);
194 void user_find(char *mappedname, int namelen, const char *userlogin);
195 void close_usertab(void);
196
197 // util.c
198 void getword_start(struct getwordstruct *gwarea, const char *line);
199 void getword_restart(struct getwordstruct *gwarea);
200 int getword(char *word, int limit, struct getwordstruct *gwarea, int stop);
201 int getword_limit(char *word, int limit, struct getwordstruct *gwarea, int stop);
202 int getword_multisep(char *word, int limit, struct getwordstruct *gwarea, int stop);
203 int getword_skip(int limit, struct getwordstruct *gwarea, int stop);
204 int getword_atoll(long long int *number, struct getwordstruct *gwarea, int stop);
205 int getword_ptr(char *orig_line,char **word, struct getwordstruct *gwarea, int stop);
206 long long int my_atoll (const char *nptr);
207 int is_absolute(const char *path);
208 int getnumlist(char *, numlist *, const int, const int);
209 void name_month(char *month,int month_len);
210 void conv_month_name(char *month);
211 void buildymd(const char *dia, const char *mes, const char *ano, char *wdata);
212 void date_from(char *date, char *dfrom, char *duntil);
213 char *fixnum(long long int value, int n);
214 char *fixnum2(long long int value, int n);
215 void fixnone(char *str);
216 void fixper(char *tbuf, char *period, const char *duntil);
217 char *fixtime(long int elap);
218 void fixendofline(char *str);
219 void show_info(FILE *fp_ou);
220 void show_sarg(FILE *fp_ou, int depth);
221 void write_logo_image(FILE *fp_ou);
222 void write_html_header(FILE *fp_ou, int depth, const char *title);
223 void close_html_header(FILE *fp_ou);
224 void write_html_trailer(FILE *fp_ou);
225 void output_html_string(FILE *fp_ou,const char *str,int maxlen);
226 void output_html_url(FILE *fp_ou,const char *url);
227 void subs(char *str, int size, char *from, char *to);
228 void conv_month(char *month);
229 void debuga(const char *msg,...);
230 void debugaz(const char *head, const char *msg);
231 void my_lltoa(unsigned long long int n, char *s, int ssize, int len);
232 char *get_size(const char *path, const char *file);
233 void url_module(const char *url, char *w2);
234 void url_to_file(const char *url,char *file,int filesize);
235 void strip_latin(char *line);
236 char *buildtime(long long int elap);
237 void obtdate(const char *dirname, const char *name, char *data);
238 void formatdate(char *date,int date_size,int year,int month,int day,int hour,int minute,int second,int dst);
239 void obtuser(const char *dirname, const char *name, char *tuser);
240 void obttotal(const char *dirname, const char *name, char *tbytes, const char *tuser, char *media);
241 void version(void);
242 int vercode(const char *code);
243 void load_excludecodes(const char *ExcludeCodes);
244 void free_excludecodes(void);
245 void my_mkdir(const char *name);
246 int testvaliduserchar(const char *user);
247 char *strlow(char *string);
248 char *strup(char *string);
249 void builddia(char *dia, const char *mes, const char *ano, const char *df, char *wdata);
250 void vrfydir(const char *per1, const char *addr, const char *site, const char *us, const char *form);
251 void gperiod(const char *dirname, const char *period);
252 void removetmp(const char *outdir);
253 void zdate(char *ftime,int ftimesize, const char *DateFormat);
254 void baddata(void);
255 char *get_param_value(const char *param,char *line);
256 int compar( const void *, const void * );
257 void unlinkdir(const char *dir,int contentonly);
258 int longline_prepare(struct longlinestruct *line);
259 char *longline_read(FILE *fp_in,struct longlinestruct *line);
260 void longline_free(struct longlinestruct *line);