This class represents the knowledge about the state of the network that is available at the network server. More...
#include "network-status.h"
Public Member Functions | |
NetworkStatus () | |
Default constructor. | |
~NetworkStatus () override | |
Destructor. | |
void | AddGateway (Address &address, Ptr< GatewayStatus > gwStatus) |
Add a new gateway to the list of gateways connected to the network. | |
void | AddNode (Ptr< ClassAEndDeviceLorawanMac > edMac) |
Add a device to the ones that are tracked by this NetworkStatus object. | |
int | CountEndDevices () |
Return the number of end devices currently managed by the server. | |
Address | GetBestGatewayForDevice (LoraDeviceAddress deviceAddress, int window) |
Return whether we have a gateway that is available to send a reply to the specified device. | |
Ptr< EndDeviceStatus > | GetEndDeviceStatus (LoraDeviceAddress address) |
Get the EndDeviceStatus corresponding to a LoraDeviceAddress. | |
Ptr< EndDeviceStatus > | GetEndDeviceStatus (Ptr< const Packet > packet) |
Get the EndDeviceStatus of the device that sent a packet. | |
Ptr< Packet > | GetReplyForDevice (LoraDeviceAddress edAddress, int windowNumber) |
Get the reply packet prepared for a reception window of a device. | |
bool | NeedsReply (LoraDeviceAddress deviceAddress) |
Return whether the specified device needs a reply. | |
void | OnReceivedPacket (Ptr< const Packet > packet, const Address &gwaddress) |
Update network status on a received packet. | |
void | SendThroughGateway (Ptr< Packet > packet, Address gwAddress) |
Send a packet through a gateway. | |
Public Member Functions inherited from ns3::Object | |
Object () | |
Constructor. | |
~Object () override | |
Destructor. | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. | |
void | Dispose () |
Dispose of this Object. | |
AggregateIterator | GetAggregateIterator () const |
Get an iterator to the Objects aggregated to this one. | |
TypeId | GetInstanceTypeId () const override |
Get the most derived TypeId for this Object. | |
template<typename T > | |
Ptr< T > | GetObject () const |
Get a pointer to the requested aggregated Object. | |
template<> | |
Ptr< Object > | GetObject () const |
Specialization of () for objects of type ns3::Object. | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. | |
template<> | |
Ptr< Object > | GetObject (TypeId tid) const |
Specialization of (TypeId tid) for objects of type ns3::Object. | |
void | Initialize () |
Invoke DoInitialize on all Objects aggregated to this one. | |
bool | IsInitialized () const |
Check if the object has been initialized. | |
void | UnidirectionalAggregateObject (Ptr< Object > other) |
Aggregate an Object to another Object. | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Default constructor. | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment operator. | |
void | Ref () const |
Increment the reference count. | |
void | Unref () const |
Decrement the reference count. | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. | |
void | GetAttribute (std::string name, AttributeValue &value, bool permissive=false) const |
Get the value of an attribute, raising fatal errors if unsuccessful. | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising errors. | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Register this type. | |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId () |
Register this type. | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId () |
Get the type ID. | |
Public Attributes | |
std::map< LoraDeviceAddress, Ptr< EndDeviceStatus > > | m_endDeviceStatuses |
Map tracking the state of devices connected to this network server. | |
std::map< Address, Ptr< GatewayStatus > > | m_gatewayStatuses |
Map tracking the state of gateways connected to this network server. | |
Additional Inherited Members | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
Copy an Object. | |
virtual void | DoDispose () |
Destructor implementation. | |
virtual void | DoInitialize () |
Initialize() implementation. | |
virtual void | NotifyNewAggregate () |
Notify all Objects aggregated to this one of a new Object being aggregated. | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. | |
virtual void | NotifyConstructionCompleted () |
Notifier called once the ObjectBase is fully constructed. | |
Related Symbols inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. | |
This class represents the knowledge about the state of the network that is available at the network server.
It is essentially a collection of two maps: one containing DeviceStatus objects, and the other containing GatewayStatus objects.
This class is meant to be queried by NetworkController components, which can decide to take action based on the current status of the network.
Definition at line 37 of file network-status.h.
ns3::lorawan::NetworkStatus::NetworkStatus | ( | ) |
Default constructor.
Definition at line 41 of file network-status.cc.
References NS_LOG_FUNCTION_NOARGS.
|
override |
void ns3::lorawan::NetworkStatus::AddGateway | ( | Address & | address, |
Ptr< GatewayStatus > | gwStatus ) |
Add a new gateway to the list of gateways connected to the network.
Each gateway is identified by its NetDevice Address in the network connecting it to the network server.
address | The gateway's NetDevice Address. |
gwStatus | A pointer to a GatewayStatus object for the gateway. |
Definition at line 72 of file network-status.cc.
References m_gatewayStatuses, NS_LOG_DEBUG, and NS_LOG_FUNCTION.
void ns3::lorawan::NetworkStatus::AddNode | ( | Ptr< ClassAEndDeviceLorawanMac > | edMac | ) |
Add a device to the ones that are tracked by this NetworkStatus object.
edMac | Pointer to the MAC layer object of the device to be tracked. |
Definition at line 52 of file network-status.cc.
References ns3::CreateObject(), ns3::DynamicCast(), m_endDeviceStatuses, NS_LOG_DEBUG, NS_LOG_FUNCTION, and ns3::lorawan::LoraDeviceAddress::Print().
int ns3::lorawan::NetworkStatus::CountEndDevices | ( | ) |
Return the number of end devices currently managed by the server.
Definition at line 232 of file network-status.cc.
References m_endDeviceStatuses, and NS_LOG_FUNCTION.
Address ns3::lorawan::NetworkStatus::GetBestGatewayForDevice | ( | LoraDeviceAddress | deviceAddress, |
int | window ) |
Return whether we have a gateway that is available to send a reply to the specified device.
deviceAddress | The address of the device we are interested in. |
window | The device reception window we are currently targeting (1 or 2). |
Definition at line 116 of file network-status.cc.
References m_endDeviceStatuses, m_gatewayStatuses, and NS_ABORT_MSG.
Ptr< EndDeviceStatus > ns3::lorawan::NetworkStatus::GetEndDeviceStatus | ( | LoraDeviceAddress | address | ) |
Get the EndDeviceStatus corresponding to a LoraDeviceAddress.
address | The LoraDeviceAddress of the end device. |
Definition at line 215 of file network-status.cc.
References m_endDeviceStatuses, NS_LOG_ERROR, and NS_LOG_FUNCTION.
Ptr< EndDeviceStatus > ns3::lorawan::NetworkStatus::GetEndDeviceStatus | ( | Ptr< const Packet > | packet | ) |
Get the EndDeviceStatus of the device that sent a packet.
packet | The packet sent by the end device. |
Definition at line 192 of file network-status.cc.
References ns3::lorawan::LoraFrameHeader::GetAddress(), m_endDeviceStatuses, NS_LOG_ERROR, and NS_LOG_FUNCTION.
Ptr< Packet > ns3::lorawan::NetworkStatus::GetReplyForDevice | ( | LoraDeviceAddress | edAddress, |
int | windowNumber ) |
Get the reply packet prepared for a reception window of a device.
edAddress | The address of the device. |
windowNumber | The reception window number (1 or 2). |
Definition at line 167 of file network-status.cc.
References m_endDeviceStatuses, ns3::lorawan::LoraTag::SetDataRate(), and ns3::lorawan::LoraTag::SetFrequency().
|
static |
Register this type.
Definition at line 32 of file network-status.cc.
References ns3::TypeId::SetParent().
bool ns3::lorawan::NetworkStatus::NeedsReply | ( | LoraDeviceAddress | deviceAddress | ) |
Return whether the specified device needs a reply.
deviceAddress | The address of the device we are interested in. |
Definition at line 109 of file network-status.cc.
References m_endDeviceStatuses.
void ns3::lorawan::NetworkStatus::OnReceivedPacket | ( | Ptr< const Packet > | packet, |
const Address & | gwaddress ) |
Update network status on a received packet.
packet | The received packet. |
gwaddress | Address of the gateway this packet was received from. |
Definition at line 88 of file network-status.cc.
References ns3::lorawan::LoraFrameHeader::GetAddress(), m_endDeviceStatuses, NS_LOG_DEBUG, NS_LOG_FUNCTION, and ns3::lorawan::LoraFrameHeader::SetAsUplink().
Send a packet through a gateway.
This function assumes that the packet is already tagged with a LoraTag that will inform the gateway of the parameters to use for the transmission.
packet | The packet. |
gwAddress | The address of the gateway. |
Definition at line 159 of file network-status.cc.
References m_gatewayStatuses, and NS_LOG_FUNCTION.
std::map<LoraDeviceAddress, Ptr<EndDeviceStatus> > ns3::lorawan::NetworkStatus::m_endDeviceStatuses |
Map tracking the state of devices connected to this network server.
Definition at line 140 of file network-status.h.
Referenced by AddNode(), CountEndDevices(), GetBestGatewayForDevice(), GetEndDeviceStatus(), GetEndDeviceStatus(), GetReplyForDevice(), NeedsReply(), and OnReceivedPacket().
std::map<Address, Ptr<GatewayStatus> > ns3::lorawan::NetworkStatus::m_gatewayStatuses |
Map tracking the state of gateways connected to this network server.
Definition at line 142 of file network-status.h.
Referenced by AddGateway(), GetBestGatewayForDevice(), and SendThroughGateway().