xrootd
XrdSutPFEntry.hh
Go to the documentation of this file.
1 // $Id$
2 #ifndef __SUT_PFENTRY_H
3 #define __SUT_PFENTRY_H
4 
5 /******************************************************************************/
6 /* */
7 /* X r d S u t P F E n t r y . h h */
8 /* */
9 /* (c) 2005 by the Board of Trustees of the Leland Stanford, Jr., University */
10 /* All Rights Reserved. See XrdInfo.cc for complete License Terms */
11 /* Produced by Andrew Hanushevsky for Stanford University under contract */
12 /* DE-AC03-76-SFO0515 with the Department of Energy */
13 /******************************************************************************/
14 
15 #include <XProtocol/XProtocol.hh>
16 
17 /******************************************************************************/
18 /* */
19 /* Class defining the basic entry into a PFile */
20 /* */
21 /******************************************************************************/
22 
24  kPFE_inactive = -2, // -2 inactive: eliminated at next trim
25  kPFE_disabled, // -1 disabled, cannot be enabled
26  kPFE_allowed, // 0 empty creds, can be enabled
27  kPFE_ok, // 1 enabled and OK
28  kPFE_onetime, // 2 enabled, can be used only once
29  kPFE_expired, // 3 enabled, creds to be changed at next used
30  kPFE_special, // 4 special (non-creds) entry
31  kPFE_anonymous, // 5 enabled, OK, no creds, counter
32  kPFE_crypt // 6 enabled, OK, crypt-like credentials
33 };
34 
35 //
36 // Buffer used internally by XrdSutPFEntry
37 //
38 class XrdSutPFBuf {
39 public:
40  char *buf;
42  XrdSutPFBuf(char *b = 0, kXR_int32 l = 0);
43  XrdSutPFBuf(const XrdSutPFBuf &b);
44 
45  virtual ~XrdSutPFBuf() { if (len > 0 && buf) delete[] buf; }
46 
47  void SetBuf(const char *b = 0, kXR_int32 l = 0);
48 };
49 
50 //
51 // Generic File entry: it stores a
52 //
53 // name
54 // status 2 bytes
55 // cnt 2 bytes
56 // mtime 4 bytes
57 // buf1, buf2, buf3, buf4
58 //
59 // The buffers are generic buffers to store bufferized info
60 //
62 public:
63  char *name;
64  short status;
65  short cnt; // counter
66  kXR_int32 mtime; // time of last modification / creation
71  XrdSutPFEntry(const char *n = 0, short st = 0, short cn = 0,
72  kXR_int32 mt = 0);
73  XrdSutPFEntry(const XrdSutPFEntry &e);
74  virtual ~XrdSutPFEntry() { if (name) delete[] name; }
75  kXR_int32 Length() const { return (buf1.len + buf2.len + 2*sizeof(short) +
76  buf3.len + buf4.len + 5*sizeof(kXR_int32)); }
77  void Reset();
78  void SetName(const char *n = 0);
79  char *AsString() const;
80 
82 };
83 
84 #endif