25 #include "ns3/simulator.h"
26 #include "ns3/drop-tail-queue.h"
31 #include "ns3/packet-burst.h"
37 #include "ns3/trace-source-accessor.h"
38 #include "ns3/pointer.h"
40 #include "ns3/uinteger.h"
46 #include "ns3/ipv4-address.h"
47 #include "ns3/llc-snap-header.h"
61 .AddConstructor<BaseStationNetDevice> ()
63 .AddAttribute (
"BSScheduler",
64 "Downlink Scheduler for BS",
67 MakePointerChecker<BSScheduler> ())
69 .AddAttribute (
"InitialRangInterval",
70 "Time between Initial Ranging regions assigned by the BS. Maximum is 2s",
76 .AddAttribute (
"DcdInterval",
77 "Time between transmission of DCD messages. Maximum value is 10s.",
82 .AddAttribute (
"UcdInterval",
83 "Time between transmission of UCD messages. Maximum value is 10s.",
88 .AddAttribute (
"IntervalT8",
89 "Wait for DSA/DSC Acknowledge timeout. Maximum 300ms.",
94 .AddAttribute (
"RangReqOppSize",
95 "The ranging opportunity size in symbols",
99 MakeUintegerChecker<uint8_t> (1, 256))
101 .AddAttribute (
"BwReqOppSize",
102 "The bandwidth request opportunity size in symbols",
105 MakeUintegerChecker<uint8_t> (1, 256))
107 .AddAttribute (
"MaxRangCorrectionRetries",
108 "Number of retries on contention Ranging Requests",
112 MakeUintegerChecker<uint8_t> (1, 16))
114 .AddAttribute (
"SSManager",
115 "The ss manager attached to this device.",
118 MakePointerChecker<SSManager> ())
120 .AddAttribute (
"Scheduler",
121 "The BS scheduler attached to this device.",
124 MakePointerChecker<BSScheduler> ())
126 .AddAttribute (
"LinkManager",
127 "The link manager attached to this device.",
130 MakePointerChecker<BSLinkManager> ())
132 .AddAttribute (
"UplinkScheduler",
133 "The uplink scheduler attached to this device.",
137 MakePointerChecker<UplinkScheduler> ())
139 .AddAttribute (
"BsIpcsPacketClassifier",
140 "The uplink IP packet classifier attached to this device.",
143 MakePointerChecker<IpcsClassifier> ())
145 .AddAttribute (
"ServiceFlowManager",
146 "The service flow manager attached to this device.",
150 MakePointerChecker<ServiceFlowManager> ())
152 .AddTraceSource (
"BSTx",
"A packet has been received from higher layers and is being processed in preparation for "
155 .AddTraceSource (
"BSTxDrop",
156 "A packet has been dropped in the MAC layer before being queued for transmission.",
159 .AddTraceSource (
"BSPromiscRx",
160 "A packet has been received by this device, has been passed up from the physical layer "
161 "and is being forwarded up the local protocol stack. This is a promiscuous trace,",
164 .AddTraceSource (
"BSRx",
165 "A packet has been received by this device, has been passed up from the physical layer "
166 "and is being forwarded up the local protocol stack. This is a non-promiscuous trace,",
169 .AddTraceSource (
"BSRxDrop",
170 "A packet has been dropped in the MAC layer after it has been passed up from the physical "
599 uint16_t protocolNumber)
611 if (protocolNumber == 2048)
616 if (protocolNumber != 2048 || serviceFlow == 0)
621 if (serviceFlow == 0)
627 if (serviceFlow->GetIsEnabled ())
651 "BS: Can not enqueue packet on the selected connection: the connection is not initialized");
658 return connection->
Enqueue (packet, hdrType, hdr);
675 bool fragmentation =
false;
688 cid = gnrcMacHdr.
GetCid ();
700 uint8_t tmpType = type;
701 if (((tmpType >> 2) & 1) == 1)
704 NS_LOG_INFO (
"FRAG_DEBUG: DoReceive -> the packet is a fragment" << std::endl);
705 fragmentation =
true;
803 NS_LOG_INFO (
"FRAG_DEBUG: BS DoReceive, the Packet is a fragment" << std::endl);
805 uint32_t fc = fragSubhdr.
GetFc ();
811 NS_LOG_INFO (
"\t Received the latest fragment" << std::endl);
819 NS_LOG_INFO (
"\t BS PACKET DEFRAGMENTATION" << std::endl);
821 iter != fragmentsQueue.end (); ++iter)
838 NS_LOG_INFO (
"\t Received the first or the middle fragment" << std::endl);
851 "A bandwidth request should be carried by a bandwidth header type");
858 cid = bwRequestHdr.
GetCid ();
870 bool sendDcd =
false, sendUcd =
false, updateDcd =
false, updateUcd =
false;
880 sendDcd = sendUcd =
true;
947 Time txTime = Seconds (0);
948 std::pair<OfdmDlMapIe*, Ptr<PacketBurst> > pair;
955 while (downlinkBursts->size ())
957 pair = downlinkBursts->front ();
959 dlMapIe = pair.first;
961 uint8_t diuc = dlMapIe->
GetDiuc ();
981 downlinkBursts->pop_front ();
998 != downlinkBursts->end (); ++iter)
1000 iter->first->SetPreamblePresent (0);
1001 iter->first->SetStartTime (0);
1062 for (std::list<OfdmUlMapIe>::iterator iter = uplinkAllocations.begin (); iter != uplinkAllocations.end (); ++iter)
1152 NS_ASSERT_MSG (connection != 0,
"BS: Invalid connection=0");
1159 uint16_t symbolsToAllocation = 0;
1161 for (std::list<OfdmUlMapIe>::iterator iter = uplinkAllocations.begin (); iter != uplinkAllocations.end (); ++iter)
1170 symbolsToAllocation = uplinkAllocation.
GetStartTime ();