suricata
app-layer-htp-xff.h
Go to the documentation of this file.
1 /* Copyright (C) 2014 Open Information Security Foundation
2  *
3  * You can copy, redistribute or modify this Program under the terms of
4  * the GNU General Public License version 2 as published by the Free
5  * Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * version 2 along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15  * 02110-1301, USA.
16  */
17 
18 /**
19  * \file
20  *
21  * \author Ignacio Sanchez <sanchezmartin.ji@gmail.com>
22  * \author Duarte Silva <duarte.silva@serializing.me>
23  */
24 
25 #ifndef SURICATA_APP_LAYER_HTP_XFF_H
26 #define SURICATA_APP_LAYER_HTP_XFF_H
27 
28 /** XFF is disabled */
29 #define XFF_DISABLED 1
30 /** XFF extra data mode */
31 #define XFF_EXTRADATA 2
32 /** XFF overwrite mode */
33 #define XFF_OVERWRITE 4
34 /** XFF is to be used in a reverse proxy deployment */
35 #define XFF_REVERSE 8
36 /** XFF is to be used in a forward proxy deployment */
37 #define XFF_FORWARD 16
38 /** Single XFF IP maximum length (default value based on IPv6 address length) */
39 #define XFF_MAXLEN 46
40 
41 typedef struct HttpXFFCfg_ {
42  uint8_t flags; /**< XFF operation mode and deployment */
43  const char *header; /**< XFF header name */
45 
46 void HttpXFFGetCfg(ConfNode *conf, HttpXFFCfg *result);
47 
48 int HttpXFFGetIPFromTx(const Flow *f, uint64_t tx_id, HttpXFFCfg *xff_cfg, char *dstbuf, int dstbuflen);
49 
50 int HttpXFFGetIP(const Flow *f, HttpXFFCfg *xff_cfg, char *dstbuf, int dstbuflen);
51 
52 void HTPXFFParserRegisterTests(void);
53 
54 #endif /* SURICATA_APP_LAYER_HTP_XFF_H */
HttpXFFGetIP
int HttpXFFGetIP(const Flow *f, HttpXFFCfg *xff_cfg, char *dstbuf, int dstbuflen)
Function to return XFF IP if any. The caller needs to lock the flow.
Definition: app-layer-htp-xff.c:180
HttpXFFGetIPFromTx
int HttpXFFGetIPFromTx(const Flow *f, uint64_t tx_id, HttpXFFCfg *xff_cfg, char *dstbuf, int dstbuflen)
Function to return XFF IP if any in the selected transaction. The caller needs to lock the flow.
Definition: app-layer-htp-xff.c:116
HTPXFFParserRegisterTests
void HTPXFFParserRegisterTests(void)
Definition: app-layer-htp-xff.c:336
Flow_
Flow data structure.
Definition: flow.h:356
HttpXFFGetCfg
void HttpXFFGetCfg(ConfNode *conf, HttpXFFCfg *result)
Function to return XFF configuration from a configuration node.
Definition: app-layer-htp-xff.c:205
HttpXFFCfg_::header
const char * header
Definition: app-layer-htp-xff.h:43
HttpXFFCfg_
Definition: app-layer-htp-xff.h:41
HttpXFFCfg
struct HttpXFFCfg_ HttpXFFCfg
HttpXFFCfg_::flags
uint8_t flags
Definition: app-layer-htp-xff.h:42
ConfNode_
Definition: conf.h:32