ROOT  6.06/09
Reference Guide
XrdProofdClientMgr.h
Go to the documentation of this file.
1 // @(#)root/proofd:$Id$
2 // Author: G. Ganis Jan 2008
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_XrdProofdClientMgr
13 #define ROOT_XrdProofdClientMgr
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // XrdProofdClientMgr //
18 // //
19 // Author: G. Ganis, CERN, 2008 //
20 // //
21 // Class managing clients. //
22 // //
23 //////////////////////////////////////////////////////////////////////////
24 
25 #include <list>
26 
27 #include "XpdSysPthread.h"
28 
29 #include "XrdProofdConfig.h"
30 
31 #include "XrdOuc/XrdOucString.hh"
32 
33 #define XPD_LOGGEDIN 1
34 #define XPD_NEED_AUTH 2
35 #define XPD_ADMINUSER 4
36 #define XPD_NEED_MAP 8
37 
38 class XrdProofdClient;
39 class XrdProofdConfig;
40 class XrdProofdManager;
41 class XrdProofdProtocol;
42 class XrdProtocol_Config;
43 class XrdSecService;
44 class XrdSysError;
45 class XrdSysPlugin;
46 
47 
49 
52  XrdOucString fSecLib;
53  XrdSecService *fCIA; // Security framework
54  XrdSysPlugin *fSecPlugin; // Security framework plugin
55 
58 
59  XrdOucString fClntAdminPath; // Client admin area
60  int fNDisconnected; // Clients previously connected still offline
63 
64  std::list<XrdProofdClient *> fProofdClients; // keeps track of all users
65 
67  XrdOucString &cidpath, XrdOucString &emsg);
69  const char *user, XrdOucString &emsg);
71  XrdOucString &path, XrdOucString &e);
72  int RestoreAdminPath(XrdOucString &cpath, XrdOucString &emsg);
73  int ParsePreviousClients(XrdOucString &emsg);
74  int MapClient(XrdProofdProtocol *xp, bool all = 1);
75  char *FilterSecConfig(int &nd);
76 
77  void RegisterDirectives();
78  int DoDirectiveClientMgr(char *, XrdOucStream *, bool);
79 
80  // Security service
81  XrdSecService *LoadSecurity();
82 
83 public:
84  XrdProofdClientMgr(XrdProofdManager *mgr, XrdProtocol_Config *pi, XrdSysError *e);
85  virtual ~XrdProofdClientMgr() { SafeDel(fMutex); }
86 
88 
89  int Config(bool rcf = 0);
91  char *val, XrdOucStream *cfg, bool rcf);
92  int CheckClients();
93 
94  XrdProofdClient *GetClient(const char *usr, const char *grp = 0, bool create = 1);
95  int GetNClients() const { XrdSysMutexHelper mh(fMutex);
96  return fProofdClients.size(); }
97 
98  void Broadcast(XrdProofdClient *c, const char *msg);
99  void TerminateSessions(XrdProofdClient *c, const char *msg, int srvtype);
100 
101  int Process(XrdProofdProtocol *p);
102 
103  int Auth(XrdProofdProtocol *xp);
104  int Login(XrdProofdProtocol *xp);
105 
106  int CheckFrequency() const { return fCheckFrequency; }
107  inline XrdProofdPipe *Pipe() { return &fPipe; }
108 };
109 #endif
int Auth(XrdProofdProtocol *xp)
Analyse client authentication info.
#define SafeDel(x)
Definition: XrdProofdAux.h:335
XrdSecService * fCIA
XrdProofdManager * fMgr
const double pi
int RestoreAdminPath(XrdOucString &cpath, XrdOucString &emsg)
void RegisterDirectives()
Register directives for configuration.
#define XrdSysRecMutex
Definition: XrdSysToOuc.h:18
int CheckAdminPath(XrdProofdProtocol *p, XrdOucString &cidpath, XrdOucString &emsg)
Check the old-clients admin for an existing entry for this client and read the client ID;...
void Broadcast(XrdProofdClient *c, const char *msg)
Broadcast message 'msg' to the connected instances of client 'clnt' or to all connected instances if ...
int GetNClients() const
int Process(XrdProofdProtocol *p)
int MapClient(XrdProofdProtocol *xp, bool all=1)
Process a login request.
XrdSysPlugin * fSecPlugin
char * FilterSecConfig(int &nd)
Grep directives of the form "xpd.sec...", "sec.protparm" and "sec.protocol" from file 'cfn' and save ...
int Login(XrdProofdProtocol *xp)
Process a login request.
void TerminateSessions(XrdProofdClient *c, const char *msg, int srvtype)
Terminate sessions of client 'clnt' or to of all clients if clnt == 0.
XrdProofdPipe * Pipe()
XrdSecService * LoadSecurity()
Load security framework and plugins, if not already done.
int DoDirectiveClientMgr(char *, XrdOucStream *, bool)
Process 'clientmgr' directive eg: xpd.clientmgr checkfq:120 activityto:600.
int ParsePreviousClients(XrdOucString &emsg)
Client entries for the clients still connected when the daemon terminated.
XrdSysRecMutex * fMutex
#define XrdSysMutexHelper
Definition: XrdSysToOuc.h:17
#define XrdSysError
Definition: XpdSysError.h:8
#define XrdSysPlugin
Definition: XpdSysPlugin.h:8
int Config(bool rcf=0)
Run configuration and parse the entered config directives.
int CheckClient(XrdProofdProtocol *p, const char *user, XrdOucString &emsg)
Perform checks on the client username.
std::list< XrdProofdClient * > fProofdClients
int DoDirective(XrdProofdDirective *d, char *val, XrdOucStream *cfg, bool rcf)
Update the priorities of the active sessions.
int CheckFrequency() const
int CreateAdminPath(XrdProofdProtocol *p, XrdOucString &path, XrdOucString &e)
Create the client directory in the admin path.
XrdProofdClientMgr(XrdProofdManager *mgr, XrdProtocol_Config *pi, XrdSysError *e)
Constructor.
XrdProofdClient * GetClient(const char *usr, const char *grp=0, bool create=1)
Handle request for localizing a client instance for {usr, grp} from the list.
XrdOucString fClntAdminPath
int CheckClients()
Regular checks of the client admin path; run by the cron job.