Convert to unix line endings.
This commit is contained in:
@@ -1,238 +1,238 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Gaurav Sathe <gaurav.sathe@tcs.com>
|
||||
*/
|
||||
|
||||
#include "ns3/lte-helper.h"
|
||||
#include "ns3/epc-helper.h"
|
||||
#include "ns3/core-module.h"
|
||||
#include "ns3/network-module.h"
|
||||
#include "ns3/ipv4-global-routing-helper.h"
|
||||
#include "ns3/internet-module.h"
|
||||
#include "ns3/mobility-module.h"
|
||||
#include "ns3/lte-module.h"
|
||||
#include "ns3/applications-module.h"
|
||||
#include "ns3/point-to-point-helper.h"
|
||||
#include "ns3/config-store.h"
|
||||
//#include "ns3/gtk-config-store.h"
|
||||
|
||||
using namespace ns3;
|
||||
|
||||
/**
|
||||
* Sample simulation script for LTE+EPC. It instantiates one eNodeB,
|
||||
* attaches three UE to eNodeB starts a flow for each UE to and from a remote host.
|
||||
* It also instantiates one dedicated bearer per UE
|
||||
*/
|
||||
NS_LOG_COMPONENT_DEFINE ("BearerDeactivateExample");
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
|
||||
uint16_t numberOfNodes = 1;
|
||||
uint16_t numberOfUeNodes = 3;
|
||||
double simTime = 1.1;
|
||||
double distance = 60.0;
|
||||
double interPacketInterval = 100;
|
||||
|
||||
// Command line arguments
|
||||
CommandLine cmd;
|
||||
cmd.AddValue ("numberOfNodes", "Number of eNodeBs + UE pairs", numberOfNodes);
|
||||
cmd.AddValue ("simTime", "Total duration of the simulation [s])", simTime);
|
||||
cmd.AddValue ("distance", "Distance between eNBs [m]", distance);
|
||||
cmd.AddValue ("interPacketInterval", "Inter packet interval [ms])", interPacketInterval);
|
||||
cmd.Parse (argc, argv);
|
||||
|
||||
Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
|
||||
Ptr<PointToPointEpcHelper> epcHelper = CreateObject<PointToPointEpcHelper> ();
|
||||
lteHelper->SetEpcHelper (epcHelper);
|
||||
|
||||
ConfigStore inputConfig;
|
||||
inputConfig.ConfigureDefaults ();
|
||||
|
||||
// parse again so you can override default values from the command line
|
||||
cmd.Parse (argc, argv);
|
||||
|
||||
Ptr<Node> pgw = epcHelper->GetPgwNode ();
|
||||
|
||||
// Enable Logging
|
||||
LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_ALL);
|
||||
|
||||
LogComponentEnable ("BearerDeactivateExample", LOG_LEVEL_ALL);
|
||||
LogComponentEnable ("LteHelper", logLevel);
|
||||
LogComponentEnable ("EpcHelper", logLevel);
|
||||
LogComponentEnable ("EpcEnbApplication", logLevel);
|
||||
LogComponentEnable ("EpcSgwPgwApplication", logLevel);
|
||||
LogComponentEnable ("EpcMme", logLevel);
|
||||
LogComponentEnable ("LteEnbRrc", logLevel);
|
||||
|
||||
|
||||
// Create a single RemoteHost
|
||||
NodeContainer remoteHostContainer;
|
||||
remoteHostContainer.Create (1);
|
||||
Ptr<Node> remoteHost = remoteHostContainer.Get (0);
|
||||
InternetStackHelper internet;
|
||||
internet.Install (remoteHostContainer);
|
||||
|
||||
// Create the Internet
|
||||
PointToPointHelper p2ph;
|
||||
p2ph.SetDeviceAttribute ("DataRate", DataRateValue (DataRate ("100Gb/s")));
|
||||
p2ph.SetDeviceAttribute ("Mtu", UintegerValue (1500));
|
||||
p2ph.SetChannelAttribute ("Delay", TimeValue (Seconds (0.010)));
|
||||
NetDeviceContainer internetDevices = p2ph.Install (pgw, remoteHost);
|
||||
Ipv4AddressHelper ipv4h;
|
||||
ipv4h.SetBase ("1.0.0.0", "255.0.0.0");
|
||||
Ipv4InterfaceContainer internetIpIfaces = ipv4h.Assign (internetDevices);
|
||||
// interface 0 is localhost, 1 is the p2p device
|
||||
Ipv4Address remoteHostAddr = internetIpIfaces.GetAddress (1);
|
||||
|
||||
Ipv4StaticRoutingHelper ipv4RoutingHelper;
|
||||
Ptr<Ipv4StaticRouting> remoteHostStaticRouting = ipv4RoutingHelper.GetStaticRouting (remoteHost->GetObject<Ipv4> ());
|
||||
remoteHostStaticRouting->AddNetworkRouteTo (Ipv4Address ("7.0.0.0"), Ipv4Mask ("255.0.0.0"), 1);
|
||||
|
||||
NodeContainer ueNodes;
|
||||
NodeContainer enbNodes;
|
||||
enbNodes.Create (numberOfNodes);
|
||||
ueNodes.Create (numberOfUeNodes);
|
||||
|
||||
// Install Mobility Model
|
||||
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
|
||||
for (uint16_t i = 0; i < numberOfNodes; i++)
|
||||
{
|
||||
positionAlloc->Add (Vector (distance * i, 0, 0));
|
||||
}
|
||||
MobilityHelper mobility;
|
||||
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
|
||||
mobility.SetPositionAllocator (positionAlloc);
|
||||
mobility.Install (enbNodes);
|
||||
mobility.Install (ueNodes);
|
||||
|
||||
// Install LTE Devices to the nodes
|
||||
NetDeviceContainer enbLteDevs = lteHelper->InstallEnbDevice (enbNodes);
|
||||
NetDeviceContainer ueLteDevs = lteHelper->InstallUeDevice (ueNodes);
|
||||
|
||||
// Install the IP stack on the UEs
|
||||
internet.Install (ueNodes);
|
||||
Ipv4InterfaceContainer ueIpIface;
|
||||
ueIpIface = epcHelper->AssignUeIpv4Address (NetDeviceContainer (ueLteDevs));
|
||||
// Assign IP address to UEs, and install applications
|
||||
for (uint32_t u = 0; u < ueNodes.GetN (); ++u)
|
||||
{
|
||||
Ptr<Node> ueNode = ueNodes.Get (u);
|
||||
// Set the default gateway for the UE
|
||||
Ptr<Ipv4StaticRouting> ueStaticRouting = ipv4RoutingHelper.GetStaticRouting (ueNode->GetObject<Ipv4> ());
|
||||
ueStaticRouting->SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (), 1);
|
||||
}
|
||||
|
||||
// Attach a UE to a eNB
|
||||
lteHelper->Attach (ueLteDevs, enbLteDevs.Get (0));
|
||||
|
||||
// Activate an EPS bearer on all UEs
|
||||
|
||||
for (uint32_t u = 0; u < ueNodes.GetN (); ++u)
|
||||
{
|
||||
Ptr<NetDevice> ueDevice = ueLteDevs.Get (u);
|
||||
GbrQosInformation qos;
|
||||
qos.gbrDl = 132; // bit/s, considering IP, UDP, RLC, PDCP header size
|
||||
qos.gbrUl = 132;
|
||||
qos.mbrDl = qos.gbrDl;
|
||||
qos.mbrUl = qos.gbrUl;
|
||||
|
||||
enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
|
||||
EpsBearer bearer (q, qos);
|
||||
bearer.arp.priorityLevel = 15 - (u + 1);
|
||||
bearer.arp.preemptionCapability = true;
|
||||
bearer.arp.preemptionVulnerability = true;
|
||||
lteHelper->ActivateDedicatedEpsBearer (ueDevice, bearer, EpcTft::Default ());
|
||||
}
|
||||
|
||||
|
||||
// Install and start applications on UEs and remote host
|
||||
uint16_t dlPort = 1234;
|
||||
uint16_t ulPort = 2000;
|
||||
uint16_t otherPort = 3000;
|
||||
ApplicationContainer clientApps;
|
||||
ApplicationContainer serverApps;
|
||||
for (uint32_t u = 0; u < ueNodes.GetN (); ++u)
|
||||
{
|
||||
++ulPort;
|
||||
++otherPort;
|
||||
PacketSinkHelper dlPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), dlPort));
|
||||
PacketSinkHelper ulPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), ulPort));
|
||||
PacketSinkHelper packetSinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), otherPort));
|
||||
serverApps.Add (dlPacketSinkHelper.Install (ueNodes.Get (u)));
|
||||
serverApps.Add (ulPacketSinkHelper.Install (remoteHost));
|
||||
serverApps.Add (packetSinkHelper.Install (ueNodes.Get (u)));
|
||||
|
||||
UdpClientHelper dlClient (ueIpIface.GetAddress (u), dlPort);
|
||||
dlClient.SetAttribute ("Interval", TimeValue (MilliSeconds (interPacketInterval)));
|
||||
dlClient.SetAttribute ("MaxPackets", UintegerValue (1000000));
|
||||
|
||||
UdpClientHelper ulClient (remoteHostAddr, ulPort);
|
||||
ulClient.SetAttribute ("Interval", TimeValue (MilliSeconds (interPacketInterval)));
|
||||
ulClient.SetAttribute ("MaxPackets", UintegerValue (1000000));
|
||||
|
||||
UdpClientHelper client (ueIpIface.GetAddress (u), otherPort);
|
||||
client.SetAttribute ("Interval", TimeValue (MilliSeconds (interPacketInterval)));
|
||||
client.SetAttribute ("MaxPackets", UintegerValue (1000000));
|
||||
|
||||
clientApps.Add (dlClient.Install (remoteHost));
|
||||
clientApps.Add (ulClient.Install (ueNodes.Get (u)));
|
||||
if (u + 1 < ueNodes.GetN ())
|
||||
{
|
||||
clientApps.Add (client.Install (ueNodes.Get (u + 1)));
|
||||
}
|
||||
else
|
||||
{
|
||||
clientApps.Add (client.Install (ueNodes.Get (0)));
|
||||
}
|
||||
}
|
||||
|
||||
serverApps.Start (Seconds (0.030));
|
||||
clientApps.Start (Seconds (0.030));
|
||||
|
||||
double statsStartTime = 0.04; // need to allow for RRC connection establishment + SRS
|
||||
double statsDuration = 1.0;
|
||||
|
||||
lteHelper->EnableRlcTraces ();
|
||||
Ptr<RadioBearerStatsCalculator> rlcStats = lteHelper->GetRlcStats ();
|
||||
rlcStats->SetAttribute ("StartTime", TimeValue (Seconds (statsStartTime)));
|
||||
rlcStats->SetAttribute ("EpochDuration", TimeValue (Seconds (statsDuration)));
|
||||
|
||||
//get ue device pointer for UE-ID 0 IMSI 1 and enb device pointer
|
||||
Ptr<NetDevice> ueDevice = ueLteDevs.Get (0);
|
||||
Ptr<NetDevice> enbDevice = enbLteDevs.Get (0);
|
||||
|
||||
/*
|
||||
* Instantiate De-activation using Simulator::Schedule() method which will initiate bearer de-activation after deActivateTime
|
||||
* Instantiate De-activation in sequence (Time const &time, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3)
|
||||
*/
|
||||
Time deActivateTime (Seconds (1.5));
|
||||
Simulator::Schedule (deActivateTime, &LteHelper::DeActivateDedicatedEpsBearer, lteHelper, ueDevice, enbDevice, 2);
|
||||
|
||||
//stop simulation after 3 seconds
|
||||
Simulator::Stop (Seconds (3.0));
|
||||
|
||||
Simulator::Run ();
|
||||
/*GtkConfigStore config;
|
||||
config.ConfigureAttributes();*/
|
||||
|
||||
Simulator::Destroy ();
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Gaurav Sathe <gaurav.sathe@tcs.com>
|
||||
*/
|
||||
|
||||
#include "ns3/lte-helper.h"
|
||||
#include "ns3/epc-helper.h"
|
||||
#include "ns3/core-module.h"
|
||||
#include "ns3/network-module.h"
|
||||
#include "ns3/ipv4-global-routing-helper.h"
|
||||
#include "ns3/internet-module.h"
|
||||
#include "ns3/mobility-module.h"
|
||||
#include "ns3/lte-module.h"
|
||||
#include "ns3/applications-module.h"
|
||||
#include "ns3/point-to-point-helper.h"
|
||||
#include "ns3/config-store.h"
|
||||
//#include "ns3/gtk-config-store.h"
|
||||
|
||||
using namespace ns3;
|
||||
|
||||
/**
|
||||
* Sample simulation script for LTE+EPC. It instantiates one eNodeB,
|
||||
* attaches three UE to eNodeB starts a flow for each UE to and from a remote host.
|
||||
* It also instantiates one dedicated bearer per UE
|
||||
*/
|
||||
NS_LOG_COMPONENT_DEFINE ("BearerDeactivateExample");
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
|
||||
uint16_t numberOfNodes = 1;
|
||||
uint16_t numberOfUeNodes = 3;
|
||||
double simTime = 1.1;
|
||||
double distance = 60.0;
|
||||
double interPacketInterval = 100;
|
||||
|
||||
// Command line arguments
|
||||
CommandLine cmd;
|
||||
cmd.AddValue ("numberOfNodes", "Number of eNodeBs + UE pairs", numberOfNodes);
|
||||
cmd.AddValue ("simTime", "Total duration of the simulation [s])", simTime);
|
||||
cmd.AddValue ("distance", "Distance between eNBs [m]", distance);
|
||||
cmd.AddValue ("interPacketInterval", "Inter packet interval [ms])", interPacketInterval);
|
||||
cmd.Parse (argc, argv);
|
||||
|
||||
Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
|
||||
Ptr<PointToPointEpcHelper> epcHelper = CreateObject<PointToPointEpcHelper> ();
|
||||
lteHelper->SetEpcHelper (epcHelper);
|
||||
|
||||
ConfigStore inputConfig;
|
||||
inputConfig.ConfigureDefaults ();
|
||||
|
||||
// parse again so you can override default values from the command line
|
||||
cmd.Parse (argc, argv);
|
||||
|
||||
Ptr<Node> pgw = epcHelper->GetPgwNode ();
|
||||
|
||||
// Enable Logging
|
||||
LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_ALL);
|
||||
|
||||
LogComponentEnable ("BearerDeactivateExample", LOG_LEVEL_ALL);
|
||||
LogComponentEnable ("LteHelper", logLevel);
|
||||
LogComponentEnable ("EpcHelper", logLevel);
|
||||
LogComponentEnable ("EpcEnbApplication", logLevel);
|
||||
LogComponentEnable ("EpcSgwPgwApplication", logLevel);
|
||||
LogComponentEnable ("EpcMme", logLevel);
|
||||
LogComponentEnable ("LteEnbRrc", logLevel);
|
||||
|
||||
|
||||
// Create a single RemoteHost
|
||||
NodeContainer remoteHostContainer;
|
||||
remoteHostContainer.Create (1);
|
||||
Ptr<Node> remoteHost = remoteHostContainer.Get (0);
|
||||
InternetStackHelper internet;
|
||||
internet.Install (remoteHostContainer);
|
||||
|
||||
// Create the Internet
|
||||
PointToPointHelper p2ph;
|
||||
p2ph.SetDeviceAttribute ("DataRate", DataRateValue (DataRate ("100Gb/s")));
|
||||
p2ph.SetDeviceAttribute ("Mtu", UintegerValue (1500));
|
||||
p2ph.SetChannelAttribute ("Delay", TimeValue (Seconds (0.010)));
|
||||
NetDeviceContainer internetDevices = p2ph.Install (pgw, remoteHost);
|
||||
Ipv4AddressHelper ipv4h;
|
||||
ipv4h.SetBase ("1.0.0.0", "255.0.0.0");
|
||||
Ipv4InterfaceContainer internetIpIfaces = ipv4h.Assign (internetDevices);
|
||||
// interface 0 is localhost, 1 is the p2p device
|
||||
Ipv4Address remoteHostAddr = internetIpIfaces.GetAddress (1);
|
||||
|
||||
Ipv4StaticRoutingHelper ipv4RoutingHelper;
|
||||
Ptr<Ipv4StaticRouting> remoteHostStaticRouting = ipv4RoutingHelper.GetStaticRouting (remoteHost->GetObject<Ipv4> ());
|
||||
remoteHostStaticRouting->AddNetworkRouteTo (Ipv4Address ("7.0.0.0"), Ipv4Mask ("255.0.0.0"), 1);
|
||||
|
||||
NodeContainer ueNodes;
|
||||
NodeContainer enbNodes;
|
||||
enbNodes.Create (numberOfNodes);
|
||||
ueNodes.Create (numberOfUeNodes);
|
||||
|
||||
// Install Mobility Model
|
||||
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
|
||||
for (uint16_t i = 0; i < numberOfNodes; i++)
|
||||
{
|
||||
positionAlloc->Add (Vector (distance * i, 0, 0));
|
||||
}
|
||||
MobilityHelper mobility;
|
||||
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
|
||||
mobility.SetPositionAllocator (positionAlloc);
|
||||
mobility.Install (enbNodes);
|
||||
mobility.Install (ueNodes);
|
||||
|
||||
// Install LTE Devices to the nodes
|
||||
NetDeviceContainer enbLteDevs = lteHelper->InstallEnbDevice (enbNodes);
|
||||
NetDeviceContainer ueLteDevs = lteHelper->InstallUeDevice (ueNodes);
|
||||
|
||||
// Install the IP stack on the UEs
|
||||
internet.Install (ueNodes);
|
||||
Ipv4InterfaceContainer ueIpIface;
|
||||
ueIpIface = epcHelper->AssignUeIpv4Address (NetDeviceContainer (ueLteDevs));
|
||||
// Assign IP address to UEs, and install applications
|
||||
for (uint32_t u = 0; u < ueNodes.GetN (); ++u)
|
||||
{
|
||||
Ptr<Node> ueNode = ueNodes.Get (u);
|
||||
// Set the default gateway for the UE
|
||||
Ptr<Ipv4StaticRouting> ueStaticRouting = ipv4RoutingHelper.GetStaticRouting (ueNode->GetObject<Ipv4> ());
|
||||
ueStaticRouting->SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (), 1);
|
||||
}
|
||||
|
||||
// Attach a UE to a eNB
|
||||
lteHelper->Attach (ueLteDevs, enbLteDevs.Get (0));
|
||||
|
||||
// Activate an EPS bearer on all UEs
|
||||
|
||||
for (uint32_t u = 0; u < ueNodes.GetN (); ++u)
|
||||
{
|
||||
Ptr<NetDevice> ueDevice = ueLteDevs.Get (u);
|
||||
GbrQosInformation qos;
|
||||
qos.gbrDl = 132; // bit/s, considering IP, UDP, RLC, PDCP header size
|
||||
qos.gbrUl = 132;
|
||||
qos.mbrDl = qos.gbrDl;
|
||||
qos.mbrUl = qos.gbrUl;
|
||||
|
||||
enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
|
||||
EpsBearer bearer (q, qos);
|
||||
bearer.arp.priorityLevel = 15 - (u + 1);
|
||||
bearer.arp.preemptionCapability = true;
|
||||
bearer.arp.preemptionVulnerability = true;
|
||||
lteHelper->ActivateDedicatedEpsBearer (ueDevice, bearer, EpcTft::Default ());
|
||||
}
|
||||
|
||||
|
||||
// Install and start applications on UEs and remote host
|
||||
uint16_t dlPort = 1234;
|
||||
uint16_t ulPort = 2000;
|
||||
uint16_t otherPort = 3000;
|
||||
ApplicationContainer clientApps;
|
||||
ApplicationContainer serverApps;
|
||||
for (uint32_t u = 0; u < ueNodes.GetN (); ++u)
|
||||
{
|
||||
++ulPort;
|
||||
++otherPort;
|
||||
PacketSinkHelper dlPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), dlPort));
|
||||
PacketSinkHelper ulPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), ulPort));
|
||||
PacketSinkHelper packetSinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), otherPort));
|
||||
serverApps.Add (dlPacketSinkHelper.Install (ueNodes.Get (u)));
|
||||
serverApps.Add (ulPacketSinkHelper.Install (remoteHost));
|
||||
serverApps.Add (packetSinkHelper.Install (ueNodes.Get (u)));
|
||||
|
||||
UdpClientHelper dlClient (ueIpIface.GetAddress (u), dlPort);
|
||||
dlClient.SetAttribute ("Interval", TimeValue (MilliSeconds (interPacketInterval)));
|
||||
dlClient.SetAttribute ("MaxPackets", UintegerValue (1000000));
|
||||
|
||||
UdpClientHelper ulClient (remoteHostAddr, ulPort);
|
||||
ulClient.SetAttribute ("Interval", TimeValue (MilliSeconds (interPacketInterval)));
|
||||
ulClient.SetAttribute ("MaxPackets", UintegerValue (1000000));
|
||||
|
||||
UdpClientHelper client (ueIpIface.GetAddress (u), otherPort);
|
||||
client.SetAttribute ("Interval", TimeValue (MilliSeconds (interPacketInterval)));
|
||||
client.SetAttribute ("MaxPackets", UintegerValue (1000000));
|
||||
|
||||
clientApps.Add (dlClient.Install (remoteHost));
|
||||
clientApps.Add (ulClient.Install (ueNodes.Get (u)));
|
||||
if (u + 1 < ueNodes.GetN ())
|
||||
{
|
||||
clientApps.Add (client.Install (ueNodes.Get (u + 1)));
|
||||
}
|
||||
else
|
||||
{
|
||||
clientApps.Add (client.Install (ueNodes.Get (0)));
|
||||
}
|
||||
}
|
||||
|
||||
serverApps.Start (Seconds (0.030));
|
||||
clientApps.Start (Seconds (0.030));
|
||||
|
||||
double statsStartTime = 0.04; // need to allow for RRC connection establishment + SRS
|
||||
double statsDuration = 1.0;
|
||||
|
||||
lteHelper->EnableRlcTraces ();
|
||||
Ptr<RadioBearerStatsCalculator> rlcStats = lteHelper->GetRlcStats ();
|
||||
rlcStats->SetAttribute ("StartTime", TimeValue (Seconds (statsStartTime)));
|
||||
rlcStats->SetAttribute ("EpochDuration", TimeValue (Seconds (statsDuration)));
|
||||
|
||||
//get ue device pointer for UE-ID 0 IMSI 1 and enb device pointer
|
||||
Ptr<NetDevice> ueDevice = ueLteDevs.Get (0);
|
||||
Ptr<NetDevice> enbDevice = enbLteDevs.Get (0);
|
||||
|
||||
/*
|
||||
* Instantiate De-activation using Simulator::Schedule() method which will initiate bearer de-activation after deActivateTime
|
||||
* Instantiate De-activation in sequence (Time const &time, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3)
|
||||
*/
|
||||
Time deActivateTime (Seconds (1.5));
|
||||
Simulator::Schedule (deActivateTime, &LteHelper::DeActivateDedicatedEpsBearer, lteHelper, ueDevice, enbDevice, 2);
|
||||
|
||||
//stop simulation after 3 seconds
|
||||
Simulator::Stop (Seconds (3.0));
|
||||
|
||||
Simulator::Run ();
|
||||
/*GtkConfigStore config;
|
||||
config.ConfigureAttributes();*/
|
||||
|
||||
Simulator::Destroy ();
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,347 +1,347 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2011, 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author:Gaurav Sathe <gaurav.sathe@tcs.com>
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include <ns3/object.h>
|
||||
#include <ns3/spectrum-interference.h>
|
||||
#include <ns3/spectrum-error-model.h>
|
||||
#include <ns3/log.h>
|
||||
#include <ns3/test.h>
|
||||
#include <ns3/simulator.h>
|
||||
#include <ns3/packet.h>
|
||||
#include <ns3/ptr.h>
|
||||
#include "ns3/radio-bearer-stats-calculator.h"
|
||||
#include <ns3/constant-position-mobility-model.h>
|
||||
#include <ns3/eps-bearer.h>
|
||||
#include <ns3/node-container.h>
|
||||
#include <ns3/mobility-helper.h>
|
||||
#include <ns3/net-device-container.h>
|
||||
#include <ns3/lte-ue-net-device.h>
|
||||
#include <ns3/lte-enb-net-device.h>
|
||||
#include <ns3/lte-ue-rrc.h>
|
||||
#include <ns3/lte-helper.h>
|
||||
#include "ns3/string.h"
|
||||
#include "ns3/double.h"
|
||||
#include <ns3/lte-enb-phy.h>
|
||||
#include <ns3/lte-ue-phy.h>
|
||||
#include <ns3/boolean.h>
|
||||
#include <ns3/enum.h>
|
||||
|
||||
#include "ns3/point-to-point-epc-helper.h"
|
||||
#include "ns3/network-module.h"
|
||||
#include "ns3/ipv4-global-routing-helper.h"
|
||||
#include "ns3/internet-module.h"
|
||||
#include "ns3/applications-module.h"
|
||||
#include "ns3/point-to-point-helper.h"
|
||||
|
||||
#include "lte-test-deactivate-bearer.h"
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("LenaTestDeactivateBearer");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
LenaTestBearerDeactivateSuite::LenaTestBearerDeactivateSuite ()
|
||||
: TestSuite ("lte-test-deactivate-bearer", SYSTEM)
|
||||
{
|
||||
NS_LOG_INFO ("creating LenaTestPssFfMacSchedulerSuite");
|
||||
|
||||
bool errorModel = false;
|
||||
|
||||
// Test Case: homogeneous flow test in PSS (different distance)
|
||||
// Traffic1 info
|
||||
// UDP traffic: payload size = 100 bytes, interval = 1 ms
|
||||
// UDP rate in scheduler: (payload + RLC header + PDCP header + IP header + UDP header) * 1000 byte/sec -> 132000 byte/rate
|
||||
// Maximum throughput = 3 / ( 1/2196000 + 1/1191000 + 1/1383000) = 1486569 byte/s
|
||||
// 132000 * 3 = 396000 < 1209046 -> estimated throughput in downlink = 132000 byte/sec
|
||||
std::vector<uint16_t> dist_1;
|
||||
|
||||
dist_1.push_back (0); // User 0 distance --> MCS 28
|
||||
dist_1.push_back (0); // User 1 distance --> MCS 22
|
||||
dist_1.push_back (0); // User 2 distance --> MCS 20
|
||||
|
||||
std::vector<uint16_t> packetSize_1;
|
||||
|
||||
packetSize_1.push_back (100); //1
|
||||
packetSize_1.push_back (100); //2
|
||||
packetSize_1.push_back (100); //3
|
||||
|
||||
std::vector<uint32_t> estThrPssDl_1;
|
||||
|
||||
estThrPssDl_1.push_back (132000); // User 0 estimated TTI throughput from PSS
|
||||
estThrPssDl_1.push_back (132000); // User 1 estimated TTI throughput from PSS
|
||||
estThrPssDl_1.push_back (132000); // User 2 estimated TTI throughput from PSS
|
||||
|
||||
AddTestCase (new LenaDeactivateBearerTestCase (dist_1,estThrPssDl_1,packetSize_1,1,errorModel,true), TestCase::QUICK);
|
||||
}
|
||||
|
||||
static LenaTestBearerDeactivateSuite lenaTestBearerDeactivateSuite;
|
||||
|
||||
|
||||
std::string
|
||||
LenaDeactivateBearerTestCase::BuildNameString (uint16_t nUser, std::vector<uint16_t> dist)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << "distances (m) = [ ";
|
||||
for (std::vector<uint16_t>::iterator it = dist.begin (); it != dist.end (); ++it)
|
||||
{
|
||||
oss << *it << " ";
|
||||
}
|
||||
oss << "]";
|
||||
return oss.str ();
|
||||
}
|
||||
|
||||
LenaDeactivateBearerTestCase::LenaDeactivateBearerTestCase (std::vector<uint16_t> dist, std::vector<uint32_t> estThrPssDl, std::vector<uint16_t> packetSize, uint16_t interval,bool errorModelEnabled, bool useIdealRrc)
|
||||
: TestCase (BuildNameString (dist.size (), dist)),
|
||||
m_nUser (dist.size ()),
|
||||
m_dist (dist),
|
||||
m_packetSize (packetSize),
|
||||
m_interval (interval),
|
||||
m_estThrPssDl (estThrPssDl),
|
||||
m_errorModelEnabled (errorModelEnabled)
|
||||
{
|
||||
}
|
||||
|
||||
LenaDeactivateBearerTestCase::~LenaDeactivateBearerTestCase ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
LenaDeactivateBearerTestCase::DoRun (void)
|
||||
{
|
||||
if (!m_errorModelEnabled)
|
||||
{
|
||||
Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
|
||||
Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false));
|
||||
}
|
||||
|
||||
Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (true));
|
||||
|
||||
|
||||
Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
|
||||
Ptr<PointToPointEpcHelper> epcHelper = CreateObject<PointToPointEpcHelper> ();
|
||||
lteHelper->SetEpcHelper (epcHelper);
|
||||
|
||||
Ptr<Node> pgw = epcHelper->GetPgwNode ();
|
||||
|
||||
// Create a single RemoteHost
|
||||
NodeContainer remoteHostContainer;
|
||||
remoteHostContainer.Create (1);
|
||||
Ptr<Node> remoteHost = remoteHostContainer.Get (0);
|
||||
InternetStackHelper internet;
|
||||
internet.Install (remoteHostContainer);
|
||||
|
||||
// Create the Internet
|
||||
PointToPointHelper p2ph;
|
||||
p2ph.SetDeviceAttribute ("DataRate", DataRateValue (DataRate ("100Gb/s")));
|
||||
p2ph.SetDeviceAttribute ("Mtu", UintegerValue (1500));
|
||||
p2ph.SetChannelAttribute ("Delay", TimeValue (Seconds (0.001)));
|
||||
NetDeviceContainer internetDevices = p2ph.Install (pgw, remoteHost);
|
||||
Ipv4AddressHelper ipv4h;
|
||||
ipv4h.SetBase ("1.0.0.0", "255.0.0.0");
|
||||
Ipv4InterfaceContainer internetIpIfaces = ipv4h.Assign (internetDevices);
|
||||
// interface 0 is localhost, 1 is the p2p device
|
||||
Ipv4Address remoteHostAddr = internetIpIfaces.GetAddress (1);
|
||||
|
||||
Ipv4StaticRoutingHelper ipv4RoutingHelper;
|
||||
Ptr<Ipv4StaticRouting> remoteHostStaticRouting = ipv4RoutingHelper.GetStaticRouting (remoteHost->GetObject<Ipv4> ());
|
||||
remoteHostStaticRouting->AddNetworkRouteTo (Ipv4Address ("7.0.0.0"), Ipv4Mask ("255.0.0.0"), 1);
|
||||
|
||||
// LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_ALL);
|
||||
|
||||
// LogComponentEnable ("LenaTestDeactivateBearer", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("LteHelper", logLevel);
|
||||
// LogComponentEnable ("EpcHelper", logLevel);
|
||||
// LogComponentEnable ("EpcEnbApplication", logLevel);
|
||||
// LogComponentEnable ("EpcSgwPgwApplication", logLevel);
|
||||
// LogComponentEnable ("EpcMme", logLevel);
|
||||
// LogComponentEnable ("LteEnbRrc", logLevel);
|
||||
|
||||
lteHelper->SetAttribute ("PathlossModel", StringValue ("ns3::FriisSpectrumPropagationLossModel"));
|
||||
|
||||
// Create Nodes: eNodeB and UE
|
||||
NodeContainer enbNodes;
|
||||
NodeContainer ueNodes;
|
||||
enbNodes.Create (1);
|
||||
ueNodes.Create (m_nUser);
|
||||
|
||||
// Install Mobility Model
|
||||
MobilityHelper mobility;
|
||||
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
|
||||
mobility.Install (enbNodes);
|
||||
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
|
||||
mobility.Install (ueNodes);
|
||||
|
||||
// Create Devices and install them in the Nodes (eNB and UE)
|
||||
NetDeviceContainer enbDevs;
|
||||
NetDeviceContainer ueDevs;
|
||||
lteHelper->SetSchedulerType ("ns3::PssFfMacScheduler");
|
||||
enbDevs = lteHelper->InstallEnbDevice (enbNodes);
|
||||
ueDevs = lteHelper->InstallUeDevice (ueNodes);
|
||||
|
||||
Ptr<LteEnbNetDevice> lteEnbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
|
||||
Ptr<LteEnbPhy> enbPhy = lteEnbDev->GetPhy ();
|
||||
enbPhy->SetAttribute ("TxPower", DoubleValue (30.0));
|
||||
enbPhy->SetAttribute ("NoiseFigure", DoubleValue (5.0));
|
||||
|
||||
// Set UEs' position and power
|
||||
for (int i = 0; i < m_nUser; i++)
|
||||
{
|
||||
Ptr<ConstantPositionMobilityModel> mm = ueNodes.Get (i)->GetObject<ConstantPositionMobilityModel> ();
|
||||
mm->SetPosition (Vector (m_dist.at (i), 0.0, 0.0));
|
||||
Ptr<LteUeNetDevice> lteUeDev = ueDevs.Get (i)->GetObject<LteUeNetDevice> ();
|
||||
Ptr<LteUePhy> uePhy = lteUeDev->GetPhy ();
|
||||
uePhy->SetAttribute ("TxPower", DoubleValue (23.0));
|
||||
uePhy->SetAttribute ("NoiseFigure", DoubleValue (9.0));
|
||||
}
|
||||
|
||||
// Install the IP stack on the UEs
|
||||
internet.Install (ueNodes);
|
||||
Ipv4InterfaceContainer ueIpIface;
|
||||
ueIpIface = epcHelper->AssignUeIpv4Address (NetDeviceContainer (ueDevs));
|
||||
|
||||
// Assign IP address to UEs
|
||||
for (uint32_t u = 0; u < ueNodes.GetN (); ++u)
|
||||
{
|
||||
Ptr<Node> ueNode = ueNodes.Get (u);
|
||||
// Set the default gateway for the UE
|
||||
Ptr<Ipv4StaticRouting> ueStaticRouting = ipv4RoutingHelper.GetStaticRouting (ueNode->GetObject<Ipv4> ());
|
||||
ueStaticRouting->SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (), 1);
|
||||
}
|
||||
|
||||
// Attach a UE to a eNB
|
||||
lteHelper->Attach (ueDevs, enbDevs.Get (0));
|
||||
|
||||
// Activate an EPS bearer on all UEs
|
||||
|
||||
for (uint32_t u = 0; u < ueNodes.GetN (); ++u)
|
||||
{
|
||||
Ptr<NetDevice> ueDevice = ueDevs.Get (u);
|
||||
GbrQosInformation qos;
|
||||
qos.gbrDl = (m_packetSize.at (u) + 32) * (1000 / m_interval) * 8; // bit/s, considering IP, UDP, RLC, PDCP header size
|
||||
qos.gbrUl = (m_packetSize.at (u) + 32) * (1000 / m_interval) * 8;
|
||||
qos.mbrDl = qos.gbrDl;
|
||||
qos.mbrUl = qos.gbrUl;
|
||||
|
||||
enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
|
||||
EpsBearer bearer (q, qos);
|
||||
bearer.arp.priorityLevel = 15 - (u + 1);
|
||||
bearer.arp.preemptionCapability = true;
|
||||
bearer.arp.preemptionVulnerability = true;
|
||||
lteHelper->ActivateDedicatedEpsBearer (ueDevice, bearer, EpcTft::Default ());
|
||||
}
|
||||
|
||||
|
||||
// Install downlink and uplink applications
|
||||
uint16_t dlPort = 1234;
|
||||
uint16_t ulPort = 2000;
|
||||
PacketSinkHelper dlPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), dlPort));
|
||||
PacketSinkHelper ulPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), ulPort));
|
||||
ApplicationContainer clientApps;
|
||||
ApplicationContainer serverApps;
|
||||
for (uint32_t u = 0; u < ueNodes.GetN (); ++u)
|
||||
{
|
||||
++ulPort;
|
||||
serverApps.Add (dlPacketSinkHelper.Install (ueNodes.Get (u))); // receive packets from remotehost
|
||||
serverApps.Add (ulPacketSinkHelper.Install (remoteHost)); // receive packets from UEs
|
||||
|
||||
UdpClientHelper dlClient (ueIpIface.GetAddress (u), dlPort); // uplink packets generator
|
||||
dlClient.SetAttribute ("Interval", TimeValue (MilliSeconds (m_interval)));
|
||||
dlClient.SetAttribute ("MaxPackets", UintegerValue (1000000));
|
||||
dlClient.SetAttribute ("PacketSize", UintegerValue (m_packetSize.at (u)));
|
||||
|
||||
UdpClientHelper ulClient (remoteHostAddr, ulPort); // downlink packets generator
|
||||
ulClient.SetAttribute ("Interval", TimeValue (MilliSeconds (m_interval)));
|
||||
ulClient.SetAttribute ("MaxPackets", UintegerValue (1000000));
|
||||
ulClient.SetAttribute ("PacketSize", UintegerValue (m_packetSize.at (u)));
|
||||
|
||||
clientApps.Add (dlClient.Install (remoteHost));
|
||||
clientApps.Add (ulClient.Install (ueNodes.Get (u)));
|
||||
}
|
||||
|
||||
|
||||
serverApps.Start (Seconds (0.030));
|
||||
clientApps.Start (Seconds (0.030));
|
||||
|
||||
double statsStartTime = 0.04; // need to allow for RRC connection establishment + SRS
|
||||
double statsDuration = 1.0;
|
||||
double tolerance = 0.1;
|
||||
|
||||
lteHelper->EnableRlcTraces ();
|
||||
Ptr<RadioBearerStatsCalculator> rlcStats = lteHelper->GetRlcStats ();
|
||||
rlcStats->SetAttribute ("StartTime", TimeValue (Seconds (statsStartTime)));
|
||||
rlcStats->SetAttribute ("EpochDuration", TimeValue (Seconds (statsDuration)));
|
||||
|
||||
|
||||
//get ue device pointer for UE-ID 0 IMSI 1 and enb device pointer
|
||||
Ptr<NetDevice> ueDevice = ueDevs.Get (0);
|
||||
Ptr<NetDevice> enbDevice = enbDevs.Get (0);
|
||||
|
||||
/*
|
||||
* Instantiate De-activation using Simulator::Schedule() method which will initiate bearer de-activation after deActivateTime
|
||||
* Instantiate De-activation in sequence (Time const &time, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3)
|
||||
*/
|
||||
Time deActivateTime (Seconds (1.5));
|
||||
Simulator::Schedule (deActivateTime, &LteHelper::DeActivateDedicatedEpsBearer, lteHelper, ueDevice, enbDevice, 2);
|
||||
|
||||
//stop simulation after 3 seconds
|
||||
Simulator::Stop (Seconds (3.0));
|
||||
|
||||
Simulator::Run ();
|
||||
|
||||
NS_LOG_INFO ("DL - Test with " << m_nUser << " user(s)");
|
||||
std::vector <uint64_t> dlDataRxed;
|
||||
std::vector <uint64_t> dlDataTxed;
|
||||
for (int i = 0; i < m_nUser; i++)
|
||||
{
|
||||
// get the imsi
|
||||
uint64_t imsi = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetImsi ();
|
||||
// get the lcId
|
||||
// lcId is hard-coded, since only one dedicated bearer is added
|
||||
uint8_t lcId = 4;
|
||||
dlDataRxed.push_back (rlcStats->GetDlRxData (imsi, lcId));
|
||||
dlDataTxed.push_back (rlcStats->GetDlTxData (imsi, lcId));
|
||||
NS_LOG_INFO ("\tUser " << i << " dist " << m_dist.at (i) << " imsi " << imsi << " bytes rxed " << (double)dlDataRxed.at (i) << " thr " << (double)dlDataRxed.at (i) / statsDuration << " ref " << m_estThrPssDl.at (i));
|
||||
NS_LOG_INFO ("\tUser " << i << " imsi " << imsi << " bytes txed " << (double)dlDataTxed.at (i) << " thr " << (double)dlDataTxed.at (i) / statsDuration);
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_nUser; i++)
|
||||
{
|
||||
uint64_t imsi = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetImsi ();
|
||||
|
||||
/*
|
||||
* For UE ID-0 IMSI 1, LCID=4 is deactivated hence If traffic seen on it, test case should fail
|
||||
* Else For other UE's, test case should validate throughput
|
||||
*/
|
||||
if (imsi == 1)
|
||||
{
|
||||
NS_TEST_ASSERT_MSG_EQ ((double)dlDataTxed.at (i), 0, "Invalid LCID in Statistics ");
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_TEST_ASSERT_MSG_EQ_TOL ((double)dlDataTxed.at (i) / statsDuration, m_estThrPssDl.at (i), m_estThrPssDl.at (i) * tolerance, " Unfair Throughput!");
|
||||
}
|
||||
}
|
||||
|
||||
Simulator::Destroy ();
|
||||
}
|
||||
}
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2011, 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author:Gaurav Sathe <gaurav.sathe@tcs.com>
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include <ns3/object.h>
|
||||
#include <ns3/spectrum-interference.h>
|
||||
#include <ns3/spectrum-error-model.h>
|
||||
#include <ns3/log.h>
|
||||
#include <ns3/test.h>
|
||||
#include <ns3/simulator.h>
|
||||
#include <ns3/packet.h>
|
||||
#include <ns3/ptr.h>
|
||||
#include "ns3/radio-bearer-stats-calculator.h"
|
||||
#include <ns3/constant-position-mobility-model.h>
|
||||
#include <ns3/eps-bearer.h>
|
||||
#include <ns3/node-container.h>
|
||||
#include <ns3/mobility-helper.h>
|
||||
#include <ns3/net-device-container.h>
|
||||
#include <ns3/lte-ue-net-device.h>
|
||||
#include <ns3/lte-enb-net-device.h>
|
||||
#include <ns3/lte-ue-rrc.h>
|
||||
#include <ns3/lte-helper.h>
|
||||
#include "ns3/string.h"
|
||||
#include "ns3/double.h"
|
||||
#include <ns3/lte-enb-phy.h>
|
||||
#include <ns3/lte-ue-phy.h>
|
||||
#include <ns3/boolean.h>
|
||||
#include <ns3/enum.h>
|
||||
|
||||
#include "ns3/point-to-point-epc-helper.h"
|
||||
#include "ns3/network-module.h"
|
||||
#include "ns3/ipv4-global-routing-helper.h"
|
||||
#include "ns3/internet-module.h"
|
||||
#include "ns3/applications-module.h"
|
||||
#include "ns3/point-to-point-helper.h"
|
||||
|
||||
#include "lte-test-deactivate-bearer.h"
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("LenaTestDeactivateBearer");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
LenaTestBearerDeactivateSuite::LenaTestBearerDeactivateSuite ()
|
||||
: TestSuite ("lte-test-deactivate-bearer", SYSTEM)
|
||||
{
|
||||
NS_LOG_INFO ("creating LenaTestPssFfMacSchedulerSuite");
|
||||
|
||||
bool errorModel = false;
|
||||
|
||||
// Test Case: homogeneous flow test in PSS (different distance)
|
||||
// Traffic1 info
|
||||
// UDP traffic: payload size = 100 bytes, interval = 1 ms
|
||||
// UDP rate in scheduler: (payload + RLC header + PDCP header + IP header + UDP header) * 1000 byte/sec -> 132000 byte/rate
|
||||
// Maximum throughput = 3 / ( 1/2196000 + 1/1191000 + 1/1383000) = 1486569 byte/s
|
||||
// 132000 * 3 = 396000 < 1209046 -> estimated throughput in downlink = 132000 byte/sec
|
||||
std::vector<uint16_t> dist_1;
|
||||
|
||||
dist_1.push_back (0); // User 0 distance --> MCS 28
|
||||
dist_1.push_back (0); // User 1 distance --> MCS 22
|
||||
dist_1.push_back (0); // User 2 distance --> MCS 20
|
||||
|
||||
std::vector<uint16_t> packetSize_1;
|
||||
|
||||
packetSize_1.push_back (100); //1
|
||||
packetSize_1.push_back (100); //2
|
||||
packetSize_1.push_back (100); //3
|
||||
|
||||
std::vector<uint32_t> estThrPssDl_1;
|
||||
|
||||
estThrPssDl_1.push_back (132000); // User 0 estimated TTI throughput from PSS
|
||||
estThrPssDl_1.push_back (132000); // User 1 estimated TTI throughput from PSS
|
||||
estThrPssDl_1.push_back (132000); // User 2 estimated TTI throughput from PSS
|
||||
|
||||
AddTestCase (new LenaDeactivateBearerTestCase (dist_1,estThrPssDl_1,packetSize_1,1,errorModel,true), TestCase::QUICK);
|
||||
}
|
||||
|
||||
static LenaTestBearerDeactivateSuite lenaTestBearerDeactivateSuite;
|
||||
|
||||
|
||||
std::string
|
||||
LenaDeactivateBearerTestCase::BuildNameString (uint16_t nUser, std::vector<uint16_t> dist)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << "distances (m) = [ ";
|
||||
for (std::vector<uint16_t>::iterator it = dist.begin (); it != dist.end (); ++it)
|
||||
{
|
||||
oss << *it << " ";
|
||||
}
|
||||
oss << "]";
|
||||
return oss.str ();
|
||||
}
|
||||
|
||||
LenaDeactivateBearerTestCase::LenaDeactivateBearerTestCase (std::vector<uint16_t> dist, std::vector<uint32_t> estThrPssDl, std::vector<uint16_t> packetSize, uint16_t interval,bool errorModelEnabled, bool useIdealRrc)
|
||||
: TestCase (BuildNameString (dist.size (), dist)),
|
||||
m_nUser (dist.size ()),
|
||||
m_dist (dist),
|
||||
m_packetSize (packetSize),
|
||||
m_interval (interval),
|
||||
m_estThrPssDl (estThrPssDl),
|
||||
m_errorModelEnabled (errorModelEnabled)
|
||||
{
|
||||
}
|
||||
|
||||
LenaDeactivateBearerTestCase::~LenaDeactivateBearerTestCase ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
LenaDeactivateBearerTestCase::DoRun (void)
|
||||
{
|
||||
if (!m_errorModelEnabled)
|
||||
{
|
||||
Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
|
||||
Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false));
|
||||
}
|
||||
|
||||
Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (true));
|
||||
|
||||
|
||||
Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
|
||||
Ptr<PointToPointEpcHelper> epcHelper = CreateObject<PointToPointEpcHelper> ();
|
||||
lteHelper->SetEpcHelper (epcHelper);
|
||||
|
||||
Ptr<Node> pgw = epcHelper->GetPgwNode ();
|
||||
|
||||
// Create a single RemoteHost
|
||||
NodeContainer remoteHostContainer;
|
||||
remoteHostContainer.Create (1);
|
||||
Ptr<Node> remoteHost = remoteHostContainer.Get (0);
|
||||
InternetStackHelper internet;
|
||||
internet.Install (remoteHostContainer);
|
||||
|
||||
// Create the Internet
|
||||
PointToPointHelper p2ph;
|
||||
p2ph.SetDeviceAttribute ("DataRate", DataRateValue (DataRate ("100Gb/s")));
|
||||
p2ph.SetDeviceAttribute ("Mtu", UintegerValue (1500));
|
||||
p2ph.SetChannelAttribute ("Delay", TimeValue (Seconds (0.001)));
|
||||
NetDeviceContainer internetDevices = p2ph.Install (pgw, remoteHost);
|
||||
Ipv4AddressHelper ipv4h;
|
||||
ipv4h.SetBase ("1.0.0.0", "255.0.0.0");
|
||||
Ipv4InterfaceContainer internetIpIfaces = ipv4h.Assign (internetDevices);
|
||||
// interface 0 is localhost, 1 is the p2p device
|
||||
Ipv4Address remoteHostAddr = internetIpIfaces.GetAddress (1);
|
||||
|
||||
Ipv4StaticRoutingHelper ipv4RoutingHelper;
|
||||
Ptr<Ipv4StaticRouting> remoteHostStaticRouting = ipv4RoutingHelper.GetStaticRouting (remoteHost->GetObject<Ipv4> ());
|
||||
remoteHostStaticRouting->AddNetworkRouteTo (Ipv4Address ("7.0.0.0"), Ipv4Mask ("255.0.0.0"), 1);
|
||||
|
||||
// LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_ALL);
|
||||
|
||||
// LogComponentEnable ("LenaTestDeactivateBearer", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("LteHelper", logLevel);
|
||||
// LogComponentEnable ("EpcHelper", logLevel);
|
||||
// LogComponentEnable ("EpcEnbApplication", logLevel);
|
||||
// LogComponentEnable ("EpcSgwPgwApplication", logLevel);
|
||||
// LogComponentEnable ("EpcMme", logLevel);
|
||||
// LogComponentEnable ("LteEnbRrc", logLevel);
|
||||
|
||||
lteHelper->SetAttribute ("PathlossModel", StringValue ("ns3::FriisSpectrumPropagationLossModel"));
|
||||
|
||||
// Create Nodes: eNodeB and UE
|
||||
NodeContainer enbNodes;
|
||||
NodeContainer ueNodes;
|
||||
enbNodes.Create (1);
|
||||
ueNodes.Create (m_nUser);
|
||||
|
||||
// Install Mobility Model
|
||||
MobilityHelper mobility;
|
||||
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
|
||||
mobility.Install (enbNodes);
|
||||
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
|
||||
mobility.Install (ueNodes);
|
||||
|
||||
// Create Devices and install them in the Nodes (eNB and UE)
|
||||
NetDeviceContainer enbDevs;
|
||||
NetDeviceContainer ueDevs;
|
||||
lteHelper->SetSchedulerType ("ns3::PssFfMacScheduler");
|
||||
enbDevs = lteHelper->InstallEnbDevice (enbNodes);
|
||||
ueDevs = lteHelper->InstallUeDevice (ueNodes);
|
||||
|
||||
Ptr<LteEnbNetDevice> lteEnbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
|
||||
Ptr<LteEnbPhy> enbPhy = lteEnbDev->GetPhy ();
|
||||
enbPhy->SetAttribute ("TxPower", DoubleValue (30.0));
|
||||
enbPhy->SetAttribute ("NoiseFigure", DoubleValue (5.0));
|
||||
|
||||
// Set UEs' position and power
|
||||
for (int i = 0; i < m_nUser; i++)
|
||||
{
|
||||
Ptr<ConstantPositionMobilityModel> mm = ueNodes.Get (i)->GetObject<ConstantPositionMobilityModel> ();
|
||||
mm->SetPosition (Vector (m_dist.at (i), 0.0, 0.0));
|
||||
Ptr<LteUeNetDevice> lteUeDev = ueDevs.Get (i)->GetObject<LteUeNetDevice> ();
|
||||
Ptr<LteUePhy> uePhy = lteUeDev->GetPhy ();
|
||||
uePhy->SetAttribute ("TxPower", DoubleValue (23.0));
|
||||
uePhy->SetAttribute ("NoiseFigure", DoubleValue (9.0));
|
||||
}
|
||||
|
||||
// Install the IP stack on the UEs
|
||||
internet.Install (ueNodes);
|
||||
Ipv4InterfaceContainer ueIpIface;
|
||||
ueIpIface = epcHelper->AssignUeIpv4Address (NetDeviceContainer (ueDevs));
|
||||
|
||||
// Assign IP address to UEs
|
||||
for (uint32_t u = 0; u < ueNodes.GetN (); ++u)
|
||||
{
|
||||
Ptr<Node> ueNode = ueNodes.Get (u);
|
||||
// Set the default gateway for the UE
|
||||
Ptr<Ipv4StaticRouting> ueStaticRouting = ipv4RoutingHelper.GetStaticRouting (ueNode->GetObject<Ipv4> ());
|
||||
ueStaticRouting->SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (), 1);
|
||||
}
|
||||
|
||||
// Attach a UE to a eNB
|
||||
lteHelper->Attach (ueDevs, enbDevs.Get (0));
|
||||
|
||||
// Activate an EPS bearer on all UEs
|
||||
|
||||
for (uint32_t u = 0; u < ueNodes.GetN (); ++u)
|
||||
{
|
||||
Ptr<NetDevice> ueDevice = ueDevs.Get (u);
|
||||
GbrQosInformation qos;
|
||||
qos.gbrDl = (m_packetSize.at (u) + 32) * (1000 / m_interval) * 8; // bit/s, considering IP, UDP, RLC, PDCP header size
|
||||
qos.gbrUl = (m_packetSize.at (u) + 32) * (1000 / m_interval) * 8;
|
||||
qos.mbrDl = qos.gbrDl;
|
||||
qos.mbrUl = qos.gbrUl;
|
||||
|
||||
enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
|
||||
EpsBearer bearer (q, qos);
|
||||
bearer.arp.priorityLevel = 15 - (u + 1);
|
||||
bearer.arp.preemptionCapability = true;
|
||||
bearer.arp.preemptionVulnerability = true;
|
||||
lteHelper->ActivateDedicatedEpsBearer (ueDevice, bearer, EpcTft::Default ());
|
||||
}
|
||||
|
||||
|
||||
// Install downlink and uplink applications
|
||||
uint16_t dlPort = 1234;
|
||||
uint16_t ulPort = 2000;
|
||||
PacketSinkHelper dlPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), dlPort));
|
||||
PacketSinkHelper ulPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), ulPort));
|
||||
ApplicationContainer clientApps;
|
||||
ApplicationContainer serverApps;
|
||||
for (uint32_t u = 0; u < ueNodes.GetN (); ++u)
|
||||
{
|
||||
++ulPort;
|
||||
serverApps.Add (dlPacketSinkHelper.Install (ueNodes.Get (u))); // receive packets from remotehost
|
||||
serverApps.Add (ulPacketSinkHelper.Install (remoteHost)); // receive packets from UEs
|
||||
|
||||
UdpClientHelper dlClient (ueIpIface.GetAddress (u), dlPort); // uplink packets generator
|
||||
dlClient.SetAttribute ("Interval", TimeValue (MilliSeconds (m_interval)));
|
||||
dlClient.SetAttribute ("MaxPackets", UintegerValue (1000000));
|
||||
dlClient.SetAttribute ("PacketSize", UintegerValue (m_packetSize.at (u)));
|
||||
|
||||
UdpClientHelper ulClient (remoteHostAddr, ulPort); // downlink packets generator
|
||||
ulClient.SetAttribute ("Interval", TimeValue (MilliSeconds (m_interval)));
|
||||
ulClient.SetAttribute ("MaxPackets", UintegerValue (1000000));
|
||||
ulClient.SetAttribute ("PacketSize", UintegerValue (m_packetSize.at (u)));
|
||||
|
||||
clientApps.Add (dlClient.Install (remoteHost));
|
||||
clientApps.Add (ulClient.Install (ueNodes.Get (u)));
|
||||
}
|
||||
|
||||
|
||||
serverApps.Start (Seconds (0.030));
|
||||
clientApps.Start (Seconds (0.030));
|
||||
|
||||
double statsStartTime = 0.04; // need to allow for RRC connection establishment + SRS
|
||||
double statsDuration = 1.0;
|
||||
double tolerance = 0.1;
|
||||
|
||||
lteHelper->EnableRlcTraces ();
|
||||
Ptr<RadioBearerStatsCalculator> rlcStats = lteHelper->GetRlcStats ();
|
||||
rlcStats->SetAttribute ("StartTime", TimeValue (Seconds (statsStartTime)));
|
||||
rlcStats->SetAttribute ("EpochDuration", TimeValue (Seconds (statsDuration)));
|
||||
|
||||
|
||||
//get ue device pointer for UE-ID 0 IMSI 1 and enb device pointer
|
||||
Ptr<NetDevice> ueDevice = ueDevs.Get (0);
|
||||
Ptr<NetDevice> enbDevice = enbDevs.Get (0);
|
||||
|
||||
/*
|
||||
* Instantiate De-activation using Simulator::Schedule() method which will initiate bearer de-activation after deActivateTime
|
||||
* Instantiate De-activation in sequence (Time const &time, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3)
|
||||
*/
|
||||
Time deActivateTime (Seconds (1.5));
|
||||
Simulator::Schedule (deActivateTime, &LteHelper::DeActivateDedicatedEpsBearer, lteHelper, ueDevice, enbDevice, 2);
|
||||
|
||||
//stop simulation after 3 seconds
|
||||
Simulator::Stop (Seconds (3.0));
|
||||
|
||||
Simulator::Run ();
|
||||
|
||||
NS_LOG_INFO ("DL - Test with " << m_nUser << " user(s)");
|
||||
std::vector <uint64_t> dlDataRxed;
|
||||
std::vector <uint64_t> dlDataTxed;
|
||||
for (int i = 0; i < m_nUser; i++)
|
||||
{
|
||||
// get the imsi
|
||||
uint64_t imsi = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetImsi ();
|
||||
// get the lcId
|
||||
// lcId is hard-coded, since only one dedicated bearer is added
|
||||
uint8_t lcId = 4;
|
||||
dlDataRxed.push_back (rlcStats->GetDlRxData (imsi, lcId));
|
||||
dlDataTxed.push_back (rlcStats->GetDlTxData (imsi, lcId));
|
||||
NS_LOG_INFO ("\tUser " << i << " dist " << m_dist.at (i) << " imsi " << imsi << " bytes rxed " << (double)dlDataRxed.at (i) << " thr " << (double)dlDataRxed.at (i) / statsDuration << " ref " << m_estThrPssDl.at (i));
|
||||
NS_LOG_INFO ("\tUser " << i << " imsi " << imsi << " bytes txed " << (double)dlDataTxed.at (i) << " thr " << (double)dlDataTxed.at (i) / statsDuration);
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_nUser; i++)
|
||||
{
|
||||
uint64_t imsi = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetImsi ();
|
||||
|
||||
/*
|
||||
* For UE ID-0 IMSI 1, LCID=4 is deactivated hence If traffic seen on it, test case should fail
|
||||
* Else For other UE's, test case should validate throughput
|
||||
*/
|
||||
if (imsi == 1)
|
||||
{
|
||||
NS_TEST_ASSERT_MSG_EQ ((double)dlDataTxed.at (i), 0, "Invalid LCID in Statistics ");
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_TEST_ASSERT_MSG_EQ_TOL ((double)dlDataTxed.at (i) / statsDuration, m_estThrPssDl.at (i), m_estThrPssDl.at (i) * tolerance, " Unfair Throughput!");
|
||||
}
|
||||
}
|
||||
|
||||
Simulator::Destroy ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,39 +1,39 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
|
||||
#ifndef LENA_TEST_DEACTIVATE_BEARER_H
|
||||
#define LENA_TEST_DEACTIVATE_BEARER_H
|
||||
|
||||
#include "ns3/simulator.h"
|
||||
#include "ns3/test.h"
|
||||
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class LenaDeactivateBearerTestCase : public TestCase
|
||||
{
|
||||
public:
|
||||
LenaDeactivateBearerTestCase (std::vector<uint16_t> dist, std::vector<uint32_t> estThrPssDl, std::vector<uint16_t> packetSize, uint16_t interval, bool errorModelEnabled, bool useIdealRrc);
|
||||
virtual ~LenaDeactivateBearerTestCase ();
|
||||
|
||||
private:
|
||||
static std::string BuildNameString (uint16_t nUser, std::vector<uint16_t> dist);
|
||||
virtual void DoRun (void);
|
||||
uint16_t m_nUser;
|
||||
std::vector<uint16_t> m_dist;
|
||||
std::vector<uint16_t> m_packetSize; // byte
|
||||
uint16_t m_interval; // ms
|
||||
std::vector<uint32_t> m_estThrPssDl;
|
||||
bool m_errorModelEnabled;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class LenaTestBearerDeactivateSuite : public TestSuite
|
||||
{
|
||||
public:
|
||||
LenaTestBearerDeactivateSuite ();
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
#endif
|
||||
#ifndef LENA_TEST_DEACTIVATE_BEARER_H
|
||||
#define LENA_TEST_DEACTIVATE_BEARER_H
|
||||
|
||||
#include "ns3/simulator.h"
|
||||
#include "ns3/test.h"
|
||||
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class LenaDeactivateBearerTestCase : public TestCase
|
||||
{
|
||||
public:
|
||||
LenaDeactivateBearerTestCase (std::vector<uint16_t> dist, std::vector<uint32_t> estThrPssDl, std::vector<uint16_t> packetSize, uint16_t interval, bool errorModelEnabled, bool useIdealRrc);
|
||||
virtual ~LenaDeactivateBearerTestCase ();
|
||||
|
||||
private:
|
||||
static std::string BuildNameString (uint16_t nUser, std::vector<uint16_t> dist);
|
||||
virtual void DoRun (void);
|
||||
uint16_t m_nUser;
|
||||
std::vector<uint16_t> m_dist;
|
||||
std::vector<uint16_t> m_packetSize; // byte
|
||||
uint16_t m_interval; // ms
|
||||
std::vector<uint32_t> m_estThrPssDl;
|
||||
bool m_errorModelEnabled;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class LenaTestBearerDeactivateSuite : public TestSuite
|
||||
{
|
||||
public:
|
||||
LenaTestBearerDeactivateSuite ();
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,91 +1,91 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Ghada Badawy <gbadawy@gmail.com>
|
||||
*/
|
||||
#ifndef AMPDU_SUBFRAME_HEADER_H
|
||||
#define AMPDU_SUBFRAME_HEADER_H
|
||||
|
||||
#include "ns3/header.h"
|
||||
#include "ns3/mac48-address.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
/**
|
||||
* \ingroup wifi
|
||||
*
|
||||
*
|
||||
*/
|
||||
class AmpduSubframeHeader : public Header
|
||||
{
|
||||
public:
|
||||
AmpduSubframeHeader ();
|
||||
virtual ~AmpduSubframeHeader ();
|
||||
|
||||
static TypeId GetTypeId (void);
|
||||
virtual TypeId GetInstanceTypeId (void) const;
|
||||
virtual void Print (std::ostream &os) const;
|
||||
virtual uint32_t GetSerializedSize (void) const;
|
||||
virtual void Serialize (Buffer::Iterator start) const;
|
||||
virtual uint32_t Deserialize (Buffer::Iterator start);
|
||||
|
||||
/**
|
||||
* Set the CRC field.
|
||||
*
|
||||
* \param crc
|
||||
*/
|
||||
void SetCrc (uint8_t crc);
|
||||
/**
|
||||
* Set the SIG field.
|
||||
*
|
||||
* \param crc
|
||||
*/
|
||||
void SetSig ();
|
||||
/**
|
||||
* Set the length field.
|
||||
*
|
||||
* \param length
|
||||
*/
|
||||
void SetLength (uint16_t length);
|
||||
/**
|
||||
* Return the CRC field.
|
||||
*
|
||||
* \return the CRC field
|
||||
*/
|
||||
uint8_t GetCrc (void) const;
|
||||
/**
|
||||
* Return the SIG field.
|
||||
*
|
||||
* \return the SIG field
|
||||
*/
|
||||
uint8_t GetSig (void) const;
|
||||
/**
|
||||
* Return the length field.
|
||||
*
|
||||
* \return the length field
|
||||
*/
|
||||
uint16_t GetLength (void) const;
|
||||
|
||||
private:
|
||||
uint8_t m_crc; //!< CRC field
|
||||
uint8_t m_sig; //!< SIG field
|
||||
uint16_t m_length; //!< length field
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
#endif /* AMPDU_SUBFRAME_HEADER_H */
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Ghada Badawy <gbadawy@gmail.com>
|
||||
*/
|
||||
#ifndef AMPDU_SUBFRAME_HEADER_H
|
||||
#define AMPDU_SUBFRAME_HEADER_H
|
||||
|
||||
#include "ns3/header.h"
|
||||
#include "ns3/mac48-address.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
/**
|
||||
* \ingroup wifi
|
||||
*
|
||||
*
|
||||
*/
|
||||
class AmpduSubframeHeader : public Header
|
||||
{
|
||||
public:
|
||||
AmpduSubframeHeader ();
|
||||
virtual ~AmpduSubframeHeader ();
|
||||
|
||||
static TypeId GetTypeId (void);
|
||||
virtual TypeId GetInstanceTypeId (void) const;
|
||||
virtual void Print (std::ostream &os) const;
|
||||
virtual uint32_t GetSerializedSize (void) const;
|
||||
virtual void Serialize (Buffer::Iterator start) const;
|
||||
virtual uint32_t Deserialize (Buffer::Iterator start);
|
||||
|
||||
/**
|
||||
* Set the CRC field.
|
||||
*
|
||||
* \param crc
|
||||
*/
|
||||
void SetCrc (uint8_t crc);
|
||||
/**
|
||||
* Set the SIG field.
|
||||
*
|
||||
* \param crc
|
||||
*/
|
||||
void SetSig ();
|
||||
/**
|
||||
* Set the length field.
|
||||
*
|
||||
* \param length
|
||||
*/
|
||||
void SetLength (uint16_t length);
|
||||
/**
|
||||
* Return the CRC field.
|
||||
*
|
||||
* \return the CRC field
|
||||
*/
|
||||
uint8_t GetCrc (void) const;
|
||||
/**
|
||||
* Return the SIG field.
|
||||
*
|
||||
* \return the SIG field
|
||||
*/
|
||||
uint8_t GetSig (void) const;
|
||||
/**
|
||||
* Return the length field.
|
||||
*
|
||||
* \return the length field
|
||||
*/
|
||||
uint16_t GetLength (void) const;
|
||||
|
||||
private:
|
||||
uint8_t m_crc; //!< CRC field
|
||||
uint8_t m_sig; //!< SIG field
|
||||
uint16_t m_length; //!< length field
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
#endif /* AMPDU_SUBFRAME_HEADER_H */
|
||||
|
||||
@@ -1,82 +1,82 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Ghada Badawy <gbadawy@gmail.com>
|
||||
*/
|
||||
#ifndef AMPDU_TAG_H
|
||||
#define AMPDU_TAG_H
|
||||
|
||||
#include "ns3/packet.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class Tag;
|
||||
|
||||
/**
|
||||
* \ingroup wifi
|
||||
*
|
||||
* The aim of the AmpduTag is to provide means for a MAC to specify that a packet includes A-MPDU
|
||||
* since this is done in HT-SIG and there is no HT-SIG representation in ns-3
|
||||
*/
|
||||
class AmpduTag : public Tag
|
||||
{
|
||||
public:
|
||||
static TypeId GetTypeId (void);
|
||||
virtual TypeId GetInstanceTypeId (void) const;
|
||||
|
||||
/**
|
||||
* Create a AmpduTag with the default =0 no Ampdu
|
||||
*/
|
||||
AmpduTag ();
|
||||
/**
|
||||
* Set m_ampdu to 1.
|
||||
*/
|
||||
void SetAmpdu (bool supported);
|
||||
/**
|
||||
* \param noofmpdus the number of MPDUs
|
||||
*
|
||||
* Set the number of MPDUs in the A-MPDU.
|
||||
*/
|
||||
void SetNoOfMpdus (uint8_t noofmpdus);
|
||||
|
||||
virtual void Serialize (TagBuffer i) const;
|
||||
virtual void Deserialize (TagBuffer i);
|
||||
virtual uint32_t GetSerializedSize () const;
|
||||
virtual void Print (std::ostream &os) const;
|
||||
|
||||
/**
|
||||
* \return true if it is an A-MPDU,
|
||||
* false otherwise.
|
||||
*
|
||||
* Returns m_ampdu
|
||||
*/
|
||||
bool GetAmpdu (void) const;
|
||||
/**
|
||||
* \return the number of MPDUs in an A-MPDU
|
||||
*
|
||||
* Returns the number of MPDUs in an A-MPDU
|
||||
*/
|
||||
uint8_t GetNoOfMpdus (void) const;
|
||||
|
||||
private:
|
||||
uint8_t m_ampdu; //!< Flag whether it is an A-MPDU
|
||||
uint8_t m_noOfMpdus; //!< number of MPDUs in the A-MPDU
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
#endif /* AMPDU_TAG_H */
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Ghada Badawy <gbadawy@gmail.com>
|
||||
*/
|
||||
#ifndef AMPDU_TAG_H
|
||||
#define AMPDU_TAG_H
|
||||
|
||||
#include "ns3/packet.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class Tag;
|
||||
|
||||
/**
|
||||
* \ingroup wifi
|
||||
*
|
||||
* The aim of the AmpduTag is to provide means for a MAC to specify that a packet includes A-MPDU
|
||||
* since this is done in HT-SIG and there is no HT-SIG representation in ns-3
|
||||
*/
|
||||
class AmpduTag : public Tag
|
||||
{
|
||||
public:
|
||||
static TypeId GetTypeId (void);
|
||||
virtual TypeId GetInstanceTypeId (void) const;
|
||||
|
||||
/**
|
||||
* Create a AmpduTag with the default =0 no Ampdu
|
||||
*/
|
||||
AmpduTag ();
|
||||
/**
|
||||
* Set m_ampdu to 1.
|
||||
*/
|
||||
void SetAmpdu (bool supported);
|
||||
/**
|
||||
* \param noofmpdus the number of MPDUs
|
||||
*
|
||||
* Set the number of MPDUs in the A-MPDU.
|
||||
*/
|
||||
void SetNoOfMpdus (uint8_t noofmpdus);
|
||||
|
||||
virtual void Serialize (TagBuffer i) const;
|
||||
virtual void Deserialize (TagBuffer i);
|
||||
virtual uint32_t GetSerializedSize () const;
|
||||
virtual void Print (std::ostream &os) const;
|
||||
|
||||
/**
|
||||
* \return true if it is an A-MPDU,
|
||||
* false otherwise.
|
||||
*
|
||||
* Returns m_ampdu
|
||||
*/
|
||||
bool GetAmpdu (void) const;
|
||||
/**
|
||||
* \return the number of MPDUs in an A-MPDU
|
||||
*
|
||||
* Returns the number of MPDUs in an A-MPDU
|
||||
*/
|
||||
uint8_t GetNoOfMpdus (void) const;
|
||||
|
||||
private:
|
||||
uint8_t m_ampdu; //!< Flag whether it is an A-MPDU
|
||||
uint8_t m_noOfMpdus; //!< number of MPDUs in the A-MPDU
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
#endif /* AMPDU_TAG_H */
|
||||
|
||||
@@ -1,91 +1,91 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Ghada Badawy <gbadawy@gmail.com>
|
||||
*/
|
||||
#ifndef MPDU_AGGREGATOR_H
|
||||
#define MPDU_AGGREGATOR_H
|
||||
|
||||
#include "ns3/ptr.h"
|
||||
#include "ns3/packet.h"
|
||||
#include "ns3/object.h"
|
||||
|
||||
#include "ampdu-subframe-header.h"
|
||||
|
||||
#include <list>
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class WifiMacHeader;
|
||||
|
||||
/**
|
||||
* \brief Abstract class that concrete mpdu aggregators have to implement
|
||||
* \ingroup wifi
|
||||
*/
|
||||
class MpduAggregator : public Object
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* A list of deaggregated packets and their A-MPDU subframe headers.
|
||||
*/
|
||||
typedef std::list<std::pair<Ptr<Packet>, AmpduSubframeHeader> > DeaggregatedMpdus;
|
||||
/**
|
||||
* A constant iterator for a list of deaggregated packets and their A-MPDU subframe headers.
|
||||
*/
|
||||
typedef std::list<std::pair<Ptr<Packet>, AmpduSubframeHeader> >::const_iterator DeaggregatedMpdusCI;
|
||||
|
||||
static TypeId GetTypeId (void);
|
||||
/**
|
||||
* \param packet Packet we have to insert into <i>aggregatedPacket</i>.
|
||||
* \param aggregatedPacket Packet that will contain <i>packet</i>, if aggregation is possible.
|
||||
* \return true if <i>packet</i> can be aggregated to <i>aggregatedPacket</i>, false otherwise.
|
||||
*
|
||||
* Adds <i>packet</i> to <i>aggregatedPacket</i>. In concrete aggregator's implementation is
|
||||
* specified how and if <i>packet</i> can be added to <i>aggregatedPacket</i>.
|
||||
*/
|
||||
virtual bool Aggregate (Ptr<const Packet> packet, Ptr<Packet> aggregatedPacket) = 0;
|
||||
/**
|
||||
* Adds A-MPDU subframe header and padding to each MPDU that is part of an A-MPDU before it is sent.
|
||||
*/
|
||||
virtual void AddHeaderAndPad (Ptr<Packet> packet,bool last) = 0;
|
||||
/**
|
||||
* \param packetSize size of the packet we want to insert into <i>aggregatedPacket</i>.
|
||||
* \param aggregatedPacket packet that will contain the packet of size <i>packetSize</i>, if aggregation is possible.
|
||||
* \param blockAckSize size of the piggybacked block ack request
|
||||
* \return true if the packet of size <i>packetSize</i> can be aggregated to <i>aggregatedPacket</i>, false otherwise.
|
||||
*
|
||||
* This method is used to determine if a packet could be aggregated to an A-MPDU without exceeding the maximum packet size.
|
||||
*/
|
||||
virtual bool CanBeAggregated (uint32_t packetSize, Ptr<Packet> aggregatedPacket, uint8_t blockAckSize) = 0;
|
||||
/**
|
||||
* \return padding that must be added to the end of an aggregated packet
|
||||
*
|
||||
* Calculates how much padding must be added to the end of an aggregated packet, after that a new packet is added.
|
||||
* Each A-MPDU subframe is padded so that its length is multiple of 4 octets.
|
||||
*/
|
||||
virtual uint32_t CalculatePadding (Ptr<const Packet> packet) = 0;
|
||||
/**
|
||||
* Deaggregates an A-MPDU by removing the A-MPDU subframe header and padding.
|
||||
*
|
||||
* \return list of deaggragted packets and their A-MPDU subframe headers
|
||||
*/
|
||||
static DeaggregatedMpdus Deaggregate (Ptr<Packet> aggregatedPacket);
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
#endif /* MPDU_AGGREGATOR_H */
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Ghada Badawy <gbadawy@gmail.com>
|
||||
*/
|
||||
#ifndef MPDU_AGGREGATOR_H
|
||||
#define MPDU_AGGREGATOR_H
|
||||
|
||||
#include "ns3/ptr.h"
|
||||
#include "ns3/packet.h"
|
||||
#include "ns3/object.h"
|
||||
|
||||
#include "ampdu-subframe-header.h"
|
||||
|
||||
#include <list>
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class WifiMacHeader;
|
||||
|
||||
/**
|
||||
* \brief Abstract class that concrete mpdu aggregators have to implement
|
||||
* \ingroup wifi
|
||||
*/
|
||||
class MpduAggregator : public Object
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* A list of deaggregated packets and their A-MPDU subframe headers.
|
||||
*/
|
||||
typedef std::list<std::pair<Ptr<Packet>, AmpduSubframeHeader> > DeaggregatedMpdus;
|
||||
/**
|
||||
* A constant iterator for a list of deaggregated packets and their A-MPDU subframe headers.
|
||||
*/
|
||||
typedef std::list<std::pair<Ptr<Packet>, AmpduSubframeHeader> >::const_iterator DeaggregatedMpdusCI;
|
||||
|
||||
static TypeId GetTypeId (void);
|
||||
/**
|
||||
* \param packet Packet we have to insert into <i>aggregatedPacket</i>.
|
||||
* \param aggregatedPacket Packet that will contain <i>packet</i>, if aggregation is possible.
|
||||
* \return true if <i>packet</i> can be aggregated to <i>aggregatedPacket</i>, false otherwise.
|
||||
*
|
||||
* Adds <i>packet</i> to <i>aggregatedPacket</i>. In concrete aggregator's implementation is
|
||||
* specified how and if <i>packet</i> can be added to <i>aggregatedPacket</i>.
|
||||
*/
|
||||
virtual bool Aggregate (Ptr<const Packet> packet, Ptr<Packet> aggregatedPacket) = 0;
|
||||
/**
|
||||
* Adds A-MPDU subframe header and padding to each MPDU that is part of an A-MPDU before it is sent.
|
||||
*/
|
||||
virtual void AddHeaderAndPad (Ptr<Packet> packet,bool last) = 0;
|
||||
/**
|
||||
* \param packetSize size of the packet we want to insert into <i>aggregatedPacket</i>.
|
||||
* \param aggregatedPacket packet that will contain the packet of size <i>packetSize</i>, if aggregation is possible.
|
||||
* \param blockAckSize size of the piggybacked block ack request
|
||||
* \return true if the packet of size <i>packetSize</i> can be aggregated to <i>aggregatedPacket</i>, false otherwise.
|
||||
*
|
||||
* This method is used to determine if a packet could be aggregated to an A-MPDU without exceeding the maximum packet size.
|
||||
*/
|
||||
virtual bool CanBeAggregated (uint32_t packetSize, Ptr<Packet> aggregatedPacket, uint8_t blockAckSize) = 0;
|
||||
/**
|
||||
* \return padding that must be added to the end of an aggregated packet
|
||||
*
|
||||
* Calculates how much padding must be added to the end of an aggregated packet, after that a new packet is added.
|
||||
* Each A-MPDU subframe is padded so that its length is multiple of 4 octets.
|
||||
*/
|
||||
virtual uint32_t CalculatePadding (Ptr<const Packet> packet) = 0;
|
||||
/**
|
||||
* Deaggregates an A-MPDU by removing the A-MPDU subframe header and padding.
|
||||
*
|
||||
* \return list of deaggragted packets and their A-MPDU subframe headers
|
||||
*/
|
||||
static DeaggregatedMpdus Deaggregate (Ptr<Packet> aggregatedPacket);
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
#endif /* MPDU_AGGREGATOR_H */
|
||||
|
||||
@@ -1,74 +1,74 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Ghada Badawy <gbadawy@gmail.com>
|
||||
*/
|
||||
#ifndef MPDU_STANDARD_AGGREGATOR_H
|
||||
#define MPDU_STANDARD_AGGREGATOR_H
|
||||
|
||||
#include "mpdu-aggregator.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
/**
|
||||
* \ingroup wifi
|
||||
* Standard MPDU aggregator
|
||||
*
|
||||
*/
|
||||
class MpduStandardAggregator : public MpduAggregator
|
||||
{
|
||||
public:
|
||||
static TypeId GetTypeId (void);
|
||||
MpduStandardAggregator ();
|
||||
~MpduStandardAggregator ();
|
||||
/**
|
||||
* \param packet packet we have to insert into <i>aggregatedPacket</i>.
|
||||
* \param aggregatedPacket packet that will contain <i>packet</i>, if aggregation is possible.
|
||||
* \return true if <i>packet</i> can be aggregated to <i>aggregatedPacket</i>, false otherwise.
|
||||
*
|
||||
* This method performs an MPDU aggregation.
|
||||
* Returns true if <i>packet</i> can be aggregated to <i>aggregatedPacket</i>, false otherwise.
|
||||
*/
|
||||
virtual bool Aggregate (Ptr<const Packet> packet, Ptr<Packet> aggregatedPacket);
|
||||
/**
|
||||
* Adds A-MPDU subframe header and padding to each MPDU that is part of an A-MPDU before it is sent.
|
||||
*/
|
||||
virtual void AddHeaderAndPad (Ptr<Packet> packet, bool last);
|
||||
/**
|
||||
* \param packetSize size of the packet we want to insert into <i>aggregatedPacket</i>.
|
||||
* \param aggregatedPacket packet that will contain the packet of size <i>packetSize</i>, if aggregation is possible.
|
||||
* \param blockAckSize size of the piggybacked block ack request
|
||||
* \return true if the packet of size <i>packetSize</i> can be aggregated to <i>aggregatedPacket</i>, false otherwise.
|
||||
*
|
||||
* This method is used to determine if a packet could be aggregated to an A-MPDU without exceeding the maximum packet size.
|
||||
*/
|
||||
virtual bool CanBeAggregated (uint32_t packetSize, Ptr<Packet> aggregatedPacket, uint8_t blockAckSize);
|
||||
/**
|
||||
* \return padding that must be added to the end of an aggregated packet
|
||||
*
|
||||
* Calculates how much padding must be added to the end of an aggregated packet, after that a new packet is added.
|
||||
* Each A-MPDU subframe is padded so that its length is multiple of 4 octets.
|
||||
*/
|
||||
virtual uint32_t CalculatePadding (Ptr<const Packet> packet);
|
||||
|
||||
private:
|
||||
uint32_t m_maxAmpduLength; //!< Maximum length in bytes of A-MPDUs
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
#endif /* MPDU_STANDARD_AGGREGATOR_H */
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Ghada Badawy <gbadawy@gmail.com>
|
||||
*/
|
||||
#ifndef MPDU_STANDARD_AGGREGATOR_H
|
||||
#define MPDU_STANDARD_AGGREGATOR_H
|
||||
|
||||
#include "mpdu-aggregator.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
/**
|
||||
* \ingroup wifi
|
||||
* Standard MPDU aggregator
|
||||
*
|
||||
*/
|
||||
class MpduStandardAggregator : public MpduAggregator
|
||||
{
|
||||
public:
|
||||
static TypeId GetTypeId (void);
|
||||
MpduStandardAggregator ();
|
||||
~MpduStandardAggregator ();
|
||||
/**
|
||||
* \param packet packet we have to insert into <i>aggregatedPacket</i>.
|
||||
* \param aggregatedPacket packet that will contain <i>packet</i>, if aggregation is possible.
|
||||
* \return true if <i>packet</i> can be aggregated to <i>aggregatedPacket</i>, false otherwise.
|
||||
*
|
||||
* This method performs an MPDU aggregation.
|
||||
* Returns true if <i>packet</i> can be aggregated to <i>aggregatedPacket</i>, false otherwise.
|
||||
*/
|
||||
virtual bool Aggregate (Ptr<const Packet> packet, Ptr<Packet> aggregatedPacket);
|
||||
/**
|
||||
* Adds A-MPDU subframe header and padding to each MPDU that is part of an A-MPDU before it is sent.
|
||||
*/
|
||||
virtual void AddHeaderAndPad (Ptr<Packet> packet, bool last);
|
||||
/**
|
||||
* \param packetSize size of the packet we want to insert into <i>aggregatedPacket</i>.
|
||||
* \param aggregatedPacket packet that will contain the packet of size <i>packetSize</i>, if aggregation is possible.
|
||||
* \param blockAckSize size of the piggybacked block ack request
|
||||
* \return true if the packet of size <i>packetSize</i> can be aggregated to <i>aggregatedPacket</i>, false otherwise.
|
||||
*
|
||||
* This method is used to determine if a packet could be aggregated to an A-MPDU without exceeding the maximum packet size.
|
||||
*/
|
||||
virtual bool CanBeAggregated (uint32_t packetSize, Ptr<Packet> aggregatedPacket, uint8_t blockAckSize);
|
||||
/**
|
||||
* \return padding that must be added to the end of an aggregated packet
|
||||
*
|
||||
* Calculates how much padding must be added to the end of an aggregated packet, after that a new packet is added.
|
||||
* Each A-MPDU subframe is padded so that its length is multiple of 4 octets.
|
||||
*/
|
||||
virtual uint32_t CalculatePadding (Ptr<const Packet> packet);
|
||||
|
||||
private:
|
||||
uint32_t m_maxAmpduLength; //!< Maximum length in bytes of A-MPDUs
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
#endif /* MPDU_STANDARD_AGGREGATOR_H */
|
||||
|
||||
Reference in New Issue
Block a user