1 /*
2  * Copyright (C) 2023 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 COMPATIBLE_AUTH_SUB_SESSION_COMMON_H
17 #define COMPATIBLE_AUTH_SUB_SESSION_COMMON_H
18 
19 #include "compatible_auth_sub_session_defines.h"
20 
21 #define MIN_KEY_LENGTH 16
22 #define MAX_KEY_LENGTH 1024
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 void CreateAuthParamsList(ParamsVecForAuth *vec);
29 void DestroyAuthParamsList(ParamsVecForAuth *vec);
30 int32_t GetAuthParamsVec(int32_t osAccountId, const CJson *param, ParamsVecForAuth *authParamsVec);
31 int32_t CreateAndProcessAuthTask(CompatibleAuthSubSession *session, CJson *paramInSession, CJson *out,
32     int32_t *status);
33 void ClearCachedData(CJson *paramInSession);
34 int32_t ProcessClientAuthError(CompatibleAuthSubSession *session, const CJson *out);
35 void ProcessServerAuthError(CompatibleAuthSubSession *session, const CJson *out);
36 int32_t AddGroupAuthTransmitData(const CompatibleAuthSubSession *session, bool isClientFirst, CJson *sendToPeer);
37 int32_t HandleAuthTaskStatus(const CompatibleAuthSubSession *session, CJson *out, int32_t status, bool isClientFirst);
38 void NotifyPeerAuthError(const CJson *authParam, const DeviceAuthCallback *callback);
39 int32_t AuthOnNextGroupIfExist(CompatibleAuthSubSession *session);
40 
41 #ifdef __cplusplus
42 }
43 #endif
44 
45 #endif