Free (GPLv2) TCP/IP stack developed by TASS Belgium
Dependents: lpc1768-picotcp-demo ZeroMQ_PicoTCP_Publisher_demo TCPSocket_HelloWorld_PicoTCP Pico_TCP_UDP_Test ... more
DHCPServer.cpp
00001 /* 00002 * 00003 * PicoTCP Socket interface for mbed. 00004 * Copyright (C) 2013 TASS Belgium NV 00005 * 00006 * Released under GPL v2 00007 * 00008 * Other licensing models might apply at the sole discretion of the copyright holders. 00009 * 00010 * 00011 * This software is based on the mbed.org EthernetInterface implementation: 00012 * Copyright (C) 2012 mbed.org, MIT License 00013 * 00014 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 00015 * and associated documentation files (the "Software"), to deal in the Software without restriction, 00016 * including without limitation the rights to use, copy, modify, merge, publish, distribute, 00017 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 00018 * furnished to do so, subject to the following conditions: 00019 * 00020 * The above copyright notice and this permission notice shall be included in all copies or 00021 * substantial portions of the Software. 00022 * 00023 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 00024 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00025 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 00026 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00027 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00028 */ 00029 00030 #include "Socket/DHCPServer.h" 00031 #include "wrapper.h" 00032 #include "proxy_endpoint.h" 00033 00034 static struct pico_dhcp_server_setting setting = {0}; 00035 00036 DHCPServer::DHCPServer() { 00037 } 00038 00039 int DHCPServer::init(const char* ip) { 00040 return DHCPServer::set_server_ip(ip); 00041 } 00042 00043 int DHCPServer::set_server_ip(const char *ip) { 00044 return pico_string_to_ipv4(ip, &setting.server_ip.addr); 00045 } 00046 00047 int DHCPServer::set_pool_start(const char * pool_start) { 00048 return pico_string_to_ipv4(pool_start, &setting.pool_start); 00049 } 00050 00051 int DHCPServer::set_pool_end(const char * pool_end) { 00052 return pico_string_to_ipv4(pool_end, &setting.pool_end); 00053 } 00054 00055 void DHCPServer::set_lease_time(uint32_t lease_time) { 00056 setting.lease_time = lease_time; 00057 } 00058 00059 int DHCPServer::start(void) { 00060 return picotcp_dhcp_server_start(&setting); 00061 } 00062
Generated on Tue Jul 12 2022 15:59:21 by 1.7.2