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.

Revision:
149:5f4cb161cec3
Parent:
133:5b075f5e141a
Child:
152:a3d286bf94e5
--- a/modules/pico_tcp.h	Tue Mar 11 15:34:51 2014 +0100
+++ b/modules/pico_tcp.h	Wed Apr 09 14:31:41 2014 +0200
@@ -5,15 +5,15 @@
    .
 
  *********************************************************************/
-#ifndef _INCLUDE_PICO_TCP
-#define _INCLUDE_PICO_TCP
+#ifndef INCLUDE_PICO_TCP
+#define INCLUDE_PICO_TCP
 #include "pico_addressing.h"
 #include "pico_protocol.h"
 #include "pico_socket.h"
 
 extern struct pico_protocol pico_proto_tcp;
 
-struct __attribute__((packed)) pico_tcp_hdr {
+PACKED_STRUCT_DEF pico_tcp_hdr {
     struct pico_trans trans;
     uint32_t seq;
     uint32_t ack;
@@ -24,7 +24,7 @@
     uint16_t urgent;
 };
 
-struct __attribute__((packed)) tcp_pseudo_hdr_ipv4
+PACKED_STRUCT_DEF tcp_pseudo_hdr_ipv4
 {
     struct pico_ip4 src;
     struct pico_ip4 dst;
@@ -37,10 +37,6 @@
 #define PICO_SIZE_TCPOPT_SYN 20
 #define PICO_SIZE_TCPHDR (uint32_t)(sizeof(struct pico_tcp_hdr))
 
-#define PICO_TCP_DEFAULT_MSS 1444
-
-
-
 /* TCP options */
 #define PICO_TCP_OPTION_END         0x00
 #define PICO_TCPOPTLEN_END        1u
@@ -58,11 +54,11 @@
 #define PICO_TCPOPTLEN_TIMESTAMP  10u
 
 /* TCP flags */
-#define PICO_TCP_FIN 0x01
-#define PICO_TCP_SYN 0x02
-#define PICO_TCP_RST 0x04
-#define PICO_TCP_PSH 0x08
-#define PICO_TCP_ACK 0x10
+#define PICO_TCP_FIN 0x01u
+#define PICO_TCP_SYN 0x02u
+#define PICO_TCP_RST 0x04u
+#define PICO_TCP_PSH 0x08u
+#define PICO_TCP_ACK 0x10u
 #define PICO_TCP_URG 0x20u
 #define PICO_TCP_ECN 0x40u
 #define PICO_TCP_CWR 0x80u
@@ -74,33 +70,33 @@
 #define PICO_TCP_RSTACK    (PICO_TCP_RST | PICO_TCP_ACK)
 
 
-struct __attribute__((packed)) pico_tcp_option
+PACKED_STRUCT_DEF pico_tcp_option
 {
     uint8_t kind;
     uint8_t len;
-#if 0
-    union {
-        uint16_t mss;
-        uint8_t wshift;
-        struct {
-            uint32_t tsval;
-            uint32_t tsecr;
-        } timestamp;
-    } data;
-#endif
 };
 
-struct pico_socket *pico_tcp_open(void);
+struct pico_socket *pico_tcp_open(uint16_t family);
 uint32_t pico_tcp_read(struct pico_socket *s, void *buf, uint32_t len);
 int pico_tcp_initconn(struct pico_socket *s);
 int pico_tcp_input(struct pico_socket *s, struct pico_frame *f);
+uint16_t pico_tcp_checksum(struct pico_frame *f);
 uint16_t pico_tcp_checksum_ipv4(struct pico_frame *f);
+#ifdef PICO_SUPPORT_IPV6
+uint16_t pico_tcp_checksum_ipv6(struct pico_frame *f);
+#endif
 uint16_t pico_tcp_overhead(struct pico_socket *s);
 int pico_tcp_output(struct pico_socket *s, int loop_score);
 int pico_tcp_queue_in_is_empty(struct pico_socket *s);
 int pico_tcp_reply_rst(struct pico_frame *f);
 void pico_tcp_cleanup_queues(struct pico_socket *sck);
 void pico_tcp_notify_closing(struct pico_socket *sck);
-void transport_flags_update(struct pico_frame *, struct pico_socket *);
+void pico_tcp_flags_update(struct pico_frame *f, struct pico_socket *s);
+int pico_tcp_set_bufsize_in(struct pico_socket *s, uint32_t value);
+int pico_tcp_set_bufsize_out(struct pico_socket *s, uint32_t value);
+int pico_tcp_get_bufsize_in(struct pico_socket *s, uint32_t *value);
+int pico_tcp_get_bufsize_out(struct pico_socket *s, uint32_t *value);
+uint16_t pico_tcp_get_socket_mtu(struct pico_socket *s);
+int pico_tcp_check_listen_close(struct pico_socket *s);
 
 #endif