X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=dev%2Fetherpkt.hh;h=7a7809f0a1f12f5ad8a34f73d0df335938d05c94;hb=244ce7fb29cbd7107a5dc0fb640a6154a091ec6e;hp=030f51317432a4d9f5278959c1ddcc35c24f672c;hpb=dcc0197caa30844056865080d9d412d43bf77116;p=gem5.git diff --git a/dev/etherpkt.hh b/dev/etherpkt.hh index 030f51317..7a7809f0a 100644 --- a/dev/etherpkt.hh +++ b/dev/etherpkt.hh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003 The Regents of The University of Michigan + * Copyright (c) 2002-2004 The Regents of The University of Michigan * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,38 +33,36 @@ #ifndef __ETHERPKT_HH__ #define __ETHERPKT_HH__ +#include #include - -#include "sim/host.hh" +#include #include "base/refcnt.hh" - -class IniFile; +#include "sim/host.hh" /* * Reference counted class containing ethernet packet data */ -class EtherPacket : public RefCounted +class Checkpoint; +class PacketData : public RefCounted { public: uint8_t *data; int length; public: - EtherPacket() : data(NULL), length(0) {} - EtherPacket(std::auto_ptr d, int l) - : data(d.release()), length(l) {} - ~EtherPacket() { if (data) delete [] data; } + PacketData() : data(NULL), length(0) { } + explicit PacketData(size_t size) : data(new uint8_t[size]), length(0) { } + PacketData(std::auto_ptr d, int l) + : data(d.release()), length(l) { } + ~PacketData() { if (data) delete [] data; } public: - bool IsUnicast() { return data[0] == 0x00; } - bool IsMulticast() { return data[0] == 0x01; } - bool IsBroadcast() { return data[0] == 0xff; } - - virtual void serialize(std::ostream &os); - virtual void unserialize(const IniFile *db, 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; +typedef RefCountingPtr PacketPtr; #endif // __ETHERPKT_HH__