@@ -9,26 +9,24 @@
/**
* @file packet.h Basic functions to create, fill and read packets.
*/
#ifndef NETWORK_CORE_PACKET_H
#define NETWORK_CORE_PACKET_H
#include "config.h"
#include "core.h"
#include "../../string_type.h"
#ifdef ENABLE_NETWORK
typedef uint16 PacketSize; ///< Size of the whole packet.
typedef uint8 PacketType; ///< Identifier for the packet
* Internal entity of a packet. As everything is sent as a packet,
* all network communication will need to call the functions that
* populate the packet.
* Every packet can be at most SEND_MTU bytes. Overflowing this
* limit will give an assertion when sending (i.e. writing) the
* packet. Reading past the size of the packet when receiving
* will return all 0 values and "" in case of the string.
*
@@ -78,15 +76,13 @@ public:
void ReadRawPacketSize();
void PrepareToRead();
bool CanReadFromPacket (uint bytes_to_read);
bool Recv_bool ();
uint8 Recv_uint8 ();
uint16 Recv_uint16();
uint32 Recv_uint32();
uint64 Recv_uint64();
void Recv_string(char *buffer, size_t size, StringValidationSettings settings = SVS_REPLACE_WITH_QUESTION_MARK);
};
#endif /* ENABLE_NETWORK */
#endif /* NETWORK_CORE_PACKET_H */