etherint.hh revision 2665
111308Santhony.gutierrez@amd.com/* 211308Santhony.gutierrez@amd.com * Copyright (c) 2002-2005 The Regents of The University of Michigan 311308Santhony.gutierrez@amd.com * All rights reserved. 411308Santhony.gutierrez@amd.com * 511308Santhony.gutierrez@amd.com * Redistribution and use in source and binary forms, with or without 611308Santhony.gutierrez@amd.com * modification, are permitted provided that the following conditions are 711308Santhony.gutierrez@amd.com * met: redistributions of source code must retain the above copyright 811308Santhony.gutierrez@amd.com * notice, this list of conditions and the following disclaimer; 911308Santhony.gutierrez@amd.com * redistributions in binary form must reproduce the above copyright 1011308Santhony.gutierrez@amd.com * notice, this list of conditions and the following disclaimer in the 1111308Santhony.gutierrez@amd.com * documentation and/or other materials provided with the distribution; 1211308Santhony.gutierrez@amd.com * neither the name of the copyright holders nor the names of its 1311308Santhony.gutierrez@amd.com * contributors may be used to endorse or promote products derived from 1411308Santhony.gutierrez@amd.com * this software without specific prior written permission. 1511308Santhony.gutierrez@amd.com * 1611308Santhony.gutierrez@amd.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1711308Santhony.gutierrez@amd.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1811308Santhony.gutierrez@amd.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1911308Santhony.gutierrez@amd.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2011308Santhony.gutierrez@amd.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2111308Santhony.gutierrez@amd.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2211308Santhony.gutierrez@amd.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2311308Santhony.gutierrez@amd.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2411308Santhony.gutierrez@amd.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2511308Santhony.gutierrez@amd.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2611308Santhony.gutierrez@amd.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2711308Santhony.gutierrez@amd.com * 2811308Santhony.gutierrez@amd.com * Authors: Nathan Binkert 2911308Santhony.gutierrez@amd.com */ 3011308Santhony.gutierrez@amd.com 3111308Santhony.gutierrez@amd.com/* @file 3211308Santhony.gutierrez@amd.com * Class representing the actual interface between two ethernet 3311308Santhony.gutierrez@amd.com * components. 3411308Santhony.gutierrez@amd.com */ 3511308Santhony.gutierrez@amd.com 3611308Santhony.gutierrez@amd.com#ifndef __DEV_ETHERINT_HH__ 3711308Santhony.gutierrez@amd.com#define __DEV_ETHERINT_HH__ 3811308Santhony.gutierrez@amd.com 3911308Santhony.gutierrez@amd.com#include <string> 4011308Santhony.gutierrez@amd.com 4111308Santhony.gutierrez@amd.com#include "dev/etherpkt.hh" 4211308Santhony.gutierrez@amd.com#include "sim/sim_object.hh" 4311308Santhony.gutierrez@amd.com 4411308Santhony.gutierrez@amd.com/* 4511308Santhony.gutierrez@amd.com * Class representing the actual interface between two ethernet 4611308Santhony.gutierrez@amd.com * components. These components are intended to attach to another 4711308Santhony.gutierrez@amd.com * ethernet interface on one side and whatever device on the other. 4811308Santhony.gutierrez@amd.com */ 4911308Santhony.gutierrez@amd.comclass EtherInt : public SimObject 5011308Santhony.gutierrez@amd.com{ 5111308Santhony.gutierrez@amd.com protected: 5211308Santhony.gutierrez@amd.com EtherInt *peer; 5311308Santhony.gutierrez@amd.com 5411308Santhony.gutierrez@amd.com public: 5511308Santhony.gutierrez@amd.com EtherInt(const std::string &name) : SimObject(name), peer(NULL) {} 5611308Santhony.gutierrez@amd.com virtual ~EtherInt() {} 5711308Santhony.gutierrez@amd.com 5811308Santhony.gutierrez@amd.com void setPeer(EtherInt *p); 5911308Santhony.gutierrez@amd.com 6011308Santhony.gutierrez@amd.com void recvDone() { peer->sendDone(); } 6111308Santhony.gutierrez@amd.com virtual void sendDone() = 0; 6211308Santhony.gutierrez@amd.com 6311308Santhony.gutierrez@amd.com bool sendPacket(EthPacketPtr packet) 6411308Santhony.gutierrez@amd.com { return peer ? peer->recvPacket(packet) : true; } 6511308Santhony.gutierrez@amd.com virtual bool recvPacket(EthPacketPtr packet) = 0; 6611308Santhony.gutierrez@amd.com}; 6711308Santhony.gutierrez@amd.com 6811308Santhony.gutierrez@amd.com#endif // __DEV_ETHERINT_HH__ 6911308Santhony.gutierrez@amd.com