plugin  2.1.3
Runtime plugin loader and Ed25519 DSO signing for C++ applications
fedem::dso::DSOLoader Class Reference

#include <DSOLoader.hh>

+ Collaboration diagram for fedem::dso::DSOLoader:

Static Public Member Functions

static void load (std::string const &soName)
 
static void load (std::string const &soName, std::vector< std::string > const &list)
 
static void loadAll (std::string const &extension, std::string const &folder)
 
static void loadAll (std::string const &extension)
 
static void loadAll (std::string const &extension, std::vector< std::string > const &list)
 
static void loadAllByEnvironment (std::string const &extension, std::string const &env)
 
static void loadAllByEnvironment (std::string const &extension)
 
static void prefix (std::string const &pre)
 
static std::string prefix ()
 
static SignedLoadResult loadSigned (std::string const &soName, std::vector< std::string > const &searchDirs, std::string const &trustedKeysDir)
 
static void loadVerified (std::string const &soName, std::vector< std::string > const &searchDirs, std::string const &trustedKeysDir, sign::TrustLevel minTrust)
 

Private Member Functions

 DSOLoader ()=delete
 
 ~DSOLoader ()=delete
 
 DSOLoader (DSOLoader const &)=delete
 
 DSOLoader (DSOLoader &&)=delete
 
DSOLoaderoperator= (DSOLoader const &)=delete
 
DSOLoaderoperator= (DSOLoader &&)=delete
 

Static Private Member Functions

static std::string loadSingle (std::string const &soName)
 
static void scanDirectory (std::string const &extension, std::string const &folder, std::string &missingFiles)
 

Static Private Attributes

static std::string filenamePrefix
 
static std::mutex mutex_
 

Detailed Description

Thread-safe DSO loader.

Loading variants ──────────────── load() — load without any signature check (always available) loadSigned() — load and report trust level (requires DSOLD_WITH_SIGN) loadVerified() — load only when trust >= min (requires DSOLD_WITH_SIGN)

Constructor & Destructor Documentation

◆ DSOLoader() [1/3]

fedem::dso::DSOLoader::DSOLoader ( )
privatedelete

◆ ~DSOLoader()

fedem::dso::DSOLoader::~DSOLoader ( )
privatedelete

◆ DSOLoader() [2/3]

fedem::dso::DSOLoader::DSOLoader ( DSOLoader const &  )
privatedelete

◆ DSOLoader() [3/3]

fedem::dso::DSOLoader::DSOLoader ( DSOLoader &&  )
privatedelete

Member Function Documentation

◆ load() [1/2]

void fedem::dso::DSOLoader::load ( std::string const &  soName)
static

References loadSingle(), and mutex_.

Referenced by plugin::Plugin< Base >::load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load() [2/2]

void fedem::dso::DSOLoader::load ( std::string const &  soName,
std::vector< std::string > const &  list 
)
static

References loadSingle(), mutex_, and fedem::exception::FileNotFound::whatStr().

+ Here is the call graph for this function:

◆ loadAll() [1/3]

void fedem::dso::DSOLoader::loadAll ( std::string const &  extension,
std::string const &  folder 
)
static

References mutex_, and scanDirectory().

+ Here is the call graph for this function:

◆ loadAll() [2/3]

void fedem::dso::DSOLoader::loadAll ( std::string const &  extension)
static

References mutex_, and scanDirectory().

+ Here is the call graph for this function:

◆ loadAll() [3/3]

void fedem::dso::DSOLoader::loadAll ( std::string const &  extension,
std::vector< std::string > const &  list 
)
static

References mutex_, and scanDirectory().

+ Here is the call graph for this function:

◆ loadAllByEnvironment() [1/2]

void fedem::dso::DSOLoader::loadAllByEnvironment ( std::string const &  extension,
std::string const &  env 
)
static

References mutex_, PATH_SEPARATOR, and scanDirectory().

Referenced by loadAllByEnvironment().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadAllByEnvironment() [2/2]

void fedem::dso::DSOLoader::loadAllByEnvironment ( std::string const &  extension)
static

References LIBPATH, and loadAllByEnvironment().

+ Here is the call graph for this function:

◆ prefix() [1/2]

void fedem::dso::DSOLoader::prefix ( std::string const &  pre)
static

References filenamePrefix, and mutex_.

◆ prefix() [2/2]

std::string fedem::dso::DSOLoader::prefix ( )
static

References filenamePrefix, and mutex_.

◆ loadSigned()

SignedLoadResult fedem::dso::DSOLoader::loadSigned ( std::string const &  soName,
std::vector< std::string > const &  searchDirs,
std::string const &  trustedKeysDir 
)
static

Load DSO and verify its signature. Loading is never blocked — the caller receives the trust level and decides what to do.

References fedem::dso::SignedLoadResult::detail, fedem::sign::VerifyResult::detail, fedem::dso::SignedLoadResult::loaded, loadSingle(), mutex_, fedem::dso::SignedLoadResult::soPath, fedem::dso::SignedLoadResult::trust, fedem::sign::VerifyResult::trust, fedem::sign::UNSIGNED, fedem::sign::Verifier::verify(), and fedem::exception::FileNotFound::whatStr().

Referenced by loadVerified().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadVerified()

void fedem::dso::DSOLoader::loadVerified ( std::string const &  soName,
std::vector< std::string > const &  searchDirs,
std::string const &  trustedKeysDir,
sign::TrustLevel  minTrust 
)
static

Load DSO only if trust level >= minTrust. Throws fedem::exception::SignatureRejected when trust is insufficient. Throws fedem::exception::FileNotFound when the DSO is not found.

References fedem::dso::SignedLoadResult::detail, fedem::dso::SignedLoadResult::loaded, loadSigned(), fedem::sign::REJECTED, fedem::dso::SignedLoadResult::soPath, fedem::dso::SignedLoadResult::trust, fedem::sign::TRUSTED, fedem::sign::UNKNOWN, and fedem::sign::UNSIGNED.

+ Here is the call graph for this function:

◆ operator=() [1/2]

DSOLoader& fedem::dso::DSOLoader::operator= ( DSOLoader const &  )
privatedelete

◆ operator=() [2/2]

DSOLoader& fedem::dso::DSOLoader::operator= ( DSOLoader &&  )
privatedelete

◆ loadSingle()

std::string fedem::dso::DSOLoader::loadSingle ( std::string const &  soName)
staticprivate

Referenced by load(), loadSigned(), and scanDirectory().

+ Here is the caller graph for this function:

◆ scanDirectory()

void fedem::dso::DSOLoader::scanDirectory ( std::string const &  extension,
std::string const &  folder,
std::string &  missingFiles 
)
staticprivate

References filenamePrefix, loadSingle(), fedem::exception::FileNotFound::missingFilename(), and fedem::exception::FileNotFound::whatStr().

Referenced by loadAll(), and loadAllByEnvironment().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ filenamePrefix

std::string fedem::dso::DSOLoader::filenamePrefix
staticprivate

Referenced by prefix(), and scanDirectory().

◆ mutex_

std::mutex fedem::dso::DSOLoader::mutex_
staticprivate

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