dhcpserver: Initial DHCP server support, hands out leases but doesn't expire them

This commit is contained in:
Angus Gratton 2015-08-13 17:10:38 +10:00
parent 347f9d3a85
commit 4c98f575e7
3 changed files with 324 additions and 0 deletions

View file

@ -0,0 +1,34 @@
/* Very basic LWIP & FreeRTOS-based DHCP server
*/
#ifndef _DHCPSERVER_H
#define _DHCPSERVER_H
#ifndef DHCPSERVER_MAXCLIENTS
#define DHCPSERVER_MAXCLIENTS 4
#endif
/* First client IP to hand out.
IP assignment routine is very simple - Fourth octet in IP will be incremented
from this value to (value+DHCPSERVER_MAXCLIENTS-1).
*/
#ifndef DHCPSERVER_FIRST_CLIENT_IP
#define DHCPSERVER_FIRST_CLIENT_IP(DST) IP4_ADDR(DST, 192, 168, 3, 5)
#endif
#ifndef DHCPSERVER_LEASE_TIME
#define DHCPSERVER_LEASE_TIME 30
#endif
/* Start DHCP server.
Static IP of server should already be set and network interface enabled.
*/
void dhcpserver_start(void);
/* Stop DHCP server.
*/
void dhcpserver_stop(void);
#endif