OpenTTD Source
20241108-master-g80f628063a
|
Simple helper to (more easily) manage authorized keys. More...
#include <network_type.h>
Public Member Functions | |
bool | Contains (std::string_view key) const |
Check whether the given key is contains in these authorized keys. More... | |
bool | Add (std::string_view key) |
Add the given key to the authorized keys, when it is not already contained. More... | |
bool | Remove (std::string_view key) |
Remove the given key from the authorized keys, when it is exists. More... | |
Simple helper to (more easily) manage authorized keys.
The authorized keys are hexadecimal representations of their binary form. The authorized keys are case insensitive.
Definition at line 148 of file network_type.h.
bool NetworkAuthorizedKeys::Add | ( | std::string_view | key | ) |
Add the given key to the authorized keys, when it is not already contained.
key | The key to add. |
true
when the key was added, false
when the key already existed or the key was empty. Definition at line 190 of file network.cpp.
References FindKey().
bool NetworkAuthorizedKeys::Contains | ( | std::string_view | key | ) | const |
Check whether the given key is contains in these authorized keys.
key | The key to look for. |
true
when the key has been found, otherwise false
. Definition at line 180 of file network.cpp.
References FindKey().
Referenced by NetworkClientInfo::CanJoinCompany(), and NetworkAuthenticationDefaultAuthorizedKeyHandler::IsAllowed().
bool NetworkAuthorizedKeys::Remove | ( | std::string_view | key | ) |
Remove the given key from the authorized keys, when it is exists.
key | The key to remove. |
true
when the key was removed, false
when the key did not exist. Definition at line 206 of file network.cpp.
References FindKey().