Contiki 2.6

dhcps.h

00001 #ifndef __DHCPS_H__6M2XYUGNTK__
00002 #define __DHCPS_H__6M2XYUGNTK__
00003 #include "contiki-net.h"
00004 #include <stdint.h>
00005 
00006 #define MAX_HLEN 6
00007 
00008 struct dhcps_client_lease
00009 {
00010   uint8_t chaddr[MAX_HLEN];
00011   uip_ipaddr_t ipaddr;
00012   unsigned long lease_end;
00013   uint8_t flags;
00014 };
00015 
00016 struct dhcps_config
00017 {
00018   unsigned long default_lease_time;
00019   uip_ipaddr_t netmask;
00020   uip_ipaddr_t dnsaddr;
00021   uip_ipaddr_t default_router;
00022   struct dhcps_client_lease *leases;
00023   uint8_t flags;
00024   uint8_t num_leases;
00025 };
00026 
00027 #define DHCP_CONF_NETMASK 0x01
00028 #define DHCP_CONF_DNSADDR 0x02
00029 #define DHCP_CONF_DEFAULT_ROUTER 0x04
00030 
00031 #define DHCP_INIT_LEASE(addr0, addr1, addr2, addr3) \
00032 {{0},{addr0, addr1, addr2, addr3},0,0}
00033 
00034 /**
00035  * Start the DHCP server
00036  *
00037  * This function starts th DHCP server with the given configuration.
00038  * The flags field determines which options are actually sent to the
00039  * client
00040  *
00041  * \param conf Pointer to a configuration struct. The configuration is
00042  * not copied and should remain constant while the server is running.
00043  * The leases pointed to by the configuration must be in writable memory.
00044  **/
00045 void dhcps_init(const struct dhcps_config *conf);
00046 
00047 #endif /* __DHCPS_H__6M2XYUGNTK__ */