#ifndef ETHERLIB_TEST_DHCP_H #define ETHERLIB_TEST_DHCP_H #include #include "../../eth_interface.h" typedef struct { uint8_t op; ///< Operations uint8_t htype; ///< Hardware type uint8_t hlen; ///< Hardware address length uint8_t hops; ///< Number of network hops uint32_t xid; ///< Transaction ID uint16_t secs; ///< Seconds elapsed since client started trying to boot uint16_t flags; ///< Flags uint32_t ciaddr; ///< Client IP address (filled in DHCPREQUEST) uint32_t yiaddr; ///< 'Your' client IP address uint32_t siaddr; ///< ... uint32_t giaddr; ///< ... uint8_t chaddr[16]; ///< Client hardware address char * sname; ///< Optional server host name char * file; ///< Boot file name } DhcpOps; /** * DHCP state. */ typedef enum { DHCP_INIT_REBOOT, DHCP_REBOOTING, DHCP_INIT, DHCP_REQUESTING, DHCP_SELECTING, DHCP_REBINDING, DHCP_BOUND, DHCP_RENEWING } DhcpState; /** * DHCP op codes. */ typedef enum { DHCP_BOOTREQUEST = 1, DHCP_BOOTREPLY = 0 } DhcpOpCode; #define DHCP_MIN_PACKET_SIZE (312) #define DHCP_CLIENT_PORT (68) #define DHCP_SERVER_PORT (67) /** * Initiate DHCP on interface * @param intf interface */ void dhcp_initiate(EthInterface * intf); #endif //ETHERLIB_TEST_DHCP_H