about summary refs log tree commit diff stats
path: root/inc/packet.h
diff options
context:
space:
mode:
Diffstat (limited to 'inc/packet.h')
-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
+