xrootd
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 <string.h>
34
35struct XrdVersionInfo;
36
37class XrdSysError;
38
39//------------------------------------------------------------------------------
50//------------------------------------------------------------------------------
51
53{
54public:
55
56//------------------------------------------------------------------------------
68//------------------------------------------------------------------------------
69
70void *getPlugin(const char *pname, int optional=0);
71
72//------------------------------------------------------------------------------
87//------------------------------------------------------------------------------
88
89void *getPlugin(const char *pname, int optional, bool global);
90
91//------------------------------------------------------------------------------
96//------------------------------------------------------------------------------
97
98void *Persist() {void *lHan = libHandle; libHandle = 0; return lHan;}
99
100//------------------------------------------------------------------------------
117//------------------------------------------------------------------------------
118
119static
120bool Preload(const char *path, char *ebuff=0, int eblen=0);
121
122//------------------------------------------------------------------------------
131//------------------------------------------------------------------------------
132
133static
134bool VerCmp(XrdVersionInfo &vInf1, XrdVersionInfo &vInf2, bool noMsg=false);
135
136//------------------------------------------------------------------------------
143//------------------------------------------------------------------------------
144
145 XrdSysPlugin(XrdSysError *erp, const char *path)
146 : eDest(erp), libName(0), libPath(path ? strdup(path) : 0),
147 libHandle(0), myInfo(0), eBuff(0), eBLen(0), msgCnt(-1) {}
148
149//------------------------------------------------------------------------------
163//------------------------------------------------------------------------------
164
165 XrdSysPlugin(XrdSysError *erp, const char *path, const char *lname,
166 XrdVersionInfo *vinf=0, int msgNum=-1)
167 : eDest(erp), libName(lname),
168 libPath(path ? strdup(path) : 0), libHandle(0),
169 myInfo(vinf), eBuff(0), eBLen(0), msgCnt(msgNum) {}
170
171//------------------------------------------------------------------------------
188//------------------------------------------------------------------------------
189
190 XrdSysPlugin(char *ebuff, int eblen, const char *path, const char *lname,
191 XrdVersionInfo *vinf=0, int msgNum=-1)
192 : eDest(0), libName(lname),
193 libPath(path ? strdup(path) : 0), libHandle(0),
194 myInfo(vinf), eBuff(ebuff), eBLen(eblen), msgCnt(msgNum) {}
195
196//------------------------------------------------------------------------------
198//------------------------------------------------------------------------------
199
201
202private:
204
205cvResult badVersion(XrdVersionInfo &urInfo,char mmv,int majv,int minv);
206cvResult chkVersion(XrdVersionInfo &urInfo, const char *pname, void *lh);
207static int DLflags();
208static void *Find(const char *libname);
209void Inform(const char *txt1, const char *txt2=0, const char *txt3=0,
210 const char *txt4=0, const char *txt5=0, int noHush=0);
211cvResult libMsg(const char *txt1, const char *txt2, const char *mSym=0);
212const char *msgSuffix(const char *Word, char *buff, int bsz);
213
215const char *libName;
218XrdVersionInfo *myInfo;
219char *eBuff;
222
224 char *libPath;
226 };
227
229};
230#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.
XrdSysPlugin(char *ebuff, int eblen, const char *path, const char *lname, XrdVersionInfo *vinf=0, int msgNum=-1)
Definition: XrdSysPlugin.hh:190
static int DLflags()
void * Persist()
Definition: XrdSysPlugin.hh:98
const char * libName
Definition: XrdSysPlugin.hh:215
char * libPath
Definition: XrdSysPlugin.hh:216
void * getPlugin(const char *pname, int optional, bool global)
char * eBuff
Definition: XrdSysPlugin.hh:219
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:165
XrdSysError * eDest
Definition: XrdSysPlugin.hh:214
cvResult chkVersion(XrdVersionInfo &urInfo, const char *pname, void *lh)
int eBLen
Definition: XrdSysPlugin.hh:220
cvResult
Definition: XrdSysPlugin.hh:203
@ cvClean
Definition: XrdSysPlugin.hh:203
@ cvMissing
Definition: XrdSysPlugin.hh:203
@ cvBad
Definition: XrdSysPlugin.hh:203
@ cvNone
Definition: XrdSysPlugin.hh:203
@ cvDirty
Definition: XrdSysPlugin.hh:203
cvResult libMsg(const char *txt1, const char *txt2, const char *mSym=0)
XrdSysPlugin(XrdSysError *erp, const char *path)
Definition: XrdSysPlugin.hh:145
int msgCnt
Definition: XrdSysPlugin.hh:221
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:228
const char * msgSuffix(const char *Word, char *buff, int bsz)
void * libHandle
Definition: XrdSysPlugin.hh:217
XrdVersionInfo * myInfo
Definition: XrdSysPlugin.hh:218
static void * Find(const char *libname)
Definition: XrdSysPlugin.hh:223
char * libPath
Definition: XrdSysPlugin.hh:224
PLlist * next
Definition: XrdSysPlugin.hh:223
void * libHandle
Definition: XrdSysPlugin.hh:225