summaryrefslogtreecommitdiff
path: root/digital/zigbit/bitcloud/stack/Components/NWK/include/private/nwkIB.h
blob: 3db5b41302678b4e173a4e469a2654cebfebfb81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/**************************************************************************//**
  \file nwkIB.h

  \brief Network information base.

  \author
    Atmel Corporation: http://www.atmel.com \n
    Support email: avr@atmel.com

  Copyright (c) 2008-2011, Atmel Corporation. All rights reserved.
  Licensed under Atmel's Limited License Agreement (BitCloudTM).

  \internal
   History:
    2009-05-01 M. Gekk - Created.
   Last change:
    $Id: nwkIB.h 18296 2011-08-19 12:29:05Z mgekk $
 ******************************************************************************/
#if !defined _NWK_IB_H
#define _NWK_IB_H

/******************************************************************************
                                Includes section
 ******************************************************************************/
#include <nwkConfig.h>
#include <types.h>
#include <configServer.h>
#include <nwkSystem.h>
#include <mac.h>
#include <nwkCommon.h>
#include <nwkSecurity.h>
#include <nwkSystem.h>
#include <nwkFrame.h>
#include <nlmeReset.h>

/******************************************************************************
                                 Types section
 ******************************************************************************/
typedef struct _NIB_t
{
             /*** Attributes are initialized by NWK-layer. ***/
  /** A network address of parent node. */
  ShortAddr_t parentNetworkAddress;
  /** The count of total transmissions. */
  uint16_t transmitCounter;
  /** The count of transmissions with failures. */
  uint16_t transmitFailureCounter;
  /** The address of the designated network channel manager function. */
  ShortAddr_t managerAddr;
  /** This field shall contain the device capability information established at
   * network joining time. */
  MAC_CapabilityInf_t capabilityInformation;
  /** The tree depth of the neighbor device. A value of 0x00 indicates that
   * the device is the ZigBee coordinator for the network. */
  NwkDepth_t depth;
  /** A sequence number used to identify outgoing frames */
  NwkSequenceNumber_t sequenceNumber;
  /** The total delivery time for a broadcast transmission, i.e. the time
   * required for a broadcast to be delivered to every device in the network. */
  uint32_t networkBroadcastDeliveryTime;
  /** The value identifying a snapshot of the network settings with which this
   * node is operating with. */
  NwkUpdateId_t updateId;
  /** Network rejoin permissions, by default end devices and routers can rejoin. */
  NWK_RejoinPermit_t rejoinPermit;

  struct {
    /** This field is used by MAC layer. */
    NwkLength_t header[MAC_MAX_BEACON_HEADER_LENGTH];
    /** The beacon payload contain the information which enables the NWK layer
     * to provide additional information to new devices that are performing
     * network discovery and allows these new devices to more efficiently select
     * a network and a particular neighbor to join. */
    NwkBeaconPayload_t payload;
  } beacon;
            /*** Attributes are initialized in Config Server. ***/
  /** The type of the device:
   *  - 0x00 - zigbee coordinator
   *  - 0x01 - zigbee router
   *  - 0x02 - zigbee end device */
  DeviceType_t deviceType;
  /** A value that determines the method used to assign addresses:
   *  - 0x00 = use distributed address allocation
   *  - 0x01 = reserved
   *  - 0x02 = use stochastic address allocation. */
  NWK_AddrAlloc_t addrAlloc;
  /** The current route symmetry setting. 1 means that routes are considered to
   * be comprised of symmetric links. Backward and forward routes are created
   * during one-route discovery and they are identical. 0 indicates that routes
   * are not consider to be comprised of symmetric links. Only the forward route
   * is stored during route discovery.*/
  bool symLink;
  /** Determines whether or not the static addressing mode will be used.
   * If set to '1' then the device must use a static network address
   * otherwise, the stochastic addressing mode will be employed. */
  bool uniqueAddr;
  /** The identifier of the ZigBee stack profile in use for this device. */
  StackProfile_t stackProfile;
  /** The version of the ZigBee NWK protocol in the device. */
  uint8_t protocolVersion;
  /** The depth a device can have. */
  NwkDepth_t maxDepth;
  /** Route to neighbor directly only if the incoming cost is less than given
   * threshold. */
  NwkLinkCost_t maxNeighborRouteCost;
  /** RF channel page */
  uint8_t channelPage;
  /** Number of RF channel */
  Channel_t logicalChannel;
  /** The 16-bit address that the device uses to communicate with the PAN. */
  ShortAddr_t networkAddress;
  /** The short (16-bit) pan identifier of a zigbee network. */
  PanId_t panId;
  /** The Extended PAN Identifier for the PAN of which the device is a member.
   * The value 0x0000000000000000 means the Extended PAN Identifier is unknown.
   **/
  ExtPanId_t extendedPanId;
  /** The number of routers any one device is allowed to have as children. */
  NwkChildCount_t maxRouters;
  /** The number of end devices any one device is allowed to have as children.
   **/
  NwkChildCount_t maxEndDevices;
#if defined _SECURITY_
  /** Pointer to the security information base. */
  NWK_SecurityIB_t securityIB;
#endif /* _SECURITY_ */
} NIB_t;

/******************************************************************************
                             Definitions section
 ******************************************************************************/

/******************************************************************************
                              Prototypes section
 ******************************************************************************/
/**************************************************************************//**
  \brief Reset the network information base.

  \param[in] powerFailureControl - stack restoring after power failure control bitfield;
                                  affects on initialization procedure.
  \param[in] capabilityInformation - this parameter shall contain the device
    capability information. See ZigBee spec r18, Table 3.47, page 356.

  \return None.
 ******************************************************************************/
NWK_PRIVATE void nwkResetNib(const NWK_PowerFailureControl_t powerFailureControl,
  const MAC_CapabilityInf_t capabilityInformation);

/**************************************************************************//**
  \brief Update beacon payload depending on NIB values
 ******************************************************************************/
NWK_PRIVATE void nwkUpdateBeaconPayload(void);

/**************************************************************************//**
  \brief Set depth in NIB and update cSkips.

  \param[in] depth - new value of depth.
 ******************************************************************************/
NWK_PRIVATE void nwkSetDepth(NwkDepth_t depth);

/**************************************************************************//**
  \brief Reload parameters from the config server.
 ******************************************************************************/
NWK_PRIVATE void nwkReloadNibFromConfigServer(void);

#if defined _ROUTER_ || defined _ENDDEVICE_
/**************************************************************************//**
  \brief Set a network address of parent device.

  \param[in] addr - short address of parent device.
 ******************************************************************************/
NWK_PRIVATE void nwkSetParentShortAddr(ShortAddr_t addr);

#endif /* _ROUTER_ or _ENDDEVICE_ */

#endif  /* _NWK_IB_H */
/**  eof nwkIB.h */