use serde::{Deserialize, Serialize};
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub enum Outcome {
Success,
Failure,
Forward,
}
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub enum GenericOutcome<Reason> {
Success(Reason),
Failure(Reason),
Forward(Reason),
}
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub enum AccessStatus {
Granted,
Revoked,
Expired,
Denied,
Rejected,
InProgress,
AccpetedRAC,
RejectedRAC,
Unspecified,
}
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub enum CustomBool {
True,
False,
Unspecified,
}
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub enum DbOps {
RepoCreated,
RepoInitialized,
RepoAlreadyExists,
RepoEmpty,
RepoNotFound,
RepoDropped,
DbIntegrityConsistent,
DbIntegrityCorrupted,
DocumentIntegrityConsistent,
DocumentIntegrityCorrupted,
DbCreated,
DbFound,
DbAlreadyExists,
DbNotFound,
DbEmpty,
DbList(Vec<String>),
DbModified,
DbDropped,
DocumentCreated,
DocumentInserted,
DocumentFound,
DocumentEmpty,
DocumentList(Vec<String>),
DocumentAlreadyExists,
DocumentNotFound,
DocumentModified,
DocumentDropped,
FieldCreated,
FieldInserted,
FieldFound,
FieldAlreadyExists,
FieldNotFound,
FieldContents(Vec<u8>),
FieldList(Vec<Vec<u8>>),
FieldModified,
FieldDropped,
Created,
Commited,
UnCommited,
Inserted,
Changed,
Unchanged,
Skipped,
AlreadyExists,
Modified,
Swapped,
Deleted,
KeyFound,
KeyNotFound,
NotExecuted,
QueryConflictError,
Empty,
Queued,
DeQueued,
CompactionTrue,
CompactionFalse,
ConnRefused,
PortAddrInUse,
DriverError,
RuntimeError,
EncounteredErrors(String),
PermissionDenied,
ClusterOnline,
ClusterOffline,
ClusterSynced,
ClusterNodeAdded,
ConfigUpdated,
ClusterNodeDropped,
Logged,
NotLogged,
Interrupted,
Unspecified,
}
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub enum ExecCommand {
Queued,
DeQueued,
InProgress,
Paused,
Frozen,
Killed,
Executed,
Interrupted,
Unspecified,
}
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub enum FileOps {
DirCreated,
DirAccessDenied,
DirIsReadOnly,
DirectoryAppendOnly,
FileIsReadOnly,
FileIsAppendOnly,
DeletionDenied,
DeletionToBeDone,
ReadDone,
WriteDone,
AlreadyExists,
UpdateDone,
DeletionDone,
ReadInProgress,
WriteInProgess,
UpdateInProgress,
DeletionInProgress,
DirOpened,
DirClosed,
DirModified,
OpenedFile,
ClosedFile,
OpenError,
EncounteredErrors(String),
CreateDenied,
ReadDenied,
UpdateDenied,
WriteDenied,
AppendDenied,
MetadataAdded,
MetadataNotAvailable,
MetadataChanged,
MetadataDeleted,
OpenTrue,
OpenFalse,
CreateTrue,
CreateFalse,
WriteTrue,
WriteFalse,
AppendTrue,
Interrupted,
DeleteTrue,
}
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub enum Compression {
Done,
InProgress,
AlreadyCompressed,
Impossible,
ToBeDone,
StreamCompress,
Interrupted,
Unspecified,
}
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub enum Subscription {
Subscribed,
Unsubscribed,
NotActivated,
Unspecified,
}
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub enum ActivityStatus {
Activated,
Deactivated,
Unspecified,
}
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub enum ActivityToggle {
Activate,
Deactivate,
Unspecified,
}
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub enum Cli {
ParseInProgress,
ParseArgs,
ArgFieldParseInPorgress,
ParsedArgField,
ParseAsync,
ArgFieldAsyncParseInPorgress,
NotEnoughArgs,
EncounteredErrors(String),
}
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub enum DateTimeOp {
DateCreated,
DateDeleted,
DateModified,
DateUnspecified,
TimeCreated,
TimeDeleted,
TimeModified,
TimeUnspecified,
DateTimeUnspecified,
}
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub enum SecOps {
KeyCorrupted,
KeyAuthentic,
KeyInvalid,
TimedOut,
PossibleIdTheft,
DataCorrupted,
DataInvalid,
Encrypted,
KeyGenSucceded,
KeyGenFailed,
KeyDeleted,
CryptoRandomGenerated,
CryptoRandomGenFailure,
NonCryptoRandomGenerated,
NonCryptoRandomGenFailure,
AuthenticMAC,
InvalidMAC,
ValidRAC,
InvalidRAC,
KeyLengthSane,
KeyTooShort(KeyLength),
KeyTooLong(KeyLength),
}
impl std::fmt::Display for SecOps {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
SecOps::KeyCorrupted => write!(f, "Key could not be verified as it did not finish streaming"),
SecOps::KeyAuthentic => write!(f, "Key Authentic and approved"),
SecOps::KeyInvalid => write!(f, "Key has been tampered with"),
SecOps::TimedOut => write!(f, "Timed Out while verification was in progress"),
SecOps::PossibleIdTheft => write!(f, "Possible Identity Forgery"),
SecOps::DataCorrupted => write!(f, "Data encrypted has been corrupted"),
SecOps::DataInvalid => write!(f, "Data has been tampered with"),
SecOps::Encrypted => write!(f, "Data has been encrypted"),
SecOps::KeyGenSucceded => write!(f, "Key generation successful"),
SecOps::KeyGenFailed => write!(f, "Key generation failed"),
SecOps::KeyDeleted => write!(f, "Key has been deleted"),
SecOps::CryptoRandomGenerated => write!(f, "random data generated from Cryptographically Secure PRNG (CSPRNG)"),
SecOps::CryptoRandomGenFailure => write!(f, "random data generated from Cryptographically Secure PRNG (CSPRNG) was not generated"),
SecOps::NonCryptoRandomGenerated => write!(f, "random data generated from Noncryptographic PRNG"),
SecOps::NonCryptoRandomGenFailure => write!(f, "random data generated from Noncryptographic PRNG was not generated"),
SecOps::AuthenticMAC => write!(f, "Message Authentication Code is authentic"),
SecOps::InvalidMAC => write!(f, "Message Authentication Code is corrupted"),
SecOps::ValidRAC => write!(f, "Random Authentication Code (RAC) Token is genuine/authentic"),
SecOps::InvalidRAC => write!(f, "Random Authentication Code (RAC) Token is not genuine/authentic"),
SecOps::KeyLengthSane => write!(f, "Key Length is equal to the length needed by the cryptography algorithm"),
SecOps::KeyTooShort(_) => write!(f, "Key length too short"),
SecOps::KeyTooLong(_) => write!(f, "Key Length is too long"),
}
}
}
impl std::error::Error for SecOps {
fn description(&self) -> &str {
match self {
SecOps::KeyCorrupted => "Key could not be verified as it did not finish streaming",
SecOps::KeyAuthentic => "Key Authentic and approved",
SecOps::KeyInvalid => "Key has been tampered with",
SecOps::TimedOut => "Timed Out while verification was in progress",
SecOps::PossibleIdTheft => "Possible Identity Forgery",
SecOps::DataCorrupted => "Data encrypted has been corrupted",
SecOps::DataInvalid => "Data has been tampered with",
SecOps::Encrypted => "Data has been encrypted",
SecOps::KeyGenSucceded => "Key generation successful",
SecOps::KeyGenFailed => "Key generation failed",
SecOps::KeyDeleted => "Key has been deleted",
SecOps::CryptoRandomGenerated => "random data generated from Cryptographically Secure PRNG (CSPRNG)",
SecOps::CryptoRandomGenFailure => "random data generated from Cryptographically Secure PRNG (CSPRNG) was not generated",
SecOps::NonCryptoRandomGenerated => "random data generated from Noncryptographic PRNG",
SecOps::NonCryptoRandomGenFailure => "random data generated from Noncryptographic PRNG was not generated",
SecOps::AuthenticMAC => "Message Authentication Code is authentic",
SecOps::InvalidMAC => "Message Authentication Code is corrupted",
SecOps::ValidRAC => "Random Authentication Code (RAC) Token is genuine/authentic",
SecOps::InvalidRAC => "Random Authentication Code (RAC) Token is not genuine/authentic",
SecOps::KeyLengthSane => "Key Length is equal to the length needed by the cryptography algorithm",
SecOps::KeyTooShort(_) => "Key length too short",
SecOps::KeyTooLong(_) => "Key Length is too long",
}
}
fn cause(&self) -> Option<&dyn std::error::Error> {
match self {
SecOps::KeyCorrupted => Some(&SecOps::KeyCorrupted),
SecOps::KeyAuthentic => Some(&SecOps::KeyAuthentic),
SecOps::KeyInvalid => Some(&SecOps::KeyInvalid),
SecOps::TimedOut => Some(&SecOps::TimedOut),
SecOps::PossibleIdTheft => Some(&SecOps::PossibleIdTheft),
SecOps::DataCorrupted => Some(&SecOps::DataCorrupted),
SecOps::DataInvalid => Some(&SecOps::DataInvalid),
SecOps::Encrypted => Some(&SecOps::Encrypted),
SecOps::KeyGenSucceded => Some(&SecOps::KeyGenSucceded),
SecOps::KeyGenFailed => Some(&SecOps::KeyGenFailed),
SecOps::KeyDeleted => Some(&SecOps::KeyDeleted),
SecOps::CryptoRandomGenerated => Some(&SecOps::CryptoRandomGenerated),
SecOps::CryptoRandomGenFailure => Some(&SecOps::CryptoRandomGenFailure),
SecOps::NonCryptoRandomGenerated => Some(&SecOps::NonCryptoRandomGenFailure),
SecOps::NonCryptoRandomGenFailure => Some(&SecOps::NonCryptoRandomGenFailure),
SecOps::AuthenticMAC => Some(&SecOps::AuthenticMAC),
SecOps::InvalidMAC => Some(&SecOps::InvalidMAC),
SecOps::ValidRAC => Some(&SecOps::ValidRAC),
SecOps::InvalidRAC => Some(&SecOps::InvalidRAC),
SecOps::KeyLengthSane => Some(&SecOps::KeyLengthSane),
SecOps::KeyTooShort(ref length) => length.source(),
SecOps::KeyTooLong(ref length) => length.source(),
}
}
}
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub enum KeyLength {
Bytes8,
Bytes16,
Bytes24,
Bytes32,
Bytes64,
Bytes128,
Bytes256,
Bytes512,
Bytes1024,
Bytes2048,
Bytes4096,
}
impl std::fmt::Display for KeyLength {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
KeyLength::Bytes8 => write!(f, "KeyLength::Bytes8"),
KeyLength::Bytes16 => write!(f, "KeyLength::Bytes16"),
KeyLength::Bytes24 => write!(f, "KeyLength::Bytes24"),
KeyLength::Bytes32 => write!(f, "KeyLength::Bytes32"),
KeyLength::Bytes64 => write!(f, "KeyLength::Bytes64"),
KeyLength::Bytes128 => write!(f, "KeyLength::Bytes128"),
KeyLength::Bytes256 => write!(f, "KeyLength::Bytes256"),
KeyLength::Bytes512 => write!(f, "KeyLength::Bytes512"),
KeyLength::Bytes1024 => write!(f, "KeyLength::Bytes1024"),
KeyLength::Bytes2048 => write!(f, "KeyLength::Bytes2048"),
KeyLength::Bytes4096 => write!(f, "KeyLength::Bytes4096"),
}
}
}
impl std::error::Error for KeyLength {
fn description(&self) -> &str {
match self {
KeyLength::Bytes8 => "The key is not 8 bytes in length",
KeyLength::Bytes16 => "The key is not 16 bytes in length",
KeyLength::Bytes24 => "The key is not 24 bytes in length",
KeyLength::Bytes32 => "The key is not 32 bytes in length",
KeyLength::Bytes64 => "The key is not 64 bytes in length",
KeyLength::Bytes128 => "The key is not 128 bytes in length",
KeyLength::Bytes256 => "The key is not 256 bytes in length",
KeyLength::Bytes512 => "The key is not 512 bytes in length",
KeyLength::Bytes1024 => "The key is not 1024 bytes in length",
KeyLength::Bytes2048 => "The key is not 2048 bytes in length",
KeyLength::Bytes4096 => "The key is not 4096 bytes in length",
}
}
fn cause(&self) -> Option<&dyn std::error::Error> {
match self {
KeyLength::Bytes8 => Some(&KeyLength::Bytes8),
KeyLength::Bytes16 => Some(&KeyLength::Bytes16),
KeyLength::Bytes24 => Some(&KeyLength::Bytes24),
KeyLength::Bytes32 => Some(&KeyLength::Bytes32),
KeyLength::Bytes64 => Some(&KeyLength::Bytes64),
KeyLength::Bytes128 => Some(&KeyLength::Bytes128),
KeyLength::Bytes256 => Some(&KeyLength::Bytes256),
KeyLength::Bytes512 => Some(&KeyLength::Bytes512),
KeyLength::Bytes1024 => Some(&KeyLength::Bytes1024),
KeyLength::Bytes2048 => Some(&KeyLength::Bytes2048),
KeyLength::Bytes4096 => Some(&KeyLength::Bytes4096),
}
}
}
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub enum HardwareResources {
CpuUnderHeavyLoad,
RamUnderHeavyLoad,
CpuMaxed,
CpuOverclocked,
CpuUnderclocked,
CpuIdle,
CpuTempOk,
CpuThrottling,
EthernetDevUp,
EthernetDevDown,
EthernetDevAccessed,
CarrierDevUp,
CarrierDevDown,
CarrierDevChipMissing,
DriverMissing,
OpticDevUp,
OpticDevDown,
OpticalDevAccessed,
OpticalDevAccessDenied,
OpticalDevPoweredOff,
OticalDevChipMissing,
NfcDevUp,
NfcDevDown,
NfcDevActive,
NfcDevPaired,
NfcDevAccessed,
NfcDevDenied,
NfcDevClosed,
NfcDevPoweredOff,
WiFiDevUp,
WiFiDevDown,
WiFiDevAccessDenied,
WiFiDevPoweredOff,
WiFiDevAccessed,
WiFiDevHotSpotMode,
BluetoothDevUp,
BluetoothDevPaired,
BluetoothDevDevTrusted,
BluetoothDevDevUntrusted,
BluetoothDevAccessDenied,
BluetoothDevUnpaired,
BluetoothDevShareMode,
BluetoothDevSinkMode,
BluetoothDevTxMode,
BluetoothDevRxMode,
BluetoothDevClosed,
BluetoothDevPowerOff,
BluetoothDevDown,
UsbDevUp,
UsbDevDown,
UsbDevPoweredOff,
UsbDevAdded,
UsbDevTxMode,
UsbDevRxMode,
UsbDevRemoved,
UsbDevAccessDenied,
GpsDevUp,
GpsDevDown,
GpsDevTxMode,
GpsDevRxmode,
GpsDevAccessDenied,
AirplaneMode,
Unspecified,
}
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub enum Networking {
NetworkAccessDenied,
HostUnreachable,
ConnectionReset,
ConnectionAborted,
NotConnected,
HeadersCorrupted,
ServerNotResponding,
IpInUse,
PortInUse,
AddrInUse,
IpAvailable,
BrokenPipe,
NetConnExists,
InvalidNetInput,
InvalidNetData,
NetTimedOut,
Interrupted,
UnexpectedNetEof,
NetDriverBuggy,
Unspecified,
}
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub enum SecHardware {
UsbKeyUp,
UsbKeyDown,
UsbKeyDevTxMode,
UsbKeyDevRxMode,
UsbKeyDevAccessDenied,
FingerPrintDevUp,
FingerPrintDevDown,
FingerPrintDevPoweredOff,
FingerPrintDevTxMode,
FingerPrintDevRxMode,
FingerPrintDevAccessDenied,
IrisDevUp,
IrisDevDown,
IrisDevPoweredOff,
IrisDevTxMode,
IrisDevRxMode,
IrisDevAccessDenied,
IrFloodDevUp,
IrFloodDevDown,
IrFloodDevPoweredOff,
IrDevTxMode,
IrDevRxMode,
IrDevAccessDenied,
Unspecified,
}