From 6b0cf95d75935308e142232fe646d56d0f9d418c Mon Sep 17 00:00:00 2001 From: Ren Kararou Date: Sat, 21 Dec 2024 14:14:35 -0600 Subject: start packet impl --- inc/packet.h | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 inc/packet.h (limited to 'inc') diff --git a/inc/packet.h b/inc/packet.h new file mode 100644 index 0000000..d5f341c --- /dev/null +++ b/inc/packet.h @@ -0,0 +1,51 @@ +#ifndef NBT_TFTP_PACKET_H +#define NBT_TFTP_PACKET_H + +#include + +typedef enum { + RRQ = 1, + WRQ = 2, + DAT = 3, + ACK = 4, + ERR = 5, +} nbt_tftp_opcode; + +typedef enum { + ERROR = 0, + ENOTFOUND = 1, + EACCESS = 2, + ENOSPACE = 3, + EOPERATION = 4, + ETRANS = 5, + EEXISTS = 6, + EUSER = 7, +} nbt_tftp_ecode; + +typedef struct { + nbt_tftp_opcode opcode; + char* filename; + char* mode; +} nbt_tftp_packet_rq; + +typedef struct { + nbt_tftp_opcode opcode; + uint16_t block_num; + char* data; +} nbt_tftp_packet_data; + +typedef struct { + nbt_tftp_opcode opcode; + uint16_t block_num; +} nbt_tftp_packet_ack; + +typedef struct { + nbt_tftp_opcode opcode; + nbt_tftp_ecode err; + char* emsg; +} nbt_tftp_packet_error; + + + +#endif + -- cgit 1.4.1-2-gfad0