summaryrefslogtreecommitdiff
path: root/include/mrl_io.h
blob: 2dc076f01ca18c61f49550b2022aa3e203c745b4 (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
#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