OLD | NEW |
(Empty) | |
| 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
| 2 /* |
| 3 * Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari |
| 4 * |
| 5 * This program is free software; you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 2 as |
| 7 * published by the Free Software Foundation; |
| 8 * |
| 9 * This program is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. |
| 13 * |
| 14 * You should have received a copy of the GNU General Public License |
| 15 * along with this program; if not, write to the Free Software |
| 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 * |
| 18 * Author: Giuseppe Piro <g.piro@poliba.it> |
| 19 */ |
| 20 |
| 21 |
| 22 #include "radio-bearer-instance.h" |
| 23 #include "bearer-qos-parameters.h" |
| 24 #include "ip-classifier-record.h" |
| 25 #include "rlc-entity.h" |
| 26 #include <ns3/log.h> |
| 27 #include <ns3/pointer.h> |
| 28 |
| 29 NS_LOG_COMPONENT_DEFINE ("RadioBearerInstance"); |
| 30 |
| 31 namespace ns3 { |
| 32 |
| 33 |
| 34 NS_OBJECT_ENSURE_REGISTERED (RadioBearerInstance); |
| 35 |
| 36 TypeId RadioBearerInstance::GetTypeId (void) |
| 37 { |
| 38 static TypeId tid = TypeId ("ns3::RadioBearerInstance") |
| 39 .SetParent<Object> () |
| 40 .AddAttribute ("TxQueue", |
| 41 "Transmit queue", |
| 42 PointerValue (), |
| 43 MakePointerAccessor (&RadioBearerInstance::GetQueue), |
| 44 MakePointerChecker<LteMacQueue> ()); |
| 45 return tid; |
| 46 } |
| 47 |
| 48 |
| 49 RadioBearerInstance::RadioBearerInstance () |
| 50 : m_queue (CreateObject<LteMacQueue> (1024)), |
| 51 m_qosParameters (0), |
| 52 m_rlcEntity (CreateObject<RlcEntity> ()) |
| 53 { |
| 54 } |
| 55 |
| 56 |
| 57 RadioBearerInstance::~RadioBearerInstance () |
| 58 { |
| 59 } |
| 60 |
| 61 void |
| 62 RadioBearerInstance::SetBearerDirection (BearerDirection direction) |
| 63 { |
| 64 m_direction = direction; |
| 65 } |
| 66 |
| 67 |
| 68 RadioBearerInstance::BearerDirection |
| 69 RadioBearerInstance::GetBearerDirection (void) const |
| 70 { |
| 71 return m_direction; |
| 72 } |
| 73 |
| 74 |
| 75 void |
| 76 RadioBearerInstance::SetBearerType (BearerType type) |
| 77 { |
| 78 m_bearerType = type; |
| 79 } |
| 80 |
| 81 |
| 82 RadioBearerInstance::BearerType |
| 83 RadioBearerInstance::GetBearerType (void) const |
| 84 { |
| 85 return m_bearerType; |
| 86 } |
| 87 |
| 88 |
| 89 void |
| 90 RadioBearerInstance::SetQoSParameters (Ptr<BearerQoSParameters> qosParameters) |
| 91 { |
| 92 m_qosParameters = qosParameters; |
| 93 } |
| 94 |
| 95 |
| 96 Ptr<BearerQoSParameters> |
| 97 RadioBearerInstance::GetQoSParameters (void) |
| 98 { |
| 99 return m_qosParameters; |
| 100 } |
| 101 |
| 102 |
| 103 void |
| 104 RadioBearerInstance::DoDispose (void) |
| 105 { |
| 106 NS_LOG_FUNCTION (this); |
| 107 m_queue = 0; |
| 108 } |
| 109 |
| 110 |
| 111 Ptr<LteMacQueue> |
| 112 RadioBearerInstance::GetQueue (void) const |
| 113 { |
| 114 NS_LOG_FUNCTION (this); |
| 115 return m_queue; |
| 116 } |
| 117 |
| 118 |
| 119 bool |
| 120 RadioBearerInstance::Enqueue (Ptr<Packet> packet) |
| 121 { |
| 122 NS_LOG_FUNCTION (this); |
| 123 return m_queue->Enqueue (packet); |
| 124 } |
| 125 |
| 126 |
| 127 Ptr<Packet> |
| 128 RadioBearerInstance::Dequeue (void) |
| 129 { |
| 130 NS_LOG_FUNCTION (this); |
| 131 return m_queue->Dequeue (); |
| 132 } |
| 133 |
| 134 |
| 135 Ptr<Packet> |
| 136 RadioBearerInstance::Dequeue (uint32_t availableByte) |
| 137 { |
| 138 NS_LOG_FUNCTION (this); |
| 139 /* |
| 140 This function can be caled when the UM or AM RLC mode is abilited. |
| 141 The bearer gives packets to rlc-entiry until all available byte will be used. |
| 142 */ |
| 143 // return m_queue->Dequeue (availableByte); |
| 144 return 0; |
| 145 } |
| 146 |
| 147 |
| 148 bool |
| 149 RadioBearerInstance::HasPackets (void) const |
| 150 { |
| 151 NS_LOG_FUNCTION (this); |
| 152 return !m_queue->IsEmpty (); |
| 153 } |
| 154 |
| 155 |
| 156 void |
| 157 RadioBearerInstance::SetRlcEntity (Ptr<RlcEntity> rlc) |
| 158 { |
| 159 NS_LOG_FUNCTION (this); |
| 160 m_rlcEntity = rlc; |
| 161 } |
| 162 |
| 163 |
| 164 Ptr<RlcEntity> |
| 165 RadioBearerInstance::GetRlcEntity (void) |
| 166 { |
| 167 NS_LOG_FUNCTION (this); |
| 168 return m_rlcEntity; |
| 169 } |
| 170 |
| 171 |
| 172 } // namespace ns3 |
OLD | NEW |