From b9af3891687db335d9ebee607b9bc862d3004d2b Mon Sep 17 00:00:00 2001 From: wangyu- Date: Fri, 15 Jun 2018 00:50:47 -0500 Subject: [PATCH] renamed id_t to avoid conflict on bsd --- common.cpp | 14 +++++++------- common.h | 6 +++--- connection.cpp | 16 ++++++++-------- connection.h | 10 +++++----- main.cpp | 12 ++++++------ misc.cpp | 2 +- misc.h | 2 +- 7 files changed, 31 insertions(+), 31 deletions(-) diff --git a/common.cpp b/common.cpp index 272d342..cdb34f4 100644 --- a/common.cpp +++ b/common.cpp @@ -183,11 +183,11 @@ int set_buf_size(int fd,int socket_buf_size,int force_socket_buf) return 0; } -int numbers_to_char(id_t id1,id_t id2,id_t id3,char * &data,int &len) +int numbers_to_char(my_id_t id1,my_id_t id2,my_id_t id3,char * &data,int &len) { static char buf[buf_len]; data=buf; - id_t tmp=htonl(id1); + my_id_t tmp=htonl(id1); memcpy(buf,&tmp,sizeof(tmp)); tmp=htonl(id2); @@ -196,21 +196,21 @@ int numbers_to_char(id_t id1,id_t id2,id_t id3,char * &data,int &len) tmp=htonl(id3); memcpy(buf+sizeof(tmp)*2,&tmp,sizeof(tmp)); - len=sizeof(id_t)*3; + len=sizeof(my_id_t)*3; return 0; } -int char_to_numbers(const char * data,int len,id_t &id1,id_t &id2,id_t &id3) +int char_to_numbers(const char * data,int len,my_id_t &id1,my_id_t &id2,my_id_t &id3) { - if(len udp_fd_mp; //a bit dirty to used pointer,but can void unordered_map search //unordered_map timer_fd_mp;//we can use pointer here since unordered_map.rehash() uses shallow copy - unordered_map const_id_mp; + unordered_map const_id_mp; unordered_map mp; //put it at end so that it de-consturcts first @@ -157,7 +157,7 @@ int send_bare(raw_info_t &raw_info,const char* data,int len);//send function wit //int reserved_parse_bare(const char *input,int input_len,char* & data,int & len); // a sub function used in recv_bare int recv_bare(raw_info_t &raw_info,char* & data,int & len);//recv function with encryption but no anti replay,this is used when client and server verifys each other //you have to design the protocol carefully, so that you wont be affect by relay attack -int send_handshake(raw_info_t &raw_info,id_t id1,id_t id2,id_t id3);// a warp for send_bare for sending handshake(this is not tcp handshake) easily +int send_handshake(raw_info_t &raw_info,my_id_t id1,my_id_t id2,my_id_t id3);// a warp for send_bare for sending handshake(this is not tcp handshake) easily int send_safer(conn_info_t &conn_info,char type,const char* data,int len); //safer transfer function with anti-replay,when mutually verification is done. int send_data_safer(conn_info_t &conn_info,const char* data,int len,u32_t conv_num);//a wrap for send_safer for transfer data. //int reserved_parse_safer(conn_info_t &conn_info,const char * input,int input_len,char &type,char* &data,int &len);//subfunction for recv_safer,allow overlap diff --git a/main.cpp b/main.cpp index ab43c71..2863ca2 100755 --- a/main.cpp +++ b/main.cpp @@ -332,21 +332,21 @@ int client_on_raw_recv(conn_info_t &conn_info) //called when raw fd received a p mylog(log_debug,"unexpected adress %x %x %d %d\n",recv_info.src_ip,send_info.dst_ip,recv_info.src_port,send_info.dst_port); return -1; } - if(data_len