📄 mac_802_15_4.h
字号:
}M802_15_4Statistics;// /**// STRUCT :: MacData802_15_4// DESCRIPTION :: Layer structure of MAC802.15.4// **/typedef struct mac_802_15_4_str{ MacData* myMacData; M802_15_4PIB mpib; PHY_PIB tmp_ppib; M802_15_4DevCapability capability; //device capability //--- for beacon --- //(most are temp. variables which should be populated before being used) BOOL secuBeacon; M802_15_4SuperframeSpec sfSpec,sfSpec2,sfSpec3; //superframe spec M802_15_4GTSSpec gtsSpec,gtsSpec2; //GTS specification M802_15_4PendAddrSpec pendAddrSpec; //pending address specification UInt8 beaconPeriods,beaconPeriods2; //# of backoff periods it takes //to transmit the beacon M802_15_4PanEle panDes,panDes2; //PAN descriptor Message* rxBeacon; //the beacon packet just received clocktype macBcnTxTime; //the time last beacon sent (in symbol) clocktype macBcnRxTime; //the time last beacon received // from within PAN (in symbol) clocktype macBcnRxLastTime; clocktype macBcnOtherRxTime; //the time last beacon received //from outside PAN (in symbol) UInt8 macBeaconOrder2; UInt8 macSuperframeOrder2; UInt8 macBeaconOrder3; UInt8 macSuperframeOrder3; UInt8 macBeaconOrder_last; BOOL oneMoreBeacon; UInt8 numLostBeacons; //# of beacons lost in a row //------------------ UInt16 rt_myNodeID; UInt8 energyLevel; MACADDR aExtendedAddress; BOOL isPANCoor; //is a PAN coordinator? BOOL isCoor; //is a coordinator? BOOL isSyncLoss; //has loss the synchronization with CO?// Phy802_15_4 *phy; void* csma; void* sscs; PLMEsetTrxState trx_state_req; //tranceiver state required: BOOL inTransmission; //in the middle of transmission BOOL beaconWaiting; //it's about time to transmit beacon (suppress //all other transmissions) Message* txBeacon; //beacon packet to be transmitted (w/o using //CSMA-CA) Message* txAck; //ack. packet to be transmitted (no waiting) Message* txBcnCmd; //beacon or command packet waiting for //transmission (using CSMA-CA) -- triggered by receiving a packet Message* txBcnCmd2; //beacon or command packet waiting for //transmission (using CSMA-CA) -- triggered by upper layer Message* txData; //data packet waiting for transmission //(using CSMA-CA) Message* txCsmaca; //for which packet (txBcnCmd/txBcnCmd2/txData) //is CSMA-CA performed Message* txPkt; //packet (any type) currently being transmitted Message* rxData; //data packet received (waiting for passing up) Message* rxCmd; //command packet received (will be handled after //the transmission of ack.) UInt32 txPkt_uid; //for debug purpose clocktype rxDataTime; //the time when data packet received by MAC BOOL waitBcnCmdAck; //only used if (txBcnCmd): waiting for an ack BOOL waitBcnCmdAck2; //only used if (txBcnCmd2): waiting for an ack BOOL waitDataAck; //only used if (txData): waiting for an ack UInt8 backoffStatus; //0=no backoff yet;1=backoff //successful;2=backoff failed;99=in the middle of backoff UInt8 numDataRetry; //# of retries (retransmissions) for data //packet UInt8 numBcnCmdRetry; //# of retries (retransmissions) for beacon //or command packet UInt8 numBcnCmdRetry2; //# of retries (retransmissions) for beacon //or command packet // seed for generating random backoff RandomSeed seed; //Statistics M802_15_4Statistics stats; //Timers Message* txOverT; //Transmission over timer Message* txT; //Tx timer Message* extractT; //Extraction timer Message* assoRspWaitT; //Association resp timer Message* dataWaitT; //Data wait Message* rxEnableT; //Receive enable Message* scanT; //Scan Message* bcnTxT; //beacon transmission timer Message* bcnRxT; //beacon reception timer Message* bcnSearchT; //beacon search timer Message* txCmdDataT; Message* backoffBoundT; Message* orphanT; Message* IFST; //Interframe space //MAC state M802_15_4TaskPending taskP; //for association and transaction M802_15_4DEVLINK* deviceLink1; M802_15_4DEVLINK* deviceLink2; M802_15_4TRANSLINK* transacLink1; M802_15_4TRANSLINK* transacLink2;}MacData802_15_4;//--------------------------------------------------------------------------// FUNCTION DECLARATIONS//--------------------------------------------------------------------------//--------------------------------------------------------------------------//API functions between MAC and PHY//--------------------------------------------------------------------------// /**// FUNCTION :: Mac802_15_4PD_DATA_confirm// LAYER :: Mac// PURPOSE :: Primitive to report result of Data request// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface index// + status : PhyStatusType : Status received from phy// RETURN :: None// **/void Mac802_15_4PD_DATA_confirm( Node* node, int interfaceIndex, PhyStatusType status);// /**// FUNCTION :: Mac802_15_4PLME_CCA_confirm// LAYER :: Mac// PURPOSE :: Primitive to report result of CCA request// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface index// + status : PhyStatusType : Status received from phy// RETURN :: None// **/void Mac802_15_4PLME_CCA_confirm( Node* node, int interfaceIndex, PhyStatusType status);// /**// FUNCTION :: Mac802_15_4PLME_ED_confirm// LAYER :: Mac// PURPOSE :: Primitive to report result of ED request// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface index// + status : PhyStatusType : Status received from phy// + EnergyLevel : UInt8 : Energy level// RETURN :: None// **/void Mac802_15_4PLME_ED_confirm( Node* node, int interfaceIndex, PhyStatusType status, UInt8 EnergyLevel);// /**// FUNCTION :: Mac802_15_4PLME_GET_confirm// LAYER :: Mac// PURPOSE :: Primitive to report result of GET request// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface index// + status : PhyStatusType : Status received from phy// + PIBAttribute : PPIBAenum : Attribute id// + PIBAttributeValue: PHY_PIB* : Attribute value// RETURN :: None// **/void Mac802_15_4PLME_GET_confirm( Node* node, int interfaceIndex, PhyStatusType status, PPIBAenum PIBAttribute, PHY_PIB* PIBAttributeValue);// /**// FUNCTION :: Mac802_15_4PLME_SET_TRX_STATE_confirm// LAYER :: Mac// PURPOSE :: Primitive to report result of Set TRX request// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface index// + status : PhyStatusType : Status received from phy// RETURN :: None// **/void Mac802_15_4PLME_SET_TRX_STATE_confirm( Node* node, int interfaceIndex, PhyStatusType status);// /**// FUNCTION :: Mac802_15_4PLME_SET_confirm// LAYER :: Mac// PURPOSE :: Primitive to report result of GET request// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface index// + status : PhyStatusType : Status received from phy// + PIBAttribute : PPIBAenum : Attribute id// RETURN :: None// **/void Mac802_15_4PLME_SET_confirm( Node* node, int interfaceIndex, PhyStatusType status, PPIBAenum PIBAttribute);//--------------------------------------------------------------------------//API functions between MAC and SSCS//--------------------------------------------------------------------------// /**// FUNCTION :: Mac802_15_4MCPS_DATA_request// LAYER :: Mac// PURPOSE :: Primitive to request data transfer from SSCS to peer entity// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface index// + SrcAddrMode : UInt8 : Source address mode// + SrcPANId : UInt16 : source PAN id// + SrcAddr : MACADDR : Source address// + DstAddrMode : UInt8 : Destination address mode// + DstPANId : UInt16 : Destination PAN id// + DstAddr : MACADDR : Destination Address// + msduLength : UInt8 : MSDU length// + msdu : Message* : MSDU// + msduHandle : UInt8 : Handle associated with MSDU// + TxOptions : UInt8 : Transfer options (3bits)// bit-1 = ack(1)/unack(0) tx// bit-2 = GTS(1)/CAP(0) tx// bit-3 = Indirect(1)/Direct(0) tx// RETURN :: None// **/void Mac802_15_4MCPS_DATA_request( Node* node, MacData802_15_4* M802_15_4, UInt8 SrcAddrMode, UInt16 SrcPANId, MACADDR SrcAddr, UInt8 DstAddrMode, UInt16 DstPANId, MACADDR DstAddr, UInt8 msduLength, Message* msdu, UInt8 msduHandle, UInt8 TxOptions);// /**// FUNCTION :: Mac802_15_4MCPS_DATA_indication// LAYER :: Mac// PURPOSE :: Primitive to indicate the transfer of a data SPDU to SSCS// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface index// + SrcAddrMode : UInt8 : Source address mode// + SrcPANId : UInt16 : source PAN id// + SrcAddr : MACADDR : Source address// + DstAddrMode : UInt8 : Destination address mode// + DstPANId : UInt16 : Destination PAN id// + DstAddr : MACADDR : Destination Address// + msduLength : UInt8 : MSDU length// + msdu : Message* : MSDU// + mpduLinkQuality: UInt8 : LQI value measured during reception of// the MPDU// + SecurityUse : BOOL : whether security is used// + ACLEntry : UInt8 : ACL entry// RETURN :: None// **/void Mac802_15_4MCPS_DATA_indication( Node* node, int interfaceIndex, UInt8 SrcAddrMode, UInt16 SrcPANId, MACADDR SrcAddr, UInt8 DstAddrMode, UInt16 DstPANId, MACADDR DstAddr, UInt8 msduLength, Message* msdu, UInt8 mpduLinkQuality, BOOL SecurityUse, UInt8 ACLEntry);// /**// FUNCTION :: Mac802_15_4MCPS_PURGE_request// LAYER :: Mac// PURPOSE :: Primitive to request purging an MSDU from transaction queue// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface index// + msduHandle : UInt8 : Handle associated with MSDU// RETURN :: None// **/void Mac802_15_4MCPS_PURGE_request( Node* node, int interfaceIndex, UInt8 msduHandle);// /**// FUNCTION :: Mac802_15_4MLME_ASSOCIATE_request// LAYER :: Mac// PURPOSE :: Primitive to request an association with a coordinator// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface index// + LogicalChannel : UInt8 : Channel on which attempt is to be done// + CoordAddrMode : UInt8 : Coordinator address mode// + CoordPANId : UInt16 : Coordinator PAN id// + CoordAddress : MACADDR : Coordinator address// + CapabilityInformation : UInt8 : capabilities of associating device// + SecurityEnable : BOOL : Whether enable security or not// RETURN :: None// **/void Mac802_15_4MLME_ASSOCIATE_request( Node* node, int interfaceIndex, UInt8 LogicalChannel, UInt8 CoordAddrMode, UInt16 CoordPANId, MACADDR CoordAddress, UInt8 CapabilityInformation, BOOL SecurityEnable);// /**// FUNCTION :: Mac802_15_4MLME_ASSOCIATE_response// LAYER :: Mac// PURPOSE :: Primitive to initiate a response from SSCS sublayer// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface index// + DeviceAddress : MACADDR : Address of device requesting assoc// + AssocShortAddress : UInt16 : Short address allocated by coord// + status : M802_15_4_enum: Status of association attempt// + SecurityEnable : BOOL : Whether enabled security or not// RETURN :: None// **/void Mac802_15_4MLME_ASSOCIATE_response( Node* node, int interfaceIndex, MACADDR DeviceAddress, UInt16 AssocShortAddress, M802_15_4_enum status, BOOL SecurityEnable);// /**// FUNCTION :: Mac802_15_4MLME_DISASSOCIATE_request// LAYER :: Mac// PURPOSE :: Primitive to indicate coordinator intent to leave// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface index// + DeviceAddress : MACADDR : Add of device requesting dis-assoc// + DisassociateReason : UInt8 : Reason for disassociation// + SecurityEnable : BOOL : Whether enabled security or not// RETURN :: None// **/void Mac802_15_4MLME_DISASSOCIATE_request( Node* node, int interfaceIndex, MACADDR DeviceAddress, UInt8 DisassociateReason, BOOL SecurityEnable);// /**// FUNCTION :: Mac802_15_4MLME_DISASSOCIATE_indication// LAYER :: Mac// PURPOSE :: Primitive to indicate reception of disassociation command// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface index// + DeviceAddress : MACADDR : Add of device requesting dis-assoc// + DisassociateReason : UInt8 : Reason for disassociation// + SecurityUse : BOOL : Whether enabled security or not// + ACLEntry : UInt8 : ACL entry// RETURN :: None
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -