Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 
48 class XrdProofdClientMgr : public XrdProofdConfig {
49 
50  XrdSysRecMutex *fMutex;
51  XrdProofdManager *fMgr;
52  XrdOucString fSecLib;
53  XrdSecService *fCIA; // Security framework
54  XrdSysPlugin *fSecPlugin; // Security framework plugin
55 
56  int fCheckFrequency;
57  XrdProofdPipe fPipe;
58 
59  XrdOucString fClntAdminPath; // Client admin area
60  int fNDisconnected; // Clients previously connected still offline
61  int fReconnectTimeOut;
62  int fActivityTimeOut;
63 
64  std::list<XrdProofdClient *> fProofdClients; // keeps track of all users
65 
66  int CheckAdminPath(XrdProofdProtocol *p,
67  XrdOucString &cidpath, XrdOucString &emsg);
68  int CheckClient(XrdProofdProtocol *p,
69  const char *user, XrdOucString &emsg);
70  int CreateAdminPath(XrdProofdProtocol *p,
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 
87  enum CMProtocol { kClientDisconnect = 0 };
88 
89  int Config(bool rcf = 0);
90  int DoDirective(XrdProofdDirective *d,
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