2 * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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
17 * @file connection-thread.h
18 * @author Krzysztof Jackiewicz (k.jackiewicz@samsung.com)
27 #include <dpl/exception.h>
28 #include <noncopyable.h>
29 #include <client-common.h>
30 #include <async-request.h>
31 #include <descriptor-set.h>
36 class ConnectionThread
39 DECLARE_EXCEPTION_TYPE(CKM::Exception, PipeError)
42 virtual ~ConnectionThread();
44 NONCOPYABLE(ConnectionThread);
48 void sendMessage(AsyncRequest&& request);
50 bool finished() const { return m_finished; }
55 void newRequest(int pipe, short revents);
57 // reads notification pipe
58 void readPipe(int pipe, short revents);
60 Service& getService(const std::string& interface);
62 // Helper class that creates a pipe before thread is started
71 int output() const { return m_pipe[0]; }
78 AsyncRequest::Queue m_waitingReqs;
87 std::map<std::string, Service> m_services;
88 DescriptorSet m_descriptors;