📄 mac_802_15_4.h
字号:
// **/void Mac802_15_4MLME_DISASSOCIATE_indication( Node* node, int interfaceIndex, MACADDR DeviceAddress, UInt8 DisassociateReason, BOOL SecurityUse, UInt8 ACLEntry);// /**// FUNCTION :: Mac802_15_4MLME_GET_request// LAYER :: Mac// PURPOSE :: Primitive to request info about PIB attribute// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface index// + PIBAttribute : M802_15_4_PIBA_enum : PIB attribute id// RETURN :: None// **/void Mac802_15_4MLME_GET_request( Node* node, int interfaceIndex, M802_15_4_PIBA_enum PIBAttribute);// /**// FUNCTION :: Mac802_15_4MLME_GTS_request// LAYER :: Mac// PURPOSE :: Primitive to request to the PAN coordinator to allocate a// new GTS or to deallocate an existing GTS// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface index// + GTSCharacteristics : UInt8 : characteristics of GTS req// + SecurityEnable : BOOL : Whether enabled security or not// RETURN :: None// **/void Mac802_15_4MLME_GTS_request( Node* node, int interfaceIndex, UInt8 GTSCharacteristics, BOOL SecurityEnable);// /**// FUNCTION :: Mac802_15_4MLME_GTS_confirm// LAYER :: Mac// PURPOSE :: Primitive to report the result of a GTS req// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface index// + GTSCharacteristics : UInt8 : characteristics of GTS req// + status : M802_15_4_enum: status of GTS req// RETURN :: None// **/void Mac802_15_4MLME_GTS_confirm( Node* node, int interfaceIndex, UInt8 GTSCharacteristics, M802_15_4_enum status);// /**// FUNCTION :: Mac802_15_4MLME_GTS_indication// LAYER :: Mac// PURPOSE :: Primitive to indicates that a GTS has been allocated or that// a previously allocated GTS has been deallocated.// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface index// + DevAddress : UInt16 : Short address of device// + GTSCharacteristics : UInt8 : characteristics of GTS req// + SecurityUse : BOOL : Whether enabled security or not// + ACLEntry : UInt8 : ACL entry// RETURN :: None// **/void Mac802_15_4MLME_GTS_indication( Node* node, int interfaceIndex, UInt16 DevAddress, UInt8 GTSCharacteristics, BOOL SecurityUse, UInt8 ACLEntry);// /**// FUNCTION :: Mac802_15_4MLME_ORPHAN_response// LAYER :: Mac// PURPOSE :: Primitive to respond to the MLME-ORPHAN.indication primitive// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface index// + OrphanAddress : MACADDR : Address of orphan device// + ShortAddress : UInt16 : Short address of device// + AssociatedMember : BOOL : Associated or not// + SecurityEnable : BOOL : Whether enabled security or not// RETURN :: None// **/void Mac802_15_4MLME_ORPHAN_response( Node* node, int interfaceIndex, MACADDR OrphanAddress, UInt16 ShortAddress, BOOL AssociatedMember, BOOL SecurityEnable);// /**// FUNCTION :: Mac802_15_4MLME_RESET_request// LAYER :: Mac// PURPOSE :: Primitive to request that the MLME performs a reset// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface index// + SetDefaultPIB : BOOL : Whether to reset PIB to default// RETURN :: None// **/void Mac802_15_4MLME_RESET_request( Node* node, int interfaceIndex, BOOL SetDefaultPIB);// /**// FUNCTION :: Mac802_15_4MLME_RX_ENABLE_request// LAYER :: Mac// PURPOSE :: Primitive to request that the receiver is either enabled for// a finite period of time or disabled// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface index// + DeferPermit : BOOL : If defer till next superframe permitted// + RxOnTime : UInt32 : No. of symbols from start of superframe// after which receiver is enabled// + RxOnDuration : UInt32 : No. of symbols for which receiver is to be// enabled// RETURN :: None// **/void Mac802_15_4MLME_RX_ENABLE_request( Node* node, int interfaceIndex, BOOL DeferPermit, UInt32 RxOnTime, UInt32 RxOnDuration);// /**// FUNCTION :: Mac802_15_4MLME_SCAN_request// LAYER :: Mac// PURPOSE :: Primitive to initiate a channel scan over a given list of// channels// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface index// + ScanType : UInt8 : Type of scan (0-ED/Active/Passive/3-Orphan)// + ScanChannels : UInt32 : Channels to be scanned// + ScanDuration : UInt8 : Duration of scan, ignored for orphan scan// RETURN :: None// **/void Mac802_15_4MLME_SCAN_request( Node* node, int interfaceIndex, UInt8 ScanType, UInt32 ScanChannels, UInt8 ScanDuration);// /**// FUNCTION :: Mac802_15_4MLME_SET_request// LAYER :: Mac// PURPOSE :: Primitive to set PIB attribute// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface index// + PIBAttribute : M802_15_4_PIBA_enum : PIB attribute id// + PIBAttributeValue : M802_15_4PIB* : Attribute value// RETURN :: None// **/void Mac802_15_4MLME_SET_request( Node* node, int interfaceIndex, M802_15_4_PIBA_enum PIBAttribute, M802_15_4PIB* PIBAttributeValue);// /**// FUNCTION :: Mac802_15_4MLME_START_request// LAYER :: Mac// PURPOSE :: Primitive to allow the PAN coordinator to initiate a new PAN// or to begin using a new superframe configuration// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface index// + PANId : UInt16 : PAN id// + LogicalChannel : UInt8 : Logical channel// + BeaconOrder : UInt8 : How often a beacon is tx'd.// + SuperframeOrder : UInt8 : Length of active portion of s-frame// + PANCoordinator : BOOL : If device is PAN coordinator// + BatteryLifeExtension : BOOL : for battery saving mode// + CoordRealignment : BOOL : If coordinator realignment command// needs to be sent prior to changing superframe config// + SecurityEnable : BOOL : If security is enabled// RETURN :: None// **/void Mac802_15_4MLME_START_request( Node* node, int interfaceIndex, UInt16 PANId, UInt8 LogicalChannel, UInt8 BeaconOrder, UInt8 SuperframeOrder, BOOL PANCoordinator, BOOL BatteryLifeExtension, BOOL CoordRealignment, BOOL SecurityEnable);// /**// FUNCTION :: Mac802_15_4MLME_SYNC_request// LAYER :: Mac// PURPOSE :: Primitive to request synchronize with the coordinator// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface index// + LogicalChannel : UInt8 : Logical channel// + TrackBeacon : BOOL : Whether to synchronize with all future beacons// RETURN :: None// **/void Mac802_15_4MLME_SYNC_request( Node* node, int interfaceIndex, UInt8 LogicalChannel, BOOL TrackBeacon);// /**// FUNCTION :: Mac802_15_4MLME_POLL_request// LAYER :: Mac// PURPOSE :: Primitive to prompt device to request data from coordinator// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface index// + CoordAddrMode : UInt8 : Coordinator address mode// + CoordPANId : UInt16 : Coordinator PAN id// + CoordAddress : MACADDR : Coordinator address// + SecurityEnable : BOOL : Whether enable security or not// RETURN :: None// **/void Mac802_15_4MLME_POLL_request( Node* node, int interfaceIndex, UInt8 CoordAddrMode, UInt16 CoordPANId, MACADDR CoordAddress, BOOL SecurityEnable);Message* Mac802_15_4SetTimer( Node* node, MacData802_15_4* mac802_15_4, M802_15_4TimerType timerType, clocktype delay, Message* msg);// /**// FUNCTION Mac802_15_4Init// PURPOSE Initialization function for 802.15.4 protocol of MAC layer// PARAMETERS Node* node// Node being initialized.// NodeInput* nodeInput// Structure containing contents of input file.// SubnetMemberData* subnetList// Number of nodes in subnet.// int nodesInSubnet// Number of nodes in subnet.// int subnetListIndex// NodeAddress subnetAddress// Subnet address.// RETURN None// NOTES None// **/void Mac802_15_4Init( Node* node, const NodeInput* nodeInput, int interfaceIndex, NodeAddress subnetAddress, SubnetMemberData* subnetList, int nodesInSubnet);// /**// FUNCTION Mac802_15_4Layer// PURPOSE Models the behaviour of the MAC layer with the 802.15.4// protocol on receiving the message enclosed in msgHdr// PARAMETERS Node *node// Node which received the message.// int interfaceIndex// Interface index.// Message* msg// Message received by the layer.// RETURN None// NOTES None// **/void Mac802_15_4Layer(Node* node, int interfaceIndex, Message* msg);// /**// FUNCTION Mac802_15_4Finalize// PURPOSE Called at the end of simulation to collect the results of// the simulation of 802.15.4 protocol of the MAC Layer.// PARAMETERS Node* node// Node which received the message.// int interfaceIndex// Interface index.// RETURN None// NOTES None// **/void Mac802_15_4Finalize(Node* node, int interfaceIndex);// /**// NAME Mac802_15_4NetworkLayerHasPacketToSend// PURPOSE To notify 802.15.4 that network has something to send// PARAMETERS Node* node// Node which received the message.// MacData_802_15_4* M802_15_4// 802.15.4 data structure// RETURN None// NOTES None// **/void Mac802_15_4NetworkLayerHasPacketToSend( Node* node, MacData802_15_4* M802_15_4);// /**// NAME Mac802_15_4ReceivePacketFromPhy// PURPOSE To recieve packet from the physical layer// PARAMETERS Node* node// Node which received the message.// MacData_802_15_4* M802_15_4// 802.15.4 data structure// Message* msg// Message received by the layer.// RETURN None.// NOTES None// **/void Mac802_15_4ReceivePacketFromPhy( Node* node, MacData802_15_4* M802_15_4, Message* msg);// /**// NAME Mac802_15_4ReceivePhyStatusChangeNotification// PURPOSE Receive notification of status change in physical layer// PARAMETERS Node* node// Node which received the message.// MacData_802_15_4* M802_15_4// 802.15.4 data structure.// PhyStatusType oldPhyStatus// The old physical status.// PhyStatusType newPhyStatus// The new physical status.// clocktype receiveDuration// The receiving duration.// Message* potentialIncomingPacket// Incoming packet.// RETURN None.// NOTES None// **/void Mac802_15_4ReceivePhyStatusChangeNotification( Node* node, MacData802_15_4* M802_15_4, PhyStatusType oldPhyStatus, PhyStatusType newPhyStatus, clocktype receiveDuration, const Message* potentialIncomingPacket);//--------------------------------------------------------------------------// STATIC FUNCTIONS//--------------------------------------------------------------------------// /**// FUNCTION :: Mac802_15_4FrameCtrlParse// LAYER :: Mac// PURPOSE :: This function is called for parsing Frame Control fields.// PARAMETERS ::// + frameCtrl : M802_15_4FrameCtrl* : Pointer to Frame Control// RETURN :: None.// **/staticvoid Mac802_15_4FrameCtrlParse(M802_15_4FrameCtrl* frameCtrl){ frameCtrl->frmType = (UInt8)((frameCtrl->FrmCtrl & 0xe000) >> 13); //taking deviation from coding guidelines and using ternary operator frameCtrl->secu = ((frameCtrl->FrmCtrl & 0x1000) == 0)?FALSE:TRUE; frameCtrl->frmPending = ((frameCtrl->FrmCtrl & 0x0800) == 0)?FALSE:TRUE; frameCtrl->ackReq = ((frameCtrl->FrmCtrl & 0x0400) == 0)?FALSE:TRUE; frameCtrl->intraPan = ((frameCtrl->FrmCtrl & 0x0200) == 0)?FALSE:TRUE; frameCtrl->dstAddrMode = (UInt8)((frameCtrl->FrmCtrl & 0x0030) >> 4); frameCtrl->srcAddrMode = (UInt8)(frameCtrl->FrmCtrl & 0x0003);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -