//=========================================================================== // $Name: arts++-1-1-a12 $ // $Id: ArtsBgp4Prefix.cc,v 1.2 2004/04/21 23:51:31 kkeys Exp $ //=========================================================================== // Copyright Notice // // By accessing this software, arts++, you are duly informed // of and agree to be bound by the conditions described below in this // notice: // // This software product, arts++, is developed by Daniel W. McRobb, and // copyrighted(C) 1998 by the University of California, San Diego // (UCSD), with all rights reserved. UCSD administers the CAIDA grant, // NCR-9711092, under which part of this code was developed. // // There is no charge for arts++ software. You can redistribute it // and/or modify it under the terms of the GNU Lesser General Public // License, Version 2.1, February 1999, which is incorporated by // reference herein. // // arts++ is distributed WITHOUT ANY WARRANTY, IMPLIED OR EXPRESS, OF // MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE or that the use // of it will not infringe on any third party's intellectual // property rights. // // You should have received a copy of the GNU Lesser General Public // License along with arts++. Copies can also be obtained from: // // http://www.gnu.org/copyleft/lesser.html // // or by writing to: // // Free Software Foundation, Inc. // 59 Temple Place, Suite 330 // Boston, MA 02111-1307 // USA // // Or contact: // // info@caida.org //=========================================================================== extern "C" { #include } #include #include "ArtsBgp4Prefix.hh" using namespace std; static const std::string rcsid = "@(#) $Name: arts++-1-1-a12 $ $Id: ArtsBgp4Prefix.cc,v 1.2 2004/04/21 23:51:31 kkeys Exp $"; //------------------------------------------------------------------------- // uint8_t ArtsBgp4Prefix::AddressFamily() const //......................................................................... // //------------------------------------------------------------------------- uint8_t ArtsBgp4Prefix::AddressFamily() const { return(this->_addressFamily); } //------------------------------------------------------------------------- // uint8_t ArtsBgp4Prefix::AddressFamily(uint8_t addressFamily) //......................................................................... // //------------------------------------------------------------------------- uint8_t ArtsBgp4Prefix::AddressFamily(uint8_t addressFamily) { this->_addressFamily = addressFamily; return(this->_addressFamily); } //------------------------------------------------------------------------- // uint8_t ArtsBgp4Prefix::MaskLength() const //......................................................................... // //------------------------------------------------------------------------- uint8_t ArtsBgp4Prefix::MaskLength() const { return(this->_maskLength); } //------------------------------------------------------------------------- // uint8_t ArtsBgp4Prefix::MaskLength(uint8_t maskLength) //......................................................................... // //------------------------------------------------------------------------- uint8_t ArtsBgp4Prefix::MaskLength(uint8_t maskLength) { this->_maskLength = maskLength; return(this->_maskLength); } //------------------------------------------------------------------------- // ipv4addr_t ArtsBgp4Prefix::Ipv4Network() const //......................................................................... // //------------------------------------------------------------------------- ipv4addr_t ArtsBgp4Prefix::Ipv4Network() const { return(this->_network.network.ipv4addr); } //------------------------------------------------------------------------- // ipv4addr_t ArtsBgp4Prefix::Ipv4Network(ipv4addr_t ipv4Network) //......................................................................... // //------------------------------------------------------------------------- ipv4addr_t ArtsBgp4Prefix::Ipv4Network(ipv4addr_t ipv4Network) { this->_network.network.ipv4addr = ipv4Network; return(this->_network.network.ipv4addr); } #ifdef HAVE_IPV6 //------------------------------------------------------------------------- // ipv6addr_t ArtsBgp4Prefix::Ipv6Network() const //......................................................................... // //------------------------------------------------------------------------- ipv6addr_t ArtsBgp4Prefix::Ipv6Network() const { return(this->_network.network.ipv6addr); } //------------------------------------------------------------------------- // ipv6addr_t ArtsBgp4Prefix::Ipv6Network(ipv6addr_t ipv6Network) //......................................................................... // //------------------------------------------------------------------------- ipv6addr_t ArtsBgp4Prefix::Ipv6Network(ipv6addr_t ipv6Network) { memcpy(this->_network.network.ipv6addr,ipv6Network,sizeof(ipv6Network)); return(this->_network.network.ipv6addr); } #endif // HAVE_IPV6 //------------------------------------------------------------------------- // ArtsBgp4Prefix & // ArtsBgp4Prefix::operator = (const ArtsBgp4Prefix & bgp4prefix) //......................................................................... // //------------------------------------------------------------------------- ArtsBgp4Prefix & ArtsBgp4Prefix::operator = (const ArtsBgp4Prefix & bgp4prefix) { this->_addressFamily = bgp4prefix.AddressFamily(); switch (this->_addressFamily) { case AF_INET: this->Ipv4Network(bgp4prefix.Ipv4Network()); break; #ifdef HAVE_IPV6 case AF_INET6: this->Ipv6Network(bgp4prefix.Ipv6Network()); break; #endif default: break; } return(*this); }