openssh_sftp_client_lowlevel/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//! This crate provides a set of APIs to access the remote filesystem using
//! the sftp protocol and is implemented in pure Rust.
//!
//! It supports sending multiple requests concurrently using [`WriteEnd`]
//! (it can be [`WriteEnd::clone`]d), however receiving responses have to be done
//! sequentially using [`ReadEnd::read_in_one_packet`].
//!
//! To create [`WriteEnd`] and [`ReadEnd`], simply pass the `stdin` and `stdout` of
//! the `sftp-server` launched at remote to [`connect`].
//!
//! This crate supports all operations supported by sftp v3, in additional to
//! the following extensions:
//!  - [`WriteEnd::send_limits_request`]
//!  - [`WriteEnd::send_expand_path_request`]
//!  - [`WriteEnd::send_fsync_request`]
//!  - [`WriteEnd::send_hardlink_request`]
//!  - [`WriteEnd::send_posix_rename_request`]

pub use openssh_sftp_error::{Error, SftpErrMsg, SftpErrorKind, UnixTimeStampError};
pub use openssh_sftp_protocol::{
    file_attrs::{FileAttrs, FileType, Permissions, UnixTimeStamp},
    open_options::{CreateFlags, OpenOptions},
    request::OpenFileRequest,
    response::{Extensions, Limits, NameEntry},
    Handle, HandleOwned,
};

/// Default size of buffer for up/download in openssh-portable
pub const OPENSSH_PORTABLE_DEFAULT_COPY_BUFLEN: usize = 32768;

/// Default number of concurrent outstanding requests in openssh-portable
pub const OPENSSH_PORTABLE_DEFAULT_NUM_REQUESTS: usize = 64;

/// Minimum amount of data to read at a time in openssh-portable
pub const OPENSSH_PORTABLE_MIN_READ_SIZE: usize = 512;

/// Maximum depth to descend in directory trees in openssh-portable
pub const OPENSSH_PORTABLE_MAX_DIR_DEPTH: usize = 64;

/// Default length of download buffer in openssh-portable
pub const OPENSSH_PORTABLE_DEFAULT_DOWNLOAD_BUFLEN: usize = 20480;

/// Default length of upload buffer in openssh-portable
pub const OPENSSH_PORTABLE_DEFAULT_UPLOAD_BUFLEN: usize = 20480;

#[cfg(doc)]
/// Changelog for this crate.
pub mod changelog;

mod awaitable_responses;
pub use awaitable_responses::Id;

mod awaitables;
pub use awaitables::{
    AwaitableAttrs, AwaitableAttrsFuture, AwaitableData, AwaitableDataFuture, AwaitableHandle,
    AwaitableHandleFuture, AwaitableLimits, AwaitableLimitsFuture, AwaitableName,
    AwaitableNameEntries, AwaitableNameEntriesFuture, AwaitableNameFuture, AwaitableStatus,
    AwaitableStatusFuture, Data,
};

mod buffer;
pub use buffer::{Buffer, ToBuffer};

mod connection;
pub use connection::{connect, SharedData};

mod queue;
pub use queue::Queue;

mod read_end;
pub use read_end::ReadEnd;

mod reader_buffered;

mod write_end;
pub use write_end::WriteEnd;