/EQEmuServer/common/EmuTCPServer.h

http://projecteqemu.googlecode.com/ · C Header · 38 lines · 24 code · 10 blank · 4 comment · 0 complexity · 1f9c987a9629d9894484c9f52643d9a5 MD5 · raw file

  1. #ifndef EmuTCPSERVER_H_
  2. #define EmuTCPSERVER_H_
  3. #include "TCPServer.h"
  4. class EmuTCPConnection;
  5. struct EmuTCPNetPacket_Struct;
  6. class ServerPacket;
  7. class EmuTCPServer : public TCPServer<EmuTCPConnection> {
  8. public:
  9. EmuTCPServer(uint16 iPort = 0, bool iOldFormat = false);
  10. virtual ~EmuTCPServer();
  11. //packet broadcast routines.
  12. void SendPacket(ServerPacket* pack);
  13. void SendPacket(EmuTCPNetPacket_Struct** tnps);
  14. //special crap for relay management
  15. EmuTCPConnection *FindConnection(uint32 iID);
  16. //exposed for some crap we pull. Do not call from outside this object.
  17. TCPServer<EmuTCPConnection>::AddConnection;
  18. protected:
  19. virtual void Process();
  20. virtual void CreateNewConnection(uint32 ID, SOCKET in_socket, uint32 irIP, uint16 irPort);
  21. bool pOldFormat;
  22. //broadcast packet queue..
  23. void CheckInQueue();
  24. Mutex MInQueue;
  25. EmuTCPNetPacket_Struct* InQueuePop(); //returns ownership
  26. std::queue<EmuTCPNetPacket_Struct *> m_InQueue;
  27. };
  28. #endif /*EmuTCPSERVER_H_*/