]>
Commit | Line | Data |
---|---|---|
c7f74643 | 1 | /* tftp defines */ |
cb9c377f PB |
2 | #ifndef SLIRP_TFTP_H |
3 | #define SLIRP_TFTP_H 1 | |
c7f74643 | 4 | |
5f22b054 | 5 | #define TFTP_SESSIONS_MAX 20 |
c7f74643 FB |
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 | |
1f697db9 | 14 | #define TFTP_OACK 6 |
c7f74643 FB |
15 | |
16 | #define TFTP_FILENAME_MAX 512 | |
17 | ||
18 | struct tftp_t { | |
c7f74643 | 19 | struct udphdr udp; |
b6dce92e | 20 | uint16_t tp_op; |
c7f74643 | 21 | union { |
5fafdf24 | 22 | struct { |
b6dce92e SW |
23 | uint16_t tp_block_nr; |
24 | uint8_t tp_buf[512]; | |
c7f74643 | 25 | } tp_data; |
5fafdf24 | 26 | struct { |
b6dce92e SW |
27 | uint16_t tp_error_code; |
28 | uint8_t tp_msg[512]; | |
c7f74643 | 29 | } tp_error; |
89d2d3af | 30 | char tp_buf[512 + 2]; |
c7f74643 | 31 | } x; |
fad7fb9c | 32 | } __attribute__((packed)); |
c7f74643 | 33 | |
460fec67 JK |
34 | struct tftp_session { |
35 | Slirp *slirp; | |
36 | char *filename; | |
78be0566 | 37 | int fd; |
460fec67 | 38 | |
fad7fb9c | 39 | struct sockaddr_storage client_addr; |
b6dce92e | 40 | uint16_t client_port; |
4aa401f3 | 41 | uint32_t block_nr; |
460fec67 JK |
42 | |
43 | int timestamp; | |
44 | }; | |
45 | ||
fad7fb9c | 46 | void tftp_input(struct sockaddr_storage *srcsas, struct mbuf *m); |
cb9c377f PB |
47 | |
48 | #endif |