Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
DHCPClient.h
00001 // DHCPClient.h 2012/4/21 00002 #ifndef DHCPCLIENT_H 00003 #define DHCPCLIENT_H 00004 #include "UDPSocket.h" 00005 00006 00007 #define DHCP_OFFSET_OP 0 00008 #define DHCP_OFFSET_XID 4 00009 #define DHCP_OFFSET_YIADDR 16 00010 #define DHCP_OFFSET_CHADDR 28 00011 #define DHCP_OFFSET_MAGIC_COOKIE 236 00012 #define DHCP_OFFSET_OPTIONS 240 00013 #define DHCP_MAX_PACKET_SIZE 600 00014 00015 class DHCPClient { 00016 int discover(uint8_t buf[], int size); 00017 int request(uint8_t buf[], int size); 00018 int offer_ack(uint8_t buf[], int size); 00019 bool verify(uint8_t buf[], int len); 00020 public: 00021 void callback(UDPSocketEvent e); 00022 int setup(int timeout_ms = 15000); 00023 DHCPClient(); 00024 uint8_t chaddr[6]; // MAC 00025 uint8_t yiaddr[4]; // IP 00026 uint8_t dnsaddr[4]; // DNS 00027 uint8_t gateway[4]; 00028 uint8_t netmask[4]; 00029 private: 00030 UDPSocket* m_udp; 00031 uint8_t xid[4]; 00032 bool exit_flag; 00033 Timer m_interval; 00034 int m_retry; 00035 }; 00036 #endif //DHCPCLIENT_H
Generated on Tue Jul 12 2022 13:04:14 by
1.7.2