A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::zigbee::ZigbeeGroupTable Class Reference

The Zigbee Group Table Zigbee Specification r22.1.0, Section 2.2.8.3 and 3.6.6.1 The group table is a special table that is accessible by both the Zigbee NWK and APS layers. More...

#include "zigbee-group-table.h"

+ Inheritance diagram for ns3::zigbee::ZigbeeGroupTable:
+ Collaboration diagram for ns3::zigbee::ZigbeeGroupTable:

Public Member Functions

 ZigbeeGroupTable ()
 Constructor for Zigbee group table.
 
 ~ZigbeeGroupTable ()
 Destructor for Zigbee group table.
 
bool AddEntry (uint16_t groupId, uint8_t endPoint)
 Add a group ID and its related endpoint.
 
bool IsGroupMember (uint16_t groupId) const
 Indicates whether the group ID exists in the group table.
 
bool LookUpEndPoints (uint16_t groupId, std::vector< uint8_t > &endPoints) const
 Look up the endpoints associated with a given group ID.
 
bool RemoveEntry (uint16_t groupId, uint8_t endPoint)
 Remove endpoint from a group.
 
bool RemoveMembership (uint8_t endPoint)
 Remove the endPoint from all groups.
 
- Public Member Functions inherited from ns3::SimpleRefCount< ZigbeeGroupTable >
 SimpleRefCount ()
 Default constructor.
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor.
 
uint32_t GetReferenceCount () const
 Get the reference count of the object.
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator.
 
void Ref () const
 Increment the reference count.
 
void Unref () const
 Decrement the reference count.
 

Private Attributes

std::unordered_map< uint16_t, std::bitset< MAX_ENDPOINT_ENTRIES > > m_groupTable
 The group table object.
 

Static Private Attributes

static constexpr int MAX_ENDPOINT_ENTRIES {256}
 The maximum amount of endpoints allowed per group id entry.
 
static constexpr int MAX_GROUP_ID_ENTRIES {256}
 The maximum amount of group ID entries allowed in the table.
 

Detailed Description

The Zigbee Group Table Zigbee Specification r22.1.0, Section 2.2.8.3 and 3.6.6.1 The group table is a special table that is accessible by both the Zigbee NWK and APS layers.

It is used to store group IDs and associated endpoints. The group table is used in GroupCasting operations (A type of multicast in Zigbee). In this implementation, the group table is represented as a map where the key is the group ID and the value is a bitset representing the endpoints associated with that group ID. Each bit in the bitset corresponds to an endpoint, where the index of the bit represents the endpoint number.

Definition at line 35 of file zigbee-group-table.h.

Constructor & Destructor Documentation

◆ ZigbeeGroupTable()

ns3::zigbee::ZigbeeGroupTable::ZigbeeGroupTable ( )
default

Constructor for Zigbee group table.

◆ ~ZigbeeGroupTable()

ns3::zigbee::ZigbeeGroupTable::~ZigbeeGroupTable ( )
default

Destructor for Zigbee group table.

Member Function Documentation

◆ AddEntry()

bool ns3::zigbee::ZigbeeGroupTable::AddEntry ( uint16_t groupId,
uint8_t endPoint )

Add a group ID and its related endpoint.

If the group ID already exists, the endpoint is added to the existing group ID entry.

Parameters
groupIdThe group ID to add.
endPointThe endpoint to associate with the group ID.
Returns
True if the entry was added successfully or the endpoint is already a member of the group, false if the table is full.

Definition at line 26 of file zigbee-group-table.cc.

References m_groupTable, MAX_GROUP_ID_ENTRIES, NS_LOG_FUNCTION, NS_LOG_INFO, and NS_LOG_WARN.

◆ IsGroupMember()

bool ns3::zigbee::ZigbeeGroupTable::IsGroupMember ( uint16_t groupId) const

Indicates whether the group ID exists in the group table.

Parameters
groupIdThe group ID to query.
Returns
True if the group ID exists, false otherwise.

Definition at line 110 of file zigbee-group-table.cc.

References m_groupTable.

◆ LookUpEndPoints()

bool ns3::zigbee::ZigbeeGroupTable::LookUpEndPoints ( uint16_t groupId,
std::vector< uint8_t > & endPoints ) const

Look up the endpoints associated with a given group ID.

Parameters
groupIdThe group ID to look up.
endPointsA vector to store the endpoints associated with the group ID.
Returns
True if the group ID was found and endpoints were retrieved, false otherwise.

Definition at line 116 of file zigbee-group-table.cc.

References m_groupTable, MAX_ENDPOINT_ENTRIES, and NS_LOG_WARN.

◆ RemoveEntry()

bool ns3::zigbee::ZigbeeGroupTable::RemoveEntry ( uint16_t groupId,
uint8_t endPoint )

Remove endpoint from a group.

If the endpoint is the last one associated with the group ID, the group ID entry is removed.

Parameters
groupIdThe group ID of the group to remove the endpoint from.
endPointThe endpoint to remove from the group ID.
Returns
True if the entry was removed successfully, false if the group does not exist, or the endpoint is not a member of the group.

Definition at line 51 of file zigbee-group-table.cc.

References m_groupTable, NS_LOG_FUNCTION, NS_LOG_INFO, and NS_LOG_WARN.

◆ RemoveMembership()

bool ns3::zigbee::ZigbeeGroupTable::RemoveMembership ( uint8_t endPoint)

Remove the endPoint from all groups.

Parameters
endPointThe endpoint to remove from all groups. If the removed endpoint is the last one associated with the group ID, the group ID entry is also removed.
Returns
True if the endpoint was remmoved from at least one group, false if the endpoint was not found in any group.

Definition at line 86 of file zigbee-group-table.cc.

References m_groupTable, NS_LOG_FUNCTION, and NS_LOG_INFO.

Member Data Documentation

◆ m_groupTable

std::unordered_map<uint16_t, std::bitset<MAX_ENDPOINT_ENTRIES> > ns3::zigbee::ZigbeeGroupTable::m_groupTable
private

The group table object.

Definition at line 104 of file zigbee-group-table.h.

Referenced by AddEntry(), IsGroupMember(), LookUpEndPoints(), RemoveEntry(), and RemoveMembership().

◆ MAX_ENDPOINT_ENTRIES

int ns3::zigbee::ZigbeeGroupTable::MAX_ENDPOINT_ENTRIES {256}
staticconstexprprivate

The maximum amount of endpoints allowed per group id entry.

Definition at line 101 of file zigbee-group-table.h.

Referenced by LookUpEndPoints().

◆ MAX_GROUP_ID_ENTRIES

int ns3::zigbee::ZigbeeGroupTable::MAX_GROUP_ID_ENTRIES {256}
staticconstexprprivate

The maximum amount of group ID entries allowed in the table.

Definition at line 99 of file zigbee-group-table.h.

Referenced by AddEntry().


The documentation for this class was generated from the following files: