|
OpenTTD Source 20251104-master-g3befbdd52f
|
Base socket handler for all STUN TCP sockets. More...
#include <tcp_stun.h>
Public Member Functions | |
| NetworkStunSocketHandler (SOCKET s=INVALID_SOCKET) | |
| Create a new cs socket handler for a given cs. | |
Public Member Functions inherited from NetworkTCPSocketHandler | |
| bool | IsConnected () const |
| Whether this socket is currently bound to a socket. | |
| virtual NetworkRecvStatus | CloseConnection (bool error=true) |
| This will put this socket handler in a close state. | |
| void | CloseSocket () |
| Close the actual socket of the connection. | |
| virtual void | SendPacket (std::unique_ptr< Packet > &&packet) |
| This function puts the packet in the send-queue and it is send as soon as possible. | |
| SendPacketsState | SendPackets (bool closing_down=false) |
| Sends all the buffered packets out for this client. | |
| virtual std::unique_ptr< Packet > | ReceivePacket () |
| Receives a packet for the given client. | |
| bool | CanSendReceive () |
| Check whether this socket can send or receive something. | |
| bool | HasSendQueue () |
| Whether there is something pending in the send queue. | |
| NetworkTCPSocketHandler (SOCKET s=INVALID_SOCKET) | |
| Construct a socket handler for a TCP connection. | |
Public Member Functions inherited from NetworkSocketHandler | |
| NetworkSocketHandler ()=default | |
| Create a new unbound socket. | |
| 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. | |
| void | Reopen () |
| Reopen the socket so we can send/receive stuff again. | |
Protected Member Functions | |
| bool | ReceiveInvalidPacket (PacketStunType type) |
| Helper for logging receiving invalid packets. | |
| virtual bool | Receive_SERCLI_STUN (Packet &p) |
| Send a STUN request to the STUN server letting the Game Coordinator know what our actually public IP:port is. | |
Additional Inherited Members | |
Data Fields inherited from NetworkTCPSocketHandler | |
| SOCKET | sock = INVALID_SOCKET |
| The socket currently connected to. | |
| bool | writable = false |
| Can we write to this socket? | |
Protected Attributes inherited from NetworkSocketHandler | |
| std::unique_ptr< class NetworkEncryptionHandler > | receive_encryption_handler = nullptr |
| The handler for decrypting received packets. | |
| std::unique_ptr< class NetworkEncryptionHandler > | send_encryption_handler = nullptr |
| The handler for encrypting sent packets. | |
Base socket handler for all STUN TCP sockets.
Definition at line 26 of file tcp_stun.h.
|
inline |
Create a new cs socket handler for a given cs.
| s | the socket we are connected with. |
| address | IP etc. of the client. |
Definition at line 50 of file tcp_stun.h.
|
protectedvirtual |
Send a STUN request to the STUN server letting the Game Coordinator know what our actually public IP:port is.
uint8_t Game Coordinator protocol version. string Token to track the current STUN request. uint8_t Which interface number this is (for example, IPv4 or IPv6). The Game Coordinator relays this number back in later packets.
| p | The packet that was just received. |
Definition at line 29 of file tcp_stun.cpp.
References PACKET_STUN_SERCLI_STUN, and ReceiveInvalidPacket().
|
protected |
Helper for logging receiving invalid packets.
| type | The received packet type. |
Definition at line 23 of file tcp_stun.cpp.
References Debug.
Referenced by Receive_SERCLI_STUN().