A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
zigbee-group-table.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2025 Tokushima University, Japan
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author:
7
* Alberto Gallegos Ramonet <alramonet@is.tokushima-u.ac.jp>
8
*/
9
10
#ifndef ZIGBEE_GROUP_TABLE_H
11
#define ZIGBEE_GROUP_TABLE_H
12
13
#include "ns3/simple-ref-count.h"
14
15
#include <bitset>
16
#include <unordered_map>
17
18
namespace
ns3
19
{
20
namespace
zigbee
21
{
22
23
/**
24
* @ingroup zigbee
25
* The Zigbee Group Table
26
* Zigbee Specification r22.1.0, Section 2.2.8.3 and 3.6.6.1
27
* The group table is a special table that is accessible by both the
28
* Zigbee NWK and APS layers. It is used to store group IDs and associated endpoints.
29
* The group table is used in GroupCasting operations (A type of multicast in Zigbee).
30
* In this implementation, the group table is represented as a map where the key is the group ID
31
* and the value is a bitset representing the endpoints associated with that group ID.
32
* Each bit in the bitset corresponds to an endpoint, where the index of the bit represents the
33
* endpoint number.
34
*/
35
class
ZigbeeGroupTable
:
public
SimpleRefCount
<ZigbeeGroupTable>
36
{
37
public
:
38
/**
39
* Constructor for Zigbee group table.
40
*/
41
ZigbeeGroupTable
();
42
43
/**
44
* Destructor for Zigbee group table.
45
*/
46
~ZigbeeGroupTable
();
47
48
/**
49
* Add a group ID and its related endpoint. If the group ID already exists,
50
* the endpoint is added to the existing group ID entry.
51
*
52
* @param groupId The group ID to add.
53
* @param endPoint The endpoint to associate with the group ID.
54
* @return True if the entry was added successfully or the endpoint is already a member of the
55
* group, false if the table is full.
56
*/
57
bool
AddEntry
(uint16_t groupId, uint8_t endPoint);
58
59
/**
60
* Remove endpoint from a group. If the endpoint is the last one
61
* associated with the group ID, the group ID entry is removed.
62
*
63
* @param groupId The group ID of the group to remove the endpoint from.
64
* @param endPoint The endpoint to remove from the group ID.
65
* @return True if the entry was removed successfully, false if the group does not exist, or the
66
* endpoint is not a member of the group.
67
*/
68
bool
RemoveEntry
(uint16_t groupId, uint8_t endPoint);
69
70
/**
71
* Remove the endPoint from all groups.
72
*
73
* @param endPoint The endpoint to remove from all groups. If the removed endpoint is the last
74
* one associated with the group ID, the group ID entry is also removed.
75
* @return True if the endpoint was remmoved from at least one group, false if the endpoint was
76
* not found in any group.
77
*
78
*/
79
bool
RemoveMembership
(uint8_t endPoint);
80
81
/**
82
* Indicates whether the group ID exists in the group table.
83
*
84
* @param groupId The group ID to query.
85
* @return True if the group ID exists, false otherwise.
86
*/
87
bool
IsGroupMember
(uint16_t groupId)
const
;
88
89
/**
90
* Look up the endpoints associated with a given group ID.
91
*
92
* @param groupId The group ID to look up.
93
* @param endPoints A vector to store the endpoints associated with the group ID.
94
* @return True if the group ID was found and endpoints were retrieved, false otherwise.
95
*/
96
bool
LookUpEndPoints
(uint16_t groupId, std::vector<uint8_t>& endPoints)
const
;
97
98
private
:
99
static
constexpr
int
MAX_GROUP_ID_ENTRIES
{256};
//!< The maximum amount of group ID
100
//!< entries allowed in the table.
101
static
constexpr
int
MAX_ENDPOINT_ENTRIES
{256};
//!< The maximum amount of endpoints
102
//!< allowed per group id entry.
103
std::unordered_map<uint16_t, std::bitset<MAX_ENDPOINT_ENTRIES>>
104
m_groupTable
;
//!< The group table object
105
};
106
107
}
// namespace zigbee
108
}
// namespace ns3
109
110
#endif
/* ZIGBEE_GROUP_TABLE_H */
ns3::SimpleRefCount
A template-based reference counting class.
Definition
simple-ref-count.h:70
ns3::zigbee::ZigbeeGroupTable
The Zigbee Group Table Zigbee Specification r22.1.0, Section 2.2.8.3 and 3.6.6.1 The group table is a...
Definition
zigbee-group-table.h:36
ns3::zigbee::ZigbeeGroupTable::RemoveEntry
bool RemoveEntry(uint16_t groupId, uint8_t endPoint)
Remove endpoint from a group.
Definition
zigbee-group-table.cc:51
ns3::zigbee::ZigbeeGroupTable::IsGroupMember
bool IsGroupMember(uint16_t groupId) const
Indicates whether the group ID exists in the group table.
Definition
zigbee-group-table.cc:110
ns3::zigbee::ZigbeeGroupTable::m_groupTable
std::unordered_map< uint16_t, std::bitset< MAX_ENDPOINT_ENTRIES > > m_groupTable
The group table object.
Definition
zigbee-group-table.h:104
ns3::zigbee::ZigbeeGroupTable::MAX_ENDPOINT_ENTRIES
static constexpr int MAX_ENDPOINT_ENTRIES
The maximum amount of endpoints allowed per group id entry.
Definition
zigbee-group-table.h:101
ns3::zigbee::ZigbeeGroupTable::LookUpEndPoints
bool LookUpEndPoints(uint16_t groupId, std::vector< uint8_t > &endPoints) const
Look up the endpoints associated with a given group ID.
Definition
zigbee-group-table.cc:116
ns3::zigbee::ZigbeeGroupTable::ZigbeeGroupTable
ZigbeeGroupTable()
Constructor for Zigbee group table.
ns3::zigbee::ZigbeeGroupTable::RemoveMembership
bool RemoveMembership(uint8_t endPoint)
Remove the endPoint from all groups.
Definition
zigbee-group-table.cc:86
ns3::zigbee::ZigbeeGroupTable::~ZigbeeGroupTable
~ZigbeeGroupTable()
Destructor for Zigbee group table.
ns3::zigbee::ZigbeeGroupTable::MAX_GROUP_ID_ENTRIES
static constexpr int MAX_GROUP_ID_ENTRIES
The maximum amount of group ID entries allowed in the table.
Definition
zigbee-group-table.h:99
ns3::zigbee::ZigbeeGroupTable::AddEntry
bool AddEntry(uint16_t groupId, uint8_t endPoint)
Add a group ID and its related endpoint.
Definition
zigbee-group-table.cc:26
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
zigbee
model
zigbee-group-table.h
Generated on Tue Jul 15 2025 18:41:07 for ns-3 by
1.11.0