Changeset 11049 in vbox for trunk/include
- Timestamp:
- Jul 31, 2008 9:19:52 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 33944
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/net.h
r11044 r11049 245 245 RTDECL(bool) RTNetIPv4IsUDPValid(PCRTNETIPV4 pIpHdr, PCRTNETUDP pUdpHdr, void const *pvData, size_t cbPktMax); 246 246 247 /** 248 * IPv4 BOOTP / DHCP packet. 249 */ 250 #pragma pack(1) 251 typedef struct RTNETBOOTP 252 { 253 /** 00 - The packet opcode. */ 254 uint8_t bp_op; 255 /** 01 - Hardware address type. Same as RTNETARPHDR::ar_htype. */ 256 uint8_t bp_htype; 257 /** 02 - Hardware address length. */ 258 uint8_t bp_hlen; 259 /** 03 - Gateway hops. */ 260 uint8_t bp_hops; 261 /** 04 - Transaction ID. */ 262 uint32_t bp_xid; 263 /** 08 - Seconds since boot started. */ 264 uint16_t bp_secs; 265 /** 0a - Unused (BOOTP) / Flags (DHCP). */ 266 uint16_t bp_flags; 267 /** 0c - Client IPv4 address. */ 268 RTNETADDRIPV4 bp_ciaddr; 269 /** 10 - Your IPv4 address. */ 270 RTNETADDRIPV4 bp_yiaddr; 271 /** 14 - Server IPv4 address. */ 272 RTNETADDRIPV4 bp_siaddr; 273 /** 18 - Gateway IPv4 address. */ 274 RTNETADDRIPV4 bp_giaddr; 275 /** 1c - Client hardware address. */ 276 union 277 { 278 uint8_t au8[16]; 279 RTMAC Mac; 280 } bp_chaddr; 281 /** 2c - Server name. */ 282 uint8_t bp_sname[64]; 283 /** 6c - File name / more DHCP options. */ 284 uint8_t bp_file[128]; 285 /** ec - Vendor specific area (BOOTP) / Options (DHCP). 286 * @remark This is really 312 bytes in the DHCP version. */ 287 union 288 { 289 uint8_t au8[128]; 290 struct DHCP 291 { 292 /** ec - The DHCP cookie (RTNET_DHCP_COOKIE). */ 293 uint32_t dhcp_cookie; 294 /** f0 - The DHCP options. */ 295 uint8_t dhcp_opts[124]; 296 } Dhcp; 297 } bp_vend; 298 299 } RTNETBOOTP; 300 #pragma pack(0) 301 AssertCompileSize(RTNETBOOTP, 0xec + 128); 302 /** Pointer to a BOOTP / DHCP packet. */ 303 typedef RTNETBOOTP *PRTNETBOOTP; 304 /** Pointer to a const BOOTP / DHCP packet. */ 305 typedef RTNETBOOTP const *PCRTNETBOOTP; 306 307 /** @name BOOTP packet opcode values 308 * @{ */ 309 #define RTNETBOOTP_OP_REQUEST 1 310 #define RTNETBOOTP_OP_REPLY 2 311 /** @} */ 312 313 /** @name DHCP flags (RTNETBOOTP::bp_flags) 314 * @{ */ 315 #define RTNET_DHCP_FLAGS_NO_BROADCAST UINT16_C(0x8000) /** @todo check test!!! */ 316 /** @} */ 317 318 /** The DHCP cookie (network endian). */ 319 #define RTNET_DHCP_COOKIE UINT32_C(0x63825363) 320 321 /** 322 * An IPv4 DHCP option header. 323 */ 324 typedef struct RTNETDHCPOPT 325 { 326 /** 00 - The DHCP option. */ 327 uint8_t dhcp_opt; 328 /** 01 - The data length (excluding this header). */ 329 uint8_t dhcp_len; 330 /* 02 - The option data follows here, optional and of variable length. */ 331 } RTNETDHCPOPT; 332 AssertCompileSize(RTNETDHCPOPT, 2); 333 /** Pointer to a DHCP option header. */ 334 typedef RTNETDHCPOPT *PRTNETDHCPOPT; 335 /** Pointer to a const DHCP option header. */ 336 typedef RTNETDHCPOPT const *PCRTNETDHCPOPT; 337 338 /** @name DHCP options 339 * @{ */ 340 /** 1 byte padding, this has no dhcp_len field. */ 341 #define RTNET_DHCP_OPT_PAD 0 342 /** Have a 8-bit message type value as data, see RTNET_DHCP_MT_*. */ 343 #define RTNET_DHCP_OPT_MSG_TYPE 53 344 /** Marks the end of the DHCP options, this has no dhcp_len field. */ 345 #define RTNET_DHCP_OPT_END 255 346 /** @} */ 347 348 /** @name DHCP Message Types (option 53) 349 * @{ */ 350 #define RTNET_DHCP_MT_DISCOVER 1 351 #define RTNET_DHCP_MT_OFFER 2 352 #define RTNET_DHCP_MT_REQUEST 3 353 #define RTNET_DHCP_MT_DECLINE 4 354 #define RTNET_DHCP_MT_ACK 5 355 #define RTNET_DHCP_MT_NAC 6 356 #define RTNET_DHCP_MT_RELEASE 7 357 #define RTNET_DHCP_MT_INFORM 8 358 /** @} */ 359 360 RTDECL(bool) RTNetIPv4IsDHCPValid(PCRTNETUDP pUdpHdr, PCRTNETBOOTP pDhcp, size_t cbDhcp, uint8_t *pMsgType); 361 247 362 248 363 /** 249 364 * IPv4 DHCP packet. 365 * @obsolete Use RTNETBOOTP. 250 366 */ 251 367 #pragma pack(1) 252 368 typedef struct RTNETDHCP 253 369 { 370 /** 00 - The packet opcode. */ 254 371 uint8_t Op; 255 372 /** Hardware address type. */
Note:
See TracChangeset
for help on using the changeset viewer.