123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913 |
- /**************************************************************************************************
- Filename: APSMEDE.h
- Revised: $Date: 2011-04-18 16:30:05 -0700 (Mon, 18 Apr 2011) $
- Revision: $Revision: 25757 $
- Description: Primitives of the Application Support Sub Layer Data Entity (APSDE) and
- Management Entity (APSME).
- Copyright 2004-2011 Texas Instruments Incorporated. All rights reserved.
- IMPORTANT: Your use of this Software is limited to those specific rights
- granted under the terms of a software license agreement between the user
- who downloaded the software, his/her employer (which must be your employer)
- and Texas Instruments Incorporated (the "License"). You may not use this
- Software unless you agree to abide by the terms of the License. The License
- limits your use, and you acknowledge, that the Software may not be modified,
- copied or distributed unless embedded on a Texas Instruments microcontroller
- or used solely and exclusively in conjunction with a Texas Instruments radio
- frequency transceiver, which is integrated into your product. Other than for
- the foregoing purpose, you may not use, reproduce, copy, prepare derivative
- works of, modify, distribute, perform, display or sell this Software and/or
- its documentation for any purpose.
- YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
- PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
- INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
- NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
- TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
- NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
- LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
- INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
- OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
- OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
- (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
- Should you have any questions regarding your right to use this Software,
- contact Texas Instruments Incorporated at www.TI.com.
- **************************************************************************************************/
- #ifndef APSMEDE_H
- #define APSMEDE_H
- #ifdef __cplusplus
- extern "C" {
- #endif
- /******************************************************************************
- * INCLUDES
- */
- #include "ZComDef.h"
- #include "nwk_globals.h"
- #include "AssocList.h"
- #include "nwk_bufs.h"
- #include "BindingTable.h"
- #include "ssp.h"
- /******************************************************************************
- * MACROS
- */
- /******************************************************************************
- * CONSTANTS
- */
- // Frame control fields
- #define APS_FRAME_TYPE_MASK 0x03
- #define APS_DATA_FRAME 0x00
- #define APS_CMD_FRAME 0x01
- #define APS_ACK_FRAME 0x02
- #define STUB_APS_FRAME 0x03
- #define APS_DELIVERYMODE_MASK 0x0C
- #define APS_FC_DM_UNICAST 0x00
- #define APS_FC_DM_INDIRECT 0x04
- #define APS_FC_DM_BROADCAST 0x08
- #define APS_FC_DM_GROUP 0x0C
- #define APS_FC_ACK_FORMAT 0x10
- #define APS_FC_SECURITY 0x20
- #define APS_FC_ACK_REQ 0x40
- #define APS_FC_EXTENDED 0x80
- #define APS_XFC_FRAG_MASK 0x03
- #define APS_XFC_FIRST_FRAG 0x01
- #define APS_XFC_FRAGMENT 0x02
- #define APS_XFC_RESERVED 0xFC
- #define APS_FRAME_CTRL_FIELD_LEN 0x01
- #define APS_DSTEP_ID_FIELD_LEN 0x01
- #define APS_GROUP_ID_FIELD_LEN 0x02
- #define APS_SRCEP_ID_FIELD_LEN 0x01
- #define APS_CLUSTERID_FIELD_LEN_V1_0 0x01
- #define APS_CLUSTERID_FIELD_LEN 0x02
- #define APS_PROFILEID_FIELD_LEN 0x02
- #define APS_FRAME_CNT_FIELD_LEN 0x01
- #define APS_XFRAME_CTRL_FIELD_LEN 0x01
- #define APS_BLOCK_CNT_FIELD_LEN 0x01
- #define APS_ACK_BITS_FIELD_LEN 0x01
- // Tx Options (bitmap values)
- #define APS_TX_OPTIONS_SECURITY_ENABLE 0x01u
- //#define APS_TX_OPTIONS_USE_NWK_KEY 0x02u remove from spec
- #define APS_TX_OPTIONS_ACK 0x04u
- #define APS_TX_OPTIONS_PERMIT_FRAGMENT 0x08u
- #define APS_TX_OPTIONS_SKIP_ROUTING 0x10u
- #define APS_TX_OPTIONS_FIRST_FRAGMENT 0x20u
- #define APS_TX_OPTIONS_PREPROCESS 0x40u
- // APSDE header fields
- #define APS_HDR_FC 0
- // APSME CMD id index
- #define APSME_CMD_ID 0
- // APS commands
- #define APSME_CMD_SKKE_1 0x01
- #define APSME_CMD_SKKE_2 0x02
- #define APSME_CMD_SKKE_3 0x03
- #define APSME_CMD_SKKE_4 0x04
- #define APSME_CMD_TRANSPORT_KEY 0x05
- #define APSME_CMD_UPDATE_DEVICE 0x06
- #define APSME_CMD_REMOVE_DEVICE 0x07
- #define APSME_CMD_REQUEST_KEY 0x08
- #define APSME_CMD_SWITCH_KEY 0x09
- #define APSME_CMD_EA_INIT_CHLNG 0x0A
- #define APSME_CMD_EA_RSP_CHLNG 0x0B
- #define APSME_CMD_EA_INIT_MAC_DATA 0x0C
- #define APSME_CMD_EA_RSP_MAC_DATA 0x0D
- #define APSME_CMD_TUNNEL 0x0E
- // APSME CMD packet fields (APSME_CMD_SKKE_*)
- #define APSME_SKKE_METHOD 0
- #define APSME_SKKE_INIT_ADDR 1
- #define APSME_SKKE_RESP_ADDR 9
- #define APSME_SKKE_PAYLOAD 17
- #define APSME_SKKE_LEN 33
- // APSME CMD packet fields (APSME_CMD_TRANSPORT_KEY)
- #define APSME_TK_KEY_TYPE 1
- #define APSME_TK_KEY 2
- #define APSME_TK_COMMON_LEN (uint8) \
- (APSME_TK_KEY + \
- SEC_KEY_LEN )
- #define APSME_TK_KEY_SEQ_LEN 1
- #define APSME_TK_INITIATOR_LEN 1
- #define APSME_TK_TC_DST_ADDR 18
- #define APSME_TK_TC_SRC_ADDR 26
- #define APSME_TK_TC_KEY_LEN 34
- #define APSME_TK_NWK_KEY_SEQ 18
- #define APSME_TK_NWK_DST_ADDR 19
- #define APSME_TK_NWK_SRC_ADDR 27
- #define APSME_TK_NWK_KEY_LEN 35
- #define APSME_TK_APP_PARTNER_ADDR 18
- #define APSME_TK_APP_INITIATOR 26
- #define APSME_TK_APP_KEY_LEN 27
- // APSME CMD packet fields (APSME_CMD_UPDATE_DEVICE)
- #define APSME_UD_STANDARD_SECURED_REJOIN 0
- #define APSME_UD_STANDARD_UNSECURED_JOIN 1
- #define APSME_UD_STANDARD_UNSECURED_REJOIN 3
- #define APSME_UD_HIGH_SECURED_REJOIN 4
- #define APSME_UD_HIGH_UNSECURED_JOIN 5
- #define APSME_UD_HIGH_UNSECURED_REJOIN 7
- #define APSME_UD_EADDR 1
- #define APSME_UD_SADDR_LSB 9
- #define APSME_UD_SADDR_MSB 10
- #define APSME_UD_STATUS 11
- #define APSME_UD_LEN 12
- // APSME CMD packet fields (APSME_CMD_REMOVE_DEVICE)
- #define APSME_RD_LEN 9
- #define APSME_RD_EADDR 1
- // APSME CMD packet fields (APSME_CMD_REQUEST_KEY)
- #define APSME_RK_KEY_TYPE 1
- #define APSME_RK_EADDR 2
- #define APSME_RK_SYS_LEN 2
- #define APSME_RK_APP_LEN 10
- // APSME CMD packet fields (APSME_CMD_SWITCH_KEY)
- #define APSME_SK_SEQ_NUM 1
- #define APSME_SK_LEN 2
- // APSME CMD packet fields (APSME_CMD_EA*)
- // challenge packets
- #define APSME_EA_CHLNG_KEY_TYPE 1
- #define APSME_EA_CHLNG_SEQ_NUM 2
- #define APSME_EA_CHLNG_INIT_ADDR 3
- #define APSME_EA_CHLNG_RESP_ADDR 11
- #define APSME_EA_CHLNG_PAYLOAD 19
- #define APSME_EA_CHLNG_LEN 35
- // data packets
- #define APSME_EA_DATA_TAG 1
- #define APSME_EA_DATA_TYPE 17
- #define APSME_EA_DATA_TEXT 18
- #define APSME_EA_DATA_LEN 22
- // APSME_AuthenticateReq_t::action types
- #define APSME_EA_INITIATE 0x00
- #define APSME_EA_ACCEPT 0x01
- #define APSME_EA_REJECT 0x02
- // APSME CMD packet fields (APSME_CMD_TUNNEL)
- #define APSME_TUNNEL_DEA 1 //destination extended address
- //devtag.pro.security.remove
- // APSME_TUNNEL_AUX 9 //auxillary header(obsolete)
- #define APSME_TUNNEL_TCMD 9 //tunnelled command
- #define APSME_TUNNEL_LEN 9
- // APSME Coordinator/Trust Center NWK addresses
- #define APSME_TRUSTCENTER_NWKADDR NWK_PAN_COORD_ADDR
- #if !defined( MAX_APS_FRAMECOUNTER_CHANGES )
- // The number of times the frame counter can change before
- // saving to NV
- #define MAX_APS_FRAMECOUNTER_CHANGES 1000
- #endif
- #if !defined( MAX_TCLK_FRAMECOUNTER_CHANGES )
- // The number of times the frame counter can change before
- // saving to NV
- #define MAX_TCLK_FRAMECOUNTER_CHANGES 10
- #endif
- /******************************************************************************
- * TYPEDEFS
- */
- // AIB item Ids
- typedef enum
- {
- apsAddressMap = 0xA0,
- // Proprietary Items
- apsMaxBindingTime,
- apsBindingTable,
- apsNumBindingTableEntries,
- apsUseExtendedPANID,
- apsUseInsecureJoin,
- apsMAX_AIB_ITEMS // Must be the last entry
- } ZApsAttributes_t;
- // Type of information being queried
- typedef enum
- {
- NWK_ADDR_LIST,
- EXT_ADDRESS,
- SIMPLE_DESC,
- NODE_DESC,
- POWER_DESC,
- SVC_MATCH
- } APSME_query_t;
- #define APS_ILLEGAL_DEVICES 0x02
- // Structure returned from APSME_GetRequest for apsBindingTable
- typedef struct
- {
- uint8 srcAddr[Z_EXTADDR_LEN]; // Src address
- byte srcEP; // Endpoint/interface of source device
- uint16 clusterID; // Cluster ID
- zAddrType_t dstAddr; // Destination address
- byte dstEP; // Endpoint/interface of dest device
- } apsBindingItem_t;
- typedef struct
- {
- byte FrmCtrl;
- byte XtndFrmCtrl;
- byte DstEndPoint;
- byte SrcEndPoint;
- uint16 GroupID;
- uint16 ClusterID;
- uint16 ProfileID;
- uint16 macDestAddr;
- byte wasBroadcast;
- byte apsHdrLen;
- byte *asdu;
- byte asduLength;
- byte ApsCounter;
- uint8 transID;
- uint8 BlkCount;
- uint8 AckBits;
- } aps_FrameFormat_t;
- typedef struct
- {
- uint16 tna; // tunnel network address
- uint8* dea; // destination extended address
- } APSDE_FrameTunnel_t;
- // APS Data Service Primitives
- typedef struct
- {
- zAddrType_t dstAddr;
- uint8 srcEP;
- uint8 dstEP;
- uint16 dstPanId;
- uint16 clusterID;
- uint16 profileID;
- uint16 asduLen;
- uint8* asdu;
- uint16 txOptions;
- uint8 transID;
- uint8 discoverRoute;
- uint8 radiusCounter;
- uint8 apsCount;
- uint8 blkCount;
- } APSDE_DataReq_t;
- typedef struct
- {
- uint16 dstAddr;
- uint8 dstEP;
- uint8 srcEP;
- uint8 transID;
- uint8 status;
- } APSDE_DataCnf_t;
- typedef struct
- {
- uint8 secure;
- } APSDE_DataReqMTU_t;
- // APS Security Related Primitives
- typedef struct
- {
- uint16 dstAddr;
- uint8* respExtAddr;
- uint8 method;
- uint8 apsSecure;
- uint8 nwkSecure;
- //devtag.0604.todo - remove obsolete
- } APSME_EstablishKeyReq_t;
- typedef struct
- {
- uint8* partExtAddr;
- uint8 status;
- } APSME_EstablishKeyCfm_t;
- typedef struct
- {
- uint16 srcAddr;
- uint8* initExtAddr;
- uint8 method;
- uint8 apsSecure;
- uint8 nwkSecure;
- //devtag.0604.todo - remove obsolete
- } APSME_EstablishKeyInd_t;
- typedef struct
- {
- uint16 dstAddr;
- uint8* initExtAddr;
- uint8 accept;
- uint8 apsSecure;
- uint8 nwkSecure;
- //devtag.0604.todo - remove obsolete
- } APSME_EstablishKeyRsp_t;
- typedef struct
- {
- uint16 dstAddr;
- uint8 keyType;
- uint8 keySeqNum;
- uint8* key;
- uint8* extAddr;
- uint8 initiator;
- uint8 apsSecure;
- uint8 nwkSecure;
- APSDE_FrameTunnel_t* tunnel;
- } APSME_TransportKeyReq_t;
- typedef struct
- {
- uint16 srcAddr;
- uint8 keyType;
- uint8 keySeqNum;
- uint8* key;
- uint8* dstExtAddr;
- uint8* srcExtAddr;
- uint8 initiator;
- uint8 secure;
- } APSME_TransportKeyInd_t;
- typedef struct
- {
- uint16 dstAddr;
- uint16 devAddr;
- uint8* devExtAddr;
- uint8 status;
- uint8 apsSecure;
- } APSME_UpdateDeviceReq_t;
- typedef struct
- {
- uint16 srcAddr;
- uint8* devExtAddr;
- uint16 devAddr;
- uint8 status;
- } APSME_UpdateDeviceInd_t;
- typedef struct
- {
- uint16 parentAddr;
- uint8* childExtAddr;
- } APSME_RemoveDeviceReq_t;
- typedef struct
- {
- uint16 srcAddr;
- uint8* childExtAddr;
- } APSME_RemoveDeviceInd_t;
- typedef struct
- {
- uint8 dstAddr;
- uint8 keyType;
- uint8* partExtAddr;
- } APSME_RequestKeyReq_t;
- typedef struct
- {
- uint16 srcAddr;
- uint8 keyType;
- uint8* partExtAddr;
- } APSME_RequestKeyInd_t;
- typedef struct
- {
- uint16 dstAddr;
- uint8 keySeqNum;
- } APSME_SwitchKeyReq_t;
- typedef struct
- {
- uint16 srcAddr;
- uint8 keySeqNum;
- } APSME_SwitchKeyInd_t;
- typedef struct
- {
- uint16 nwkAddr;
- uint8* extAddr;
- uint8* challenge;
- uint8 action;
- } APSME_AuthenticateReq_t;
- typedef struct
- {
- uint16 initNwkAddr;
- uint8 initExtAddr[Z_EXTADDR_LEN];
- uint8 challenge[SEC_KEY_LEN];
- } APSME_AuthenticateInd_t;
- typedef struct
- {
- uint8 initiator;
- uint8 partExtAddr[Z_EXTADDR_LEN];
- uint8 status;
- } APSME_AuthenticateCfm_t;
- // APS Incoming Command Packet
- typedef struct
- {
- osal_event_hdr_t hdr;
- uint8* asdu;
- uint8 asduLen;
- uint8 secure;
- uint16 nwkAddr;
- uint8 nwkSecure;
- } APSME_CmdPkt_t;
- typedef struct
- {
- uint8 key[SEC_KEY_LEN];
- uint32 txFrmCntr;
- uint32 rxFrmCntr;
- } APSME_LinkKeyData_t;
- typedef struct
- {
- uint8 frmCtrl;
- uint8 xtndFrmCtrl;
- uint8 srcEP;
- uint8 dstEP;
- uint16 groupID;
- uint16 clusterID;
- uint16 profileID;
- uint8 asduLen;
- uint8* asdu;
- uint8 hdrLen;
- uint8 apsCounter;
- uint8 transID;
- uint8 blkCount;
- uint8 ackBits;
- } APSDE_FrameData_t;
- typedef struct
- {
- uint8 frmCtrl;
- uint8 xtndFrmCtrl;
- uint8 srcEP;
- uint8 dstEP;
- uint16 clusterID;
- uint16 profileID;
- uint8 asduLen;
- uint16 dstAddr;
- uint8 transID;
- } APSDE_StoredFrameData_t;
- typedef struct
- {
- //ZMacDataReq_t mfd;
- NLDE_FrameData_t nfd;
- APSDE_FrameData_t afd;
- } APSDE_FrameFormat_t;
- typedef struct
- {
- uint16 dstAddr;
- uint8 frmCtrl;
- uint8 xtndFrmCtrl;
- uint8 asduLen;
- uint8 nwkSecure;
- APSDE_FrameTunnel_t* tunnel;
- } APSDE_FrameAlloc_t;
- typedef struct
- {
- //input
- APSDE_FrameAlloc_t fa;
- //output
- APSDE_FrameFormat_t* aff;
- SSP_Info_t* si;
- uint8 status;
- } APSDE_FrameBlk_t;
- typedef struct
- {
- uint8 extAddr[Z_EXTADDR_LEN];
- uint8 key[SEC_KEY_LEN];
- uint32 txFrmCntr;
- uint32 rxFrmCntr;
- } APSME_TCLinkKey_t;
- typedef struct
- {
- uint32 txFrmCntr;
- uint32 rxFrmCntr;
- uint8 pendingFlag;
- } APSME_ApsLinkKeyFrmCntr_t;
- typedef struct
- {
- uint32 txFrmCntr;
- uint32 rxFrmCntr;
- uint8 pendingFlag;
- } APSME_TCLinkKeyFrmCntr_t;
- // Function pointer prototype to preprocess messages before calling NWK layer
- typedef void (*apsPreProcessDataReq_t)( APSDE_FrameBlk_t *blk );
- /******************************************************************************
- * GLOBAL VARIABLES
- */
- // Store Frame Counters in RAM and update NV periodically
- extern APSME_ApsLinkKeyFrmCntr_t ApsLinkKeyFrmCntr[];
- extern APSME_TCLinkKeyFrmCntr_t TCLinkKeyFrmCntr[];
- /******************************************************************************
- * APS Data Service
- * APSDE-DATA
- */
- /*
- * This function requests the transfer of data from the next higher layer
- * to a single peer entity.
- */
- extern ZStatus_t APSDE_DataReq( APSDE_DataReq_t* req );
- /*
- * This function requests the MTU(Max Transport Unit) of the APS Data Service
- */
- extern uint8 APSDE_DataReqMTU( APSDE_DataReqMTU_t* fields );
- /*
- * This function reports the results of a request to transfer a data
- * PDU (ASDU) from a local higher layer entity to another single peer entity.
- */
- extern void APSDE_DataConfirm( nwkDB_t *rec, ZStatus_t Status );
- extern void APSDE_DataCnf( APSDE_DataCnf_t* cnf );
- /*
- * This function indicates the transfer of a data PDU (ASDU) from the
- * APS sub-layer to the local application layer entity.
- */
- extern void APSDE_DataIndication( aps_FrameFormat_t *aff, zAddrType_t *SrcAddress,
- uint16 SrcPanId, NLDE_Signal_t *sig, uint8 nwkSeqNum,
- byte SecurityUse, uint32 timestamp );
- /******************************************************************************
- * APS Management Service
- * APSME-BIND
- * APSME-UNBIND
- */
- /*
- * This function allows the next higher layer to request to bind two devices together
- * either by proxy or directly, if issued on the coordinator.
- *
- * NOTE: The APSME-BIND.confirm is returned by this function and is not a
- * seperate callback function.
- */
- extern ZStatus_t APSME_BindRequest( byte SrcEndpInt, uint16 ClusterId,
- zAddrType_t *DstAddr, byte DstEndpInt);
- /*
- * This function allows the next higher layer to request to unbind two devices
- * either by proxy or directly, if issued on the coordinator.
- *
- * NOTE: The APSME-UNBIND.confirm is returned by this function and is not a
- * seperate callback function.
- */
- extern ZStatus_t APSME_UnBindRequest( byte SrcEndpInt,
- uint16 ClusterId, zAddrType_t *DstAddr, byte DstEndpInt);
- /*
- * This function allows the next higher layer to read the value of an attribute
- * from the AIB (APS Information Base)
- */
- extern ZStatus_t APSME_GetRequest( ZApsAttributes_t AIBAttribute,
- uint16 Index, byte *AttributeValue );
- /*
- * This function allows the next higher layer to write the value of an attribute
- * into the AIB (APS Information Base)
- */
- extern ZStatus_t APSME_SetRequest( ZApsAttributes_t AIBAttribute,
- uint16 Index, byte *AttributeValue );
- /*
- * This function gets the EXT address based on the NWK address.
- */
- extern uint8 APSME_LookupExtAddr( uint16 nwkAddr, uint8* extAddr );
- /*
- * This function gets the NWK address based on the EXT address.
- */
- extern uint8 APSME_LookupNwkAddr( uint8* extAddr, uint16* nwkAddr );
- #if 0 // NOT IMPLEMENTED
- /*
- * This function allows the next higher layer to be notified of the results of its
- * request to unbind two devices directly or by proxy.
- */
- extern void APSME_UnbindConfirm( zAddrType_t CoorAddr,ZStatus_t Status,
- uint16 SrcAddr, byte SrcEndpInt, byte ObjectId,
- uint16 DstAddr, byte DstEndpInt);
- /*
- * This function allows the next higher layer to be notified of the results of its
- * request to bind two devices directly or by proxy.
- */
- extern void APSME_BindConfirm( zAddrType_t CoorAddr,ZStatus_t Status,
- uint16 SrcAddr, byte SrcEndpInt, byte ObjectId,
- uint16 DstAddr, byte DstEndpInt);
- #endif // NOT IMPLEMENTED
- /*
- * Set the Preprocess function pointer. The APS Layer will call this function
- * right before calling APSDE_FrameSend() [setup function that calls NLDE_DataReq()].
- */
- extern void APSDE_SetPreProcessFnp( apsPreProcessDataReq_t pfnCB );
- /******************************************************************************
- * APS Incoming Command Packet Handler
- */
- /*
- * APSME_CmdPkt handles APS CMD packets.
- */
- extern void APSME_CmdPkt( APSME_CmdPkt_t* pkt );
- /******************************************************************************
- * APS Frame Allocation And Routing
- */
- /*
- * APSDE_FrameAlloc allocates an APS frame.
- */
- extern void APSDE_FrameAlloc( APSDE_FrameBlk_t* blk );
- /*
- * APSDE_FrameSend sends an APS frame.
- */
- extern void APSDE_FrameSend( APSDE_FrameBlk_t* blk );
- /*
- * APSME_HoldDataRequests holds all data request for a timeout.
- */
- void APSME_HoldDataRequests( uint16 holdTime );
- /******************************************************************************
- * APS Security Related Functions
- */
- /*
- * APSME_FrameSecurityRemove removes security from APS frame.
- */
- extern ZStatus_t APSME_FrameSecurityRemove(uint16 srcAddr,
- aps_FrameFormat_t* aff);
- /*
- * APSME_FrameSecurityApply applies security to APS frame.
- */
- extern ZStatus_t APSME_FrameSecurityApply(uint16 dstAddr,
- aps_FrameFormat_t* aff);
- /*
- * Configure APS security mode
- */
- extern void APSME_SecurityNM( void ); // NULL MODE - NO SECURITY
- extern void APSME_SecurityRM_ED( void );// RESIDENTIAL MODE - END DEVICE
- extern void APSME_SecurityRM_RD( void );// RESIDENTIAL MODE - ROUTER DEVICE
- extern void APSME_SecurityRM_CD( void );// RESIDENTIAL MODE - COORD DEVICE
- extern void APSME_SecurityCM_ED( void );// COMMERCIAL MODE - END DEVICE
- extern void APSME_SecurityCM_RD( void );// COMMERCIAL MODE - ROUTER DEVICE
- extern void APSME_SecurityCM_CD( void );// COMMERCIAL MODE - COORD DEVICE
- /*
- * Configure SKA(Shared Key Authentication) slot data
- */
- extern void APSME_SKA_SlotInit( uint8 total );
- /*
- * Handle the SKA(Shared Key Authentication) slot timer.
- */
- extern void APSME_SKA_SlotTimerHandler( void );
- /******************************************************************************
- * APS Security Service Primitives - API, NHLE Calls Routines
- *
- * APSME_EstablishKeyReq
- * APSME_EstablishKeyRsp
- * APSME_TransportKeyReq
- * APSME_UpdateDeviceReq
- * APSME_RemoveDeviceReq
- * APSME_RequestKeyReq
- * APSME_SwitchKeyReq
- * APSME_AuthenticateReq
- */
- /*
- * APSME_EstablishKeyReq primitive.
- */
- extern ZStatus_t APSME_EstablishKeyReq( APSME_EstablishKeyReq_t* req );
- /*
- * APSME_EstablishKeyRsp primitive.
- */
- extern ZStatus_t APSME_EstablishKeyRsp( APSME_EstablishKeyRsp_t* rsp );
- /*
- * APSME_TransportKeyReq primitive.
- */
- extern ZStatus_t APSME_TransportKeyReq( APSME_TransportKeyReq_t* req );
- /*
- * APSME_UpdateDeviceReq primitive.
- */
- extern ZStatus_t APSME_UpdateDeviceReq( APSME_UpdateDeviceReq_t* req );
- /*
- * APSME_RemoveDeviceReq primitive.
- */
- extern ZStatus_t APSME_RemoveDeviceReq( APSME_RemoveDeviceReq_t* req );
- /*
- * APSME_RequestKeyReq primitive.
- */
- extern ZStatus_t APSME_RequestKeyReq( APSME_RequestKeyReq_t* req );
- /*
- * APSME_SwitchKeyReq primitive.
- */
- extern ZStatus_t APSME_SwitchKeyReq( APSME_SwitchKeyReq_t* req );
- /*
- * APSME_AuthenticateReq primitive.
- */
- extern ZStatus_t APSME_AuthenticateReq( APSME_AuthenticateReq_t* req );
- /******************************************************************************
- * APS Security Primitive Stubs - API, NHLE Implements Callback Stubs
- *
- * APSME_EstablishKeyCfm
- * APSME_EstablishKeyInd
- * APSME_TransportKeyInd
- * APSME_UpdateDeviceInd
- * APSME_RemoveDeviceInd
- * APSME_RequestKeyInd
- * APSME_SwitchKeyInd
- * APSME_AuthenticateInd
- * APSME_AuthenticateCfm
- */
- /*
- * APSME_EstablishKeyCfm primitive.
- */
- extern void APSME_EstablishKeyCfm( APSME_EstablishKeyCfm_t* cfm );
- /*
- * APSME_EstablishKeyInd primitive.
- */
- extern void APSME_EstablishKeyInd( APSME_EstablishKeyInd_t* ind );
- /*
- * APSME_TransportKeyInd primitive.
- */
- extern void APSME_TransportKeyInd( APSME_TransportKeyInd_t* ind );
- /*
- * APSME_UpdateDeviceInd primitive.
- */
- extern void APSME_UpdateDeviceInd( APSME_UpdateDeviceInd_t* ind );
- /*
- * APSME_RemoveDeviceInd primitive.
- */
- extern void APSME_RemoveDeviceInd( APSME_RemoveDeviceInd_t* ind );
- /*
- * APSME_RequestKeyInd primitive.
- */
- extern void APSME_RequestKeyInd( APSME_RequestKeyInd_t* ind );
- /*
- * APSME_SwitchKeyInd primitive.
- */
- extern void APSME_SwitchKeyInd( APSME_SwitchKeyInd_t* ind );
- /*
- * APSME_AuthenticateInd primitive.
- */
- extern void APSME_AuthenticateInd( APSME_AuthenticateInd_t* ind );
- /*
- * APSME_AuthenticateCfm primitive.
- */
- extern void APSME_AuthenticateCfm( APSME_AuthenticateCfm_t* cfm );
- /******************************************************************************
- * APS Security Support - NHLE Implements Callback Stubs
- *
- * APSME_MasterKeyGet
- * APSME_LinkKeySet
- * APSME_LinkKeyNVIdGet
- * APSME_KeyFwdToChild
- */
- /*
- * APSME_MasterKeyExtGet stub.
- */
- extern ZStatus_t APSME_MasterKeyGet( uint8* extAddr, uint16* pKeyNvId );
- /*
- * APSME_LinkKeySet stub.
- */
- extern ZStatus_t APSME_LinkKeySet( uint8* extAddr, uint8* key );
- /*
- * APSME_LinkKeyNVIdGet stub.
- */
- extern ZStatus_t APSME_LinkKeyNVIdGet(uint8* extAddr, uint16 *pKeyNvId);
- /*
- * APSME_IsLinkKeyValid stub.
- */
- extern uint8 APSME_IsLinkKeyValid(uint8* extAddr);
- /*
- * APSME_KeyFwdToChild stub.
- */
- extern uint8 APSME_KeyFwdToChild( APSME_TransportKeyInd_t* ind );
- /*
- * APSME_TCAddrSetup - Configure the Trust Center short address.
- * Use with ZG_SECURITY_SE_STANDARD
- *
- * shortAddr - Trust Center short address
- */
- extern void APSME_TCAddrSetup( uint16 shortAddr );
- /******************************************************************************
- ******************************************************************************/
- #ifdef __cplusplus
- }
- #endif
- #endif /* APSMEDE_H */
|