Skip to main content

Module tftp

Module tftp 

Source
Expand description

TFTP (Trivial File Transfer Protocol) layer implementation.

Implements RFC 1350 TFTP packet parsing as a zero-copy view into a packet buffer.

TFTP operates over UDP port 69 and defines 5 packet types:

§Packet Types

OpcodeAbbreviationPacket Type
1RRQRead Request
2WRQWrite Request
3DATAData
4ACKAcknowledgment
5ERRORError

§Packet Formats

RRQ / WRQ:

2 bytes   string   1 byte   string   1 byte
+---------+--------+--------+--------+--------+
| Opcode  |Filename|   0    |  Mode  |   0    |
+---------+--------+--------+--------+--------+

DATA:

2 bytes   2 bytes   n bytes
+---------+---------+--------+
| Opcode  |  Block# |  Data  |
+---------+---------+--------+

ACK:

2 bytes   2 bytes
+---------+---------+
| Opcode  |  Block# |
+---------+---------+

ERROR:

2 bytes   2 bytes   string   1 byte
+---------+---------+--------+--------+
| Opcode  | ErrorCode| ErrMsg |   0    |
+---------+---------+--------+--------+

Re-exports§

pub use builder::TftpBuilder;

Modules§

builder
TFTP packet builder.

Structs§

TftpLayer
A zero-copy view into a TFTP layer within a packet buffer.

Constants§

ERR_ACCESS_VIOLATION
ERR_DISK_FULL
ERR_FILE_EXISTS
ERR_FILE_NOT_FOUND
ERR_ILLEGAL_OPERATION
ERR_NO_SUCH_USER
ERR_UNDEFINED
ERR_UNKNOWN_TID
OPCODE_ACK
OPCODE_DATA
OPCODE_ERROR
OPCODE_RRQ
OPCODE_WRQ
TFTP_DEFAULT_BLOCK_SIZE
Default TFTP data block size (bytes).
TFTP_MIN_HEADER_LEN
Minimum TFTP header: opcode (2 bytes).
TFTP_PORT
TFTP server UDP port.

Statics§

TFTP_FIELD_NAMES
Field names for Python/generic access.

Functions§

error_code_description
Returns a human-readable description for a TFTP error code.
is_tftp_payload
Returns true if buf looks like a TFTP payload.
opcode_name
Returns a human-readable name for a TFTP opcode.
tftp_show_fields
Display fields for TftpLayer in show() output.