00001
00018 #ifndef _APS_H
00019 #define _APS_H
00020
00021
00022
00023
00024 #include <types.h>
00025 #include <nwk.h>
00026 #include <appFramework.h>
00027 #include <macAddr.h>
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef APS_MAX_TRANSMISSION_WINDOW_SIZE
00036 #define APS_MAX_TRANSMISSION_WINDOW_SIZE 3
00037 #endif
00038
00039
00040
00041 #ifndef APS_MAX_BLOCKS_AMOUNT
00042 #define APS_MAX_BLOCKS_AMOUNT 3
00043 #endif
00044
00045
00046 #ifndef _HIGH_SECURITY_
00047
00050 #define APS_MAX_DATA_FRAME_HEADER_LENGTH 12
00051
00052
00055 #define APS_MAX_DATA_FRAME_FOOTER_LENGTH 0
00056 #else
00057
00060 #define APS_MAX_DATA_FRAME_HEADER_LENGTH (12 + 6)
00061
00062
00065 #define APS_MAX_DATA_FRAME_FOOTER_LENGTH 8
00066 #endif
00067
00068
00071 #define APS_MAX_ASDU_SIZE (NWK_MAX_NSDU_SIZE - APS_MAX_DATA_FRAME_HEADER_LENGTH - APS_MAX_DATA_FRAME_FOOTER_LENGTH)
00072
00073
00076 #define APS_ASDU_OFFSET (NWK_NSDU_OFFSET + APS_MAX_DATA_FRAME_HEADER_LENGTH)
00077
00078
00081 #define APS_AFFIX_LENGTH (APS_MAX_DATA_FRAME_HEADER_LENGTH + APS_MAX_DATA_FRAME_FOOTER_LENGTH + NWK_AFFIX_LENGTH)
00082
00083
00086 #define APS_BROADCAST_ENDPOINT 0xff
00087
00088
00091 #define APS_MIN_USER_ENDPOINT 0x01
00092
00093
00096 #define APS_MAX_USER_ENDPOINT 0xf0
00097
00098
00099
00100 #define APS_ZDO_ENDPOINT 0x00
00101
00102
00103 #define APS_MIN_RESERVED_ENDPOINT 0xf1
00104 #define APS_MAX_RESERVED_ENDPOINT 0xfe
00105
00106
00107 #define APS_MAX_UNICAST_SHORT_ADDRESS 0xfff7
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00126 typedef struct
00127 {
00128 union
00129 {
00130 ShortAddr_t shortAddress;
00131 #ifdef _APS_MULTICAST_
00132 GroupAddr_t groupAddress;
00133 #endif
00134 };
00135 ExtAddr_t extAddress;
00136 } APS_Address_t;
00137
00138
00145 typedef enum
00146 {
00147 APS_NO_ADDRESS = 0x00,
00148 #ifdef _APS_MULTICAST_
00149 APS_GROUP_ADDRESS = 0x01,
00150 #endif
00151 APS_SHORT_ADDRESS = 0x02,
00152 APS_EXT_ADDRESS = 0x03
00153 } APS_AddrMode_t;
00154
00155
00164 typedef enum
00165 {
00166 APS_SUCCESS_STATUS = 0x00,
00167 APS_ASDU_TOO_LONG_STATUS = 0xa0,
00168 APS_DEFRAG_DEFERRED_STATUS = 0xa1,
00169 APS_DEFRAG_UNSUPPORTED_STATUS = 0xa2,
00170 APS_ILLEGAL_REQUEST_STATUS = 0xa3,
00171 APS_INVALID_BINDING_STATUS = 0xa4,
00172 APS_INVALID_GROUP_STATUS = 0xa5,
00173 APS_INVALID_PARAMETER_STATUS = 0xa6,
00174 APS_NO_ACK_STATUS = 0xa7,
00175 APS_NO_BOUND_DEVICE_STATUS = 0xa8,
00176 APS_NO_SHORT_ADDRESS_STATUS = 0xa9,
00177 APS_NOT_SUPPORTED_STATUS = 0xaa,
00178 APS_SECURED_LINK_KEY_STATUS = 0xab,
00179 APS_SECURED_NWK_KEY_STATUS = 0xac,
00180 APS_SECURITY_FAIL_STATUS = 0xad,
00181 APS_TABLE_FULL_STATUS = 0xae,
00182 APS_UNSECURED_STATUS = 0xaf,
00183 APS_UNSUPPORTED_ATTRIBUTE_STATUS = 0xb0,
00184
00185
00186 APS_NOT_INDICATED_STATUS = 0xb1
00187 } APS_Status_t;
00188
00189 #ifdef _SECURITY_
00190
00199 typedef enum
00200 {
00201 APS_SKKE_SUCCESS_STATUS = 0x00,
00202 APS_SKKE_INVALID_PARAMETER_STATUS = 0x01,
00203 APS_SKKE_NO_MASTER_KEY_STATUS = 0x02,
00204 APS_SKKE_INVALID_CHALLENGE_STATUS = 0x03,
00205 APS_SKKE_INVALID_SKG_STATUS = 0x04,
00206 APS_SKKE_INVALID_MAC_STATUS = 0x05,
00207 APS_SKKE_INVALID_KEY_STATUS = 0x06,
00208 APS_SKKE_TIMEOUT_STATUS = 0x07,
00209 APS_SKKE_BAD_FRAME_STATUS = 0x08,
00210 } APS_SkkeStatus_t;
00211 #endif //#ifdef _SECURITY_
00212
00213
00222 typedef enum
00223 {
00224
00225 APS_AIB_BINDING_TABLE = 0xc1,
00226 APS_AIB_DESIGNATED_COORDINATOR = 0xc2,
00227 APS_AIB_CHANNEL_MASK = 0xc3,
00228 APS_AIB_USE_EXTENDED_PANID = 0xc4,
00229 APS_AIB_GROUP_TABLE = 0xc5,
00230 APS_AIB_NONMEMBER_RADIUS = 0xc6,
00231 APS_AIB_PERMISSIONS_CONFIGURATION = 0xc7,
00232 APS_AIB_USE_INSECURE_JOIN = 0xc8,
00233 APS_AIB_INTERFRAME_DELAY = 0xc9,
00234
00235
00236 APS_AIB_DEVICE_KEY_PAIR_SET = 0xaa,
00237 APS_AIB_TRUST_CENTER_ADDRESS = 0xab,
00238 APS_AIB_SECURITY_TIME_OUT_PERIOD = 0xac
00239 } APS_AibAttributeId_t;
00240
00241
00249 typedef struct
00250 {
00251 uint8_t apscMaxDescriptorSize;
00252 uint8_t apscMaxFrameRetries;
00253 uint32_t apscAckWaitDuration;
00254 uint8_t apscMinDuplicateRejectionTableSize;
00255 uint8_t apscMaxWindowSize;
00256 uint16_t apscInterframeDelay;
00257 uint8_t apscMinHeaderOverHead;
00258 } APS_AibPermissionsConfiguration_t;
00259
00260
00261
00262
00263
00264
00265
00266 typedef struct
00267 {
00268 bool busy;
00269 GroupAddr_t groupAddr;
00270 Endpoint_t endpoints[1];
00271 } APS_GroupTableEntry_t;
00272
00273
00274
00275
00276
00277
00278 typedef struct
00279 {
00280 uint8_t groupsAmount;
00281 uint8_t endpointsAmount;
00282
00283 uint16_t entrySizeof;
00284 APS_GroupTableEntry_t *entries;
00285 } APS_GroupTable_t;
00286
00287
00288
00297 typedef union
00298 {
00299
00300
00301 void *apsBindingTable;
00302 bool apsDesignatedCoordinator;
00303 uint32_t apsChannelMask;
00304 uint64_t apsUseExtendedPANID;
00305 APS_GroupTable_t *apsGroupTable;
00306 uint8_t apsNonmemberRadius;
00307
00309 APS_AibPermissionsConfiguration_t *apsPermissionsConfiguration;
00310
00311 bool apsUseInsecureJoin;
00312 uint16_t apsInterframeDelay;
00313
00314
00315 void *apsDeviceKeyPairSet;
00316 uint64_t apsTrustCenterAddress;
00317 uint16_t apsSecurityTimeOutPeriod;
00318 } APS_AibAttribute_t;
00319
00320
00321
00322
00323
00324
00325
00326
00331 typedef struct
00332 {
00333
00334
00335
00336
00337
00338 APS_Status_t status;
00339 uint32_t txTime;
00340
00341 } APS_DataConf_t;
00342
00343
00344
00348 BEGIN_PACK
00349 typedef struct PACK
00350 {
00351 uint8_t securityEnabledTransmission :1;
00352 uint8_t useNwkKey :1;
00353 uint8_t acknowledgedTransmission :1;
00354 uint8_t fragmentationPermitted :1;
00355 uint8_t reserved :4;
00356 } APS_TxOptions_t;
00357 END_PACK
00358
00359
00364 typedef struct
00365 {
00366
00368 struct
00369 {
00370 void *next;
00371 } service;
00372
00373
00384 APS_AddrMode_t dstAddrMode;
00388 APS_Address_t dstAddress;
00394 Endpoint_t dstEndpoint;
00396 ProfileId_t profileId;
00398 ClusterId_t clusterId;
00400 Endpoint_t srcEndpoint;
00405 uint8_t asduLength;
00407 uint8_t *asdu;
00417 APS_TxOptions_t txOptions;
00421 uint8_t radius;
00422
00424 void (*APS_DataConf)(APS_DataConf_t *conf);
00425 APS_DataConf_t confirm;
00426 } APS_DataReq_t;
00427
00428
00429
00435 typedef struct
00436 {
00444 APS_AddrMode_t dstAddrMode;
00447 APS_Address_t dstAddress;
00449 Endpoint_t dstEndpoint;
00458 APS_AddrMode_t srcAddrMode;
00461 APS_Address_t srcAddress;
00464 Endpoint_t srcEndpoint;
00466 ProfileId_t profileId;
00468 ClusterId_t clusterId;
00470 uint8_t asduLength;
00472 uint8_t *asdu;
00474 APS_Status_t status;
00478 APS_Status_t securityStatus;
00480 uint8_t linkQuality;
00483 uint32_t rxTime;
00484
00485 int8_t rssi;
00486
00487 } APS_DataInd_t;
00488
00489
00490
00491 #ifdef _BINDING_
00492
00493
00494
00495
00496
00497
00498
00499
00500 typedef struct
00501 {
00502
00503 APS_Status_t status;
00504 } APS_BindConf_t;
00505
00506
00507
00508
00509
00510
00511 typedef struct
00512 {
00513
00514 ExtAddr_t srcAddr;
00515 Endpoint_t srcEndpoint;
00516 ClusterId_t clusterId;
00517 APS_AddrMode_t dstAddrMode;
00518 APS_Address_t dstAddr;
00519 Endpoint_t dstEndpoint;
00520
00521 APS_BindConf_t confirm;
00522 } APS_BindReq_t;
00523
00524
00525
00526
00527
00528
00529 typedef struct
00530 {
00531
00532 APS_Status_t status;
00533 } APS_UnbindConf_t;
00534
00535
00536
00537
00538
00539
00540 typedef struct
00541 {
00542
00543 ExtAddr_t srcAddr;
00544 Endpoint_t srcEndpoint;
00545 ClusterId_t clusterId;
00546 APS_AddrMode_t dstAddrMode;
00547 APS_Address_t dstAddr;
00548 Endpoint_t dstEndpoint;
00549
00550 APS_UnbindConf_t confirm;
00551 } APS_UnbindReq_t;
00552
00553
00554 #endif //#ifdef _BINDING_
00555
00556
00557
00558
00559
00560
00565 typedef struct
00566 {
00567
00569 APS_Status_t status;
00571 uint16_t aibAttributeLength;
00573 APS_AibAttribute_t aibAttributeValue;
00574 } APS_GetConf_t;
00575
00576
00577
00582 typedef struct
00583 {
00584
00586 APS_AibAttributeId_t aibAttribute;
00587
00588
00590 APS_GetConf_t confirm;
00591 } APS_GetReq_t;
00592
00593
00594
00599 typedef struct
00600 {
00601
00603 APS_Status_t status;
00604 } APS_SetConf_t;
00605
00606
00607
00612 typedef struct
00613 {
00614
00616 APS_AibAttributeId_t aibAttribute;
00618 uint16_t aibAttributeLength;
00620 APS_AibAttribute_t aibAttributeValue;
00621
00622
00624 APS_SetConf_t confirm;
00625 } APS_SetReq_t;
00626
00627
00628 #ifdef _APS_MULTICAST_
00629
00630
00631
00632
00633
00638 typedef struct
00639 {
00640
00642 APS_Status_t status;
00643 } APS_AddGroupConf_t;
00644
00645
00650 typedef struct
00651 {
00652
00654 GroupAddr_t groupAddress;
00656 Endpoint_t endpoint;
00657
00658
00660 APS_AddGroupConf_t confirm;
00661 } APS_AddGroupReq_t;
00662
00663
00664
00669 typedef struct
00670 {
00671
00673 APS_Status_t status;
00674 } APS_RemoveGroupConf_t;
00675
00676
00681 typedef struct
00682 {
00683
00685 GroupAddr_t groupAddress;
00687 Endpoint_t endpoint;
00688
00689
00691 APS_RemoveGroupConf_t confirm;
00692 } APS_RemoveGroupReq_t;
00693
00694
00695
00700 typedef struct
00701 {
00702
00704 APS_Status_t status;
00705 } APS_RemoveAllGroupsConf_t;
00706
00707
00712 typedef struct
00713 {
00714
00716 Endpoint_t endpoint;
00717
00718
00720 APS_RemoveAllGroupsConf_t confirm;
00721 } APS_RemoveAllGroupsReq_t;
00722
00723 #endif //#ifdef _APS_MULTICAST_
00724
00725
00726 #ifdef _SECURITY_
00727 #ifdef _HIGH_SECURITY_
00728 typedef struct
00729 {
00730 ExtAddr_t deviceAddress;
00731 uint8_t masterKey[16];
00732 uint8_t linkKey[16];
00733 uint32_t outFrameCounter;
00734 uint32_t inFrameCounter;
00735 } ApsKeyPairDescriptor_t;
00736
00737
00738
00739
00740
00741
00742
00743 typedef enum
00744 {
00745 APS_SKKE_KEY_ESTABLISHMENT_METHOD = 0x00
00746 } APS_KeyEstablishmentMethod_t;
00747
00748
00749
00750
00751
00752 typedef struct
00753 {
00754 ExtAddr_t address;
00755 APS_SkkeStatus_t status;
00756 } APS_EstablishKeyConf_t;
00757
00758
00759
00760
00761
00762
00763 typedef struct
00764 {
00765
00767 struct
00768 {
00769 void *next;
00770 } service;
00771
00772 ExtAddr_t responderAddress;
00773 bool useParent;
00774 ExtAddr_t responderParentAddress;
00775 APS_KeyEstablishmentMethod_t keyEstablishmentMethod;
00776
00777 APS_EstablishKeyConf_t confirm;
00778 void (*APS_EstablishKeyConf)(APS_EstablishKeyConf_t *conf);
00779 } APS_EstablishKeyReq_t;
00780
00781
00782
00783
00784
00785 typedef struct
00786 {
00787 ExtAddr_t initiatorAddress;
00788 bool accept;
00789
00790 APS_EstablishKeyConf_t confirm;
00791 void (*APS_EstablishKeyConf)(APS_EstablishKeyConf_t *conf);
00792 } APS_EstablishKeyResp_t;
00793
00794
00795
00796
00797
00798 typedef struct
00799 {
00800
00801 ExtAddr_t initiatorAddress;
00802 APS_KeyEstablishmentMethod_t keyEstablishmentMethod;
00803 } APS_EstablishKeyInd_t;
00804 #endif //#ifdef _HIGH_SECURITY_
00805
00806
00807
00808
00809 typedef enum
00810 {
00811 APS_TRUST_CENTER_MASTER_KEY_TYPE = 0x00,
00812 APS_STANDARD_NETWORK_KEY_TYPE = 0x01,
00813 APS_APP_MASTER_KEY_TYPE = 0x02,
00814 APS_APP_LINK_KEY_TYPE = 0x03,
00815 APS_TRUST_CENTER_LINK_KEY_TYPE = 0x04,
00816 APS_HIGH_SECURITY_NETWORK_KEY_TYPE = 0x05
00817 } APS_TransportKeyType_t;
00818
00819
00820 typedef struct
00821 {
00822 ExtAddr_t parentAddress;
00823 uint8_t key[16];
00824 } APS_ReqTrustCenterMasterOrLinkKeyTransportData_t;
00825
00826 typedef struct
00827 {
00828 uint8_t keySeqNumber;
00829 uint8_t networkKey[16];
00830 bool useParent;
00831 ExtAddr_t parentAddress;
00832 } APS_ReqNetworkKeyTransportData_t;
00833
00834 typedef struct
00835 {
00836 ExtAddr_t partnerAddress;
00837 bool initiator;
00838 uint8_t key[16];
00839 } APS_ReqApplicationMasterOrLinkKeyTransportData_t;
00840
00841 typedef union
00842 {
00843 APS_ReqTrustCenterMasterOrLinkKeyTransportData_t trustCenterKey;
00844 APS_ReqNetworkKeyTransportData_t networkKey;
00845 APS_ReqApplicationMasterOrLinkKeyTransportData_t applicationKey;
00846 } APS_ReqTransportKeyData_t;
00847
00848
00849 typedef enum
00850 {
00851 APS_TKR_SUCCESS_STATUS = 0x00,
00852 APS_TKR_NO_SHORT_ADDRESS_STATUS = 0x01,
00853 APS_TKR_SECURITY_FAIL_STATUS = 0x02,
00854 APS_TKR_NOT_SENT_STATUS = 0x03
00855 } APS_TkrStatus_t;
00856
00857
00858
00859
00860 typedef struct
00861 {
00862 APS_TkrStatus_t status;
00863 } APS_TransportKeyConf_t;
00864
00865
00866
00867
00868 typedef struct
00869 {
00870
00871 struct
00872 {
00873 void *next;
00874 } service;
00875
00876
00877 ExtAddr_t destAddress;
00878 APS_TransportKeyType_t keyType;
00879 APS_ReqTransportKeyData_t transportKeyData;
00880
00881
00882 APS_TransportKeyConf_t confirm;
00883 void (*APS_TransportKeyConf)(APS_TransportKeyConf_t *conf);
00884 } APS_TransportKeyReq_t;
00885
00886
00887
00888 typedef struct
00889 {
00890 uint8_t trustCenterMasterKey[16];
00891 } APS_IndTrustCenterMasterOrLinkKeyTransportData_t;
00892
00893 typedef struct
00894 {
00895 uint8_t keySeqNumber;
00896 uint8_t networkKey[16];
00897 } APS_IndNetworkKeyTransportData_t;
00898
00899 typedef struct
00900 {
00901 ExtAddr_t partnerAddress;
00902 uint8_t key[16];
00903 } APS_IndApplicationMasterOrLinkKeyTransportData_t;
00904
00905 typedef union
00906 {
00907 APS_IndTrustCenterMasterOrLinkKeyTransportData_t trustCenterKey;
00908 APS_IndNetworkKeyTransportData_t networkKey;
00909 APS_IndApplicationMasterOrLinkKeyTransportData_t applicationKey;
00910 } APS_IndTransportKeyData_t;
00911
00912
00913
00914
00915
00916 typedef struct
00917 {
00918
00919 ExtAddr_t srcAddress;
00920 APS_TransportKeyType_t keyType;
00921 APS_IndTransportKeyData_t transportKeyData;
00922 } APS_TransportKeyInd_t;
00923
00924
00925 typedef enum
00926 {
00927 APS_STANDARD_DEVICE_SECURED_REJOIN_STATUS = 0x00,
00928 APS_STANDARD_DEVICE_UNSECURED_JOIN_STATUS = 0x01,
00929 APS_DEVICE_LEFT_STATUS = 0x02,
00930 APS_STANDARD_DEVICE_UNSECURED_REJOIN_STATUS = 0x03,
00931 APS_HIGH_SECURITY_DEVICE_SECURED_REJOIN_STATUS = 0x04,
00932 APS_HIGH_SECURITY_DEVICE_UNSECURED_JOIN_STATUS = 0x05,
00933 APS_RESERVED_STATUS = 0x06,
00934 APS_HIGH_SECURITY_DEVICE_UNSECURED_REJOIN_STATUS = 0x07
00935 } APS_UpdateDeviceStatus_t;
00936
00937 typedef enum
00938 {
00939 APS_UDR_SUCCESS_STATUS = 0x00,
00940 APS_UDR_NO_SHORT_ADDRESS_STATUS = 0x01,
00941 APS_UDR_SECURITY_FAIL_STATUS = 0x02,
00942 APS_UDR_NOT_SENT_STATUS = 0x03
00943 } APS_UdrStatus_t;
00944
00945
00946
00947
00948 typedef struct
00949 {
00950 APS_UdrStatus_t status;
00951 } APS_UpdateDeviceConf_t;
00952
00953
00954
00955
00956
00957 typedef struct
00958 {
00959
00960 struct
00961 {
00962 void *next;
00963 } service;
00964
00965
00966 ExtAddr_t destAddress;
00967 ExtAddr_t deviceAddress;
00968 APS_UpdateDeviceStatus_t status;
00969 ShortAddr_t deviceShortAddress;
00970
00971
00972 APS_UpdateDeviceConf_t confirm;
00973 void (*APS_UpdateDeviceConf)(APS_UpdateDeviceConf_t *conf);
00974 } APS_UpdateDeviceReq_t;
00975
00976
00977
00978
00979
00980 typedef struct
00981 {
00982
00983 ExtAddr_t srcAddress;
00984 ExtAddr_t deviceAddress;
00985 APS_UpdateDeviceStatus_t status;
00986 ShortAddr_t deviceShortAddress;
00987 } APS_UpdateDeviceInd_t;
00988
00989
00990 typedef enum
00991 {
00992 APS_RDR_SUCCESS_STATUS = 0x00,
00993 APS_RDR_NO_SHORT_ADDRESS_STATUS = 0x01,
00994 APS_RDR_SECURITY_FAIL_STATUS = 0x02,
00995 APS_RDR_NOT_SENT_STATUS = 0x03
00996 } APS_RdrStatus_t;
00997
00998
00999
01000
01001 typedef struct
01002 {
01003 APS_RdrStatus_t status;
01004 } APS_RemoveDeviceConf_t;
01005
01006
01007
01008
01009
01010 typedef struct
01011 {
01012
01013 struct
01014 {
01015 void *next;
01016 } service;
01017
01018
01019 ExtAddr_t parentAddress;
01020 ExtAddr_t childAddress;
01021
01022
01023 APS_RemoveDeviceConf_t confirm;
01024 void (*APS_RemoveDeviceConf)(APS_RemoveDeviceConf_t *conf);
01025 } APS_RemoveDeviceReq_t;
01026
01027
01028
01029
01030
01031 typedef struct
01032 {
01033
01034 ExtAddr_t srcAddress;
01035 ExtAddr_t childAddress;
01036 } APS_RemoveDeviceInd_t;
01037
01038
01039
01040 #ifdef _HIGH_SECURITY_
01041
01042 typedef enum
01043 {
01044 APS_NETWORK_KEY_TYPE = 0x01,
01045 APS_APP_KEY_TYPE = 0x02
01046 } APS_RequestKeyType_t;
01047
01048 typedef enum
01049 {
01050 APS_RKR_SUCCESS_STATUS = 0x00,
01051 APS_RKR_NO_SHORT_ADDRESS_STATUS = 0x01,
01052 APS_RKR_SECURITY_FAIL_STATUS = 0x02,
01053 APS_RKR_NOT_SENT_STATUS = 0x03
01054 } APS_RkrStatus_t;
01055
01056
01057
01058 typedef struct
01059 {
01060 APS_RkrStatus_t status;
01061 } APS_RequestKeyConf_t;
01062
01063
01064
01065
01066 typedef struct
01067 {
01068
01069 struct
01070 {
01071 void *next;
01072 } service;
01073
01074
01075 ExtAddr_t destAddress;
01076 APS_RequestKeyType_t keyType;
01077 ExtAddr_t partnerAddress;
01078
01079
01080 APS_RequestKeyConf_t confirm;
01081 void (*APS_RequestKeyConf)(APS_RequestKeyConf_t *conf);
01082 } APS_RequestKeyReq_t;
01083
01084
01085
01086
01087 typedef struct
01088 {
01089
01090 ExtAddr_t srcAddress;
01091 APS_RequestKeyType_t keyType;
01092 ExtAddr_t partnerAddress;
01093 } APS_RequestKeyInd_t;
01094
01095 #endif //#ifdef _HIGH_SECURITY_
01096
01097
01098
01099
01100
01101
01102 typedef enum
01103 {
01104 APS_SKR_SUCCESS_STATUS = 0x00,
01105 APS_SKR_NO_SHORT_ADDRESS_STATUS = 0x01,
01106 APS_SKR_SECURITY_FAIL_STATUS = 0x02,
01107 APS_SKR_NOT_SENT_STATUS = 0x03
01108 } APS_SkrStatus_t;
01109
01110
01111
01112
01113 typedef struct
01114 {
01115 APS_SkrStatus_t status;
01116 } APS_SwitchKeyConf_t;
01117
01118
01119
01120
01121
01122 typedef struct
01123 {
01124
01125 struct
01126 {
01127 void *next;
01128 } service;
01129
01130
01131 ExtAddr_t destAddress;
01132 uint8_t keySeqNumber;
01133
01134
01135 APS_SwitchKeyConf_t confirm;
01136 void (*APS_SwitchKeyConf)(APS_SwitchKeyConf_t *conf);
01137 } APS_SwitchKeyReq_t;
01138
01139
01140
01141
01142
01143 typedef struct
01144 {
01145
01146 ExtAddr_t srcAddress;
01147 uint8_t keySeqNumber;
01148 } APS_SwitchKeyInd_t;
01149
01150
01151 #ifdef _HIGH_SECURITY_
01152
01153 typedef enum
01154 {
01155 APS_INITIATE_ACTION = 0x00,
01156 APS_RESPOND_ACCEPT_ACTION = 0x01,
01157 APS_RESPOND_REJECT_ACTION = 0x02
01158 } APS_AuthenticateAction_t;
01159
01160 typedef enum
01161 {
01162 APS_AUTH_SUCCESS_STATUS = 0x00,
01163 APS_AUTH_INVALID_PARAMETER_STATUS = 0x01,
01164 APS_AUTH_NO_KEY_STATUS = 0x02,
01165 APS_AUTH_NO_DATA_STATUS = 0x03,
01166 APS_AUTH_INVALID_CHALLENGE_STATUS = 0x04,
01167 APS_AUTH_INVALID_MAC_STATUS = 0x05,
01168 APS_AUTH_INVALID_KEY_STATUS = 0x06,
01169 APS_AUTH_TIMEOUT_STATUS = 0x07
01170 } APS_AuthenticateStatus_t;
01171
01172
01173
01174
01175 typedef struct
01176 {
01177
01178 ExtAddr_t address;
01179 APS_AuthenticateStatus_t status;
01180 } APS_AuthenticateConf_t;
01181
01182
01183
01184
01185
01186 typedef struct
01187 {
01188
01189 struct
01190 {
01191 void *next;
01192 } service;
01193
01194
01195 ExtAddr_t partnerAddress;
01196 APS_AuthenticateAction_t action;
01197 uint8_t randomChallenge[16];
01198
01199
01200 void (*APS_AuthenticateConf)(APS_AuthenticateConf_t *conf);
01201 APS_AuthenticateConf_t confirm;
01202 } APS_AuthenticateReq_t;
01203
01204
01205
01206
01207 typedef struct
01208 {
01209
01210 ExtAddr_t initiatorAddress;
01211 uint8_t randomChallenge[16];
01212 } APS_AuthenticateInd_t;
01213
01214 #endif //#ifdef _HIGH_SECURITY_
01215
01216
01217 #endif //#ifdef _SECURITY_
01218
01219
01220
01221
01222
01223
01224
01225
01226
01227
01228
01229
01230 typedef struct
01231 {
01232
01233 APS_Status_t status;
01234 } APS_ResetConf_t;
01235
01236
01237
01238
01239 typedef struct
01240 {
01241
01242 bool commissioning;
01243
01244 void (*APS_ResetConf)(APS_ResetConf_t *conf);
01245 APS_ResetConf_t confirm;
01246 } APS_ResetReq_t;
01247
01248
01249
01250
01251 typedef struct
01252 {
01253
01254 APS_Status_t status;
01255 } APS_StartConf_t;
01256
01257
01258
01259
01260 typedef struct
01261 {
01262
01263
01264
01265 void (*APS_StartConf)(APS_StartConf_t *conf);
01266 APS_StartConf_t confirm;
01267 } APS_StartReq_t;
01268
01269
01270
01271
01272
01273 typedef struct
01274 {
01275
01276 APS_Status_t status;
01277 } APS_StopConf_t;
01278
01279
01280
01281
01282
01283 typedef struct
01284 {
01285
01286
01287
01288 void (*APS_StopConf)(APS_StopConf_t *conf);
01289 APS_StopConf_t confirm;
01290 } APS_StopReq_t;
01291
01292
01293
01294
01295
01296
01297
01298
01299
01300
01301
01306 typedef struct
01307 {
01308
01310 struct
01311 {
01312 void *next;
01313 struct
01314 {
01315 uint8_t noIndication :1;
01316 uint8_t reserved :7;
01317 };
01318 } service;
01319
01320
01322 SimpleDescriptor_t *simpleDescriptor;
01324 void (*APS_DataInd)(APS_DataInd_t *ind);
01325 } APS_RegisterEndpointReq_t;
01326
01327
01332 typedef struct
01333 {
01334
01336 Endpoint_t endpoint;
01337 } APS_UnregisterEndpointReq_t;
01338
01339
01340
01341
01342
01343
01344
01345
01346
01347
01348
01349
01350
01351
01352
01353
01354
01355
01356
01357
01358
01359
01360
01361
01362
01363
01364
01365
01366
01367
01368 extern void APS_TaskHandler(void);
01369
01370
01371
01372 #ifdef _BINDING_
01373
01374
01375
01376 void APS_BindReq(APS_BindReq_t *req);
01377 void APS_UnbindReq(APS_UnbindReq_t *req);
01378 #endif //#ifdef _BINDING_
01379
01380
01381
01382
01383
01384
01391 extern void APS_GetReq(APS_GetReq_t *req);
01392
01393
01403 extern void APS_SetReq(APS_SetReq_t *req);
01404
01405
01406
01407
01408
01409
01410
01417 extern void APS_RegisterEndpointReq(APS_RegisterEndpointReq_t *req);
01418
01419
01426 extern void APS_UnregisterEndpointReq(APS_UnregisterEndpointReq_t *req);
01427
01428
01434 extern APS_RegisterEndpointReq_t *APS_GetEndpointList(void);
01435
01436
01443 extern void APS_StopEndpointIndication(Endpoint_t endpoint);
01444
01445
01452 extern void APS_ResumeEndpointIndication(Endpoint_t endpoint);
01453
01454
01455
01463 extern void APS_ResetReq(APS_ResetReq_t *req);
01464
01465
01470 extern void APS_Init(void);
01471
01472
01473
01478 extern void APS_StartReq(APS_StartReq_t *req);
01479
01480
01485 extern void APS_StopReq(APS_StopReq_t *req);
01486
01487
01488
01489
01490
01491
01492
01493
01504 extern void APS_DataReq(APS_DataReq_t *req);
01505
01506
01507 #ifdef _APS_MULTICAST_
01508
01509
01510
01511
01512
01523 extern void APS_AddGroupReq(APS_AddGroupReq_t *req);
01524
01525
01536 extern void APS_RemoveGroupReq(APS_RemoveGroupReq_t *req);
01537
01538
01550 extern void APS_RemoveAllGroupsReq(APS_RemoveAllGroupsReq_t *req);
01551
01552
01553
01567 APS_GroupTableEntry_t* APS_FindGroup(GroupAddr_t groupAddr, uint8_t *index);
01568
01569
01570 #endif
01571
01572
01573
01574 #ifdef _SECURITY_
01575
01576
01577
01578 extern void APS_DeleteLinkKeyAndResetCounters(ExtAddr_t *extAddr);
01579
01580
01581
01582
01583
01584
01585
01586
01587 extern bool APS_SetMasterKey(ExtAddr_t *extAddr, uint8_t *key);
01588
01589
01590
01591
01592
01593
01594
01595
01596 extern bool APS_SetLinkKey(ExtAddr_t *extAddr, uint8_t *key);
01597
01598 #ifdef _HIGH_SECURITY_
01599
01600 extern void APS_EstablishKeyReq(APS_EstablishKeyReq_t *req);
01601 extern void APS_EstablishKeyResp(APS_EstablishKeyResp_t *resp);
01602
01603 extern void APS_EstablishKeyInd(APS_EstablishKeyInd_t *ind);
01604
01605 #endif //#ifdef _HIGH_SECURITY_
01606
01607
01608
01609 extern void APS_TransportKeyReq(APS_TransportKeyReq_t *req);
01610
01611 extern void APS_TransportKeyInd(APS_TransportKeyInd_t *ind);
01612
01613
01614 extern void APS_UpdateDeviceReq(APS_UpdateDeviceReq_t *req);
01615
01616 extern void APS_UpdateDeviceInd(APS_UpdateDeviceInd_t *ind);
01617
01618
01619
01620 extern void APS_RemoveDeviceReq(APS_RemoveDeviceReq_t *req);
01621
01622 extern void APS_RemoveDeviceInd(APS_RemoveDeviceInd_t *ind);
01623
01624 #ifdef _HIGH_SECURITY_
01625
01626 extern void APS_RequestKeyReq(APS_RequestKeyReq_t *req);
01627
01628 extern void APS_RequestKeyInd(APS_RequestKeyInd_t *ind);
01629 #endif //#ifdef _HIGH_SECURITY_
01630
01631
01632 extern void APS_SwitchKeyReq(APS_SwitchKeyReq_t *req);
01633
01634 extern void APS_SwitchKeyInd(APS_SwitchKeyInd_t *ind);
01635
01636 #ifdef _HIGH_SECURITY_
01637
01638 extern void APS_AuthenticateReq(APS_AuthenticateReq_t *req);
01639
01640 extern void APS_AuthenticateInd(APS_AuthenticateInd_t *ind);
01641
01642
01643
01644 extern ApsKeyPairDescriptor_t *APS_GetKeyPairDescriptor(ExtAddr_t *address);
01645 extern uint8_t *APS_GetMasterKey(ApsKeyPairDescriptor_t *keyPairDescriptor);
01646 extern uint8_t *APS_GetLinkKey(ApsKeyPairDescriptor_t *keyPairDescriptor);
01647 extern bool APS_DeleteKeyPair(ExtAddr_t *extAddr);
01648 #endif //#ifdef _HIGH_SECURITY_
01649
01650 #endif
01651
01652
01653
01654
01655
01656
01657
01658
01659
01660
01661
01662 extern void NWK_DataInd(NWK_DataInd_t *req);
01663
01664
01665
01666
01667
01668
01669
01670 extern void NWK_DataConf(NWK_DataConf_t *req);
01671
01672
01673
01674
01675
01676
01677 extern void APS_ZdoDataInd(APS_DataInd_t *ind);
01678
01679
01680 extern void APS_CalculateTimes(void);
01681
01682 #endif //#ifndef _APS_H
01683
01684
01685