summaryrefslogtreecommitdiff
path: root/src/dev/ethertap.hh
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2007-08-16 16:49:02 -0400
committerAli Saidi <saidi@eecs.umich.edu>2007-08-16 16:49:02 -0400
commit773cb77656174b221c1e51b92a8af7d8e268b733 (patch)
treec6358a24188fde67e0d0a2816f6b9e2b55d8c535 /src/dev/ethertap.hh
parenta9e4daf574e265e419a0a4a6bcbd03edf3a3299f (diff)
downloadgem5-773cb77656174b221c1e51b92a8af7d8e268b733.tar.xz
Devices: Make EtherInts connect in the same way memory ports currently do.
--HG-- extra : convert_revision : 765b096785a77df9adc4791c9101b90696bd7be2
Diffstat (limited to 'src/dev/ethertap.hh')
-rw-r--r--src/dev/ethertap.hh33
1 files changed, 30 insertions, 3 deletions
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 <queue>
#include <string>
+#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<EthPacketPtr> 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<const Params *>(_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 &section);
};
+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__