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.
Fork of DhcpServer by
Revision 4:ac6385f9f2db, committed 2018-06-21
- Comitter:
- dkato
- Date:
- Thu Jun 21 10:37:18 2018 +0000
- Parent:
- 3:bdea854c0ec8
- Commit message:
- Supports mbed-os 5.9.1
Changed in this revision
| DhcpServer.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/DhcpServer.cpp Fri Jun 23 11:44:52 2017 +0000 +++ b/DhcpServer.cpp Thu Jun 21 10:37:18 2018 +0000 @@ -1,14 +1,38 @@ #include "mbed.h" #include "rtos.h" -#include "lwip/netif.h" #include "TCPSocket.h" #include "TCPServer.h" #include "SocketAddress.h" #include "UDPSocket.h" -#include "prot/ip4.h" -#include "prot/dhcp.h" #include "DhcpServer.h" + /* DHCP message item offsets and length */ +#define DHCP_SNAME_LEN 64U + +/* DHCP message types */ +#define DHCP_DISCOVER 1 +#define DHCP_OFFER 2 +#define DHCP_REQUEST 3 +#define DHCP_DECLINE 4 +#define DHCP_ACK 5 +#define DHCP_NAK 6 +#define DHCP_RELEASE 7 +#define DHCP_INFORM 8 + +/* BootP options */ +#define DHCP_OPTION_SUBNET_MASK 1 /* RFC 2132 3.3 */ +#define DHCP_OPTION_ROUTER 3 +#define DHCP_OPTION_DNS_SERVER 6 + +/* DHCP options */ +#define DHCP_OPTION_LEASE_TIME 51 /* RFC 2132 9.2, time in seconds, in 4 bytes */ + +#define DHCP_OPTION_MESSAGE_TYPE 53 /* RFC 2132 9.6, important for DHCP */ +#define DHCP_OPTION_MESSAGE_TYPE_LEN 1 + +#define DHCP_OPTION_SERVER_ID 54 /* RFC 2132 9.7, server IP address */ + + #define IP_ADDER_START (10) #define OFS_XID (4)
