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