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:
Thu Sep 26 07:05:22 2013 +0000
Revision:
70:cd218dd180e5
Parent:
3:b4047e8a0123
Child:
73:dfb737147f6e
Update from masterbranch

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_FRAME
daniele 3:b4047e8a0123 7 #define _INCLUDE_PICO_FRAME
daniele 3:b4047e8a0123 8 #include "pico_config.h"
daniele 3:b4047e8a0123 9
daniele 3:b4047e8a0123 10
daniele 3:b4047e8a0123 11 #define PICO_FRAME_FLAG_BCAST (0x01)
daniele 3:b4047e8a0123 12 #define PICO_FRAME_FLAG_SACKED (0x80)
daniele 3:b4047e8a0123 13 #define IS_BCAST(f) ((f->flags & PICO_FRAME_FLAG_BCAST) == PICO_FRAME_FLAG_BCAST)
daniele 3:b4047e8a0123 14
daniele 3:b4047e8a0123 15
daniele 3:b4047e8a0123 16 struct pico_socket;
daniele 3:b4047e8a0123 17
daniele 3:b4047e8a0123 18
daniele 3:b4047e8a0123 19 struct pico_frame {
daniele 3:b4047e8a0123 20
daniele 3:b4047e8a0123 21 /* Connector for queues */
daniele 3:b4047e8a0123 22 struct pico_frame *next;
daniele 3:b4047e8a0123 23
daniele 3:b4047e8a0123 24 /* Start of the whole buffer, total frame length. */
daniele 3:b4047e8a0123 25 unsigned char *buffer;
daniele 3:b4047e8a0123 26 uint32_t buffer_len;
daniele 3:b4047e8a0123 27
daniele 3:b4047e8a0123 28 /* For outgoing packets: this is the meaningful buffer. */
daniele 3:b4047e8a0123 29 unsigned char *start;
daniele 3:b4047e8a0123 30 uint32_t len;
daniele 3:b4047e8a0123 31
daniele 3:b4047e8a0123 32 /* Pointer to usage counter */
daniele 3:b4047e8a0123 33 uint32_t *usage_count;
daniele 3:b4047e8a0123 34
daniele 3:b4047e8a0123 35 /* Pointer to protocol headers */
daniele 3:b4047e8a0123 36 uint8_t *datalink_hdr;
daniele 3:b4047e8a0123 37
daniele 3:b4047e8a0123 38 uint8_t *net_hdr;
tass 70:cd218dd180e5 39 uint16_t net_len;
daniele 3:b4047e8a0123 40 uint8_t *transport_hdr;
tass 70:cd218dd180e5 41 uint16_t transport_len;
daniele 3:b4047e8a0123 42 uint8_t *app_hdr;
tass 70:cd218dd180e5 43 uint16_t app_len;
daniele 3:b4047e8a0123 44
daniele 3:b4047e8a0123 45 /* Pointer to the phisical device this packet belongs to.
daniele 3:b4047e8a0123 46 * Should be valid in both routing directions
daniele 3:b4047e8a0123 47 */
daniele 3:b4047e8a0123 48 struct pico_device *dev;
daniele 3:b4047e8a0123 49
tass 70:cd218dd180e5 50 uint64_t timestamp;
daniele 3:b4047e8a0123 51
daniele 3:b4047e8a0123 52 /* Failures due to bad datalink addressing. */
daniele 3:b4047e8a0123 53 uint16_t failure_count;
daniele 3:b4047e8a0123 54
daniele 3:b4047e8a0123 55 /* Protocol over IP */
daniele 3:b4047e8a0123 56 uint8_t proto;
daniele 3:b4047e8a0123 57
daniele 3:b4047e8a0123 58 /* PICO_FRAME_FLAG_* */
daniele 3:b4047e8a0123 59 uint8_t flags;
daniele 3:b4047e8a0123 60
daniele 3:b4047e8a0123 61 /* Pointer to payload */
daniele 3:b4047e8a0123 62 unsigned char *payload;
tass 70:cd218dd180e5 63 uint16_t payload_len;
daniele 3:b4047e8a0123 64
daniele 3:b4047e8a0123 65 #ifdef PICO_SUPPORT_IPFRAG
daniele 3:b4047e8a0123 66 /* Payload fragmentation info (big endian)*/
daniele 3:b4047e8a0123 67 uint16_t frag;
daniele 3:b4047e8a0123 68 #endif
daniele 3:b4047e8a0123 69
daniele 3:b4047e8a0123 70 /* Pointer to socket */
daniele 3:b4047e8a0123 71 struct pico_socket *sock;
daniele 3:b4047e8a0123 72
daniele 3:b4047e8a0123 73 /* Pointer to transport info, used to store remote UDP duple (IP + port) */
daniele 3:b4047e8a0123 74 void *info;
daniele 3:b4047e8a0123 75
daniele 3:b4047e8a0123 76 /*Priority. "best-effort" priority, the default value is 0. Priority can be in between -10 and +10*/
daniele 3:b4047e8a0123 77 int8_t priority;
daniele 3:b4047e8a0123 78 };
daniele 3:b4047e8a0123 79
daniele 3:b4047e8a0123 80 /** frame alloc/dealloc/copy **/
daniele 3:b4047e8a0123 81 void pico_frame_discard(struct pico_frame *f);
daniele 3:b4047e8a0123 82 struct pico_frame *pico_frame_copy(struct pico_frame *f);
daniele 3:b4047e8a0123 83 struct pico_frame *pico_frame_deepcopy(struct pico_frame *f);
tass 70:cd218dd180e5 84 struct pico_frame *pico_frame_alloc(uint32_t size);
tass 70:cd218dd180e5 85 uint16_t pico_checksum(void *inbuf, uint32_t len);
tass 70:cd218dd180e5 86 uint16_t pico_dualbuffer_checksum(void *b1, uint32_t len1, void *b2, uint32_t len2);
daniele 3:b4047e8a0123 87
daniele 3:b4047e8a0123 88 static inline int pico_is_digit(char c)
daniele 3:b4047e8a0123 89 {
daniele 3:b4047e8a0123 90 if (c < '0' || c > '9')
daniele 3:b4047e8a0123 91 return 0;
daniele 3:b4047e8a0123 92 return 1;
daniele 3:b4047e8a0123 93 }
daniele 3:b4047e8a0123 94
daniele 3:b4047e8a0123 95 #endif