diff --git a/main.cpp b/main.cpp index 0bf908c..b2c86cb 100755 --- a/main.cpp +++ b/main.cpp @@ -22,7 +22,7 @@ int use_tcp_for_detection=1; extern pcap_t *pcap_handle; -int cap_len; +extern int pcap_captured_full_len; int client_on_timer(conn_info_t &conn_info) //for client. called when a timer is ready in epoll { @@ -671,7 +671,7 @@ void async_cb(struct ev_loop *loop, struct ev_async *watcher, int revents) log_bare(log_info,"link level header captured:\n"); unsigned char *tmp=(unsigned char*)pcap_header_buf; - cap_len=len; + pcap_captured_full_len=len; for(int i=0;i",(u32_t)tmp[i]); @@ -1038,13 +1038,9 @@ void sigint_cb(struct ev_loop *l, ev_signal *w, int revents) int main(int argc, char *argv[]) { -int xxxx; int aaaa; -#define xxxx xxxx + 1; -#define aaaa bbbb -#define bbbb aaaa -xxxx ; aaaa ; assert(sizeof(unsigned short)==2); assert(sizeof(unsigned int)==4); + assert(sizeof(unsigned long long)==8); init_ws(); diff --git a/network.cpp b/network.cpp index a8a7000..df55e89 100644 --- a/network.cpp +++ b/network.cpp @@ -50,6 +50,7 @@ int send_with_pcap=1; int pcap_header_captured=0; int pcap_header_buf[buf_len]; +int pcap_captured_full_len=-1; pcap_t *pcap_handle; int pcap_link_header_len=-1; @@ -221,14 +222,14 @@ void my_packet_handler( printf("<%x>",int( p[i] )); } printf("\n");*/ - mylog(log_debug,"received a packet!\n"); + //mylog(log_debug,"received a packet!\n"); assert(packet_header->caplen <= packet_header->len); assert(packet_header->caplen <= max_data_len); //if(packet_header->caplen > max_data_len) return ; if(packet_header->caplenlen) return; if((int)packet_header->caplen",int(p[i])); @@ -910,7 +911,7 @@ int send_raw_ip(raw_info_t &raw_info,const char * payload,int payloadlen) printf("<%02x>",int(p[i])); printf("\n"); - printf("pcap send!\n"); + printf("pcap send!\n");*/ } diff --git a/network.h b/network.h index af25750..61c2813 100644 --- a/network.h +++ b/network.h @@ -58,11 +58,11 @@ struct icmphdr struct my_iphdr { #ifdef UDP2RAW_LITTLE_ENDIAN - unsigned int ihl:4; - unsigned int version:4; + unsigned char ihl:4; + unsigned char version:4; #else - unsigned int version:4; - unsigned int ihl:4; + unsigned char version:4; + unsigned char ihl:4; #endif u_int8_t tos; u_int16_t tot_len;