Mir
protobuf_message_processor.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2012. 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 
20 #ifndef MIR_FRONTEND_PROTOBUF_MESSAGE_PROCESSOR_H_
21 #define MIR_FRONTEND_PROTOBUF_MESSAGE_PROCESSOR_H_
22 
24 #include "mir_protobuf.pb.h"
25 #include <google/protobuf/stubs/common.h>
26 
27 #include <memory>
28 
29 namespace google { namespace protobuf { class MessageLite; } }
30 namespace mir
31 {
32 namespace frontend
33 {
34 class MessageProcessorReport;
35 
36 namespace detail
37 {
38 class DisplayServer;
39 class ProtobufMessageSender;
40 
42  public std::enable_shared_from_this<ProtobufMessageProcessor>
43 {
44 public:
46  std::shared_ptr<ProtobufMessageSender> const& sender,
47  std::shared_ptr<DisplayServer> const& display_server,
48  std::shared_ptr<MessageProcessorReport> const& report);
49 
51 
52  void client_pid(int pid) override;
53 
54  void send_response(google::protobuf::uint32 id, google::protobuf::MessageLite* response);
55  void send_response(google::protobuf::uint32 id, protobuf::Buffer* response);
56  void send_response(google::protobuf::uint32 id, protobuf::Connection* response);
57  void send_response(google::protobuf::uint32 id, protobuf::Surface* response);
58  void send_response(google::protobuf::uint32 id, std::shared_ptr<protobuf::Buffer> response);
59  void send_response(google::protobuf::uint32 id, mir::protobuf::Screencast* response);
60  void send_response(google::protobuf::uint32 id, mir::protobuf::BufferStream* response);
61  void send_response(google::protobuf::uint32 id, mir::protobuf::SocketFD* response);
62  void send_response(google::protobuf::uint32 id, std::shared_ptr<protobuf::PlatformOperationMessage> response);
63 
64 private:
65  bool dispatch(Invocation const& invocation, std::vector<mir::Fd> const& side_channel_fds) override;
66 
67  std::shared_ptr<ProtobufMessageSender> const sender;
68  std::shared_ptr<DisplayServer> const display_server;
69  std::shared_ptr<MessageProcessorReport> const report;
70 };
71 }
72 }
73 }
74 
75 #endif /* PROTOBUF_MESSAGE_PROCESSOR_H_ */
All things Mir.
Definition: atomic_callback.h:25
Definition: message_processor.h:40
Definition: protobuf_message_processor.h:41
Definition: message_processor.h:53
Definition: buffer_stream.h:37
~ProtobufMessageProcessor() noexcept
Definition: protobuf_message_processor.h:50

Copyright © 2012-2015 Canonical Ltd.
Generated on Wed Mar 30 00:29:56 UTC 2016