Leosac  0.8.0
Open Source Access Control
Leosac Namespace Reference

This is the header file for a generated source file, GitSHA1.cpp. More...

Namespaces

 Audit
 The Audit namespace provides classes and facilities to keep track of what's happening on the Leosac deamon.
 
 Auth
 Holds classes relevant to the Authentication and Authorization subsystem.
 
 Colorize
 A collection of function to colorize / format text.
 
 Cred
 
 db
 
 Ex
 
 Hardware
 Provides facade classes to hardware device implementation.
 
 JSONUtil
 Add a few useful extraction functions.
 
 Module
 All modules that provides features to Leosac shall be in this namespace.
 
 service_event
 
 Tasks
 
 Test
 Unit test live in this namespace.
 
 Tools
 
 update
 

Classes

struct  AccessPointJSONSerializer
 A serializer that handle Auth::AccessPoint object. More...
 
struct  AccessPointJSONStringSerializer
 
struct  AtMostOneCombiner
 A boost::signals2 combiner that makes sure that at most one slot returns a non-null pointer. More...
 
class  ConfigChecker
 This class is here to help check the validity of the configuration. More...
 
class  ConfigManager
 That class helps manage the configuration for the application and its module. More...
 
class  CoreAPI
 CoreAPI is a class for interact with Leosac's core. More...
 
class  CoreUtils
 This class is part of Leosac::Kernel, but it only exposes thread-safe functionalities that may be used by every modules. More...
 
struct  CredentialJSONSerializer
 A serializer that handle Cred::ICredential object. More...
 
struct  CredentialJSONStringSerializer
 
class  DBService
 Provides various database-related services to consumer. More...
 
struct  DoorJSONSerializer
 A serializer that handle Auth::Door object. More...
 
struct  DoorJSONStringSerializer
 
class  EntityNotFound
 
struct  ExecutionContext
 An ExecutionContext is passed around to service so they have context about who is making the call and how. More...
 
class  ExtensibleSerializer
 Provides dynamic serializers management for a given object's hierarchy. More...
 
class  GlobalRegistry
 An application wide registry that can store objects of any type. More...
 
struct  GroupJSONSerializer
 A serializer that handle Auth::Group object. More...
 
struct  GroupJSONStringSerializer
 
class  InvalidArgument
 A class to represents invalid argument exception in Leosac. More...
 
struct  is_shared_ptr
 
struct  is_shared_ptr< const std::shared_ptr< T > & >
 
struct  is_shared_ptr< const std::shared_ptr< T > >
 
struct  is_shared_ptr< std::shared_ptr< T > & >
 
struct  is_shared_ptr< std::shared_ptr< T > >
 
struct  JSONSerializer
 A JSON serializer that can serialize an object of type T. More...
 
class  Kernel
 Core of Leosac. More...
 
struct  MailInfo
 
class  NetworkConfig
 Class that helps configuring the network. More...
 
class  NullSecurityContext
 A SecurityContext with no permission. More...
 
struct  PinCodeJSONSerializer
 A serializer that handle Cred::IPinCode object. More...
 
struct  PolymorphicCredentialJSONSerializer
 A serializer that handle any subclass of ICredential. More...
 
struct  PolymorphicCredentialJSONStringSerializer
 Serialize the object as a JSON string. More...
 
class  Registry
 A simple container that can holds object of any type. More...
 
class  RegistryKeyNotFoundException
 
class  RemoteConfigCollector
 This class provides an API to collect the configuration of a remote Leosac unit. More...
 
class  RemoteControl
 This class handle the remote control of leosac. More...
 
class  RemoteControlSecurity
 Provide some kind of security framework to the Remote Control service. More...
 
struct  RFIDCardJSONSerializer
 A serializer that handle Cred::IRFIDCard object. More...
 
class  Scheduler
 This is a scheduler that is used internally to schedule asynchronous / long running tasks. More...
 
class  SecurityContext
 A SecurityContext is used to query permission while doing an operation. More...
 
class  ServiceRegistry
 A class that manages services. More...
 
class  SMTPService
 Reference interface for SMTP module. More...
 
struct  SystemExecutionContext
 
class  SystemSecurityContext
 A security context for system operation. More...
 
struct  TestAccess
 This is class that can be used to access some object's internal. More...
 
class  ThreadLocalRegistry
 A simple, thread-local container to share various type of objects. More...
 
struct  UserGroupMembershipJSONSerializer
 A serializer that handle Auth::UserGroupMembership object. More...
 
struct  UserGroupMembershipJSONStringSerializer
 
struct  UserJSONSerializer
 A serializer that handle Auth::User object. More...
 
