๐Ÿ“ฆ haasal / tftp-packet-rs

โ˜… 0 stars โ‘‚ 0 forks ๐Ÿ‘ 0 watching โš–๏ธ MIT License
๐Ÿ“ฅ Clone https://github.com/haasal/tftp-packet-rs.git
HTTPS git clone https://github.com/haasal/tftp-packet-rs.git
SSH git clone git@github.com:haasal/tftp-packet-rs.git
CLI gh repo clone haasal/tftp-packet-rs
Alexander Haas Alexander Haas Fixed docs link 38546ae 3 years ago ๐Ÿ“ History
๐Ÿ“‚ master View all commits โ†’
๐Ÿ“ .vscode
๐Ÿ“ src
๐Ÿ“„ .gitignore
๐Ÿ“„ Cargo.toml
๐Ÿ“„ LICENSE
๐Ÿ“„ README.md
๐Ÿ“„ README.md

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

OpcodeFilename0Mode0
2 bytesstring1 bytestring1 byte
01 or 02 as u16"file" as [u8]0 as u8"octet" as [u8]0 as u8

DATA

OpcodeBlock #Data
2 bytes2 bytes0 - 512 bytes
03 as u161 - x as u16Data Chunk as [u8]
  • Block #: Increments with each block sent
  • Data: Transmission terminates automatically if Packet length < 512

ACK

OpcodeBlock #
2 bytes2 bytes
04 as u161 - x as u16

ERROR

OpcodeError CodeError Message0
2 bytes2 bytesstring1 byte
05 as u16x 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