xrootd
Main Page
Namespaces
Classes
Files
File List
File Members
src
XrdFrc
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 <stdlib.h>
34
#include <string.h>
35
36
#include "
XrdSys/XrdSysPthread.hh
"
37
38
class
XrdOucEnv
;
39
class
XrdOucStream
;
40
41
class
XrdFrcCID
42
{
43
public
:
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) {}
55
~XrdFrcCID
() {}
56
57
private
:
58
59
struct
cidEnt
60
{
cidEnt
*
Next
;
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
78
class
cidMon
{
public
:
79
cidMon
() {
cidMutex
.
Lock
();}
80
~cidMon
() {
cidMutex
.
UnLock
();}
81
private
:
82
static
XrdSysMutex
cidMutex
;
83
};
84
85
cidEnt
*
Find
(
const
char
*iName);
86
int
Init
(
XrdOucStream
&cidFile);
87
int
Update
();
88
89
cidEnt
*
Dflt
;
90
cidEnt
*
First
;
91
char
*
cidFN
;
92
char
*
cidFN2
;
93
};
94
95
namespace
XrdFrc
96
{
97
extern
XrdFrcCID
CID
;
98
}
99
#endif
Generated by
1.8.3.1