struct  UserJSONStringSerializer
 
class  UserSecurityContext
 A SecurityContext object for users. More...
 
class  UUID
 Thin wrapper around boost::uuids::uuid. More...
 
struct  VectorAppenderCombiner
 A shortname for the boost::signals2 namespace. More...
 
struct  ZoneJSONSerializer
 A serializer that handle Auth::Zone object. More...
 
struct  ZoneJSONStringSerializer
 

Typedefs

using json = nlohmann::json
 
using SchedulerPtr = std::shared_ptr< Scheduler >
 
using ConfigCheckerPtr = std::shared_ptr< ConfigChecker >
 
using CoreUtilsPtr = std::shared_ptr< CoreUtils >
 
using ByteVector = std::vector< uint8_t >
 
using DBPtr = std::shared_ptr< odb::database >
 
using DBServicePtr = std::shared_ptr< DBService >
 
using ServiceRegistryUPtr = std::unique_ptr< ServiceRegistry >
 

Enumerations

enum  APIStatusCode {
  APIStatusCode::SUCCESS = 0x00, APIStatusCode::GENERAL_FAILURE = 0x01, APIStatusCode::PERMISSION_DENIED = 0x02, APIStatusCode::RATE_LIMITED = 0x03,
  APIStatusCode::MALFORMED = 0x04, APIStatusCode::INVALID_CALL = 0x05, APIStatusCode::TIMEOUT = 0x06, APIStatusCode::SESSION_ABORTED = 0x07,
  APIStatusCode::ENTITY_NOT_FOUND = 0x08, APIStatusCode::DATABASE_ERROR = 0x09, APIStatusCode::UNKNOWN = 0x0A, APIStatusCode::MODEL_EXCEPTION = 0x0B,
  APIStatusCode::INVALID_ARGUMENT = 0x0C
}
 Those are the Leosac API status code. More...
 
enum  TargetThread { TargetThread::MAIN, TargetThread::POOL }
 

Functions

ServiceRegistryget_service_registry ()
 A function to retrieve the ServiceRegistry from pretty much anywhere. More...
 
void print_exception (const std::exception &e, int level=0)
 Recursively print the exception trace to std::cerr. More...
 
void log_exception (const std::exception &e, int level=0)
 Recursively log exceptions using the logging macro. More...
 
template<typename Out , typename In >
std::enable_if_t< is_shared_ptr_v< Out >, Out > assert_cast (const std::shared_ptr< In > &in)
 
template<typename Out , typename In >
std::enable_if_t<!is_shared_ptr_v< Out > &&!std::is_pointer< Out >::value, Out && > assert_cast (In &&in)
 
template<typename Out , typename In >
std::enable_if_t< std::is_pointer< Out >::value &&std::is_pointer< In >::value, Out > assert_cast (In &&in)
 
std::string gen_uuid ()
 Generate a new UUID. More...
 
bool my_puttime (std::string &out, const std::tm *tt, const char *fmt)
 
std::string to_local_rfc2822 (const std::chrono::system_clock::time_point &tp)
 Convert a timepoint to an RFC2822 (SMTP) date. More...
 
uint64_t gettid ()
 Return the Linux thread ID. More...
 
void set_thread_name (const std::string &name)
 Set the name of the current thread. More...
 

Variables

template<typename T >
constexpr bool is_shared_ptr_v = is_shared_ptr<T>::value
 

Detailed Description

This is the header file for a generated source file, GitSHA1.cpp.

CMake generates that file from the GitSHA1.cpp.in file.

Typedef Documentation

◆ ByteVector

using Leosac::ByteVector = typedef std::vector<uint8_t>

Definition at line 37 of file LeosacFwd.hpp.

◆ ConfigCheckerPtr

using Leosac::ConfigCheckerPtr = typedef std::shared_ptr<ConfigChecker>

Definition at line 32 of file LeosacFwd.hpp.

◆ CoreUtilsPtr

using Leosac::CoreUtilsPtr = typedef std::shared_ptr<CoreUtils>

Definition at line 35 of file LeosacFwd.hpp.

◆ DBPtr

using Leosac::DBPtr = typedef std::shared_ptr<odb::database>

Definition at line 31 of file db_fwd.hpp.

◆ DBServicePtr

using Leosac::DBServicePtr = typedef std::shared_ptr<DBService>

Definition at line 34 of file db_fwd.hpp.

◆ json

typedef nlohmann::json Leosac::json

Definition at line 29 of file AuditSerializer.hpp.

◆ SchedulerPtr

using Leosac::SchedulerPtr = typedef std::shared_ptr<Scheduler>

