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
#include <vector>
18
19
namespace
ns3
20
{
21
namespace
zigbee
22
{
23
24
/**
25
* @ingroup zigbee
26
* The Zigbee Group Table
27
* Zigbee Specification r22.1.0, Section 2.2.8.3 and 3.6.6.1
28
* The group table is a special table that is accessible by both the
29
* Zigbee NWK and APS layers. It is used to store group IDs and associated endpoints.
30
* The group table is used in GroupCasting operations (A type of multicast in Zigbee).
31
* In this implementation, the group table is represented as a map where the key is the group ID
32
* and the value is a bitset representing the endpoints associated with that group ID.
33
* Each bit in the bitset corresponds to an endpoint, where the index of the bit represents the
34
* endpoint number.
35
*/
36
class
ZigbeeGroupTable
:
public
SimpleRefCount
<ZigbeeGroupTable>
37
{
38
public
:
39
/**
40
* Constructor for Zigbee group table.
41
*/
42
ZigbeeGroupTable
();
43
44
/**
45
* Destructor for Zigbee group table.
46
*/
47
~ZigbeeGroupTable
();
48
49
/**
50
* Add a group ID and its related endpoint. If the group ID already exists,
51
* the endpoint is added to the existing group ID entry.
52
*
53
* @param groupId The group ID to add.
54
* @param endPoint The endpoint to associate with the group ID.
55
* @return True if the entry was added successfully or the endpoint is already a member of the
56
* group, false if the table is full.
57
*/
58
bool
AddEntry
(uint16_t groupId, uint8_t endPoint);
59
60
/**
61
* Remove endpoint from a group. If the endpoint is the last one
62
* associated with the group ID, the group ID entry is removed.
63
*
64
* @param groupId The group ID of the group to remove the endpoint from.
65
* @param endPoint The endpoint to remove from the group ID.
66
* @return True if the entry was removed successfully, false if the group does not exist, or the
67
* endpoint is not a member of the group.
68
*/
69
bool
RemoveEntry
(uint16_t groupId, uint8_t endPoint);
70
71
/**
72
* Remove the endPoint from all groups.
73
*
74
* @param endPoint The endpoint to remove from all groups. If the removed endpoint is the last
75
* one associated with the group ID, the group ID entry is also removed.
76
* @return True if the endpoint was remmoved from at least one group, false if the endpoint was
77
* not found in any group.
78
*
79
*/
80
bool
RemoveMembership
(uint8_t endPoint);
81
82
/**
83
* Indicates whether the group ID exists in the group table.
84
*
85
* @param groupId The group ID to query.
86
* @return True if the group ID exists, false otherwise.
87
*/
88
bool
IsGroupMember
(uint16_t groupId)
const
;
89
90
/**
91
* Look up the endpoints associated with a given group ID.
92
*
93
* @param groupId The group ID to look up.
94
* @param endPoints A vector to store the endpoints associated with the group ID.
95
* @return True if the group ID was found and endpoints were retrieved, false otherwise.
96
*/
97
bool
LookUpEndPoints
(uint16_t groupId, std::vector<uint8_t>& endPoints)
const
;
98
99
private
:
100
static
constexpr
int
MAX_GROUP_ID_ENTRIES
{256};
//!< The maximum amount of group ID
101
//!< entries allowed in the table.
102
static
constexpr
int
MAX_ENDPOINT_ENTRIES
{256};
//!< The maximum amount of endpoints
103
//!< allowed per group id entry.
104
std::unordered_map<uint16_t, std::bitset<MAX_ENDPOINT_ENTRIES>>
105
m_groupTable
;
//!< The group table object
106
};
107
108
}
// namespace zigbee
109
}
// namespace ns3
110
111
#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:37
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:105
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:102
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:100
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 22 2025 18:22:42 for ns-3 by
1.11.0