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_NETWORKS_H 00020 #define LIB_SPACE_NETWORKS_H 00021 00022 #include <list> 00023 #include <boost/shared_ptr.hpp> 00024 00025 #include <lib/space.h> 00026 00031 class space_networks: 00032 public space 00033 { 00034 public: 00035 typedef boost::shared_ptr<space_networks> pointer; 00036 00040 virtual ~space_networks(); 00041 00049 static pointer create(const rcstring &filename); 00050 00055 class record 00056 { 00057 public: 00058 typedef boost::shared_ptr<record> pointer; 00059 00063 ~record(); 00064 00065 typedef std::list<rcstring> aliases_t; 00066 00071 static pointer create(const source_location &locn, const rcstring &name, 00072 const rcstring &number, const aliases_t &aliases); 00073 00074 const source_location &get_source_location(void) const { return locn; } 00075 rcstring get_name(void) const { return name; } 00076 rcstring get_number(void) const { return number; } 00077 unsigned long get_number_binary(void) const; 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 &number, const aliases_t &aliases); 00095 00096 source_location locn; 00097 rcstring name; 00098 rcstring number; 00099 aliases_t aliases; 00100 00101 record(); 00102 record(const record &rhs); 00103 record &operator=(const record &rhs); 00104 }; 00105 00117 record::pointer get(void); 00118 00124 static bool is_ok_name(const rcstring &input, rcstring &output); 00125 00130 static bool is_ok_name(const rcstring &); 00131 00132 protected: 00140 space_networks(const rcstring &filename); 00141 00142 private: 00147 unsigned long last_addr; 00148 00152 space_networks(); 00153 00157 space_networks(const space_networks &); 00158 00162 space_networks &operator=(const space_networks &); 00163 }; 00164 00165 // vim: set ts=8 sw=4 et : 00166 #endif // LIB_SPACE_NETWORKS_H