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 RTOSgeneric mbed Ethernet driverhigh performance NXP LPC1768 specific Ethernet driverMulti-threading support for mbed RTOSBerkeley sockets and integration with the New Socket APIFork of the apps running on top of the New Socket APIScheduling 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.
include/pico_tree.h@152:a3d286bf94e5, 2015-09-28 (annotated)
- Committer:
- tass
- Date:
- Mon Sep 28 13:16:18 2015 +0200
- Revision:
- 152:a3d286bf94e5
- Parent:
- 149:5f4cb161cec3
Mercurial: latest development version of PicoTCP
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tass | 68:0847e35d08a6 | 1 | /********************************************************************* |
tass | 152:a3d286bf94e5 | 2 | PicoTCP. Copyright (c) 2012-2015 Altran Intelligent Systems. Some rights reserved. |
TASS Belgium NV |
131:4758606c9316 | 3 | See LICENSE and COPYING for usage. |
tass | 68:0847e35d08a6 | 4 | |
TASS Belgium NV |
131:4758606c9316 | 5 | Author: Andrei Carp <andrei.carp@tass.be> |
TASS Belgium NV |
131:4758606c9316 | 6 | *********************************************************************/ |
tass | 68:0847e35d08a6 | 7 | |
tass picotcp@tass.be | 149:5f4cb161cec3 | 8 | #ifndef PICO_RBTREE_H |
tass picotcp@tass.be | 149:5f4cb161cec3 | 9 | #define PICO_RBTREE_H |
tass | 68:0847e35d08a6 | 10 | |
tass | 68:0847e35d08a6 | 11 | #include "pico_config.h" |
tass | 68:0847e35d08a6 | 12 | |
TASS Belgium NV |
131:4758606c9316 | 13 | /* This is used to declare a new tree, leaf root by default */ |
TASS Belgium NV |
131:4758606c9316 | 14 | #define PICO_TREE_DECLARE(name, compareFunction) \ |
TASS Belgium NV |
131:4758606c9316 | 15 | struct pico_tree name = \ |
TASS Belgium NV |
131:4758606c9316 | 16 | { \ |
TASS Belgium NV |
131:4758606c9316 | 17 | &LEAF, \ |
TASS Belgium NV |
131:4758606c9316 | 18 | compareFunction \ |
TASS Belgium NV |
131:4758606c9316 | 19 | } |
tass | 68:0847e35d08a6 | 20 | |
tass picotcp@tass.be | 149:5f4cb161cec3 | 21 | #define USE_PICO_PAGE0_ZALLOC (1) |
tass picotcp@tass.be | 149:5f4cb161cec3 | 22 | #define USE_PICO_ZALLOC (2) |
tass picotcp@tass.be | 149:5f4cb161cec3 | 23 | |
tass | 68:0847e35d08a6 | 24 | struct pico_tree_node |
tass | 68:0847e35d08a6 | 25 | { |
TASS Belgium NV |
131:4758606c9316 | 26 | void*keyValue; /* generic key */ |
TASS Belgium NV |
131:4758606c9316 | 27 | struct pico_tree_node*parent; |
TASS Belgium NV |
131:4758606c9316 | 28 | struct pico_tree_node*leftChild; |
TASS Belgium NV |
131:4758606c9316 | 29 | struct pico_tree_node*rightChild; |
TASS Belgium NV |
131:4758606c9316 | 30 | uint8_t color; |
tass | 68:0847e35d08a6 | 31 | }; |
tass | 68:0847e35d08a6 | 32 | |
tass | 68:0847e35d08a6 | 33 | struct pico_tree |
tass | 68:0847e35d08a6 | 34 | { |
TASS Belgium NV |
131:4758606c9316 | 35 | struct pico_tree_node *root; /* root of the tree */ |
tass | 68:0847e35d08a6 | 36 | |
TASS Belgium NV |
131:4758606c9316 | 37 | /* this function directly provides the keys as parameters not the nodes. */ |
TASS Belgium NV |
131:4758606c9316 | 38 | int (*compare)(void*keyA, void*keyB); |
tass | 68:0847e35d08a6 | 39 | }; |
tass | 68:0847e35d08a6 | 40 | |
TASS Belgium NV |
131:4758606c9316 | 41 | extern struct pico_tree_node LEAF; /* generic leaf node */ |
tass picotcp@tass.be | 149:5f4cb161cec3 | 42 | |
tass picotcp@tass.be | 149:5f4cb161cec3 | 43 | #ifdef PICO_SUPPORT_MM |
tass picotcp@tass.be | 149:5f4cb161cec3 | 44 | void *pico_tree_insert_implementation(struct pico_tree *tree, void *key, uint8_t allocator); |
tass picotcp@tass.be | 149:5f4cb161cec3 | 45 | void *pico_tree_delete_implementation(struct pico_tree *tree, void *key, uint8_t allocator); |
tass picotcp@tass.be | 149:5f4cb161cec3 | 46 | #endif |
tass picotcp@tass.be | 149:5f4cb161cec3 | 47 | |
tass picotcp@tass.be | 149:5f4cb161cec3 | 48 | |
tass | 68:0847e35d08a6 | 49 | /* |
tass | 68:0847e35d08a6 | 50 | * Manipulation functions |
tass | 68:0847e35d08a6 | 51 | */ |
TASS Belgium NV |
131:4758606c9316 | 52 | void *pico_tree_insert(struct pico_tree *tree, void *key); |
TASS Belgium NV |
131:4758606c9316 | 53 | void *pico_tree_delete(struct pico_tree *tree, void *key); |
TASS Belgium NV |
131:4758606c9316 | 54 | void *pico_tree_findKey(struct pico_tree *tree, void *key); |
TASS Belgium NV |
131:4758606c9316 | 55 | void pico_tree_drop(struct pico_tree *tree); |
TASS Belgium NV |
131:4758606c9316 | 56 | int pico_tree_empty(struct pico_tree *tree); |
TASS Belgium NV |
131:4758606c9316 | 57 | struct pico_tree_node *pico_tree_findNode(struct pico_tree *tree, void *key); |
tass | 68:0847e35d08a6 | 58 | |
TASS Belgium NV |
131:4758606c9316 | 59 | void *pico_tree_first(struct pico_tree *tree); |
TASS Belgium NV |
131:4758606c9316 | 60 | void *pico_tree_last(struct pico_tree *tree); |
tass | 68:0847e35d08a6 | 61 | /* |
tass | 68:0847e35d08a6 | 62 | * Traverse functions |
tass | 68:0847e35d08a6 | 63 | */ |
TASS Belgium NV |
131:4758606c9316 | 64 | struct pico_tree_node *pico_tree_lastNode(struct pico_tree_node *node); |
TASS Belgium NV |
131:4758606c9316 | 65 | struct pico_tree_node *pico_tree_firstNode(struct pico_tree_node *node); |
TASS Belgium NV |
131:4758606c9316 | 66 | struct pico_tree_node *pico_tree_next(struct pico_tree_node *node); |
TASS Belgium NV |
131:4758606c9316 | 67 | struct pico_tree_node *pico_tree_prev(struct pico_tree_node *node); |
tass | 68:0847e35d08a6 | 68 | |
tass | 68:0847e35d08a6 | 69 | /* |
tass | 68:0847e35d08a6 | 70 | * For each macros |
tass | 68:0847e35d08a6 | 71 | */ |
tass | 68:0847e35d08a6 | 72 | |
TASS Belgium NV |
131:4758606c9316 | 73 | #define pico_tree_foreach(idx, tree) \ |
TASS Belgium NV |
131:4758606c9316 | 74 | for ((idx) = pico_tree_firstNode((tree)->root); \ |
TASS Belgium NV |
131:4758606c9316 | 75 | (idx) != &LEAF; \ |
TASS Belgium NV |
131:4758606c9316 | 76 | (idx) = pico_tree_next(idx)) |
tass | 68:0847e35d08a6 | 77 | |
TASS Belgium NV |
131:4758606c9316 | 78 | #define pico_tree_foreach_reverse(idx, tree) \ |
TASS Belgium NV |
131:4758606c9316 | 79 | for ((idx) = pico_tree_lastNode((tree)->root); \ |
TASS Belgium NV |
131:4758606c9316 | 80 | (idx) != &LEAF; \ |
TASS Belgium NV |
131:4758606c9316 | 81 | (idx) = pico_tree_prev(idx)) |
tass | 68:0847e35d08a6 | 82 | |
TASS Belgium NV |
131:4758606c9316 | 83 | #define pico_tree_foreach_safe(idx, tree, idx2) \ |
TASS Belgium NV |
131:4758606c9316 | 84 | for ((idx) = pico_tree_firstNode((tree)->root); \ |
TASS Belgium NV |
131:4758606c9316 | 85 | ((idx) != &LEAF) && ((idx2) = pico_tree_next(idx), 1); \ |
TASS Belgium NV |
131:4758606c9316 | 86 | (idx) = (idx2)) |
tass | 68:0847e35d08a6 | 87 | |
TASS Belgium NV |
131:4758606c9316 | 88 | #define pico_tree_foreach_reverse_safe(idx, tree, idx2) \ |
TASS Belgium NV |
131:4758606c9316 | 89 | for ((idx) = pico_tree_lastNode((tree)->root); \ |
TASS Belgium NV |
131:4758606c9316 | 90 | ((idx) != &LEAF) && ((idx2) = pico_tree_prev(idx), 1); \ |
TASS Belgium NV |
131:4758606c9316 | 91 | (idx) = (idx2)) |
tass | 68:0847e35d08a6 | 92 | |
tass | 68:0847e35d08a6 | 93 | #endif |