src/lte/model/lte-rlc.cc
changeset 8364 0d7da39de404
parent 8148 09e2d03022a2
child 8374 5a07200122a6
--- a/src/lte/model/lte-rlc.cc	Wed Sep 07 16:23:47 2011 +0200
+++ b/src/lte/model/lte-rlc.cc	Wed Sep 07 16:40:08 2011 +0200
@@ -19,19 +19,21 @@
  */
 
 
-#include "lte-rlc.h"
-#include "lte-mac-sap.h"
-#include "ff-mac-sched-sap.h"
-#include "lte-rlc-tag.h"
+#include "ns3/log.h"
+#include "ns3/simulator.h"
 
-#include <ns3/log.h>
-#include <ns3/simulator.h>
+#include "ns3/lte-rlc.h"
+#include "ns3/lte-rlc-tag.h"
+// #include "lte-mac-sap.h"
+#include "ns3/lte-rlc-sap.h"
+// #include "ff-mac-sched-sap.h"
 
 NS_LOG_COMPONENT_DEFINE ("LteRlc");
 
 namespace ns3 {
 
 
+
 ///////////////////////////////////////
 
 class LteRlcSpecificLteMacSapUser : public LteMacSapUser
@@ -39,7 +41,7 @@
 public:
   LteRlcSpecificLteMacSapUser (LteRlc* rlc);
 
-  // inherited from LteMacSapUser
+  // Interface implemented from LteMacSapUser
   virtual void NotifyTxOpportunity (uint32_t bytes);
   virtual void NotifyHarqDeliveryFailure ();
   virtual void ReceivePdu (Ptr<Packet> p);
@@ -78,14 +80,17 @@
 
 
 ///////////////////////////////////////
+
 NS_OBJECT_ENSURE_REGISTERED (LteRlc);
 
 LteRlc::LteRlc ()
-  : m_macSapProvider (0),
+  : m_rlcSapUser (0),
+    m_macSapProvider (0),
     m_rnti (0),
     m_lcid (0)
 {
   NS_LOG_FUNCTION (this);
+  m_rlcSapProvider = new LteRlcSpecificLteRlcSapProvider<LteRlc> (this);
   m_macSapUser = new LteRlcSpecificLteMacSapUser (this);
 }
 
@@ -99,7 +104,7 @@
     .AddTraceSource ("RxPDU",
                      "PDU received.",
                      MakeTraceSourceAccessor (&LteRlc::m_rxPdu))
-  ;
+    ;
   return tid;
 }
 
@@ -120,10 +125,25 @@
 LteRlc::~LteRlc ()
 {
   NS_LOG_FUNCTION (this);
+  delete (m_rlcSapProvider);
   delete (m_macSapUser);
 }
 
 void
+LteRlc::SetLteRlcSapUser (LteRlcSapUser * s)
+{
+  NS_LOG_FUNCTION (this << s);
+  m_rlcSapUser = s;
+}
+
+LteRlcSapProvider*
+LteRlc::GetLteRlcSapProvider ()
+{
+  NS_LOG_FUNCTION (this);
+  return m_rlcSapProvider;
+}
+
+void
 LteRlc::SetLteMacSapProvider (LteMacSapProvider * s)
 {
   NS_LOG_FUNCTION (this << s);
@@ -139,9 +159,7 @@
 
 
 
-
-
-// //////////////////////////////////////
+////////////////////////////////////////
 
 NS_OBJECT_ENSURE_REGISTERED (LteRlcSm);
 
@@ -163,22 +181,28 @@
   static TypeId tid = TypeId ("ns3::LteRlcSm")
     .SetParent<LteRlc> ()
     .AddConstructor<LteRlcSm> ()
-  ;
+    ;
   return tid;
 }
 
 void
+LteRlcSm::DoTransmitPdcpPdu (Ptr<Packet> p)
+{
+  NS_LOG_FUNCTION (this);
+}
+
+void
 LteRlcSm::DoReceivePdu (Ptr<Packet> p)
 {
   // RLC Performance evaluation
   RlcTag rlcTag;
   Time delay;
-  if (p->FindFirstMatchingByteTag (rlcTag))
+  if (p->FindFirstMatchingByteTag(rlcTag))
     {
-      delay = Simulator::Now () - rlcTag.getSenderTimestamp ();
+      delay = Simulator::Now() - rlcTag.getSenderTimestamp ();
     }
   NS_LOG_FUNCTION (this << m_rnti << (uint32_t) m_lcid << p->GetSize () << delay.GetNanoSeconds ());
-  m_rxPdu (m_rnti, m_lcid, p->GetSize (), delay.GetNanoSeconds () );
+  m_rxPdu(m_rnti, m_lcid, p->GetSize (), delay.GetNanoSeconds () );
 }
 
 void
@@ -190,10 +214,10 @@
   params.lcid = m_lcid;
 
   // RLC Performance evaluation
-  RlcTag tag (Simulator::Now ());
+  RlcTag tag (Simulator::Now());
   params.pdu->AddByteTag (tag);
   NS_LOG_FUNCTION (this << m_rnti << (uint32_t) m_lcid << bytes);
-  m_txPdu (m_rnti, m_lcid, bytes);
+  m_txPdu(m_rnti, m_lcid, bytes);
 
   m_macSapProvider->TransmitPdu (params);
 }