Mir
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 graphics { class PlatformIpcOperations; }
30 namespace frontend
31 {
32 class MessageProcessorReport;
33 class ProtobufIpcFactory;
34 class SessionAuthorizer;
35 
36 namespace detail
37 {
38 class DisplayServer;
39 class SocketConnection;
40 class MessageProcessor;
41 class ProtobufMessageSender;
42 }
43 
45 {
46 public:
48  std::shared_ptr<ProtobufIpcFactory> const& ipc_factory,
49  std::shared_ptr<SessionAuthorizer> const& session_authorizer,
50  std::shared_ptr<graphics::PlatformIpcOperations> const& operations,
51  std::shared_ptr<MessageProcessorReport> const& report);
52  ~ProtobufConnectionCreator() noexcept;
53 
54  void create_connection_for(
55  std::shared_ptr<boost::asio::local::stream_protocol::socket> const& socket,
56  ConnectionContext const& connection_context) override;
57 
58  virtual std::shared_ptr<detail::MessageProcessor> create_processor(
59  std::shared_ptr<detail::ProtobufMessageSender> const& sender,
60  std::shared_ptr<detail::DisplayServer> const& display_server,
61  std::shared_ptr<MessageProcessorReport> const& report) const;
62 
63 private:
64  int next_id();
65 
66  std::shared_ptr<ProtobufIpcFactory> const ipc_factory;
67  std::shared_ptr<SessionAuthorizer> const session_authorizer;
68  std::shared_ptr<graphics::PlatformIpcOperations> const operations;
69  std::shared_ptr<MessageProcessorReport> const report;
70  std::atomic<int> next_session_id;
71  std::shared_ptr<detail::Connections<detail::SocketConnection>> const connections;
72 };
73 }
74 }
75 
76 #endif /* MIR_FRONTEND_PROTOBUF_CONNECTION_CREATOR_H_ */
All things Mir.
Definition: atomic_callback.h:25
Definition: connection_context.h:32
Definition: connection_creator.h:32
Definition: protobuf_connection_creator.h:44

Copyright © 2012-2015 Canonical Ltd.
Generated on Thu Sep 8 14:50:19 UTC 2016