Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
protobuf_connection_creator.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2013-2014 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 3,
6  * as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Alan Griffiths <alan@octopull.co.uk>
17  */
18 
19 #ifndef MIR_FRONTEND_PROTOBUF_CONNECTION_CREATOR_H_
20 #define MIR_FRONTEND_PROTOBUF_CONNECTION_CREATOR_H_
21 
24 
25 #include <atomic>
26 
27 namespace mir
28 {
29 namespace frontend
30 {
31 class MessageProcessorReport;
32 class ProtobufIpcFactory;
33 class SessionAuthorizer;
34 
35 namespace detail
36 {
37 class DisplayServer;
38 class SocketConnection;
39 class MessageProcessor;
40 class ProtobufMessageSender;
41 }
42 
44 {
45 public:
47  std::shared_ptr<ProtobufIpcFactory> const& ipc_factory,
48  std::shared_ptr<SessionAuthorizer> const& session_authorizer,
49  std::shared_ptr<MessageProcessorReport> const& report);
50  ~ProtobufConnectionCreator() noexcept;
51 
53  std::shared_ptr<boost::asio::local::stream_protocol::socket> const& socket,
54  ConnectionContext const& connection_context) override;
55 
56  virtual std::shared_ptr<detail::MessageProcessor> create_processor(
57  std::shared_ptr<detail::ProtobufMessageSender> const& sender,
58  std::shared_ptr<detail::DisplayServer> const& display_server,
59  std::shared_ptr<MessageProcessorReport> const& report) const;
60 
61 private:
62  int next_id();
63 
64  std::shared_ptr<ProtobufIpcFactory> const ipc_factory;
65  std::shared_ptr<SessionAuthorizer> const session_authorizer;
66  std::shared_ptr<MessageProcessorReport> const report;
67  std::atomic<int> next_session_id;
68  std::shared_ptr<detail::Connections<detail::SocketConnection>> const connections;
69 };
70 }
71 }
72 
73 #endif /* MIR_FRONTEND_PROTOBUF_CONNECTION_CREATOR_H_ */
All things Mir.
Definition: aging_buffer.h:24
virtual std::shared_ptr< detail::MessageProcessor > create_processor(std::shared_ptr< detail::ProtobufMessageSender > const &sender, std::shared_ptr< detail::DisplayServer > const &display_server, std::shared_ptr< MessageProcessorReport > const &report) const
Definition: protobuf_connection_creator.cpp:84
void create_connection_for(std::shared_ptr< boost::asio::local::stream_protocol::socket > const &socket, ConnectionContext const &connection_context) override
Definition: protobuf_connection_creator.cpp:58
Definition: connection_context.h:32
~ProtobufConnectionCreator() noexcept
Definition: protobuf_connection_creator.cpp:48
Definition: connection_creator.h:32
Definition: protobuf_connection_creator.h:43
ProtobufConnectionCreator(std::shared_ptr< ProtobufIpcFactory > const &ipc_factory, std::shared_ptr< SessionAuthorizer > const &session_authorizer, std::shared_ptr< MessageProcessorReport > const &report)
Definition: protobuf_connection_creator.cpp:36

Copyright © 2012,2013 Canonical Ltd.
Generated on Fri Oct 10 14:07:14 UTC 2014