//=========================================================================== // @(#) $Name: cflowd-2-1-b1 $ // @(#) $Id: CflowdProtocolTable.hh,v 1.7 1998/09/16 17:53:33 dwm Exp $ //=========================================================================== // CAIDA Copyright Notice // // By accessing this software, cflowd++, you are duly informed // of and agree to be bound by the conditions described below in this // notice: // // This software product, cflowd++, 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 cflowd++ software. You can redistribute it // and/or modify it under the terms of the GNU General Public License, // v. 2 dated June 1991 which is incorporated by reference herein. // cflowd++ 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 GPL along with cflowd++. // Copies can also be obtained from: // // http://www.gnu.org/copyleft/gpl.html // // or by writing to: // // University of California, San Diego // // SDSC/CAIDA // 9500 Gilman Dr., MS-0505 // La Jolla, CA 92093 - 0505 USA // // Or contact: // // info@caida.org //=========================================================================== #ifndef _CFLOWDPROTOCOLTABLE_HH_ #define _CFLOWDPROTOCOLTABLE_HH_ extern "C" { #include #include #include "caida_t.h" } #include using namespace std; #include "ArtsPrimitive.hh" #include "CflowdProtocolTableTrafficCounter.hh" #include "CflowdRawFlow.hh" typedef map > _CflowdProtocolTableMap_t; //--------------------------------------------------------------------------- // class CflowdProtocolTable : public _CflowdProtocolTableMap_t //--------------------------------------------------------------------------- // This class is used to contain protocol traffic data in cflowd++. // We use the protocol number as a key, and a // CflowdProtocolTableTrafficCounter to hold data in an STL map. // Note we just inherit from an instantiation of an STL map, then just // add some new member functions. //--------------------------------------------------------------------------- class CflowdProtocolTable : public _CflowdProtocolTableMap_t { public: typedef _CflowdProtocolTableMap_t::iterator iterator; typedef _CflowdProtocolTableMap_t::const_iterator const_iterator; //------------------------------------------------------------------------- // int AddFlow(const CflowdRawFlow & flow) //......................................................................... // Adds data to the protocol table from the flows in flowpdu. // Returns the number of flows handled. //------------------------------------------------------------------------- int AddFlow(const CflowdRawFlow & flow); //------------------------------------------------------------------------- // istream & read(istream & is) //......................................................................... // Reads the protocol data from an istream. Returns the istream. //------------------------------------------------------------------------- istream & read(istream & is); //------------------------------------------------------------------------- // int read(int fd) //......................................................................... // Reads the protocol data from a file descriptor. Returns the // number of bytes read on success, -1 on failure. //------------------------------------------------------------------------- int read(int fd); //------------------------------------------------------------------------- // ostream & write(ostream & os) const //......................................................................... // Writes the protocol data to an ostream. Returns the ostream. //------------------------------------------------------------------------- ostream & write(ostream & os) const; //------------------------------------------------------------------------- // int write(int fd) const //......................................................................... // Writes the protocol data to a file descriptor. Returns the // number of bytes written on success, -1 on failure. //------------------------------------------------------------------------- int write(int fd) const; //------------------------------------------------------------------------- // friend ostream& operator << (ostream& os, // const CflowdProtocolTable & protocolTable) //......................................................................... // //------------------------------------------------------------------------- friend ostream& operator << (ostream& os, const CflowdProtocolTable & protocolTable); }; #endif // _CFLOWDPROTOCOLTABLE_HH_