root / slirp / tftp.h @ 795ca114
History | View | Annotate | Download (785 Bytes)
1 |
/* tftp defines */
|
---|---|
2 |
#ifndef SLIRP_TFTP_H
|
3 |
#define SLIRP_TFTP_H 1 |
4 |
|
5 |
#define TFTP_SESSIONS_MAX 3 |
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 |
14 |
#define TFTP_OACK 6 |
15 |
|
16 |
#define TFTP_FILENAME_MAX 512 |
17 |
|
18 |
struct tftp_t {
|
19 |
struct ip ip;
|
20 |
struct udphdr udp;
|
21 |
uint16_t tp_op; |
22 |
union {
|
23 |
struct {
|
24 |
uint16_t tp_block_nr; |
25 |
uint8_t tp_buf[512];
|
26 |
} tp_data; |
27 |
struct {
|
28 |
uint16_t tp_error_code; |
29 |
uint8_t tp_msg[512];
|
30 |
} tp_error; |
31 |
char tp_buf[512 + 2]; |
32 |
} x; |
33 |
}; |
34 |
|
35 |
struct tftp_session {
|
36 |
Slirp *slirp; |
37 |
char *filename;
|
38 |
int fd;
|
39 |
|
40 |
struct in_addr client_ip;
|
41 |
uint16_t client_port; |
42 |
uint32_t block_nr; |
43 |
|
44 |
int timestamp;
|
45 |
}; |
46 |
|
47 |
void tftp_input(struct mbuf *m); |
48 |
|
49 |
#endif
|