forked from allinurl/goaccess
-
Notifications
You must be signed in to change notification settings - Fork 0
/
parser.h
112 lines (103 loc) · 3.32 KB
/
parser.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/**
* Copyright (C) 2009-2014 by Gerardo Orellana <[email protected]>
* GoAccess - An Ncurses apache weblog analyzer & interactive viewer
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* A copy of the GNU General Public License is attached to this
* source distribution for its full text.
*
* Visit http://goaccess.prosoftcorp.com for new releases.
*/
#ifndef PARSER_H_INCLUDED
#define PARSER_H_INCLUDED
#define UKEY_BUFFER 2048
#define LINE_BUFFER 4096
#define BW_HASHTABLES 3
#define KEY_FOUND 1
#define KEY_NOT_FOUND -1
#define REQ_PROTO_LEN 9
#define REQ_METHOD_LEN 8
#ifdef HAVE_LIBGLIB_2_0
#include <glib.h>
#endif
extern GHashTable *ht_browsers;
extern GHashTable *ht_countries;
extern GHashTable *ht_date_bw;
extern GHashTable *ht_file_bw;
extern GHashTable *ht_file_serve_usecs;
extern GHashTable *ht_host_bw;
extern GHashTable *ht_hostnames;
extern GHashTable *ht_hosts;
extern GHashTable *ht_hosts_agents;
extern GHashTable *ht_host_serve_usecs;
extern GHashTable *ht_keyphrases;
extern GHashTable *ht_monthly;
extern GHashTable *ht_not_found_requests;
extern GHashTable *ht_os;
extern GHashTable *ht_referrers;
extern GHashTable *ht_referring_sites;
extern GHashTable *ht_requests;
extern GHashTable *ht_requests_static;
extern GHashTable *ht_status_code;
extern GHashTable *ht_unique_vis;
extern GHashTable *ht_unique_visitors;
typedef struct GLogItem_
{
char *agent;
char *date;
char *host;
char *ref;
char *method;
char *protocol;
char *req;
char *status;
unsigned long long resp_size;
unsigned long long serve_time;
} GLogItem;
typedef struct GLog_
{
unsigned int invalid;
unsigned int offset;
unsigned int process;
unsigned long long resp_size;
unsigned short piping;
GLogItem *items;
} GLog;
typedef struct GRequest_
{
char method[REQ_METHOD_LEN];
char protocol[REQ_PROTO_LEN];
char *request;
int hits;
} GRequest;
GLog *init_log (void);
GLogItem *init_log_item (GLog * logger);
int cmp_data_asc (const void *a, const void *b);
int cmp_data_desc (const void *a, const void *b);
int cmp_raw_data_desc (const void *a, const void *b);
int cmp_num_desc (const void *a, const void *b);
int cmp_raw_num_desc (const void *a, const void *b);
int cmp_raw_req_num_desc (const void *a, const void *b);
int cmp_raw_geo_num_desc (const void *a, const void *b);
int cmp_num_asc (const void *a, const void *b);
int cmp_bw_desc (const void *a, const void *b);
int cmp_bw_asc (const void *a, const void *b);
int cmp_usec_desc (const void *a, const void *b);
int cmp_usec_asc (const void *a, const void *b);
int cmp_proto_asc (const void *a, const void *b);
int cmp_proto_desc (const void *a, const void *b);
int cmp_mthd_asc (const void *a, const void *b);
int cmp_mthd_desc (const void *a, const void *b);
int parse_log (GLog ** logger, char *tail, int n);
int test_format (GLog * logger);
void reset_struct (GLog * logger);
#endif