diff --git a/common.cpp b/common.cpp index dd66bec..1f02262 100644 --- a/common.cpp +++ b/common.cpp @@ -10,7 +10,7 @@ raw_mode_t raw_mode=mode_faketcp; -map raw_mode_tostring = {{mode_faketcp, "faketcp"}, {mode_udp, "udp"}, {mode_icmp, "icmp"}}; +unordered_map raw_mode_tostring = {{mode_faketcp, "faketcp"}, {mode_udp, "udp"}, {mode_icmp, "icmp"}}; int socket_buf_size=1024*1024; static int random_number_fd=-1; diff --git a/common.h b/common.h index 27e4fb4..01a6fd5 100644 --- a/common.h +++ b/common.h @@ -9,24 +9,15 @@ #define COMMON_H_ + #include #include -#include -#include #include #include -#include +#include #include - -#include - #include #include - -#include -#include -#include - #include //for socket ofcourse #include #include //for exit(0); @@ -38,20 +29,13 @@ #include #include #include -#include -#include #include #include #include - #include #include - #include -#include -#include #include - #include #include #include @@ -59,8 +43,10 @@ #include #include -#include + + +#include using namespace std; const int max_data_len=65535; @@ -99,7 +85,7 @@ enum raw_mode_t{mode_faketcp=1,mode_udp,mode_icmp,mode_end}; extern raw_mode_t raw_mode; enum program_mode_t {unset_mode=0,client_mode,server_mode}; extern program_mode_t program_mode; -extern map raw_mode_tostring ; +extern unordered_map raw_mode_tostring ; extern int socket_buf_size; typedef uint32_t id_t; diff --git a/encrypt.cpp b/encrypt.cpp index d54c6c9..b2344fa 100755 --- a/encrypt.cpp +++ b/encrypt.cpp @@ -13,8 +13,8 @@ static int8_t zero_iv[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0};//this prog use zero iv,you should make sure first block of data contains a random/nonce data -map auth_mode_tostring = {{auth_none, "none"}, {auth_md5, "md5"}, {auth_crc32, "crc32"},{auth_sum,"sum"}}; -map cipher_mode_tostring={{cipher_none,"none"},{cipher_aes128cbc,"aes128cbc"},{cipher_xor,"xor"}}; +unordered_map auth_mode_tostring = {{auth_none, "none"}, {auth_md5, "md5"}, {auth_crc32, "crc32"},{auth_sum,"sum"}}; +unordered_map cipher_mode_tostring={{cipher_none,"none"},{cipher_aes128cbc,"aes128cbc"},{cipher_xor,"xor"}}; auth_mode_t auth_mode=auth_sum; cipher_mode_t cipher_mode=cipher_xor; diff --git a/encrypt.h b/encrypt.h index c89982a..f7afc0b 100755 --- a/encrypt.h +++ b/encrypt.h @@ -1,11 +1,15 @@ #ifndef _ENCRYPTION_H_ #define _ENCRYPTION_H_ -#include "aes.h" -#include "md5.h" + + +//#include "aes.h" +//#include "md5.h" #include "common.h" -using namespace std; + +//using namespace std; + int my_encrypt(const char *data,char *output,int &len,char * key); int my_decrypt(const char *data,char *output,int &len,char * key); @@ -17,13 +21,19 @@ unsigned short csum(const unsigned short *ptr,int nbytes) ; enum auth_mode_t {auth_none=0,auth_md5,auth_crc32,auth_sum,auth_end}; -extern map auth_mode_tostring; + enum cipher_mode_t {cipher_none=0,cipher_aes128cbc,cipher_xor,cipher_end}; -extern map cipher_mode_tostring; + extern auth_mode_t auth_mode; extern cipher_mode_t cipher_mode; -//const map auth_mode_tostring2 = {{auth_none, "none"}, {auth_md5, "md5"}, {auth_crc32, "crc32"},{auth_sum,"sum"}}; + +struct a +{ + char * buf[buf_len]; +}; +extern unordered_map auth_mode_tostring; +extern unordered_map cipher_mode_tostring; #endif diff --git a/main.cpp b/main.cpp index 50a4f2d..ea56cda 100755 --- a/main.cpp +++ b/main.cpp @@ -1,7 +1,7 @@ #include "common.h" #include "network.h" #include "log.h" - +#include "md5.h" char local_address[100]="0.0.0.0", remote_address[100]="255.255.255.255",source_address[100]="0.0.0.0"; uint32_t local_address_uint32,remote_address_uint32,source_address_uint32; @@ -2698,7 +2698,7 @@ void process_arg(int argc, char *argv[]) { for(i=0;i