Move function definition to aul header
[platform/core/appfw/aul-1.git] / src / app_request.h
1 /*
2  * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
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 #ifndef APP_REQUEST_H_
18 #define APP_REQUEST_H_
19
20 #include <bundle_cpp.h>
21 #include <bundle.h>
22 #include <string>
23
24 #include "aul.h"
25 #include "aul_sock.h"
26
27 namespace aul {
28 namespace internal {
29
30 class AppRequest {
31  public:
32   AppRequest(int cmd, uid_t uid);
33   AppRequest(int cmd);
34
35   AppRequest& With(tizen_base::Bundle b);
36   AppRequest& With(bundle* b);
37   AppRequest& SetAppId(const std::string& app_id);
38   AppRequest& SetInstId(const std::string& inst_id);
39   AppRequest& SetAppIdAsPid(pid_t pid);
40   AppRequest& SetPid(pid_t pid);
41   int Send(int opt = AUL_SOCK_QUEUE);
42   int SendSimply(int opt = AUL_SOCK_NONE);
43   int SendCmdOnly(int opt = AUL_SOCK_NONE);
44
45  private:
46   void ClearInternalKey();
47   void SetTime();
48   void SetUid(uid_t uid);
49
50  private:
51   int cmd_;
52   uid_t uid_;
53   tizen_base::Bundle bundle_;
54 };
55
56 }  // namespace internal
57 }  // namespace aul
58
59 #endif  // APP_REQUEST_H_