封包格式:
struct dhcp_msg {
uint8_t op, htype, hlen, hops;
uint8_t xid[4];
uint16_t secs, flags;
uint8_t ciaddr[4];
uint8_t yiaddr[4];
uint8_t siaddr[4];
uint8_t giaddr[4];
uint8_t chaddr[16];
#ifndef UIP_CONF_DHCP_LIGHT
uint8_t sname[64];
uint8_t file[128];
#endif
uint8_t options[312];
};
DHCP的封包格式如右图所示,各字段定义如下:
HLEN:
硬件地址长度, Ethernet 为 6。
TRANSACTIO