limal-nfs-server

NfsIdmapdConf.hpp

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                                                                      |
00003 |                     _     _   _   _     __     _                     |
00004 |                    | |   | | | \_/ |   /  \   | |                    |
00005 |                    | |   | | | |_| |  / /\ \  | |                    |
00006 |                    | |__ | | | | | | / ____ \ | |__                  |
00007 |                    |____||_| |_| |_|/ /    \ \|____|                 |
00008 |                                                                      |
00009 |                             nfs-server library                       |
00010 |                                                                      |
00011 |                                         (C) SUSE Linux Products GmbH |
00012 |                                         (C) Novell, Inc.             |
00013 \----------------------------------------------------------------------/
00014 
00015   File:      NfsIdmapdConf.hpp
00016 
00017   Author:     Marius Tomaschewski, Chakravarthi P
00018   Maintainer: Chakravarthi P
00019 
00020 /-*/
00025 #ifndef   LIMAL_NFS_SERVER_NFS_IDMAPD_CONF_HPP
00026 #define   LIMAL_NFS_SERVER_NFS_IDMAPD_CONF_HPP
00027 
00028 #include <limal/nfs-server/config.h>
00029 #include <blocxx/String.hpp>
00030 #include <blocxx/Array.hpp>
00031 #include <blocxx/List.hpp>
00032 #include <blocxx/Map.hpp>
00033 
00034 // -------------------------------------------------------------------
00035 namespace LIMAL_NAMESPACE
00036 {
00037 namespace NFS_SERVER_NAMESPACE
00038 {
00039 
00040 // -------------------------------------------------------------------
00049 class IdmapdEntry
00050 {
00051 public:
00055         IdmapdEntry ();
00056 
00071         IdmapdEntry (const blocxx::String &name,
00072                      const blocxx::String &value);
00073 
00088         IdmapdEntry (const blocxx::String &entry);
00089 
00090         IdmapdEntry (const IdmapdEntry &ientry);
00091 
00092         ~IdmapdEntry ();
00093 
00094         bool
00095         empty () const;
00096 
00097         blocxx::String
00098         toString () const;
00099         
00100         blocxx::String
00101         getName () const;
00102 
00103         blocxx::String
00104         getValue () const;
00105 
00106         blocxx::String
00107         getEntry () const;
00108 
00109         void
00110         setEntry (const blocxx::String &entry);
00111 
00112         void
00113         addComment (const blocxx::String &comment);
00114 
00115         bool
00116         hasComments () const;
00117 
00118         blocxx::Array<blocxx::String>
00119         getComments () const;
00120 
00121 
00122 
00123 private:
00124         blocxx::String  m_name;
00125         blocxx::String  m_value;
00126 
00127         blocxx::Array<blocxx::String> comments;
00128 
00129         void
00130         setName (const blocxx::String &name);
00131 
00132 };
00133 
00134 // -------------------------------------------------------------------
00139 typedef blocxx::List<IdmapdEntry> IdmapdEntries;
00140 
00141 
00142 // -------------------------------------------------------------------
00143 class IdmapdSection
00144 {
00145 
00146 public:
00147         typedef blocxx::IntrusiveReference<IdmapdEntry> IERef;
00148         
00149         IdmapdSection ();
00150         
00151         IdmapdSection (const blocxx::String &name);
00152 
00153         IdmapdSection (const IdmapdSection &section);
00154 
00155         IdmapdSection  (const blocxx::String &name,
00156                         const IdmapdEntries &entries);
00157 
00158         // see if its already there ...
00159         IdmapdSection &
00160         addEntry (const IdmapdEntry &entry);
00161 
00162         blocxx::String
00163         getName () const;
00164 
00165         bool
00166         empty() const;
00167 
00168         blocxx::Array<blocxx::String>
00169         getStringEntries () const;
00170 
00171         IdmapdEntry&
00172         getEntry (const blocxx::String &name) ;
00173 
00174         void    
00175         setEntry (const IdmapdEntry &entry);
00176         
00177         void    
00178         setEntryValue (const blocxx::String &entry,
00179                   const blocxx::String &value);
00180 
00181         void
00182         addComment (const blocxx::String &comment);
00183 
00184         bool
00185         hasComments () const;
00186 
00187         bool
00188         hasEntry (const blocxx::String &entryName) const;
00189 
00190         blocxx::Array<blocxx::String>
00191         getComments () const;
00192 
00193 
00194         blocxx::List<IdmapdEntry>
00195         getEntries () const;
00196 
00197 private:
00198 
00199         blocxx::String  m_name;
00200 
00201         /*  IdmapdEntry list */
00202         IdmapdEntries m_entries;
00203         blocxx::Map<blocxx::String,IdmapdEntry> entryMap; 
00204 
00205         void    
00206         setEntryMap (const blocxx::List<IdmapdEntry> &entries);
00207 
00208         blocxx::Array<blocxx::String> comments;
00209 };
00210 
00211 
00212 
00213 
00214 // -------------------------------------------------------------------
00219 typedef blocxx::List<IdmapdSection> IdmapdSections;
00220 
00221 
00222 
00223 // -------------------------------------------------------------------
00224 class IdmapdConf
00225 {
00226 public:
00227         IdmapdConf();
00228 
00229         IdmapdConf(const IdmapdConf &conf);
00230         
00231         ~IdmapdConf ();
00232 
00233         blocxx::List<IdmapdEntry>
00234         getEntries (const blocxx::String &sectionName);
00235 
00236         blocxx::Array<blocxx::String>
00237         getStringEntries (const blocxx::String &sectionName);
00238 
00239         blocxx::Array<blocxx::String>
00240         getAllStringEntries () const;
00241 
00242         const IdmapdSection&
00243         getSection (const blocxx::String &sectionName);
00244 
00245         const blocxx::String
00246         getValueFor (const blocxx::String &entryName);
00247 
00248         bool
00249         hasSection (const blocxx::String &secName) const;
00250 
00251         blocxx::List<IdmapdSection>
00252         getSections () const;
00253 
00254         blocxx::Map<blocxx::String,IdmapdSection>
00255         getSectionMap () const;
00256 
00257         void
00258         setSectionMap ();
00259 
00260         void
00261         setSection (const IdmapdSection &section);
00262 
00263         void
00264         setEntry (const blocxx::String &entryName,
00265                   const blocxx::String &value);
00266 
00267         void
00268         addComment (const blocxx::String &comment);
00269 
00270         bool
00271         hasComments () const;
00272 
00273         blocxx::Array<blocxx::String>
00274         getComments () const;
00275 
00276         bool
00277         empty () const;
00278 
00279         /*
00280         bool
00281         setIdmapdSection (const blocxx::String &sectionName,
00282                           const IdmapdSection &section);
00283         */      
00284         
00285 private:
00286         blocxx::Map<blocxx::String,IdmapdSection> sectionMap;
00287         blocxx::Array<blocxx::String> comments;
00288         
00289 };
00290 
00291 // -------------------------------------------------------------------
00292 
00293 
00294 
00295 }      // End of NFS_SERVER_NAMESPACE
00296 }      // End of LIMAL_NAMESPACE
00297 
00298 #endif // LIMAL_NFS_SERVER_NFS_IDMAPD_CONF_HPP
00299 // vim: set ts=8 sts=8 sw=8 ai noet: