1 /*
2  * Copyright (c) 2024 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 IAM_REMOTE_CONNECT_MANAGER_H
17 #define IAM_REMOTE_CONNECT_MANAGER_H
18 
19 #include <cstdint>
20 #include <string>
21 
22 #include "attributes.h"
23 #include "iam_common_defines.h"
24 #include "iam_logger.h"
25 
26 #include "remote_connect_listener.h"
27 
28 #define LOG_TAG "USER_AUTH_SA"
29 namespace OHOS {
30 namespace UserIam {
31 namespace UserAuth {
32 class RemoteConnectionManager {
33 public:
34     static RemoteConnectionManager &GetInstance();
35     RemoteConnectionManager() = default;
36     virtual ~RemoteConnectionManager() = default;
37 
38     ResultCode OpenConnection(const std::string &connectionName,
39         std::string remoteNetworkId, uint32_t tokenId);
40     ResultCode CloseConnection(const std::string &connectionName);
41     ResultCode RegisterConnectionListener(const std::string &connectionName,
42         const std::string &endPointName, const std::shared_ptr<ConnectionListener> &listener);
43     ResultCode RegisterConnectionListener(const std::string &endPointName,
44         const std::shared_ptr<ConnectionListener> &listener);
45     ResultCode UnregisterConnectionListener(const std::string &connectionName,
46         const std::string &endPointName);
47     ResultCode UnregisterConnectionListener(const std::string &endPointName);
48     ResultCode SendMessage(const std::string &connectionName,
49         const std::string &srcEndPoint, const std::string &destEndPoint,
50         const std::shared_ptr<Attributes> &attributes, MsgCallback &callback);
51 };
52 } // namespace UserAuth
53 } // namespace UserIam
54 } // namespace OHOS
55 #endif // IAM_REMOTE_CONNECT_MANAGER_H
56