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:
daniele
Date:
Fri May 24 15:25:25 2013 +0000
Revision:
3:b4047e8a0123
Child:
51:ab4529a384a6
Updated from main repo + fixed Mutexes;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
daniele 3:b4047e8a0123 1 /*********************************************************************
daniele 3:b4047e8a0123 2 PicoTCP. Copyright (c) 2012 TASS Belgium NV. Some rights reserved.
daniele 3:b4047e8a0123 3 See LICENSE and COPYING for usage.
daniele 3:b4047e8a0123 4
daniele 3:b4047e8a0123 5 *********************************************************************/
daniele 3:b4047e8a0123 6 #ifndef _INCLUDE_PICO_PROTOCOL
daniele 3:b4047e8a0123 7 #define _INCLUDE_PICO_PROTOCOL
daniele 3:b4047e8a0123 8 #include <stdint.h>
daniele 3:b4047e8a0123 9 #include "pico_queue.h"
daniele 3:b4047e8a0123 10
daniele 3:b4047e8a0123 11 #define PICO_LOOP_DIR_IN 1
daniele 3:b4047e8a0123 12 #define PICO_LOOP_DIR_OUT 2
daniele 3:b4047e8a0123 13
daniele 3:b4047e8a0123 14 enum pico_layer {
daniele 3:b4047e8a0123 15 PICO_LAYER_DATALINK = 2, /* Ethernet only. */
daniele 3:b4047e8a0123 16 PICO_LAYER_NETWORK = 3, /* IPv4, IPv6, ARP. Arp is there because it communicates with L2 */
daniele 3:b4047e8a0123 17 PICO_LAYER_TRANSPORT = 4, /* UDP, TCP, ICMP */
daniele 3:b4047e8a0123 18 PICO_LAYER_SOCKET = 5 /* Socket management */
daniele 3:b4047e8a0123 19 };
daniele 3:b4047e8a0123 20
daniele 3:b4047e8a0123 21 enum pico_err_e {
daniele 3:b4047e8a0123 22 PICO_ERR_NOERR = 0,
daniele 3:b4047e8a0123 23 PICO_ERR_EPERM,
daniele 3:b4047e8a0123 24 PICO_ERR_ENOENT,
daniele 3:b4047e8a0123 25 /* ... */
daniele 3:b4047e8a0123 26 PICO_ERR_EINTR = 4,
daniele 3:b4047e8a0123 27 PICO_ERR_EIO,
daniele 3:b4047e8a0123 28 PICO_ERR_ENXIO,
daniele 3:b4047e8a0123 29 /* ... */
daniele 3:b4047e8a0123 30 PICO_ERR_EAGAIN = 11,
daniele 3:b4047e8a0123 31 PICO_ERR_ENOMEM,
daniele 3:b4047e8a0123 32 PICO_ERR_EACCESS,
daniele 3:b4047e8a0123 33 PICO_ERR_EFAULT,
daniele 3:b4047e8a0123 34 /* ... */
daniele 3:b4047e8a0123 35 PICO_ERR_EBUSY = 16,
daniele 3:b4047e8a0123 36 PICO_ERR_EEXIST = 17,
daniele 3:b4047e8a0123 37 /* ... */
daniele 3:b4047e8a0123 38 PICO_ERR_EINVAL = 22,
daniele 3:b4047e8a0123 39 /* ... */
daniele 3:b4047e8a0123 40 PICO_ERR_EPROTO = 71,
daniele 3:b4047e8a0123 41 PICO_ERR_ENOPROTOOPT = 92,
daniele 3:b4047e8a0123 42 PICO_ERR_EPROTONOSUPPORT = 93,
daniele 3:b4047e8a0123 43
daniele 3:b4047e8a0123 44 /* ... */
daniele 3:b4047e8a0123 45 PICO_ERR_EADDRINUSE = 98,
daniele 3:b4047e8a0123 46 PICO_ERR_EADDRNOTAVAIL,
daniele 3:b4047e8a0123 47 PICO_ERR_ENETUNREACH,
daniele 3:b4047e8a0123 48
daniele 3:b4047e8a0123 49 /* ... */
daniele 3:b4047e8a0123 50 PICO_ERR_ECONNRESET = 104,
daniele 3:b4047e8a0123 51
daniele 3:b4047e8a0123 52 /* ... */
daniele 3:b4047e8a0123 53 PICO_ERR_EISCONN = 106,
daniele 3:b4047e8a0123 54 PICO_ERR_ENOTCONN,
daniele 3:b4047e8a0123 55 PICO_ERR_ESHUTDOWN,
daniele 3:b4047e8a0123 56 /* ... */
daniele 3:b4047e8a0123 57 PICO_ERR_ETIMEDOUT = 110,
daniele 3:b4047e8a0123 58 PICO_ERR_ECONNREFUSED = 111,
daniele 3:b4047e8a0123 59 PICO_ERR_EHOSTDOWN,
daniele 3:b4047e8a0123 60 PICO_ERR_EHOSTUNREACH,
daniele 3:b4047e8a0123 61 /* ... */
daniele 3:b4047e8a0123 62 PICO_ERR_EOPNOTSUPP = 122,
daniele 3:b4047e8a0123 63
daniele 3:b4047e8a0123 64 };
daniele 3:b4047e8a0123 65
daniele 3:b4047e8a0123 66 typedef enum pico_err_e pico_err_t;
daniele 3:b4047e8a0123 67 extern volatile pico_err_t pico_err;
daniele 3:b4047e8a0123 68
daniele 3:b4047e8a0123 69 #define IS_IPV6(f) ((((uint8_t *)(f->net_hdr))[0] & 0xf0) == 0x60)
daniele 3:b4047e8a0123 70 #define IS_IPV4(f) ((((uint8_t *)(f->net_hdr))[0] & 0xf0) == 0x40)
daniele 3:b4047e8a0123 71
daniele 3:b4047e8a0123 72 #define MAX_PROTOCOL_NAME 16
daniele 3:b4047e8a0123 73
daniele 3:b4047e8a0123 74 struct pico_protocol {
daniele 3:b4047e8a0123 75 char name[MAX_PROTOCOL_NAME];
daniele 3:b4047e8a0123 76 uint32_t hash;
daniele 3:b4047e8a0123 77 enum pico_layer layer;
daniele 3:b4047e8a0123 78 int proto_number;
daniele 3:b4047e8a0123 79 struct pico_queue *q_in;
daniele 3:b4047e8a0123 80 struct pico_queue *q_out;
daniele 3:b4047e8a0123 81 struct pico_frame *(*alloc)(struct pico_protocol *self, int size); /* Frame allocation. */
daniele 3:b4047e8a0123 82 int (*push) (struct pico_protocol *self, struct pico_frame *p); /* Push function, for active outgoing pkts from above */
daniele 3:b4047e8a0123 83 int (*process_out)(struct pico_protocol *self, struct pico_frame *p); /* Send loop. */
daniele 3:b4047e8a0123 84 int (*process_in)(struct pico_protocol *self, struct pico_frame *p); /* Recv loop. */
daniele 3:b4047e8a0123 85 };
daniele 3:b4047e8a0123 86
daniele 3:b4047e8a0123 87 int pico_protocols_loop(int loop_score);
daniele 3:b4047e8a0123 88 void pico_protocol_init(struct pico_protocol *p);
daniele 3:b4047e8a0123 89
daniele 3:b4047e8a0123 90 int pico_protocol_datalink_loop(int loop_score, int direction);
daniele 3:b4047e8a0123 91 int pico_protocol_network_loop(int loop_score, int direction);
daniele 3:b4047e8a0123 92 int pico_protocol_transport_loop(int loop_score, int direction);
daniele 3:b4047e8a0123 93 int pico_protocol_socket_loop(int loop_score, int direction);
daniele 3:b4047e8a0123 94
daniele 3:b4047e8a0123 95 #endif