xrootd
XrdSecPManager.hh
Go to the documentation of this file.
00001 #ifndef __SEC_PMANAGER_HH__
00002 #define __SEC_PMANAGER_HH__
00003 /******************************************************************************/
00004 /*                                                                            */
00005 /*                     X r d S e c P M a n a g e r . h h                      */
00006 /*                                                                            */
00007 /* (c) 2003 by the Board of Trustees of the Leland Stanford, Jr., University  */
00008 /*                            All Rights Reserved                             */
00009 /*   Produced by Andrew Hanushevsky for Stanford University under contract    */
00010 /*              DE-AC02-76-SFO0515 with the Department of Energy              */
00011 /*                                                                            */
00012 /* This file is part of the XRootD software suite.                            */
00013 /*                                                                            */
00014 /* XRootD is free software: you can redistribute it and/or modify it under    */
00015 /* the terms of the GNU Lesser General Public License as published by the     */
00016 /* Free Software Foundation, either version 3 of the License, or (at your     */
00017 /* option) any later version.                                                 */
00018 /*                                                                            */
00019 /* XRootD is distributed in the hope that it will be useful, but WITHOUT      */
00020 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or      */
00021 /* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public       */
00022 /* License for more details.                                                  */
00023 /*                                                                            */
00024 /* You should have received a copy of the GNU Lesser General Public License   */
00025 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file  */
00026 /* COPYING (GPL license).  If not, see <http://www.gnu.org/licenses/>.        */
00027 /*                                                                            */
00028 /* The copyright holder's institutional names and contributor's names may not */
00029 /* be used to endorse or promote products derived from this software without  */
00030 /* specific prior written permission of the institution or contributor.       */
00031 /******************************************************************************/
00032 
00033 #include <sys/socket.h>
00034   
00035 #include "XrdSec/XrdSecInterface.hh"
00036 #include "XrdSys/XrdSysPthread.hh"
00037 
00038 class XrdOucErrInfo;
00039 class XrdSecProtList;
00040 class XrdSecProtocol;
00041 class XrdSysError;
00042 
00043 typedef int XrdSecPMask_t;
00044 
00045 #define PROTPARMS const char, const char *, const struct sockaddr &, \
00046                   const char *, XrdOucErrInfo *
00047 
00048 class XrdSecPManager
00049 {
00050 public:
00051 
00052 XrdSecPMask_t   Find(const         char  *pid,      // In
00053                                    char **parg=0);  // Out
00054 
00055 XrdSecProtocol *Get(const char     *hname,
00056                     const sockaddr &netaddr,
00057                     const char     *pname,
00058                     XrdOucErrInfo  *erp);
00059 
00060 XrdSecProtocol *Get (const char             *hname,
00061                      const struct sockaddr  &netaddr,
00062                            XrdSecParameters &secparm);
00063 
00064 int             Load(XrdOucErrInfo *eMsg,    // In
00065                      const char     pmode,   // In 'c' | 's'
00066                      const char    *pid,     // In
00067                      const char    *parg,    // In
00068                      const char    *path)    // In
00069                      {return (0 != ldPO(eMsg, pmode, pid, parg, path));}
00070 
00071 void            setDebug(int dbg) {DebugON = dbg;}
00072 
00073 void            setErrP(XrdSysError *eP) {errP = eP;}
00074 
00075                 XrdSecPManager(int dbg=0)
00076                               : protnum(1), First(0), Last(0), errP(0),
00077                                 DebugON(dbg) {}
00078                ~XrdSecPManager() {}
00079 
00080 private:
00081 
00082 XrdSecProtList    *Add(XrdOucErrInfo  *eMsg, const char *pid,
00083                        XrdSecProtocol *(*ep)(PROTPARMS), const char *parg);
00084 XrdSecProtList    *ldPO(XrdOucErrInfo *eMsg,    // In
00085                         const char     pmode,   // In 'c' | 's'
00086                         const char    *pid,     // In
00087                         const char    *parg=0,  // In
00088                         const char    *spath=0);// In
00089 XrdSecProtList    *Lookup(const char *pid);
00090 
00091 XrdSecPMask_t      protnum;
00092 XrdSysMutex        myMutex;
00093 XrdSecProtList    *First;
00094 XrdSecProtList    *Last;
00095 XrdSysError       *errP;
00096 int                DebugON;
00097 };
00098 #endif