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 RTOS
  • generic mbed Ethernet driver
  • high performance NXP LPC1768 specific Ethernet driver
  • Multi-threading support for mbed RTOS
  • Berkeley sockets and integration with the New Socket API
  • Fork of the apps running on top of the New Socket API
  • Scheduling 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.

Committer:
tass
Date:
Thu Jan 28 15:12:00 2016 +0100
Revision:
155:a70f34550c34
Parent:
139:1f7a4a8525ef
Adding TCP flag for FIN.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tass picotcp@tass.be 139:1f7a4a8525ef 1 /*
tass picotcp@tass.be 139:1f7a4a8525ef 2 *
tass picotcp@tass.be 139:1f7a4a8525ef 3 * PicoTCP Socket interface for mbed.
tass picotcp@tass.be 139:1f7a4a8525ef 4 * Copyright (C) 2013 TASS Belgium NV
tass picotcp@tass.be 139:1f7a4a8525ef 5 *
tass picotcp@tass.be 139:1f7a4a8525ef 6 * Released under GPL v2
tass picotcp@tass.be 139:1f7a4a8525ef 7 *
tass picotcp@tass.be 139:1f7a4a8525ef 8 * Other licensing models might apply at the sole discretion of the copyright holders.
tass picotcp@tass.be 139:1f7a4a8525ef 9 *
tass picotcp@tass.be 139:1f7a4a8525ef 10 *
tass picotcp@tass.be 139:1f7a4a8525ef 11 * This software is based on the mbed.org EthernetInterface implementation:
tass picotcp@tass.be 139:1f7a4a8525ef 12 * Copyright (C) 2012 mbed.org, MIT License
tass picotcp@tass.be 139:1f7a4a8525ef 13 *
tass picotcp@tass.be 139:1f7a4a8525ef 14 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
tass picotcp@tass.be 139:1f7a4a8525ef 15 * and associated documentation files (the "Software"), to deal in the Software without restriction,
tass picotcp@tass.be 139:1f7a4a8525ef 16 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
tass picotcp@tass.be 139:1f7a4a8525ef 17 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
tass picotcp@tass.be 139:1f7a4a8525ef 18 * furnished to do so, subject to the following conditions:
tass picotcp@tass.be 139:1f7a4a8525ef 19 *
tass picotcp@tass.be 139:1f7a4a8525ef 20 * The above copyright notice and this permission notice shall be included in all copies or
tass picotcp@tass.be 139:1f7a4a8525ef 21 * substantial portions of the Software.
tass picotcp@tass.be 139:1f7a4a8525ef 22 *
tass picotcp@tass.be 139:1f7a4a8525ef 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
tass picotcp@tass.be 139:1f7a4a8525ef 24 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
tass picotcp@tass.be 139:1f7a4a8525ef 25 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
tass picotcp@tass.be 139:1f7a4a8525ef 26 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
tass picotcp@tass.be 139:1f7a4a8525ef 27 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
tass picotcp@tass.be 139:1f7a4a8525ef 28 */
tass picotcp@tass.be 139:1f7a4a8525ef 29
tass picotcp@tass.be 139:1f7a4a8525ef 30 #include "Socket/DHCPServer.h"
tass picotcp@tass.be 139:1f7a4a8525ef 31 #include "wrapper.h"
tass picotcp@tass.be 139:1f7a4a8525ef 32 #include "proxy_endpoint.h"
tass picotcp@tass.be 139:1f7a4a8525ef 33
tass picotcp@tass.be 139:1f7a4a8525ef 34 static struct pico_dhcp_server_setting setting = {0};
tass picotcp@tass.be 139:1f7a4a8525ef 35
tass picotcp@tass.be 139:1f7a4a8525ef 36 DHCPServer::DHCPServer() {
tass picotcp@tass.be 139:1f7a4a8525ef 37 }
tass picotcp@tass.be 139:1f7a4a8525ef 38
tass picotcp@tass.be 139:1f7a4a8525ef 39 int DHCPServer::init(const char* ip) {
tass picotcp@tass.be 139:1f7a4a8525ef 40 return DHCPServer::set_server_ip(ip);
tass picotcp@tass.be 139:1f7a4a8525ef 41 }
tass picotcp@tass.be 139:1f7a4a8525ef 42
tass picotcp@tass.be 139:1f7a4a8525ef 43 int DHCPServer::set_server_ip(const char *ip) {
tass picotcp@tass.be 139:1f7a4a8525ef 44 return pico_string_to_ipv4(ip, &setting.server_ip.addr);
tass picotcp@tass.be 139:1f7a4a8525ef 45 }
tass picotcp@tass.be 139:1f7a4a8525ef 46
tass picotcp@tass.be 139:1f7a4a8525ef 47 int DHCPServer::set_pool_start(const char * pool_start) {
tass picotcp@tass.be 139:1f7a4a8525ef 48 return pico_string_to_ipv4(pool_start, &setting.pool_start);
tass picotcp@tass.be 139:1f7a4a8525ef 49 }
tass picotcp@tass.be 139:1f7a4a8525ef 50
tass picotcp@tass.be 139:1f7a4a8525ef 51 int DHCPServer::set_pool_end(const char * pool_end) {
tass picotcp@tass.be 139:1f7a4a8525ef 52 return pico_string_to_ipv4(pool_end, &setting.pool_end);
tass picotcp@tass.be 139:1f7a4a8525ef 53 }
tass picotcp@tass.be 139:1f7a4a8525ef 54
tass picotcp@tass.be 139:1f7a4a8525ef 55 void DHCPServer::set_lease_time(uint32_t lease_time) {
tass picotcp@tass.be 139:1f7a4a8525ef 56 setting.lease_time = lease_time;
tass picotcp@tass.be 139:1f7a4a8525ef 57 }
tass picotcp@tass.be 139:1f7a4a8525ef 58
tass picotcp@tass.be 139:1f7a4a8525ef 59 int DHCPServer::start(void) {
tass picotcp@tass.be 139:1f7a4a8525ef 60 return picotcp_dhcp_server_start(&setting);
tass picotcp@tass.be 139:1f7a4a8525ef 61 }
tass picotcp@tass.be 139:1f7a4a8525ef 62