Android-cuttlefish cvd tool
channel_sharedfd.h
Go to the documentation of this file.
1/*
2 * Copyright 2023 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
22
23namespace cuttlefish::transport {
24
25class SharedFdChannel : public Channel {
26 public:
27 explicit SharedFdChannel(Fd input_output);
28 explicit SharedFdChannel(Fd input, Fd output);
29 explicit SharedFdChannel(SharedFD input_output);
30 explicit SharedFdChannel(SharedFD input, SharedFD output);
31
32 Result<void> SendRequest(RawMessage& message) override;
33 Result<void> SendResponse(RawMessage& message) override;
35 Result<int> WaitForMessage() override;
36
37 private:
40
41 Result<void> SendMessage(RawMessage& message, bool response);
42};
43
44} // namespace cuttlefish::transport
Definition: fd.h:87
Definition: shared_fd.h:125
Definition: channel.h:66
Definition: channel_sharedfd.h:25
Result< void > SendMessage(RawMessage &message, bool response)
Definition: channel_sharedfd.cpp:91
Result< int > WaitForMessage() override
Definition: channel_sharedfd.cpp:79
SharedFD output_
Definition: channel_sharedfd.h:39
SharedFD input_
Definition: channel_sharedfd.h:38
SharedFdChannel(Fd input_output)
Definition: channel_sharedfd.cpp:38
Result< ManagedMessage > ReceiveMessage() override
Definition: channel_sharedfd.cpp:60
Result< void > SendRequest(RawMessage &message) override
Definition: channel_sharedfd.cpp:50
Result< void > SendResponse(RawMessage &message) override
Definition: channel_sharedfd.cpp:55
Definition: channel.cpp:27
tl::expected< T, StackTraceError< E > > Result
Definition: result_type.h:30
Definition: channel.h:34