Change timeout in clinet from 1 secont to 2 seconds.
[platform/core/security/security-manager.git] / src / server / service / get-object-name.h
1 /*
2  *  Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *  Contact: Bumjin Im <bj.im@samsung.com>
5  *
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
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
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
17  */
18 /*
19  * @file        get-object-name.h
20  * @author      Jan Olszak (j.olszak@samsung.com)
21  * @version     1.0
22  * @brief       Implementation of api-get-object-name service.
23  */
24
25 #ifndef _SECURITY_SERVER_SERV_GET_OBJECT_NAME_
26 #define _SECURITY_SERVER_SERV_GET_OBJECT_NAME_
27
28 #include <service-thread.h>
29 #include <generic-socket-manager.h>
30
31 #include <dpl/serialization.h>
32 #include <message-buffer.h>
33
34 namespace SecurityServer {
35
36 class GetObjectNameService  :
37     public SecurityServer::GenericSocketService
38   , public SecurityServer::ServiceThread<GetObjectNameService>
39 {
40 public:
41     typedef std::map<int, MessageBuffer> MessageBufferMap;
42
43     ServiceDescriptionVector GetServiceDescription();
44
45     DECLARE_THREAD_EVENT(AcceptEvent, accept)
46     DECLARE_THREAD_EVENT(WriteEvent, write)
47     DECLARE_THREAD_EVENT(ReadEvent, process)
48     DECLARE_THREAD_EVENT(CloseEvent, close)
49
50     void accept(const AcceptEvent &event);
51     void write(const WriteEvent &event);
52     void process(const ReadEvent &event);
53     void close(const CloseEvent &event);
54
55 private:
56     std::string m_name;
57     bool processOne(const ConnectionID &conn, MessageBuffer &buffer);
58     int  setName(gid_t gid);
59     MessageBufferMap m_messageBufferMap;
60 };
61
62 } // namespace SecurityServer
63
64 #endif // _SECURITY_SERVER_SERV_GET_OBJECT_NAME_