/*
- * Copyright (c) 2004 The Regents of The University of Michigan
+ * Copyright (c) 2004-2005 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include <iostream>
+#include "base/misc.hh"
#include "dev/etherpkt.hh"
#include "sim/serialize.hh"
using namespace std;
void
-PacketData::doext()
+PacketData::serialize(const string &base, ostream &os)
{
- _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);
+ paramOut(os, base + ".length", length);
+ arrayParamOut(os, base + ".data", data, length);
}
void
-PacketData::unserialize(Checkpoint *cp, const string §ion)
+PacketData::unserialize(const string &base, Checkpoint *cp,
+ const string §ion)
{
- UNSERIALIZE_SCALAR(length);
- data = new uint8_t[length];
- UNSERIALIZE_ARRAY(data, length);
+ paramIn(cp, section, base + ".length", length);
+ if (length)
+ arrayParamIn(cp, section, base + ".data", data, length);
}