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 #define FIELD_RESULT_CODE "resultCode" 25 26 #define PEER_ACCOUNT_NOT_MATCH 0x7A00000F //2046820367 27 #define PEER_ACCOUNT_NOT_LOGIN 0x7A000023 //2046820387 28 #define PEER_ACCOUNT_NOT_REG 0x7A000022 //2046820386 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 void CreateAuthParamsList(ParamsVecForAuth *vec); 35 void DestroyAuthParamsList(ParamsVecForAuth *vec); 36 int32_t GetAuthParamsVec(int32_t osAccountId, const CJson *param, ParamsVecForAuth *authParamsVec); 37 int32_t CreateAndProcessAuthTask(CompatibleAuthSubSession *session, CJson *paramInSession, CJson *out, 38 int32_t *status); 39 void ClearCachedData(CJson *paramInSession); 40 int32_t ProcessClientAuthError(CompatibleAuthSubSession *session, const CJson *out); 41 void ProcessServerAuthError(CompatibleAuthSubSession *session, const CJson *out); 42 int32_t AddGroupAuthTransmitData(const CompatibleAuthSubSession *session, bool isClientFirst, CJson *sendToPeer); 43 int32_t HandleAuthTaskStatus(const CompatibleAuthSubSession *session, CJson *out, int32_t status, bool isClientFirst); 44 void NotifyPeerAuthError(const CJson *authParam, const DeviceAuthCallback *callback); 45 int32_t AuthOnNextGroupIfExist(CompatibleAuthSubSession *session); 46 47 #ifdef __cplusplus 48 } 49 #endif 50 51 #endif