1 /* 2 3 Firewall Builder 4 5 Copyright (C) 2000 NetCitadel, LLC 6 7 Author: Vadim Kurland vadim@fwbuilder.org 8 9 $Id$ 10 11 12 This program is free software which we release under the GNU General Public 13 License. You may redistribute and/or modify this program under the terms 14 of that license as published by the Free Software Foundation; either 15 version 2 of the License, or (at your option) any later version. 16 17 This program is distributed in the hope that it will be useful, 18 but WITHOUT ANY WARRANTY; without even the implied warranty of 19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 GNU General Public License for more details. 21 22 To get a copy of the GNU General Public License, write to the Free Software 23 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 25 */ 26 27 #ifndef __IPV4_HH_FLAG__ 28 #define __IPV4_HH_FLAG__ 29 30 #include <string> 31 32 #include "fwbuilder/InetAddrMask.h" 33 #include "fwbuilder/Address.h" 34 #include "fwbuilder/FWException.h" 35 #include "fwbuilder/ObjectMatcher.h" 36 37 namespace libfwbuilder 38 { 39 40 class IPv4 : public Address 41 { 42 public: 43 44 IPv4(); 45 virtual ~IPv4(); 46 47 virtual void fromXML(xmlNodePtr parent) throw(FWException); 48 virtual xmlNodePtr toXML(xmlNodePtr xml_parent_node) throw(FWException); 49 dimension()50 virtual unsigned int dimension() const { return 1; } 51 52 DECLARE_FWOBJECT_SUBTYPE(IPv4); 53 54 DECLARE_DISPATCH_METHODS(IPv4); 55 hasInetAddress()56 virtual bool hasInetAddress() const { return true; } 57 58 /** 59 * similar to hasInetAddress() but counts addresses 60 */ countInetAddresses(bool)61 virtual int countInetAddresses(bool) const { return 1; } 62 getAddressObject()63 virtual const Address* getAddressObject() const { return this; } 64 65 virtual void setAddress(const InetAddr &a); 66 virtual void setNetmask(const InetAddr &nm); 67 virtual void setAddressNetmask(const std::string& s); 68 69 virtual void dump(std::ostream &f,bool recursive,bool brief,int offset=0) const; 70 71 virtual bool isPrimaryObject() const; 72 73 }; 74 75 } 76 77 #endif 78 79 80