blob: b9f0847eb9310177a035d267f93ad54885e8e53d [file] [log] [blame]
bellardc7f74642004-08-24 21:57:12 +00001/* tftp defines */
2
3#define TFTP_SESSIONS_MAX 3
4
5#define TFTP_SERVER 69
6
7#define TFTP_RRQ 1
8#define TFTP_WRQ 2
9#define TFTP_DATA 3
10#define TFTP_ACK 4
11#define TFTP_ERROR 5
ths1f697db2007-02-20 00:07:50 +000012#define TFTP_OACK 6
bellardc7f74642004-08-24 21:57:12 +000013
14#define TFTP_FILENAME_MAX 512
15
16struct tftp_t {
17 struct ip ip;
18 struct udphdr udp;
Stefan Weilb6dce922010-07-22 22:15:23 +020019 uint16_t tp_op;
bellardc7f74642004-08-24 21:57:12 +000020 union {
ths5fafdf22007-09-16 21:08:06 +000021 struct {
Stefan Weilb6dce922010-07-22 22:15:23 +020022 uint16_t tp_block_nr;
23 uint8_t tp_buf[512];
bellardc7f74642004-08-24 21:57:12 +000024 } tp_data;
ths5fafdf22007-09-16 21:08:06 +000025 struct {
Stefan Weilb6dce922010-07-22 22:15:23 +020026 uint16_t tp_error_code;
27 uint8_t tp_msg[512];
bellardc7f74642004-08-24 21:57:12 +000028 } tp_error;
Stefan Weilb6dce922010-07-22 22:15:23 +020029 uint8_t tp_buf[512 + 2];
bellardc7f74642004-08-24 21:57:12 +000030 } x;
31};
32
Jan Kiszka460fec62009-06-24 14:42:31 +020033struct tftp_session {
34 Slirp *slirp;
35 char *filename;
36
37 struct in_addr client_ip;
Stefan Weilb6dce922010-07-22 22:15:23 +020038 uint16_t client_port;
Jan Kiszka460fec62009-06-24 14:42:31 +020039
40 int timestamp;
41};
42
bellardc7f74642004-08-24 21:57:12 +000043void tftp_input(struct mbuf *m);