• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "auth_common.h"
20 
21 #ifdef __cplusplus
22 #if __cplusplus
23 extern "C" {
24 #endif
25 #endif
26 
27 int32_t AuthMetaInit(const AuthTransCallback *callback);
28 void AuthMetaDeinit(void);
29 
30 int32_t AuthMetaStartVerify(uint32_t connectionId, const AuthKeyInfo *authKeyInfo, uint32_t requestId,
31     int32_t callingPid, const AuthVerifyCallback *callBack);
32 void AuthMetaReleaseVerify(int64_t authId);
33 
34 int32_t AuthMetaEncrypt(int64_t authId, const uint8_t *inData, uint32_t inLen,
35     uint8_t *outData, uint32_t *outLen);
36 int32_t AuthMetaDecrypt(int64_t authId, const uint8_t *inData, uint32_t inLen,
37     uint8_t *outData, uint32_t *outLen);
38 
39 int32_t AuthMetaGetPreferConnInfo(const char *uuid, AuthConnInfo *connInfo);
40 int32_t AuthMetaGetConnInfoBySide(const char *uuid, bool isClient, AuthConnInfo *connInfo);
41 int32_t AuthMetaOpenConn(const AuthConnInfo *info, uint32_t requestId, const AuthConnCallback *callback);
42 void AuthMetaNotifyDataReceived(uint32_t connectionId, const SocketPktHead *pktHead, const uint8_t *data);
43 void AuthMetaCloseConn(int64_t authId);
44 
45 int32_t AuthMetaPostTransData(int64_t authId, const AuthTransData *dataInfo);
46 int64_t AuthMetaGetIdByConnInfo(const AuthConnInfo *connInfo, bool isServer);
47 int64_t AuthMetaGetIdByUuid(const char *uuid, AuthLinkType type, bool isServer);
48 int32_t AuthMetaSetP2pMac(int64_t authId, const char *p2pMac);
49 int32_t AuthMetaGetConnInfo(int64_t authId, AuthConnInfo *connInfo);
50 int32_t AuthMetaGetServerSide(int64_t authId, bool *isServer);
51 int32_t AuthMetaGetDeviceUuid(int64_t authId, char *uuid, uint16_t size);
52 int32_t AuthMetaGetConnIdByInfo(const AuthConnInfo *connInfo, uint32_t *connectionId);
53 void DelAuthMetaManagerByPid(const char *pkgName, int32_t pid);
54 void AuthMetaCheckMetaExist(const AuthConnInfo *connInfo, bool *isExist);
55 void DelAuthMetaManagerByConnectionId(uint32_t connectionId);
56 
57 #ifdef __cplusplus
58 #if __cplusplus
59 }
60 #endif
61 #endif
62 #endif /* AUTH_META_MANAGER_H */
63