about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorRen Kararou <[email protected]>2024-12-21 14:14:35 -0600
committerRen Kararou <[email protected]>2024-12-21 14:14:35 -0600
commit6b0cf95d75935308e142232fe646d56d0f9d418c (patch)
tree7135f345c5d53ee91319b90f46c5b2e27a5705a2
parentc6240b9162f104583218c1100c18be00a5584ca1 (diff)
downloadnbtpd-6b0cf95d75935308e142232fe646d56d0f9d418c.tar.gz
nbtpd-6b0cf95d75935308e142232fe646d56d0f9d418c.tar.bz2
nbtpd-6b0cf95d75935308e142232fe646d56d0f9d418c.zip
start packet impl
-rw-r--r--inc/packet.h51
1 files changed, 51 insertions, 0 deletions
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 <stdint.h>
+
+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
+