Enum lawn_protocol::protocol::ResponseCode
source · pub enum ResponseCode {
Show 18 variants
Success,
Continuation,
NeedsAuthentication,
Forbidden,
Closing,
Errno,
AuthenticationFailed,
Gone,
NotFound,
InternalError,
ChannelDead,
NotEnabled,
NotSupported,
ParametersNotSupported,
Invalid,
TooLarge,
TooManyMessages,
InvalidParameters,
}
Expand description
Overview
The protocol is relatively simple. Each request consists of a 32-bit size of the resulting message, a 32-bit request ID, a 32-bit message type, and an optional per-message CBOR blob representing message data. For performance and security reasons, the message size is limited to 2^24 in size. The size includes all fields other than the size.
Each response consists of a 32-bit size of the message, the 32-bit request ID, a 32-bit response code, and an optional per-response code CBOR blob.
The bottom 31 bits of the request ID may be any value; the response will use the same ID. No check is made for duplicates, so the requestor should prefer not repeating IDs that are in flight. The top bit is clear if the request is client-to-server request and it is set if the request is a server-to-client request. This helps eliminate confusion as to whether a message is a request or a response.
All data is serialized in a little-endian format. The response codes for the protocol.
The response codes are based around IMAP’s response codes, and the top two bytes of the response indicates the type:
- 0: success
- 1: no (roughly, the request was understood, but not completed)
- 2: bad (roughly, the request was not understood)
Variants§
Success
The request was successful. The response contains the requested data.
Continuation
The request is incomplete, but is so far successful. The request should continue, referencing the ID of the last request.
NeedsAuthentication
The request requires authentication.
The semantics for this message are equivalent to an HTTP 401 response.
Forbidden
The message was not allowed.
The semantics for this message are equivalent to an HTTP 403 response.
Closing
The server is shutting down.
Errno
The message failed for a system error reason.
This is generally only useful for certain types of channels.
AuthenticationFailed
Gone
The other end of the channel has disappeared.
NotFound
InternalError
ChannelDead
The channel has ceased to produce new data and this operation cannot complete.
NotEnabled
The message type was not enabled.
NotSupported
The message type was not supported.
ParametersNotSupported
The parameters were not supported.
Invalid
The message type was received, but was not valid.
TooLarge
The message was too large.
TooManyMessages
There are too many pending messages.
InvalidParameters
The parameters are supported, but not correct.
For example, if a selector is not valid for a channel, this message may be sent.
Trait Implementations§
source§impl Clone for ResponseCode
impl Clone for ResponseCode
source§fn clone(&self) -> ResponseCode
fn clone(&self) -> ResponseCode
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ResponseCode
impl Debug for ResponseCode
source§impl From<ResponseCode> for Error
impl From<ResponseCode> for Error
source§fn from(code: ResponseCode) -> Error
fn from(code: ResponseCode) -> Error
source§impl FromPrimitive for ResponseCode
impl FromPrimitive for ResponseCode
source§fn from_i64(n: i64) -> Option<Self>
fn from_i64(n: i64) -> Option<Self>
i64
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read moresource§fn from_u64(n: u64) -> Option<Self>
fn from_u64(n: u64) -> Option<Self>
u64
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read moresource§fn from_isize(n: isize) -> Option<Self>
fn from_isize(n: isize) -> Option<Self>
isize
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read moresource§fn from_i8(n: i8) -> Option<Self>
fn from_i8(n: i8) -> Option<Self>
i8
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read moresource§fn from_i16(n: i16) -> Option<Self>
fn from_i16(n: i16) -> Option<Self>
i16
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read moresource§fn from_i32(n: i32) -> Option<Self>
fn from_i32(n: i32) -> Option<Self>
i32
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read moresource§fn from_i128(n: i128) -> Option<Self>
fn from_i128(n: i128) -> Option<Self>
i128
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read moresource§fn from_usize(n: usize) -> Option<Self>
fn from_usize(n: usize) -> Option<Self>
usize
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read moresource§fn from_u8(n: u8) -> Option<Self>
fn from_u8(n: u8) -> Option<Self>
u8
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read moresource§fn from_u16(n: u16) -> Option<Self>
fn from_u16(n: u16) -> Option<Self>
u16
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read moresource§fn from_u32(n: u32) -> Option<Self>
fn from_u32(n: u32) -> Option<Self>
u32
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read moresource§fn from_u128(n: u128) -> Option<Self>
fn from_u128(n: u128) -> Option<Self>
u128
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read moresource§impl Ord for ResponseCode
impl Ord for ResponseCode
source§fn cmp(&self, other: &ResponseCode) -> Ordering
fn cmp(&self, other: &ResponseCode) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<ResponseCode> for ResponseCode
impl PartialEq<ResponseCode> for ResponseCode
source§fn eq(&self, other: &ResponseCode) -> bool
fn eq(&self, other: &ResponseCode) -> bool
source§impl PartialOrd<ResponseCode> for ResponseCode
impl PartialOrd<ResponseCode> for ResponseCode
source§fn partial_cmp(&self, other: &ResponseCode) -> Option<Ordering>
fn partial_cmp(&self, other: &ResponseCode) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more