19 #ifndef MIR_CLIENT_RPC_MIR_PROTOBUF_RPC_CHANNEL_H_
20 #define MIR_CLIENT_RPC_MIR_PROTOBUF_RPC_CHANNEL_H_
26 #include <google/protobuf/service.h>
27 #include <google/protobuf/descriptor.h>
45 class DisplayConfiguration;
47 class LifecycleControl;
61 std::shared_ptr<SurfaceMap>
const& surface_map,
62 std::shared_ptr<DisplayConfiguration>
const& disp_config,
63 std::shared_ptr<RpcReport>
const& rpc_report,
64 std::shared_ptr<LifecycleControl>
const& lifecycle_control,
65 std::shared_ptr<EventSink>
const& event_sink);
78 virtual void CallMethod(
const google::protobuf::MethodDescriptor* method, google::protobuf::RpcController*,
79 const google::protobuf::Message* parameters, google::protobuf::Message* response,
80 google::protobuf::Closure* complete)
override;
82 std::shared_ptr<RpcReport>
const rpc_report;
85 static constexpr
size_t size_of_header = 2;
89 void receive_file_descriptors(google::protobuf::Message* response, google::protobuf::Closure* complete);
90 template<
class MessageType>
91 void receive_any_file_descriptors_for(MessageType* response);
92 void send_message(mir::protobuf::wire::Invocation
const& body,
93 mir::protobuf::wire::Invocation
const& invocation,
94 std::vector<mir::Fd>& fds);
97 void process_event_sequence(
std::string const& event);
99 void notify_disconnected();
101 std::shared_ptr<SurfaceMap> surface_map;
102 std::shared_ptr<DisplayConfiguration> display_configuration;
103 std::shared_ptr<LifecycleControl> lifecycle_control;
104 std::shared_ptr<EventSink> event_sink;
105 std::atomic<bool> disconnected;
106 std::mutex read_mutex;
107 std::mutex write_mutex;
116 std::unique_ptr<StreamTransport> transport;
All things Mir.
Definition: buffer_stream.h:37
void on_disconnected() override
Called by the Transport when the connection to the server has been broken.
Definition: mir_protobuf_rpc_channel.cpp:354
~MirProtobufRpcChannel()=default
Definition: mir_basic_rpc_channel.h:52
mir::dispatch::FdEvents relevant_events() const override
The set of file-descriptor events this Dispatchable handles.
Definition: mir_protobuf_rpc_channel.cpp:369
Definition: mir_basic_rpc_channel.h:91
bool dispatch(mir::dispatch::FdEvents events) override
Dispatch one pending event.
Definition: mir_protobuf_rpc_channel.cpp:364
MirProtobufRpcChannel(std::unique_ptr< StreamTransport > transport, std::shared_ptr< SurfaceMap > const &surface_map, std::shared_ptr< DisplayConfiguration > const &disp_config, std::shared_ptr< RpcReport > const &rpc_report, std::shared_ptr< LifecycleControl > const &lifecycle_control, std::shared_ptr< EventSink > const &event_sink)
Definition: mir_protobuf_rpc_channel.cpp:50
std::vector< uint8_t > SendBuffer
Definition: mir_basic_rpc_channel.h:50
Fd watch_fd() const override
Get a poll()able file descriptor.
Definition: mir_protobuf_rpc_channel.cpp:359
Definition: dispatchable.h:38
Definition: mir_protobuf_rpc_channel.h:54
uint32_t FdEvents
Definition: dispatchable.h:36
void on_data_available() override
Called by the Transport when data is available for reading.
Definition: mir_protobuf_rpc_channel.cpp:299
Observer of IO status.
Definition: stream_transport.h:87