19 #ifndef MIR_CLIENT_RPC_MIR_SOCKET_RPC_CHANNEL_H_
20 #define MIR_CLIENT_RPC_MIR_SOCKET_RPC_CHANNEL_H_
24 #include <boost/asio.hpp>
26 #include <google/protobuf/service.h>
27 #include <google/protobuf/descriptor.h>
44 class DisplayConfiguration;
46 class LifecycleControl;
56 std::shared_ptr<SurfaceMap>
const& surface_map,
57 std::shared_ptr<DisplayConfiguration>
const& disp_config,
58 std::shared_ptr<RpcReport>
const& rpc_report,
59 std::shared_ptr<LifecycleControl>
const& lifecycle_control);
62 std::shared_ptr<SurfaceMap>
const& surface_map,
63 std::shared_ptr<DisplayConfiguration>
const& disp_config,
64 std::shared_ptr<RpcReport>
const& rpc_report,
65 std::shared_ptr<LifecycleControl>
const& lifecycle_control);
71 virtual void CallMethod(
const google::protobuf::MethodDescriptor* method, google::protobuf::RpcController*,
72 const google::protobuf::Message* parameters, google::protobuf::Message* response,
73 google::protobuf::Closure* complete);
74 std::shared_ptr<RpcReport>
const rpc_report;
76 std::thread io_service_thread;
77 boost::asio::io_service io_service;
78 boost::asio::io_service::work work;
79 boost::asio::local::stream_protocol::socket socket;
81 static size_t const size_of_header = 2;
82 unsigned char header_bytes[size_of_header];
84 void receive_file_descriptors(google::protobuf::Message* response, google::protobuf::Closure* complete);
85 void receive_file_descriptors(std::vector<int> &fds);
86 void send_message(mir::protobuf::wire::Invocation
const& body,
detail::SendBuffer& buffer,
87 mir::protobuf::wire::Invocation
const& invocation);
88 void on_header_read(
const boost::system::error_code& error);
91 void process_event_sequence(std::string
const& event);
93 size_t read_message_header();
95 mir::protobuf::wire::Result read_message_body(
const size_t body_size);
96 void notify_disconnected();
98 std::shared_ptr<SurfaceMap> surface_map;
99 std::shared_ptr<DisplayConfiguration> display_configuration;
100 std::shared_ptr<LifecycleControl> lifecycle_control;
101 std::atomic<bool> disconnected;