xrootd
XrdFrcCID.hh
Go to the documentation of this file.
1 #ifndef __FRCCID_H__
2 #define __FRCCID_H__
3 /******************************************************************************/
4 /* */
5 /* X r d F r c C I D . h h */
6 /* */
7 /* (c) 2010 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 
13 #include <stdlib.h>
14 #include <string.h>
15 
16 #include "XrdSys/XrdSysPthread.hh"
17 
18 class XrdOucEnv;
19 class XrdOucStream;
20 
21 class XrdFrcCID
22 {
23 public:
24  int Add(const char *iName, const char *cName, time_t addT, pid_t Pid);
25 
26  int Get(const char *iName, char *buff, int blen);
27 
28  int Get(const char *iName, const char *vName, XrdOucEnv *evP);
29 
30  int Init(const char *qPath);
31 
32  void Ref(const char *iName);
33 
34  XrdFrcCID() : Dflt(0), First(0), cidFN(0), cidFN2(0) {}
36 
37 private:
38 
39 struct cidEnt
41  char *iName;
42  char *cName;
43  time_t addT;
44  pid_t Pid;
45  int useCnt;
46  short iNLen;
47  short cNLen;
48 
49  cidEnt(cidEnt *epnt,const char *iname,const char *cname,
50  time_t addt, pid_t idp)
51  : Next(epnt), iName(strdup(*iname ? iname : "anon")),
52  cName(strdup(cname)), addT(addt), Pid(idp), useCnt(0),
53  iNLen(strlen(iName)), cNLen(strlen(cName)) {}
54  ~cidEnt() {if (iName) free(iName); if (cName) free(cName);}
55 
56  };
57 
58 class cidMon {public:
61  private:
63  };
64 
65 cidEnt *Find(const char *iName);
66 int Init(XrdOucStream &cidFile);
67 int Update();
68 
71 char *cidFN;
72 char *cidFN2;
73 };
74 
75 namespace XrdFrc
76 {
77 extern XrdFrcCID CID;
78 }
79 #endif