]> git.proxmox.com Git - mirror_qemu.git/blame - slirp/src/tftp.h
build-sys: pass CFLAGS & LDFLAGS to subdir-slirp
[mirror_qemu.git] / slirp / src / tftp.h
CommitLineData
dfacac4c 1/* SPDX-License-Identifier: BSD-3-Clause */
c7f74643 2/* tftp defines */
175de524 3
cb9c377f 4#ifndef SLIRP_TFTP_H
175de524 5#define SLIRP_TFTP_H
c7f74643 6
5f22b054 7#define TFTP_SESSIONS_MAX 20
c7f74643
FB
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
1f697db9 16#define TFTP_OACK 6
c7f74643
FB
17
18#define TFTP_FILENAME_MAX 512
9443598d 19#define TFTP_BLOCKSIZE_MAX 1428
c7f74643
FB
20
21struct tftp_t {
c7f74643 22 struct udphdr udp;
b6dce92e 23 uint16_t tp_op;
c7f74643 24 union {
5fafdf24 25 struct {
b6dce92e 26 uint16_t tp_block_nr;
9443598d 27 uint8_t tp_buf[TFTP_BLOCKSIZE_MAX];
c7f74643 28 } tp_data;
5fafdf24 29 struct {
b6dce92e 30 uint16_t tp_error_code;
9443598d 31 uint8_t tp_msg[TFTP_BLOCKSIZE_MAX];
c7f74643 32 } tp_error;
9443598d 33 char tp_buf[TFTP_BLOCKSIZE_MAX + 2];
c7f74643 34 } x;
fad7fb9c 35} __attribute__((packed));
c7f74643 36
460fec67
JK
37struct tftp_session {
38 Slirp *slirp;
39 char *filename;
78be0566 40 int fd;
9443598d 41 uint16_t block_size;
460fec67 42
fad7fb9c 43 struct sockaddr_storage client_addr;
b6dce92e 44 uint16_t client_port;
4aa401f3 45 uint32_t block_nr;
460fec67
JK
46
47 int timestamp;
48};
49
fad7fb9c 50void tftp_input(struct sockaddr_storage *srcsas, struct mbuf *m);
cb9c377f
PB
51
52#endif