//=========================================================================== // 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 _ARTSINTERFACEMATRIX_HH_ #define _ARTSINTERFACEMATRIX_HH_ extern "C" { #include #include "caida_t.h" } #include "Arts.hh" //--------------------------------------------------------------------------- // class ArtsInterfaceMatrix : public Arts //--------------------------------------------------------------------------- //! This class encapsulates an interface matrix object (packets and bytes //! of traffic sent from source interfaces to destination interfaces). //--------------------------------------------------------------------------- class ArtsInterfaceMatrix : public Arts { public: //------------------------------------------------------------------------- // ArtsInterfaceMatrix() //......................................................................... //! constructor //------------------------------------------------------------------------- ArtsInterfaceMatrix(); //------------------------------------------------------------------------- // ~ArtsInterfaceMatrix() //......................................................................... //! destructor //------------------------------------------------------------------------- ~ArtsInterfaceMatrix(); //------------------------------------------------------------------------- // inline uint16_t SampleInterval() const //......................................................................... //! Returns the sampling ratio if the interface matrix was built using //! packet sampling techniques. Normally this value is 1, meaning //! we're working with complete data sets (for example, from Cisco //! flow-export). //------------------------------------------------------------------------- inline uint16_t SampleInterval() const { return(this->InterfaceMatrixData()->SampleInterval()); } //------------------------------------------------------------------------- // inline uint16_t SampleInterval(uint16_t sampleInterval) //......................................................................... //! Sets and returns the sampling ratio if the interface matrix was //! built using packet sampling techniques. Normally this value is 1, //! meaning we're working with complete data sets (for example, from //! Cisco flow-export). //------------------------------------------------------------------------- inline uint16_t SampleInterval(uint16_t sampleInterval) { return(this->InterfaceMatrixData()->SampleInterval(sampleInterval)); } //------------------------------------------------------------------------- // inline uint32_t Count() const //......................................................................... //! Returns the number of interface matrix entries (cells) in an //! ArtsInterfaceMatrix object. //------------------------------------------------------------------------- inline uint32_t Count() const { return(this->InterfaceMatrixData()->Count()); } //------------------------------------------------------------------------- // inline uint32_t Count(uint32_t count) //......................................................................... //! Sets and Returns the number of interface matrix entries (cells) in //! an ArtsInterfaceMatrix object. //------------------------------------------------------------------------- inline uint32_t Count(uint32_t count) { return(this->InterfaceMatrixData()->Count(count)); } //------------------------------------------------------------------------- // inline uint64_t TotalPkts() const //......................................................................... //! Returns the total packets of traffic in the ArtsInterfaceMatrix //! object. The total is the sum of all traffic from each source to //! each destination. //------------------------------------------------------------------------- inline uint64_t TotalPkts() const { return(this->InterfaceMatrixData()->TotalPkts()); } //------------------------------------------------------------------------- // inline uint64_t TotalPkts(uint64_t totalPkts) //......................................................................... //! Sets and returns the total packets of traffic in the //! ArtsInterfaceMatrixData object. The total is the sum of all //! traffic from each source to each destination. //------------------------------------------------------------------------- inline uint64_t TotalPkts(uint64_t totalPkts) { return(this->InterfaceMatrixData()->TotalPkts(totalPkts)); } //------------------------------------------------------------------------- // inline uint64_t TotalBytes() const //......................................................................... //! Returns the total bytes of traffic in the ArtsInterfaceMatrix //! object. The total is the sum of all traffic from each source to //! each destination. //------------------------------------------------------------------------- inline uint64_t TotalBytes() const { return(this->InterfaceMatrixData()->TotalBytes()); } //------------------------------------------------------------------------- // inline uint64_t TotalBytes(uint64_t totalBytes) //......................................................................... //! Sets and returns the total bytes of traffic in the //! ArtsInterfaceMatrix object. The total is the sum of all traffic //! from each source to each destination. //------------------------------------------------------------------------- inline uint64_t TotalBytes(uint64_t totalBytes) { return(this->InterfaceMatrixData()->TotalBytes(totalBytes)); } //------------------------------------------------------------------------- // inline std::vector & InterfaceEntries() const //......................................................................... //! Return a reference to the vector of ArtsInterfaceMatrixEntry //! objects. Note that even though this member may be called from a //! const object, the returned reference is not const; the vector is //! mutable. //------------------------------------------------------------------------- inline std::vector & InterfaceEntries() const { return(this->InterfaceMatrixData()->InterfaceEntries()); } //-------------------------------------------------------------------------- // friend std::istream & // operator >> (std::istream & is, // ArtsInterfaceMatrix & artsInterfaceMatrix) //.......................................................................... //! Reads an ArtsInterfaceMatrix 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, ArtsInterfaceMatrix & artsInterfaceMatrix); }; #endif // _ARTSINTERFACEMATRIX_HH_