This commit is contained in:
wangyu-
2017-09-23 03:05:23 -05:00
parent 0e77b0d5ab
commit d778be2bfc
7 changed files with 377 additions and 360 deletions

View File

@@ -90,10 +90,17 @@ int init_raw_socket();
void init_filter(int port);
void remove_filter();
int init_ifindex(const char * if_name,int &index);
int find_lower_level_info(u32_t ip,u32_t &dest_ip,string &if_name,string &hw);
int get_src_adress(u32_t &ip,u32_t remote_ip_uint32,int remote_port); //a trick to get src adress for a dest adress,so that we can use the src address in raw socket as source ip
int try_to_list_and_bind(int bind_fd,u32_t local_ip_uint32,int port); //try to bind to a port,may fail.
int client_bind_to_a_new_port(int bind_fd,u32_t local_ip_uint32);//find a free port and bind to it.
int send_raw_ip(raw_info_t &raw_info,const char * payload,int payloadlen);
int peek_raw(packet_info_t &peek_info);