OpenTTD Source  20241108-master-g80f628063a
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. 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...
 

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 190 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 180 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 206 of file network.cpp.

References FindKey().


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