A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wimax-connection.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007,2008, 2009 INRIA, UDcast
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Authors: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr>
7 * Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
8 */
9
10#include "wimax-connection.h"
11
12#include "service-flow.h"
13
14#include "ns3/enum.h"
15#include "ns3/pointer.h"
16#include "ns3/uinteger.h"
17
18namespace ns3
19{
20
21NS_OBJECT_ENSURE_REGISTERED(WimaxConnection);
22
23TypeId
25{
26 static TypeId tid = TypeId("ns3::WimaxConnection")
27
29
30 .SetGroupName("Wimax")
31
32 .AddAttribute("Type",
33 "Connection type",
37 "Broadcast",
39 "InitialRanging",
41 "Basic",
43 "Primary",
45 "Transport",
47 "Multicast",
49 "Padding"))
50
51 .AddAttribute("TxQueue",
52 "Transmit queue",
56 return tid;
57}
58
60 : m_cid(cid),
61 m_cidType(type),
62 m_queue(CreateObject<WimaxMacQueue>(1024)),
63 m_serviceFlow(nullptr)
64{
65}
66
70
71void
73{
74 m_queue = nullptr;
75 // m_serviceFlow = 0;
76}
77
78Cid
80{
81 return m_cid;
82}
83
86{
87 return m_cidType;
88}
89
92{
93 return m_queue;
94}
95
96void
98{
99 m_serviceFlow = serviceFlow;
100}
101
104{
105 return m_serviceFlow;
106}
107
108uint8_t
113
114bool
116 const MacHeaderType& hdrType,
117 const GenericMacHeader& hdr)
118{
119 return m_queue->Enqueue(packet, hdrType, hdr);
120}
121
124{
125 return m_queue->Dequeue(packetType);
126}
127
130{
131 return m_queue->Dequeue(packetType, availableByte);
132}
133
134bool
136{
137 return !m_queue->IsEmpty();
138}
139
140bool
142{
143 return !m_queue->IsEmpty(packetType);
144}
145
146std::string
148{
149 switch (m_cidType)
150 {
151 case Cid::BROADCAST:
152 return "Broadcast";
154 return "Initial Ranging";
155 case Cid::BASIC:
156 return "Basic";
157 case Cid::PRIMARY:
158 return "Primary";
159 case Cid::TRANSPORT:
160 return "Transport";
161 case Cid::MULTICAST:
162 return "Multicast";
163 default:
164 NS_FATAL_ERROR("Invalid connection type");
165 }
166
167 return "";
168}
169
170// Defragmentation Function
176
177void
179{
180 m_fragmentsQueue.push_back(fragment);
181}
182
183void
188} // namespace ns3
Cid class.
Definition cid.h:26
Type
Type enumeration.
Definition cid.h:30
@ PRIMARY
Definition cid.h:34
@ BROADCAST
Definition cid.h:31
@ TRANSPORT
Definition cid.h:35
@ MULTICAST
Definition cid.h:36
@ BASIC
Definition cid.h:33
@ PADDING
Definition cid.h:37
@ INITIAL_RANGING
Definition cid.h:32
Hold variables of type enum.
Definition enum.h:52
This class implements the Generic mac Header as described by IEEE Standard for Local and metropolitan...
This class Represents the HT (Header Type) field of generic MAC and bandwidth request headers.
HeaderType
Header type enumeration.
A base class which provides memory management and object aggregation.
Definition object.h:78
AttributeValue implementation for Pointer.
Smart pointer class similar to boost::intrusive_ptr.
This class implements service flows as described by the IEEE-802.16 standard.
ServiceFlow::SchedulingType GetSchedulingType() const
Get scheduling type.
a unique identifier for an interface.
Definition type-id.h:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
ServiceFlow * m_serviceFlow
service flow
bool Enqueue(Ptr< Packet > packet, const MacHeaderType &hdrType, const GenericMacHeader &hdr)
enqueue a packet in the queue of the connection
std::string GetTypeStr() const
Get type string.
ServiceFlow * GetServiceFlow() const
void DoDispose() override
Destructor implementation.
Cid::Type GetType() const
Get type function.
Ptr< Packet > Dequeue(MacHeaderType::HeaderType packetType=MacHeaderType::HEADER_TYPE_GENERIC)
dequeue a packet from the queue of the connection
void ClearFragmentsQueue()
delete all enqueued fragments
Cid GetCid() const
Get CID function.
uint8_t GetSchedulingType() const
WimaxConnection(Cid cid, Cid::Type type)
Constructor.
void SetServiceFlow(ServiceFlow *serviceFlow)
set the service flow associated to this connection
Ptr< WimaxMacQueue > GetQueue() const
Ptr< WimaxMacQueue > m_queue
queue
Cid::Type m_cidType
CID type.
static TypeId GetTypeId()
Get the type ID.
std::list< Ptr< const Packet > > FragmentsQueue
Definition of Fragments Queue data type.
FragmentsQueue m_fragmentsQueue
fragments queue
const FragmentsQueue GetFragmentsQueue() const
get a queue of received fragments
void FragmentEnqueue(Ptr< const Packet > fragment)
enqueue a received packet (that is a fragment) into the fragments queue
Class implementing the device packet queue.
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition pointer.h:248
Ptr< AttributeChecker > MakePointerChecker()
Create a PointerChecker for a type.
Definition pointer.h:269
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition object.h:619
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeEnumChecker(T v, std::string n, Ts... args)
Make an EnumChecker pre-configured with a set of allowed values by name.
Definition enum.h:179
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Definition enum.h:221