Refactor slp-pkgmgr with tidl
[platform/core/appfw/slp-pkgmgr.git] / installer / src / request.hh
1 /*
2  * Copyright (c) 2022 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17
18 #ifndef INSTALLER_SRC_REQUEST_H_
19 #define INSTALLER_SRC_REQUEST_H_
20
21 #include <map>
22 #include <memory>
23 #include <string>
24 #include <list>
25 #include <vector>
26
27 #include "PkgSignal.h"
28
29 namespace pkgmgr {
30 namespace installer {
31
32 class Control;
33 class Request {
34  public:
35   Request();
36   virtual ~Request();
37
38   int GetRequestType() const;
39   int GetMoveType() const;
40   void SetUpgrade(bool is_upgrade);
41   const std::string& GetRequestInfo() const;
42   const std::string& GetSessionId() const;
43   const std::string& GetLicensePath() const;
44   const std::string& GetOptionalData() const;
45   const std::string& GetCallerPkgid() const;
46   void SetUid(uid_t uid);
47   void SetRequestType(int type);
48   void SetSessionId(std::string id);
49   uid_t GetUid() const;
50   const std::string& GetTepPath() const;
51   bool IsUpgrade() const;
52   bool IsTepMove() const;
53   bool IsPreload() const;
54   bool IsForceRemoval() const;
55   bool IsPreloadRw() const;
56   bool IsNoRemoval() const;
57   bool IsKeepRwData() const;
58   bool IsPartialRw() const;
59   bool IsDebugMode() const;
60   bool IsSkipCheckReference() const;
61   bool IsSkipOptimization() const;
62   bool IsRecoveryCleanup() const;
63   const std::vector<std::string>& GetRequests() const;
64
65  private:
66   friend class Control;
67   int request_type_ = 0;
68   int move_type_ = 0;
69   bool is_upgrade_ = false;
70   std::string pkgmgr_info_;
71   std::string session_id_;
72   std::string license_path_;
73   std::string optional_data_;
74   std::string caller_pkgid_;
75   uid_t target_uid_ = 0;
76   std::string tep_path_;
77   bool tep_move_ = false;
78   bool is_preload_ = false;
79   bool force_removal_ = false;
80   bool is_preload_rw_ = false;
81   bool no_removal_ = false;
82   bool keep_rwdata_ = false;
83   bool partial_rw_ = false;
84   bool debug_mode_ = false;
85   bool skip_check_reference_ = false;
86   bool skip_optimization_ = false;
87   bool recovery_cleanup_ = false;
88   std::vector<std::string> pkgs_;
89 };
90
91 }  // namespace installer
92 }  // namespace pkgmgr
93
94 #endif  // INSTALLER_SRC_REQUEST_H_