root/src/log.h

Revision 5, 1.8 KB (checked in by nick, 3 years ago)
Line 
1#ifndef _LOG_H_
2#define _LOG_H_
3
4/* types */
5#define LOG_COMMON 1
6#define LOG_COMBINED 2
7#define LOG_ATOP 3
8
9/* parse*() fills in this struct */
10struct logbits {
11        int url_pos;              /* location of url in urlmap */
12        int url_hash;             /* hash of url string */
13
14        /* host and ip. Whatever we have in the log gets set here initially,
15        ** then want_foo is set to false. want_otherfoo is set to true
16        ** explicitly; then an entry is made into the relevant Queue
17        ** (want_host or want_ip). adns does the resolving, and then
18        ** whatever it finds is placed in otherfoo, and want_otherfoo is set
19        ** to false */
20        bool want_host;
21        int host_pos;             /* location of host in hostmap */
22        int host_hash;            /* hash of host string */
23
24        bool want_ip;
25        //unsigned int ipl;         /* numerical representation of IP */
26        int ip_pos;               /* location of IP in ipmap */
27        int ip_hash;              /* hash of IP string */
28
29#if HAVE_ADNS_H
30        adns_query *dns_query;
31        //Resolver dns_query;
32#endif
33
34        int ref_pos;              /* location of referrer in map */
35        int ref_hash;             /* hash of Referrer string */
36
37        int fileid;               /* which file descriptor we're from */
38        int file_pos;             /* location of file in filemap */
39
40        unsigned short retcode;   /* return code */
41        unsigned int bytes;       /* body of result page */
42        time_t time;              /* time of request, unixtime */
43};
44
45class LogParser
46{
47        public:
48        virtual int parse(char *logline, struct logbits *b) = 0;
49
50        char *processURL(char **buf);
51        int mungeURL(char **url, int *length);
52};
53
54class CommonLogParser : public LogParser
55{
56        int parse(char *logline, struct logbits *b);
57};
58class AtopLogParser : public LogParser
59{
60        int parse(char *logline, struct logbits *b);
61};
62
63void collect_dns_responses();
64
65#endif
Note: See TracBrowser for help on using the browser.