//=========================================================================== // @(#) $Name: arts++-1-1-a12 $ // @(#) $Id: ArtsProtocolTable.hh,v 1.2 2004/04/21 23:51:29 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 //=========================================================================== #ifndef _ARTSPROTOCOLTABLE_HH_ #define _ARTSPROTOCOLTABLE_HH_ extern "C" { #include #include "caida_t.h" } #include "Arts.hh" //--------------------------------------------------------------------------- // class ArtsProtocolTable : public Arts //--------------------------------------------------------------------------- //! This class abstracts an ARTS protocol table object. This is used //! to hold packet and byte counters for a series of protocols (TCP, UDP, //! ICMP, et. al.). Typical use of this object is to track protocol //! usage in a network with software like cflowd. //--------------------------------------------------------------------------- class ArtsProtocolTable : public Arts { public: //------------------------------------------------------------------------- // ArtsProtocolTable() //......................................................................... //! constructor //------------------------------------------------------------------------- ArtsProtocolTable(); //------------------------------------------------------------------------- // ~ArtsProtocolTable() //......................................................................... //! destructor //------------------------------------------------------------------------- ~ArtsProtocolTable(); //------------------------------------------------------------------------- // uint16_t SampleInterval() const //......................................................................... //! Returns the sampling interval used to collect the data. This //! is for the case where our counter data came from 1:N sampling of //! packet headers. This function returns the N. //------------------------------------------------------------------------- uint16_t SampleInterval() const; //------------------------------------------------------------------------- // uint16_t SampleInterval(uint16_t sampleInterval) //......................................................................... //! Sets and returns the sampling interval used to collect the data. //! This is for the case where our counter data came from 1:N sampling //! of packet headers. This function returns the N. //------------------------------------------------------------------------- uint16_t SampleInterval(uint16_t sampleInterval); //------------------------------------------------------------------------- // uint64_t TotalPkts() const //......................................................................... //! Returns the total number of packets in the table (sum of packets //! for all protocols). //------------------------------------------------------------------------- uint64_t TotalPkts() const; //------------------------------------------------------------------------- // uint64_t TotalPkts(uint64_t totalPkts) //......................................................................... //! Sets and returns the total number of packets in the table (sum of //! packets for all protocols). //------------------------------------------------------------------------- uint64_t TotalPkts(uint64_t totalPkts); //------------------------------------------------------------------------- // uint64_t TotalBytes() const //......................................................................... //! Returns the total number of bytes in the table (sum of bytes for //! all protocols). //------------------------------------------------------------------------- uint64_t TotalBytes() const; //------------------------------------------------------------------------- // uint64_t TotalBytes(uint64_t totalBytes) //......................................................................... //! Sets and returns the total number of bytes in the table (sum of //! bytes for all protocols). //------------------------------------------------------------------------- uint64_t TotalBytes(uint64_t totalBytes); //------------------------------------------------------------------------- // std::vector & ProtocolEntries() const //......................................................................... //! Returns a reference to the vector of protocol entries. //------------------------------------------------------------------------- std::vector & ProtocolEntries() const; //-------------------------------------------------------------------------- // friend std::istream & operator >> (std::istream & is, // ArtsProtocolTable & artsProtocolTable) //.......................................................................... //! Reads an ArtsProtocolTable 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, ArtsProtocolTable & artsProtocolTable); }; #endif // _ARTSPROTOCOLTABLE_HH_