diff --git a/doc/WimaxArchitecture.png b/doc/WimaxArchitecture.png new file mode 100644 index 000000000..6eba0b8b3 Binary files /dev/null and b/doc/WimaxArchitecture.png differ diff --git a/examples/wimax/wimax-simple.cc b/examples/wimax/wimax-simple.cc index 25b568878..2d941190f 100644 --- a/examples/wimax/wimax-simple.cc +++ b/examples/wimax/wimax-simple.cc @@ -154,6 +154,10 @@ int main (int argc, char *argv[]) Simulator::Stop (Seconds (duration + 0.1)); + wimax.EnablePcap ("wimax-simple-ss0", ssNodes.Get (0)->GetId (), ss[0]->GetIfIndex ()); + wimax.EnablePcap ("wimax-simple-ss1", ssNodes.Get (1)->GetId (), ss[1]->GetIfIndex ()); + wimax.EnablePcap ("wimax-simple-bs0", bsNodes.Get (0)->GetId (), bs->GetIfIndex ()); + IpcsClassifierRecord DlClassifierUgs (Ipv4Address ("0.0.0.0"), Ipv4Mask ("0.0.0.0"), SSinterfaces.GetAddress (0), diff --git a/src/common/buffer.cc b/src/common/buffer.cc index 41999c7db..38eb82c8c 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -280,6 +280,11 @@ Buffer::Buffer (uint32_t dataSize, bool initialize) bool Buffer::CheckInternalState (void) const { +#if 0 + // If you want to modify any code in this file, enable this checking code. + // Otherwise, there is not much point is enabling it because the + // current implementation has been fairly seriously tested and the cost + // of this constant checking is pretty high, even for a debug build. bool offsetsOk = m_start <= m_zeroAreaStart && m_zeroAreaStart <= m_zeroAreaEnd && @@ -300,6 +305,9 @@ Buffer::CheckInternalState (void) const ", " << (internalSizeOk?"true":"false") << " "); } return ok; +#else + return true; +#endif } void @@ -376,13 +384,6 @@ Buffer::~Buffer () } } -uint32_t -Buffer::GetSize (void) const -{ - NS_ASSERT (CheckInternalState ()); - return m_end - m_start; -} - Buffer::Iterator Buffer::Begin (void) const { diff --git a/src/common/buffer.h b/src/common/buffer.h index 2ec401b9b..6c1a1965c 100644 --- a/src/common/buffer.h +++ b/src/common/buffer.h @@ -393,7 +393,7 @@ public: /** * \return the number of bytes stored in this buffer. */ - uint32_t GetSize (void) const; + inline uint32_t GetSize (void) const; /** * \return a pointer to the start of the internal @@ -633,6 +633,11 @@ Buffer::Iterator::ReadU8 (void) } } +uint32_t +Buffer::GetSize (void) const +{ + return m_end - m_start; +} } // namespace ns3 diff --git a/src/common/packet.cc b/src/common/packet.cc index 5679a0320..521f69408 100644 --- a/src/common/packet.cc +++ b/src/common/packet.cc @@ -225,12 +225,6 @@ Packet::GetNixVector (void) const return m_nixVector; } -uint32_t -Packet::GetSize (void) const -{ - return m_buffer.GetSize (); -} - void Packet::AddHeader (const Header &header) { diff --git a/src/common/packet.h b/src/common/packet.h index 94ccdbfc6..a158a088e 100644 --- a/src/common/packet.h +++ b/src/common/packet.h @@ -254,7 +254,7 @@ public: * \returns the size in bytes of the packet (including the zero-filled * initial payload) */ - uint32_t GetSize (void) const; + inline uint32_t GetSize (void) const; /** * Add header to this packet. This method invokes the * Header::GetSerializedSize and Header::Serialize @@ -613,4 +613,14 @@ std::ostream& operator<< (std::ostream& os, const Packet &packet); } // namespace ns3 +namespace ns3 { + +uint32_t +Packet::GetSize (void) const +{ + return m_buffer.GetSize (); +} + +} // namespace ns3 + #endif /* PACKET_H */ diff --git a/src/devices/wimax/bs-net-device.cc b/src/devices/wimax/bs-net-device.cc index 26212a419..4244aba01 100644 --- a/src/devices/wimax/bs-net-device.cc +++ b/src/devices/wimax/bs-net-device.cc @@ -594,16 +594,12 @@ BaseStationNetDevice::DoSend (Ptr packet, Ptr burst = Create (); ServiceFlow *serviceFlow = 0; - // drop packet if no SS is registered with the BS, the destination SS is not yet registered or if queue is full - NS_LOG_INFO ("BS (" << source << "):"); NS_LOG_INFO ("\tSending packet..."); NS_LOG_INFO ("\t\tDestination: " << dest); NS_LOG_INFO ("\t\tPaket Size: " << packet->GetSize ()); NS_LOG_INFO ("\t\tProtocol: " << protocolNumber); - NS_LOG_INFO ("TraceDelay: TX (BS), To: " << dest << ", Uid: " << packet->GetUid () << ", time: " - << (Simulator::Now ()).GetSeconds () << ", Packet Size: " << packet->GetSize ()); if (protocolNumber == 2048) { diff --git a/src/devices/wimax/mac-messages.h b/src/devices/wimax/mac-messages.h index 77cc43a92..73e9a5543 100644 --- a/src/devices/wimax/mac-messages.h +++ b/src/devices/wimax/mac-messages.h @@ -38,19 +38,22 @@ namespace ns3 { class ManagementMessageType : public Header { public: + /* + * Section 6.3.2.3 MAC Management messages page 42, Table 14 page 43 + */ enum MessageType { - MESSAGE_TYPE_DL_MAP, - MESSAGE_TYPE_DCD, - MESSAGE_TYPE_UL_MAP, - MESSAGE_TYPE_UCD, - MESSAGE_TYPE_RNG_REQ, - MESSAGE_TYPE_RNG_RSP, - MESSAGE_TYPE_REG_REQ, - MESSAGE_TYPE_REG_RSP, - MESSAGE_TYPE_DSA_REQ, - MESSAGE_TYPE_DSA_RSP, - MESSAGE_TYPE_DSA_ACK + MESSAGE_TYPE_UCD = 0, + MESSAGE_TYPE_DCD = 1, + MESSAGE_TYPE_DL_MAP = 2, + MESSAGE_TYPE_UL_MAP = 3, + MESSAGE_TYPE_RNG_REQ = 4, + MESSAGE_TYPE_RNG_RSP = 5, + MESSAGE_TYPE_REG_REQ = 6, + MESSAGE_TYPE_REG_RSP = 7, + MESSAGE_TYPE_DSA_REQ = 11, + MESSAGE_TYPE_DSA_RSP = 12, + MESSAGE_TYPE_DSA_ACK = 13 }; ManagementMessageType (void); diff --git a/src/devices/wimax/simple-ofdm-wimax-phy.cc b/src/devices/wimax/simple-ofdm-wimax-phy.cc index 04d7e55dd..4ba774217 100644 --- a/src/devices/wimax/simple-ofdm-wimax-phy.cc +++ b/src/devices/wimax/simple-ofdm-wimax-phy.cc @@ -241,6 +241,7 @@ SimpleOfdmWimaxPhy::Send (SendParams *params) Send (o_params->GetBurst (), (WimaxPhy::ModulationType) o_params->GetModulationType (), o_params->GetDirection ()); + } WimaxPhy::PhyType @@ -263,6 +264,7 @@ SimpleOfdmWimaxPhy::Send (Ptr burst, SetBlockParameters (burst->GetSize (), modulationType); CreateFecBlocks (buffer, modulationType); StartSendFecBlock (true, modulationType, direction); + m_traceTx (burst); } } @@ -459,8 +461,8 @@ void SimpleOfdmWimaxPhy::EndReceive (Ptr burst) { Ptr b = burst->Copy (); - m_traceRx (burst); GetReceiveCallback () (b); + m_traceRx (burst); } bvec diff --git a/src/devices/wimax/simple-ofdm-wimax-phy.h b/src/devices/wimax/simple-ofdm-wimax-phy.h index 8f0d96944..6787aec95 100644 --- a/src/devices/wimax/simple-ofdm-wimax-phy.h +++ b/src/devices/wimax/simple-ofdm-wimax-phy.h @@ -232,7 +232,7 @@ private: Time m_blockTime; TracedCallback > m_traceRx; - TracedCallback, WimaxPhy::ModulationType, uint16_t, uint16_t> m_traceTx; + TracedCallback > m_traceTx; // data rates for this Phy uint32_t m_dataRateBpsk12, m_dataRateQpsk12, m_dataRateQpsk34, m_dataRateQam16_12, m_dataRateQam16_34, diff --git a/src/devices/wimax/ss-net-device.cc b/src/devices/wimax/ss-net-device.cc index 3283b2c50..6bbf1bfa9 100644 --- a/src/devices/wimax/ss-net-device.cc +++ b/src/devices/wimax/ss-net-device.cc @@ -1031,8 +1031,7 @@ SubscriberStationNetDevice::DoReceive (Ptr packet) // This is the first or middle fragment. // Take the fragment queue, store the fragment into the queue NS_LOG_INFO ( "\t Received the first or the middle fragment" << std::endl); - GetConnectionManager ()->GetConnection (cid) - ->FragmentEnqueue (packet); + GetConnectionManager ()->GetConnection (cid)->FragmentEnqueue (packet); } } } diff --git a/src/devices/wimax/wimax-mac-to-mac-header.cc b/src/devices/wimax/wimax-mac-to-mac-header.cc index 3d8029ed2..99d45d67d 100644 --- a/src/devices/wimax/wimax-mac-to-mac-header.cc +++ b/src/devices/wimax/wimax-mac-to-mac-header.cc @@ -74,7 +74,16 @@ WimaxMacToMacHeader::GetSizeOfLen (void) const uint32_t WimaxMacToMacHeader::GetSerializedSize (void) const { - return 20 + GetSizeOfLen () ; + uint8_t sizeOfLen = GetSizeOfLen (); + if (sizeOfLen==1) + { + return 20 ; + } + else + { + return 20 + sizeOfLen -1 ; + } + //return 19+sizeOfLen; } void @@ -112,7 +121,7 @@ WimaxMacToMacHeader::Serialize (Buffer::Iterator i) const } else { - i.WriteU8 ((lenSize - 1) | 0x80); + i.WriteU8 ((lenSize-1) | 0x80); for (int j = 0; j < lenSize - 1; j++) { i.WriteU8 ((uint8_t)(m_len >> ((lenSize - 1 - 1 - j) * 8))); diff --git a/src/devices/wimax/wimax-tlv.cc b/src/devices/wimax/wimax-tlv.cc index 808def7d8..48a470e0f 100644 --- a/src/devices/wimax/wimax-tlv.cc +++ b/src/devices/wimax/wimax-tlv.cc @@ -121,7 +121,7 @@ Tlv::Serialize (Buffer::Iterator i) const } else { - i.WriteU8 ((lenSize - 1) | WIMAX_TLV_EXTENDED_LENGTH_MASK); + i.WriteU8 ((lenSize-1) | WIMAX_TLV_EXTENDED_LENGTH_MASK); for (int j = 0; j < lenSize - 1; j++) { i.WriteU8 ((uint8_t)(m_length >> ((lenSize - 1 - 1 - j) * 8))); diff --git a/src/helper/wimax-helper.cc b/src/helper/wimax-helper.cc index ef83fd10d..96a35a510 100644 --- a/src/helper/wimax-helper.cc +++ b/src/helper/wimax-helper.cc @@ -534,19 +534,16 @@ WimaxHelper::EnableAsciiInternal (Ptr stream, EnableAsciiForConnection (stream, nodeid, deviceid, (char*) "SubscriberStationNetDevice", (char*) "BasicConnection"); EnableAsciiForConnection (stream, nodeid, deviceid, (char*) "SubscriberStationNetDevice", (char*) "PrimaryConnection"); - } +} static void PcapSniffTxEvent (Ptr file, - Ptr burst, - WimaxPhy::ModulationType modulationType, - uint16_t m_nrBlocks, - uint16_t m_blockSize) + Ptr burst) { std::list > packets = burst->GetPackets (); for (std::list >::iterator iter = packets.begin (); iter != packets.end (); ++iter) { - WimaxMacToMacHeader m2m((*iter)->GetSize()+1); - (*iter)->AddHeader(m2m); + WimaxMacToMacHeader m2m ((*iter)->GetSize ()); + (*iter)->AddHeader (m2m); file->Write (Simulator::Now (), (*iter)); } } @@ -556,8 +553,8 @@ static void PcapSniffRxEvent (Ptr file, Ptr std::list > packets = burst->GetPackets (); for (std::list >::iterator iter = packets.begin (); iter != packets.end (); ++iter) { - WimaxMacToMacHeader m2m((*iter)->GetSize()+1); - (*iter)->AddHeader(m2m); + WimaxMacToMacHeader m2m ((*iter)->GetSize ()); + (*iter)->AddHeader (m2m); file->Write (Simulator::Now (), (*iter)); } } @@ -568,7 +565,7 @@ WimaxHelper::EnablePcapInternal (std::string prefix, Ptr nd, bool exp // // All of the Pcap enable functions vector through here including the ones // that are wandering through all of devices on perhaps all of the nodes in - // the system. We can only deal with devices of type WifiNetDevice. + // the system. We can only deal with devices of type WimaxNetDevice. // Ptr device = nd->GetObject (); if (device == 0)