summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/mrl_io.h121
-rw-r--r--include/mrl_redis.h3
-rw-r--r--include/mrl_utils.h6
3 files changed, 69 insertions, 61 deletions
diff --git a/include/mrl_io.h b/include/mrl_io.h
index 69946ee..2dc076f 100644
--- a/include/mrl_io.h
+++ b/include/mrl_io.h
@@ -1,60 +1,61 @@
-#ifndef __MRL_PACKET_H_
-#define __MRL_PACKET_H_
-
-#include "stream.h"
-#include "MESA_htable.h"
-#include "mrl_utils.h"
-
-struct mrl_nominee_key{
-char sip[MRL_STR_IP_LEN];
-char dip[MRL_STR_IP_LEN];
-uint16_t sport;//host order
-uint16_t dport;//host order
-};
-
-struct mrl_dnat_policy_key{
-char original_ip[MRL_STR_IP_LEN];
-uint16_t original_port;
-};
-
-struct user_data
-{
- char detect_ip[MRL_STR_IP_LEN];
- int nominee_type;
-};
-
-MESA_htable_handle mrl_htable_init(void * fn_data_free_cb);
-
-void ht_nominee_free_cb(void * data);
-void ht_snat_candidate_free_cb(void * data);
-
-void ht_dnat_candidate_free_cb(void * data);
-
-void ht_dnat_policy_free_cb(void * data);
-void ht_vxlan_info_free_cb(void * data);
-void ht_mrl_ip_info_free_cb(void * data);
-void ht_link_identity_free_cb(void * data);
-long ht_nominee_search_cb(void *data, const uchar *key, uint size, void *user_arg);
-
-//long ht_dnat_policy_search_cb(void *data, const uchar *key, uint size, void *user_arg);
-
-
-int mrl_htable_add(MESA_htable_handle htable,const unsigned char* key,unsigned int key_len,const void* value);
-int mrl_htable_delete(MESA_htable_handle htable,const unsigned char* key,unsigned int key_len);
-
-void mrl_socket_init();
-void mrl_socket_close();
-
-bool mrl_snat_pkt_identify(struct streaminfo *mystream, struct mrl_tuple *tuple);
-
-bool mrl_dnat_pkt_identify(struct streaminfo *mystream, struct mrl_tuple *tuple);
-
-void mrl_send_to_gdev(int thread_seq, struct mrl_vxlan_info * vxlan_info, const char *payload, size_t payload_len);
-int mrl_send_to_mgw(void *raw_pkt, int thread_seq);
-void *mrl_recv_from_mgw(void *arg);
-
-void *mrl_detect_action(void *arg);
-
-#endif
-
-
+#ifndef __MRL_PACKET_H_
+#define __MRL_PACKET_H_
+
+#include "stream.h"
+#include "MESA_htable.h"
+#include "mrl_utils.h"
+
+struct mrl_nominee_key{
+char sip[MRL_STR_IP_LEN];
+char dip[MRL_STR_IP_LEN];
+uint16_t sport;//host order
+uint16_t dport;//host order
+};
+
+struct mrl_dnat_policy_key{
+ char original_ip[MRL_STR_IP_LEN];
+ uint16_t original_port;
+ int original_protocol;
+};
+
+struct user_data
+{
+ char detect_ip[MRL_STR_IP_LEN];
+ int nominee_type;
+};
+
+MESA_htable_handle mrl_htable_init(void * fn_data_free_cb);
+
+void ht_nominee_free_cb(void * data);
+void ht_snat_candidate_free_cb(void * data);
+
+void ht_dnat_candidate_free_cb(void * data);
+
+void ht_dnat_policy_free_cb(void * data);
+void ht_vxlan_info_free_cb(void * data);
+void ht_mrl_ip_info_free_cb(void * data);
+void ht_link_identity_free_cb(void * data);
+long ht_nominee_search_cb(void *data, const uchar *key, uint size, void *user_arg);
+
+//long ht_dnat_policy_search_cb(void *data, const uchar *key, uint size, void *user_arg);
+
+
+int mrl_htable_add(MESA_htable_handle htable,const unsigned char* key,unsigned int key_len,const void* value);
+int mrl_htable_delete(MESA_htable_handle htable,const unsigned char* key,unsigned int key_len);
+
+void mrl_socket_init();
+void mrl_socket_close();
+
+bool mrl_snat_pkt_identify(struct streaminfo *mystream, struct mrl_tuple *tuple);
+
+bool mrl_dnat_pkt_identify(struct streaminfo *mystream, struct mrl_tuple *tuple);
+
+void mrl_send_to_gdev(int thread_seq, struct mrl_vxlan_info * vxlan_info, const char *payload, size_t payload_len);
+int mrl_send_to_mgw(void *raw_pkt, int thread_seq);
+void *mrl_recv_from_mgw(void *arg);
+
+void *mrl_detect_action(void *arg);
+
+#endif
+
+
diff --git a/include/mrl_redis.h b/include/mrl_redis.h
index 360eaf5..3a00432 100644
--- a/include/mrl_redis.h
+++ b/include/mrl_redis.h
@@ -13,6 +13,7 @@ struct mrl_nominee{
char effective_range[MRL_STR_EFFEC_RANGE_LEN];
char op_time[MRL_DATE_LEN];
int nominee_type;//0--snat_nominee;1--dnat_nominee
+ int nominee_count;//��ǰ��ѡIP��DNAT_POLICY���ж�Ӧ������Ŀ��ֻ�е�ֵΪ1ʱ����DNAT_POLICYִ��ɾ������ʱ�ŻὫ��ӹ�ϣ��ht_nominee��ɾ��
};
struct mrl_snat_candidate{
@@ -43,7 +44,7 @@ struct mrl_dnat_policy{
char op_time[MRL_DATE_LEN];
};
-
+/*mrl�Ƿֲ�ʽ����Ϊ�˱�֤���������dnat_candidate��ͬ������Ҫһ��dnat_candidate��*/
struct mrl_dnat_candidate{
int config_id;
char ip_addr[MRL_STR_IP_LEN];
diff --git a/include/mrl_utils.h b/include/mrl_utils.h
index affc144..c08e887 100644
--- a/include/mrl_utils.h
+++ b/include/mrl_utils.h
@@ -49,6 +49,12 @@
#define MRL_DEL_AFTER 1800
#define MRL_DEL_NOW 0
+#define MRL_INVALID 0
+#define MRL_VALID 1
+
+#define MRL_ADD_DNAT_NOMINEE 0
+#define MRL_DEL_DNAT_NOMINEE 1
+
#define RLOG_LV_DEBUG 10
#define RLOG_LV_INFO 20
#define RLOG_LV_FATAL 30