13#include "ns3/pointer.h"
14#include "ns3/simulator.h"
157 if ((
first.GetDstAddr16() ==
second.GetDstAddr16()) &&
158 (
first.GetDstEndPoint() ==
second.GetDstEndPoint()))
166 if ((
first.GetDstAddr64() ==
second.GetDstAddr64()) &&
167 (
first.GetDstEndPoint() ==
second.GetDstEndPoint()))
178 return ((
first.GetSrcAddress() ==
second.GetSrcAddress()) &&
179 (
first.GetSrcEndPoint() ==
second.GetSrcEndPoint()) &&
191 for (
const auto& destination : entry.second)
195 NS_LOG_WARN(
"Entry already exist in binding table");
208 entry.second.emplace_back(dst);
222 m_bindingTable.emplace_back(src, std::vector<DstBindingEntry>{dst});
235 auto& destinations = it->second;
236 for (
auto destIt = destinations.begin(); destIt != destinations.end(); ++destIt)
241 destinations.erase(destIt);
244 if (destinations.empty())
253 NS_LOG_WARN(
"Cannot unbind, destination entry do not exist");
258 NS_LOG_WARN(
"Cannot unbind, source entry do not exist");
270 dstEntries = entry.second;
This class can contain 16 bit addresses.
bool CompareSources(const SrcBindingEntry &first, const SrcBindingEntry &second)
Compare the equality of 2 source entries.
uint8_t m_maxSrcEntries
The maximum amount of source entries allowed in the table.
bool LookUpEntries(const SrcBindingEntry &src, std::vector< DstBindingEntry > &dstEntries)
Look for destination entries binded to an specific source entry portion in the binding table.
BindingTableStatus Bind(const SrcBindingEntry &src, const DstBindingEntry &dst)
Add an entry to the binding table.
BindingTableStatus Unbind(const SrcBindingEntry &src, const DstBindingEntry &dst)
Unbinds a destination entry portion of a binding table from a source entry portion.
BindingTable()
The constructor of the binding table.
std::vector< std::pair< SrcBindingEntry, std::vector< DstBindingEntry > > > m_bindingTable
The binding table object.
bool CompareDestinations(const DstBindingEntry &first, const DstBindingEntry &second)
Compare the equality of 2 destination entries.
uint8_t m_maxDstEntries
The maximum amount of destination entries allowed in the table.
Binding Table entry: Destination portion of the table.
Mac64Address m_dstAddr64
The destination IEEE address (64-bit address) in the destination entry.
Mac16Address m_dstAddr16
The destination 16-bit address in the destination entry.
DstBindingEntry()
The default constructor of the destination binding entry.
ApsDstAddressModeBind m_dstAddrMode
The destination address mode used by the entry.
Mac16Address GetDstAddr16() const
Get the 16-bit address destination of the destination entry.
Mac64Address GetDstAddr64() const
Get the 64-bit address destination of the destination entry.
uint8_t GetDstEndPoint() const
Get the destination endpoint of the destination entry.
void SetDstAddr64(Mac64Address address)
Set the destination IEEE Address (64-bit address) of the destination binding entry.
ApsDstAddressModeBind GetDstAddrMode() const
Get the destination address mode used by the destination entry.
uint8_t m_dstEndPoint
The destination endpoint in the destination entry.
void SetDstAddrMode(ApsDstAddressModeBind mode)
Set the destination address mode of the destination binding entry.
void SetDstEndPoint(uint8_t endPoint)
Set the destination endppoint to the destination binding entry.
void SetDstAddr16(Mac16Address address)
Set the destination 16-bit address of the destination binding entry.
Binding Table entry: Source portion of the table.
uint16_t GetClusterId() const
Get the cluster ID from the source binding entry.
uint8_t GetSrcEndPoint() const
Get the source endpoint from the source binding entry.
SrcBindingEntry()
The default constructor of the source binding entry.
void SetSrcEndPoint(uint8_t endPoint)
Set the source endpoint of the source binding entry.
uint8_t m_srcEndPoint
The source endpoint in the source entry.
void SetClusterId(uint16_t clusterId)
Set the cluster ID of the source binding entry.
Mac64Address m_srcAddr
The source IEEE address in the source entry.
void SetSrcAddress(Mac64Address address)
Set the source IEEE address to the entry.
Mac64Address GetSrcAddress() const
Get the IEEE address from the source binding entry.
uint16_t m_clusterId
The cluster ID in the source entry.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
BindingTableStatus
The status resulting of interactions with the binding table.
ApsDstAddressModeBind
APS Destination Address Mode for Binding Zigbee Specification r22.1.0, Table 2-6 APSME-BIND....
@ GROUP_ADDR_DST_ENDPOINT_NOT_PRESENT
@ DST_ADDR64_DST_ENDPOINT_PRESENT
Every class exported by the ns3 library is enclosed in the ns3 namespace.