Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(113)

Unified Diff: src/devices/lte/bearer.cc

Issue 1866042: LTE module - Giuseppe Piro
Patch Set: LTE module Created 13 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/devices/lte/bearer.cc
===================================================================
new file mode 100755
--- /dev/null
+++ b/src/devices/lte/bearer.cc
@@ -0,0 +1,232 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Giuseppe Piro <g.piro@poliba.it>
+ */
+
+
+#include "bearer.h"
+#include "qos-parameters.h"
+#include "ip-classifier-record.h"
+#include "rlc-entity.h"
+#include <ns3/log.h>
+#include <ns3/pointer.h>
+
+NS_LOG_COMPONENT_DEFINE ("Bearer");
+
+namespace ns3 {
+
+
+NS_OBJECT_ENSURE_REGISTERED (Bearer);
+
+TypeId Bearer::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::Bearer")
+ .SetParent<Object> ()
+
+ //XXX: add other attributes
+
+ .AddAttribute ("TxQueue",
+ "Transmit queue",
+ PointerValue (),
+ MakePointerAccessor (&Bearer::GetQueue),
+ MakePointerChecker<LteMacQueue> ());
+ return tid;
+}
+
+
+Bearer::Bearer ()
+ : m_queue (CreateObject<LteMacQueue> (1024)),
+ m_qosParameters (0),
+ m_classifierRecord (0),
+ m_rlcEntity (CreateObject<RlcEntity> ())
+{
+}
+
+
+Bearer::~Bearer ()
+{
+}
+
+void
+Bearer::SetBearerQoSType (BearerQoSType qosType)
+{
+ m_bearerQoSType = qosType;
+}
+
+
+Bearer::BearerQoSType
+Bearer::GetBearerQoSType (void) const
+{
+ return m_bearerQoSType;
+}
+
+
+void
+Bearer::SetBearerDirection (BearerDirection direction)
+{
+ m_direction = direction;
+}
+
+
+Bearer::BearerDirection
+Bearer::GetBearerDirection (void) const
+{
+ return m_direction;
+}
+
+
+void
+Bearer::SetBearerType (BearerType type)
+{
+ m_bearerType = type;
+}
+
+
+Bearer::BearerType
+Bearer::GetBearerType (void) const
+{
+ return m_bearerType;
+}
+
+
+void
+Bearer::SetBearerState (BearerState state)
+{
+ m_bearerState = state;
+}
+
+
+Bearer::BearerState
+Bearer::GetBearerState (void) const
+{
+ return m_bearerState;
+}
+
+
+void
+Bearer::SetBearerSchedulerState (BearerSchedulerState state)
+{
+ m_schedulerState = state;
+}
+
+
+Bearer::BearerSchedulerState
+Bearer::GetBearerSchedulerState (void) const
+{
+ return m_schedulerState;
+}
+
+
+void
+Bearer::SetQoSParameters (Ptr<QoSParameters> qosParameters)
+{
+ m_qosParameters = qosParameters;
+}
+
+
+Ptr<QoSParameters>
+Bearer::GetQoSParameters (void)
+{
+ return m_qosParameters;
+}
+
+
+void
+Bearer::SetIpClassifierRecord (Ptr<IpClassifierRecord> record)
+{
+ m_classifierRecord = record;
+}
+
+
+Ptr<IpClassifierRecord>
+Bearer::GetIpClassifierRecord (void)
+{
+ return m_classifierRecord;
+}
+
+
+void
+Bearer::DoDispose (void)
+{
+ NS_LOG_FUNCTION (this);
+ m_queue = 0;
+}
+
+
+Ptr<LteMacQueue>
+Bearer::GetQueue (void) const
+{
+ NS_LOG_FUNCTION (this);
+ return m_queue;
+}
+
+
+bool
+Bearer::Enqueue (Ptr<Packet> packet)
+{
+ NS_LOG_FUNCTION (this);
+ return m_queue->Enqueue (packet);
+}
+
+
+Ptr<Packet>
+Bearer::Dequeue (void)
+{
+ NS_LOG_FUNCTION (this);
+ return m_queue->Dequeue ();
+}
+
+
+Ptr<Packet>
+Bearer::Dequeue (uint32_t availableByte)
+{
+ NS_LOG_FUNCTION (this);
+ /*
+ This function can be caled when the UM or AM RLC mode is abilited.
+ The bearer gives packets to rlc-entiry until all available byte will be used.
+ */
+ //return m_queue->Dequeue (availableByte);
+ return false;
+}
+
+
+bool
+Bearer::HasPackets (void) const
+{
+ NS_LOG_FUNCTION (this);
+ return !m_queue->IsEmpty ();
+}
+
+
+void
+Bearer::SetRlcEntity (Ptr<RlcEntity> rlc)
+{
+ NS_LOG_FUNCTION (this);
+ m_rlcEntity = rlc;
+}
+
+
+Ptr<RlcEntity>
+Bearer::GetRlcEntiry (void)
+{
+ NS_LOG_FUNCTION (this);
+ return m_rlcEntity;
+}
+
+
+} // namespace ns3

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b