diff options
author | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2019-11-03 18:33:49 +0100 |
---|---|---|
committer | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2019-11-03 18:33:49 +0100 |
commit | a0fa261a8a9542418072c42cfe73807d8d30cf88 (patch) | |
tree | 550af2cf98219323cda009fe76b81655d65719a8 /src/configuration/error.rs | |
parent | Work on configuration interface (diff) | |
download | wireguard-rs-a0fa261a8a9542418072c42cfe73807d8d30cf88.tar.xz wireguard-rs-a0fa261a8a9542418072c42cfe73807d8d30cf88.zip |
Work on UAPI parser
Diffstat (limited to 'src/configuration/error.rs')
-rw-r--r-- | src/configuration/error.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/configuration/error.rs b/src/configuration/error.rs new file mode 100644 index 0000000..74e2144 --- /dev/null +++ b/src/configuration/error.rs @@ -0,0 +1,28 @@ +pub enum ConfigError { + NoSuchPeer, + NotListening, + FailedToBind, + InvalidHexValue, + InvalidPortNumber, + InvalidFwmark, + InvalidKey, + UnsupportedValue, + UnsupportedProtocolVersion, +} + +impl ConfigError { + fn errno(&self) -> i32 { + // TODO: obtain the correct error values + match self { + ConfigError::NoSuchPeer => 1, + ConfigError::NotListening => 2, + ConfigError::FailedToBind => 3, + ConfigError::InvalidHexValue => 4, + ConfigError::InvalidPortNumber => 5, + ConfigError::InvalidFwmark => 6, + ConfigError::UnsupportedValue => 7, + ConfigError::InvalidKey => 8, + ConfigError::UnsupportedProtocolVersion => 9, + } + } +} |