XrdSutPFEntry.hh

Go to the documentation of this file.
00001 // $Id: XrdSutPFEntry.hh 24468 2008-06-22 16:47:03Z ganis $
00002 #ifndef  __SUT_PFENTRY_H
00003 #define  __SUT_PFENTRY_H
00004 
00005 /******************************************************************************/
00006 /*                                                                            */
00007 /*                      X r d S u t P F E n t r y . h h                       */
00008 /*                                                                            */
00009 /* (c) 2005 by the Board of Trustees of the Leland Stanford, Jr., University  */
00010 /*       All Rights Reserved. See XrdInfo.cc for complete License Terms       */
00011 /*   Produced by Andrew Hanushevsky for Stanford University under contract    */
00012 /*              DE-AC03-76-SFO0515 with the Department of Energy              */
00013 /******************************************************************************/
00014 
00015 #include <XProtocol/XProtocol.hh>
00016 
00017 /******************************************************************************/
00018 /*                                                                            */
00019 /*  Class defining the basic entry into a PFile                               */
00020 /*                                                                            */
00021 /******************************************************************************/
00022 
00023 enum kPFEntryStatus {
00024    kPFE_inactive = -2,     // -2  inactive: eliminated at next trim
00025    kPFE_disabled,          // -1  disabled, cannot be enabled
00026    kPFE_allowed,           //  0  empty creds, can be enabled 
00027    kPFE_ok,                //  1  enabled and OK
00028    kPFE_onetime,           //  2  enabled, can be used only once
00029    kPFE_expired,           //  3  enabled, creds to be changed at next used
00030    kPFE_special,           //  4  special (non-creds) entry
00031    kPFE_anonymous,         //  5  enabled, OK, no creds, counter
00032    kPFE_crypt              //  6  enabled, OK, crypt-like credentials
00033 };
00034 
00035 //
00036 // Buffer used internally by XrdSutPFEntry
00037 //
00038 class XrdSutPFBuf {
00039 public:
00040    char      *buf;
00041    kXR_int32  len;   
00042    XrdSutPFBuf(char *b = 0, kXR_int32 l = 0);
00043    XrdSutPFBuf(const XrdSutPFBuf &b);
00044 
00045    virtual ~XrdSutPFBuf() { if (len > 0 && buf) delete[] buf; }
00046 
00047    void SetBuf(const char *b = 0, kXR_int32 l = 0);
00048 };
00049 
00050 //
00051 // Generic File entry: it stores a 
00052 //
00053 //        name
00054 //        status                     2 bytes
00055 //        cnt                        2 bytes
00056 //        mtime                      4 bytes
00057 //        buf1, buf2, buf3, buf4
00058 //
00059 // The buffers are generic buffers to store bufferized info
00060 //
00061 class XrdSutPFEntry {
00062 public:
00063    char        *name;
00064    short        status;
00065    short        cnt;            // counter
00066    kXR_int32    mtime;          // time of last modification / creation
00067    XrdSutPFBuf  buf1;
00068    XrdSutPFBuf  buf2;
00069    XrdSutPFBuf  buf3;
00070    XrdSutPFBuf  buf4;
00071    XrdSutPFEntry(const char *n = 0, short st = 0, short cn = 0,
00072                  kXR_int32 mt = 0);
00073    XrdSutPFEntry(const XrdSutPFEntry &e);
00074    virtual ~XrdSutPFEntry() { if (name) delete[] name; } 
00075    kXR_int32 Length() const { return (buf1.len + buf2.len + 2*sizeof(short) +
00076                                       buf3.len + buf4.len + 5*sizeof(kXR_int32)); }
00077    void Reset();
00078    void SetName(const char *n = 0);
00079    char *AsString() const;
00080 
00081    XrdSutPFEntry &operator=(const XrdSutPFEntry &pfe);
00082 };
00083 
00084 #endif

Generated on Tue Jul 5 14:47:02 2011 for ROOT_528-00b_version by  doxygen 1.5.1