• Kmiracle
  • C/C++
  • 21.8MB
  • rar
  • 0
  • 1 积分
  • 1
  • 2016-03-16 11:44
是TI基于cc2530的2007pro zigbee协议栈、、、、测试可用
/************************************************************************************************** Filename: ZDSecMgr.c Revised: $Date: 2010-01-08 13:29:59 -0800 (Fri, 08 Jan 2010) $ Revision: $Revision: 21465 $ Description: The ZigBee Device Security Manager. Copyright 2005-2009 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. **************************************************************************************************/ #ifdef __cplusplus extern "C" { #endif /****************************************************************************** * INCLUDES */ #include "ZComdef.h" #include "OSAL.h" #include "OSAL_NV.h" #include "ZGlobals.h" #include "ssp.h" #include "nwk_globals.h" #include "nwk.h" #include "NLMEDE.h" #include "AddrMgr.h" #include "AssocList.h" #include "APSMEDE.h" #include "AF.h" #include "ZDConfig.h" #include "ZDApp.h" #include "ZDSecMgr.h" /****************************************************************************** * CONSTANTS */ // maximum number of devices managed by this Security Manager #if !defined ( ZDSECMGR_DEVICE_MAX ) #define ZDSECMGR_DEVICE_MAX 3 #endif // total number of preconfigured devices (EXT address, MASTER key) //devtag.pro.security //#define ZDSECMGR_PRECONFIG_MAX ZDSECMGR_DEVICE_MAX #define ZDSECMGR_PRECONFIG_MAX 0 // maximum number of MASTER keys this device may hold #define ZDSECMGR_MASTERKEY_MAX ZDSECMGR_DEVICE_MAX // maximum number of LINK keys this device may store #define ZDSECMGR_ENTRY_MAX ZDSECMGR_DEVICE_MAX // total number of devices under control - authentication, SKKE, etc. #define ZDSECMGR_CTRL_MAX ZDSECMGR_DEVICE_MAX // total number of stored devices #if !defined ( ZDSECMGR_STORED_DEVICES ) #define ZDSECMGR_STORED_DEVICES 3 #endif // Total number of preconfigured trust center link key #if !defined ( ZDSECMGR_TC_DEVICE_MAX ) #define ZDSECMGR_TC_DEVICE_MAX 1 #endif #if ( ZDSECMGR_TC_DEVICE_MAX < 1 ) || ( ZDSECMGR_TC_DEVICE_MAX > 255 ) #error "ZDSECMGR_TC_DEVICE_MAX shall be between 1 and 255 !" #endif #define ZDSECMGR_CTRL_NONE 0 #define ZDSECMGR_CTRL_INIT 1 #define ZDSECMGR_CTRL_TK_MASTER 2 #define ZDSECMGR_CTRL_SKKE_INIT 3 #define ZDSECMGR_CTRL_SKKE_WAIT 4 #define ZDSECMGR_CTRL_SKKE_DONE 5 #define ZDSECMGR_CTRL_SKKE_FAIL 6 #define ZDSECMGR_CTRL_TK_NWK 7 #define ZDSECMGR_CTRL_BASE_CNTR 1 #define ZDSECMGR_CTRL_SKKE_INIT_CNTR 1 #define ZDSECMGR_CTRL_TK_NWK_CNTR 1 // set SKA slot maximum #define ZDSECMGR_SKA_SLOT_MAX 1 // APSME Stub Implementations #define ZDSecMgrMasterKeyGet APSME_MasterKeyGet #define ZDSecMgrLinkKeySet APSME_LinkKeySet #define ZDSecMgrLinkKeyDataGet APSME_LinkKeyDataGet #define ZDSecMgrKeyFwdToChild APSME_KeyFwdToChild #if !defined( MAX_APS_FRAMECOUNTER_CHANGES ) // The number of times the frame counter can change before // saving to NV #define MAX_APS_FRAMECOUNTER_CHANGES 10 #endif /****************************************************************************** * TYPEDEFS */ typedef struct { uint8 extAddr[Z_EXTADDR_LEN]; uint8 key[SEC_KEY_LEN]; } ZDSecMgrPreConfigData_t; typedef struct { uint16 ami; uint8 key[SEC_KEY_LEN]; } ZDSecMgrMasterKeyData_t; //should match APSME_LinkKeyData_t; typedef struct { uint8 key[SEC_KEY_LEN]; APSME_LinkKeyData_t apsmelkd; } ZDSecMgrLinkKeyData_t; typedef struct { uint16 ami; ZDSecMgrLinkKeyData_t lkd; ZDSecMgr_Authentication_Option authenticateOption; } ZDSecMgrEntry_t; typedef struct { ZDSecMgrEntry_t* entry; uint16 parentAddr; uint8 secure; uint8 state; uint8 cntr; //uint8 next; } ZDSecMgrCtrl_t; typedef struct { uint16 nwkAddr; uint8* extAddr; uint16 parentAddr; uint8 secure; uint8 devStatus; ZDSecMgrCtrl_t* ctrl; } ZDSecMgrDevice_t; /****************************************************************************** * LOCAL VARIABLES */ #if 0 // Taken out because the following functionality is only used for test // purpose. A more efficient (above) way is used. It can be put // back in if customers request for a white/black list feature. uint8 ZDSecMgrStoredDeviceList[ZDSECMGR_STORED_DEVICES][Z_EXTADDR_LEN] = { { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, }; #endif uint8 ZDSecMgrTCExtAddr[Z_EXTADDR_LEN]= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; uint8 ZDSecMgrTCMasterKey[SEC_KEY_LEN] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x89,0x67,0x45,0x23,0x01,0xEF,0xCD,0xAB}; uint8 ZDSecMgrTCAuthenticated = FALSE; uint8 ZDSecMgrTCDataLoaded = FALSE; //devtag.pro.security - remove this #if ( ZDSECMGR_PRECONFIG_MAX != 0 ) const ZDSecMgrPreConfigData_t ZDSecMgrPreConfigData[ZDSECMGR_PRECONFIG_MAX] = { //--------------------------------------------------------------------------- // DEVICE A //--------------------------------------------------------------------------- { // extAddr {0x7C,0x01,0x12,0x13,0x14,0x15,0x16,0x17}, // key {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} }, //--------------------------------------------------------------------------- // DEVICE B //--------------------------------------------------------------------------- { // extAddr {0x84,0x03,0x00,0x00,0x00,0x4B,0x12,0x00}, // key {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} }, //--------------------------------------------------------------------------- // DEVICE C //--------------------------------------------------------------------------- { // extAddr {0x3E,0x01,0x12,0x13,0x14,0x15,0x16,0x17}, // key {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x
    • Texas Instruments.zip
      Texas Instruments常用元件库 TI Analog Timer Circuit.IntLib TI Logic Flip-Flop.IntLib TI Logic Gate 1.IntLib TI Logic Gate 2.IntLib TI Logic Latch.IntLib TI Logic Switch.IntLib TI Power Mgt ...
    • Texas Instruments.zip
      TI封装库(包含大部分TI器件封装) TexasInstruments └── Texas Instruments ├── Texas Instruments Footprints.PcbLib ├── TI Analog Comparator.IntLib ├── TI Analog Current Mirror.IntLib
    • Texas Holdem Calculator-开源
      适用于Windows Mobile 5/6,Windows Phone 7的简单德州扑克计算器,可帮助计算手牌和底池赔率。
    • Texas:C ++ 17的纹理加载器
      Texas是一个旨在简化C ++ 17程序的纹理加载的库,重点放在3D应用程序上。 目标是拥有一个库,其中大多数(如果不是全部)功能都是模块化的,可以选择退出。 这使用户可以配置Texas以符合其项目的要求,并使其尽可能...
    • IAR Embedded Workbench for Texas Instruments 430 5.60
      IAR Embedded Workbench for Texas Instruments 430 5.60授权文件 此授权文件无任何限制,全功能通用版。 与正版授权文件的唯一区别就是不能解压缩Iar Library Source,因不知道压缩文件密码,此缺陷不影响正常使用...
    • Texas_Holdem
      #项目1-德州扑克 我的游戏项目是创建一个标准的2人德克萨斯德州扑克游戏,可能还会创建二十一点,这取决于我在这两个游戏之间有多少时间以及可以回收多少内容。 德州扑克的核心功能: 两名玩家(头对头) ...
    • texas_holdem-master.zip
      texas_holdem Ruby 类模拟德州扑克 注意的补丁/引入请求 分叉项目。 进行功能添加或错误修复。 为其添加测试。 这很重要,所以我不会在未来的版本中无意中破坏它。 提交,不要弄乱 rakefile、版本或历史记录。...
    • Texas Instruments.zip
    • Proteus7.12.rar