diff options
Diffstat (limited to 'src/dev/net')
-rw-r--r-- | src/dev/net/etherint.cc | 19 | ||||
-rw-r--r-- | src/dev/net/etherint.hh | 3 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/dev/net/etherint.cc b/src/dev/net/etherint.cc index 0c5e6b817..b55e625f7 100644 --- a/src/dev/net/etherint.cc +++ b/src/dev/net/etherint.cc @@ -34,6 +34,25 @@ #include "sim/sim_object.hh" void +EtherInt::bind(Port &peer) +{ + EtherInt *p = dynamic_cast<EtherInt *>(&peer); + if (!p) { + fatal("Attempt to bind port %s to non-ethernet port %s.", + name(), peer.name()); + } + setPeer(p); + _connected = true; +} + +void +EtherInt::unbind() +{ + peer = nullptr; + _connected = false; +} + +void EtherInt::setPeer(EtherInt *p) { if (peer && peer != p) diff --git a/src/dev/net/etherint.hh b/src/dev/net/etherint.hh index 77032208c..0486631b2 100644 --- a/src/dev/net/etherint.hh +++ b/src/dev/net/etherint.hh @@ -60,6 +60,9 @@ class EtherInt : public Port /** Return port name (for DPRINTF). */ const std::string &name() const { return portName; } + void bind(Port &peer) override; + void unbind() override; + void setPeer(EtherInt *p); EtherInt* getPeer() { return peer; } |