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.
Diff: modules/pico_icmp4.c
- Revision:
- 149:5f4cb161cec3
- Parent:
- 131:4758606c9316
- Child:
- 152:a3d286bf94e5
--- a/modules/pico_icmp4.c Tue Mar 11 15:34:51 2014 +0100 +++ b/modules/pico_icmp4.c Wed Apr 09 14:31:41 2014 +0200 @@ -52,7 +52,7 @@ if (hdr->type == PICO_ICMP_ECHO) { hdr->type = PICO_ICMP_ECHOREPLY; /* outgoing frames require a f->len without the ethernet header len */ - if (f->dev->eth) + if (f->dev && f->dev->eth) f->len -= PICO_SIZE_ETHHDR; pico_icmp4_checksum(f); @@ -140,6 +140,12 @@ return pico_icmp4_notify(f, PICO_ICMP_TIME_EXCEEDED, PICO_ICMP_TIMXCEED_INTRANS); } +int pico_icmp4_mtu_exceeded(struct pico_frame *f) +{ + /*Parameter check executed in pico_icmp4_notify*/ + return pico_icmp4_notify(f, PICO_ICMP_UNREACH, PICO_ICMP_UNREACH_NEEDFRAG); +} + int pico_icmp4_packet_filtered(struct pico_frame *f) { /*Parameter check executed in pico_icmp4_notify*/ @@ -187,10 +193,13 @@ PICO_TREE_DECLARE(Pings, cookie_compare); -static uint8_t pico_icmp4_send_echo(struct pico_icmp4_ping_cookie *cookie) +static int8_t pico_icmp4_send_echo(struct pico_icmp4_ping_cookie *cookie) { struct pico_frame *echo = pico_proto_ipv4.alloc(&pico_proto_ipv4, (uint16_t)(PICO_ICMPHDR_UN_SIZE + cookie->size)); struct pico_icmp4_hdr *hdr; + if (!echo) { + return -1; + } hdr = (struct pico_icmp4_hdr *) echo->transport_hdr; @@ -226,7 +235,7 @@ } pico_tree_delete(&Pings, cookie); - pico_free(cookie); + PICO_FREE(cookie); } } @@ -236,7 +245,7 @@ pico_icmp4_send_echo(cookie); cookie->timestamp = pico_tick; pico_timer_add((uint32_t)cookie->timeout, ping_timeout, cookie); - if (cookie->seq < cookie->count) + if (cookie->seq < (uint16_t)cookie->count) pico_timer_add((uint32_t)cookie->interval, next_ping, cookie); } @@ -246,8 +255,8 @@ IGNORE_PARAMETER(now); if(pico_tree_findKey(&Pings, cookie)) { - if (cookie->seq < cookie->count) { - newcookie = pico_zalloc(sizeof(struct pico_icmp4_ping_cookie)); + if (cookie->seq < (uint16_t)cookie->count) { + newcookie = PICO_ZALLOC(sizeof(struct pico_icmp4_ping_cookie)); if (!newcookie) return; @@ -272,7 +281,7 @@ if (cookie) { struct pico_icmp4_stats stats; cookie->err = PICO_PING_ERR_REPLIED; - stats.dst = cookie->dst; + stats.dst = ((struct pico_ipv4_hdr *)f->net_hdr)->src; stats.seq = cookie->seq; stats.size = cookie->size; stats.time = pico_tick - cookie->timestamp; @@ -295,15 +304,15 @@ return -1; } - cookie = pico_zalloc(sizeof(struct pico_icmp4_ping_cookie)); + cookie = PICO_ZALLOC(sizeof(struct pico_icmp4_ping_cookie)); if (!cookie) { pico_err = PICO_ERR_ENOMEM; return -1; } - if (pico_string_to_ipv4(dst, &cookie->dst.addr) < 0) { + if (pico_string_to_ipv4(dst, (uint32_t *)&cookie->dst.addr) < 0) { pico_err = PICO_ERR_EINVAL; - pico_free(cookie); + PICO_FREE(cookie); return -1; }