src/devices/p2p/p2p-net-device.h
changeset 378 32bd402ea5ea
parent 369 29ea5d1a83c8
child 379 ae74e8a7bb44
--- a/src/devices/p2p/p2p-net-device.h	Mon Mar 26 06:50:33 2007 -0700
+++ b/src/devices/p2p/p2p-net-device.h	Tue Mar 27 13:04:11 2007 -0700
@@ -28,11 +28,12 @@
 #include "ns3/callback.h"
 #include "ns3/packet.h"
 #include "ns3/callback-trace-source.h"
+#include "ns3/nstime.h"
+#include "ns3/data-rate.h"
 
 namespace ns3 {
 
 class PointToPointChannel;
-class PointToPointPhy;
 class Queue;
 
 class PointToPointNetDevice : public NetDevice {
@@ -41,9 +42,13 @@
     QUEUE,
     RX,
   };
+
   PointToPointNetDevice(Node* node);
   virtual ~PointToPointNetDevice();
 
+  void SetDataRate(DataRate bps);
+  void SetInterframeGap(Time t);
+  
 private:
   // Don't let the compiler slip in copy and assignment construction
   PointToPointNetDevice(const PointToPointNetDevice&);
@@ -52,7 +57,6 @@
 public:
   bool Attach(PointToPointChannel* ch);
   void AddQueue(Queue*);
-  // called by PointToPointPhy
   void Receive (Packet& p);
 
 protected:
@@ -60,11 +64,25 @@
   PointToPointChannel* GetChannel(void) const;
 
 private:
-  virtual void NotifyDataAvailable (void);
   virtual bool SendTo (Packet& p, const MacAddress& dest);
+
+  bool TransmitStart (Packet &p);
+  void TransmitCompleteEvent (void);
+  void TransmitReadyEvent (void);
+
   virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context);
 
-  PointToPointPhy* m_phy;
+  enum TxMachineState
+    {
+      READY,
+      BUSY,
+      GAP
+    };
+
+  TxMachineState m_txMachineState;
+  DataRate       m_bps;
+  Time           m_tInterframeGap;
+
   PointToPointChannel* m_channel;
   Queue* m_queue;
   CallbackTraceSource<Packet &> m_rxTrace;