Browse Source

simplified protocal

wangyu 8 years ago
parent
commit
cf47d0a7a8
3 changed files with 397 additions and 363 deletions
  1. 4 0
      common.h
  2. 390 363
      main.cpp
  3. 3 0
      network.cpp

+ 4 - 0
common.h

@@ -66,6 +66,10 @@ const int conn_clear_ratio=10;
 const int conv_clear_min=5;
 const int conn_clear_min=1;
 
+const uint32_t conv_clear_interval=1000;
+const uint32_t conn_clear_interval=1000;
+
+
 const int max_fail_time=100000;
 
 

File diff suppressed because it is too large
+ 390 - 363
main.cpp


+ 3 - 0
network.cpp

@@ -133,6 +133,7 @@ packet_info_t::packet_info_t()
 		protocol = IPPROTO_TCP;
 		ack_seq = get_true_random_number();
 		seq = get_true_random_number();
+		has_ts=0;
 	}
 	else if (raw_mode == mode_udp)
 	{
@@ -141,6 +142,7 @@ packet_info_t::packet_info_t()
 	else if (raw_mode == mode_icmp)
 	{
 		protocol = IPPROTO_ICMP;
+		icmp_seq=0;
 	}
 
 }
@@ -837,6 +839,7 @@ int recv_raw_icmp(raw_info_t &raw_info, char *&payload, int &payloadlen)
 
 	if(ntohs(icmph->id)!=send_info.src_port)
 	{
+		mylog(log_debug,"icmp id mis-match,ignored\n");
 		return -1;
 	}
 

Some files were not shown because too many files changed in this diff