summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Reedy <breed808@breed808.com>2018-04-14 11:27:25 +1000
committerBen Reedy <breed808@breed808.com>2018-04-14 11:27:25 +1000
commit9bdd43ea7cd47c9d498db5639a693e38671b8b55 (patch)
tree03fe14a2c6aeb88d63e720d7ae98117cc1eb27bd
parent00067c96dd60a1e7180895886f0bac3761a3f40c (diff)
downloadssh2-rs-9bdd43ea7cd47c9d498db5639a693e38671b8b55.zip
Add libssh2 SFTP error codes
-rw-r--r--libssh2-sys/lib.rs22
-rw-r--r--src/error.rs21
2 files changed, 43 insertions, 0 deletions
diff --git a/libssh2-sys/lib.rs b/libssh2-sys/lib.rs
index d216419..722ad16 100644
--- a/libssh2-sys/lib.rs
+++ b/libssh2-sys/lib.rs
@@ -96,6 +96,28 @@ pub const LIBSSH2_ERROR_ENCRYPT: c_int = -44;
pub const LIBSSH2_ERROR_BAD_SOCKET: c_int = -45;
pub const LIBSSH2_ERROR_KNOWN_HOSTS: c_int = -46;
+pub const LIBSSH2_FX_EOF: c_int = 1;
+pub const LIBSSH2_FX_NO_SUCH_FILE: c_int = 2;
+pub const LIBSSH2_FX_PERMISSION_DENIED: c_int = 3;
+pub const LIBSSH2_FX_FAILURE: c_int = 4;
+pub const LIBSSH2_FX_BAD_MESSAGE: c_int = 5;
+pub const LIBSSH2_FX_NO_CONNECTION: c_int = 6;
+pub const LIBSSH2_FX_CONNECTION_LOST: c_int = 7;
+pub const LIBSSH2_FX_OP_UNSUPPORTED: c_int = 8;
+pub const LIBSSH2_FX_INVALID_HANDLE: c_int = 9;
+pub const LIBSSH2_FX_NO_SUCH_PATH: c_int = 10;
+pub const LIBSSH2_FX_FILE_ALREADY_EXISTS: c_int = 11;
+pub const LIBSSH2_FX_WRITE_PROTECT: c_int = 12;
+pub const LIBSSH2_FX_NO_MEDIA: c_int = 13;
+pub const LIBSSH2_FX_NO_SPACE_ON_FILESYSTEM: c_int = 14;
+pub const LIBSSH2_FX_QUOTA_EXCEEDED: c_int = 15;
+pub const LIBSSH2_FX_UNKNOWN_PRINCIPAL: c_int = 16;
+pub const LIBSSH2_FX_LOCK_CONFLICT: c_int = 17;
+pub const LIBSSH2_FX_DIR_NOT_EMPTY: c_int = 18;
+pub const LIBSSH2_FX_NOT_A_DIRECTORY: c_int = 19;
+pub const LIBSSH2_FX_INVALID_FILENAME: c_int = 20;
+pub const LIBSSH2_FX_LINK_LOOP: c_int = 21;
+
pub const LIBSSH2_HOSTKEY_HASH_MD5: c_int = 1;
pub const LIBSSH2_HOSTKEY_HASH_SHA1: c_int = 2;
diff --git a/src/error.rs b/src/error.rs
index e402010..0911e57 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -97,6 +97,27 @@ impl Error {
raw::LIBSSH2_ERROR_ENCRYPT => "bad encrypt",
raw::LIBSSH2_ERROR_BAD_SOCKET => "bad socket",
raw::LIBSSH2_ERROR_KNOWN_HOSTS => "known hosts error",
+ raw::LIBSSH2_FX_EOF => "end of file",
+ raw::LIBSSH2_FX_NO_SUCH_FILE => "no such file",
+ raw::LIBSSH2_FX_PERMISSION_DENIED => "permission denied",
+ raw::LIBSSH2_FX_FAILURE => "failure",
+ raw::LIBSSH2_FX_BAD_MESSAGE => "bad message",
+ raw::LIBSSH2_FX_NO_CONNECTION => "no connection",
+ raw::LIBSSH2_FX_CONNECTION_LOST => "connection lost",
+ raw::LIBSSH2_FX_OP_UNSUPPORTED => "operation unsupported",
+ raw::LIBSSH2_FX_INVALID_HANDLE => "invalid handle",
+ raw::LIBSSH2_FX_NO_SUCH_PATH => "no such path",
+ raw::LIBSSH2_FX_FILE_ALREADY_EXISTS => "file already exists",
+ raw::LIBSSH2_FX_WRITE_PROTECT => "file is write protected",
+ raw::LIBSSH2_FX_NO_MEDIA => "no media available",
+ raw::LIBSSH2_FX_NO_SPACE_ON_FILESYSTEM => "no space on filesystem",
+ raw::LIBSSH2_FX_QUOTA_EXCEEDED => "quota exceeded",
+ raw::LIBSSH2_FX_UNKNOWN_PRINCIPAL => "unknown principal",
+ raw::LIBSSH2_FX_LOCK_CONFLICT => "lock conflict",
+ raw::LIBSSH2_FX_DIR_NOT_EMPTY => "directory not empty",
+ raw::LIBSSH2_FX_NOT_A_DIRECTORY => "not a directory",
+ raw::LIBSSH2_FX_INVALID_FILENAME => "invalid filename",
+ raw::LIBSSH2_FX_LINK_LOOP => "link loop",
_ => "unknown error"
};
Error::new(code, msg)