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 Belgium NV
Date:
Mon Dec 16 11:25:54 2013 +0100
Revision:
131:4758606c9316
Parent:
128:ae39e6e81531
Child:
149:5f4cb161cec3
Syncronized with master branch

Who changed what in which revision?

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