xrootd
Main Page
Namespaces
Classes
Files
File List
File Members
src
XrdSut
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/XProtocol.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
Generated by
1.8.3.1