Class Server

Inheritance Relationships

Base Type

  • public std::enable_shared_from_this< Server >

Class Documentation

class core::networking::Server : public std::enable_shared_from_this<Server>

Public Types

typedef std::function<void(std::shared_ptr<Connection> connection, std::shared_ptr<Packet> packet)> PacketHandler
typedef std::function<void(std::shared_ptr<Connection> connection)> NewConnectionHandler
typedef std::function<void(std::shared_ptr<Connection> connection)> DisconnectHandler

Public Functions

Server(std::shared_ptr<Application> application, std::string host, unsigned short port, uint8_t securityLevel, const uint32_t defaultKeys[])
~Server()
void Run()
std::shared_ptr<PacketManager> GetPacketManager()
void SetNewConnectionHandler(NewConnectionHandler handler)
void SetDisconnectHandler(DisconnectHandler handler)
void RegisterHandler(uint8_t header, PacketHandler handler)
void CallNewConnectionHandler(const std::shared_ptr<Connection> &connection)
void CallDisconnectHandler(const std::shared_ptr<Connection> &connection)
void CallPacketHandler(std::shared_ptr<Connection> connection, std::shared_ptr<Packet> packet)
void SendToAll(const std::shared_ptr<Packet> &packet)
void SendTo(const std::shared_ptr<Packet> &packet, std::function<bool(std::shared_ptr<Connection>&)> filter)
void SendToPhase(std::shared_ptr<Packet> packet, uint8_t phase)
std::shared_ptr<Connection> GetConnection(uint64_t id)
void RemoveConnection(uint64_t id)
std::shared_ptr<Application> GetApplication()