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
//! TFTP (Trivial File Transfer Protocol) implementation
//!
//! This module implements the complete TFTP protocol, based on the following RFC standards:
//! - [RFC 1350](https://www.rfc-editor.org/rfc/rfc1350) TFTP Protocol version 2
//! - [RFC 2347](https://www.rfc-editor.org/rfc/rfc2347) TFTP Option Extension
//! - [RFC 2348](https://www.rfc-editor.org/rfc/rfc2348) Blocksize Option
//! - [RFC 2349](https://www.rfc-editor.org/rfc/rfc2349) Timeout and Transfer Size Options
//! - [RFC 7440](https://www.rfc-editor.org/rfc/rfc7440) Windowsize Option
//!
//! ## Module Structure
//!
//! ```text
//! tftp/
//! ├── core/ # Core protocol implementation
//! │ ├── packet # Packet serialization/deserialization
//! │ ├── socket # Socket abstraction layer
//! │ ├── options # Protocol options
//! │ ├── window # Windowed transfer
//! │ └── convert # Data conversion utilities
//! │
//! ├── server/ # TFTP server
//! │ ├── server # Main server logic
//! │ ├── worker # Transfer worker threads
//! │ └── config # Server configuration
//! │
//! └── client/ # TFTP client
//! └── ...
//! ```
//!
//! ## Usage Examples
//!
//! ### Start TFTP Server
//!
//! ```rust,no_run
//! use xtool::tftp::{server::Config, server::Server};
//! use std::path::PathBuf;
//!
//! let config = Config::with_defaults().merge_cli(
//! "0.0.0.0".to_string(),
//! 69,
//! PathBuf::from("/var/tftp"),
//! false,
//! false,
//! );
//!
//! let mut server = Server::new(&config).unwrap();
//! server.listen();
//! ```
// Submodules
// Re-export commonly used types for convenience