summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorlijie <[email protected]>2018-12-07 13:52:27 +0800
committerlijie <[email protected]>2018-12-07 13:52:27 +0800
commita99c438e15ad2000d151ee0460b8f725ae7fe53b (patch)
treebb11355e96301e0c138834517bc8ad5d5beebe77 /include
parentac94ad0124de7a529854ba7e3914ac26b8255ffe (diff)
添加读取dnat_policy表功能
Diffstat (limited to 'include')
-rw-r--r--include/mrl_main.h1
-rw-r--r--include/mrl_packet.h5
-rw-r--r--include/mrl_redis.h15
-rw-r--r--include/mrl_stat.h6
4 files changed, 20 insertions, 7 deletions
diff --git a/include/mrl_main.h b/include/mrl_main.h
index 67530b1..12e1a7f 100644
--- a/include/mrl_main.h
+++ b/include/mrl_main.h
@@ -68,6 +68,7 @@ struct mrl_global_instance
struct mrl_global_cfg mrl_cfg;
Maat_feather_t mrl_feather;
MESA_htable_handle ht_nominee;
+ MESA_htable_handle ht_dnat;
MESA_lqueue_head mrl_queue;
MMDB_s mrl_mmdb;
int stop_flag;
diff --git a/include/mrl_packet.h b/include/mrl_packet.h
index aec886f..94e0171 100644
--- a/include/mrl_packet.h
+++ b/include/mrl_packet.h
@@ -7,7 +7,10 @@ void mrl_socket_init();
void mrl_socket_close();
void mrl_send_to_gdev(int thread_seq, struct mrl_vxlan_info * vxlan_info, const char *payload, size_t payload_len);
-bool mrl_pkt_signature_identify(struct streaminfo *mystream);
+
+bool mrl_snat_pkt_identify(struct streaminfo *mystream);
+bool mrl_dnat_pkt_identify(struct streaminfo *mystream)
+
void mrl_send_to_mgw(void *raw_pkt, int thread_seq);
void mrl_detect_init();
void mrl_detect_action(const char *ip_addr);
diff --git a/include/mrl_redis.h b/include/mrl_redis.h
index 1b19cd5..4acb9ec 100644
--- a/include/mrl_redis.h
+++ b/include/mrl_redis.h
@@ -7,13 +7,18 @@
#define IR_CANDIDATE_IP_TABLE_NAME "IR_CANDIDATE_IP"
#define IR_DNAT_POLICY_TABLE_NAME "IR_DNAT_POLICY"
-struct mrl_ht_nominee_key{
+struct mrl_nominee_key{
uint32_t sip;
uint32_t dip;
uint16_t sport;
uint16_t dport;
};
+struct mrl_dnat_key{
+uint32_t trans_ip;
+uint16_t trans_port;
+};
+
struct mrl_nominee_item{
int config_id;
int addr_pool_id;
@@ -50,8 +55,8 @@ struct mrl_candidate_item{
char effective_range[MRL_STR_EFFEC_RANGE_LEN];
char op_time[MRL_DATE_LEN];
};
-/*
-struct mrl_dnat_policy_item{
+
+struct mrl_dnat_item{
int config_id;
char original_dest_ip[MRL_STR_IP_LEN];
char original_dest_port[MRL_STR_PORT_LEN];
@@ -62,8 +67,10 @@ struct mrl_dnat_policy_item{
int action;
int service;
int is_valid;
+ char effective_range[MRL_STR_EFFEC_RANGE_LEN];
+ char op_time[MRL_DATE_LEN];
};
-*/
+
MESA_htable_handle mrl_htable_init(void * fn_data_free_cb);
//void ht_candidate_free_cb(void * data);
diff --git a/include/mrl_stat.h b/include/mrl_stat.h
index 1bd9b7a..cb8e667 100644
--- a/include/mrl_stat.h
+++ b/include/mrl_stat.h
@@ -15,7 +15,8 @@ enum FS_FIELD
FIELD_RECV_GDEV_TCP_PKTS,
FIELD_RECV_GDEV_UDP_PKTS,
- FIELD_RECV_IR_PKTS,
+ FIELD_RECV_SNAT_PKTS,
+ FIELD_RECV_DNAT_PKTS,
FIELD_RECV_DETECT_PKTS,
FIELD_SEND_DETECT_PKTS,
@@ -43,7 +44,8 @@ struct global_stat_t
uint64_t recv_gdev_tcp_pkts;
uint64_t recv_gdev_udp_pkts;
- uint64_t recv_ir_pkts;
+ uint64_t recv_snat_pkts;
+ uint64_t recv_dnat_pkts;
uint64_t recv_detect_pkts;
uint64_t send_detect_pkts;