diff options
author | Gabe Black <gabeblack@google.com> | 2017-06-03 07:23:05 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2017-06-03 15:24:02 +0000 |
commit | c58537ca206f2fb3829050a4a0e342edef0bd64b (patch) | |
tree | b0813e58558ed89290b11cf9aa4561f19e0ffddc /src/dev/net/ethertap.hh | |
parent | 2ce045341b73166cad2ef95b37c87d8d4c590d80 (diff) | |
download | gem5-c58537ca206f2fb3829050a4a0e342edef0bd64b.tar.xz |
dev: Add a version of EtherTap which uses the tap driver.
The object is called EtherTap (as opposed to EtherTapStub, what the former
EtherTap was renamed to), and its existance is gated on the linux/if_tun.h
header file existing. That's probably overly strict, but it will hopefully
be minimally likely to break the build for other systems.
Change-Id: Ie03507fadf0d843a4d4d52f283c44a416c6f2a74
Reviewed-on: https://gem5-review.googlesource.com/3646
Reviewed-by: Nathan Binkert <nate@binkert.org>
Maintainer: Nathan Binkert <nate@binkert.org>
Diffstat (limited to 'src/dev/net/ethertap.hh')
-rw-r--r-- | src/dev/net/ethertap.hh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/dev/net/ethertap.hh b/src/dev/net/ethertap.hh index 718af1808..96cc4710c 100644 --- a/src/dev/net/ethertap.hh +++ b/src/dev/net/ethertap.hh @@ -39,9 +39,16 @@ #include <string> #include "base/pollevent.hh" +#include "config/use_tuntap.hh" #include "dev/net/etherint.hh" #include "dev/net/etherobject.hh" #include "dev/net/etherpkt.hh" + +#if USE_TUNTAP +#include "params/EtherTap.hh" + +#endif + #include "params/EtherTapStub.hh" #include "sim/eventq.hh" #include "sim/sim_object.hh" @@ -176,4 +183,28 @@ class EtherTapStub : public EtherTapBase }; +#if USE_TUNTAP +class EtherTap : public EtherTapBase +{ + public: + typedef EtherTapParams Params; + EtherTap(const Params *p); + ~EtherTap(); + + const Params * + params() const + { + return dynamic_cast<const Params *>(_params); + } + + + protected: + int tap; + + void recvReal(int revent) override; + bool sendReal(const void *data, size_t len) override; +}; +#endif + + #endif // __DEV_NET_ETHERTAP_HH__ |