OpenTTD Source 20241224-master-gf74b0cf984
NetworkAuthorizedKeys Class Reference

Simple helper to (more easily) manage authorized keys. More...

#include <network_type.h>

Inheritance diagram for NetworkAuthorizedKeys:

Public Member Functions

bool Contains (std::string_view key) const
 Check whether the given key is contains in these authorized keys.
 
bool Add (std::string_view key)
 Add the given key to the authorized keys, when it is not already contained.
 
bool Remove (std::string_view key)
 Remove the given key from the authorized keys, when it is exists.
 

Detailed Description

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.

Member Function Documentation

◆ Add()

bool NetworkAuthorizedKeys::Add ( std::string_view  key)

Add the given key to the authorized keys, when it is not already contained.

Parameters
keyThe key to add.
Returns
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().

◆ Contains()

bool NetworkAuthorizedKeys::Contains ( std::string_view  key) const

Check whether the given key is contains in these authorized keys.

Parameters
keyThe key to look for.
Returns
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().

◆ Remove()

bool NetworkAuthorizedKeys::Remove ( std::string_view  key)

Remove the given key from the authorized keys, when it is exists.

Parameters
keyThe key to remove.
Returns
true when the key was removed, false when the key did not exist.

Definition at line 204 of file network.cpp.

References FindKey().


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