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