#ifndef PACKET_H #define PACKET_H #include "network/ENet.h" #include "utils/Types.h" class InPacket { ENetPacket* packet; unsigned int index; friend class Server; InPacket(ENetPacket* packet); bool read(void* buffer, unsigned int length); public: bool readU8(uint8& u); bool readU16(uint16& u); bool readU32(uint32& u); bool readS8(int8& u); bool readS16(int16& u); bool readS32(int32& u); }; class OutPacket { ENetPacket* packet; unsigned int index; friend class Client; public: OutPacket(unsigned int size, int flags); ~OutPacket(); OutPacket(const OutPacket& other); OutPacket(OutPacket&& other); OutPacket& operator=(OutPacket other); void writeU8(uint8 u); void writeU16(uint16 u); void writeU32(uint32 u); void writeS8(int8 s); void writeS16(int16 s); void writeS32(int32 s); private: void write(const void* buffer, unsigned int length); }; #endif