]>
git.ipfire.org Git - thirdparty/sarg.git/blob - include/defs.h
2 \brief Declaration of the structures and functions.
12 typedef struct longlinestruct
* longline
;
14 struct generalitemstruct
16 //! \c True if the entry is for the total of the file or \c false if it is a single line.
18 //! The user to which the entry apply. The length is limited to ::MAX_USER_LEN.
20 //! The number of accesses performed by the user.
22 //! The number of bytes transfered.
24 //! The URL accessed by the user. The length is not limited.
26 //! The source IP address of the user. The length is limited to ::MAX_IP_LEN.
28 //! The time of the access. The length is limited to ::MAX_DATETIME_LEN.
30 //! The date of the access. The length is limited to ::MAX_DATETIME_LEN.
32 //! The number of milliseconds spend processing the request.
34 //! The number of bytes fetched from the cache of the proxy (cache hit).
36 //! The number of bytes fetched from the site (cache miss).
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.
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
];
53 void htaccess ( const struct userinfostruct
* uinfo
);
56 void authfail_report ( void );
59 void ccharset ( char * CharSet
);
62 void convlog ( const char * arq
, char * df
, int dfrom
, int duntil
);
65 void css_content ( FILE * fp_css
);
66 void css ( FILE * fp_css
);
69 void dansguardian_log ( void );
71 // dansguardian_report.c
72 void dansguardian_report ( void );
75 void data_file ( char * tmp
);
78 FILE * decomp ( const char * arq
, bool * pipe
);
81 void gen_denied_report ( void );
84 void download_report ( void );
85 void free_download ( void );
86 void set_download_suffix ( const char * list
);
87 bool is_download_suffix ( const char * url
);
90 int geramail ( const char * dirname
, int debug
, const char * outdir
, const char * email
, const char * TempDir
);
93 void gethexclude ( const char * hexfile
, int debug
);
94 void getuexclude ( const char * uexfile
, int debug
);
95 int vhexclude ( const char * url
);
96 int vuexclude ( const char * user
);
97 bool is_indexonly ( void );
98 void free_exclude ( void );
104 void greport_prepare ( void );
105 void greport_day ( const struct userinfostruct
* user
);
106 void greport_cleanup ( void );
112 void index_only ( const char * dirname
, int debug
);
115 void ip2name ( char * ip
, int ip_len
);
116 void name2ip ( char * name
);
119 void mklastlog ( const char * outdir
);
122 __attribute__ (( warn_unused_result
)) /*@null@*/ /*@only@*/ longline
longline_create ( void );
123 void longline_reset ( longline line
);
124 /*@null@*/ char * longline_read ( FILE * fp_in
, /*@null@*/ longline line
);
125 void longline_destroy ( /*@out@*/ /*@only@*/ /*@null@*/ longline
* line_ptr
);
128 void make_index ( void );
134 void report_day ( const struct userinfostruct
* user
);
137 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
);
139 int ger_read ( char * buffer
, struct generalitemstruct
* item
, const char * filename
);
145 void smartfilter_report ( void );
148 void sort_users_log ( const char * tmp
, int debug
);
150 void sort_labels ( const char ** label
, const char ** order
);
153 void splitlog ( const char * arq
, char * df
, int dfrom
, int duntil
, int convert
);
156 void squidguard_log ( void );
158 // squidguard_report.c
159 void squidguard_report ( void );
168 void day_totalize ( const char * tmp
, const struct userinfostruct
* uinfo
, int indexonly
);
171 int totalger ( const char * dirname
, int debug
, const char * outdir
);
174 void usage ( const char * prog
);
177 void useragent ( void );
180 /*@shared@*/ struct userinfostruct
* userinfo_create ( const char * userid
);
181 void userinfo_free ( void );
182 /*@shared@*/ struct userinfostruct
* userinfo_find_from_file ( const char * filename
);
183 /*@shared@*/ struct userinfostruct
* userinfo_find_from_id ( const char * id
);
186 void init_usertab ( const char * UserTabFile
);
187 void user_find ( char * mappedname
, int namelen
, const char * userlogin
);
188 void close_usertab ( void );
191 void getword_start ( /*@out@*/ struct getwordstruct
* gwarea
, const char * line
);
192 void getword_restart ( struct getwordstruct
* gwarea
);
193 __attribute__ (( warn_unused_result
)) int getword ( /*@out@*/ char * word
, int limit
, struct getwordstruct
* gwarea
, char stop
);
194 __attribute__ (( warn_unused_result
)) int getword_limit ( /*@out@*/ char * word
, int limit
, struct getwordstruct
* gwarea
, char stop
);
195 __attribute__ (( warn_unused_result
)) int getword_multisep ( /*@out@*/ char * word
, int limit
, struct getwordstruct
* gwarea
, char stop
);
196 __attribute__ (( warn_unused_result
)) int getword_skip ( int limit
, struct getwordstruct
* gwarea
, char stop
);
197 __attribute__ (( warn_unused_result
)) int getword_atoll ( /*@out@*/ long long int * number
, struct getwordstruct
* gwarea
, char stop
);
198 __attribute__ (( warn_unused_result
)) int getword_ptr ( char * orig_line
, /*@out@*/ char ** word
, struct getwordstruct
* gwarea
, char stop
);
199 long long int my_atoll ( const char * nptr
);
200 int is_absolute ( const char * path
);
201 int getnumlist ( char *, numlist
*, const int , const int );
202 void name_month ( char * month
, int month_len
);
203 int conv_month ( const char * month
);
204 const char * conv_month_name ( int month
);
205 void buildymd ( const char * dia
, const char * mes
, const char * ano
, char * wdata
);
206 void date_from ( char * date
, int * dfrom
, int * duntil
);
207 char * fixnum ( long long int value
, int n
);
208 char * fixnum2 ( long long int value
, int n
);
209 void fixnone ( char * str
);
210 char * fixtime ( long long int elap
);
211 void fixendofline ( char * str
);
212 void show_info ( FILE * fp_ou
);
213 void show_sarg ( FILE * fp_ou
, int depth
);
214 void write_logo_image ( FILE * fp_ou
);
215 void write_html_head ( FILE * fp_ou
, const char * page_title
);
216 void write_html_header ( FILE * fp_ou
, int depth
, const char * title
);
217 void close_html_header ( FILE * fp_ou
);
218 __attribute__ (( warn_unused_result
)) int write_html_trailer ( FILE * fp_ou
);
219 void output_html_string ( FILE * fp_ou
, const char * str
, int maxlen
);
220 void output_html_url ( FILE * fp_ou
, const char * url
);
221 void debuga ( const char * msg
,...) __attribute__ (( format ( printf
, 1 , 2 )));
222 void debugaz ( const char * head
, const char * msg
);
223 void my_lltoa ( unsigned long long int n
, char * s
, int ssize
, int len
);
224 char * get_size ( const char * path
, const char * file
);
225 void url_hostname ( const char * url
, char * hostname
, int hostsize
);
226 void url_module ( const char * url
, char * w2
);
227 void url_to_file ( const char * url
, char * file
, int filesize
);
228 void strip_latin ( char * line
);
229 char * buildtime ( long long int elap
);
230 void obtdate ( const char * dirname
, const char * name
, char * data
);
231 void formatdate ( char * date
, int date_size
, int year
, int month
, int day
, int hour
, int minute
, int second
, int dst
);
232 void computedate ( int year
, int month
, int day
, struct tm
* t
);
233 int obtuser ( const char * dirname
, const char * name
);
234 void obttotal ( const char * dirname
, const char * name
, char * tbytes
, int nuser
, char * media
);
236 int vercode ( const char * code
);
237 void load_excludecodes ( const char * ExcludeCodes
);
238 void free_excludecodes ( void );
239 void my_mkdir ( const char * name
);
240 int testvaliduserchar ( const char * user
);
241 char * strlow ( char * string
);
242 char * strup ( char * string
);
243 int month2num ( const char * month
);
244 int builddia ( int day
, int month
, int year
);
245 int vrfydir ( const struct periodstruct
* per1
, const char * addr
, const char * site
, const char * us
, const char * form
);
246 int getperiod_fromsarglog ( const char * arqtt
, struct periodstruct
* period
);
247 void getperiod_fromrange ( struct periodstruct
* period
, int dfrom
, int duntil
);
248 int getperiod_buildtext ( struct periodstruct
* period
);
249 void removetmp ( const char * outdir
);
250 void zdate ( char * ftime
, int ftimesize
, const char * DateFormat
);
251 char * get_param_value ( const char * param
, char * line
);
252 int compar ( const void *, const void * );
253 void unlinkdir ( const char * dir
, int contentonly
);