tftp-packet 0.1.0

A library for creating and parsing TFTP packets
Documentation
  • Coverage
  • 26.19%
    11 out of 42 items documented6 out of 9 items with examples
  • Size
  • Source code size: 20.8 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.89 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 16s Average build duration of successful builds.
  • all releases: 16s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • haasal/tftp-packet-rs
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • haasal

TFTP packet parser in Rust

Based on rfc 1350.

This is a simple library that parses tftp byte packets. See the [docs] for more information.

The tftp packet

WRQ/RRQ

Opcode Filename 0 Mode 0
2 bytes string 1 byte string 1 byte
01 or 02 as u16 "file" as [u8] 0 as u8 "octet" as [u8] 0 as u8

DATA

Opcode Block # Data
2 bytes 2 bytes 0 - 512 bytes
03 as u16 1 - x as u16 Data Chunk as [u8]
  • Block #: Increments with each block sent
  • Data: Transmission terminates automatically if Packet length < 512

ACK

Opcode Block #
2 bytes 2 bytes
04 as u16 1 - x as u16

ERROR

Opcode Error Code Error Message 0
2 bytes 2 bytes string 1 byte
05 as u16 x as u16 "msg" as [u8] 0as u8

Protocol

WRQ

sequenceDiagram
    participant Client
    participant Server

    Client->>Server: WRQ, TID=69

    Note right of Server: Block #35;: 0
    Server->>Client: ACK, TID=xyz

    loop TID=xyz
        Client-->>Server: DATA
        Server-->>Client: ACK
    end