X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=dev%2Fetherpkt.hh;h=cb9022d7256d108d424819fa3764576d5de6e90f;hb=60e92986f739a025a6534972b8e1cf9498ce3fd2;hp=1b6e9858fe268ad7a90222e7b5abf3f7d36d8cde;hpb=6ac0d27b7dc130397b6ba9b11e593706c2f669fe;p=gem5.git diff --git a/dev/etherpkt.hh b/dev/etherpkt.hh index 1b6e9858f..cb9022d72 100644 --- a/dev/etherpkt.hh +++ b/dev/etherpkt.hh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2004 The Regents of The University of Michigan + * Copyright (c) 2002-2005 The Regents of The University of Michigan * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,18 +47,36 @@ class Checkpoint; class PacketData : public RefCounted { public: + /* + * Pointer to packet data will be deleted + */ uint8_t *data; + + /* + * Length of the current packet + */ int length; + /* + * Extra space taken up by the packet in whatever data structure + * it is in. + * + * NOTE: This can only be use by *one* data structure at a time! + */ + int slack; + public: - PacketData() : data(NULL), length(0) { } - PacketData(std::auto_ptr d, int l) - : data(d.release()), length(l) { } + PacketData() : data(NULL), length(0), slack(0) { } + explicit PacketData(size_t size) + : data(new uint8_t[size]), length(0), slack(0) { } + PacketData(std::auto_ptr d, int l, int s = 0) + : data(d.release()), length(l), slack(s) { } ~PacketData() { if (data) delete [] data; } public: - void serialize(std::ostream &os); - void unserialize(Checkpoint *cp, const std::string §ion); + void serialize(const std::string &base, std::ostream &os); + void unserialize(const std::string &base, Checkpoint *cp, + const std::string §ion); }; typedef RefCountingPtr PacketPtr;