XRootD
XrdSutPFEntry.hh
Go to the documentation of this file.
1
#ifndef __SUT_PFENTRY_H
2
#define __SUT_PFENTRY_H
3
/******************************************************************************/
4
/* */
5
/* X r d S u t P F E n t r y . h h */
6
/* */
7
/* (c) 2005 by the Board of Trustees of the Leland Stanford, Jr., University */
8
/* Produced by Gerri Ganis for CERN */
9
/* */
10
/* This file is part of the XRootD software suite. */
11
/* */
12
/* XRootD is free software: you can redistribute it and/or modify it under */
13
/* the terms of the GNU Lesser General Public License as published by the */
14
/* Free Software Foundation, either version 3 of the License, or (at your */
15
/* option) any later version. */
16
/* */
17
/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
18
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
19
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
20
/* License for more details. */
21
/* */
22
/* You should have received a copy of the GNU Lesser General Public License */
23
/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
24
/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
25
/* */
26
/* The copyright holder's institutional names and contributor's names may not */
27
/* be used to endorse or promote products derived from this software without */
28
/* specific prior written permission of the institution or contributor. */
29
/******************************************************************************/
30
31
#include "
XProtocol/XPtypes.hh
"
32
#include "
XrdSys/XrdSysPthread.hh
"
33
34
/******************************************************************************/
35
/* */
36
/* Class defining the basic entry into a PFile */
37
/* */
38
/******************************************************************************/
39
40
enum
kPFEntryStatus
{
41
kPFE_inactive
= -2,
// -2 inactive: eliminated at next trim
42
kPFE_disabled
,
// -1 disabled, cannot be enabled
43
kPFE_allowed
,
// 0 empty creds, can be enabled
44
kPFE_ok
,
// 1 enabled and OK
45
kPFE_onetime
,
// 2 enabled, can be used only once
46
kPFE_expired
,
// 3 enabled, creds to be changed at next used
47
kPFE_special
,
// 4 special (non-creds) entry
48
kPFE_anonymous
,
// 5 enabled, OK, no creds, counter
49
kPFE_crypt
// 6 enabled, OK, crypt-like credentials
50
};
51
52
//
53
// Buffer used internally by XrdSutPFEntry
54
//
55
class
XrdSutPFBuf
{
56
public
:
57
char
*
buf
;
58
kXR_int32
len
;
59
XrdSutPFBuf
(
char
*b = 0,
kXR_int32
l = 0);
60
XrdSutPFBuf
(
const
XrdSutPFBuf
&b);
61
62
virtual
~XrdSutPFBuf
() {
if
(
len
> 0 &&
buf
)
delete
[]
buf
; }
63
64
void
SetBuf
(
const
char
*b = 0,
kXR_int32
l = 0);
65
};
66
67
//
68
// Generic File entry: it stores a
69
//
70
// name
71
// status 2 bytes
72
// cnt 2 bytes
73
// mtime 4 bytes
74
// buf1, buf2, buf3, buf4
75
//
76
// The buffers are generic buffers to store bufferized info
77
//
78
class
XrdSutPFEntry
{
79
public
:
80
char
*
name
;
81
short
status
;
82
short
cnt
;
// counter
83
kXR_int32
mtime
;
// time of last modification / creation
84
XrdSutPFBuf
buf1
;
85
XrdSutPFBuf
buf2
;
86
XrdSutPFBuf
buf3
;
87
XrdSutPFBuf
buf4
;
88
XrdSysMutex
pfeMutex
;
// Locked when reference is outstanding
89
XrdSutPFEntry
(
const
char
*n = 0,
short
st = 0,
short
cn = 0,
90
kXR_int32
mt = 0);
91
XrdSutPFEntry
(
const
XrdSutPFEntry
&e);
92
virtual
~XrdSutPFEntry
() {
if
(
name
)
delete
[]
name
; }
93
kXR_int32
Length
()
const
{
return
(
buf1
.
len
+
buf2
.
len
+ 2*
sizeof
(
short
) +
94
buf3
.
len
+
buf4
.
len
+ 5*
sizeof
(
kXR_int32
)); }
95
void
Reset
();
96
void
SetName
(
const
char
*n = 0);
97
char
*
AsString
()
const
;
98
99
XrdSutPFEntry
&
operator=
(
const
XrdSutPFEntry
&pfe);
100
};
101
102
#endif
XPtypes.hh
kXR_int32
int kXR_int32
Definition:
XPtypes.hh:89
kPFEntryStatus
kPFEntryStatus
Definition:
XrdSutPFEntry.hh:40
kPFE_special
@ kPFE_special
Definition:
XrdSutPFEntry.hh:47
kPFE_inactive
@ kPFE_inactive
Definition:
XrdSutPFEntry.hh:41
kPFE_allowed
@ kPFE_allowed
Definition:
XrdSutPFEntry.hh:43
kPFE_disabled
@ kPFE_disabled
Definition:
XrdSutPFEntry.hh:42
kPFE_anonymous
@ kPFE_anonymous
Definition:
XrdSutPFEntry.hh:48
kPFE_onetime
@ kPFE_onetime
Definition:
XrdSutPFEntry.hh:45
kPFE_ok
@ kPFE_ok
Definition:
XrdSutPFEntry.hh:44
kPFE_expired
@ kPFE_expired
Definition:
XrdSutPFEntry.hh:46
kPFE_crypt
@ kPFE_crypt
Definition:
XrdSutPFEntry.hh:49
XrdSysPthread.hh
XrdSutPFBuf
Definition:
XrdSutPFEntry.hh:55
XrdSutPFBuf::~XrdSutPFBuf
virtual ~XrdSutPFBuf()
Definition:
XrdSutPFEntry.hh:62
XrdSutPFBuf::SetBuf
void SetBuf(const char *b=0, kXR_int32 l=0)
Definition:
XrdSutPFEntry.cc:66
XrdSutPFBuf::buf
char * buf
Definition:
XrdSutPFEntry.hh:57
XrdSutPFBuf::XrdSutPFBuf
XrdSutPFBuf(char *b=0, kXR_int32 l=0)
Definition:
XrdSutPFEntry.cc:37
XrdSutPFBuf::len
kXR_int32 len
Definition:
XrdSutPFEntry.hh:58
XrdSutPFEntry
Definition:
XrdSutPFEntry.hh:78
XrdSutPFEntry::mtime
kXR_int32 mtime
Definition:
XrdSutPFEntry.hh:83
XrdSutPFEntry::buf3
XrdSutPFBuf buf3
Definition:
XrdSutPFEntry.hh:86
XrdSutPFEntry::buf1
XrdSutPFBuf buf1
Definition:
XrdSutPFEntry.hh:84
XrdSutPFEntry::operator=
XrdSutPFEntry & operator=(const XrdSutPFEntry &pfe)
Definition:
XrdSutPFEntry.cc:170
XrdSutPFEntry::pfeMutex
XrdSysMutex pfeMutex
Definition:
XrdSutPFEntry.hh:88
XrdSutPFEntry::AsString
char * AsString() const
Definition:
XrdSutPFEntry.cc:152
XrdSutPFEntry::SetName
void SetName(const char *n=0)
Definition:
XrdSutPFEntry.cc:136
XrdSutPFEntry::status
short status
Definition:
XrdSutPFEntry.hh:81
XrdSutPFEntry::XrdSutPFEntry
XrdSutPFEntry(const char *n=0, short st=0, short cn=0, kXR_int32 mt=0)
Definition:
XrdSutPFEntry.cc:85
XrdSutPFEntry::buf2
XrdSutPFBuf buf2
Definition:
XrdSutPFEntry.hh:85
XrdSutPFEntry::Length
kXR_int32 Length() const
Definition:
XrdSutPFEntry.hh:93
XrdSutPFEntry::~XrdSutPFEntry
virtual ~XrdSutPFEntry()
Definition:
XrdSutPFEntry.hh:92
XrdSutPFEntry::buf4
XrdSutPFBuf buf4
Definition:
XrdSutPFEntry.hh:87
XrdSutPFEntry::Reset
void Reset()
Definition:
XrdSutPFEntry.cc:119
XrdSutPFEntry::cnt
short cnt
Definition:
XrdSutPFEntry.hh:82
XrdSutPFEntry::name
char * name
Definition:
XrdSutPFEntry.hh:80
XrdSysMutex
Definition:
XrdSysPthread.hh:165
XrdSut
XrdSutPFEntry.hh
Generated by
1.9.1