mac_pib 的结构如下:
typedef struct _MAC_PIB {
UINT32 macAckWaitDuration;//ack 确认包等待的时间
union _MAC_PIB_flags {
UINT32 val;
struct {
unsigned macAssociationPermit:1;//是否允许别关联
unsigned macAutoRequest:1;//是否自动发送请求
unsigned macBattLifeExt:1;
unsigned macGTSPermit:1;//是否允许GTS分配
unsigned macPromiscousMode:1;
unsigned macPanCoordinator:1;
unsigned ackPending:1;//1 表示正在等待ACK
unsigned TxInProgress:1; //正在发送
unsigned GotBeaconResponse:1; //1 表示已经收到beacon
unsigned WaitingForBeaconResponse:1; //1 表示正在等待Beacon 响应
unsigned macPending:1; //mac CMD pending in the RX buffer
unsigned macIsAssociated:1; // 1 表示已经被关联
unsigned WaitingForAssocResponse:1; //1 表示正在等待关联响应
unsigned GotOrphanResponse:1; // 1 表示得到孤立响应
unsigned WaitingForOrphanResponse:1; //1 表示正在等待孤立响应
}bits;
}flags;
LADDR macCoordExtendedAddress; //父设备长地址
SADDR macCoordShortAddress;//父设备短地址
UINT16 macPANID; // 已加入的PAN ID
BYTE macDSN; // 序号
BYTE depth; //depth in the network
BYTE macCapInfo;
BYTE macMaxAckRetries;
struct {
unsigned maxMaxCSMABackoffs:3;
unsigned macMinBE:2;
}misc;
UINT32 tx_start_time; //time that packet was sent
UINT32 last_data_rx_time; //time that last data rx packet was received that was accepted by this node
BYTE bcnDepth;
SADDR bcnSADDR;
UINT16 bcnPANID;
BYTE bcnRSSI;
BYTE currentAckRetries;
BYTE rxTail; //tail pointer of rxBuff
BYTE rxHead; //head pointer of rxBuff
//fifo for RX pkts, holds LRWPAN_MAX_MAC_RX_PKTS
MACPKT rxBuff[MAC_RXBUFF_SIZE]; //buffer for packets not yet processed
#ifdef LRWPAN_FFD
//neighbor info
UINT16 nextChildRFD; //下一个孩子精简设备的地址
UINT16 nextChildRouter; //下一个孩子路由器的地址
BYTE ChildRFDs; //number of neighbor RFDs
BYTE ChildRouters; //number of neighbor Routers
BYTE SuperframeOrder; //超帧阶数
BYTE BeaconOrder; //信标阶数
BYTE FinalCAPSlot; // 最后一个竞争的SLOT的位置
#endif
}MAC_PIB;