diff options
author | Steve Raasch <sraasch@umich.edu> | 2003-10-30 15:16:00 -0500 |
---|---|---|
committer | Steve Raasch <sraasch@umich.edu> | 2003-10-30 15:16:00 -0500 |
commit | 48ce8b70e62a203b3aff4bacc35a2657c64fb762 (patch) | |
tree | 9fd50bbb0d8ee1276746311fdc1dae41ab0dd653 /dev/ethertap.cc | |
parent | 9dac0d3c568d8767a2022afaaf958455df012e42 (diff) | |
download | gem5-48ce8b70e62a203b3aff4bacc35a2657c64fb762.tar.xz |
Add serialization (which Nate now says we probably don't need)
--HG--
extra : convert_revision : e075fafdf6e72a424110a120e24ca71cb44cfb03
Diffstat (limited to 'dev/ethertap.cc')
-rw-r--r-- | dev/ethertap.cc | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/dev/ethertap.cc b/dev/ethertap.cc index b99d46ce5..339e7ac78 100644 --- a/dev/ethertap.cc +++ b/dev/ethertap.cc @@ -163,6 +163,7 @@ EtherTap::detach() { DPRINTF(Ethernet, "EtherTap detached\n"); delete event; + event = 0; close(socket); socket = -1; } @@ -262,6 +263,52 @@ EtherTap::retransmit() txEvent.schedule(curTick + 1000); } +//===================================================================== + +void +EtherTap::serialize(ostream &os) +{ + SERIALIZE_SCALAR(socket); + SERIALIZE_SCALAR(buflen); + SERIALIZE_ARRAY((uint8_t *)buffer,buflen); + SERIALIZE_SCALAR(buffer_offset); + SERIALIZE_SCALAR(data_len); + + bool tapevent_present = false; + if (event) { + tapevent_present = true; + SERIALIZE_SCALAR(tapevent_present); + event->serialize(os); + } + else { + SERIALIZE_SCALAR(tapevent_present); + } +} + +void +EtherTap::unserialize(Checkpoint *cp, const std::string §ion) +{ + UNSERIALIZE_SCALAR(socket); + UNSERIALIZE_SCALAR(buflen); + UNSERIALIZE_ARRAY((uint8_t *)buffer,buflen); + UNSERIALIZE_SCALAR(buffer_offset); + UNSERIALIZE_SCALAR(data_len); + + bool tapevent_present; + UNSERIALIZE_SCALAR(tapevent_present); + if (tapevent_present) { + event = new TapEvent(this, socket, POLLIN|POLLERR); + + event->unserialize(cp,section); + + if (event->queued()) { + pollQueue.schedule(event); + } + } +} + +//===================================================================== + BEGIN_DECLARE_SIM_OBJECT_PARAMS(EtherTap) SimObjectParam<EtherInt *> peer; |