#ifndef NBD_TFTP_PACKET_H #define NBD_TFTP_PACKET_H #include typedef enum { RRQ = 1, WRQ = 2, DAT = 3, ACK = 4, ERR = 5, } nbd_tftp_opcode; typedef enum { ERROR = 0, ENOTFOUND = 1, EACCESS = 2, ENOSPACE = 3, EOPERATION = 4, ETRANS = 5, EEXISTS = 6, EUSER = 7, } nbd_tftp_ecode; typedef struct { uint16_t opcode; char *filename; char *mode; } nbd_tftp_packet_rq; typedef struct { uint16_t opcode; uint16_t block_num; char *data; } nbd_tftp_packet_data; typedef struct { uint16_t opcode; uint16_t block_num; } nbd_tftp_packet_ack; typedef struct { uint16_t opcode; uint16_t err; char *emsg; } nbd_tftp_packet_error; char *nbd_tftp_error_to_message(nbd_tftp_ecode error); #endif