⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nwk_broadcast.h

📁 ucos在NEC平台下的移植
💻 H
字号:
#ifndef NWK_BROADCAST_H
#define  NWK_BROADCAST_H
 
#define BROADCAST_JITTER  1213        //this constant need be changed

#if BROADCAST_JITTER == 0
#define RREQ_BROADCAST_JITTER   (2 * nwkcMinRREQJitter)
#else
#define RREQ_BROADCAST_JITTER   (2 * BROADCAST_JITTER)
#endif


//we should buffered the recived broadcast packet.
typedef struct 
                {
                    BYTE        destroyPacket;    // Well, not really any more.  Just send up a confirm.
                    BYTE        firstBroadcast;
                    BYTE        sendMessage ;
                }BROADCAST_INFO;
typedef struct
{
        BYTE    nRetries;
        BYTE    bMessageFromUpperLayers;
        BYTE    bConfirmSent;
}BTR_INFO;
 
 //-----------------the definition about Broadcast Transaction Record--------------------
typedef struct       
{
    BYTE                    *dataPtr;
    BYTE                      dataLength;   //used when allocate memory for dataPtr.
    BYTE                      nwkBroadcastSequenceNumber;
	// BYTE                      nwkRadius;                      /*the radius of the network*/
    UINT16         nwkSourceAddress;
    UINT16         nwkDestinationAddress;
    UINT8           currentNeighbor;
    TICK                      broadcastJitterTimer;
    TICK                      broadcastTime; //used to record the time when to transmit a broadcast packet.
	UINT8         broadcastRadius;
    BTR_INFO               btrInfo;
	
	//a flag array,used to record if the neighbor device has relayed the broadcast packet.
    BYTE                      bMessageNotRelayed[NEIGHBOR_TABLE_ENTRIES];
    
} BTR;  // Broadcast Transaction Record
//-----------------end of definition of Broadcast Transaction Record---------------------------

//------------------------------------------------------------------------------------
//     ZBOOL CreateNewBTR( BYTE *BTTIndex );
//
//     DESCRIPTION:
//                This function tries to create a new BTR.   
//    PARAMETER:
//                BYTE *BTTIndex,
//                   A 'value-result' parameter,if the function completes successfully,use the BTTIndex to take
//                   back the BTR's index in the BTT.
//    RETURN-VALUE:
//                TRUE:create the new BTR successfully.
//                FALSE:there is no room in the BTT or there is not enough memory to allocate to dataPtr.
//-----------------------------------------------------------------------------------
ZBOOL CreateNewBTR( BYTE *BTTIndex );

//--------------------------------------------------------------------------
//      void MarkNeighborAsPasssiveACKed( BYTE BTTindex )
//
//      DESCRIPTION:
//              This function must be called while mcpsDataIndication parameters are valid.The indicated BTR will be updated to reflect that
//              the source of the current message has rebroadcast  the message.
//      PARAMETER:
//              BTTindex
//      RETURN-VALUE:
//              NO
//-----------------------------------------------------------------------------
void MarkNeighborAsPasssiveACKed( BYTE BTTindex );

//--------------------------------------------------------------------------
//        void nwkDealWithRecivedRreqFromMLDE(void);
//
//        DESCRIPTION:
//                This  function deals with the recived route request command through mcpsDataIndication function.
//        PARAMETER:
//                 NO
//         RETURN-VALUE:
//                 NO
//         NOTE:
//                The meaning of the function name is :network deals with recived route request command
//                recived through mcpsDataIndication function;this route request command is probably  from
//                some remote device.
//-----------------------------------------------------------------------------
void nwkDealWithRecivedRreqFromMLDE(void);

//------------------------------------------------------------------------------------
//    void sendBroadcastFrameToAllNeighbors(BYTE BTTIndex);
//
//     DESCRIPTION:
//          This function is used to send nwk layer's broadcast frame to all neighbor devices .
//     PARAMETER:
//          BYTE BTTIndex,
//             The index of the broadcast frame that will be sent  out in the BTT array.  
//     RETURN-VALUE:
//                 NO
//     NOTE:
//           This function is used in broadcast procedure.
//---------------------------------------------------------------------------------------
void sendBroadcastFrameToAllNeighbors(BYTE BTTIndex);

//------------------------------------------------------------------------------------
//    void sendBroadcastFrameToAllNeighbors(BYTE index);
//
//    DESCRIPTION:
//          This function is used to relay the recived broadcast frame to all neighbor devices .
//    PARAMETER:
//          BYTE index,
//             The index of the broadcast frame that will be sent  out in the BTT array.  
//    RETURN-VALUE:
//                 NO
//    NOTE:
//           This function is used in broadcast procedure.
//---------------------------------------------------------------------------------------
void sendBroadcastFrameToAllNeighborsOnMCPS(BYTE index);

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -