1 /* 2 * Copyright (c) 2022 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_META_MANAGER_H 17 #define AUTH_META_MANAGER_H 18 19 #include <stdint.h> 20 #include <stdbool.h> 21 #include "auth_common.h" 22 #include "auth_interface.h" 23 24 #ifdef __cplusplus 25 #if __cplusplus 26 extern "C" { 27 #endif 28 #endif 29 30 int32_t AuthMetaInit(const AuthTransCallback *callback); 31 void AuthMetaDeinit(void); 32 33 int32_t AuthMetaStartVerify(uint32_t connectionId, const uint8_t *key, uint32_t keyLen, 34 uint32_t requestId, const AuthVerifyCallback *callBack); 35 void AuthMetaReleaseVerify(int64_t authId); 36 37 int32_t AuthMetaEncrypt(int64_t authId, const uint8_t *inData, uint32_t inLen, 38 uint8_t *outData, uint32_t *outLen); 39 int32_t AuthMetaDecrypt(int64_t authId, const uint8_t *inData, uint32_t inLen, 40 uint8_t *outData, uint32_t *outLen); 41 42 int32_t AuthMetaGetPreferConnInfo(const char *uuid, AuthConnInfo *connInfo); 43 int32_t AuthMetaOpenConn(const AuthConnInfo *info, uint32_t requestId, const AuthConnCallback *callback); 44 void AuthMetaCloseConn(int64_t authId); 45 46 int32_t AuthMetaPostTransData(int64_t authId, const AuthTransData *dataInfo); 47 int64_t AuthMetaGetIdByConnInfo(const AuthConnInfo *connInfo, bool isServer); 48 int64_t AuthMetaGetIdByP2pMac(const char *p2pMac, AuthLinkType type, bool isServer); 49 int32_t AuthMetaSetP2pMac(int64_t authId, const char *p2pMac); 50 int32_t AuthMetaGetConnInfo(int64_t authId, AuthConnInfo *connInfo); 51 int32_t AuthMetaGetServerSide(int64_t authId, bool *isServer); 52 int32_t AuthMetaGetDeviceUuid(int64_t authId, char *uuid, uint16_t size); 53 54 #ifdef __cplusplus 55 #if __cplusplus 56 } 57 #endif 58 #endif 59 #endif /* AUTH_META_MANAGER_H */ 60