summaryrefslogtreecommitdiff
path: root/src/mctrl.h
diff options
context:
space:
mode:
authorjixinyi <[email protected]>2019-01-17 17:22:08 +0800
committerjixinyi <[email protected]>2019-01-17 17:22:08 +0800
commit1aafdc717b84f842af8716efe2c023a90e326013 (patch)
tree1b52e3a63e8c4a0c90ae83b76ec654c5b179699e /src/mctrl.h
改用maat新接口
Diffstat (limited to 'src/mctrl.h')
-rw-r--r--src/mctrl.h88
1 files changed, 88 insertions, 0 deletions
diff --git a/src/mctrl.h b/src/mctrl.h
new file mode 100644
index 0000000..ca11c06
--- /dev/null
+++ b/src/mctrl.h
@@ -0,0 +1,88 @@
+#ifndef MCTRL_H
+#define 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 40
+#define HTABLE_DATA_LEN 512
+
+#define MCTRL_CONF_FILE "./conf/mctrl.conf"
+
+//table name
+#define NOMINEE_TABLE_NAME "IR_NOMINEE_IP"
+#define INTERCEPT_TABLE_NAME "IR_INTERCEPT_IP"
+#define STATIC_NOMINEE_TABLE_NAME "IR_STATIC_NOMINEE_IP"
+#define DYNAMIC_NOMINEE_TABLE_NAME "IR_DYNAMIC_NOMINEE_IP"
+#define CANDIDATE_TABLE_NAME "IR_CANDIDATE_IP"
+#define DNAT_POLICY_TABLE_NAME "IR_DNAT_POLICY"
+
+#define SLEEP_TIME 43200
+#define TIME_OUT 5
+#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
+
+//table_id
+#define STATIC_NOMINEE_ID 0
+#define DYNAMIC_NOMINEE_ID 1
+#define DNAT_POLICY_ID 2
+#define NOMINEE_ID 3
+#define INTERCEPT_ID 4
+#define CANDIDATE_ID 5
+
+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;
+};
+
+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 mctrl_htable_handle;
+};
+
+
+#endif
+
+