OpenTTD Source
1.11.0-beta2
|
Go to the documentation of this file.
12 #ifndef NETWORK_CORE_TCP_CONTENT_H
13 #define NETWORK_CORE_TCP_CONTENT_H
18 #include "../../debug.h"
99 void Close()
override;
bool IsSelected() const
Is the state either selected or autoselected?
@ INVALID_CONTENT_ID
Sentinel for invalid content.
uint8 tag_count
Number of tags.
~ContentInfo()
Free everything allocated.
const char * GetTextfile(TextfileType type) const
Search a textfile file next to this file in the content list.
ContentType type
Type of content.
Base socket handler for all Content TCP sockets.
virtual bool Receive_SERVER_CONTENT(Packet *p)
Server sending list of content info: uint32 unique id uint32 file size (0 == does not exist) string f...
ContentType
The values in the enum are important; they are used as database 'keys'.
bool upgrade
This item is an upgrade.
@ DOES_NOT_EXIST
The content does not exist in the content system.
PacketContentType
Enum with all types of TCP content packets.
@ CONTENT_TYPE_BASE_SOUNDS
The content consists of base sounds.
@ CONTENT_TYPE_AI
The content consists of an AI.
char(* tags)[32]
Malloced array of tags (strings)
@ PACKET_CONTENT_END
Must ALWAYS be on the end of this list!! (period)
@ CONTENT_TYPE_BASE_GRAPHICS
The content consists of base graphics.
@ PACKET_CONTENT_CLIENT_CONTENT
Request a content file given an internal ID.
bool ReceivePackets()
Receive a packet at TCP level.
@ PACKET_CONTENT_SERVER_CONTENT
Reply with the content of the given ID.
State
The state the content can be in.
char filename[48]
Filename (for the .tar.gz; only valid on download)
virtual bool Receive_CLIENT_INFO_EXTID_MD5(Packet *p)
Client requesting a list of content info based on an external 'unique' id; GRF ID + MD5 checksum for ...
bool IsValid() const
Is the information from this content info valid?
@ CONTENT_TYPE_BASE_MUSIC
The content consists of base music.
void TransferFrom(ContentInfo *other)
Copy data from other ContentInfo and take ownership of allocated stuff.
virtual bool Receive_CLIENT_INFO_EXTID(Packet *p)
Client requesting a list of content info based on an external 'unique' id; GRF ID for NewGRFS,...
NetworkAddress client_addr
The address we're connected to.
@ UNSELECTED
The content has not been selected.
virtual ~NetworkContentSocketHandler()
On destructing of this class, the socket needs to be closed.
@ CONTENT_TYPE_HEIGHTMAP
The content consists of a heightmap.
Container for all important information about a piece of content.
byte md5sum[16]
The MD5 checksum.
@ CONTENT_TYPE_GAME
The content consists of a game script.
@ CONTENT_TYPE_SCENARIO
The content consists of a scenario.
@ SELECTED
The content has been manually selected.
@ CONTENT_TYPE_AI_LIBRARY
The content consists of an AI library.
@ PACKET_CONTENT_CLIENT_INFO_ID
Queries the content server for information about a list of internal IDs.
char url[96]
URL related to the content.
Internal entity of a packet.
@ CONTENT_TYPE_GAME_LIBRARY
The content consists of a GS library.
@ CONTENT_TYPE_NEWGRF
The content consists of a NewGRF.
bool ReceiveInvalidPacket(PacketContentType type)
Helper for logging receiving invalid packets.
char description[512]
Description of the content.
@ PACKET_CONTENT_CLIENT_INFO_LIST
Queries the content server for a list of info of a given content type.
Wrapper for (un)resolved network addresses; there's no reason to transform a numeric IP to a string a...
@ ALREADY_HERE
The content is already at the client side.
virtual bool Receive_CLIENT_CONTENT(Packet *p)
Client requesting the actual content: uint16 count of unique ids uint32 unique id (count times)
@ AUTOSELECTED
The content has been selected as dependency.
size_t Size() const
Get the size of the data as send over the network.
virtual bool Receive_CLIENT_INFO_LIST(Packet *p)
Client requesting a list of content info: byte type uint32 openttd version.
virtual bool Receive_CLIENT_INFO_ID(Packet *p)
Client requesting a list of content info: uint16 count of ids uint32 id (count times)
@ PACKET_CONTENT_CLIENT_INFO_EXTID
Queries the content server for information about a list of external IDs.
NetworkContentSocketHandler(SOCKET s=INVALID_SOCKET, const NetworkAddress &address=NetworkAddress())
Create a new cs socket handler for a given cs.
ContentInfo()
Clear everything in the struct.
uint8 dependency_count
Number of dependencies.
Subdirectory
The different kinds of subdirectories OpenTTD uses.
char version[16]
Version of the content.
State state
Whether the content info is selected (for download)
uint32 unique_id
Unique ID; either GRF ID or shortname.
@ CONTENT_TYPE_BEGIN
Helper to mark the begin of the types.
ContentID
Unique identifier for the content.
TextfileType
Additional text files accompanying Tar archives.
Subdirectory GetContentInfoSubDir(ContentType type)
Helper to get the subdirectory a ContentInfo is located in.
bool HandlePacket(Packet *p)
Handle the given packet, i.e.
void Close() override
Really close the socket.
char name[32]
Name of the content.
@ INVALID
The content's invalid.
ContentID * dependencies
Malloced array of dependencies (unique server side ids)
ContentID id
Unique (server side) ID for the content.
virtual bool Receive_SERVER_INFO(Packet *p)
Server sending list of content info: byte type (invalid ID == does not exist) uint32 id uint32 file_s...
@ PACKET_CONTENT_SERVER_INFO
Reply of content server with information about content.
@ CONTENT_TYPE_END
Helper to mark the end of the types.
uint32 filesize
Size of the file.
Base socket handler for all TCP sockets.
@ PACKET_CONTENT_CLIENT_INFO_EXTID_MD5
Queries the content server for information about a list of external IDs and MD5.