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_NETMASKS_H 00020 #define LIB_SPACE_NETMASKS_H 00021 00022 #include <boost/shared_ptr.hpp> 00023 00024 #include <lib/space.h> 00025 00030 class space_netmasks: 00031 public space 00032 { 00033 public: 00034 typedef boost::shared_ptr<space_netmasks> pointer; 00035 00039 virtual ~space_netmasks(); 00040 00048 static pointer create(const rcstring &filename); 00049 00054 class record 00055 { 00056 public: 00057 typedef boost::shared_ptr<record> pointer; 00058 00062 ~record(); 00063 00077 static pointer create(const source_location &locn, 00078 const rcstring &number, const rcstring &mask); 00079 00086 rcstring representation(void) const; 00087 00088 const source_location &get_source_location(void) const { return locn; } 00089 rcstring get_number(void) const { return number; } 00090 unsigned long get_number_binary(void) const; 00091 rcstring get_mask(void) const { return mask; } 00092 unsigned long get_mask_binary(void) const; 00093 00094 private: 00108 record(const source_location &locn, const rcstring &number, 00109 const rcstring &mask); 00110 00111 source_location locn; 00112 rcstring number; 00113 rcstring mask; 00114 00118 record(); 00119 00123 record(const record &rhs); 00124 00128 record &operator=(const record &rhs); 00129 }; 00130 00142 record::pointer get(void); 00143 00144 protected: 00152 space_netmasks(const rcstring &filename); 00153 00154 private: 00159 unsigned long last_number; 00160 00164 space_netmasks(); 00165 00169 space_netmasks(const space_netmasks &); 00170 00174 space_netmasks &operator=(const space_netmasks &); 00175 }; 00176 00177 // vim: set ts=8 sw=4 et : 00178 #endif // LIB_SPACE_NETMASKS_H