nis-util
1.0.D108
|
00001 // 00002 // nis-util - NIS Administration Utilities 00003 // Copyright (C) 2002, 2008, 2009, 2012 Peter Miller 00004 // 00005 // This program is free software; you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation; either version 2 of the License, or (at 00008 // your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 // General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 // 00018 00019 #ifndef LIB_SPACE_SERVICES_H 00020 #define LIB_SPACE_SERVICES_H 00021 00022 #include <list> 00023 #include <lib/space.h> 00024 00029 class space_services: 00030 public space 00031 { 00032 public: 00033 typedef boost::shared_ptr<space_services> pointer; 00034 00038 virtual ~space_services(); 00039 00047 static pointer create(const rcstring &filename); 00048 00053 class record 00054 { 00055 public: 00056 typedef boost::shared_ptr<record> pointer; 00057 00061 ~record(); 00062 00063 typedef std::list<rcstring> aliases_t; 00064 00069 static pointer create(const source_location &locn, const rcstring &name, 00070 const rcstring &port, const rcstring &protocol, 00071 const aliases_t &aliases); 00072 00073 const source_location &get_source_location(void) const { return locn; } 00074 rcstring get_name(void) const { return name; } 00075 rcstring get_port(void) const { return port; } 00076 int get_port_binary(void) const; 00077 rcstring get_protocol(void) const { return protocol; } 00078 const aliases_t &get_aliases(void) const { return aliases; } 00079 00086 rcstring representation(void) const; 00087 00088 private: 00093 record(const source_location &locn, const rcstring &name, 00094 const rcstring &port, const rcstring &protocol, 00095 const aliases_t &aliases); 00096 00101 source_location locn; 00102 00107 rcstring name; 00108 00113 rcstring port; 00114 00119 rcstring protocol; 00120 00125 aliases_t aliases; 00126 }; 00127 00139 record::pointer get(void); 00140 00154 static bool is_ok_name(const rcstring &name, rcstring &suggest); 00155 00156 protected: 00164 space_services(const rcstring &filename); 00165 00166 private: 00171 int last_num; 00172 00176 space_services(); 00177 00181 space_services(const space_services &); 00182 00186 space_services &operator=(const space_services &); 00187 }; 00188 00189 // vim: set ts=8 sw=4 et : 00190 #endif // LIB_SPACE_SERVICES_H