summaryrefslogtreecommitdiff
path: root/src/ir_mctrl.h
blob: ac60fccab24b1ee97907dad07954c95bc53153ec (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
#ifndef IR_MCTRL_H
#define IR_MCTRL_H

#include "MESA_handle_logger.h"
#include "Maat_rule.h"
#include "Maat_command.h"
#include "MESA_htable.h"

#define MAX_STRING_LEN                64
#define MAX_PORT_LEN                  6
#define MAX_PATH_LEN                  64
#define MAX_TABLE_NAME_LEN            64
#define MAX_TIME_LEN				 30
#define	HTABLE_DATA_LEN				 512

#define MCTRL_CONF_FILE				"./conf/mctrl.conf"

//table name
#define STATIC_NOMINEE_TABLE_NAME 				"IR_STATIC_NOMINEE_IP"
#define DYNAMIC_NOMINEE_TABLE_NAME				"IR_DYNAMIC_NOMINEE_IP"
#define DNAT_POLICY_TABLE_NAME					"IR_DNAT_POLICY"
#define NOMINEE_TABLE_NAME						"IR_NOMINEE_IP"
#define INTERCEPT_TABLE_NAME					"IR_INTERCEPT_IP"
#define CANDIDATE_TABLE_NAME					"IR_CANDIDATE_IP"

#define	SLEEP_TIME						43200
#define TIME_OUT						30
#define MAX_THREAD_NUM             	   1

#define DNAT_NUMBER						500000000
#define SNAT_DYNAMIC_NUMBER				1000000000
//table flag
#define STATIC_NOMINEE_FLAG				1
#define	DYNAMIC_NOMINEE_FLAG			2
#define	DNAT_POLICY_FLAG				4
#define	NOMINEE_FLAG					8
#define	INTERCEPT_FLAG					16
#define	CANDIDATE_FLAG					32

struct IR_MCTRL_INFO
{
	int region_id; 
	int group_id; 
	int addr_type;	
	char src_ip[MAX_STRING_LEN];
	char mask_src_ip[MAX_STRING_LEN];
	char src_port[MAX_PORT_LEN];
	char mask_src_port[MAX_PORT_LEN];
	char dst_ip[MAX_STRING_LEN];
	char mask_dst_ip[MAX_STRING_LEN];
	char dst_port[MAX_PORT_LEN];
	char mask_dst_port[MAX_PORT_LEN];
	int procotol;
	int direction;
	int is_valid;
	int action;
	int service;
	int addr_pool_id;
	char effective_range[MAX_STRING_LEN];
	char user_region[MAX_STRING_LEN];
	char op_time[MAX_TIME_LEN]; 
	int do_log;
	int htable_flag;	
	int version;
};

struct mctrl_glocal_info
{
	void *logger_handle;
	Maat_feather_t d_feather;
	Maat_feather_t s_feather;
	Maat_feather_t n_feather;
	Maat_feather_t i_feather;
	MESA_htable_handle s_d_htable;
	int update_type_s;
	int update_type_d;
	int update_type_dp;
	int version_s;
	int version_d;
	int version_dp;
};


#endif