1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef AUTH_DEVICE_H 17 #define AUTH_DEVICE_H 18 19 #include "auth_session_fsm.h" 20 21 #ifdef __cplusplus 22 #if __cplusplus 23 extern "C" { 24 #endif 25 #endif 26 27 #define RETRY_REGDATA_TIMES 3 28 #define RETRY_REGDATA_MILLSECONDS 300 29 #define UDID_SHORT_HASH_LEN_TEMP 8 30 #define SHORT_UDID_HASH_HEX_LEN 16 31 32 int32_t AuthDevicePostTransData(AuthHandle authHandle, const AuthTransData *dataInfo); 33 int32_t AuthDeviceEncrypt(AuthHandle *authHandle, const uint8_t *inData, uint32_t inLen, uint8_t *outData, 34 uint32_t *outLen); 35 int32_t AuthDeviceDecrypt(AuthHandle *authHandle, const uint8_t *inData, uint32_t inLen, uint8_t *outData, 36 uint32_t *outLen); 37 int32_t AuthDeviceGetConnInfo(AuthHandle authHandle, AuthConnInfo *connInfo); 38 int32_t AuthDeviceGetServerSide(int64_t authId, bool *isServer); 39 int32_t AuthDeviceGetDeviceUuid(int64_t authId, char *uuid, uint16_t size); 40 int32_t AuthDeviceGetVersion(int64_t authId, SoftBusVersion *version); 41 void AuthDeviceNotTrust(const char *udid); 42 int32_t AuthDirectOnlineCreateAuthManager(int64_t authSeq, const AuthSessionInfo *info); 43 int32_t AuthDeviceOpenConn(const AuthConnInfo *info, uint32_t requestId, const AuthConnCallback *callback); 44 void AuthDeviceCloseConn(AuthHandle authHandle); 45 int32_t AuthStartReconnectDevice( 46 AuthHandle authHandle, const AuthConnInfo *connInfo, uint32_t requestId, const AuthConnCallback *connCb); 47 void AuthNotifyDeviceVerifyPassed(AuthHandle authHandle, const NodeInfo *nodeInfo); 48 void AuthNotifyDeviceDisconnect(AuthHandle authHandle); 49 void AuthAddNodeToLimitMap(const char *udid, int32_t reason); 50 void AuthDeleteLimitMap(const char *udidHash); 51 int32_t AuthRegisterToDpDelay(void); 52 53 #ifdef __cplusplus 54 #if __cplusplus 55 } 56 #endif 57 #endif 58 #endif /* AUTH_DEVICE_H */ 59