etherint.hh revision 1762
12686Sksewell@umich.edu/*
22100SN/A * Copyright (c) 2002-2005 The Regents of The University of Michigan
35254Sksewell@umich.edu * All rights reserved.
45254Sksewell@umich.edu *
55254Sksewell@umich.edu * Redistribution and use in source and binary forms, with or without
65254Sksewell@umich.edu * modification, are permitted provided that the following conditions are
75254Sksewell@umich.edu * met: redistributions of source code must retain the above copyright
85254Sksewell@umich.edu * notice, this list of conditions and the following disclaimer;
95254Sksewell@umich.edu * redistributions in binary form must reproduce the above copyright
105254Sksewell@umich.edu * notice, this list of conditions and the following disclaimer in the
115254Sksewell@umich.edu * documentation and/or other materials provided with the distribution;
125254Sksewell@umich.edu * neither the name of the copyright holders nor the names of its
135254Sksewell@umich.edu * contributors may be used to endorse or promote products derived from
145254Sksewell@umich.edu * this software without specific prior written permission.
155254Sksewell@umich.edu *
165254Sksewell@umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
175254Sksewell@umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
185254Sksewell@umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
195254Sksewell@umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
205254Sksewell@umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
215254Sksewell@umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
225254Sksewell@umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
235254Sksewell@umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
245254Sksewell@umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
255254Sksewell@umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
265254Sksewell@umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
275254Sksewell@umich.edu */
285254Sksewell@umich.edu
295254Sksewell@umich.edu/* @file
305254Sksewell@umich.edu * Class representing the actual interface between two ethernet
315254Sksewell@umich.edu * components.
322706Sksewell@umich.edu */
332022SN/A
342022SN/A#ifndef __DEV_ETHERINT_HH__
352043SN/A#define __DEV_ETHERINT_HH__
362024SN/A
372024SN/A#include <string>
382043SN/A
392686Sksewell@umich.edu#include "dev/etherpkt.hh"
404661Sksewell@umich.edu#include "sim/sim_object.hh"
412022SN/A
422083SN/A/*
432686Sksewell@umich.edu * Class representing the actual interface between two ethernet
442101SN/A * components.  These components are intended to attach to another
452043SN/A * ethernet interface on one side and whatever device on the other.
462043SN/A */
472101SN/Aclass EtherInt : public SimObject
482101SN/A{
496384Sgblack@eecs.umich.edu  protected:
506384Sgblack@eecs.umich.edu    EtherInt *peer;
516384Sgblack@eecs.umich.edu
526384Sgblack@eecs.umich.edu  public:
536384Sgblack@eecs.umich.edu    EtherInt(const std::string &name) : SimObject(name), peer(NULL) {}
546384Sgblack@eecs.umich.edu    virtual ~EtherInt() {}
552101SN/A
562101SN/A    void setPeer(EtherInt *p);
572101SN/A
582046SN/A    void recvDone() { peer->sendDone(); }
592686Sksewell@umich.edu    virtual void sendDone() = 0;
602686Sksewell@umich.edu
612686Sksewell@umich.edu    bool sendPacket(PacketPtr packet)
622470SN/A    { return peer ? peer->recvPacket(packet) : true; }
632686Sksewell@umich.edu    virtual bool recvPacket(PacketPtr packet) = 0;
644661Sksewell@umich.edu};
655222Sksewell@umich.edu
665222Sksewell@umich.edu#endif // __DEV_ETHERINT_HH__
672686Sksewell@umich.edu