VirtualBox

source: vbox/trunk/src/VBox/Devices/PC/Etherboot-src/include/tftp.h@ 46910

最後變更 在這個檔案從46910是 1,由 vboxsync 提交於 55 年 前

import

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 1.4 KB
 
1#ifndef _TFTP_H
2#define _TFTP_H
3
4#define TFTP_PORT 69
5#define TFTP_DEFAULTSIZE_PACKET 512
6#define TFTP_MAX_PACKET 1432 /* 512 */
7
8#define TFTP_RRQ 1
9#define TFTP_WRQ 2
10#define TFTP_DATA 3
11#define TFTP_ACK 4
12#define TFTP_ERROR 5
13#define TFTP_OACK 6
14
15#define TFTP_CODE_EOF 1
16#define TFTP_CODE_MORE 2
17#define TFTP_CODE_ERROR 3
18#define TFTP_CODE_BOOT 4
19#define TFTP_CODE_CFG 5
20
21struct tftp_t {
22 struct iphdr ip;
23 struct udphdr udp;
24 uint16_t opcode;
25 union {
26 uint8_t rrq[TFTP_DEFAULTSIZE_PACKET];
27 struct {
28 uint16_t block;
29 uint8_t download[TFTP_MAX_PACKET];
30 } data;
31 struct {
32 uint16_t block;
33 } ack;
34 struct {
35 uint16_t errcode;
36 uint8_t errmsg[TFTP_DEFAULTSIZE_PACKET];
37 } err;
38 struct {
39 uint8_t data[TFTP_DEFAULTSIZE_PACKET+2];
40 } oack;
41 } u;
42} PACKED;
43
44/* define a smaller tftp packet solely for making requests to conserve stack
45 512 bytes should be enough */
46struct tftpreq_t {
47 struct iphdr ip;
48 struct udphdr udp;
49 uint16_t opcode;
50 union {
51 uint8_t rrq[512];
52 struct {
53 uint16_t block;
54 } ack;
55 struct {
56 uint16_t errcode;
57 uint8_t errmsg[512-2];
58 } err;
59 } u;
60} PACKED;
61
62struct tftpreq_info_t {
63 const char *name;
64 unsigned short port;
65 unsigned short blksize;
66} PACKED;
67
68struct tftpblk_info_t {
69 char *data;
70 unsigned int block;
71 unsigned int len;
72 int eof;
73} PACKED;
74
75#define TFTP_MIN_PACKET (sizeof(struct iphdr) + sizeof(struct udphdr) + 4)
76
77#endif /* _TFTP_H */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette