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 127:476fed453d4d, committed 2013-12-04
- Comitter:
- tass
- Date:
- Wed Dec 04 08:39:16 2013 +0000
- Parent:
- 126:374ed597275a
- Child:
- 128:ae39e6e81531
- Commit message:
- Exported host to network functions.; EthernetInterface can return now, the assigned gateway and nemask.;
Changed in this revision
--- a/EthernetInterface/EthernetInterface.cpp Thu Nov 28 13:54:03 2013 +0000 +++ b/EthernetInterface/EthernetInterface.cpp Wed Dec 04 08:39:16 2013 +0000 @@ -58,13 +58,14 @@ static char mac_addr[19]; static char ip_addr[17] = "\0"; static char gw_addr[17] = "\0"; +static char nm_addr[17] = "\0"; static bool use_dhcp = false; static bool is_initialized = false; static void dhcp_cb(void *cli, int code) { void *id = NULL; - struct pico_ip4 address, gateway, zero = {}; + struct pico_ip4 address, gateway, netmask, zero = {}; if (PICO_DHCP_ERROR == code) goto fail; @@ -77,8 +78,13 @@ goto fail; address = pico_dhcp_get_address(id); gateway = pico_dhcp_get_gateway(id); + netmask = pico_dhcp_get_netmask(id); //if (address) ? // still needed + pico_ipv4_to_string(ip_addr, address.addr); + pico_ipv4_to_string(gw_addr,gateway.addr); + pico_ipv4_to_string(nm_addr,netmask.addr); + eth_dbg("IP assigned : %s\n",ip_addr); if (gateway.addr != 0) { @@ -140,6 +146,8 @@ use_dhcp = false; strcpy(ip_addr, ip); + strcpy(nm_addr, mask); + strcpy(gw_addr,gateway); pico_string_to_ipv4(ip, &pico_addr.addr); pico_string_to_ipv4(mask, &pico_netmask.addr); @@ -187,6 +195,14 @@ return ip_addr; } +char* EthernetInterface::getIPGateway() { + return gw_addr; +} + +char* EthernetInterface::getIPNetmask() { + return nm_addr; +} + int EthernetInterface::registerLinkStatus(void (*cb)(uint32_t linkStatus)) { ::linkCb = cb;
--- a/EthernetInterface/EthernetInterface.h Thu Nov 28 13:54:03 2013 +0000 +++ b/EthernetInterface/EthernetInterface.h Wed Dec 04 08:39:16 2013 +0000 @@ -93,7 +93,8 @@ * \return a pointer to a string containing the IP address */ static char* getIPAddress(); - + static char* getIPGateway(); + static char* getIPNetmask(); /** Register a callback to tell the status of the link. * \return 0 if callback was registered. @@ -146,4 +147,7 @@ #include "Endpoint.h" #include "UDPSocket.h" +#define htonl long_be +#define ntohl long_be + #endif /* ETHERNETINTERFACE_H_ */
--- a/modules/pico_dhcp_client.c Thu Nov 28 13:54:03 2013 +0000 +++ b/modules/pico_dhcp_client.c Wed Dec 04 08:39:16 2013 +0000 @@ -920,6 +920,11 @@ return ((struct pico_dhcp_client_cookie*)dhcpc)->gateway; } +struct pico_ip4 pico_dhcp_get_netmask(void *dhcpc) +{ + return ((struct pico_dhcp_client_cookie*)dhcpc)->netmask; +} + struct pico_ip4 pico_dhcp_get_nameserver(void* dhcpc) { return ((struct pico_dhcp_client_cookie*)dhcpc)->nameserver;
--- a/modules/pico_dhcp_client.h Thu Nov 28 13:54:03 2013 +0000 +++ b/modules/pico_dhcp_client.h Wed Dec 04 08:39:16 2013 +0000 @@ -16,6 +16,7 @@ void *pico_dhcp_get_identifier(uint32_t xid); struct pico_ip4 pico_dhcp_get_address(void *cli); struct pico_ip4 pico_dhcp_get_gateway(void *cli); +struct pico_ip4 pico_dhcp_get_netmask(void *cli); struct pico_ip4 pico_dhcp_get_nameserver(void* cli); /* possible codes for the callback */