feat: implement TFTP protocol crate (pfs-tftp-proto)
This commit introduces a sans-IO TFTP protocol implementation following RFC 1350. The protocol crate provides: - Packet types: RRQ, WRQ, DATA, ACK, ERROR with full serialization/parsing - Error codes as defined in RFC 1350 Appendix - Transfer modes: octet (binary) and netascii - Client and server state machines for managing protocol flow - Comprehensive tests for all packet types and state transitions The sans-IO design separates protocol logic from I/O operations, making the code testable and reusable across different I/O implementations. Key design decisions: - Mail mode is explicitly rejected as obsolete per RFC 1350 - Block numbers wrap around at 65535 for large file support - State machines emit events that tell the I/O layer what to do next - All protocol-specific values are documented with RFC citations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
22
crates/pfs-tftp/Cargo.toml
Normal file
22
crates/pfs-tftp/Cargo.toml
Normal file
@@ -0,0 +1,22 @@
|
||||
[package]
|
||||
name = "pfs-tftp"
|
||||
description = "TFTP client and server library (RFC 1350)"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
pfs-tftp-proto = { path = "../pfs-tftp-proto" }
|
||||
thiserror = "2"
|
||||
|
||||
[[bin]]
|
||||
name = "tftpd"
|
||||
path = "src/bin/tftpd.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "tftp"
|
||||
path = "src/bin/tftp.rs"
|
||||
Reference in New Issue
Block a user