From 773cb77656174b221c1e51b92a8af7d8e268b733 Mon Sep 17 00:00:00 2001 From: Ali Saidi Date: Thu, 16 Aug 2007 16:49:02 -0400 Subject: Devices: Make EtherInts connect in the same way memory ports currently do. --HG-- extra : convert_revision : 765b096785a77df9adc4791c9101b90696bd7be2 --- src/dev/ethertap.hh | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) (limited to 'src/dev/ethertap.hh') diff --git a/src/dev/ethertap.hh b/src/dev/ethertap.hh index 3d2838817..5c24be460 100644 --- a/src/dev/ethertap.hh +++ b/src/dev/ethertap.hh @@ -38,19 +38,22 @@ #include #include +#include "base/pollevent.hh" +#include "dev/etherobject.hh" #include "dev/etherint.hh" #include "dev/etherpkt.hh" +#include "params/EtherTap.hh" #include "sim/eventq.hh" -#include "base/pollevent.hh" #include "sim/sim_object.hh" class TapEvent; class TapListener; +class EtherTapInt; /* * Interface to connect a simulated ethernet device to the real world */ -class EtherTap : public EtherInt +class EtherTap : public EtherObject { protected: friend class TapEvent; @@ -73,6 +76,7 @@ class EtherTap : public EtherInt protected: std::string device; std::queue packetBuffer; + EtherTapInt *interface; void process(int revent); void enqueue(EthPacketData *packet); @@ -96,9 +100,18 @@ class EtherTap : public EtherInt TxEvent txEvent; public: - EtherTap(const std::string &name, EtherDump *dump, int port, int bufsz); + typedef EtherTapParams Params; + EtherTap(const Params *p); virtual ~EtherTap(); + const Params * + params() const + { + return dynamic_cast(_params); + } + + virtual EtherInt *getEthPort(const std::string &if_name, int idx); + virtual bool recvPacket(EthPacketPtr packet); virtual void sendDone(); @@ -106,4 +119,18 @@ class EtherTap : public EtherInt virtual void unserialize(Checkpoint *cp, const std::string §ion); }; +class EtherTapInt : public EtherInt +{ + private: + EtherTap *tap; + public: + EtherTapInt(const std::string &name, EtherTap *t) + : EtherInt(name), tap(t) + { } + + virtual bool recvPacket(EthPacketPtr pkt) { return tap->recvPacket(pkt); } + virtual void sendDone() { tap->sendDone(); } +}; + + #endif // __ETHERTAP_HH__ -- cgit v1.2.3