Statistics
| Branch: | Revision:

root / slirp / tftp.h @ 4a2b39d3

History | View | Annotate | Download (701 Bytes)

1 c7f74643 bellard
/* tftp defines */
2 c7f74643 bellard
3 c7f74643 bellard
#define TFTP_SESSIONS_MAX 3
4 c7f74643 bellard
5 c7f74643 bellard
#define TFTP_SERVER        69
6 c7f74643 bellard
7 c7f74643 bellard
#define TFTP_RRQ    1
8 c7f74643 bellard
#define TFTP_WRQ    2
9 c7f74643 bellard
#define TFTP_DATA   3
10 c7f74643 bellard
#define TFTP_ACK    4
11 c7f74643 bellard
#define TFTP_ERROR  5
12 1f697db9 ths
#define TFTP_OACK   6
13 c7f74643 bellard
14 c7f74643 bellard
#define TFTP_FILENAME_MAX 512
15 c7f74643 bellard
16 c7f74643 bellard
struct tftp_t {
17 c7f74643 bellard
  struct ip ip;
18 c7f74643 bellard
  struct udphdr udp;
19 b6dce92e Stefan Weil
  uint16_t tp_op;
20 c7f74643 bellard
  union {
21 5fafdf24 ths
    struct {
22 b6dce92e Stefan Weil
      uint16_t tp_block_nr;
23 b6dce92e Stefan Weil
      uint8_t tp_buf[512];
24 c7f74643 bellard
    } tp_data;
25 5fafdf24 ths
    struct {
26 b6dce92e Stefan Weil
      uint16_t tp_error_code;
27 b6dce92e Stefan Weil
      uint8_t tp_msg[512];
28 c7f74643 bellard
    } tp_error;
29 b6dce92e Stefan Weil
    uint8_t tp_buf[512 + 2];
30 c7f74643 bellard
  } x;
31 c7f74643 bellard
};
32 c7f74643 bellard
33 460fec67 Jan Kiszka
struct tftp_session {
34 460fec67 Jan Kiszka
    Slirp *slirp;
35 460fec67 Jan Kiszka
    char *filename;
36 460fec67 Jan Kiszka
37 460fec67 Jan Kiszka
    struct in_addr client_ip;
38 b6dce92e Stefan Weil
    uint16_t client_port;
39 460fec67 Jan Kiszka
40 460fec67 Jan Kiszka
    int timestamp;
41 460fec67 Jan Kiszka
};
42 460fec67 Jan Kiszka
43 c7f74643 bellard
void tftp_input(struct mbuf *m);