2 * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd All Rights Reserved
4 * Contact: Bartlomiej Grzelewski <b.grzelewski@samsung.com>
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License
20 * @author Michal Witanowski (m.witanowski@samsung.com)
21 * @brief Implementation of installer service for libprivilege-control encapsulation.
24 #ifndef _SECURITY_SERVER_INSTALLER_
25 #define _SECURITY_SERVER_INSTALLER_
27 #include <service-thread.h>
28 #include <generic-socket-manager.h>
29 #include <message-buffer.h>
30 #include <connection-info.h>
32 namespace SecurityServer {
34 class InstallerException
37 DECLARE_EXCEPTION_TYPE(SecurityServer::Exception, Base)
38 DECLARE_EXCEPTION_TYPE(Base, InvalidAction)
41 class InstallerService :
42 public SecurityServer::GenericSocketService,
43 public SecurityServer::ServiceThread<InstallerService>
47 ServiceDescriptionVector GetServiceDescription();
49 DECLARE_THREAD_EVENT(AcceptEvent, accept)
50 DECLARE_THREAD_EVENT(WriteEvent, write)
51 DECLARE_THREAD_EVENT(ReadEvent, process)
52 DECLARE_THREAD_EVENT(CloseEvent, close)
54 void accept(const AcceptEvent &event);
55 void write(const WriteEvent &event);
56 void process(const ReadEvent &event);
57 void close(const CloseEvent &event);
60 ConnectionInfoMap m_connectionInfoMap;
63 * Handle request from a client
65 * @param conn Socket connection information
66 * @param buffer Raw received data buffer
67 * @param interfaceID identifier used to distinguish source socket
68 * @return true on success
70 bool processOne(const ConnectionID &conn, MessageBuffer &buffer, InterfaceID interfaceID);
73 * Process application installation
75 * @param buffer Raw received data buffer
76 * @param send Raw data buffer to be sent
77 * @return true on success
79 bool processAppInstall(MessageBuffer &buffer, MessageBuffer &send);
82 * Process libprivilege-control action and store result in a bufer
84 * @param buffer Raw received data buffer
85 * @param send Raw data buffer to be sent
86 * @return true on success
88 bool processAppUninstall(MessageBuffer &buffer, MessageBuffer &send);
91 } // namespace SecurityServer
93 #endif // _SECURITY_SERVER_INSTALLER_