Contiki 2.5
dhcps.h
1 #ifndef __DHCPS_H__6M2XYUGNTK__
2 #define __DHCPS_H__6M2XYUGNTK__
3 #include "contiki-net.h"
4 #include <stdint.h>
5 
6 #define MAX_HLEN 6
7 
8 struct dhcps_client_lease
9 {
10  uint8_t chaddr[MAX_HLEN];
11  uip_ipaddr_t ipaddr;
12  unsigned long lease_end;
13  uint8_t flags;
14 };
15 
16 struct dhcps_config
17 {
18  unsigned long default_lease_time;
19  uip_ipaddr_t netmask;
20  uip_ipaddr_t dnsaddr;
21  uip_ipaddr_t default_router;
22  struct dhcps_client_lease *leases;
23  uint8_t flags;
24  uint8_t num_leases;
25 };
26 
27 #define DHCP_CONF_NETMASK 0x01
28 #define DHCP_CONF_DNSADDR 0x02
29 #define DHCP_CONF_DEFAULT_ROUTER 0x04
30 
31 #define DHCP_INIT_LEASE(addr0, addr1, addr2, addr3) \
32 {{0},{addr0, addr1, addr2, addr3},0,0}
33 
34 /**
35  * Start the DHCP server
36  *
37  * This function starts th DHCP server with the given configuration.
38  * The flags field determines which options are actually sent to the
39  * client
40  *
41  * \param conf Pointer to a configuration struct. The configuration is
42  * not copied and should remain constant while the server is running.
43  * The leases pointed to by the configuration must be in writable memory.
44  **/
45 void dhcps_init(const struct dhcps_config *conf);
46 
47 #endif /* __DHCPS_H__6M2XYUGNTK__ */