23 #include "ns3/simulator.h"
24 #include "ns3/drop-tail-queue.h"
29 #include "ns3/packet-burst.h"
35 #include "ns3/trace-source-accessor.h"
36 #include "ns3/pointer.h"
38 #include "ns3/uinteger.h"
44 #include "ns3/ipv4-address.h"
45 #include "ns3/llc-snap-header.h"
59 .AddConstructor<BaseStationNetDevice> ()
61 .AddAttribute (
"BSScheduler",
62 "Downlink Scheduler for BS",
65 MakePointerChecker<BSScheduler> ())
67 .AddAttribute (
"InitialRangInterval",
68 "Time between Initial Ranging regions assigned by the BS. Maximum is 2s",
74 .AddAttribute (
"DcdInterval",
75 "Time between transmission of DCD messages. Maximum value is 10s.",
80 .AddAttribute (
"UcdInterval",
81 "Time between transmission of UCD messages. Maximum value is 10s.",
86 .AddAttribute (
"IntervalT8",
87 "Wait for DSA/DSC Acknowledge timeout. Maximum 300ms.",
92 .AddAttribute (
"RangReqOppSize",
93 "The ranging opportunity size in symbols",
97 MakeUintegerChecker<uint8_t> (1, 256))
99 .AddAttribute (
"BwReqOppSize",
100 "The bandwidth request opportunity size in symbols",
103 MakeUintegerChecker<uint8_t> (1, 256))
105 .AddAttribute (
"MaxRangCorrectionRetries",
106 "Number of retries on contention Ranging Requests",
110 MakeUintegerChecker<uint8_t> (1, 16))
112 .AddAttribute (
"SSManager",
113 "The ss manager attached to this device.",
116 MakePointerChecker<SSManager> ())
118 .AddAttribute (
"Scheduler",
119 "The BS scheduler attached to this device.",
122 MakePointerChecker<BSScheduler> ())
124 .AddAttribute (
"LinkManager",
125 "The link manager attached to this device.",
128 MakePointerChecker<BSLinkManager> ())
130 .AddAttribute (
"UplinkScheduler",
131 "The uplink scheduler attached to this device.",
135 MakePointerChecker<UplinkScheduler> ())
137 .AddAttribute (
"BsIpcsPacketClassifier",
138 "The uplink IP packet classifier attached to this device.",
141 MakePointerChecker<IpcsClassifier> ())
143 .AddAttribute (
"ServiceFlowManager",
144 "The service flow manager attached to this device.",
148 MakePointerChecker<ServiceFlowManager> ())
150 .AddTraceSource (
"BSTx",
"A packet has been received from higher layers and is being processed in preparation for "
153 .AddTraceSource (
"BSTxDrop",
154 "A packet has been dropped in the MAC layer before being queued for transmission.",
157 .AddTraceSource (
"BSPromiscRx",
158 "A packet has been received by this device, has been passed up from the physical layer "
159 "and is being forwarded up the local protocol stack. This is a promiscuous trace,",
162 .AddTraceSource (
"BSRx",
163 "A packet has been received by this device, has been passed up from the physical layer "
164 "and is being forwarded up the local protocol stack. This is a non-promiscuous trace,",
167 .AddTraceSource (
"BSRxDrop",
168 "A packet has been dropped in the MAC layer after it has been passed up from the physical "
597 uint16_t protocolNumber)
609 if (protocolNumber == 2048)
614 if (protocolNumber != 2048 || serviceFlow == 0)
619 if (serviceFlow == 0)
625 if (serviceFlow->GetIsEnabled ())
649 "BS: Can not enqueue packet on the selected connection: the connection is not initialized");
656 return connection->
Enqueue (packet, hdrType, hdr);
673 bool fragmentation =
false;
686 cid = gnrcMacHdr.
GetCid ();
698 uint8_t tmpType = type;
699 if (((tmpType >> 2) & 1) == 1)
702 NS_LOG_INFO (
"FRAG_DEBUG: DoReceive -> the packet is a fragment" << std::endl);
703 fragmentation =
true;
801 NS_LOG_INFO (
"FRAG_DEBUG: BS DoReceive, the Packet is a fragment" << std::endl);
803 uint32_t fc = fragSubhdr.
GetFc ();
809 NS_LOG_INFO (
"\t Received the latest fragment" << std::endl);
817 NS_LOG_INFO (
"\t BS PACKET DEFRAGMENTATION" << std::endl);
819 iter != fragmentsQueue.end (); ++iter)
836 NS_LOG_INFO (
"\t Received the first or the middle fragment" << std::endl);
849 "A bandwidth request should be carried by a bandwidth header type");
856 cid = bwRequestHdr.
GetCid ();
868 bool sendDcd =
false, sendUcd =
false, updateDcd =
false, updateUcd =
false;
878 sendDcd = sendUcd =
true;
946 std::pair<OfdmDlMapIe*, Ptr<PacketBurst> > pair;
953 while (downlinkBursts->size ())
955 pair = downlinkBursts->front ();
957 dlMapIe = pair.first;
959 uint8_t diuc = dlMapIe->
GetDiuc ();
979 downlinkBursts->pop_front ();
996 != downlinkBursts->end (); ++iter)
998 iter->first->SetPreamblePresent (0);
999 iter->first->SetStartTime (0);
1060 for (std::list<OfdmUlMapIe>::iterator iter = uplinkAllocations.begin (); iter != uplinkAllocations.end (); ++iter)
1150 NS_ASSERT_MSG (connection != 0,
"BS: Invalid connection=0");
1157 uint16_t symbolsToAllocation = 0;
1159 for (std::list<OfdmUlMapIe>::iterator iter = uplinkAllocations.begin (); iter != uplinkAllocations.end (); ++iter)
1168 symbolsToAllocation = uplinkAllocation.
GetStartTime ();