diff --git a/common.cpp b/common.cpp index db6a3b6..e4523f1 100644 --- a/common.cpp +++ b/common.cpp @@ -593,7 +593,21 @@ int create_fifo(char * file) return fifo_fd; } - +void ip_port_t::from_u64(u64_t u64) +{ + ip=get_u64_h(u64); + port=get_u64_l(u64); +} +u64_t ip_port_t::to_u64() +{ + return pack_u64(ip,port); +} +char * ip_port_t::to_s() +{ + static char res[40]; + sprintf(res,"%s:%d",my_ntoa(ip),port); + return res; +} diff --git a/common.h b/common.h index 3955a59..ae7c4a5 100644 --- a/common.h +++ b/common.h @@ -70,6 +70,24 @@ typedef u64_t padding_t; typedef u64_t anti_replay_seq_t; + +struct ip_port_t +{ + u32_t ip; + int port; + void from_u64(u64_t u64); + u64_t to_u64(); + char * to_s(); +}; + +struct fd_info_t +{ + ip_port_t ip_port; +}; + + +typedef u64_t fd64_t; + const int max_data_len=1600; const int buf_len=max_data_len+400; diff --git a/makefile b/makefile index fcf00eb..979d89d 100755 --- a/makefile +++ b/makefile @@ -8,7 +8,7 @@ cc_arm= /toolchains/arm-2014.05/bin/arm-none-linux-gnueabi-g++ #cc_bcm2708=/home/wangyu/raspberry/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++ FLAGS= -std=c++11 -Wall -Wextra -Wno-unused-variable -Wno-unused-parameter -Wno-missing-field-initializers -COMMON=main.cpp lib/md5.c encrypt.cpp log.cpp network.cpp common.cpp connection.cpp misc.cpp -lpthread +COMMON=main.cpp lib/md5.c encrypt.cpp log.cpp network.cpp common.cpp connection.cpp misc.cpp fd_manager.cpp -lpthread SOURCES= $(COMMON) lib/aes_faster_c/aes.c lib/aes_faster_c/wrapper.c SOURCES_TINY_AES= $(COMMON) lib/aes.c SOURCES_AES_ACC=$(COMMON) $(wildcard lib/aes_acc/aes*.c)