xrootd
Loading...
Searching...
No Matches
XrdSysPlugin.hh
Go to the documentation of this file.
1#ifndef __XRDSYSPLUGIN__
2#define __XRDSYSPLUGIN__
3/******************************************************************************/
4/* */
5/* X r d S y s P l u g i n . h h */
6/* */
7/* (c) 2005 by the Board of Trustees of the Leland Stanford, Jr., University */
8/* All Rights Reserved */
9/* Produced by Andrew Hanushevsky for Stanford University under contract */
10/* DE-AC02-76-SFO0515 with the Department of Energy */
11/* */
12/* This file is part of the XRootD software suite. */
13/* */
14/* XRootD is free software: you can redistribute it and/or modify it under */
15/* the terms of the GNU Lesser General Public License as published by the */
16/* Free Software Foundation, either version 3 of the License, or (at your */
17/* option) any later version. */
18/* */
19/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22/* License for more details. */
23/* */
24/* You should have received a copy of the GNU Lesser General Public License */
25/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27/* */
28/* The copyright holder's institutional names and contributor's names may not */
29/* be used to endorse or promote products derived from this software without */
30/* specific prior written permission of the institution or contributor. */
31/******************************************************************************/
32
33#include <cstring>
34
35struct XrdVersionInfo;
36
37class XrdSysError;
38
39//------------------------------------------------------------------------------
50//------------------------------------------------------------------------------
51
53{
54public:
55
56//------------------------------------------------------------------------------
72//------------------------------------------------------------------------------
73
74void *getLibrary(bool allMsgs=true, bool global=false);
75
76//------------------------------------------------------------------------------
88//------------------------------------------------------------------------------
89
90void *getPlugin(const char *pname, int optional=0);
91
92//------------------------------------------------------------------------------
107//------------------------------------------------------------------------------
108
109void *getPlugin(const char *pname, int optional, bool global);
110
111//------------------------------------------------------------------------------
116//------------------------------------------------------------------------------
117
118void *Persist() {void *lHan = libHandle; libHandle = 0; return lHan;}
119
120//------------------------------------------------------------------------------
137//------------------------------------------------------------------------------
138
139static
140bool Preload(const char *path, char *ebuff=0, int eblen=0);
141
142//------------------------------------------------------------------------------
151//------------------------------------------------------------------------------
152
153static
154bool VerCmp(XrdVersionInfo &vInf1, XrdVersionInfo &vInf2, bool noMsg=false);
155
156//------------------------------------------------------------------------------
163//------------------------------------------------------------------------------
164
165 XrdSysPlugin(XrdSysError *erp, const char *path)
166 : eDest(erp), libName(0), libPath(path ? strdup(path) : 0),
167 libHandle(0), myInfo(0), eBuff(0), eBLen(0), msgCnt(-1) {}
168
169//------------------------------------------------------------------------------
183//------------------------------------------------------------------------------
184
185 XrdSysPlugin(XrdSysError *erp, const char *path, const char *lname,
186 XrdVersionInfo *vinf=0, int msgNum=-1)
187 : eDest(erp), libName(lname),
188 libPath(path ? strdup(path) : 0), libHandle(0),
189 myInfo(vinf), eBuff(0), eBLen(0), msgCnt(msgNum) {}
190
191//------------------------------------------------------------------------------
208//------------------------------------------------------------------------------
209
210 XrdSysPlugin(char *ebuff, int eblen, const char *path, const char *lname,
211 XrdVersionInfo *vinf=0, int msgNum=-1)
212 : eDest(0), libName(lname),
213 libPath(path ? strdup(path) : 0), libHandle(0),
214 myInfo(vinf), eBuff(ebuff), eBLen(eblen), msgCnt(msgNum) {}
215
216//------------------------------------------------------------------------------
218//------------------------------------------------------------------------------
219
221
222private:
224
225cvResult badVersion(XrdVersionInfo &urInfo,char mmv,int majv,int minv);
226cvResult chkVersion(XrdVersionInfo &urInfo, const char *pname, void *lh);
227static int DLflags();
228static void *Find(const char *libname);
229void Inform(const char *txt1, const char *txt2=0, const char *txt3=0,
230 const char *txt4=0, const char *txt5=0, int noHush=0);
231cvResult libMsg(const char *txt1, const char *txt2, const char *mSym=0);
232const char *msgSuffix(const char *Word, char *buff, int bsz);
233
235const char *libName;
238XrdVersionInfo *myInfo;
239char *eBuff;
242
244 char *libPath;
246 };
247
249};
250#endif
Definition XrdSysError.hh:90
Definition XrdSysPlugin.hh:53
void * getPlugin(const char *pname, int optional=0)
static bool Preload(const char *path, char *ebuff=0, int eblen=0)
~XrdSysPlugin()
Destructor.
void * getLibrary(bool allMsgs=true, bool global=false)
XrdSysPlugin(char *ebuff, int eblen, const char *path, const char *lname, XrdVersionInfo *vinf=0, int msgNum=-1)
Definition XrdSysPlugin.hh:210
static int DLflags()
void * Persist()
Definition XrdSysPlugin.hh:118
const char * libName
Definition XrdSysPlugin.hh:235
char * libPath
Definition XrdSysPlugin.hh:236
void * getPlugin(const char *pname, int optional, bool global)
char * eBuff
Definition XrdSysPlugin.hh:239
void Inform(const char *txt1, const char *txt2=0, const char *txt3=0, const char *txt4=0, const char *txt5=0, int noHush=0)
XrdSysPlugin(XrdSysError *erp, const char *path, const char *lname, XrdVersionInfo *vinf=0, int msgNum=-1)
Definition XrdSysPlugin.hh:185
XrdSysError * eDest
Definition XrdSysPlugin.hh:234
cvResult chkVersion(XrdVersionInfo &urInfo, const char *pname, void *lh)
int eBLen
Definition XrdSysPlugin.hh:240
cvResult
Definition XrdSysPlugin.hh:223
@ cvClean
Definition XrdSysPlugin.hh:223
@ cvMissing
Definition XrdSysPlugin.hh:223
@ cvBad
Definition XrdSysPlugin.hh:223
@ cvNone
Definition XrdSysPlugin.hh:223
@ cvDirty
Definition XrdSysPlugin.hh:223
cvResult libMsg(const char *txt1, const char *txt2, const char *mSym=0)
XrdSysPlugin(XrdSysError *erp, const char *path)
Definition XrdSysPlugin.hh:165
int msgCnt
Definition XrdSysPlugin.hh:241
cvResult badVersion(XrdVersionInfo &urInfo, char mmv, int majv, int minv)
static bool VerCmp(XrdVersionInfo &vInf1, XrdVersionInfo &vInf2, bool noMsg=false)
static PLlist * plList
Definition XrdSysPlugin.hh:248
const char * msgSuffix(const char *Word, char *buff, int bsz)
void * libHandle
Definition XrdSysPlugin.hh:237
XrdVersionInfo * myInfo
Definition XrdSysPlugin.hh:238
static void * Find(const char *libname)
Definition XrdSysPlugin.hh:243
char * libPath
Definition XrdSysPlugin.hh:244
PLlist * next
Definition XrdSysPlugin.hh:243
void * libHandle
Definition XrdSysPlugin.hh:245