aboutsummaryrefslogtreecommitdiffstats
path: root/src/configuration/error.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/configuration/error.rs')
-rw-r--r--src/configuration/error.rs28
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,
+ }
+ }
+}