12#ifndef NETWORK_CORE_CORE_H
13#define NETWORK_CORE_CORE_H
15#include "../../newgrf_config.h"
16#include "../network_crypto.h"
79 void Reopen() { this->has_quit =
false; }
SocketHandler for all network sockets in OpenTTD.
virtual ~NetworkSocketHandler()=default
Close the socket when destructing the socket handler.
void MarkClosed()
Mark the connection as closed.
bool HasClientQuit() const
Whether the current client connected to the socket has quit.
std::unique_ptr< class NetworkEncryptionHandler > send_encryption_handler
The handler for encrypting sent packets.
void Reopen()
Reopen the socket so we can send/receive stuff again.
NetworkSocketHandler()
Create a new unbound socket.
std::unique_ptr< class NetworkEncryptionHandler > receive_encryption_handler
The handler for decrypting received packets.
bool has_quit
Whether the current client has quit/send a bad packet.
Configuration options of the network stuff.
NetworkRecvStatus
Status of a network client; reasons why a client has quit.
@ NETWORK_RECV_STATUS_DESYNC
A desync did occur.
@ NETWORK_RECV_STATUS_CLIENT_QUIT
The connection is lost gracefully. Other clients are already informed of this leaving client.
@ NETWORK_RECV_STATUS_SERVER_ERROR
The server told us we made an error.
@ NETWORK_RECV_STATUS_SAVEGAME
Something went wrong (down)loading the savegame.
@ NETWORK_RECV_STATUS_CLOSE_QUERY
Done querying the server.
@ NETWORK_RECV_STATUS_OKAY
Everything is okay.
@ NETWORK_RECV_STATUS_NEWGRF_MISMATCH
We did not have the required NewGRFs.
@ NETWORK_RECV_STATUS_CONNECTION_LOST
The connection is lost unexpectedly.
@ NETWORK_RECV_STATUS_SERVER_FULL
The server is full.
@ NETWORK_RECV_STATUS_MALFORMED_PACKET
We apparently send a malformed packet.
@ NETWORK_RECV_STATUS_SERVER_BANNED
The server has banned us.
void NetworkCoreShutdown()
Shuts down the network core (as that is needed for some platforms.
bool NetworkCoreInitialize()
Initializes the network core (as that is needed for some platforms.
Internal entity of a packet.