ivshmem: Plug leaks on unplug, fix peer disconnect
[qemu/ar7.git] / slirp / tftp.h
blob1cb1adf591887ffd66cc071e05009bd9d5b7929d
1 /* tftp defines */
2 #ifndef SLIRP_TFTP_H
3 #define SLIRP_TFTP_H 1
5 #define TFTP_SESSIONS_MAX 20
7 #define TFTP_SERVER 69
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
16 #define TFTP_FILENAME_MAX 512
18 struct 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));
34 struct tftp_session {
35 Slirp *slirp;
36 char *filename;
37 int fd;
39 struct sockaddr_storage client_addr;
40 uint16_t client_port;
41 uint32_t block_nr;
43 int timestamp;
46 void tftp_input(struct sockaddr_storage *srcsas, struct mbuf *m);
48 #endif