1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-06-25 02:19:37 +02:00

added shallowDuplicate to IPv6 and NetworkIPv6

This commit is contained in:
Vadim Kurland
2008-05-14 03:52:21 +00:00
parent a3e72e3ccf
commit d2641481db
4 changed files with 41 additions and 6 deletions

View File

@@ -69,6 +69,16 @@ IPv6::~IPv6()
{
}
FWObject& IPv6::shallowDuplicate(const FWObject *other,
bool preserve_id) throw(FWException)
{
const IPv6* a_other = IPv6::constcast(other);
delete inet_addr_mask;
inet_addr_mask = new Inet6AddrMask(
*(dynamic_cast<Inet6AddrMask*>(a_other->inet_addr_mask)));
return FWObject::shallowDuplicate(other, preserve_id);
}
void IPv6::fromXML(xmlNodePtr root) throw(FWException)
{
FWObject::fromXML(root);

View File

@@ -52,6 +52,10 @@ public:
DECLARE_FWOBJECT_SUBTYPE(IPv6);
virtual FWObject& shallowDuplicate(const FWObject *obj,
bool preserve_id = true)
throw(FWException);
virtual const bool hasInetAddress(bool ipv6=false) const
{
if (ipv6) return true;

View File

@@ -42,20 +42,27 @@ const char *NetworkIPv6::TYPENAME={"NetworkIPv6"};
NetworkIPv6::NetworkIPv6() : Address()
{
setNetmask(Inet6Addr(0));
delete inet_addr_mask;
inet_addr_mask = new Inet6AddrMask();
// setNetmask(Inet6Addr(0));
}
NetworkIPv6::NetworkIPv6(const FWObject *root,bool prepopulate) :
Address(root, prepopulate)
{
setNetmask(Inet6Addr(0));
delete inet_addr_mask;
inet_addr_mask = new Inet6AddrMask();
// setNetmask(Inet6Addr(0));
}
NetworkIPv6::NetworkIPv6(NetworkIPv6 &o) : Address(o)
NetworkIPv6::NetworkIPv6(NetworkIPv6 &other) : Address(other)
{
FWObject::operator=(o);
setAddress(o.getAddress());
setNetmask(o.getNetmask());
delete inet_addr_mask;
inet_addr_mask = new Inet6AddrMask(
*(dynamic_cast<Inet6AddrMask*>(other.inet_addr_mask)));
FWObject::operator=(other);
// setAddress(o.getAddress());
// setNetmask(o.getNetmask());
}
NetworkIPv6::NetworkIPv6 (const string &s) : Address()
@@ -65,6 +72,16 @@ NetworkIPv6::NetworkIPv6 (const string &s) : Address()
NetworkIPv6::~NetworkIPv6() {}
FWObject& NetworkIPv6::shallowDuplicate(const FWObject *other,
bool preserve_id) throw(FWException)
{
const NetworkIPv6* a_other = NetworkIPv6::constcast(other);
delete inet_addr_mask;
inet_addr_mask = new Inet6AddrMask(
*(dynamic_cast<Inet6AddrMask*>(a_other->inet_addr_mask)));
return FWObject::shallowDuplicate(other, preserve_id);
}
void NetworkIPv6::fromXML(xmlNodePtr root) throw(FWException)
{
FWObject::fromXML(root);

View File

@@ -52,6 +52,10 @@ public:
DECLARE_FWOBJECT_SUBTYPE(NetworkIPv6);
virtual FWObject& shallowDuplicate(const FWObject *obj,
bool preserve_id = true)
throw(FWException);
virtual const bool hasInetAddress(bool ipv6=false) const
{
if (ipv6) return true;