]> git.proxmox.com Git - mirror_qemu.git/blob - slirp/src/tftp.h
Revert "vl: Fix to create migration object before block backends again"
[mirror_qemu.git] / slirp / src / tftp.h
1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /* tftp defines */
3
4 #ifndef SLIRP_TFTP_H
5 #define SLIRP_TFTP_H
6
7 #define TFTP_SESSIONS_MAX 20
8
9 #define TFTP_SERVER 69
10
11 #define TFTP_RRQ 1
12 #define TFTP_WRQ 2
13 #define TFTP_DATA 3
14 #define TFTP_ACK 4
15 #define TFTP_ERROR 5
16 #define TFTP_OACK 6
17
18 #define TFTP_FILENAME_MAX 512
19 #define TFTP_BLOCKSIZE_MAX 1428
20
21 struct tftp_t {
22 struct udphdr udp;
23 uint16_t tp_op;
24 union {
25 struct {
26 uint16_t tp_block_nr;
27 uint8_t tp_buf[TFTP_BLOCKSIZE_MAX];
28 } tp_data;
29 struct {
30 uint16_t tp_error_code;
31 uint8_t tp_msg[TFTP_BLOCKSIZE_MAX];
32 } tp_error;
33 char tp_buf[TFTP_BLOCKSIZE_MAX + 2];
34 } x;
35 } __attribute__((packed));
36
37 struct tftp_session {
38 Slirp *slirp;
39 char *filename;
40 int fd;
41 uint16_t block_size;
42
43 struct sockaddr_storage client_addr;
44 uint16_t client_port;
45 uint32_t block_nr;
46
47 int timestamp;
48 };
49
50 void tftp_input(struct sockaddr_storage *srcsas, struct mbuf *m);
51
52 #endif