XRootD
XrdAccAuthDB.hh
Go to the documentation of this file.
1 #ifndef __ACC_AUTHDB__
2 #define __ACC_AUTHDB__
3 /******************************************************************************/
4 /* */
5 /* X r d A c c A u t h D B . h h */
6 /* */
7 /* (c) 2003 by the Board of Trustees of the Leland Stanford, Jr., University */
8 /* All Rights Reserved */
9 /* Produced by Andrew Hanushevsky for Stanford University under contract */
10 /* DE-AC02-76-SFO0515 with the Department of Energy */
11 /* */
12 /* This file is part of the XRootD software suite. */
13 /* */
14 /* XRootD is free software: you can redistribute it and/or modify it under */
15 /* the terms of the GNU Lesser General Public License as published by the */
16 /* Free Software Foundation, either version 3 of the License, or (at your */
17 /* option) any later version. */
18 /* */
19 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22 /* License for more details. */
23 /* */
24 /* You should have received a copy of the GNU Lesser General Public License */
25 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27 /* */
28 /* The copyright holder's institutional names and contributor's names may not */
29 /* be used to endorse or promote products derived from this software without */
30 /* specific prior written permission of the institution or contributor. */
31 /******************************************************************************/
32 
33 #include "XrdSys/XrdSysError.hh"
34 
35 // This class is provided for obtaining capability information from some source.
36 // Derive a class to provide an actual source for the information. The
37 // interface is similar to the set/get/endpwent enumeration interface:
38 
39 // setDBpath() is used to establish the location of the database.
40 
41 // Open() establishes the start of the database operation. It also obtains
42 // an exclusive mutex to be mt-safe. True is returned upon success.
43 
44 // getRec() get the next database record. It returns the record type as well
45 // as a pointer to the record name. False is returned at the end
46 // of the database.
47 
48 // getPP() gets the next path-priv or template name. It returns a pointer
49 // to each one. True is returned until end-of-record.
50 
51 // Close() terminates database processing and releases the associated lock.
52 // It also return FALSE if any errors occurred during processing.
53 
54 // Changed() Returns 1 id the current authorization file has changed since
55 // the last time it was opened.
56 
57 
58 /******************************************************************************/
59 /* D a t a b a s e R e c o r d T y p e s */
60 /******************************************************************************/
61 
62 // The following are the 1-letter id types that we support
63 //
64 // g -> unix group name
65 // h -> host name
66 // n -> NIS netgroup name
67 // s -> set name
68 // t -> template name
69 // u -> user name
70 
71 // The syntax for each database record is:
72 
73 // <RecType> <recname> {<tname>|<path> <priv>} [{<tname|<path> <priv>}] [...]
74 
75 // = <idname> <id:> <idval> [<id:> <idval> [....]]
76 
77 // Continuation records are signified by an ending backslash (\‍). Blank records
78 // and comments (i.e., lines with the first non-blank being a pound sign) are
79 // allowed. Word separators may be spaces or tabs.
80 
81 /******************************************************************************/
82 /* X r d A c c A u t h D B C l a s s */
83 /******************************************************************************/
84 
86 {
87 public:
88 
89 virtual int Open(XrdSysError &eroute, const char *path=0) = 0;
90 
91 virtual char getRec(char **recname) = 0;
92 
93 virtual char getID(char **id) = 0;
94 
95 virtual int getPP(char **path, char **priv, bool &istmplt) = 0;
96 
97 virtual int Close() = 0;
98 
99 virtual int Changed(const char *path=0) = 0;
100 
102 virtual ~XrdAccAuthDB() {}
103 
104 };
105 
106 /******************************************************************************/
107 /* X r d A c c X u t h D B _ O b j e c t */
108 /******************************************************************************/
109 
111 
112 #endif
XrdAccAuthDB * XrdAccAuthDBObject(XrdSysError *erp)
virtual int Changed(const char *path=0)=0
virtual int Close()=0
virtual int getPP(char **path, char **priv, bool &istmplt)=0
virtual ~XrdAccAuthDB()
virtual char getRec(char **recname)=0
virtual int Open(XrdSysError &eroute, const char *path=0)=0
virtual char getID(char **id)=0