You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.2 KiB
44 lines
1.2 KiB
//! Capabilities (permissions) of a connection.
|
|
use super::*;
|
|
use std::time::Duration;
|
|
|
|
/*
|
|
pub mod fail;
|
|
pub use fail::Failures;
|
|
|
|
/// How lenient to be with a certain operation
|
|
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, PartialOrd, Ord, Copy)]
|
|
pub enum Leniency
|
|
{
|
|
/// Ignore **all** malformed/missed messages.
|
|
Ignore,
|
|
/// Allow `n` failures before disconnecting the socket.
|
|
Specific(Failures),
|
|
/// Allow
|
|
Normal,
|
|
/// Immediately disconnect the socket on **any** malformed/missed message.
|
|
None,
|
|
}
|
|
*/
|
|
|
|
/// A capability (permission) for a raw socket's data transmission.
|
|
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
|
pub enum RawSockCapability
|
|
{
|
|
/// Process messages that aren't signed.
|
|
AllowUnsignedMessages,
|
|
|
|
/// Do not disconnect the socket when a malformed message is received, just ignore the message.
|
|
SoftFail,
|
|
|
|
/// Throttle the number of messages to process
|
|
RateLimit { tx: usize, rx: usize },
|
|
|
|
/// The request response timeout for messages with an expected response.
|
|
RecvRespTimeout { tx: Duration, rx: Duration },
|
|
|
|
/// Max number of bytes to read for a single message.
|
|
//TODO: Implement this for message
|
|
MaxMessageSize(usize),
|
|
}
|