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.
Dependents: HTTP_SDcard_file_server_WIZwiki-W7500 SSD1306_smart_watch TCPEchoServer-WIZwiki-W7500 httpServer-WIZwiki-W7500 ... more
Fork of WIZnetInterface by
This is WIZnet Ethernet Interface using Hardware TCP/IP chip, W5500 and TCP/IP Offload Engine, W7500.
[Users » embeddist » Code » WIZnetInterface](https://developer.mbed.org/users/embeddist/code/WIZnetInterface/) -> WIZnetInterface Lib will be released on [Team WIZnet](https://developer.mbed.org/teams/WIZnet/)
- WIZwiki_W7500 : /platforms/WIZwiki-W7500/

- WIZwiki_W7500P : /platforms/WIZwiki-W7500P/

- WIZwiki_W7500ECO : /platforms/WIZwiki-W7500ECO/

- W5500 Ethernet Shield : /components/W5500-Ethernet-Kit-for-IoT/

This library is an Ethernet Interface library port-based on [EthernetInterface](https://developer.mbed.org/users/mbed_official/code/EthernetInterface/docs/tip/).
For more detail, visit http://embeddist.blogspot.kr/2015/06/wiznetinterface-for-armmbed.html
Socket/DHCPClient.h
- Committer:
- Soohwan Kim
- Date:
- 2015-06-15
- Revision:
- 5:f432ae8f8708
- Parent:
- 0:6f28332c466f
File content as of revision 5:f432ae8f8708:
// DHCPClient.h 2013/4/10
#ifndef DHCPCLIENT_H
#define DHCPCLIENT_H
#include "eth_arch.h"
#include "UDPSocket.h"
#define DHCP_OFFSET_OP 0
#define DHCP_OFFSET_XID 4
#define DHCP_OFFSET_YIADDR 16
#define DHCP_OFFSET_SIADDR 20
#define DHCP_OFFSET_OPTIONS 240
#define DHCP_MAX_PACKET_SIZE 600
// DHCP Message Type
#define DHCPDISCOVER 1
#define DHCPOFFER 2
#define DHCPREQUEST 3
#define DHCPDECLINE 4
#define DHCPACK 5
#define DHCPNAK 6
#define DHCPRELEASE 7
#define DHCPINFORM 8
class DHCPClient {
public:
DHCPClient();
int setup(int timeout_ms = 15*1000);
uint8_t chaddr[6]; // MAC
uint8_t yiaddr[4]; // IP
uint8_t dnsaddr[4]; // DNS
uint8_t gateway[4];
uint8_t netmask[4];
uint8_t siaddr[4];
private:
int discover();
int request();
int offer(uint8_t buf[], int size);
void add_buf(uint8_t* buf, int len);
void fill_buf(int len, uint8_t data = 0x00);
void add_buf(uint8_t c);
void add_option(uint8_t code, uint8_t* buf = NULL, int len = 0);
bool verify(uint8_t buf[], int len);
void callback();
UDPSocket* m_udp;
Endpoint m_server;
uint8_t xid[4];
bool exit_flag;
Timer m_interval;
int m_retry;
uint8_t m_buf[DHCP_MAX_PACKET_SIZE];
int m_pos;
WIZnet_Chip* eth;
};
#endif //DHCPCLIENT_H

Network-Shield W5500
M0-Switch WIZnet W7500
Serial-to-Ethernet Controller WIZ750SR