Obtaining and maintaining node addresses

The addresses of network nodes are needed in order to access node information (see Section 6.2.4), send data from one node to another (see Section 6.5) and bind nodes together (see Section 6.4). In most of these operations, an application can specify either 64-bit IEEE/MAC addresses or 16-bit network addresses, but the ZigBee PRO stack always works with network addresses. If the IEEE address (rather than the network address) of a remote node is specified by the application, the network address must still be available to the stack in an Address Map - see below.

The IEEE address of a node is assigned at the time of device manufacture and is fixed, while its network address is dynamically allocated by its parent when the device joins the network (this address may change if the network is re-started or the device later leaves and rejoins the network). Functions are provided to obtain the IEEE address of a node given its network address or to obtain the network address given the IEEE address. Use of these functions is described in Section 6.2.3.1 and Section 6.2.3.2.

Note: The IEEE/MAC and network addresses of a node can be broadcast to all other nodes in the network using the function zps_eAplZdpDeviceAnnceRequest(). For example, this function would typically be called when the node joins or rejoins the network. The information is sent in a Device_annce announcement, which must be collected by the recipient nodes using the function ZQ_bZQueueReceive().

An Address Map table can be maintained on a node, where each entry of this table contains the pair of addresses for a remote node - the 64-bit IEEE/MAC address and 16-bit network address. In fact, the IEEE/MAC address is not directly stored in the Address Map table but in a MAC Address table - the Address Map table contains the index of this address in the MAC Address table. The Address Map is automatically updated by the stack when a Device_annce announcement is received from a remote node (described in the Note above), but you can also add an address-pair to this table using the function zps_eAplZdoAddAddrMapEntry()- never write to the Address Map table directly. The Address Map must be properly maintained if the application employs IEEE/MAC addresses to identify remote nodes. In addition, when application- level security (see Section 6.8) is used in sending data from one node to another, the Address Map on the sending node must contain an entry for the target node.

Obtaining IEEE address

You may wish to obtain the IEEE address of the node with a given network address - for example, in order to know which physical node corresponds to a particular dynamically allocated network address.

The IEEE address of the local node can be obtained simply by calling the function zps_u64AplZdoGetIeeeAddr()

The IEEE address of a remote node can be obtained in either of two ways, depending on whether an entry for the node exists in the local Address Map table:

  • The function zps_u64AplZdoLookupIeeeAddr() can be used to search the local Address Map table for the IEEE address which corresponds to a given network address.

  • The required IEEE address can be obtained directly from the remote node by using the function zps_eAplZdpIeeeAddrRequest() to submit a request for the IEEE address of the node with a particular network address. This request, of type IEEE_addr_req, is sent in an APDU (Application Protocol Data Unit) which must first be allocated using the PDUM function PDUM_hAPduAllocateAPduInstance(). The request details are specified through the structure zps_tsAplZdpIeeeAddrReq, which includes an option to also request the IEEE addresses of all the target node’s children (if any). The results are reported in an IEEE_addr_resp response.

Parent topic:Obtaining and maintaining node addresses

Obtaining network address

You may wish to obtain the network address of the node with a given IEEE address - for example, in order to know the network address that has been dynamically allocated to a particular physical node.

The network address of the local node can be obtained simply by calling the functionzps_u16AplZdoGetNwkAddr().

The network address of a remote node can be obtained in either of two ways, depending on whether an entry for the node exists in the local Address Map table:

  • zps_u16AplZdoLookupAddr() can be used to search the local Address Map table for the network address which corresponds to a given IEEE address.

  • The required network address can be obtained directly from within the network by using the function zps_eAplZdpNwkAddrRequest() to submit a request for the network address of the node with a particular IEEE address. This request can be either unicast or broadcast, as follows:

    • Unicast to another node that will ‘know’ the required network address (this may be the parent of the node of interest or the Coordinator)

    • Broadcast to the network

This request, of type NWK_addr_req, is sent in an APDU (Application Protocol Data Unit) which must first be allocated using the PDUM function PDUM_hAPduAllocateAPduInstance(). The request details are specified through the structure zps_tsAplZdpNwkAddrReq, which includes an option to also request the network addresses of all the target node’s children (if any). The results are reported in a NWK_addr_resp response.

Parent topic:Obtaining and maintaining node addresses

Parent topic:Discovering the network