Skip to main content

nfs_v3/
lib.rs

1//! NFS version 3 -- [RFC 1813], with the MOUNT v3 protocol it depends on.
2//!
3//! A complete NFSv3 client: all 22 procedures, all wire types, and the MOUNT
4//! sideband service that turns an export path into the root file handle
5//! everything else starts from.
6//!
7//! # Layers
8//!
9//! | Module | What it is |
10//! |--------|-----------|
11//! | [`wire`] | XDR types transcribed verbatim from the RFC |
12//! | [`Nfs3Client`] | One method per procedure, wire types in and out |
13//! | [`api`] | Domain types -- file handles, attributes, access bits |
14//! | [`Nfs3Error`] | Protocol status codes, classified |
15//!
16//! Pick a layer by what you are doing. Reading a file wants [`api`]. Sending a
17//! deliberately malformed request to see how a server reacts wants [`wire`]
18//! and the raw client, which will encode whatever you hand it.
19//!
20//! # Protocol properties worth knowing
21//!
22//! Two are load-bearing for anything security-related:
23//!
24//! * **File handles are bearer tokens.** A handle obtained under one
25//!   credential keeps working under any other (RFC 1813 sec. 2.6). The server
26//!   does not re-check how you got it. Handles can therefore be reused across
27//!   identity switches instead of re-resolving paths, and a handle guessed or
28//!   constructed rather than looked up is just as valid.
29//! * **`ACCESS` is advisory.** The server answers what it believes the caller
30//!   may do and is not required to be right (RFC 1813 sec. 3.3.4). It may
31//!   permit an operation here and refuse it for real, or the reverse. Confirm
32//!   by attempting the operation.
33//!
34//! [RFC 1813]: https://www.rfc-editor.org/rfc/rfc1813
35
36pub mod api;
37pub mod wire;
38
39mod error;
40mod raw;
41
42pub use api::{CreateMode, DirEntry, DirEntryPlus, DirPage, FileAttrs, FileHandle, FileType, FsInfo, FsStat, HexError, Nfs3Fault, NfsTime, ReadChunk, WriteAck, WriteStable, access};
43pub use error::Nfs3Error;
44pub use raw::Nfs3Client;
45pub use wire::{PROGRAM, VERSION};
46
47/// Re-export the MOUNT error from `nfswolf-mount` for backward compatibility.
48pub use nfs_mount::MountError;
49
50/// Re-export the MOUNT client from `nfswolf-mount` for backward compatibility.
51///
52/// `MountClient<T>` here is the unified mount client. New code should use
53/// `nfs_mount::MountClient` directly.
54pub type MountClient<T> = nfs_mount::MountClient<T>;