00001
00017 #ifndef _APS_H
00018 #define _APS_H
00019
00020
00021
00022
00023 #include <types.h>
00024 #include <nwk.h>
00025 #include <appFramework.h>
00026 #include <macAddr.h>
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef APS_MAX_TRANSMISSION_WINDOW_SIZE
00035 #define APS_MAX_TRANSMISSION_WINDOW_SIZE 3
00036 #endif
00037
00038
00039
00040 #ifndef APS_MAX_BLOCKS_AMOUNT
00041 #define APS_MAX_BLOCKS_AMOUNT 3
00042 #endif
00043
00044
00045
00046
00047
00048
00049
00050
00051 #ifndef _HIGH_SECURITY_
00052 #define APS_MAX_DATA_FRAME_HEADER_LENGTH 12
00053
00054
00055 #define APS_MAX_DATA_FRAME_FOOTER_LENGTH 0
00056 #else
00057 #define APS_MAX_DATA_FRAME_HEADER_LENGTH (12 + 6)
00058
00059
00060 #define APS_MAX_DATA_FRAME_FOOTER_LENGTH 8
00061 #endif
00062
00063
00064 #define APS_AFFIX_LENGTH (APS_MAX_DATA_FRAME_HEADER_LENGTH + APS_MAX_DATA_FRAME_FOOTER_LENGTH + NWK_AFFIX_LENGTH)
00065
00066 #define APS_MAX_ASDU_SIZE (NWK_MAX_NSDU_SIZE - APS_MAX_DATA_FRAME_HEADER_LENGTH - APS_MAX_DATA_FRAME_FOOTER_LENGTH)
00067
00068 #define APS_ASDU_OFFSET (NWK_NSDU_OFFSET + APS_MAX_DATA_FRAME_HEADER_LENGTH)
00069
00070
00071
00072
00073
00074
00075
00076
00077 #define APS_BROADCAST_ENDPOINT 0xff
00078
00079
00080 #define APS_ZDO_ENDPOINT 0x00
00081
00082
00083 #define APS_MIN_USER_ENDPOINT 0x01
00084 #define APS_MAX_USER_ENDPOINT 0xf0
00085
00086
00087 #define APS_MIN_RESERVED_ENDPOINT 0xf1
00088 #define APS_MAX_RESERVED_ENDPOINT 0xfe
00089
00090
00091
00092
00093
00094
00095 #define APS_MAX_UNICAST_SHORT_ADDRESS 0xfff7
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00114 typedef union
00115 {
00116 ShortAddr_t shortAddress;
00117 #ifdef _APS_MULTICAST_
00118 GroupAddr_t groupAddress;
00119 #endif //
00120 ExtAddr_t extAddress;
00121 } APS_Address_t;
00122
00123
00124
00125
00132 typedef enum
00133 {
00134 APS_NO_ADDRESS = 0x00,
00135 #ifdef _APS_MULTICAST_
00136 APS_GROUP_ADDRESS = 0x01,
00137 #endif
00138 APS_SHORT_ADDRESS = 0x02,
00139 APS_EXT_ADDRESS = 0x03
00140 } APS_AddrMode_t;
00141
00142
00151 typedef enum
00152 {
00153 APS_SUCCESS_STATUS = 0x00,
00154 APS_ASDU_TOO_LONG_STATUS = 0xa0,
00155 APS_DEFRAG_DEFERRED_STATUS = 0xa1,
00156 APS_DEFRAG_UNSUPPORTED_STATUS = 0xa2,
00157 APS_ILLEGAL_REQUEST_STATUS = 0xa3,
00158 APS_INVALID_BINDING_STATUS = 0xa4,
00159 APS_INVALID_GROUP_STATUS = 0xa5,
00160 APS_INVALID_PARAMETER_STATUS = 0xa6,
00161 APS_NO_ACK_STATUS = 0xa7,
00162 APS_NO_BOUND_DEVICE_STATUS = 0xa8,
00163 APS_NO_SHORT_ADDRESS_STATUS = 0xa9,
00164 APS_NOT_SUPPORTED_STATUS = 0xaa,
00165 APS_SECURED_LINK_KEY_STATUS = 0xab,
00166 APS_SECURED_NWK_KEY_STATUS = 0xac,
00167 APS_SECURITY_FAIL_STATUS = 0xad,
00168 APS_TABLE_FULL_STATUS = 0xae,
00169 APS_UNSECURED_STATUS = 0xaf,
00170 APS_UNSUPPORTED_ATTRIBUTE_STATUS = 0xb0,
00171
00172
00173 APS_NOT_INDICATED_STATUS = 0xb1
00174 } APS_Status_t;
00175
00176 #ifdef _SECURITY_
00177
00186 typedef enum
00187 {
00188 APS_SKKE_SUCCESS_STATUS = 0x00,
00189 APS_SKKE_INVALID_PARAMETER_STATUS = 0x01,
00190 APS_SKKE_NO_MASTER_KEY_STATUS = 0x02,
00191 APS_SKKE_INVALID_CHALLENGE_STATUS = 0x03,
00192 APS_SKKE_INVALID_SKG_STATUS = 0x04,
00193 APS_SKKE_INVALID_MAC_STATUS = 0x05,
00194 APS_SKKE_INVALID_KEY_STATUS = 0x06,
00195 APS_SKKE_TIMEOUT_STATUS = 0x07,
00196 APS_SKKE_BAD_FRAME_STATUS = 0x08,
00197 } APS_SkkeStatus_t;
00198 #endif //#ifdef _SECURITY_
00199
00200
00209 typedef enum
00210 {
00211
00212 APS_AIB_BINDING_TABLE = 0xc1,
00213 APS_AIB_DESIGNATED_COORDINATOR = 0xc2,
00214 APS_AIB_CHANNEL_MASK = 0xc3,
00215 APS_AIB_USE_EXTENDED_PANID = 0xc4,
00216 APS_AIB_GROUP_TABLE = 0xc5,
00217 APS_AIB_NONMEMBER_RADIUS = 0xc6,
00218 APS_AIB_PERMISSIONS_CONFIGURATION = 0xc7,
00219 APS_AIB_USE_INSECURE_JOIN = 0xc8,
00220 APS_AIB_INTERFRAME_DELAY = 0xc9,
00221
00222
00223 APS_AIB_DEVICE_KEY_PAIR_SET = 0xaa,
00224 APS_AIB_TRUST_CENTER_ADDRESS = 0xab,
00225 APS_AIB_SECURITY_TIME_OUT_PERIOD = 0xac
00226 } APS_AibAttributeId_t;
00227
00228
00236 typedef struct
00237 {
00238 uint8_t apscMaxDescriptorSize;
00239 uint8_t apscMaxFrameRetries;
00240 uint32_t apscAckWaitDuration;
00241 uint8_t apscMinDuplicateRejectionTableSize;
00242 uint8_t apscMaxWindowSize;
00243 uint16_t apscInterframeDelay;
00244 uint8_t apscMinHeaderOverHead;
00245 } PACK APS_AibPermissionsConfiguration_t;
00246
00247
00248
00249
00250
00251
00253 typedef struct
00254 {
00255 bool busy;
00256 GroupAddr_t groupAddr;
00257 Endpoint_t endpoints[1];
00258 } PACK APS_GroupTableEntry_t;
00260
00261
00262
00263
00265 typedef struct
00266 {
00267 uint8_t groupsAmount;
00268 uint8_t endpointsAmount;
00269
00270 uint16_t entrySizeof;
00271 APS_GroupTableEntry_t *entries;
00272 } PACK APS_GroupTable_t;
00274
00275
00284 typedef union
00285 {
00286
00287
00288 void *apsBindingTable;
00289 bool apsDesignatedCoordinator;
00290 uint32_t apsChannelMask;
00291 uint64_t apsUseExtendedPANID;
00292 APS_GroupTable_t *apsGroupTable;
00293 uint8_t apsNonmemberRadius;
00294
00296 APS_AibPermissionsConfiguration_t *apsPermissionsConfiguration;
00297
00298 bool apsUseInsecureJoin;
00299 uint16_t apsInterframeDelay;
00300
00301
00302 void *apsDeviceKeyPairSet;
00303 uint64_t apsTrustCenterAddress;
00304 uint16_t apsSecurityTimeOutPeriod;
00305 } APS_AibAttribute_t;
00306
00307
00308
00309
00310
00311
00312
00313
00318 typedef struct
00319 {
00320
00321
00322
00323
00324
00325 APS_Status_t status;
00326
00327
00328 uint32_t txTime;
00329
00330 } PACK APS_DataConf_t;
00331
00332
00333
00337 typedef struct
00338 {
00339 uint8_t securityEnabledTransmission :1;
00340 uint8_t useNwkKey :1;
00341 uint8_t acknowledgedTransmission :1;
00342 uint8_t fragmentationPermitted :1;
00343 uint8_t reserved :4;
00344 } PACK APS_TxOptions_t;
00345
00346
00351 typedef struct
00352 {
00353
00355 struct
00356 {
00357 void *next;
00358 } service;
00359
00360
00371 APS_AddrMode_t dstAddrMode;
00375 APS_Address_t dstAddress;
00381 Endpoint_t dstEndpoint;
00383 ProfileId_t profileId;
00385 ClusterId_t clusterId;
00387 Endpoint_t srcEndpoint;
00392 uint8_t asduLength;
00394 uint8_t *asdu;
00404 APS_TxOptions_t txOptions;
00408 uint8_t radius;
00409
00411 void (*APS_DataConf)(APS_DataConf_t *conf);
00412 APS_DataConf_t confirm;
00413 } PACK APS_DataReq_t;
00414
00415
00416
00422 typedef struct
00423 {
00431 APS_AddrMode_t dstAddrMode;
00434 APS_Address_t dstAddress;
00436 Endpoint_t dstEndpoint;
00445 APS_AddrMode_t srcAddrMode;
00448 APS_Address_t srcAddress;
00451 Endpoint_t srcEndpoint;
00453 ProfileId_t profileId;
00455 ClusterId_t clusterId;
00457 uint8_t asduLength;
00459 uint8_t *asdu;
00461 APS_Status_t status;
00464 APS_Status_t securityStatus;
00466 uint8_t linkQuality;
00469 uint32_t rxTime;
00470
00471 uint8_t rssi;
00472
00473 } PACK APS_DataInd_t;
00474
00475
00476
00477 #ifdef _BINDING_
00478
00479
00480
00481
00482
00483
00484
00485
00486 typedef struct
00487 {
00488
00489 APS_Status_t status;
00490 } PACK APS_BindConf_t;
00491
00492
00493
00494
00495
00496
00497 typedef struct
00498 {
00499
00500 ExtAddr_t srcAddr;
00501 Endpoint_t srcEndpoint;
00502 ClusterId_t clusterId;
00503 APS_AddrMode_t dstAddrMode;
00504 APS_Address_t dstAddr;
00505 Endpoint_t dstEndpoint;
00506
00507 APS_BindConf_t confirm;
00508 } PACK APS_BindReq_t;
00509
00510
00511
00512
00513
00514
00515 typedef struct
00516 {
00517
00518 APS_Status_t status;
00519 } PACK APS_UnbindConf_t;
00520
00521
00522
00523
00524
00525
00526 typedef struct
00527 {
00528
00529 ExtAddr_t srcAddr;
00530 Endpoint_t srcEndpoint;
00531 ClusterId_t clusterId;
00532 APS_AddrMode_t dstAddrMode;
00533 APS_Address_t dstAddr;
00534 Endpoint_t dstEndpoint;
00535
00536 APS_UnbindConf_t confirm;
00537 } PACK APS_UnbindReq_t;
00538
00539
00540 #endif //#ifdef _BINDING_
00541
00542
00543
00544
00545
00546
00551 typedef struct
00552 {
00553
00555 APS_Status_t status;
00557 uint16_t aibAttributeLength;
00559 APS_AibAttribute_t aibAttributeValue;
00560 } PACK APS_GetConf_t;
00561
00562
00563
00568 typedef struct
00569 {
00570
00572 APS_AibAttributeId_t aibAttribute;
00573
00574
00576 APS_GetConf_t confirm;
00577 } PACK APS_GetReq_t;
00578
00579
00580
00585 typedef struct
00586 {
00587
00589 APS_Status_t status;
00590 } PACK APS_SetConf_t;
00591
00592
00593
00598 typedef struct
00599 {
00600
00602 APS_AibAttributeId_t aibAttribute;
00604 uint16_t aibAttributeLength;
00606 APS_AibAttribute_t aibAttributeValue;
00607
00608
00610 APS_SetConf_t confirm;
00611 } PACK APS_SetReq_t;
00612
00613
00614 #ifdef _APS_MULTICAST_
00615
00616
00617
00618
00619
00624 typedef struct
00625 {
00626
00628 APS_Status_t status;
00629 } PACK APS_AddGroupConf_t;
00630
00631
00636 typedef struct
00637 {
00638
00640 GroupAddr_t groupAddress;
00642 Endpoint_t endpoint;
00643
00644
00646 APS_AddGroupConf_t confirm;
00647 } PACK APS_AddGroupReq_t;
00648
00649
00650
00655 typedef struct
00656 {
00657
00659 APS_Status_t status;
00660 } PACK APS_RemoveGroupConf_t;
00661
00662
00667 typedef struct
00668 {
00669
00671 GroupAddr_t groupAddress;
00673 Endpoint_t endpoint;
00674
00675
00677 APS_RemoveGroupConf_t confirm;
00678 } PACK APS_RemoveGroupReq_t;
00679
00680
00681
00686 typedef struct
00687 {
00688
00690 APS_Status_t status;
00691 } PACK APS_RemoveAllGroupsConf_t;
00692
00693
00698 typedef struct
00699 {
00700
00702 Endpoint_t endpoint;
00703
00704
00706 APS_RemoveAllGroupsConf_t confirm;
00707 } PACK APS_RemoveAllGroupsReq_t;
00708
00709 #endif //#ifdef _APS_MULTICAST_
00710
00711
00712 #ifdef _SECURITY_
00713 #ifdef _HIGH_SECURITY_
00714 typedef struct PACK
00715 {
00716 ExtAddr_t deviceAddress;
00717 uint8_t masterKey[16];
00718 uint8_t linkKey[16];
00719 uint32_t outFrameCounter;
00720 uint32_t inFrameCounter;
00721 } ApsKeyPairDescriptor_t;
00722
00723
00724
00725
00726
00727
00728
00729 typedef enum
00730 {
00731 APS_SKKE_KEY_ESTABLISHMENT_METHOD = 0x00
00732 } APS_KeyEstablishmentMethod_t;
00733
00734
00735
00736
00737
00738 typedef struct
00739 {
00740 ExtAddr_t address;
00741 APS_SkkeStatus_t status;
00742 } PACK APS_EstablishKeyConf_t;
00743
00744
00745
00746
00747
00748
00749 typedef struct
00750 {
00751
00753 struct
00754 {
00755 void *next;
00756 } service;
00757
00758 ExtAddr_t responderAddress;
00759 bool useParent;
00760 ExtAddr_t responderParentAddress;
00761 APS_KeyEstablishmentMethod_t keyEstablishmentMethod;
00762
00763 APS_EstablishKeyConf_t confirm;
00764 void (*APS_EstablishKeyConf)(APS_EstablishKeyConf_t *conf);
00765 } PACK APS_EstablishKeyReq_t;
00766
00767
00768
00769
00770
00771 typedef struct
00772 {
00773 ExtAddr_t initiatorAddress;
00774 bool accept;
00775
00776 APS_EstablishKeyConf_t confirm;
00777 void (*APS_EstablishKeyConf)(APS_EstablishKeyConf_t *conf);
00778 } PACK APS_EstablishKeyResp_t;
00779
00780
00781
00782
00783
00784 typedef struct
00785 {
00786
00787 ExtAddr_t initiatorAddress;
00788 APS_KeyEstablishmentMethod_t keyEstablishmentMethod;
00789 } PACK APS_EstablishKeyInd_t;
00790 #endif //#ifdef _HIGH_SECURITY_
00791
00792
00793
00794
00795 typedef enum
00796 {
00797 APS_TRUST_CENTER_MASTER_KEY_TYPE = 0x00,
00798 APS_STANDARD_NETWORK_KEY_TYPE = 0x01,
00799 APS_APP_MASTER_KEY_TYPE = 0x02,
00800 APS_APP_LINK_KEY_TYPE = 0x03,
00801 APS_TRUST_CENTER_LINK_KEY_TYPE = 0x04,
00802 APS_HIGH_SECURITY_NETWORK_KEY_TYPE = 0x05
00803 } APS_TransportKeyType_t;
00804
00805
00806 typedef struct
00807 {
00808 ExtAddr_t parentAddress;
00809 uint8_t key[16];
00810 } PACK APS_ReqTrustCenterMasterOrLinkKeyTransportData_t;
00811
00812 typedef struct
00813 {
00814 uint8_t keySeqNumber;
00815 uint8_t networkKey[16];
00816 bool useParent;
00817 ExtAddr_t parentAddress;
00818 } PACK APS_ReqNetworkKeyTransportData_t;
00819
00820 typedef struct
00821 {
00822 ExtAddr_t partnerAddress;
00823 bool initiator;
00824 uint8_t key[16];
00825 } PACK APS_ReqApplicationMasterOrLinkKeyTransportData_t;
00826
00827 typedef union
00828 {
00829 APS_ReqTrustCenterMasterOrLinkKeyTransportData_t trustCenterKey;
00830 APS_ReqNetworkKeyTransportData_t networkKey;
00831 APS_ReqApplicationMasterOrLinkKeyTransportData_t applicationKey;
00832 } APS_ReqTransportKeyData_t;
00833
00834
00835 typedef enum
00836 {
00837 APS_TKR_SUCCESS_STATUS = 0x00,
00838 APS_TKR_NO_SHORT_ADDRESS_STATUS = 0x01,
00839 APS_TKR_SECURITY_FAIL_STATUS = 0x02,
00840 APS_TKR_NOT_SENT_STATUS = 0x03
00841 } APS_TkrStatus_t;
00842
00843
00844
00845
00846 typedef struct PACK
00847 {
00848 APS_TkrStatus_t status;
00849 } APS_TransportKeyConf_t;
00850
00851
00852
00853
00854 typedef struct
00855 {
00856
00857 struct
00858 {
00859 void *next;
00860 } service;
00861
00862
00863 ExtAddr_t destAddress;
00864 APS_TransportKeyType_t keyType;
00865 APS_ReqTransportKeyData_t transportKeyData;
00866
00867
00868 APS_TransportKeyConf_t confirm;
00869 void (*APS_TransportKeyConf)(APS_TransportKeyConf_t *conf);
00870 } PACK APS_TransportKeyReq_t;
00871
00872
00873
00874 typedef struct
00875 {
00876 uint8_t trustCenterMasterKey[16];
00877 } PACK APS_IndTrustCenterMasterOrLinkKeyTransportData_t;
00878
00879 typedef struct
00880 {
00881 uint8_t keySeqNumber;
00882 uint8_t networkKey[16];
00883 } PACK APS_IndNetworkKeyTransportData_t;
00884
00885 typedef struct
00886 {
00887 ExtAddr_t partnerAddress;
00888 uint8_t key[16];
00889 } PACK APS_IndApplicationMasterOrLinkKeyTransportData_t;
00890
00891 typedef union
00892 {
00893 APS_IndTrustCenterMasterOrLinkKeyTransportData_t trustCenterKey;
00894 APS_IndNetworkKeyTransportData_t networkKey;
00895 APS_IndApplicationMasterOrLinkKeyTransportData_t applicationKey;
00896 } APS_IndTransportKeyData_t;
00897
00898
00899
00900
00901
00902 typedef struct PACK
00903 {
00904
00905 ExtAddr_t srcAddress;
00906 APS_TransportKeyType_t keyType;
00907 APS_IndTransportKeyData_t transportKeyData;
00908 } APS_TransportKeyInd_t;
00909
00910
00911 typedef enum
00912 {
00913 APS_STANDARD_DEVICE_SECURED_REJOIN_STATUS = 0x00,
00914 APS_STANDARD_DEVICE_UNSECURED_JOIN_STATUS = 0x01,
00915 APS_DEVICE_LEFT_STATUS = 0x02,
00916 APS_STANDARD_DEVICE_UNSECURED_REJOIN_STATUS = 0x03,
00917 APS_HIGH_SECURITY_DEVICE_SECURED_REJOIN_STATUS = 0x04,
00918 APS_HIGH_SECURITY_DEVICE_UNSECURED_JOIN_STATUS = 0x05,
00919 APS_RESERVED_STATUS = 0x06,
00920 APS_HIGH_SECURITY_DEVICE_UNSECURED_REJOIN_STATUS = 0x07
00921 } APS_UpdateDeviceStatus_t;
00922
00923 typedef enum
00924 {
00925 APS_UDR_SUCCESS_STATUS = 0x00,
00926 APS_UDR_NO_SHORT_ADDRESS_STATUS = 0x01,
00927 APS_UDR_SECURITY_FAIL_STATUS = 0x02,
00928 APS_UDR_NOT_SENT_STATUS = 0x03
00929 } APS_UdrStatus_t;
00930
00931
00932
00933
00934 typedef struct PACK
00935 {
00936 APS_UdrStatus_t status;
00937 } APS_UpdateDeviceConf_t;
00938
00939
00940
00941
00942
00943 typedef struct
00944 {
00945
00946 struct
00947 {
00948 void *next;
00949 } service;
00950
00951
00952 ExtAddr_t destAddress;
00953 ExtAddr_t deviceAddress;
00954 APS_UpdateDeviceStatus_t status;
00955 ShortAddr_t deviceShortAddress;
00956
00957
00958 APS_UpdateDeviceConf_t confirm;
00959 void (*APS_UpdateDeviceConf)(APS_UpdateDeviceConf_t *conf);
00960 } PACK APS_UpdateDeviceReq_t;
00961
00962
00963
00964
00965
00966 typedef struct
00967 {
00968
00969 ExtAddr_t srcAddress;
00970 ExtAddr_t deviceAddress;
00971 APS_UpdateDeviceStatus_t status;
00972 ShortAddr_t deviceShortAddress;
00973 } PACK APS_UpdateDeviceInd_t;
00974
00975
00976 typedef enum
00977 {
00978 APS_RDR_SUCCESS_STATUS = 0x00,
00979 APS_RDR_NO_SHORT_ADDRESS_STATUS = 0x01,
00980 APS_RDR_SECURITY_FAIL_STATUS = 0x02,
00981 APS_RDR_NOT_SENT_STATUS = 0x03
00982 } APS_RdrStatus_t;
00983
00984
00985
00986
00987 typedef struct PACK
00988 {
00989 APS_RdrStatus_t status;
00990 } APS_RemoveDeviceConf_t;
00991
00992
00993
00994
00995
00996 typedef struct
00997 {
00998
00999 struct
01000 {
01001 void *next;
01002 } service;
01003
01004
01005 ExtAddr_t parentAddress;
01006 ExtAddr_t childAddress;
01007
01008
01009 APS_RemoveDeviceConf_t confirm;
01010 void (*APS_RemoveDeviceConf)(APS_RemoveDeviceConf_t *conf);
01011 } PACK APS_RemoveDeviceReq_t;
01012
01013
01014
01015
01016
01017 typedef struct
01018 {
01019
01020 ExtAddr_t srcAddress;
01021 ExtAddr_t childAddress;
01022 } PACK APS_RemoveDeviceInd_t;
01023
01024
01025
01026 #ifdef _HIGH_SECURITY_
01027
01028 typedef enum
01029 {
01030 APS_NETWORK_KEY_TYPE = 0x01,
01031 APS_APP_KEY_TYPE = 0x02
01032 } APS_RequestKeyType_t;
01033
01034 typedef enum
01035 {
01036 APS_RKR_SUCCESS_STATUS = 0x00,
01037 APS_RKR_NO_SHORT_ADDRESS_STATUS = 0x01,
01038 APS_RKR_SECURITY_FAIL_STATUS = 0x02,
01039 APS_RKR_NOT_SENT_STATUS = 0x03
01040 } APS_RkrStatus_t;
01041
01042
01043
01044 typedef struct PACK
01045 {
01046 APS_RkrStatus_t status;
01047 } APS_RequestKeyConf_t;
01048
01049
01050
01051
01052 typedef struct
01053 {
01054
01055 struct
01056 {
01057 void *next;
01058 } service;
01059
01060
01061 ExtAddr_t destAddress;
01062 APS_RequestKeyType_t keyType;
01063 ExtAddr_t partnerAddress;
01064
01065
01066 APS_RequestKeyConf_t confirm;
01067 void (*APS_RequestKeyConf)(APS_RequestKeyConf_t *conf);
01068 } PACK APS_RequestKeyReq_t;
01069
01070
01071
01072
01073 typedef struct
01074 {
01075
01076 ExtAddr_t srcAddress;
01077 APS_RequestKeyType_t keyType;
01078 ExtAddr_t partnerAddress;
01079 } PACK APS_RequestKeyInd_t;
01080
01081 #endif //#ifdef _HIGH_SECURITY_
01082
01083
01084
01085
01086
01087
01088 typedef enum
01089 {
01090 APS_SKR_SUCCESS_STATUS = 0x00,
01091 APS_SKR_NO_SHORT_ADDRESS_STATUS = 0x01,
01092 APS_SKR_SECURITY_FAIL_STATUS = 0x02,
01093 APS_SKR_NOT_SENT_STATUS = 0x03
01094 } APS_SkrStatus_t;
01095
01096
01097
01098
01099 typedef struct PACK
01100 {
01101 APS_SkrStatus_t status;
01102 } APS_SwitchKeyConf_t;
01103
01104
01105
01106
01107
01108 typedef struct
01109 {
01110
01111 struct
01112 {
01113 void *next;
01114 } service;
01115
01116
01117 ExtAddr_t destAddress;
01118 uint8_t keySeqNumber;
01119
01120
01121 APS_SwitchKeyConf_t confirm;
01122 void (*APS_SwitchKeyConf)(APS_SwitchKeyConf_t *conf);
01123 } PACK APS_SwitchKeyReq_t;
01124
01125
01126
01127
01128
01129 typedef struct
01130 {
01131
01132 ExtAddr_t srcAddress;
01133 uint8_t keySeqNumber;
01134 } PACK APS_SwitchKeyInd_t;
01135
01136
01137 #ifdef _HIGH_SECURITY_
01138
01139 typedef enum
01140 {
01141 APS_INITIATE_ACTION = 0x00,
01142 APS_RESPOND_ACCEPT_ACTION = 0x01,
01143 APS_RESPOND_REJECT_ACTION = 0x02
01144 } APS_AuthenticateAction_t;
01145
01146 typedef enum
01147 {
01148 APS_AUTH_SUCCESS_STATUS = 0x00,
01149 APS_AUTH_INVALID_PARAMETER_STATUS = 0x01,
01150 APS_AUTH_NO_KEY_STATUS = 0x02,
01151 APS_AUTH_NO_DATA_STATUS = 0x03,
01152 APS_AUTH_INVALID_CHALLENGE_STATUS = 0x04,
01153 APS_AUTH_INVALID_MAC_STATUS = 0x05,
01154 APS_AUTH_INVALID_KEY_STATUS = 0x06,
01155 APS_AUTH_TIMEOUT_STATUS = 0x07
01156 } APS_AuthenticateStatus_t;
01157
01158
01159
01160
01161 typedef struct
01162 {
01163
01164 ExtAddr_t address;
01165 APS_AuthenticateStatus_t status;
01166 } PACK APS_AuthenticateConf_t;
01167
01168
01169
01170
01171
01172 typedef struct
01173 {
01174
01175 struct
01176 {
01177 void *next;
01178 } service;
01179
01180
01181 ExtAddr_t partnerAddress;
01182 APS_AuthenticateAction_t action;
01183 uint8_t randomChallenge[16];
01184
01185
01186 void (*APS_AuthenticateConf)(APS_AuthenticateConf_t *conf);
01187 APS_AuthenticateConf_t confirm;
01188 } PACK APS_AuthenticateReq_t;
01189
01190
01191
01192
01193 typedef struct
01194 {
01195
01196 ExtAddr_t initiatorAddress;
01197 uint8_t randomChallenge[16];
01198 } PACK APS_AuthenticateInd_t;
01199
01200 #endif //#ifdef _HIGH_SECURITY_
01201
01202
01203
01204 #endif //#ifdef _SECURITY_
01205
01206
01207
01208
01209
01210
01211
01212
01213
01214
01215
01216
01217 typedef struct
01218 {
01219
01220 APS_Status_t status;
01221 } PACK APS_ResetConf_t;
01222
01223
01224
01225
01226 typedef struct
01227 {
01228
01229 bool commissioning;
01230
01231 void (*APS_ResetConf)(APS_ResetConf_t *conf);
01232 APS_ResetConf_t confirm;
01233 } PACK APS_ResetReq_t;
01234
01235
01236
01237
01238 typedef struct
01239 {
01240
01241 APS_Status_t status;
01242 } PACK APS_StartConf_t;
01243
01244
01245
01246
01247 typedef struct
01248 {
01249
01250
01251
01252 void (*APS_StartConf)(APS_StartConf_t *conf);
01253 APS_StartConf_t confirm;
01254 } PACK APS_StartReq_t;
01255
01256
01257
01258
01259
01260 typedef struct
01261 {
01262
01263 APS_Status_t status;
01264 } PACK APS_StopConf_t;
01265
01266
01267
01268
01269
01270 typedef struct
01271 {
01272
01273
01274
01275 void (*APS_StopConf)(APS_StopConf_t *conf);
01276 APS_StopConf_t confirm;
01277 } PACK APS_StopReq_t;
01278
01279
01280
01281
01282
01283
01284
01285
01286
01287
01288
01293 typedef struct
01294 {
01295
01297 struct
01298 {
01299 void *next;
01300 struct
01301 {
01302 uint8_t noIndication :1;
01303 uint8_t reserved :7;
01304 };
01305 } service;
01306
01307
01309 SimpleDescriptor_t *simpleDescriptor;
01311 void (*APS_DataInd)(APS_DataInd_t *ind);
01312 } PACK APS_RegisterEndpointReq_t;
01313
01314
01319 typedef struct
01320 {
01321
01323 Endpoint_t endpoint;
01324 } PACK APS_UnregisterEndpointReq_t;
01325
01326
01327
01328
01329
01330
01331
01332
01333
01334
01335
01336
01337
01338
01339
01340
01341
01342
01343
01344
01345
01346
01347
01348
01349
01350
01351
01352
01353
01354
01355 extern void APS_TaskHandler(void);
01356
01357
01358
01359 #ifdef _BINDING_
01360
01361
01362
01363 void APS_BindReq(APS_BindReq_t *req);
01364 void APS_UnbindReq(APS_UnbindReq_t *req);
01365 #endif //#ifdef _BINDING_
01366
01367
01368
01369
01370
01371
01378 extern void APS_GetReq(APS_GetReq_t *req);
01379
01380
01390 extern void APS_SetReq(APS_SetReq_t *req);
01391
01392
01393
01394
01395
01396
01397
01404 extern void APS_RegisterEndpointReq(APS_RegisterEndpointReq_t *req);
01405
01406
01413 extern void APS_UnregisterEndpointReq(APS_UnregisterEndpointReq_t *req);
01414
01415
01422 extern APS_RegisterEndpointReq_t *APS_GetEndpointList(void);
01423
01424
01431 extern void APS_StopEndpointIndication(Endpoint_t endpoint);
01432
01433
01440 extern void APS_ResumeEndpointIndication(Endpoint_t endpoint);
01441
01442
01443
01451 extern void APS_ResetReq(APS_ResetReq_t *req);
01452
01453
01462 extern void APS_Init(void);
01463
01464
01465
01470 extern void APS_StartReq(APS_StartReq_t *req);
01471
01472
01477 extern void APS_StopReq(APS_StopReq_t *req);
01478
01479
01480
01481
01482
01483
01484
01485
01496 extern void APS_DataReq(APS_DataReq_t *req);
01497
01498
01499 #ifdef _APS_MULTICAST_
01500
01501
01502
01503
01504
01515 extern void APS_AddGroupReq(APS_AddGroupReq_t *req);
01516
01517
01528 extern void APS_RemoveGroupReq(APS_RemoveGroupReq_t *req);
01529
01530
01542 extern void APS_RemoveAllGroupsReq(APS_RemoveAllGroupsReq_t *req);
01543
01544
01545
01559 APS_GroupTableEntry_t* APS_FindGroup(GroupAddr_t groupAddr, uint8_t *index);
01560
01561
01562 #endif
01563
01564
01565
01566 #ifdef _SECURITY_
01567
01568
01569
01570 extern void APS_DeleteLinkKeyAndResetCounters(ExtAddr_t *extAddr);
01571
01572
01573
01574
01575
01576
01577
01578
01579 extern bool APS_SetMasterKey(ExtAddr_t *extAddr, uint8_t *key);
01580
01581
01582
01583
01584
01585
01586
01587
01588 extern bool APS_SetLinkKey(ExtAddr_t *extAddr, uint8_t *key);
01589
01590 #ifdef _HIGH_SECURITY_
01591
01592 extern void APS_EstablishKeyReq(APS_EstablishKeyReq_t *req);
01593 extern void APS_EstablishKeyResp(APS_EstablishKeyResp_t *resp);
01594
01595 extern void APS_EstablishKeyInd(APS_EstablishKeyInd_t *ind);
01596
01597 #endif //#ifdef _HIGH_SECURITY_
01598
01599
01600
01601 extern void APS_TransportKeyReq(APS_TransportKeyReq_t *req);
01602
01603 extern void APS_TransportKeyInd(APS_TransportKeyInd_t *ind);
01604
01605
01606 extern void APS_UpdateDeviceReq(APS_UpdateDeviceReq_t *req);
01607
01608 extern void APS_UpdateDeviceInd(APS_UpdateDeviceInd_t *ind);
01609
01610
01611
01612 extern void APS_RemoveDeviceReq(APS_RemoveDeviceReq_t *req);
01613
01614 extern void APS_RemoveDeviceInd(APS_RemoveDeviceInd_t *ind);
01615
01616 #ifdef _HIGH_SECURITY_
01617
01618 extern void APS_RequestKeyReq(APS_RequestKeyReq_t *req);
01619
01620 extern void APS_RequestKeyInd(APS_RequestKeyInd_t *ind);
01621 #endif //#ifdef _HIGH_SECURITY_
01622
01623
01624 extern void APS_SwitchKeyReq(APS_SwitchKeyReq_t *req);
01625
01626 extern void APS_SwitchKeyInd(APS_SwitchKeyInd_t *ind);
01627
01628 #ifdef _HIGH_SECURITY_
01629
01630 extern void APS_AuthenticateReq(APS_AuthenticateReq_t *req);
01631
01632 extern void APS_AuthenticateInd(APS_AuthenticateInd_t *ind);
01633
01634
01635
01636 extern ApsKeyPairDescriptor_t *APS_GetKeyPairDescriptor(ExtAddr_t *address);
01637 extern uint8_t *APS_GetMasterKey(ApsKeyPairDescriptor_t *keyPairDescriptor);
01638 extern uint8_t *APS_GetLinkKey(ApsKeyPairDescriptor_t *keyPairDescriptor);
01639 extern bool APS_DeleteKeyPair(ExtAddr_t *extAddr);
01640 #endif //#ifdef _HIGH_SECURITY_
01641
01642 #endif
01643
01644
01645
01646
01647
01648
01649
01650
01651
01652
01653
01654 extern void NWK_DataInd(NWK_DataInd_t *req);
01655
01656
01657
01658
01659
01660
01661
01662 extern void NWK_DataConf(NWK_DataConf_t *req);
01663
01664
01665
01666
01667
01668
01669 extern void APS_ZdoDataInd(APS_DataInd_t *ind);
01670
01671
01672
01673 #endif //#ifndef _APS_H
01674
01675
01676