xrootd
Loading...
Searching...
No Matches
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"
33
34/******************************************************************************/
35/* */
36/* Class defining the basic entry into a PFile */
37/* */
38/******************************************************************************/
39
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//
56public:
57 char *buf;
59 XrdSutPFBuf(char *b = 0, kXR_int32 l = 0);
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//
79public:
80 char *name;
81 short status;
82 short cnt; // counter
83 kXR_int32 mtime; // time of last modification / creation
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);
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
100};
101
102#endif
int kXR_int32
Definition XPtypes.hh:89
kPFEntryStatus
Definition XrdSutPFEntry.hh:40
@ kPFE_special
Definition XrdSutPFEntry.hh:47
@ kPFE_inactive
Definition XrdSutPFEntry.hh:41
@ kPFE_allowed
Definition XrdSutPFEntry.hh:43
@ kPFE_disabled
Definition XrdSutPFEntry.hh:42
@ kPFE_anonymous
Definition XrdSutPFEntry.hh:48
@ kPFE_onetime
Definition XrdSutPFEntry.hh:45
@ kPFE_ok
Definition XrdSutPFEntry.hh:44
@ kPFE_expired
Definition XrdSutPFEntry.hh:46
@ kPFE_crypt
Definition XrdSutPFEntry.hh:49
Definition XrdSutPFEntry.hh:55
virtual ~XrdSutPFBuf()
Definition XrdSutPFEntry.hh:62
XrdSutPFBuf(const XrdSutPFBuf &b)
void SetBuf(const char *b=0, kXR_int32 l=0)
char * buf
Definition XrdSutPFEntry.hh:57
XrdSutPFBuf(char *b=0, kXR_int32 l=0)
kXR_int32 len
Definition XrdSutPFEntry.hh:58
Definition XrdSutPFEntry.hh:78
kXR_int32 mtime
Definition XrdSutPFEntry.hh:83
XrdSutPFBuf buf3
Definition XrdSutPFEntry.hh:86
XrdSutPFBuf buf1
Definition XrdSutPFEntry.hh:84
XrdSutPFEntry & operator=(const XrdSutPFEntry &pfe)
XrdSysMutex pfeMutex
Definition XrdSutPFEntry.hh:88
char * AsString() const
void SetName(const char *n=0)
short status
Definition XrdSutPFEntry.hh:81
XrdSutPFEntry(const char *n=0, short st=0, short cn=0, kXR_int32 mt=0)
XrdSutPFBuf buf2
Definition XrdSutPFEntry.hh:85
kXR_int32 Length() const
Definition XrdSutPFEntry.hh:93
virtual ~XrdSutPFEntry()
Definition XrdSutPFEntry.hh:92
XrdSutPFEntry(const XrdSutPFEntry &e)
XrdSutPFBuf buf4
Definition XrdSutPFEntry.hh:87
short cnt
Definition XrdSutPFEntry.hh:82
char * name
Definition XrdSutPFEntry.hh:80
Definition XrdSysPthread.hh:165