limal-nfs-server
NfsIdmapdConf.hpp
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | |
3 | _ _ _ _ __ _ |
4 | | | | | | \_/ | / \ | | |
5 | | | | | | |_| | / /\ \ | | |
6 | | |__ | | | | | | / ____ \ | |__ |
7 | |____||_| |_| |_|/ / \ \|____| |
8 | |
9 | nfs-server library |
10 | |
11 | (C) SUSE Linux Products GmbH |
12 | (C) Novell, Inc. |
13 \----------------------------------------------------------------------/
14 
15  File: NfsIdmapdConf.hpp
16 
17  Author: Marius Tomaschewski, Chakravarthi P
18  Maintainer: Chakravarthi P
19 
20 /-*/
25 #ifndef LIMAL_NFS_SERVER_NFS_IDMAPD_CONF_HPP
26 #define LIMAL_NFS_SERVER_NFS_IDMAPD_CONF_HPP
27 
29 #include <blocxx/String.hpp>
30 #include <blocxx/Array.hpp>
31 #include <blocxx/List.hpp>
32 #include <blocxx/Map.hpp>
33 
34 // -------------------------------------------------------------------
35 namespace LIMAL_NAMESPACE
36 {
37 namespace NFS_SERVER_NAMESPACE
38 {
39 
40 // -------------------------------------------------------------------
50 {
51 public:
55  IdmapdEntry ();
56 
71  IdmapdEntry (const blocxx::String &name,
72  const blocxx::String &value);
73 
88  IdmapdEntry (const blocxx::String &entry);
89 
90  IdmapdEntry (const IdmapdEntry &ientry);
91 
92  ~IdmapdEntry ();
93 
94  bool
95  empty () const;
96 
97  blocxx::String
98  toString () const;
99 
100  blocxx::String
101  getName () const;
102 
103  blocxx::String
104  getValue () const;
105 
106  blocxx::String
107  getEntry () const;
108 
109  void
110  setEntry (const blocxx::String &entry);
111 
112  void
113  addComment (const blocxx::String &comment);
114 
115  bool
116  hasComments () const;
117 
118  blocxx::Array<blocxx::String>
119  getComments () const;
120 
121 
122 
123 private:
124  blocxx::String m_name;
125  blocxx::String m_value;
126 
127  blocxx::Array<blocxx::String> comments;
128 
129  void
130  setName (const blocxx::String &name);
131 
132 };
133 
134 // -------------------------------------------------------------------
139 typedef blocxx::List<IdmapdEntry> IdmapdEntries;
140 
141 
142 // -------------------------------------------------------------------
144 {
145 
146 public:
147  typedef blocxx::IntrusiveReference<IdmapdEntry> IERef;
148 
149  IdmapdSection ();
150 
151  IdmapdSection (const blocxx::String &name);
152 
153  IdmapdSection (const IdmapdSection &section);
154 
155  IdmapdSection (const blocxx::String &name,
156  const IdmapdEntries &entries);
157 
158  // see if its already there ...
159  IdmapdSection &
160  addEntry (const IdmapdEntry &entry);
161 
162  blocxx::String
163  getName () const;
164 
165  bool
166  empty() const;
167 
168  blocxx::Array<blocxx::String>
169  getStringEntries () const;
170 
171  IdmapdEntry&
172  getEntry (const blocxx::String &name) ;
173 
174  void
175  setEntry (const IdmapdEntry &entry);
176 
177  void
178  setEntryValue (const blocxx::String &entry,
179  const blocxx::String &value);
180 
181  void
182  addComment (const blocxx::String &comment);
183 
184  bool
185  hasComments () const;
186 
187  bool
188  hasEntry (const blocxx::String &entryName) const;
189 
190  blocxx::Array<blocxx::String>
191  getComments () const;
192 
193 
194  blocxx::List<IdmapdEntry>
195  getEntries () const;
196 
197 private:
198 
199  blocxx::String m_name;
200 
201  /* IdmapdEntry list */
203  blocxx::Map<blocxx::String,IdmapdEntry> entryMap;
204 
205  void
206  setEntryMap (const blocxx::List<IdmapdEntry> &entries);
207 
208  blocxx::Array<blocxx::String> comments;
209 };
210 
211 
212 
213 
214 // -------------------------------------------------------------------
219 typedef blocxx::List<IdmapdSection> IdmapdSections;
220 
221 
222 
223 // -------------------------------------------------------------------
225 {
226 public:
227  IdmapdConf();
228 
229  IdmapdConf(const IdmapdConf &conf);
230 
231  ~IdmapdConf ();
232 
233  blocxx::List<IdmapdEntry>
234  getEntries (const blocxx::String &sectionName);
235 
236  blocxx::Array<blocxx::String>
237  getStringEntries (const blocxx::String &sectionName);
238 
239  blocxx::Array<blocxx::String>
240  getAllStringEntries () const;
241 
242  const IdmapdSection&
243  getSection (const blocxx::String &sectionName);
244 
245  const blocxx::String
246  getValueFor (const blocxx::String &entryName);
247 
248  bool
249  hasSection (const blocxx::String &secName) const;
250 
251  blocxx::List<IdmapdSection>
252  getSections () const;
253 
254  blocxx::Map<blocxx::String,IdmapdSection>
255  getSectionMap () const;
256 
257  void
258  setSectionMap ();
259 
260  void
261  setSection (const IdmapdSection &section);
262 
263  void
264  setEntry (const blocxx::String &entryName,
265  const blocxx::String &value);
266 
267  void
268  addComment (const blocxx::String &comment);
269 
270  bool
271  hasComments () const;
272 
273  blocxx::Array<blocxx::String>
274  getComments () const;
275 
276  bool
277  empty () const;
278 
279  /*
280  bool
281  setIdmapdSection (const blocxx::String &sectionName,
282  const IdmapdSection &section);
283  */
284 
285 private:
286  blocxx::Map<blocxx::String,IdmapdSection> sectionMap;
287  blocxx::Array<blocxx::String> comments;
288 
289 };
290 
291 // -------------------------------------------------------------------
292 
293 
294 
295 } // End of NFS_SERVER_NAMESPACE
296 } // End of LIMAL_NAMESPACE
297 
298 #endif // LIMAL_NFS_SERVER_NFS_IDMAPD_CONF_HPP
299 // vim: set ts=8 sts=8 sw=8 ai noet: