X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/6ce56fd8481f4fc5ae2cf9383e6b6ecbff42b41d..46b0747592074017ff0ea4b33d4a7194235886e5:/projects/sgauthstress/proto.h diff --git a/projects/sgauthstress/proto.h b/projects/sgauthstress/proto.h deleted file mode 100644 index f478c0e1..00000000 --- a/projects/sgauthstress/proto.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef __PROTO_H__ -#define __PROTO_H__ - -#include -#include - -#include -#include - -#include "stg/os_int.h" -#include "stg/blowfish.h" - -#include "user.h" - -class PROTO; - -typedef bool (PROTO::*PacketProcessor)(char *); - -class PROTO { - public: - PROTO(const std::string & server, - uint16_t port, - uint16_t localPort, - int timeout = 1); - ~PROTO(); - - bool Start(); - bool Stop(); - - const std::string GetStrError() const { return errorStr; } - - bool Connect(const std::string & login); - bool Disconnect(const std::string & login); - private: - int sock; - BLOWFISH_CTX ctx; - struct sockaddr_in localAddr; - struct sockaddr_in serverAddr; - int timeout; - - std::map users; - - bool running; - bool stopped; - - pthread_t tid; - - std::string errorStr; - - std::map processors; - - static void * Runner(void * data); - - void Run(); - bool RecvPacket(); - bool HandlePacket(char * buffer); - - bool CONN_SYN_ACK_Proc(char * buffer); - bool ALIVE_SYN_Proc(char * buffer); - bool DISCONN_SYN_ACK_Proc(char * buffer); - bool FIN_Proc(char * buffer); - bool INFO_Proc(char * buffer); - bool ERR_Proc(char * buffer); -}; - -#endif