etherint.hh revision 2
18713Sandreas.hansson@arm.com/* 27586SAli.Saidi@arm.com * Copyright (c) 2003 The Regents of The University of Michigan 37586SAli.Saidi@arm.com * All rights reserved. 47586SAli.Saidi@arm.com * 57586SAli.Saidi@arm.com * Redistribution and use in source and binary forms, with or without 67586SAli.Saidi@arm.com * modification, are permitted provided that the following conditions are 77586SAli.Saidi@arm.com * met: redistributions of source code must retain the above copyright 87586SAli.Saidi@arm.com * notice, this list of conditions and the following disclaimer; 97586SAli.Saidi@arm.com * redistributions in binary form must reproduce the above copyright 107586SAli.Saidi@arm.com * notice, this list of conditions and the following disclaimer in the 117586SAli.Saidi@arm.com * documentation and/or other materials provided with the distribution; 127586SAli.Saidi@arm.com * neither the name of the copyright holders nor the names of its 133970Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from 143005Sstever@eecs.umich.edu * this software without specific prior written permission. 153005Sstever@eecs.umich.edu * 163005Sstever@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 173005Sstever@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 183005Sstever@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 193005Sstever@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 203005Sstever@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 213005Sstever@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 223005Sstever@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 233005Sstever@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 243005Sstever@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 253005Sstever@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 263005Sstever@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 273005Sstever@eecs.umich.edu */ 283005Sstever@eecs.umich.edu 293005Sstever@eecs.umich.edu/* @file 303005Sstever@eecs.umich.edu * Class representing the actual interface between two ethernet 313005Sstever@eecs.umich.edu * components. 323005Sstever@eecs.umich.edu */ 333005Sstever@eecs.umich.edu 343005Sstever@eecs.umich.edu#ifndef __ETHERINT_HH__ 353005Sstever@eecs.umich.edu#define __ETHERINT_HH__ 363005Sstever@eecs.umich.edu 373005Sstever@eecs.umich.edu#include <string> 383005Sstever@eecs.umich.edu 393005Sstever@eecs.umich.edu#include "etherpkt.hh" 403005Sstever@eecs.umich.edu#include "sim_object.hh" 416654Snate@binkert.org 426654Snate@binkert.org/* 436654Snate@binkert.org * Class representing the actual interface between two ethernet 442889SN/A * components. These components are intended to attach to another 452710SN/A * ethernet interface on one side and whatever device on the other. 466654Snate@binkert.org */ 476654Snate@binkert.orgclass EtherInt : public SimObject 486654Snate@binkert.org{ 495457Ssaidi@eecs.umich.edu protected: 506654Snate@binkert.org EtherInt *peer; 516654Snate@binkert.org 525457Ssaidi@eecs.umich.edu public: 536654Snate@binkert.org EtherInt(const std::string &name) : SimObject(name), peer(NULL) {} 546654Snate@binkert.org virtual ~EtherInt() {} 552934SN/A 562549SN/A void setPeer(EtherInt *p); 572995SN/A virtual bool recvPacket(PacketPtr packet) = 0; 583395Shsul@eecs.umich.edu void recvDone() { peer->sendDone(); } 596981SLisa.Hsu@amd.com bool sendPacket(PacketPtr packet) { return peer->recvPacket(packet); } 603448Shsul@eecs.umich.edu virtual void sendDone() = 0; 612549SN/A}; 623444Sktlim@umich.edu 633444Sktlim@umich.edu#endif // __ETHERINT_HH__ 643444Sktlim@umich.edu