2021-12-05 17:54:36 +00:00
|
|
|
#ifndef PACKETUTILS_H
|
|
|
|
#define PACKETUTILS_H
|
|
|
|
|
|
|
|
#include <BitStream.h>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace PacketUtils {
|
|
|
|
void WriteHeader(RakNet::BitStream& bitStream, uint16_t connectionType, uint32_t internalPacketID);
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
uint16_t ReadPacketU16(uint32_t startLoc, Packet* packet);
|
|
|
|
uint32_t ReadPacketU32(uint32_t startLoc, Packet* packet);
|
|
|
|
uint64_t ReadPacketU64(uint32_t startLoc, Packet* packet);
|
|
|
|
int64_t ReadPacketS64(uint32_t startLoc, Packet* packet);
|
2022-07-27 01:52:04 +00:00
|
|
|
std::string ReadString(uint32_t startLoc, Packet* packet, bool wide, uint32_t maxLen = 33);
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
void WritePacketString(const std::string& string, uint32_t maxSize, RakNet::BitStream* bitStream);
|
|
|
|
void WriteString(RakNet::BitStream& bitStream, const std::string& s, uint32_t maxSize);
|
|
|
|
void WriteWString(RakNet::BitStream& bitStream, const std::string& string, uint32_t maxSize);
|
|
|
|
void WriteWString(RakNet::BitStream& bitStream, const std::u16string& string, uint32_t maxSize);
|
|
|
|
void WritePacketWString(const std::string& string, uint32_t maxSize, RakNet::BitStream* bitStream);
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
void SavePacket(const std::string& filename, const char* data, size_t length);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PACKETUTILS_H
|