Clean up decorations and whitespace around header guards
[sdk/emulator/qemu.git] / slirp / tftp.h
1 /* tftp defines */
2
3 #ifndef SLIRP_TFTP_H
4 #define SLIRP_TFTP_H
5
6 #define TFTP_SESSIONS_MAX 20
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
15 #define TFTP_OACK   6
16
17 #define TFTP_FILENAME_MAX 512
18
19 struct tftp_t {
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 } __attribute__((packed));
34
35 struct tftp_session {
36     Slirp *slirp;
37     char *filename;
38     int fd;
39
40     struct sockaddr_storage client_addr;
41     uint16_t client_port;
42     uint32_t block_nr;
43
44     int timestamp;
45 };
46
47 void tftp_input(struct sockaddr_storage *srcsas, struct mbuf *m);
48
49 #endif