XRootD
XrdSecPManager.hh
Go to the documentation of this file.
1 #ifndef __SEC_PMANAGER_HH__
2 #define __SEC_PMANAGER_HH__
3 /******************************************************************************/
4 /* */
5 /* X r d S e c P M a n a g e r . h h */
6 /* */
7 /* (c) 2003 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 
34 #include "XrdSys/XrdSysPthread.hh"
35 
36 class XrdNetAddrInfo;
37 class XrdOucErrInfo;
38 class XrdSecProtList;
39 class XrdSecProtocol;
40 class XrdSysError;
41 
42 typedef int XrdSecPMask_t;
43 
44 #define PROTPARMS const char, const char *, XrdNetAddrInfo &, \
45  const char *, XrdOucErrInfo *
46 
48 {
49 public:
50 
51 XrdSecPMask_t Find(const char *pid, // In
52  char **parg=0); // Out
53 
54 XrdSecProtocol *Get(const char *hname,
55  XrdNetAddrInfo &endPoint,
56  const char *pname,
57  XrdOucErrInfo *erp);
58 
59 XrdSecProtocol *Get(const char *hname,
60  XrdNetAddrInfo &netaddr,
61  XrdSecParameters &secparm)
62  {return Get(hname, netaddr, secparm, (XrdOucErrInfo *)0);}
63 
64 XrdSecProtocol *Get(const char *hname,
65  XrdNetAddrInfo &netaddr,
66  XrdSecParameters &secparm,
67  XrdOucErrInfo *erp);
68 
69 int Load(XrdOucErrInfo *eMsg, // In
70  const char pmode, // In 'c' | 's'
71  const char *pid, // In
72  const char *parg, // In
73  const char *path) // In
74  {return (0 != ldPO(eMsg, pmode, pid, parg, path));}
75 
76 void setDebug(int dbg) {DebugON = dbg;}
77 
78 void setErrP(XrdSysError *eP) {errP = eP;}
79 
80 const char *protTLS() {return tlsProt;}
81 
82  XrdSecPManager(int dbg=0, bool secproxy=false,
83  bool fwdcreds=false)
84  : protnum(1), First(0), Last(0), errP(0),
85  tlsProt(0), DebugON(dbg), isProxy(secproxy),
86  fwdCreds(fwdcreds) {}
88 
89 private:
90 
91 XrdSecProtList *Add(XrdOucErrInfo *eMsg, const char *pid,
92  XrdSecProtocol *(*ep)(PROTPARMS), const char *parg);
93 XrdSecProtList *ldPO(XrdOucErrInfo *eMsg, // In
94  const char pmode, // In 'c' | 's'
95  const char *pid, // In
96  const char *parg=0, // In
97  const char *spath=0);// In
98 XrdSecProtList *Lookup(const char *pid);
99 
100 XrdSecPMask_t protnum;
101 XrdSysMutex myMutex;
102 XrdSecProtList *First;
103 XrdSecProtList *Last;
104 XrdSysError *errP;
105 char *tlsProt;
106 int DebugON;
107 bool isProxy;
108 bool fwdCreds;
109 };
110 #endif
int XrdSecPMask_t
#define PROTPARMS
#define eMsg(x)
XrdSecPMask_t Find(const char *pid, char **parg=0)
XrdSecProtocol * Get(const char *hname, XrdNetAddrInfo &endPoint, const char *pname, XrdOucErrInfo *erp)
XrdSecPManager(int dbg=0, bool secproxy=false, bool fwdcreds=false)
int Load(XrdOucErrInfo *eMsg, const char pmode, const char *pid, const char *parg, const char *path)
const char * protTLS()
XrdSecProtocol * Get(const char *hname, XrdNetAddrInfo &netaddr, XrdSecParameters &secparm)
void setErrP(XrdSysError *eP)
void setDebug(int dbg)
Generic structure to pass security information back and forth.