1 /* 2 * Copyright (c) Huawei Technologies Co., Ltd. 2013-2015. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 3. The name of the author may not be used to endorse or promote 13 * products derived from this software without specific prior 14 * written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 17 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 22 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 25 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * Description: implementation for IPv4 DHCP server 29 * Author: none 30 * Create: 2013 31 */ 32 #ifndef LWIP_HDR_DHCPS_H 33 #define LWIP_HDR_DHCPS_H 34 35 #include "lwip/opt.h" 36 #include "lwip/prot/dhcp.h" 37 #if LWIP_DHCPS /* don't build if not configured for use in lwipopts.h */ 38 39 #include "lwip/netif.h" 40 #include "lwip/udp.h" 41 42 #if defined (__cplusplus) && __cplusplus 43 extern "C" { 44 #endif 45 46 47 #ifndef LWIP_DHCPS_MAX_LEASE 48 #define LWIP_DHCPS_MAX_LEASE 30 49 #endif 50 51 #ifndef LWIP_DHCPS_LEASE_TIME 52 #define LWIP_DHCPS_LEASE_TIME 7200 53 #endif 54 55 /* Offer time in seconds */ 56 #ifndef LWIP_DHCPS_OFFER_TIME 57 #define LWIP_DHCPS_OFFER_TIME 300 58 #endif 59 60 #ifndef LWIP_DHCPS_DECLINE_TIME 61 #define LWIP_DHCPS_DECLINE_TIME 500 62 #endif 63 64 err_t dhcps_start(struct netif *netif, const char *start_ip, u16_t ip_num); 65 void dhcps_stop(struct netif *netif); 66 #if LWIP_NETIFAPI_DHCPS_IP 67 err_t dhcps_find_client_lease(struct netif *netif, u8_t *mac, u8_t maclen, ip_addr_t *ip); 68 #endif 69 void dhcps_client_disconnect(struct netif *netif, const u8_t *mac, u8_t maclen); 70 71 #if defined (__cplusplus) && __cplusplus 72 } 73 #endif 74 #endif /* LWIP_DHCPS */ 75 #endif /* LWIP_HDR_DHCPS_H */ 76