summaryrefslogtreecommitdiff
path: root/src/tsg_variable.h
blob: dd2e54eb88d4a3d04db4dcdf5a87172ab2d06b80 (plain)
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
#pragma once

#include "uthash.h"
#include "tsg_bridge.h"

#include <osfp.h>
#include <stream.h>
#include <ctemplate/template.h>

enum DEPLOY_MODE
{
	DEPLOY_MODE_MIRROR,
	DEPLOY_MODE_INLINE,
	DEPLOY_MODE_TRANSPARENT,
	DEPLOY_MODE_MAX
};

#ifndef MIN
#define MIN(a, b)  	(((a) < (b)) ? (a) : (b))
#endif

#ifndef	MAX_MATCHED_RULES_NUM
#define	MAX_MATCHED_RULES_NUM	MAX_RESULT_NUM*4
#endif

#ifndef	MAX_STRING_LEN32
#define	MAX_STRING_LEN32	32
#endif

struct reset_argv
{
	int pkt_num;
	int seed1;
	int seed2;
	int th_flags;
	int dir;
	int remedy;
};

#ifndef	MAX_STRING_LEN128
#define	MAX_STRING_LEN128	128
#endif

struct id2field
{
	int type;
	int id;
	char name[MAX_STRING_LEN32];
};

struct id2field_tlv
{
	int type;
	int id;
	int len;
	char name[MAX_STRING_LEN32];
};

struct tsg_rt_para
{
	int level;
	short mirror_switch;
	unsigned short timeout;
	int dynamic_maat_switch;
	int device_seq_in_dc;
	int datacenter_id;
	int scan_signaling_switch;
	int hash_timeout;
	int hash_slot_size;
	int hash_thread_safe;
	int feature_tamper;
	int service_chaining_sid;
	int shaping_sid;
	int intercept_sid;
	int send_resetall;
	int scan_in_pkt_state;
	int generate_ja3_fingerprint;
	int app_metric_update_interval_ms;
	enum DEPLOY_MODE deploy_mode;
	int scan_time_interval;
	int identify_app_max_pkt_num;
	int unknown_app_id;
	int proto_flag; //enum TSG_PROTOCOL
	char device_sn[MAX_STRING_LEN128];
	char log_path[MAX_STRING_LEN128];
	char device_id_command[MAX_STRING_LEN128];
	void *logger;
	struct reset_argv reset;
	struct l7_protocol *name_by_id;
	struct l7_protocol *id_by_name;
	struct traffic_mirror *mirror_handle;
	ctemplate::Template *tpl_403,*tpl_404;
	ctemplate::Template *tpl_200,*tpl_204;
	ctemplate::Template *tpl_303;
	struct osfp_db *db_osfp;
};

extern struct tsg_rt_para g_tsg_para;;
extern struct id2field_tlv g_tsg_proto_name2id[PROTO_MAX];

struct l7_protocol 
{
	int id;				/* first key */
	char name[32];		/* second key */
	UT_hash_handle hh1;	/* handle for first hash table */
	UT_hash_handle hh2;	/* handle for second hash table */
};

long long tsg_get_current_time_ms(void);