Print a warning if two devices are sharing the same interrupt
[gem5.git] / dev / etherpkt.hh
index 53612b830e745c811bf7e5ff63cdfd6c3f0f3b09..7a7809f0a1f12f5ad8a34f73d0df335938d05c94 100644 (file)
@@ -38,7 +38,6 @@
 #include <assert.h>
 
 #include "base/refcnt.hh"
-#include "base/inet.hh"
 #include "sim/host.hh"
 
 /*
@@ -51,34 +50,17 @@ class PacketData : public RefCounted
     uint8_t *data;
     int length;
 
-  protected:
-    uint8_t *_eth;
-    uint8_t *_ip;
-    uint8_t *_tcp;
-    uint8_t *_udp;
-
-    void doext();
-    void ext()
-    {
-        if (_eth != data)
-            doext();
-    }
-
   public:
-    PacketData() : data(NULL), length(0) { doext(); }
+    PacketData() : data(NULL), length(0) { }
+    explicit PacketData(size_t size) : data(new uint8_t[size]), length(0) { }
     PacketData(std::auto_ptr<uint8_t> d, int l)
-        : data(d.release()), length(l) { doext(); }
+        : data(d.release()), length(l) { }
     ~PacketData() { if (data) delete [] data; }
 
   public:
-    EthHdr *eth() { ext(); return (EthHdr *)_eth; }
-    IpHdr *ip() { ext(); return (IpHdr *)_ip; }
-    TcpHdr *tcp() { ext(); return (TcpHdr *)_tcp; }
-    UdpHdr *udp() { ext(); return (UdpHdr *)_udp; }
-
-  public:
-    void serialize(std::ostream &os);
-    void unserialize(Checkpoint *cp, const std::string &section);
+    void serialize(const std::string &base, std::ostream &os);
+    void unserialize(const std::string &base, Checkpoint *cp,
+                     const std::string &section);
 };
 
 typedef RefCountingPtr<PacketData> PacketPtr;