• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 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 BIND_SESSION_COMMON_UTIL_H
17 #define BIND_SESSION_COMMON_UTIL_H
18 
19 #include "bind_session_common_defines.h"
20 
21 BindSession *CreateBaseBindSession(int32_t sessionType, int32_t opCode, const CJson *params,
22     const DeviceAuthCallback *callback, ProcessSessionFunc func);
23 void DestroyBindSession(Session *session);
24 void InitClientChannel(const DeviceAuthCallback *callback, const CJson *params, BindSession *session);
25 void InitServerChannel(const CJson *params, BindSession *session);
26 
27 bool IsAcceptRequest(const CJson *params);
28 int32_t CheckPeerStatus(const CJson *params, bool *isNeedInform);
29 int32_t SendBindSessionData(const BindSession *session, const CJson *sendData);
30 int32_t CreateAndProcessModule(BindSession *session, const CJson *in, CJson *out);
31 int32_t ProcessModule(const BindSession *session, const CJson *in, CJson *out, int32_t *status);
32 void InformPeerGroupErrorIfNeed(bool isNeedInform, int32_t errorCode, const BindSession *session);
33 void InformPeerModuleError(CJson *out, const BindSession *session);
34 #endif
35