smb_server/lib.rs
1//! SMB2/3 file-sharing server with pluggable storage backends.
2//!
3//! See `docs/superpowers/specs/2026-04-27-rust-smb-server-design.md` for the
4//! v1 design. The public API is small on purpose:
5//!
6//! ```no_run
7//! use smb_server::{SmbServer, Share, Access, ShareBackend};
8//! # async fn run<B: ShareBackend>(backend: B) -> Result<(), Box<dyn std::error::Error>> {
9//! SmbServer::builder()
10//! .listen("0.0.0.0:4445".parse()?)
11//! .user("alice", "password")
12//! .share(Share::new("home", backend).user("alice", Access::ReadWrite))
13//! .build()?
14//! .serve()
15//! .await?;
16//! # Ok(()) }
17//! ```
18
19mod backend;
20mod builder;
21pub(crate) mod conn;
22mod dispatch;
23mod error;
24#[cfg(feature = "localfs")]
25mod fs;
26mod handlers;
27pub(crate) mod info_class;
28pub mod ntstatus;
29mod path;
30mod proto;
31mod server;
32mod utils;
33
34pub use backend::{DirEntry, FileInfo, Handle, OpenIntent, OpenOptions, ShareBackend};
35pub use builder::{Access, Share};
36#[cfg(feature = "localfs")]
37pub use fs::LocalFsBackend;
38pub use proto::auth::ntlm::Identity;
39pub use server::{ConfigHandle, ShareMode, SmbServer};
40
41pub mod wire {
42 pub use crate::proto::header;
43 pub use crate::proto::messages;
44}
45
46#[cfg(test)]
47mod tests {
48 mod dynamic_config;
49 mod memfs;
50}