2 * Copyright (c) 2022 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #ifndef CLIENT_SRC_CONNECTOR_H_
19 #define CLIENT_SRC_CONNECTOR_H_
27 #include "PkgMgrProxy.h"
29 #include "connection_event_listener.hh"
30 #include "signal_receiver.hh"
35 namespace pkg_proxy = rpc_port::PkgMgrProxy::proxy;
36 namespace pp = rpc_port::PkgMgrProxy;
40 Connector(pkgmgr_client_type pc_type) : pc_type_(pc_type) {}
43 virtual pkg_proxy::PkgMgrAdmin* GetAdminProxy();
44 virtual pkg_proxy::PkgMgr* GetInfoProxy();
45 virtual pkg_proxy::PkgMgrForClearCache* GetCacheProxy();
46 virtual pkg_proxy::DelayedResult* GetDelayedResultProxy();
47 virtual const std::unique_ptr<SignalReceiver>& GetSignalReceiver();
48 std::string GenerateRequestId() const;
49 void SetTep(std::string tep_path, bool tep_move);
52 void SetSkipOptimization();
53 const std::vector<std::string>& GetArgv() const;
54 pkgmgr_client_type GetPcType() const;
55 std::vector<std::string>& GetResRemovePath();
56 std::vector<std::string>& GetResCreateDir();
57 std::vector<pp::ResPath>& GetResCopyPath();
58 const std::string& GetTepPath();
62 bool ConnectForAdmin();
63 bool ConnectForInfo();
64 bool ConnectForCache();
65 bool ConnectForDelayedResult();
70 Activator() : fd_(-1), addr_{} {}
74 void SetTimeout(int timeout_msec);
83 pkgmgr_client_type pc_type_;
84 std::unique_ptr<pkg_proxy::PkgMgr> info_proxy_;
85 std::unique_ptr<pkg_proxy::PkgMgrForClearCache> cache_proxy_;
86 std::unique_ptr<pkg_proxy::PkgMgrAdmin> admin_proxy_;
87 std::unique_ptr<pkg_proxy::DelayedResult> delayed_result_proxy_;
88 std::vector<std::string> argv_;
89 ConnectionEventListener<pkg_proxy::PkgMgrAdmin> conn_admin_listener_;
90 ConnectionEventListener<pkg_proxy::PkgMgr> conn_info_listener_;
91 ConnectionEventListener<pkg_proxy::PkgMgrForClearCache> conn_cache_listener_;
92 ConnectionEventListener<pkg_proxy::DelayedResult> conn_delayed_result_listener_;
93 std::unique_ptr<SignalReceiver> signal_receiver_;
94 std::vector<std::string> res_remove_path_;
95 std::vector<std::string> res_create_dir_;
96 std::vector<pp::ResPath> res_copy_path_;
97 std::string tep_path_;
98 bool tep_move_ = false;
102 } // namespace client
103 } // namespace pkgmgr
105 #endif // CLIENT_SRC_CONNECTOR_H_