RestLink 2.2.0
Powerfull Rest Client for Qt
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
RestLink::PluginManager Class Reference

Manages discovery, loading, and instantiation of RestLink plugins. More...

#include <pluginmanager.h>

Public Member Functions

 PluginManager ()
 Constructs a new PluginManager instance.
 
 ~PluginManager ()
 Destroys the PluginManager instance.
 

Static Public Member Functions

static QList< AbstractRequestHandler * > handlers ()
 Returns a list of all discovered and valid AbstractRequestHandler instances.
 
static bool isDiscoveryEnabled ()
 Returns whether plugin discovery is currently enabled.
 
static void enableDiscovery ()
 Enables plugin discovery.
 
static void setDiscoveryEnabled (bool enable=true)
 Sets whether plugin discovery should be enabled.
 
static void registerPlugin (const QString &name)
 Registers a plugin name manually.
 
static PluginManagerglobal ()
 Returns the global singleton instance of PluginManager.
 

Detailed Description

Manages discovery, loading, and instantiation of RestLink plugins.

This class provides a central interface for registering and loading plugins that extend RestLink's request handling capabilities. It supports optional plugin discovery, which scans runtime library paths for valid RestLink plugins.

Warning
Plugin discovery is disabled by default due to security concerns: allowing arbitrary shared libraries to be loaded from library paths can introduce vulnerabilities. Enabling discovery should be done with caution and only in trusted environments, use enableDiscovery() to explicitly enable discovery, alternatively, use the static registerPlugin() method to securely specify which plugins should be loaded by name, bypassing the need for unrestricted path scanning.

Constructor & Destructor Documentation

◆ PluginManager()

RestLink::PluginManager::PluginManager ( )

Constructs a new PluginManager instance.

◆ ~PluginManager()

RestLink::PluginManager::~PluginManager ( )

Destroys the PluginManager instance.

Member Function Documentation

◆ handlers()

QList< AbstractRequestHandler * > RestLink::PluginManager::handlers ( )
static

Returns a list of all discovered and valid AbstractRequestHandler instances.

Returns
QList of AbstractRequestHandler pointers.

◆ isDiscoveryEnabled()

bool RestLink::PluginManager::isDiscoveryEnabled ( )
static

Returns whether plugin discovery is currently enabled.

Returns
true if discovery is enabled, false otherwise.

◆ enableDiscovery()

void RestLink::PluginManager::enableDiscovery ( )
static

Enables plugin discovery.

When enabled, RestLink will scan library paths at runtime to detect and load available plugins. This feature is disabled by default to avoid potential security risks from untrusted binaries.

Note
This must be called before creating any NetworkManager instance. It is recommended to invoke this immediately after initializing the Qt application object in your main application file.

◆ setDiscoveryEnabled()

void RestLink::PluginManager::setDiscoveryEnabled ( bool  enable = true)
static

Sets whether plugin discovery should be enabled.

Parameters
enableIf true, enables discovery; disables it otherwise.

◆ registerPlugin()

void RestLink::PluginManager::registerPlugin ( const QString &  name)
static

Registers a plugin name manually.

This will cause the plugin manager attempt to load a plugin, should be more secure than plugin discovery.

Parameters
nameThe name of the plugin to load.

◆ global()

PluginManager * RestLink::PluginManager::global ( )
static

Returns the global singleton instance of PluginManager.

Returns
A pointer to the global PluginManager.