1/* tftp defines */ 2#ifndef SLIRP_TFTP_H 3#define SLIRP_TFTP_H 1 4 5#define TFTP_SESSIONS_MAX 20 6 7#define TFTP_SERVER 69 8 9#define TFTP_RRQ 1 10#define TFTP_WRQ 2 11#define TFTP_DATA 3 12#define TFTP_ACK 4 13#define TFTP_ERROR 5 14#define TFTP_OACK 6 15 16#define TFTP_FILENAME_MAX 512 17 18struct tftp_t { 19 struct udphdr udp; 20 uint16_t tp_op; 21 union { 22 struct { 23 uint16_t tp_block_nr; 24 uint8_t tp_buf[512]; 25 } tp_data; 26 struct { 27 uint16_t tp_error_code; 28 uint8_t tp_msg[512]; 29 } tp_error; 30 char tp_buf[512 + 2]; 31 } x; 32} __attribute__((packed)); 33 34struct tftp_session { 35 Slirp *slirp; 36 char *filename; 37 int fd; 38 39 struct sockaddr_storage client_addr; 40 uint16_t client_port; 41 uint32_t block_nr; 42 43 int timestamp; 44}; 45 46void tftp_input(struct sockaddr_storage *srcsas, struct mbuf *m); 47 48#endif 49