Merge branch 'master' of github.sec.samsung.net:appfw/pkgmgr-info into tizen
[platform/core/appfw/pkgmgr-info.git] / src / server / request_handler / abstract_request_handler.hh
1 // Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by an apache-2.0 license that can be
3 // found in the LICENSE file.
4
5 #ifndef SERVER_ABSTRACT_REQUEST_HANDLER_HH_
6 #define SERVER_ABSTRACT_REQUEST_HANDLER_HH_
7
8 #include <string>
9
10 #include <sys/types.h>
11
12 #include <parcel.hh>
13
14 namespace pkgmgr_server {
15 namespace request_handler {
16
17 #ifndef EXPORT_API
18 #define EXPORT_API __attribute__((visibility("default")))
19 #endif
20
21 class EXPORT_API AbstractRequestHandler {
22  public:
23   virtual ~AbstractRequestHandler() = default;
24   virtual bool HandleRequest(unsigned char* data, int size, std::string locale) = 0;
25
26   virtual std::vector<uint8_t> ExtractResult() = 0;
27
28   void SetPID(pid_t pid);
29
30  protected:
31   pid_t GetPID();
32
33  private:
34   pid_t pid_;
35 };
36
37 }  // namespace request_handler
38 }  // namespace pkgmgr_server
39
40 #endif  // SERVER_ABSTRACT_REQUEST_HANDLER_HH_