summaryrefslogtreecommitdiff
path: root/dev/etherpkt.cc
diff options
context:
space:
mode:
Diffstat (limited to 'dev/etherpkt.cc')
-rw-r--r--dev/etherpkt.cc28
1 files changed, 25 insertions, 3 deletions
diff --git a/dev/etherpkt.cc b/dev/etherpkt.cc
index 9eda89e9d..292fe7faf 100644
--- a/dev/etherpkt.cc
+++ b/dev/etherpkt.cc
@@ -34,17 +34,39 @@
using namespace std;
void
-EtherPacket::serialize(ostream &os)
+PacketData::doext()
+{
+ _eth = 0;
+ _ip = 0;
+ _tcp = 0;
+ _udp = 0;
+
+ if (!data)
+ return;
+
+ _eth = data;
+ if (eth()->type() == ETH_TYPE_IP) {
+ _ip = eth()->payload();
+
+ if (ip()->proto() == IP_PROTO_TCP)
+ _tcp = ip()->payload();
+
+ if (ip()->proto() == IP_PROTO_UDP)
+ _udp = ip()->payload();
+ }
+}
+
+void
+PacketData::serialize(ostream &os)
{
SERIALIZE_SCALAR(length);
SERIALIZE_ARRAY(data, length);
}
void
-EtherPacket::unserialize(Checkpoint *cp, const string &section)
+PacketData::unserialize(Checkpoint *cp, const string &section)
{
UNSERIALIZE_SCALAR(length);
data = new uint8_t[length];
UNSERIALIZE_ARRAY(data, length);
}
-