|
@@ -77,11 +77,126 @@ struct s_PXENV_GET_CACHED_INFO {
|
77
|
77
|
UINT16_t PacketType;
|
78
|
78
|
UINT16_t BufferSize; /**< Buffer size */
|
79
|
79
|
SEGOFF16_t Buffer; /**< Buffer address */
|
80
|
|
- UINT16_t BufferLimit /**< Maximum buffer size */
|
|
80
|
+ UINT16_t BufferLimit; /**< Maximum buffer size */
|
81
|
81
|
} PACKED;
|
82
|
82
|
|
83
|
83
|
typedef struct s_PXENV_GET_CACHED_INFO PXENV_GET_CACHED_INFO_t;
|
84
|
84
|
|
|
85
|
+#define BOOTP_REQ 1 /**< A BOOTP request packet */
|
|
86
|
+#define BOOTP_REP 2 /**< A BOOTP reply packet */
|
|
87
|
+
|
|
88
|
+#define HWTYPE_ETHER 1 /**< Ethernet (10Mb) */
|
|
89
|
+#define HWTYPE_EXP_ETHER 2 /**< Experimental Ethernet (3Mb) */
|
|
90
|
+#define HWTYPE_AX25 3 /**< Amateur Radio AX.25 */
|
|
91
|
+#define HWTYPE_TOKEN_RING 4 /**< Proteon ProNET Token Ring */
|
|
92
|
+#define HWTYPE_CHAOS 5 /**< Chaos */
|
|
93
|
+#define HWTYPE_IEEE 6 /**< IEEE 802 Networks */
|
|
94
|
+#define HWTYPE_ARCNET 7 /**< ARCNET */
|
|
95
|
+
|
|
96
|
+/** DHCP broadcast flag
|
|
97
|
+ *
|
|
98
|
+ * Request a broadcast response (DHCPOFFER or DHCPACK) from the DHCP
|
|
99
|
+ * server.
|
|
100
|
+ */
|
|
101
|
+#define BOOTP_BCAST 0x8000
|
|
102
|
+
|
|
103
|
+#define VM_RFC1048 0x63825363L /**< DHCP magic cookie */
|
|
104
|
+
|
|
105
|
+/** Format of buffer filled in by pxenv_get_cached_info()
|
|
106
|
+ *
|
|
107
|
+ * This somewhat convoluted data structure simply describes the layout
|
|
108
|
+ * of a DHCP packet. Refer to RFC2131 section 2 for a full
|
|
109
|
+ * description.
|
|
110
|
+ */
|
|
111
|
+struct bootph {
|
|
112
|
+ /** Message opcode.
|
|
113
|
+ *
|
|
114
|
+ * Valid values are #BOOTP_REQ and #BOOTP_REP.
|
|
115
|
+ */
|
|
116
|
+ UINT8_t opcode;
|
|
117
|
+ /** NIC hardware type.
|
|
118
|
+ *
|
|
119
|
+ * Valid values are defined in RFC1010 ("Assigned numbers"),
|
|
120
|
+ * and are #HWTYPE_ETHER, #HWTYPE_EXP_ETHER, #HWTYPE_AX25,
|
|
121
|
+ * #HWTYPE_TOKEN_RING, #HWTYPE_CHAOS, #HWTYPE_IEEE and
|
|
122
|
+ * #HWTYPE_ARCNET.
|
|
123
|
+ */
|
|
124
|
+ UINT8_t Hardware;
|
|
125
|
+ UINT8_t Hardlen; /**< MAC address length */
|
|
126
|
+ /** Gateway hops
|
|
127
|
+ *
|
|
128
|
+ * Zero in packets sent by the client. May be non-zero in
|
|
129
|
+ * replies from the DHCP server, if the reply comes via a DHCP
|
|
130
|
+ * relay agent.
|
|
131
|
+ */
|
|
132
|
+ UINT8_t Gatehops;
|
|
133
|
+ UINT32_t ident; /**< DHCP transaction id (xid) */
|
|
134
|
+ /** Elapsed time
|
|
135
|
+ *
|
|
136
|
+ * Number of seconds since the client began the DHCP
|
|
137
|
+ * transaction.
|
|
138
|
+ */
|
|
139
|
+ UINT16_t seconds;
|
|
140
|
+ /** Flags
|
|
141
|
+ *
|
|
142
|
+ * This is the bitwise-OR of any of the following values:
|
|
143
|
+ * #BOOTP_BCAST.
|
|
144
|
+ */
|
|
145
|
+ UINT16_t Flags;
|
|
146
|
+ /** Client IP address
|
|
147
|
+ *
|
|
148
|
+ * Set only if the client already has an IP address.
|
|
149
|
+ */
|
|
150
|
+ IP4_t cip;
|
|
151
|
+ /** Your IP address
|
|
152
|
+ *
|
|
153
|
+ * This is the IP address that the server assigns to the
|
|
154
|
+ * client.
|
|
155
|
+ */
|
|
156
|
+ IP4_t yip;
|
|
157
|
+ /** Server IP address
|
|
158
|
+ *
|
|
159
|
+ * This is the IP address of the BOOTP/DHCP server.
|
|
160
|
+ */
|
|
161
|
+ IP4_t sip;
|
|
162
|
+ /** Gateway IP address
|
|
163
|
+ *
|
|
164
|
+ * This is the IP address of the BOOTP/DHCP relay agent, if
|
|
165
|
+ * any. It is @b not (necessarily) the address of the default
|
|
166
|
+ * gateway for routing purposes.
|
|
167
|
+ */
|
|
168
|
+ IP4_t gip;
|
|
169
|
+ MAC_ADDR_t CAddr; /**< Client MAC address */
|
|
170
|
+ UINT8_t Sname[64]; /**< Server host name */
|
|
171
|
+ UINT8_t bootfile[128]; /**< Boot file name */
|
|
172
|
+ /** DHCP options
|
|
173
|
+ *
|
|
174
|
+ * Don't ask. Just laugh. Then burn a copy of the PXE
|
|
175
|
+ * specification and send Intel an e-mail asking them if
|
|
176
|
+ * they've figured out what a "union" does in C yet.
|
|
177
|
+ */
|
|
178
|
+ union bootph_vendor {
|
|
179
|
+ UINT8_t d[BOOTP_DHCPVEND]; /**< DHCP options */
|
|
180
|
+ /** DHCP options */
|
|
181
|
+ struct bootph_vendor_v {
|
|
182
|
+ /** DHCP magic cookie
|
|
183
|
+ *
|
|
184
|
+ * Should have the value #VM_RFC1048.
|
|
185
|
+ */
|
|
186
|
+ UINT8_t magic[4];
|
|
187
|
+ UINT32_t flags; /**< BOOTP flags/opcodes */
|
|
188
|
+ /** "End of BOOTP vendor extensions"
|
|
189
|
+ *
|
|
190
|
+ * Abandon hope, all ye who consider the
|
|
191
|
+ * purpose of this field.
|
|
192
|
+ */
|
|
193
|
+ UINT8_t pad[56];
|
|
194
|
+ } v;
|
|
195
|
+ } vendor;
|
|
196
|
+} PACKED;
|
|
197
|
+
|
|
198
|
+typedef struct bootph BOOTPLAYER_t;
|
|
199
|
+
|
85
|
200
|
extern PXENV_EXIT_t pxenv_get_cached_info ( struct s_PXENV_GET_CACHED_INFO
|
86
|
201
|
*get_cached_info );
|
87
|
202
|
|