xrootd
XrdAccAuthDB.hh
Go to the documentation of this file.
00001 #ifndef __ACC_AUTHDB__
00002 #define __ACC_AUTHDB__
00003 /******************************************************************************/
00004 /*                                                                            */
00005 /*                       X r d A c c A u t h D B . h h                        */
00006 /*                                                                            */
00007 /* (c) 2003 by the Board of Trustees of the Leland Stanford, Jr., University  */
00008 /*                            All Rights Reserved                             */
00009 /*   Produced by Andrew Hanushevsky for Stanford University under contract    */
00010 /*              DE-AC02-76-SFO0515 with the Department of Energy              */
00011 /*                                                                            */
00012 /* This file is part of the XRootD software suite.                            */
00013 /*                                                                            */
00014 /* XRootD is free software: you can redistribute it and/or modify it under    */
00015 /* the terms of the GNU Lesser General Public License as published by the     */
00016 /* Free Software Foundation, either version 3 of the License, or (at your     */
00017 /* option) any later version.                                                 */
00018 /*                                                                            */
00019 /* XRootD is distributed in the hope that it will be useful, but WITHOUT      */
00020 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or      */
00021 /* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public       */
00022 /* License for more details.                                                  */
00023 /*                                                                            */
00024 /* You should have received a copy of the GNU Lesser General Public License   */
00025 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file  */
00026 /* COPYING (GPL license).  If not, see <http://www.gnu.org/licenses/>.        */
00027 /*                                                                            */
00028 /* The copyright holder's institutional names and contributor's names may not */
00029 /* be used to endorse or promote products derived from this software without  */
00030 /* specific prior written permission of the institution or contributor.       */
00031 /******************************************************************************/
00032 
00033 #include "XrdSys/XrdSysError.hh"
00034   
00035 // This class is provided for obtaining capability information from some source.
00036 // Derive a class to provide an actual source for the information. The
00037 // interface is similar to the set/get/endpwent enumeration interface:
00038 
00039 // setDBpath() is used to establish the location of the database.
00040 
00041 // Open()     establishes the start of the database operation. It also obtains
00042 //            an exclusive mutex to be mt-safe. True is returned upon success.
00043 
00044 // getRec()   get the next database record. It returns the record type as well
00045 //            as a pointer to the record name. False is returned at the end
00046 //            of the database.
00047 
00048 // getPP()    gets the next path-priv or template name. It returns a pointer
00049 //            to each one. True is returned until end-of-record.
00050 
00051 // Close()    terminates database processing and releases the associated lock.
00052 //            It also return FALSE if any errors occured during processing.
00053 
00054 // Changed()  Returns 1 id the current authorization file has changed since
00055 //            the last time it was opened.
00056 
00057   
00058 /******************************************************************************/
00059 /*                 D a t a b a s e   R e c o r d   T y p e s                  */
00060 /******************************************************************************/
00061   
00062 // The following are the 1-letter id types that we support
00063 //
00064 // g -> unix group name
00065 // h -> host name
00066 // n -> NIS netgroup name
00067 // s -> set name
00068 // t -> template name
00069 // u -> user name
00070 
00071 // The syntax for each database record is:
00072 
00073 // <RecType> <recname> {<tname>|<path> <priv>} [{<tname|<path> <priv>}] [...]
00074 
00075 // Continuation records are signified by an ending backslash (\). Blank records
00076 // and comments (i.e., lines with the first non-blank being a pound sign) are
00077 // allowed. Word separators may be spaces or tabs.
00078 
00079 /******************************************************************************/
00080 /*                    X r d A c c A u t h D B   C l a s s                     */
00081 /******************************************************************************/
00082   
00083 class XrdAccAuthDB
00084 {
00085 public:
00086 
00087 virtual int   Open(XrdSysError &eroute, const char *path=0) = 0;
00088 
00089 virtual char  getRec(char **recname) = 0;
00090 
00091 virtual int   getPP(char **path, char **priv) = 0;
00092 
00093 virtual int   Close() = 0;
00094 
00095 virtual int   Changed(const char *path=0) = 0;
00096 
00097               XrdAccAuthDB() {}
00098 virtual      ~XrdAccAuthDB() {}
00099 
00100 };
00101 
00102 /******************************************************************************/
00103 /*                   X r d A c c X u t h D B _ O b j e c t                    */
00104 /******************************************************************************/
00105   
00106 extern XrdAccAuthDB *XrdAccAuthDBObject(XrdSysError *erp);
00107 
00108 #endif