SuperTuxKart
Loading...
Searching...
No Matches
Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
ConnectToServer Class Reference
Inheritance diagram for ConnectToServer:
Inheritance graph
[legend]

Public Member Functions

 ConnectToServer (std::shared_ptr< Server > server)
 Specify server to connect to.
 
virtual ~ConnectToServer ()
 Destructor.
 
virtual void setup () OVERRIDE
 Initialise the protocol.
 
virtual void asynchronousUpdate () OVERRIDE
 Called by the protocol listener as often as possible.
 
virtual void update (int ticks) OVERRIDE
 Called by the protocol listener, synchronously with the main loop.
 
- Public Member Functions inherited from Protocol
 Protocol (ProtocolType type)
 Constructor Sets the basic protocol parameters, as the callback object and the protocol type.
 
virtual ~Protocol ()
 Destructor.
 
virtual void setup ()=0
 Called when the protocol is going to start.
 
virtual void update (int ticks)=0
 Called by the protocol listener, synchronously with the main loop.
 
virtual void asynchronousUpdate ()=0
 Called by the protocol listener as often as possible.
 
NetworkStringgetNetworkString (size_t capacity=16) const
 functions to check incoming data easily
 
bool checkDataSize (Event *event, unsigned int minimum_size)
 Checks if the message has at least the specified size, and if not prints a warning message including the message content.
 
void sendMessageToPeers (NetworkString *message, bool reliable=true)
 Sends a message to all validated peers in game, encrypt the message if needed.
 
void sendMessageToPeersInServer (NetworkString *message, bool reliable=true)
 Sends a message to all validated peers in server, encrypt the message if needed.
 
void sendToServer (NetworkString *message, bool reliable=true)
 Sends a message from a client to the server.
 
virtual void requestStart ()
 Starts a request in the protocol manager to start this protocol.
 
virtual void requestTerminate ()
 Submits a request to the ProtocolManager to terminate this protocol.
 
virtual bool notifyEvent (Event *event)
 Notify a protocol matching the Event type of that event.
 
virtual bool notifyEventAsynchronous (Event *event)
 Notify a protocol matching the Event type of that event.
 
ProtocolType getProtocolType () const
 Method to get a protocol's type.
 
void setHandleConnections (bool b)
 Sets if this protocol should receive connection events.
 
void setHandleDisconnections (bool b)
 Sets if this protocol should receive disconnection events.
 
virtual bool handleConnects () const
 Return true if this protocol should be informed about connects.
 
virtual bool handleDisconnects () const
 Return true if this protocol should be informed about disconnects.
 

Private Types

enum  ConnectState : unsigned int { SET_PUBLIC_ADDRESS , GOT_SERVER_ADDRESS , DONE , EXITING }
 State for finite state machine.
 

Private Member Functions

void getClientServerInfo ()
 
bool registerWithSTKServer ()
 Register this client with the STK server.
 
bool tryConnect (int timeout, int retry, bool another_port=false, bool ipv6=false)
 
bool detectPort ()
 

Static Private Member Functions

static int interceptCallback (ENetHost *host, ENetEvent *event)
 Intercept callback in enet to allow change server address and port if needed (Happens when there is firewall in between)
 

Private Attributes

std::shared_ptr< Serverm_server
 
irr::core::stringw m_error_msg
 
std::atomic< ConnectStatem_state
 

Static Private Attributes

static ENetAddress m_server_address
 
static int m_retry_count = 0
 
static bool m_done_intecept = false
 

Additional Inherited Members

- Protected Attributes inherited from Protocol
ProtocolType m_type
 The type of the protocol.
 
bool m_handle_connections
 True if this protocol should receive connection events.
 
bool m_handle_disconnections
 TRue if this protocol should recceiver disconnection events.
 

Constructor & Destructor Documentation

◆ ConnectToServer()

ConnectToServer::ConnectToServer ( std::shared_ptr< Server server)

Specify server to connect to.

Parameters
serverServer to connect to (if nullptr than we use quick play).

Member Function Documentation

◆ asynchronousUpdate()

void ConnectToServer::asynchronousUpdate ( )
virtual

Called by the protocol listener as often as possible.

Must be re-defined.

Implements Protocol.

◆ setup()

void ConnectToServer::setup ( )
virtual

Initialise the protocol.

Implements Protocol.

◆ update()

void ConnectToServer::update ( int  ticks)
virtual

Called by the protocol listener, synchronously with the main loop.

Must be re-defined.

Implements Protocol.


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