12345678910111213141516171819202122232425262728293031 |
- #ifndef SERVER_H
- #define SERVER_H
- #include "network/Packet.h"
- #include "utils/Error.h"
- #include "utils/Types.h"
- namespace Server {
- typedef uint16 Port;
- typedef int Client;
- typedef void (*OnConnect)(Client);
- typedef void (*OnDisconnect)(Client);
- typedef void (*OnPacket)(Client, InPacket&);
- Error start(Port port, int maxClients);
- void stop();
- void tick();
- void send(const OutPacket& p, PacketSendMode mode);
- void send(Client client, const OutPacket& p, PacketSendMode mode);
- void disconnect(Client client);
- void setConnectHandler(OnConnect oc);
- void setDisconnectHandler(OnDisconnect od);
- void setPacketHandler(OnPacket op);
- void resetHandler();
- }
- #endif
|