-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathmatchers.h
42 lines (34 loc) · 1003 Bytes
/
matchers.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
#ifndef _MATCHERS_H__
#define _MATCHERS_H__
#include <pcre.h>
#define MATCHER_MAX_LEN 2048
#define MATCHER_MAX_RESPONSE 32000 // maximum text response len
#define MATCHERS_DEFAULT_FILENAME "matchers.conf"
#ifdef HAVE_PYTHON
#include <python2.7/Python.h>
#define PYFUNCNAME "forge_response"
#define PYTHONPATH "./python" // python modules path
#endif
struct matcher_entry {
char name[64];
pcre *match;
pcre *ignore;
u_char *response;
u_int response_len;
#ifdef HAVE_PYTHON
PyObject *pyfunc;
#endif
u_int options;
#define MATCHER_OPTION_RESET 1
u_int proto;
#define MATCHER_PROTO_ANY 1
#define MATCHER_PROTO_UDP 2
#define MATCHER_PROTO_TCP 3
u_int src_port;
u_int dst_port;
struct matcher_entry *next;
};
struct matcher_entry *parse_matchers_file(char *);
struct matcher_entry *matchers_match(const char *, int, struct ctx *, u_int, u_int, u_int);
struct matcher_entry *matchers_get_response(u_char *, u_int, struct ctx *, u_int, u_int, u_int);
#endif