Skip to main content

hanabi_core/protocol/request/
control.rs

1use serde::{Deserialize, Serialize};
2
3/// Request types related to the control channel.
4#[derive(Debug, Clone, Eq, PartialEq, Hash, Serialize, Deserialize)]
5pub enum ControlRequest {
6    /// Request used to create and open a new stream with the specified type.
7    OpenStream(StreamType),
8}
9
10/// Type of the stream to open.
11#[derive(Debug, Clone, Eq, PartialEq, Hash, Serialize, Deserialize)]
12pub enum StreamType {
13    /// Both the client and server can read and reply from the stream
14    /// this is used on parts of the protocol that need a communication
15    /// in a Request-Response fashion.
16    Bidirectional,
17
18    /// Stream where only the client is allowed to send messages and
19    /// only the server is allowed to read messages.
20    ClientStream,
21
22    /// Stream where only the server is allowed to send messages and
23    /// only the client is allowed to read messages.
24    ServerStream,
25}