OpenTTD: src/network/core/tcp_content.h File Reference

OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

Data Structures | Enumerations | Functions
tcp_content.h File Reference

Basic functions to receive and send TCP packets to/from the content server. More...

`#include "os_abstraction.h"`
`#include "tcp.h"`
`#include "packet.h"`
`#include "../../debug.h"`

Go to the source code of this file.

## Data Structures
struct | ContentInfo
| Container for all important information about a piece of content. More...
class | NetworkContentSocketHandler
| Base socket handler for all Content TCP sockets. More...

## Enumerations
enum | ContentType { CONTENT_TYPE_BEGIN = 1, CONTENT_TYPE_BASE_GRAPHICS = 1, CONTENT_TYPE_NEWGRF = 2, CONTENT_TYPE_AI = 3, CONTENT_TYPE_AI_LIBRARY = 4, CONTENT_TYPE_SCENARIO = 5, CONTENT_TYPE_HEIGHTMAP = 6, CONTENT_TYPE_BASE_SOUNDS = 7, CONTENT_TYPE_BASE_MUSIC = 8, CONTENT_TYPE_GAME = 9, CONTENT_TYPE_GAME_LIBRARY = 10, CONTENT_TYPE_END }
| The values in the enum are important; they are used as database 'keys'. More...
enum | PacketContentType { PACKET_CONTENT_CLIENT_INFO_LIST, PACKET_CONTENT_CLIENT_INFO_ID, PACKET_CONTENT_CLIENT_INFO_EXTID, PACKET_CONTENT_CLIENT_INFO_EXTID_MD5, PACKET_CONTENT_SERVER_INFO, PACKET_CONTENT_CLIENT_CONTENT, PACKET_CONTENT_SERVER_CONTENT, PACKET_CONTENT_END }
| Enum with all types of TCP content packets. More...
enum | ContentID { INVALID_CONTENT_ID = UINT32_MAX }
| Unique identifier for the content. More...

## Functions
Subdirectory | GetContentInfoSubDir (ContentType type)
| Helper to get the subdirectory a ContentInfo is located in.

## Detailed Description

Basic functions to receive and send TCP packets to/from the content server.

Definition in file tcp_content.h.

## Enumeration Type Documentation

enum ContentID

Unique identifier for the content.

Enumerator:

  INVALID_CONTENT_ID | Sentinel for invalid content.

Definition at line 53 of file tcp_content.h.

enum ContentType

The values in the enum are important; they are used as database 'keys'.

Enumerator:

  CONTENT_TYPE_BEGIN | Helper to mark the begin of the types.
  CONTENT_TYPE_BASE_GRAPHICS | The content consists of base graphics.
  CONTENT_TYPE_NEWGRF | The content consists of a NewGRF.
  CONTENT_TYPE_AI | The content consists of an AI.
  CONTENT_TYPE_AI_LIBRARY | The content consists of an AI library.
  CONTENT_TYPE_SCENARIO | The content consists of a scenario.
  CONTENT_TYPE_HEIGHTMAP | The content consists of a heightmap.
  CONTENT_TYPE_BASE_SOUNDS | The content consists of base sounds.
  CONTENT_TYPE_BASE_MUSIC | The content consists of base music.
  CONTENT_TYPE_GAME | The content consists of a game script.
  CONTENT_TYPE_GAME_LIBRARY | The content consists of a GS library.
  CONTENT_TYPE_END | Helper to mark the end of the types.

Definition at line 25 of file tcp_content.h.

enum PacketContentType

Enum with all types of TCP content packets.

The order MUST not be changed

Enumerator:

  PACKET_CONTENT_CLIENT_INFO_LIST | Queries the content server for a list of info of a given content type.
  PACKET_CONTENT_CLIENT_INFO_ID | Queries the content server for information about a list of internal IDs.
  PACKET_CONTENT_CLIENT_INFO_EXTID | Queries the content server for information about a list of external IDs.
  PACKET_CONTENT_CLIENT_INFO_EXTID_MD5 | Queries the content server for information about a list of external IDs and MD5.
  PACKET_CONTENT_SERVER_INFO | Reply of content server with information about content.
  PACKET_CONTENT_CLIENT_CONTENT | Request a content file given an internal ID.
  PACKET_CONTENT_SERVER_CONTENT | Reply with the content of the given ID.
  PACKET_CONTENT_END | Must ALWAYS be on the end of this list!! (period)

Definition at line 41 of file tcp_content.h.

## Function Documentation

Subdirectory GetContentInfoSubDir | ( | ContentType | type | ) |

Helper to get the subdirectory a ContentInfo is located in.

Parameters

  type | The type of content.

Returns
  The subdirectory the content is located in.

Definition at line 249 of file tcp_content.cpp.

References AI_DIR, AI_LIBRARY_DIR, BASESET_DIR, CONTENT_TYPE_AI, CONTENT_TYPE_AI_LIBRARY, CONTENT_TYPE_BASE_GRAPHICS, CONTENT_TYPE_BASE_MUSIC, CONTENT_TYPE_BASE_SOUNDS, CONTENT_TYPE_GAME, CONTENT_TYPE_GAME_LIBRARY, CONTENT_TYPE_HEIGHTMAP, CONTENT_TYPE_NEWGRF, CONTENT_TYPE_SCENARIO, GAME_DIR, GAME_LIBRARY_DIR, HEIGHTMAP_DIR, NEWGRF_DIR, NO_DIRECTORY, and SCENARIO_DIR.

Referenced by ClientNetworkContentSocketHandler::AfterDownload(), GetFullFilename(), and ContentInfo::GetTextfile().