xrootd
Loading...
Searching...
No Matches
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/* 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
33#include <cstdlib>
34#include <cstring>
35
37
38class XrdOucEnv;
39class XrdOucStream;
40
42{
43public:
44 int Add(const char *iName, const char *cName, time_t addT, pid_t Pid);
45
46 int Get(const char *iName, char *buff, int blen);
47
48 int Get(const char *iName, const char *vName, XrdOucEnv *evP);
49
50 int Init(const char *qPath);
51
52 void Ref(const char *iName);
53
54 XrdFrcCID() : Dflt(0), First(0), cidFN(0), cidFN2(0) {}
56
57private:
58
59struct cidEnt
61 char *iName;
62 char *cName;
63 time_t addT;
64 pid_t Pid;
65 int useCnt;
66 short iNLen;
67 short cNLen;
68
69 cidEnt(cidEnt *epnt,const char *iname,const char *cname,
70 time_t addt, pid_t idp)
71 : Next(epnt), iName(strdup(*iname ? iname : "anon")),
72 cName(strdup(cname)), addT(addt), Pid(idp), useCnt(0),
73 iNLen(strlen(iName)), cNLen(strlen(cName)) {}
74 ~cidEnt() {if (iName) free(iName); if (cName) free(cName);}
75
76 };
77
78class cidMon {public:
81 private:
83 };
84
85cidEnt *Find(const char *iName);
86int Init(XrdOucStream &cidFile);
87int Update();
88
91char *cidFN;
92char *cidFN2;
93};
94
95namespace XrdFrc
96{
97extern XrdFrcCID CID;
98}
99#endif
Definition XrdFrcCID.hh:78
~cidMon()
Definition XrdFrcCID.hh:80
static XrdSysMutex cidMutex
Definition XrdFrcCID.hh:82
cidMon()
Definition XrdFrcCID.hh:79
Definition XrdFrcCID.hh:42
char * cidFN2
Definition XrdFrcCID.hh:92
int Add(const char *iName, const char *cName, time_t addT, pid_t Pid)
XrdFrcCID()
Definition XrdFrcCID.hh:54
int Get(const char *iName, char *buff, int blen)
int Update()
char * cidFN
Definition XrdFrcCID.hh:91
cidEnt * Dflt
Definition XrdFrcCID.hh:89
~XrdFrcCID()
Definition XrdFrcCID.hh:55
int Get(const char *iName, const char *vName, XrdOucEnv *evP)
int Init(const char *qPath)
cidEnt * First
Definition XrdFrcCID.hh:90
cidEnt * Find(const char *iName)
int Init(XrdOucStream &cidFile)
void Ref(const char *iName)
Definition XrdOucEnv.hh:42
Definition XrdOucStream.hh:47
Definition XrdSysPthread.hh:165
void Lock()
Definition XrdSysPthread.hh:222
void UnLock()
Definition XrdSysPthread.hh:224
Definition XrdFrcCID.hh:96
XrdFrcCID CID
Definition XrdFrcCID.hh:60
cidEnt(cidEnt *epnt, const char *iname, const char *cname, time_t addt, pid_t idp)
Definition XrdFrcCID.hh:69
char * iName
Definition XrdFrcCID.hh:61
int useCnt
Definition XrdFrcCID.hh:65
char * cName
Definition XrdFrcCID.hh:62
time_t addT
Definition XrdFrcCID.hh:63
~cidEnt()
Definition XrdFrcCID.hh:74
short cNLen
Definition XrdFrcCID.hh:67
pid_t Pid
Definition XrdFrcCID.hh:64
cidEnt * Next
Definition XrdFrcCID.hh:60
short iNLen
Definition XrdFrcCID.hh:66