//=========================================================================== // $Name: arts++-1-1-a12 $ // $Id: ArtsIpPath.hh,v 1.6 2004/05/26 20:02:18 youngh 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 //=========================================================================== #ifndef _ARTSIPPATH_HH_ #define _ARTSIPPATH_HH_ extern "C" { #include #include "caida_t.h" } #include #include "Arts.hh" #include "ArtsIpPathEntry.hh" //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // class ArtsIpPath : public Arts //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //! This class abstracts an ARTS IP path object. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ class ArtsIpPath : public Arts { public: //------------------------------------------------------------------------- // ArtsIpPath(ipv4addr_t src, ipv4addr_t dst) //......................................................................... //! constructor accepting a source and destination IP address //------------------------------------------------------------------------- ArtsIpPath(ipv4addr_t src, ipv4addr_t dst); //------------------------------------------------------------------------- // ArtsIpPath(const ArtsIpPath & artsIpPath) //......................................................................... //! Copy constructor. //------------------------------------------------------------------------- ArtsIpPath(const ArtsIpPath & artsIpPath); //------------------------------------------------------------------------- // ArtsIpPath() //......................................................................... //! default constructor //------------------------------------------------------------------------- ArtsIpPath(); //------------------------------------------------------------------------- // ~ArtsIpPath() //......................................................................... //! destructor //------------------------------------------------------------------------- ~ArtsIpPath(); //------------------------------------------------------------------------- // inline ipv4addr_t Src() const //......................................................................... //! Returns the source address of the IP path. //------------------------------------------------------------------------- inline ipv4addr_t Src() const { return(this->IpPathData()->Src()); } //------------------------------------------------------------------------- // inline ipv4addr_t Dst() const //......................................................................... //! Returns the destinatino address of the IP path. //------------------------------------------------------------------------- inline ipv4addr_t Dst() const { return(this->IpPathData()->Dst()); } //------------------------------------------------------------------------- // inline uint32_t ListId() const //......................................................................... //! Returns the ID of the destination list to which this trace belongs. //------------------------------------------------------------------------- inline uint32_t ListId() const { return(this->IpPathData()->ListId()); } //------------------------------------------------------------------------- // inline uint32_t ListId(uint32_t id) //......................................................................... //! Sets and returns the destination list ID. //------------------------------------------------------------------------- inline uint32_t ListId(uint32_t id) { return(this->IpPathData()->ListId(id)); } //------------------------------------------------------------------------- // inline uint32_t CycleId() const //......................................................................... //! Returns the ID (timestamp) of the cycle on which this trace was taken. //------------------------------------------------------------------------- inline uint32_t CycleId() const { return(this->IpPathData()->CycleId()); } //------------------------------------------------------------------------- // inline uint32_t CycleId(uint32_t id) //......................................................................... //! Sets and returns the cycle ID (timestamp). //------------------------------------------------------------------------- inline uint32_t CycleId(uint32_t id) { return(this->IpPathData()->CycleId(id)); } //------------------------------------------------------------------------- // Returns the round-trip time from the source to the destination and back. //------------------------------------------------------------------------- inline const struct timeval Rtt() const { return(this->IpPathData()->Rtt()); } //------------------------------------------------------------------------- // Sets and returns the round-trip time from the source to the // destination and back. //------------------------------------------------------------------------- const struct timeval Rtt(const struct timeval & rtt) { return(this->IpPathData()->Rtt(rtt)); } //------------------------------------------------------------------------- // uint8_t HopDistance() const //......................................................................... //! Returns the hop distance from the source to the destination. //------------------------------------------------------------------------- uint8_t HopDistance() const { return(this->IpPathData()->HopDistance()); } //------------------------------------------------------------------------- // uint8_t HopDistance(uint8_t hopDistance) //......................................................................... //! Sets and returns the hop distance from the source to the destination. //------------------------------------------------------------------------- uint8_t HopDistance(uint8_t hopDistance) { return(this->IpPathData()->HopDistance(hopDistance)); } //AL: //-------------------------------------------------------------------------- // void AddHop(ipv4addr_t ipAddr, uint8_t hopNum, // const struct timeval & rtt, uint8_t numTries) //.......................................................................... //! Appends a hop to the path. Assigns an IP address of ipAddr and //! a hop number of hopNum to the new hop, the number of tries for this hop, with a round-trip time of //! rtt. Note we *always* tack the new hop on the end of the path, //! and do *not* use hopNum to determine the location. //-------------------------------------------------------------------------- void AddHop(ipv4addr_t ipAddr, uint8_t hopNum, const struct timeval & rtt, uint8_t numTries=-1) { this->IpPathData()->AddHop(ipAddr,hopNum,rtt, numTries); return; } //-------------------------------------------------------------------------- // friend std::istream & operator >> (std::istream & is, ArtsIpPath & artsIpPath) //.......................................................................... //! Reads an ArtsIpPath from an istream. Note this is included //! for use with an istream_iterator and is not intended to be used //! in any other manner; it skips over other types of arts objects //! in the input stream. //-------------------------------------------------------------------------- friend std::istream & operator >> (std::istream & is, ArtsIpPath & artsIpPath); }; #endif /* _ARTSIPPATH_HH_ */