Go to the documentation of this file.
12 #ifndef NETWORK_CORE_PACKET_H
13 #define NETWORK_CORE_PACKET_H
17 #include "../../string_type.h"
void PrepareToSend()
Writes the packet size from the raw packet from packet->size.
void Recv_string(char *buffer, size_t size, StringValidationSettings settings=SVS_REPLACE_WITH_QUESTION_MARK)
Reads a string till it finds a '\0' in the stream.
byte * buffer
The buffer of this packet, of basically variable length up to SEND_MTU.
SocketHandler for all network sockets in OpenTTD.
void Send_uint8(uint8 data)
Package a 8 bits integer in the packet.
uint8 PacketType
Identifier for the packet.
void Send_uint32(uint32 data)
Package a 32 bits integer in the packet.
uint32 Recv_uint32()
Read a 32 bits integer from the packet.
void Send_string(const char *data)
Sends a string over the network.
void PrepareToRead()
Prepares the packet so it can be read.
PacketSize size
The size of the whole packet for received packets.
void Send_uint16(uint16 data)
Package a 16 bits integer in the packet.
fluid_settings_t * settings
FluidSynth settings handle.
Packet * next
The next packet.
bool CanReadFromPacket(uint bytes_to_read)
Is it safe to read from the packet, i.e.
void ReadRawPacketSize()
Reads the packet size from the raw packet and stores it in the packet->size.
Internal entity of a packet.
StringValidationSettings
Settings for the string validation.
void Send_bool(bool data)
Package a boolean in the packet.
~Packet()
Free the buffer of this packet.
uint16 PacketSize
Size of the whole packet.
bool Recv_bool()
Read a boolean from the packet.
void Send_uint64(uint64 data)
Package a 64 bits integer in the packet.
NetworkSocketHandler * cs
Socket we're associated with.
uint8 Recv_uint8()
Read a 8 bits integer from the packet.
Packet(NetworkSocketHandler *cs)
Create a packet that is used to read from a network socket.
uint64 Recv_uint64()
Read a 64 bits integer from the packet.
@ SVS_REPLACE_WITH_QUESTION_MARK
Replace the unknown/bad bits with question marks.
uint16 Recv_uint16()
Read a 16 bits integer from the packet.
PacketSize pos
The current read/write position in the packet.