OpenTTD Source
20241120-master-g6d3adc6169
|
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 188 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 178 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 204 of file network.cpp.
References FindKey().