Definition at line 31 of file LeosacFwd.hpp.

◆ ServiceRegistryUPtr

using Leosac::ServiceRegistryUPtr = typedef std::unique_ptr<ServiceRegistry>

Definition at line 27 of file ServiceFwd.hpp.

Enumeration Type Documentation

◆ APIStatusCode

enum Leosac::APIStatusCode
strong

Those are the Leosac API status code.

They currently apply only to the WebSocket API.

Note
This enum is provided by core because the audit system relies on it.
Enumerator
SUCCESS 

Indicate that the request's processing went well.

GENERAL_FAILURE 

A failure for an unknown reason.

PERMISSION_DENIED 

The websocket connection is not allowed to make the requested API call.

RATE_LIMITED 

The websocket connection is rate limited, and it already sent too many packets.

MALFORMED 

The source packet was malformed.

INVALID_CALL 

The API method (ie, message's type) does not exist.

TIMEOUT 

The request took too long to process.

This is mostly here as a placeholder, as this status_code will mostly be used internaly by the Javascript web app to signal a lack of response.

SESSION_ABORTED 

The session has been aborted.

This is likely due to the expiration of the token used to authenticate.

ENTITY_NOT_FOUND 

The requested entity cannot be found.

DATABASE_ERROR 

An internal database operation threw an exception.

UNKNOWN 

Unknown status.

Mostly useful as a default value somewhere.

MODEL_EXCEPTION 

Some internal API rules has failed.

This is likely to model validation.

INVALID_ARGUMENT 

One of the argument of the call had a invalid value / type.

Definition at line 31 of file APIStatusCode.hpp.

◆ TargetThread

enum Leosac::TargetThread
strong
Enumerator
MAIN 
POOL 

Definition at line 32 of file Scheduler.hpp.

Function Documentation

◆ assert_cast() [1/3]

template<typename Out , typename In >
std::enable_if_t<is_shared_ptr_v<Out>, Out> Leosac::assert_cast ( const std::shared_ptr< In > &  in)

Definition at line 58 of file AssertCast.hpp.

◆ assert_cast() [2/3]

template<typename Out , typename In >
std::enable_if_t<!is_shared_ptr_v<Out> && !std::is_pointer<Out>::value, Out &&> Leosac::assert_cast ( In &&  in)

Definition at line 75 of file AssertCast.hpp.

◆ assert_cast() [3/3]

template<typename Out , typename In >
std::enable_if_t<std::is_pointer<Out>::value && std::is_pointer<In>::value, Out> Leosac::assert_cast ( In &&  in)

Definition at line 91 of file AssertCast.hpp.

◆ gen_uuid()

std::string Leosac::gen_uuid ( )

Generate a new UUID.

Definition at line 26 of file GenGuid.cpp.

◆ get_service_registry()

ServiceRegistry & Leosac::get_service_registry ( )

A function to retrieve the ServiceRegistry from pretty much anywhere.

The only requirement is that a Kernel object is currently alive.

Definition at line 25 of file GetServiceRegistry.cpp.

◆ gettid()

uint64_t Leosac::gettid ( )

Return the Linux thread ID.

Definition at line 32 of file ThreadUtils.cpp.

◆ log_exception()

void Leosac::log_exception ( const std::exception &  e,
int  level = 0 
)

Recursively log exceptions using the logging macro.

Definition at line 62 of file ExceptionsTools.cpp.

◆ my_puttime()

bool Leosac::my_puttime ( std::string &  out,
const std::tm *  tt,
const char *  fmt 
)

Definition at line 29 of file MyTime.cpp.

◆ print_exception()

void Leosac::print_exception ( const std::exception &  e,
int  level = 0 
)

Recursively print the exception trace to std::cerr.

Definition at line 44 of file ExceptionsTools.cpp.

◆ set_thread_name()

void Leosac::set_thread_name ( const std::string &  name)

Set the name of the current thread.

The maximum length of the name is 15 bytes. If the size of name exceed 15 bytes, the name is silently truncated.

Throws on failure.

Definition at line 37 of file ThreadUtils.cpp.

◆ to_local_rfc2822()

std::string Leosac::to_local_rfc2822 ( const std::chrono::system_clock::time_point &  tp)

Convert a timepoint to an RFC2822 (SMTP) date.

The time represent the local time.

Definition at line 45 of file MyTime.cpp.

Variable Documentation

◆ is_shared_ptr_v

template<typename T >
constexpr bool Leosac::is_shared_ptr_v = is_shared_ptr<T>::value
constexpr

Definition at line 54 of file AssertCast.hpp.