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:
152:a3d286bf94e5
Parent:
149:5f4cb161cec3
--- a/stack/pico_tree.c	Wed Apr 09 17:32:25 2014 +0200
+++ b/stack/pico_tree.c	Mon Sep 28 13:16:18 2015 +0200
@@ -1,5 +1,5 @@
 /*********************************************************************
-   PicoTCP. Copyright (c) 2012 TASS Belgium NV. Some rights reserved.
+   PicoTCP. Copyright (c) 2012-2015 Altran Intelligent Systems. Some rights reserved.
    See LICENSE and COPYING for usage.
 
    Author: Andrei Carp <andrei.carp@tass.be>
@@ -125,7 +125,7 @@
     return pico_tree_insert_implementation(tree, key, USE_PICO_ZALLOC);
 }
 
-void *pico_tree_insert_implementation(struct pico_tree*tree, void *key, uint8_t allocator)
+void *pico_tree_insert_implementation(struct pico_tree *tree, void *key, uint8_t allocator)
 {
     struct pico_tree_node *last_node = INIT_LEAF;
     struct pico_tree_node *temp = tree->root;
@@ -134,9 +134,11 @@
     int result = 0;
 
     LocalKey = (IS_NOT_LEAF(tree->root) ? pico_tree_findKey(tree, key) : NULL);
+    
     /* if node already in, bail out */
-    if(LocalKey)
+    if(LocalKey) {
         return LocalKey;
+    }
     else
     {
         if(allocator == USE_PICO_PAGE0_ZALLOC)
@@ -207,7 +209,6 @@
 
 
     found = tree->root;
-
     while(IS_NOT_LEAF(found))
     {
         int result;
@@ -296,28 +297,31 @@
     return pico_tree_delete_implementation(tree, key, USE_PICO_ZALLOC);
 }
 
+static inline void if_nodecolor_black_fix_collisions(struct pico_tree *tree, struct pico_tree_node *temp, uint8_t nodeColor)
+{
+    /* deleted node is black, this will mess up the black path property */
+    if(nodeColor == BLACK) 
+        fix_delete_collisions(tree, temp);
+}
+
 void *pico_tree_delete_implementation(struct pico_tree *tree, void *key, uint8_t allocator)
 {
     struct pico_tree_node *temp;
     uint8_t nodeColor; /* keeps the color of the node to be deleted */
     void *lkey; /* keeps a copy of the key which will be removed */
     struct pico_tree_node *delete;  /* keeps a copy of the node to be extracted */
-
     if (!key)
         return NULL;
-
     delete = pico_tree_findNode(tree, key);
 
     /* this key isn't in the tree, bail out */
-    if(!delete)
+    if(!delete) 
         return NULL;
-
+    
     lkey = delete->keyValue;
     nodeColor = pico_tree_delete_check_switch(tree, delete, &temp);
 
-    /* deleted node is black, this will mess up the black path property */
-    if(nodeColor == BLACK)
-        fix_delete_collisions(tree, temp);
+    if_nodecolor_black_fix_collisions(tree, temp, nodeColor);
 
     if(allocator == USE_PICO_ZALLOC)
         PICO_FREE(delete);