Pin
Loading...
Searching...
No Matches
Public Attributes | List of all members
IPindPlugin Struct Reference

#include <ipind_plugin.h>

Public Attributes

bool verbose_
 
const char * logName_
 
void(* plugin_log )(IPindPlugin *self, const char *message, size_t length)
 
E_plugin_type(* get_plugin_type )(IPindPlugin *self)
 
bool(* init )(IPindPlugin *self, int argc, const char *const argv[])
 
void(* uninit )(IPindPlugin *self)
 

Detailed Description

This structure should not be allocated directly. It should be filled and returned as part of IRPCPlugin.

This is also the first member of IRPCPlugin. So casting an IRPCPlugin to IPindPlugin should work, providing a C style "object oriented" way of implementing plugins.

Member Data Documentation

◆ get_plugin_type

E_plugin_type(* IPindPlugin::get_plugin_type) (IPindPlugin *self)

Return plugin type.

Parameters
[in]selfA pointer to the plugin

This method must be set and may not be NULL.

Returns
E_plugin_type The plugin type. For 3rd party plugins the only acceptable return value is E_plugin_type::RPC.

◆ init

bool(* IPindPlugin::init) (IPindPlugin *self, int argc, const char *const argv[])

Called to initialize a plugin.

If this method is set, it will be called after the plugin is loaded. This method may be NULL.

Parameters
[in]selfA pointer to the plugin
[in]argcNumber of arguments (see below)
[in]argvArray of arguments as set in the plugin JSON configuration file trough the arguments field ("ExtraRPCPlugins/i/arguments" or "/RSCServer/RPCPlugins/i/arguments").
Returns
If this function returns false, the plugin is not initialized and pind will not use it

◆ logName_

const char* IPindPlugin::logName_

Plugin log filename based (but not the same) on this plugin JSON configuration file field "ExtraRPCPlugins/i/logfilename" or "/RSCServer/RPCPlugins/i/logfilename" (which can be relative or absolute). (if doesn't exist, a default name will be given from the plugin "/name" field in the configuration file (name +.log + .<PID>)

◆ plugin_log

void(* IPindPlugin::plugin_log) (IPindPlugin *self, const char *message, size_t length)

Plugin print callback. It can be used to emit plugin logs into a dedicated plugin log file. The plugin file name will be the <name from plugin JSON configuration file> + .log + .<PID> Plugin log file is created based on plugin JSON configuration file (.../logfilename field).

Note
If the path is relative it will be relative compared to the location of pin.log.
Parameters
[in]selfA pointer to the plugin
[in]messageA C style string to be emitted into the plugin log file
[in]lengthLength of message string
Note
Plugin can use this directly or use these auxiliary functions (recommended): plugin_log() / plugin_log_verbose().
This is not mandatory. Plugins can open files and emits logs into them using their own custom implementation.
This callback can be called only after (*init)(...) function was called. Calling it earlier will will emit an error message to the standard error but will not crash.

◆ uninit

void(* IPindPlugin::uninit) (IPindPlugin *self)

Perform any cleanup of resources allocated by init() or during the lifetime of the plugin.

If this method is set, it will be called before the plugin is destroyed. This method may be NULL.

Parameters
[in]selfA pointer to the plugin

◆ verbose_

bool IPindPlugin::verbose_

When true, plugin_log_verbose() will emit logs into the plugin log file This member is set (internally) to true when the plugin JSON configuration file "ExtraRPCPlugins/i/log" or "/RSCServer/RPCPlugins/i/log" is true. When false or not specified at all this member will be set to true.

Note
Plugin should not set this flag on it's own.

The documentation for this struct was generated from the following file: