|
OpenTTD Source 20251104-master-g3befbdd52f
|
Handler for combining a number of authentication handlers, where the failure of one of the handlers will retry with another handler. More...
#include <network_crypto_internal.h>
Public Types | |
| using | Handler = std::unique_ptr< NetworkAuthenticationClientHandler > |
| The type of the inner handlers. | |
Public Types inherited from NetworkAuthenticationClientHandler | |
| enum class | RequestResult : uint8_t { AwaitUserInput , ReadyForResponse , Invalid } |
| The processing result of receiving a request. More... | |
Public Member Functions | |
| void | Add (Handler &&handler) |
| Add the given sub-handler to this handler. | |
| virtual RequestResult | ReceiveRequest (struct Packet &p) override |
| Read a request from the server. | |
| virtual bool | SendResponse (struct Packet &p) override |
| Create the response to send to the server. | |
| virtual std::string_view | GetName () const override |
| Get the name of the handler for debug messages. | |
| virtual NetworkAuthenticationMethod | GetAuthenticationMethod () const override |
| Get the method this handler is providing functionality for. | |
| virtual bool | ReceiveEnableEncryption (struct Packet &p) override |
| Read the request to enable encryption from the server. | |
| virtual std::unique_ptr< NetworkEncryptionHandler > | CreateClientToServerEncryptionHandler () const override |
| Create a NetworkEncryptionHandler to encrypt or decrypt messages from the client to the server. | |
| virtual std::unique_ptr< NetworkEncryptionHandler > | CreateServerToClientEncryptionHandler () const override |
| Create a NetworkEncryptionHandler to encrypt or decrypt messages from the server to the client. | |
Private Attributes | |
| std::vector< Handler > | handlers |
| The handlers that we can authenticate with. | |
| NetworkAuthenticationClientHandler * | current_handler = nullptr |
| The currently active handler. | |
Additional Inherited Members | |
Static Public Member Functions inherited from NetworkAuthenticationClientHandler | |
| static void | EnsureValidSecretKeyAndUpdatePublicKey (std::string &secret_key, std::string &public_key) |
| Ensures that the given secret key is valid, and when not overwrite it with a valid secret key. | |
| static std::unique_ptr< NetworkAuthenticationClientHandler > | Create (std::shared_ptr< NetworkAuthenticationPasswordRequestHandler > password_handler, std::string &secret_key, std::string &public_key) |
| Create a NetworkAuthenticationClientHandler. | |
Handler for combining a number of authentication handlers, where the failure of one of the handlers will retry with another handler.
For example when authorized keys fail, it can still fall back to a password.
Definition at line 300 of file network_crypto_internal.h.
| using CombinedAuthenticationClientHandler::Handler = std::unique_ptr<NetworkAuthenticationClientHandler> |
The type of the inner handlers.
Definition at line 302 of file network_crypto_internal.h.
|
inline |
Add the given sub-handler to this handler.
| handler | The handler to add. |
Definition at line 313 of file network_crypto_internal.h.
|
inlineoverridevirtual |
Create a NetworkEncryptionHandler to encrypt or decrypt messages from the client to the server.
Implements NetworkAuthenticationHandler.
Definition at line 322 of file network_crypto_internal.h.
References NetworkAuthenticationHandler::CreateClientToServerEncryptionHandler().
|
inlineoverridevirtual |
Create a NetworkEncryptionHandler to encrypt or decrypt messages from the server to the client.
Implements NetworkAuthenticationHandler.
Definition at line 323 of file network_crypto_internal.h.
References NetworkAuthenticationHandler::CreateServerToClientEncryptionHandler().
|
overridevirtual |
Get the method this handler is providing functionality for.
NetworkAuthenticationMethod. Implements NetworkAuthenticationHandler.
Definition at line 387 of file network_crypto.cpp.
References current_handler, End, and NetworkAuthenticationHandler::GetAuthenticationMethod().
|
overridevirtual |
Get the name of the handler for debug messages.
Implements NetworkAuthenticationHandler.
Definition at line 382 of file network_crypto.cpp.
References current_handler, and NetworkAuthenticationHandler::GetName().
Referenced by ReceiveRequest(), and SendResponse().
|
inlineoverridevirtual |
Read the request to enable encryption from the server.
| p | The request from the server. |
Implements NetworkAuthenticationClientHandler.
Definition at line 321 of file network_crypto_internal.h.
References NetworkAuthenticationClientHandler::ReceiveEnableEncryption().
|
overridevirtual |
Read a request from the server.
| p | The packet to read the request from. |
Implements NetworkAuthenticationClientHandler.
Definition at line 361 of file network_crypto.cpp.
References current_handler, Debug, GetName(), handlers, NetworkAuthenticationClientHandler::Invalid, NetworkAuthenticationClientHandler::ReceiveRequest(), and Packet::Recv_uint8().
|
overridevirtual |
Create the response to send to the server.
| p | The packet to write the response from. |
Implements NetworkAuthenticationClientHandler.
Definition at line 375 of file network_crypto.cpp.
References current_handler, Debug, GetName(), and NetworkAuthenticationClientHandler::SendResponse().
|
private |
The currently active handler.
Definition at line 306 of file network_crypto_internal.h.
Referenced by GetAuthenticationMethod(), GetName(), ReceiveRequest(), and SendResponse().
|
private |
The handlers that we can authenticate with.
Definition at line 305 of file network_crypto_internal.h.
Referenced by ReceiveRequest().