Files
@ r10737:2346af7e04e8
Branch filter:
Location: cpp/openttd-patchpack/source/src/network/core/packet.h - annotation
r10737:2346af7e04e8
1.9 KiB
text/x-c
(svn r15070) -Update: WebTranslator2 update to 2009-01-13 18:42:22
brazilian_portuguese - 16 fixed by tucalipe (16)
catalan - 8 fixed by arnaullv (8)
croatian - 24 fixed by tifached (24)
czech - 8 fixed by Hadez (8)
dutch - 2 fixed by Excel20 (2)
finnish - 7 fixed, 1 changed by UltimateSephiroth (8)
hungarian - 7 fixed, 2 changed by IPG (2), alyr (7)
indonesian - 23 fixed, 2 changed by fanioz (25)
italian - 7 fixed, 1 changed by lorenzodv (8)
japanese - 59 fixed by ickoonite (59)
polish - 3 fixed by xaxa (3)
romanian - 23 fixed, 1 changed by kkmic (24)
slovak - 59 fixed by James (59)
spanish - 58 fixed by Dominus (30), eusebio (28)
turkish - 7 fixed, 1 changed by Emin (8)
brazilian_portuguese - 16 fixed by tucalipe (16)
catalan - 8 fixed by arnaullv (8)
croatian - 24 fixed by tifached (24)
czech - 8 fixed by Hadez (8)
dutch - 2 fixed by Excel20 (2)
finnish - 7 fixed, 1 changed by UltimateSephiroth (8)
hungarian - 7 fixed, 2 changed by IPG (2), alyr (7)
indonesian - 23 fixed, 2 changed by fanioz (25)
italian - 7 fixed, 1 changed by lorenzodv (8)
japanese - 59 fixed by ickoonite (59)
polish - 3 fixed by xaxa (3)
romanian - 23 fixed, 1 changed by kkmic (24)
slovak - 59 fixed by James (59)
spanish - 58 fixed by Dominus (30), eusebio (28)
turkish - 7 fixed, 1 changed by Emin (8)
r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r6121:a8ff6abe7fb2 r6121:a8ff6abe7fb2 r6121:a8ff6abe7fb2 r6121:a8ff6abe7fb2 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5527:e9d8b06d490d r5624:8f8d1f8d3a74 r5527:e9d8b06d490d r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5881:a910d470cf80 r5475:3f5cd13d1b63 r5881:a910d470cf80 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5898:2191f99d1ffb r5898:2191f99d1ffb r5898:2191f99d1ffb r5898:2191f99d1ffb r5898:2191f99d1ffb r5898:2191f99d1ffb r5898:2191f99d1ffb r5900:b72b667bb359 r6247:96e840dbefcc r5900:b72b667bb359 r5918:49621b4f6bf6 r5900:b72b667bb359 r5900:b72b667bb359 r5900:b72b667bb359 r5900:b72b667bb359 r10647:62911ec68e89 r5898:2191f99d1ffb r5900:b72b667bb359 r6247:96e840dbefcc r6247:96e840dbefcc r5900:b72b667bb359 r5900:b72b667bb359 r6247:96e840dbefcc r6247:96e840dbefcc r6247:96e840dbefcc r6247:96e840dbefcc r6247:96e840dbefcc r10647:62911ec68e89 r5881:a910d470cf80 r5475:3f5cd13d1b63 r5898:2191f99d1ffb r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 | /* $Id$ */
/**
* @file packet.h Basic functions to create, fill and read packets.
*/
#ifndef NETWORK_CORE_PACKET_H
#define NETWORK_CORE_PACKET_H
#ifdef ENABLE_NETWORK
#include "config.h"
#include "core.h"
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.
*/
struct Packet {
/** The next packet. Used for queueing packets before sending. */
Packet *next;
/** The size of the whole packet for received packets. For packets
* that will be sent, the value is filled in just before the
* actual transmission. */
PacketSize size;
/** The current read/write position in the packet */
PacketSize pos;
/** The buffer of this packet */
byte buffer[SEND_MTU];
private:
NetworkSocketHandler *cs;
public:
Packet(NetworkSocketHandler *cs);
Packet(PacketType type);
/* Sending/writing of packets */
void PrepareToSend();
void Send_bool (bool data);
void Send_uint8 (uint8 data);
void Send_uint16(uint16 data);
void Send_uint32(uint32 data);
void Send_uint64(uint64 data);
void Send_string(const char *data);
/* Reading/receiving of packets */
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);
};
Packet *NetworkSend_Init(PacketType type);
#endif /* ENABLE_NETWORK */
#endif /* NETWORK_CORE_PACKET_H */
|