NetworkSocketHandler Class Reference

SocketHandler for all network sockets in OpenTTD. More...

#include <core.h>

Inheritance diagram for NetworkSocketHandler:
NetworkHTTPSocketHandler NetworkTCPSocketHandler NetworkUDPSocketHandler NetworkAdminSocketHandler NetworkContentSocketHandler NetworkGameSocketHandler ClientNetworkUDPSocketHandler MasterNetworkUDPSocketHandler ServerNetworkUDPSocketHandler ServerNetworkAdminSocketHandler ClientNetworkContentSocketHandler ClientNetworkGameSocketHandler ServerNetworkGameSocketHandler

Public Member Functions

 NetworkSocketHandler ()
 Create a new unbound socket.
virtual ~NetworkSocketHandler ()
 Close the socket when distructing the socket handler.
virtual void Close ()
 Really close the socket.
virtual NetworkRecvStatus CloseConnection (bool error=true)
 Close the current connection; for TCP this will be mostly equivalent to Close(), but for UDP it just means the packet has to be dropped.
bool HasClientQuit () const
 Whether the current client connected to the socket has quit.
void Reopen ()
 Reopen the socket so we can send/receive stuff again.
void SendGRFIdentifier (Packet *p, const GRFIdentifier *grf)
 Serializes the GRFIdentifier (GRF ID and MD5 checksum) to the packet.
void ReceiveGRFIdentifier (Packet *p, GRFIdentifier *grf)
 Deserializes the GRFIdentifier (GRF ID and MD5 checksum) from the packet.
void SendCompanyInformation (Packet *p, const struct Company *c, const struct NetworkCompanyStats *stats, uint max_len=NETWORK_COMPANY_NAME_LENGTH)

Private Attributes

bool has_quit
 Whether the current client has quit/send a bad packet.

Detailed Description

SocketHandler for all network sockets in OpenTTD.

Definition at line 45 of file core.h.


Member Function Documentation

virtual NetworkRecvStatus NetworkSocketHandler::CloseConnection ( bool  error = true  )  [inline, virtual]

Close the current connection; for TCP this will be mostly equivalent to Close(), but for UDP it just means the packet has to be dropped.

Parameters:
error Whether we quit under an error condition or not.
Returns:
new status of the connection.

Reimplemented in NetworkTCPSocketHandler, NetworkAdminSocketHandler, NetworkGameSocketHandler, NetworkHTTPSocketHandler, and NetworkUDPSocketHandler.

Definition at line 63 of file core.h.

References has_quit, and NETWORK_RECV_STATUS_OKAY.

bool NetworkSocketHandler::HasClientQuit (  )  const [inline]
void NetworkSocketHandler::ReceiveGRFIdentifier ( Packet p,
GRFIdentifier grf 
)
void NetworkSocketHandler::SendGRFIdentifier ( Packet p,
const GRFIdentifier grf 
)

The documentation for this class was generated from the following files:

Generated on Fri May 27 04:20:55 2011 for OpenTTD by  doxygen 1.6.1