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
PicoTCP. Copyright (c) 2013 TASS Belgium NV.
Released under the GNU General Public License, version 2.
Different licensing models may exist, at the sole discretion of the Copyright holders.
Official homepage: http://www.picotcp.com
Bug tracker: https://github.com/tass-belgium/picotcp/issues
Development steps:
initial integration with mbed RTOSgeneric mbed Ethernet driverhigh performance NXP LPC1768 specific Ethernet driverMulti-threading support for mbed RTOSBerkeley sockets and integration with the New Socket APIFork of the apps running on top of the New Socket APIScheduling optimizations- Debugging/benchmarking/testing
Demo application (measuring TCP sender performance):
Import programlpc1768-picotcp-demo
A PicoTCP demo app testing the ethernet throughput on the lpc1768 mbed board.
Revision 139:1f7a4a8525ef, committed 2014-02-11
- Comitter:
- tass picotcp@tass.be
- Date:
- Tue Feb 11 14:44:54 2014 +0100
- Parent:
- 136:576dcbb16922
- Child:
- 140:bb24e339e40b
- Commit message:
- Added support for DHCP server
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Socket/DHCPServer.cpp Tue Feb 11 14:44:54 2014 +0100 @@ -0,0 +1,62 @@ +/* + * + * PicoTCP Socket interface for mbed. + * Copyright (C) 2013 TASS Belgium NV + * + * Released under GPL v2 + * + * Other licensing models might apply at the sole discretion of the copyright holders. + * + * + * This software is based on the mbed.org EthernetInterface implementation: + * Copyright (C) 2012 mbed.org, MIT License + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software + * and associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, + * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or + * substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "Socket/DHCPServer.h" +#include "wrapper.h" +#include "proxy_endpoint.h" + +static struct pico_dhcp_server_setting setting = {0}; + +DHCPServer::DHCPServer() { +} + +int DHCPServer::init(const char* ip) { + return DHCPServer::set_server_ip(ip); +} + +int DHCPServer::set_server_ip(const char *ip) { + return pico_string_to_ipv4(ip, &setting.server_ip.addr); +} + +int DHCPServer::set_pool_start(const char * pool_start) { + return pico_string_to_ipv4(pool_start, &setting.pool_start); +} + +int DHCPServer::set_pool_end(const char * pool_end) { + return pico_string_to_ipv4(pool_end, &setting.pool_end); +} + +void DHCPServer::set_lease_time(uint32_t lease_time) { + setting.lease_time = lease_time; +} + +int DHCPServer::start(void) { + return picotcp_dhcp_server_start(&setting); +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Socket/DHCPServer.h Tue Feb 11 14:44:54 2014 +0100 @@ -0,0 +1,54 @@ +/* + * + * PicoTCP Socket interface for mbed. + * Copyright (C) 2013 TASS Belgium NV + * + * Released under GPL v2 + * + * Other licensing models might apply at the sole discretion of the copyright holders. + * + * + * This software is based on the mbed.org EthernetInterface implementation: + * Copyright (C) 2012 mbed.org, MIT License + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software + * and associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, + * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or + * substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef DHCPSERVER_H +#define DHCPSERVER_H + +#include "pico_dhcp_server.h" + +/** +DHCP Server +*/ +class DHCPServer { + +public: + /** Instantiate a DHCP Server object. + */ + DHCPServer(); + + // init function needs server_ip as argument + int init(const char *); + int set_server_ip(const char *); + int set_pool_start(const char*); + int set_pool_end(const char *); + void set_lease_time(uint32_t); + int start(void); +}; + +#endif
--- a/Socket/bsd/proxy_endpoint.h Fri Jan 17 10:13:51 2014 +0100 +++ b/Socket/bsd/proxy_endpoint.h Tue Feb 11 14:44:54 2014 +0100 @@ -114,4 +114,5 @@ void picotcp_async_interrupt(void *arg); struct hostent *picotcp_gethostbyname(const char *name); +int picotcp_dhcp_server_start(struct pico_dhcp_server_setting *setting); #endif
--- a/Socket/bsd/stack_endpoint.cpp Fri Jan 17 10:13:51 2014 +0100 +++ b/Socket/bsd/stack_endpoint.cpp Tue Feb 11 14:44:54 2014 +0100 @@ -16,6 +16,7 @@ { #include "pico_mbed.h" #include "pico_dns_client.h" + #include "pico_dhcp_server.h" } //#define ptsock_dbg mbed_dbg @@ -496,6 +497,18 @@ picotcp_start(); } +int picotcp_dhcp_server_start(struct pico_dhcp_server_setting *setting) +{ + int ret; + + PicoTcpLock->lock(); + ret = pico_dhcp_server_initiate(setting); + PicoTcpLock->unlock(); + picotcp_async_interrupt(NULL); + + return ret; +} + /****** Asynchronous event handling ******/ static int appEvents = 0; static Mutex asyncMutex; @@ -572,4 +585,4 @@ free(dnsResult); return hostdata; -} \ No newline at end of file +}