Go to the documentation of this file.
12 #ifndef NETWORK_CORE_CORE_H
13 #define NETWORK_CORE_CORE_H
15 #include "../../newgrf_config.h"
72 void Reopen() { this->has_quit =
false; }
Simple calculated statistics of a company.
@ NETWORK_RECV_STATUS_DESYNC
A desync did occur.
SocketHandler for all network sockets in OpenTTD.
virtual NetworkRecvStatus CloseConnection(bool error=true)
Close the current connection; for TCP this will be mostly equivalent to Close(), but for UDP it just ...
bool has_quit
Whether the current client has quit/send a bad packet.
void NetworkCoreShutdown()
Shuts down the network core (as that is needed for some platforms.
@ NETWORK_RECV_STATUS_CONN_LOST
The connection is 'just' lost.
void Reopen()
Reopen the socket so we can send/receive stuff again.
@ NETWORK_RECV_STATUS_NEWGRF_MISMATCH
We did not have the required NewGRFs.
@ NETWORK_RECV_STATUS_SERVER_FULL
The server is full.
@ NETWORK_RECV_STATUS_SERVER_ERROR
The server told us we made an error.
NetworkSocketHandler()
Create a new unbound socket.
@ NETWORK_RECV_STATUS_SERVER_BANNED
The server has banned us.
@ NETWORK_RECV_STATUS_CLOSE_QUERY
Done querying the server.
Internal entity of a packet.
bool HasClientQuit() const
Whether the current client connected to the socket has quit.
virtual ~NetworkSocketHandler()
Close the socket when destructing the socket handler.
NetworkRecvStatus
Status of a network client; reasons why a client has quit.
bool NetworkCoreInitialize()
Initializes the network core (as that is needed for some platforms.
void CDECL error(const char *s,...)
Error handling for fatal non-user errors.
void SendCompanyInformation(Packet *p, const struct Company *c, const struct NetworkCompanyStats *stats, uint max_len=NETWORK_COMPANY_NAME_LENGTH)
Package some generic company information into a packet.
@ NETWORK_RECV_STATUS_OKAY
Everything is okay.
virtual void Close()
Really close the socket.
@ NETWORK_RECV_STATUS_SAVEGAME
Something went wrong (down)loading the savegame.
@ NETWORK_RECV_STATUS_MALFORMED_PACKET
We apparently send a malformed packet.
static const uint NETWORK_COMPANY_NAME_LENGTH
The maximum length of the company name, in bytes including '\0'.