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
86
87
88
89
90
91
92
|
#ifndef _FLOWOOD_FUN_H_
#define _FLOWOOD_FUN_H_ 1
#include <stdint.h>
#include <sys/types.h>
#include "flowood.h"
#include "flwd_net.h"
int flwd_gateway_init(void);
int flwd_packet_io_init(flwd_topology_t first_top_mode, flwd_topology_t second_top_mode);
int flwd_access_maat_init(void);
void flwd_packet_io_run(void);
int flwd_access_ip_layer_input(flwd_device_handle_t *device_handle, int tid, flwd_raw_pkt_t *raw_pkt);
int flwd_rubbish_pkt_identify(flwd_device_handle_t *device_handle, flwd_raw_pkt_t *raw_pkt, int check_dip);
void *flwd_stat_thread(void *arg);
int flwd_sendpacket_build_ipv4(u_int16_t carry_layer_len, u_int8_t tos, u_int16_t id, u_int16_t frag,
u_int8_t ttl, u_int8_t prot, u_int32_t src_net_order, u_int32_t dst_net_order, const char *payload,
int payload_s, char *buf);
int flwd_sendpacket_build_ethernet(u_int16_t eth_type_host_order, const unsigned char *src_mac, const unsigned char *dst_mac, char *buf);
int flwd_sendpacket_build_icmpv4_echo(u_int8_t type, u_int8_t code, u_int16_t sum,
u_int16_t id, u_int16_t seq, char *payload, u_int32_t payload_s, char *buf);
int flwd_sendpacket_build_udp(u_int16_t carry_layer_len,
u_int16_t sport_net_order, u_int16_t dport_net_order,
const char *payload, int payload_s, char *buf);
int flwd_sendpacket_do_checksum(char *ip_buf, int protocol, int len);
int flwd_sendpacket_build_arp(u_short hrd_net, u_short pro_net, u_char hln, u_char pln, u_short op_net,
u_char *sha, u_char *spa, u_char *tha, u_char *tpa, char *buf);
int flwd_packet_io_low_level_init(flwd_device_handle_t *g_io_handle);
void *flwd_packet_io_work_thread(void *arg);
int flwd_access_kernal_pkt_input(flwd_device_handle_t *device_handle, int tid, flwd_raw_pkt_t *raw_pkt);
int flwd_protocol_stack_process(flwd_device_handle_t *io_handle, int tid, flwd_raw_pkt_t *raw_pkt);
int flwd_access_l2tp_layer_input(flwd_device_handle_t *device_handle, int tid, flwd_raw_pkt_t *raw_pkt);
const char *flwd_tuple5_ntop(int tid, const flwd_tuple5_t *tuple5);
const char *flwd_tuple5_ntop_r(const flwd_tuple5_t *tuple5, char *str_mbuf, int mbuf_len);
const char *flwd_ipt_ntop_r(const flwd_ip_t *ipbin, char *str_mbuf, int mbuf_len);
int flwd_idle_call(int tid);
int flwd_access_active_ip_init(void);
flwd_ip_region_type_t flwd_dstip_location(const flwd_tuple5_t *tuple5);
int flwd_pkt_input(flwd_device_handle_t *device_handle, int tid, flwd_raw_pkt_t *raw_pkt);
void *flwd_malloc(int tid, size_t size);
void flwd_free(int tid, void *ptr);
void *flwd_calloc(int tid, size_t nmemb, size_t size);
unsigned int flwd_tuple5_hash(const flwd_tuple5_t *tuple5, int);
flwd_tuple5_t *flwd_tuple5_dup_to_stack(int tid, flwd_tuple5_t *dst_tuple5, const flwd_tuple5_t *src_tuple5);
flwd_tuple5_t *flwd_tuple5_dup_to_heap(flwd_tuple5_t *dst_tuple5, const flwd_tuple5_t *src_tuple5);
void flwd_tuple5_adjust_dir(flwd_tuple5_t *tuple5);
unsigned int compat_marsio_tuple4_hash(const flwd_tuple5_t *nat_key);
int flwd_act_ip_hash_proc(int tid, flwd_active_ip_t *act_ip_stack);
int flwd_nat_htable_key_cmp(const uchar * key1, uint size1, const uchar * key2, uint size2);
uint flwd_nat_htable_key2index(const MESA_htable_handle table, const uchar * key, uint size);
uchar * flwd_nat_htable_key_dup(const uchar *key, uint key_size);
void flwd_nat_htable_key_free(uchar *key, uint key_size);
void flwd_adapt_sleep(int success_work_times_in_recent_100);
int flwd_build_tuple4_key(int tid, flwd_tuple5_t *nat_key, const flwd_raw_pkt_t *raw_pkt);
int flwd_pre_process_pkt_input(flwd_device_handle_t *rcv_device_handle, flwd_raw_pkt_t *raw_pkt);
int flwd_maat_talbe_name_init(void);
int flwd_maat_table_register(void *handle, int inner_table_index);
unsigned int flwd_access_maat_scan_rule(int tid, const flwd_tuple5_t *tuple5);
flwd_active_ip_t *flwd_ip_pool_search(unsigned char act_ip_origin, const MESA_htable_handle table, const uchar * key, uint size);
void flwd_ip_dyn_sift_pool_cb(int table_id,const char* table_line,void* u_para);
void flwd_ip_pool_del(unsigned char act_ip_origin, MESA_htable_handle table, unsigned int policy_group_id,
void (* del_cb)(void *), const flwd_active_ip_t *maat_cb_tobe_del_ip);
int flwd_maat_talbe_name_init(void);
flwd_ip_region_type_t flwd_ipv4_location(unsigned int ip4addr);
flwd_ip_region_type_t flwd_ipv6_location(const struct in6_addr *ip6addr);
void flwd_act_ip_update(const flwd_active_ip_t *stack_act_ip);
void * flwd_maat_summon(const char *cfg_file, const char *cfg_section);
int flwd_ipt_equal(const flwd_ip_t *ip1, const flwd_ip_t *ip2);
const char *flwd_ip_region_ntop(int ip_region_type);
int flwd_arp_table_init(void);
int flwd_arp_table_query(int tid, flwd_ip_t *ip_union, flwd_device_handle_t *io_handle, unsigned char result_mac[6]);
void flwd_arp_response_update(const flwd_arp_hdr_t *arp_hdr);
int flwd_tuple5_to_stream_addr(int tid, const flwd_tuple5_t *tuple5, struct ipaddr *stream_addr);
unsigned int flwd_search_fwd_ip_by_gdev_ip(unsigned int active_ip_net_order);
void flwd_del_last_rn(char *data, int max_len);
int flwd_network_conn_init(void);
unsigned char *flwd_policy_group_id_key_gen(unsigned int policy_group_id, unsigned char *out_key, int *out_key_len);
const char *flwd_debug_print_tuple4(const void *a_packet, int tid);
const char *flwd_debug_print_tuple4_r(const void *a_packet, char *buf, int buf_max_len);
const char *flwd_debug_print_tuple4_detail(const void *a_packet, int tid);
const char *flwd_debug_print_tuple4_detail_r(const void *a_packet, char *buf, int buf_max_len);
unsigned short flwd_act_ip_get_usable_tcp_sport_num(void);
unsigned short flwd_act_ip_get_usable_udp_sport_num(void);
#endif
|