|
xrootd
|
#include <XrdSysPlugin.hh>

Classes | |
| struct | PLlist |
Public Member Functions | |
| void * | getPlugin (const char *pname, int optional=0) |
| void * | getPlugin (const char *pname, int optional, bool global) |
| void * | Persist () |
| XrdSysPlugin (XrdSysError *erp, const char *path) | |
| XrdSysPlugin (XrdSysError *erp, const char *path, const char *lname, XrdVersionInfo *vinf=0, int msgNum=-1) | |
| XrdSysPlugin (char *ebuff, int eblen, const char *path, const char *lname, XrdVersionInfo *vinf=0, int msgNum=-1) | |
| ~XrdSysPlugin () | |
| Destructor. | |
Static Public Member Functions | |
| static bool | Preload (const char *path, char *ebuff=0, int eblen=0) |
| static bool | VerCmp (XrdVersionInfo &vInf1, XrdVersionInfo &vInf2, bool noMsg=false) |
Private Types | |
| enum | cvResult { cvBad = 0, cvNone, cvMissing, cvClean, cvDirty } |
Private Member Functions | |
| cvResult | badVersion (XrdVersionInfo &urInfo, char mmv, int majv, int minv) |
| cvResult | chkVersion (XrdVersionInfo &urInfo, const char *pname, void *lh) |
| void | Inform (const char *txt1, const char *txt2=0, const char *txt3=0, const char *txt4=0, const char *txt5=0, int noHush=0) |
| cvResult | libMsg (const char *txt1, const char *txt2, const char *mSym=0) |
| const char * | msgSuffix (const char *Word, char *buff, int bsz) |
Static Private Member Functions | |
| static int | DLflags () |
| static void * | Find (const char *libname) |
Private Attributes | |
| XrdSysError * | eDest |
| const char * | libName |
| char * | libPath |
| void * | libHandle |
| XrdVersionInfo * | myInfo |
| char * | eBuff |
| int | eBLen |
| int | msgCnt |
Static Private Attributes | |
| static PLlist * | plList = 0 |
Handy class to load run-time plugins and optionally check if the version is compatible with the caller's version number. Version numbers are defined as "aaa.bb.cc" where aaa is a decimnal major version, bb is a decimal minor version, and cc is the decimal patch version number. Only the major and, optionally, minor version numbers are checked. The checking rules are defined in XrdVersion.hh and are rather liberal in nature. In order to check versions, the plugin versioning rule must be defined in XrdVersion.hh and constructor #2 or #3 must be used. The symbolic name of the plugin's version information is the plugin symbol being looked up appended with "Version" and must be defined as an XrdVersionInfo structure.
enum XrdSysPlugin::cvResult [private] |
| XrdSysPlugin::XrdSysPlugin | ( | XrdSysError * | erp, |
| const char * | path | ||
| ) | [inline] |
Constructor #1 (version number checking is not to be performed)
| erp | -> error message object to display error messages. |
| path | -> path to the shared library containing a plug-in. If NULL the the executable image is searched for the plug-in. Storage must persist while this object is alive. |
| XrdSysPlugin::XrdSysPlugin | ( | XrdSysError * | erp, |
| const char * | path, | ||
| const char * | lname, | ||
| XrdVersionInfo * | vinf = 0, |
||
| int | msgNum = -1 |
||
| ) | [inline] |
Constructor #2 (version number checking may be performed)
| erp | -> error message object to display error messages. |
| path | -> path to the shared library containing a plug-in. If NULL the the executable image is searched for the plug-in. Storage must persist while this object is alive. |
| lname | -> logical name of the plugin library (e.g. osslib) to be used in any error messages. Storage must persist while this object is alive. |
| vinf | -> permanent version information of the plug-in loader. If zero, then no version checking is performed. |
| msgNum | -> Number of times getPlugin() is to produce a version message for a loaded plugin. The default is always. |
| XrdSysPlugin::XrdSysPlugin | ( | char * | ebuff, |
| int | eblen, | ||
| const char * | path, | ||
| const char * | lname, | ||
| XrdVersionInfo * | vinf = 0, |
||
| int | msgNum = -1 |
||
| ) | [inline] |
Constructor #3 (version number checking may be performed and any error is returned in a supplied buffer)
| ebuff | -> buffer where eror message is to be placed. The mesage will always end with a null byte. |
| eblen | -> length of the supplied buffer, eBuff. |
| path | -> path to the shared library containing a plug-in. If NULL the the executable image is searched for the plug-in. Storage must persist while this object is alive. |
| lname | -> logical name of the plugin library (e.g. osslib) to be used in any error messages. Storage must persist while this object is alive. |
| vinf | -> permanent version information of the plug-in loader. If Zero, then no version checking is performed. |
| msgNum | -> Number of times getPlugin() is to produce a version message for a loaded plugin. The default is always. |
| XrdSysPlugin::cvResult XrdSysPlugin::badVersion | ( | XrdVersionInfo & | urInfo, |
| char | mmv, | ||
| int | majv, | ||
| int | minv | ||
| ) | [private] |
References cvBad, Inform(), msgSuffix(), myInfo, and XrdVersionInfo::vStr.
Referenced by chkVersion().
| XrdSysPlugin::cvResult XrdSysPlugin::chkVersion | ( | XrdVersionInfo & | urInfo, |
| const char * | pname, | ||
| void * | lh | ||
| ) | [private] |
References badVersion(), cvClean, cvDirty, cvMissing, cvNone, eDest, Inform(), libMsg(), libPath, msgSuffix(), myInfo, XrdVersionInfo::vNum, XrdVersionInfo::vOpt, XrdVersionInfo::vStr, XrdMajorVNUM, XrdMinorVNUM, XrdVERSIONINFOSFX, XrdVERSIONPLUGIN_DoNotChk, XrdVERSIONPLUGIN_Required, XrdVERSIONPLUGINRULES, and XrdVNUMUNK.
Referenced by getPlugin().
| int XrdSysPlugin::DLflags | ( | ) | [static, private] |
Referenced by getPlugin(), and Preload().
| void * XrdSysPlugin::Find | ( | const char * | libname | ) | [static, private] |
References XrdSysPlugin::PLlist::libHandle, XrdSysPlugin::PLlist::libPath, XrdSysPlugin::PLlist::next, and plList.
Referenced by getPlugin(), and Preload().
| void * XrdSysPlugin::getPlugin | ( | const char * | pname, |
| int | optional = 0 |
||
| ) |
Get the address of a plugin from a shared library, opening the plug-in shared library if not already open. Symbols in the library are local.
| pname | the plug-in extern "C" symbolic name |
| optional | when 0 then issue error message when symbol isn't found. Otherwise, the mising symbol is treated as an error. |
Referenced by XrdCksManager::Config(), XrdOfs::ConfigRedir(), XrdCmsSecurity::Configure(), XrdPssSys::getCache(), XrdCksConfig::getCks(), XrdCryptoFactory::GetCryptoFactory(), XrdCl::DefaultEnv::GetMonitor(), XrdSecPManager::ldPO(), XrdOucN2NLoader::Load(), XrdCksLoader::Load(), XrdSecProtocolgsi::LoadAuthzFun(), XrdSecProtocolgsi::LoadGMAPFun(), XrdSecProtocolgsi::LoadVOMSFun(), XrdBwm::setupAuth(), XrdOfs::setupAuth(), XrdBwm::setupPolicy(), XrdCmsConfig::setupXmi(), XrdOssGetSS(), XrdXrootdloadFileSystem(), and XrdXrootdloadSecurity().
| void * XrdSysPlugin::getPlugin | ( | const char * | pname, |
| int | optional, | ||
| bool | global | ||
| ) |
Get the address of a plugin from a shared library, opening the plug-in shared library if not already open and optionally make the symbols global.
| pname | the plug-in extern "C" symbolic name |
| optional | when 0 then issue error message when symbol isn't found. Otherwise, the mising symbol is treated as an error. When optional is greater than 1, the load message is suppressed. |
| global | when !0 then the symbols defined in the plug-in shared library are made available for symbol resolution of subsequently loaded libraries. |
References chkVersion(), cvBad, cvClean, cvMissing, DLflags(), eDest, XrdSysError::Emsg(), Find(), Inform(), libHandle, libMsg(), libPath, msgCnt, msgSuffix(), plList, XrdVERSIONINFODEF, and XrdVNUMUNK.
| void XrdSysPlugin::Inform | ( | const char * | txt1, |
| const char * | txt2 = 0, |
||
| const char * | txt3 = 0, |
||
| const char * | txt4 = 0, |
||
| const char * | txt5 = 0, |
||
| int | noHush = 0 |
||
| ) | [private] |
References eBLen, eBuff, eDest, and XrdSysError::Say().
Referenced by badVersion(), chkVersion(), getPlugin(), and libMsg().
| XrdSysPlugin::cvResult XrdSysPlugin::libMsg | ( | const char * | txt1, |
| const char * | txt2, | ||
| const char * | mSym = 0 |
||
| ) | [private] |
References cvBad, Inform(), and msgSuffix().
Referenced by chkVersion(), and getPlugin().
| const char * XrdSysPlugin::msgSuffix | ( | const char * | Word, |
| char * | buff, | ||
| int | bsz | ||
| ) | [private] |
References libName, and libPath.
Referenced by badVersion(), chkVersion(), getPlugin(), and libMsg().
| void* XrdSysPlugin::Persist | ( | ) | [inline] |
Make library persistent even when the plugin object is deleted. Note that if getPlugin() is called afterwards, the library will be re-opened!
References libHandle.
Referenced by XrdOfs::ConfigRedir(), XrdPssSys::getCache(), XrdSecPManager::ldPO(), XrdOucN2NLoader::Load(), XrdOfs::setupAuth(), XrdOssGetSS(), XrdXrootdloadFileSystem(), and XrdXrootdloadSecurity().
| bool XrdSysPlugin::Preload | ( | const char * | path, |
| char * | ebuff = 0, |
||
| int | eblen = 0 |
||
| ) | [static] |
Preload a shared library. This method is meant for those threading models that require libraries to be opened in the main thread (e.g. MacOS). This method is meant to be called before therads start and is not thread-safe.
| path | -> to the library path, typically this should just be the library filename so that LD_LIBRARY_PATH is used to discover the directory path. This allows getPlugin() to properly match preloaded libraries. |
| ebuff | -> buffer where eror message is to be placed. The mesage will always end with a null byte. If no error buffer is supplied, any error messages are discarded. |
| eblen | -> length of the supplied buffer, eBuff. |
References DLflags(), Find(), XrdSysPlugin::PLlist::libHandle, XrdSysPlugin::PLlist::libPath, XrdSysPlugin::PLlist::next, and plList.
Referenced by XrdCl::DefaultEnv::Initialize().
| bool XrdSysPlugin::VerCmp | ( | XrdVersionInfo & | vInf1, |
| XrdVersionInfo & | vInf2, | ||
| bool | noMsg = false |
||
| ) | [static] |
Compare two versions for compatability, optionally printing a warning.
| vInf1 | -> Version information for source. |
| vInf2 | -> Version information for target. |
| noMsg | -> If true, no error messages are written to stderr. |
References XrdVersionInfo::vNum, XrdVersionInfo::vStr, and XrdVNUMUNK.
Referenced by XrdOucN2NLoader::Load(), XrdCmsFinderRMT::VCheck(), XrdCmsFinderTRG::VCheck(), XrdAccDefaultAuthorizeObject(), XrdCksConfig::XrdCksConfig(), XrdCksLoader::XrdCksLoader(), and XrdOssGetSS().
int XrdSysPlugin::eBLen [private] |
Referenced by Inform().
char* XrdSysPlugin::eBuff [private] |
Referenced by Inform().
XrdSysError* XrdSysPlugin::eDest [private] |
Referenced by chkVersion(), getPlugin(), and Inform().
void* XrdSysPlugin::libHandle [private] |
Referenced by getPlugin(), Persist(), and ~XrdSysPlugin().
const char* XrdSysPlugin::libName [private] |
Referenced by msgSuffix().
char* XrdSysPlugin::libPath [private] |
Referenced by chkVersion(), getPlugin(), msgSuffix(), and ~XrdSysPlugin().
int XrdSysPlugin::msgCnt [private] |
Referenced by getPlugin().
XrdVersionInfo* XrdSysPlugin::myInfo [private] |
Referenced by badVersion(), and chkVersion().
struct XrdSysPlugin::PLlist * XrdSysPlugin::plList = 0 [static, private] |
Referenced by Find(), getPlugin(), and Preload().
1.7.6.1