]>
Commit | Line | Data |
---|---|---|
f2ec8c75 FM |
1 | /*!\file |
2 | \brief Declaration of the structures and functions. | |
3 | */ | |
9c7c6346 FM |
4 | |
5 | struct getwordstruct | |
6 | { | |
7 | const char *current; | |
8 | const char *beginning; | |
e5b2c6f0 | 9 | int modified; |
9c7c6346 FM |
10 | }; |
11 | ||
ac422f9b FM |
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 | ||
2240dcea FM |
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 | ||
f2ec8c75 FM |
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 | ||
5f3cfd1d | 64 | // auth.c |
d25d4e6a | 65 | void htaccess(const struct userinfostruct *uinfo); |
5f3cfd1d FM |
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); | |
6e792ade FM |
97 | void free_download(void); |
98 | void set_download_suffix(const char *list); | |
99 | int is_download_suffix(const char *url); | |
5f3cfd1d FM |
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 | |
43f18f45 FM |
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); | |
5f3cfd1d FM |
111 | |
112 | // getconf.c | |
113 | void getconf(void); | |
114 | ||
115 | // grepday.c | |
f2ec8c75 | 116 | void greport_day(const struct userinfostruct *user); |
c274f011 | 117 | void greport_cleanup(void); |
5f3cfd1d FM |
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 | ||
5f3cfd1d FM |
129 | // lastlog.c |
130 | void mklastlog(const char *outdir); | |
131 | ||
132 | // index.c | |
133 | void make_index(void); | |
134 | ||
135 | // realtime.c | |
136 | void realtime(void); | |
137 | ||
138 | // repday.c | |
f2ec8c75 | 139 | void report_day(const struct userinfostruct *user); |
5f3cfd1d FM |
140 | |
141 | // report.c | |
f2ec8c75 | 142 | 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); |
5f3cfd1d | 143 | void gerarel(void); |
2240dcea | 144 | int ger_read(char *buffer,struct generalitemstruct *item,const char *filename); |
5f3cfd1d FM |
145 | |
146 | // siteuser.c | |
147 | void siteuser(void); | |
148 | ||
149 | // smartfilter.c | |
150 | void smartfilter_report(void); | |
151 | ||
152 | // sort.c | |
153 | void sort_users_log(const char *tmp, int debug); | |
154 | void tmpsort(void); | |
155 | ||
156 | // splitlog.c | |
157 | void splitlog(const char *arq, char *df, int dfrom, int duntil, char *convert); | |
158 | ||
159 | // squidguard_log.c | |
160 | void squidguard_log(void); | |
161 | ||
162 | // squidguard_report.c | |
163 | void squidguard_report(void); | |
164 | ||
165 | // topsites.c | |
166 | void topsites(void); | |
167 | ||
168 | // topuser.c | |
169 | void topuser(void); | |
170 | ||
171 | // totday.c | |
f2ec8c75 | 172 | void day_totalize(const char *tmp, const struct userinfostruct *uinfo, int indexonly); |
5f3cfd1d FM |
173 | |
174 | // totger.c | |
175 | int totalger(const char *dirname, int debug, const char *outdir); | |
176 | ||
177 | // usage.c | |
178 | void usage(const char *prog); | |
179 | ||
180 | // useragent.c | |
181 | void useragent(void); | |
182 | ||
f2ec8c75 FM |
183 | // userinfo.c |
184 | struct userinfostruct *userinfo_create(const char *userid); | |
185 | void userinfo_free(void); | |
186 | struct userinfostruct *userinfo_find_from_file(const char *filename); | |
187 | struct userinfostruct *userinfo_find_from_id(const char *id); | |
188 | ||
965c4a6f FM |
189 | // usertab.c |
190 | void init_usertab(const char *UserTabFile); | |
191 | void user_find(char *mappedname, int namelen, const char *userlogin); | |
192 | void close_usertab(void); | |
193 | ||
5f3cfd1d | 194 | // util.c |
06b39c87 | 195 | void getword_start(/*@out@*/struct getwordstruct *gwarea, const char *line); |
9c7c6346 | 196 | void 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 |
203 | long long int my_atoll (const char *nptr); |
204 | int is_absolute(const char *path); | |
e3af0ae9 | 205 | int getnumlist(char *, numlist *, const int, const int); |
5f3cfd1d FM |
206 | void name_month(char *month,int month_len); |
207 | void conv_month_name(char *month); | |
208 | void buildymd(const char *dia, const char *mes, const char *ano, char *wdata); | |
209 | void date_from(char *date, char *dfrom, char *duntil); | |
5f3cfd1d FM |
210 | char *fixnum(long long int value, int n); |
211 | char *fixnum2(long long int value, int n); | |
212 | void fixnone(char *str); | |
213 | void fixper(char *tbuf, char *period, const char *duntil); | |
214 | char *fixtime(long int elap); | |
2357ef77 | 215 | void fixendofline(char *str); |
5f3cfd1d | 216 | void show_info(FILE *fp_ou); |
c0ec9cc7 | 217 | void show_sarg(FILE *fp_ou, int depth); |
dfb337be | 218 | void write_logo_image(FILE *fp_ou); |
c0ec9cc7 FM |
219 | void write_html_header(FILE *fp_ou, int depth, const char *title); |
220 | void close_html_header(FILE *fp_ou); | |
5f3cfd1d | 221 | void write_html_trailer(FILE *fp_ou); |
ac422f9b FM |
222 | void output_html_string(FILE *fp_ou,const char *str,int maxlen); |
223 | void output_html_url(FILE *fp_ou,const char *url); | |
5f3cfd1d | 224 | void conv_month(char *month); |
d2fe0c32 | 225 | void debuga(const char *msg,...); |
5f3cfd1d | 226 | void debugaz(const char *head, const char *msg); |
e5b2c6f0 | 227 | void my_lltoa(unsigned long long int n, char *s, int ssize, int len); |
5f3cfd1d | 228 | char *get_size(const char *path, const char *file); |
f84a35a3 | 229 | void url_hostname(const char *url,char *hostname,int hostsize); |
48864d28 | 230 | void url_module(const char *url, char *w2); |
e5b2c6f0 | 231 | void url_to_file(const char *url,char *file,int filesize); |
5f3cfd1d FM |
232 | void strip_latin(char *line); |
233 | char *buildtime(long long int elap); | |
234 | void obtdate(const char *dirname, const char *name, char *data); | |
a1de61fe | 235 | void formatdate(char *date,int date_size,int year,int month,int day,int hour,int minute,int second,int dst); |
9426efec | 236 | time_t computedate(const char *year,const char *month,const char *day); |
d25d4e6a FM |
237 | int obtuser(const char *dirname, const char *name); |
238 | void obttotal(const char *dirname, const char *name, char *tbytes, int nuser, char *media); | |
5f3cfd1d FM |
239 | void version(void); |
240 | int vercode(const char *code); | |
48864d28 FM |
241 | void load_excludecodes(const char *ExcludeCodes); |
242 | void free_excludecodes(void); | |
5f3cfd1d FM |
243 | void my_mkdir(const char *name); |
244 | int testvaliduserchar(const char *user); | |
245 | char *strlow(char *string); | |
246 | char *strup(char *string); | |
247 | void builddia(char *dia, const char *mes, const char *ano, const char *df, char *wdata); | |
e6414a9d | 248 | void vrfydir(const char *per1, const char *addr, const char *site, const char *us, const char *form); |
48864d28 | 249 | void gperiod(const char *dirname, const char *period); |
5f3cfd1d | 250 | void removetmp(const char *outdir); |
120d768c | 251 | void zdate(char *ftime,int ftimesize, const char *DateFormat); |
5f3cfd1d FM |
252 | void baddata(void); |
253 | char *get_param_value(const char *param,char *line); | |
48864d28 | 254 | int compar( const void *, const void * ); |
51465d08 | 255 | void unlinkdir(const char *dir,int contentonly); |
06b39c87 | 256 | int longline_prepare(/*@out@*/struct longlinestruct *line); |
ac422f9b FM |
257 | char *longline_read(FILE *fp_in,struct longlinestruct *line); |
258 | void longline_free(struct longlinestruct *line); |