limal-nfs-server
NfsExports.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: NfsExports.hpp
16 
17  Author: Marius Tomaschewski, Chakravarthi P
18  Maintainer: Chakravarthi P
19 
20 /-*/
25 #ifndef LIMAL_NFS_SERVER_NFS_EXPORTS_HPP
26 #define LIMAL_NFS_SERVER_NFS_EXPORTS_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 // -------------------------------------------------------------------
36 namespace LIMAL_NAMESPACE
37 {
38 namespace NFS_SERVER_NAMESPACE
39 {
40 
41 
42 // -------------------------------------------------------------------
51 {
52 public:
56  ExportOption();
57 
72  ExportOption(const blocxx::String &name,
73  const blocxx::String &value);
74 
89  ExportOption(const blocxx::String &option);
90 
96  ExportOption(const ExportOption &option);
97 
101  ~ExportOption();
102 
108  bool empty() const;
109 
116  blocxx::String toString() const;
117 
123  blocxx::String getName() const;
124 
130  blocxx::String getValue() const;
131 
136  void setName(const blocxx::String &name);
137 
141  void setValue(const blocxx::String &value);
142 
157  void setOption(const blocxx::String &option);
158 
159 #ifndef SWIG
160  friend bool
161  operator == (const ExportOption & o1, const ExportOption & o2);
162 
163  friend bool
164  operator < (const ExportOption & o1, const ExportOption & o2);
165 #endif
166 
167 private:
168  blocxx::String m_name;
169  blocxx::String m_value;
170 };
171 
172 
173 // -------------------------------------------------------------------
178 typedef blocxx::List<ExportOption> ExportOptions;
179 
180 
181 // -------------------------------------------------------------------
191 {
192 public:
196  ExportClient();
197 
203  ExportClient(const ExportClient &client);
204 
220  ExportClient(const blocxx::String &client,
221  const ExportOptions &options);
222 
234  ExportClient(const blocxx::String &client,
235  const blocxx::String &options);
236 
249  ExportClient(const blocxx::String &clientAndOpts);
250 
254  ~ExportClient();
255 
262  bool empty() const;
263 
270  blocxx::String toString() const;
271 
277  blocxx::String getClient() const;
278 
284  ExportOptions getOptions() const;
285 
291  blocxx::String getOptionsString() const;
292 
298  void setClient (const blocxx::String &client);
299 
305  void setOptions(const ExportOptions &options);
306 
312  void setOptions(const blocxx::String &options);
313 
318  static
319  ExportOptions parseOptions(const blocxx::String &options);
320 
321 #ifndef SWIG
322  friend bool
323  operator == (const ExportClient &c1, const ExportClient &c2);
324 
325  friend bool
326  operator < (const ExportClient &c1, const ExportClient &c2);
327 #endif
328 
329 private:
330  blocxx::String m_client;
332 };
333 
334 
335 // -------------------------------------------------------------------
340 typedef blocxx::List<ExportClient> ExportClients;
341 
342 
343 // -------------------------------------------------------------------
348 typedef blocxx::Array<blocxx::String> ExportComment;
349 
350 
351 // -------------------------------------------------------------------
357 {
358 public:
362  ExportEntry();
363 
369  ExportEntry(const ExportEntry &entry);
370 
371 
379  ExportEntry(const blocxx::String &path,
380  const ExportClients &clients);
381 
390  ExportEntry(const blocxx::String &path,
391  const ExportClients &clients,
392  const ExportComment &comment);
393 
397  ~ExportEntry();
398 
404  bool empty() const;
405 
409  blocxx::String toString() const;
410 
415  blocxx::StringArray toStringArray() const;
416 
420  blocxx::String getPath() const;
421 
425  ExportClients getClients() const;
426 
430  ExportComment getComment() const;
431 
437  void setPath(const blocxx::String &path);
438 
444  void setClients(const ExportClients &clients);
445 
451  void setComment(const ExportComment &comment);
452 
460  bool addClient(const ExportClient &client);
461 
469  bool removeClient(const blocxx::String &cname);
470 
477  bool removeClient(const ExportClient &client);
478 
483  void removeClients();
484 
485 #ifndef SWIG
486  friend bool
487  operator == (const ExportEntry &e1, const ExportEntry &e2);
488 
489  friend bool
490  operator < (const ExportEntry &e1, const ExportEntry &e2);
491 #endif
492 
493 private:
494  blocxx::String m_path;
497 };
498 
499 
500 // -------------------------------------------------------------------
505 typedef blocxx::List<ExportEntry> ExportEntries;
506 typedef blocxx::List<blocxx::String> ExportPaths;
507 
508 
509 // -------------------------------------------------------------------
514 class Exports
515 {
516 public:
518  {
520  E_TRAILING
521  };
522 
526  Exports();
527 
533  Exports(const Exports &exports);
534 
541  Exports(const ExportEntries &entries);
542 
546  ~Exports();
547 
551  ExportPaths getPaths() const;
552 
556  ExportClients getClients(const blocxx::String &path) const;
557 
561  ExportEntries getEntries(const blocxx::String &path) const;
562 
566  ExportEntries getEntries() const;
567 
571  ExportComment getComment(CommentType type) const;
572 
578  void setEntries(const ExportEntries &entries);
579 
586  void setComment(const ExportComment &comment,
587  CommentType type);
588 
598  void addEntry(const ExportEntry &entry);
599 
600 
601 private:
605 
606 };
607 
608 
609 // -------------------------------------------------------------------
610 } // End of NFS_SERVER_NAMESPACE
611 } // End of LIMAL_NAMESPACE
612 
613 #endif // LIMAL_NFS_SERVER_NFS_EXPORTS_HPP
614 // vim: set ts=8 sts=8 sw=8 ai noet: