Files
@ r28024:510529c5fc82
Branch filter:
Location: cpp/openttd-patchpack/source/src/network/core/tcp_content.h - annotation
r28024:510529c5fc82
4.6 KiB
text/x-c
Change: Use CARGO_LIST to show station cargo acceptance changes. (#11379)
This simplifies construction of the news message and allows for more than
two changes to be show in one line.
This simplifies construction of the news message and allows for more than
two changes to be show in one line.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r16851:b5784600e35e r16851:b5784600e35e r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r25280:78ec283d6d49 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r17619:8e40da35981c r17619:8e40da35981c r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r27737:728d55b97775 r25950:50ad36e37113 r27737:728d55b97775 r25950:50ad36e37113 r25950:50ad36e37113 r17619:8e40da35981c r17619:8e40da35981c r10793:5ba2151e71e9 r17619:8e40da35981c r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r27737:728d55b97775 r27737:728d55b97775 r17619:8e40da35981c r17619:8e40da35981c r10793:5ba2151e71e9 r17619:8e40da35981c r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r27737:728d55b97775 r10793:5ba2151e71e9 r27737:728d55b97775 r27737:728d55b97775 r17619:8e40da35981c r17619:8e40da35981c r10793:5ba2151e71e9 r17619:8e40da35981c r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r19944:25a78576fb5e r10793:5ba2151e71e9 r27737:728d55b97775 r10793:5ba2151e71e9 r27737:728d55b97775 r27737:728d55b97775 r10793:5ba2151e71e9 r17619:8e40da35981c r17619:8e40da35981c r10793:5ba2151e71e9 r17619:8e40da35981c r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r27737:728d55b97775 r27737:728d55b97775 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r27737:728d55b97775 r27737:728d55b97775 r27737:728d55b97775 r27737:728d55b97775 r27737:728d55b97775 r10793:5ba2151e71e9 r17619:8e40da35981c r17619:8e40da35981c r10793:5ba2151e71e9 r17619:8e40da35981c r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r27737:728d55b97775 r27737:728d55b97775 r17619:8e40da35981c r17619:8e40da35981c r10793:5ba2151e71e9 r17619:8e40da35981c r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r27737:728d55b97775 r27737:728d55b97775 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r17619:8e40da35981c r17619:8e40da35981c r10793:5ba2151e71e9 r17619:8e40da35981c r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r11544:5b7269ee2600 r10793:5ba2151e71e9 r25200:4496417abe2b r25200:4496417abe2b r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r25454:212b1b5e83b5 r25454:212b1b5e83b5 r25454:212b1b5e83b5 r25454:212b1b5e83b5 r25454:212b1b5e83b5 r10793:5ba2151e71e9 r20565:90fc925b267e r10793:5ba2151e71e9 r10793:5ba2151e71e9 r19537:6e0664ef363a r19537:6e0664ef363a r16851:b5784600e35e | /*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file tcp_content.h Basic functions to receive and send TCP packets to/from the content server.
*/
#ifndef NETWORK_CORE_TCP_CONTENT_H
#define NETWORK_CORE_TCP_CONTENT_H
#include "os_abstraction.h"
#include "tcp.h"
#include "packet.h"
#include "../../debug.h"
#include "tcp_content_type.h"
/** Base socket handler for all Content TCP sockets */
class NetworkContentSocketHandler : public NetworkTCPSocketHandler {
protected:
bool ReceiveInvalidPacket(PacketContentType type);
/**
* Client requesting a list of content info:
* byte type
* uint32_t openttd version (or 0xFFFFFFFF if using a list)
* Only if the above value is 0xFFFFFFFF:
* uint8_t count
* string branch-name ("vanilla" for upstream OpenTTD)
* string release version (like "12.0")
* @param p The packet that was just received.
* @return True upon success, otherwise false.
*/
virtual bool Receive_CLIENT_INFO_LIST(Packet *p);
/**
* Client requesting a list of content info:
* uint16_t count of ids
* uint32_t id (count times)
* @param p The packet that was just received.
* @return True upon success, otherwise false.
*/
virtual bool Receive_CLIENT_INFO_ID(Packet *p);
/**
* Client requesting a list of content info based on an external
* 'unique' id; GRF ID for NewGRFS, shortname and for base
* graphics and AIs.
* Scenarios and AI libraries are not supported
* uint8_t count of requests
* for each request:
* uint8_t type
* unique id (uint32_t)
* @param p The packet that was just received.
* @return True upon success, otherwise false.
*/
virtual bool Receive_CLIENT_INFO_EXTID(Packet *p);
/**
* Client requesting a list of content info based on an external
* 'unique' id; GRF ID + MD5 checksum for NewGRFS, shortname and
* xor-ed MD5 checksums for base graphics and AIs.
* Scenarios and AI libraries are not supported
* uint8_t count of requests
* for each request:
* uint8_t type
* unique id (uint32_t)
* md5 (16 bytes)
* @param p The packet that was just received.
* @return True upon success, otherwise false.
*/
virtual bool Receive_CLIENT_INFO_EXTID_MD5(Packet *p);
/**
* Server sending list of content info:
* byte type (invalid ID == does not exist)
* uint32_t id
* uint32_t file_size
* string name (max 32 characters)
* string version (max 16 characters)
* uint32_t unique id
* uint8_t md5sum (16 bytes)
* uint8_t dependency count
* uint32_t unique id of dependency (dependency count times)
* uint8_t tag count
* string tag (max 32 characters for tag count times)
* @param p The packet that was just received.
* @return True upon success, otherwise false.
*/
virtual bool Receive_SERVER_INFO(Packet *p);
/**
* Client requesting the actual content:
* uint16_t count of unique ids
* uint32_t unique id (count times)
* @param p The packet that was just received.
* @return True upon success, otherwise false.
*/
virtual bool Receive_CLIENT_CONTENT(Packet *p);
/**
* Server sending list of content info:
* uint32_t unique id
* uint32_t file size (0 == does not exist)
* string file name (max 48 characters)
* After this initial packet, packets with the actual data are send using
* the same packet type.
* @param p The packet that was just received.
* @return True upon success, otherwise false.
*/
virtual bool Receive_SERVER_CONTENT(Packet *p);
bool HandlePacket(Packet *p);
public:
/**
* Create a new cs socket handler for a given cs
* @param s the socket we are connected with
* @param address IP etc. of the client
*/
NetworkContentSocketHandler(SOCKET s = INVALID_SOCKET) :
NetworkTCPSocketHandler(s)
{
}
/** On destructing of this class, the socket needs to be closed */
virtual ~NetworkContentSocketHandler()
{
/* Virtual functions get called statically in destructors, so make it explicit to remove any confusion. */
this->CloseSocket();
}
bool ReceivePackets();
};
Subdirectory GetContentInfoSubDir(ContentType type);
#endif /* NETWORK_CORE_TCP_CONTENT_H */
|