etherdump.hh revision 5402
1955SN/A/* 2955SN/A * Copyright (c) 2002-2005 The Regents of The University of Michigan 31762SN/A * All rights reserved. 4955SN/A * 5955SN/A * Redistribution and use in source and binary forms, with or without 6955SN/A * modification, are permitted provided that the following conditions are 7955SN/A * met: redistributions of source code must retain the above copyright 8955SN/A * notice, this list of conditions and the following disclaimer; 9955SN/A * redistributions in binary form must reproduce the above copyright 10955SN/A * notice, this list of conditions and the following disclaimer in the 11955SN/A * documentation and/or other materials provided with the distribution; 12955SN/A * neither the name of the copyright holders nor the names of its 13955SN/A * contributors may be used to endorse or promote products derived from 14955SN/A * this software without specific prior written permission. 15955SN/A * 16955SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17955SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18955SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19955SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20955SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21955SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22955SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23955SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24955SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25955SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26955SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27955SN/A * 282665Ssaidi@eecs.umich.edu * Authors: Nathan Binkert 294762Snate@binkert.org */ 30955SN/A 315522Snate@binkert.org/* @file 326143Snate@binkert.org * Simple object for creating a simple pcap style packet trace 334762Snate@binkert.org */ 345522Snate@binkert.org 35955SN/A#ifndef __ETHERDUMP_H__ 365522Snate@binkert.org#define __ETHERDUMP_H__ 37955SN/A 385522Snate@binkert.org#include <fstream> 394202Sbinkertn@umich.edu#include "dev/etherpkt.hh" 405742Snate@binkert.org#include "sim/sim_object.hh" 41955SN/A#include "params/EtherDump.hh" 424381Sbinkertn@umich.edu 434381Sbinkertn@umich.edu/* 448334Snate@binkert.org * Simple object for creating a simple pcap style packet trace 45955SN/A */ 46955SN/Aclass EtherDump : public SimObject 474202Sbinkertn@umich.edu{ 48955SN/A private: 494382Sbinkertn@umich.edu std::ostream *stream; 504382Sbinkertn@umich.edu const int maxlen; 514382Sbinkertn@umich.edu void dumpPacket(EthPacketPtr &packet); 526654Snate@binkert.org void init(); 535517Snate@binkert.org 548614Sgblack@eecs.umich.edu Tick curtime; 557674Snate@binkert.org 566143Snate@binkert.org public: 576143Snate@binkert.org typedef EtherDumpParams Params; 586143Snate@binkert.org EtherDump(const Params *p); 598233Snate@binkert.org 608233Snate@binkert.org inline void dump(EthPacketPtr &pkt) { dumpPacket(pkt); } 618233Snate@binkert.org}; 628233Snate@binkert.org 638233Snate@binkert.org#endif // __ETHERDUMP_H__ 648334Snate@binkert.org