4 #include <netinet/ip.h>
11 #include "stg/os_int.h"
12 #include "stg/blowfish.h"
18 typedef bool (PROTO::*PacketProcessor)(const void *, USER *);
22 PROTO(const std::string & server,
31 const std::string GetStrError() const { return errorStr; }
33 void AddUser(const USER & user);
35 bool Connect(uint32_t ip);
36 bool Disconnect(uint32_t ip);
39 struct sockaddr_in localAddr;
40 struct sockaddr_in serverAddr;
43 std::map<uint32_t, USER> users;
44 std::vector<struct pollfd> pollFds;
53 std::map<std::string, PacketProcessor> processors;
55 static void * Runner(void * data);
59 bool SendPacket(const void * buffer, size_t length, USER * user);
60 bool HandlePacket(const char * buffer, USER * user);
62 bool CONN_SYN_ACK_Proc(const void * buffer, USER * user);
63 bool ALIVE_SYN_Proc(const void * buffer, USER * user);
64 bool DISCONN_SYN_ACK_Proc(const void * buffer, USER * user);
65 bool FIN_Proc(const void * buffer, USER * user);
66 bool INFO_Proc(const void * buffer, USER * user);
67 bool ERR_Proc(const void * buffer, USER * user);
69 bool Send_CONN_SYN(USER * user);
70 bool Send_CONN_ACK(USER * user);
71 bool Send_DISCONN_SYN(USER * user);
72 bool Send_DISCONN_ACK(USER * user);
73 bool Send_ALIVE_ACK(USER * user);