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:
Mon Nov 04 07:54:12 2013 +0000
Revision:
111:4003cf17bc15
Parent:
74:c146c4e346c4
Child:
122:5b1e9de8bf7f
Issue #48 fixed.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tass 68:0847e35d08a6 1 /*********************************************************************
tass 68:0847e35d08a6 2 PicoTCP. Copyright (c) 2012 TASS Belgium NV. Some rights reserved.
tass 68:0847e35d08a6 3 See LICENSE and COPYING for usage.
tass 68:0847e35d08a6 4
tass 68:0847e35d08a6 5 .
tass 68:0847e35d08a6 6
tass 68:0847e35d08a6 7 *********************************************************************/
tass 68:0847e35d08a6 8 #ifndef _INCLUDE_PICO_IPV4
tass 68:0847e35d08a6 9 #define _INCLUDE_PICO_IPV4
tass 68:0847e35d08a6 10 #include "pico_addressing.h"
tass 68:0847e35d08a6 11 #include "pico_protocol.h"
tass 68:0847e35d08a6 12 #include "pico_tree.h"
tass 68:0847e35d08a6 13
tass 68:0847e35d08a6 14 #define PICO_IPV4_INADDR_ANY 0x00000000U
tass 68:0847e35d08a6 15
tass 74:c146c4e346c4 16 #define PICO_SIZE_IP4HDR (uint32_t)((sizeof(struct pico_ipv4_hdr)))
tass 68:0847e35d08a6 17 #define PICO_IPV4_DONTFRAG 0x4000
tass 68:0847e35d08a6 18 #define PICO_IPV4_MOREFRAG 0x2000
tass 68:0847e35d08a6 19 #define PICO_IPV4_FRAG_MASK 0x1FFF
tass 68:0847e35d08a6 20 #define PICO_IPV4_DEFAULT_TTL 64
tass 111:4003cf17bc15 21 #ifndef MBED
tass 111:4003cf17bc15 22 #define PICO_IPV4_FRAG_MAX_SIZE (63 * 1024)
tass 111:4003cf17bc15 23 #else
tass 111:4003cf17bc15 24 #define PICO_IPV4_FRAG_MAX_SIZE PICO_DEFAULT_SOCKETQ
tass 111:4003cf17bc15 25 #endif
tass 68:0847e35d08a6 26
tass 68:0847e35d08a6 27 extern struct pico_protocol pico_proto_ipv4;
tass 68:0847e35d08a6 28
tass 68:0847e35d08a6 29 struct __attribute__((packed)) pico_ipv4_hdr {
tass 68:0847e35d08a6 30 uint8_t vhl;
tass 68:0847e35d08a6 31 uint8_t tos;
tass 68:0847e35d08a6 32 uint16_t len;
tass 68:0847e35d08a6 33 uint16_t id;
tass 68:0847e35d08a6 34 uint16_t frag;
tass 68:0847e35d08a6 35 uint8_t ttl;
tass 68:0847e35d08a6 36 uint8_t proto;
tass 68:0847e35d08a6 37 uint16_t crc;
tass 68:0847e35d08a6 38 struct pico_ip4 src;
tass 68:0847e35d08a6 39 struct pico_ip4 dst;
tass 68:0847e35d08a6 40 uint8_t options[0];
tass 68:0847e35d08a6 41 };
tass 68:0847e35d08a6 42
tass 68:0847e35d08a6 43 struct __attribute__((packed)) pico_ipv4_pseudo_hdr
tass 68:0847e35d08a6 44 {
tass 68:0847e35d08a6 45 struct pico_ip4 src;
tass 68:0847e35d08a6 46 struct pico_ip4 dst;
tass 68:0847e35d08a6 47 uint8_t zeros;
tass 68:0847e35d08a6 48 uint8_t proto;
tass 68:0847e35d08a6 49 uint16_t len;
tass 68:0847e35d08a6 50 };
tass 68:0847e35d08a6 51
tass 68:0847e35d08a6 52 /* Interface: link to device */
tass 68:0847e35d08a6 53 struct pico_mcast_list;
tass 68:0847e35d08a6 54
tass 68:0847e35d08a6 55 struct pico_ipv4_link
tass 68:0847e35d08a6 56 {
tass 68:0847e35d08a6 57 struct pico_device *dev;
tass 68:0847e35d08a6 58 struct pico_ip4 address;
tass 68:0847e35d08a6 59 struct pico_ip4 netmask;
tass 68:0847e35d08a6 60 #ifdef PICO_SUPPORT_MCAST
tass 68:0847e35d08a6 61 struct pico_tree *MCASTGroups;
tass 68:0847e35d08a6 62 uint8_t mcast_compatibility;
tass 68:0847e35d08a6 63 uint8_t mcast_last_query_interval;
tass 68:0847e35d08a6 64 #endif
tass 68:0847e35d08a6 65 };
tass 68:0847e35d08a6 66
tass 68:0847e35d08a6 67 #ifdef PICO_SUPPORT_MCAST
tass 68:0847e35d08a6 68 struct pico_mcast_group {
tass 68:0847e35d08a6 69 uint8_t filter_mode;
tass 68:0847e35d08a6 70 uint16_t reference_count;
tass 68:0847e35d08a6 71 struct pico_ip4 mcast_addr;
tass 68:0847e35d08a6 72 struct pico_tree MCASTSources;
tass 68:0847e35d08a6 73 };
tass 68:0847e35d08a6 74 #endif
tass 68:0847e35d08a6 75
tass 68:0847e35d08a6 76 int pico_ipv4_to_string(char *ipbuf, const uint32_t ip);
tass 68:0847e35d08a6 77 int pico_string_to_ipv4(const char *ipstr, uint32_t *ip);
tass 68:0847e35d08a6 78 int pico_ipv4_valid_netmask(uint32_t mask);
tass 68:0847e35d08a6 79 int pico_ipv4_is_unicast(uint32_t address);
tass 68:0847e35d08a6 80 int pico_ipv4_is_multicast(uint32_t address);
tass 68:0847e35d08a6 81 int pico_ipv4_is_broadcast(uint32_t addr);
tass 68:0847e35d08a6 82
tass 68:0847e35d08a6 83 int pico_ipv4_link_add(struct pico_device *dev, struct pico_ip4 address, struct pico_ip4 netmask);
tass 68:0847e35d08a6 84 int pico_ipv4_link_del(struct pico_device *dev, struct pico_ip4 address);
tass 68:0847e35d08a6 85 int pico_ipv4_rebound(struct pico_frame *f);
tass 68:0847e35d08a6 86
tass 68:0847e35d08a6 87 int pico_ipv4_frame_push(struct pico_frame *f, struct pico_ip4 *dst, uint8_t proto);
tass 68:0847e35d08a6 88 struct pico_ipv4_link *pico_ipv4_link_get(struct pico_ip4 *address);
tass 68:0847e35d08a6 89 struct pico_ipv4_link *pico_ipv4_link_by_dev(struct pico_device *dev);
tass 74:c146c4e346c4 90 struct pico_ipv4_link *pico_ipv4_link_by_dev_next(struct pico_device *dev, struct pico_ipv4_link *last);
tass 68:0847e35d08a6 91 struct pico_device *pico_ipv4_link_find(struct pico_ip4 *address);
tass 68:0847e35d08a6 92 struct pico_ip4 *pico_ipv4_source_find(const struct pico_ip4 *dst);
tass 68:0847e35d08a6 93 int pico_ipv4_route_add(struct pico_ip4 address, struct pico_ip4 netmask, struct pico_ip4 gateway, int metric, struct pico_ipv4_link *link);
tass 72:887bc44746ff 94 int pico_ipv4_route_del(struct pico_ip4 address, struct pico_ip4 netmask, int metric);
tass 68:0847e35d08a6 95 struct pico_ip4 pico_ipv4_route_get_gateway(struct pico_ip4 *addr);
tass 68:0847e35d08a6 96 void pico_ipv4_unreachable(struct pico_frame *f, int err);
tass 68:0847e35d08a6 97
tass 68:0847e35d08a6 98 int pico_ipv4_mcast_join(struct pico_ip4 *mcast_link, struct pico_ip4 *mcast_group, uint8_t reference_count, uint8_t filter_mode, struct pico_tree *MCASTFilter);
tass 68:0847e35d08a6 99 int pico_ipv4_mcast_leave(struct pico_ip4 *mcast_link, struct pico_ip4 *mcast_group, uint8_t reference_count, uint8_t filter_mode, struct pico_tree *MCASTFilter);
tass 68:0847e35d08a6 100 struct pico_ipv4_link *pico_ipv4_get_default_mcastlink(void);
tass 68:0847e35d08a6 101
tass 68:0847e35d08a6 102 #endif /* _INCLUDE_PICO_IPV4 */