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 19 12:38:53 2013 +0000
Revision:
63:97f481e33cb2
Parent:
51:ab4529a384a6
Update from the master branch

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
daniele 3:b4047e8a0123 7 Authors: Frederik Van Slycken
daniele 3:b4047e8a0123 8 *********************************************************************/
daniele 3:b4047e8a0123 9
daniele 3:b4047e8a0123 10 #include "pico_config.h"
daniele 3:b4047e8a0123 11 #include "pico_stack.h"
daniele 3:b4047e8a0123 12 #include "pico_dhcp_common.h"
daniele 3:b4047e8a0123 13
daniele 3:b4047e8a0123 14 #if defined (PICO_SUPPORT_DHCPC) || defined (PICO_SUPPORT_DHCPD)
tass 63:97f481e33cb2 15 //this function should only be used after you checked if the options are valid! otherwise it could read from bad memory!
tass 63:97f481e33cb2 16 uint8_t dhcp_get_next_option(uint8_t *begin, uint8_t *data, int *len, uint8_t **nextopt)
daniele 3:b4047e8a0123 17 {
tass 63:97f481e33cb2 18 uint8_t *p;
tass 63:97f481e33cb2 19 uint8_t type;
tass 63:97f481e33cb2 20 uint8_t opt_len;
tass 63:97f481e33cb2 21
tass 63:97f481e33cb2 22 if (!begin)
tass 63:97f481e33cb2 23 p = *nextopt;
tass 63:97f481e33cb2 24 else
tass 63:97f481e33cb2 25 p = begin;
tass 51:ab4529a384a6 26
tass 63:97f481e33cb2 27 type = *p;
tass 63:97f481e33cb2 28 *nextopt = ++p;
tass 63:97f481e33cb2 29 if ((type == PICO_DHCPOPT_END) || (type == PICO_DHCPOPT_PAD)) {
tass 63:97f481e33cb2 30 memset(data, 0, *len);
tass 63:97f481e33cb2 31 len = 0;
tass 63:97f481e33cb2 32 return type;
tass 63:97f481e33cb2 33 }
tass 63:97f481e33cb2 34 opt_len = *p;
tass 63:97f481e33cb2 35 p++;
tass 63:97f481e33cb2 36 if (*len > opt_len)
tass 63:97f481e33cb2 37 *len = opt_len;
tass 63:97f481e33cb2 38 memcpy(data, p, *len);
tass 63:97f481e33cb2 39 *nextopt = p + opt_len;
tass 63:97f481e33cb2 40 return type;
tass 51:ab4529a384a6 41 }
daniele 3:b4047e8a0123 42
tass 63:97f481e33cb2 43 int is_options_valid(uint8_t *opt_buffer, int len)
tass 51:ab4529a384a6 44 {
tass 63:97f481e33cb2 45 uint8_t *p = opt_buffer;
tass 51:ab4529a384a6 46 while (len > 0) {
tass 63:97f481e33cb2 47 if (*p == PICO_DHCPOPT_END)
tass 63:97f481e33cb2 48 return 1;
tass 63:97f481e33cb2 49 else if (*p == PICO_DHCPOPT_PAD) {
tass 63:97f481e33cb2 50 p++;
tass 63:97f481e33cb2 51 len--;
tass 63:97f481e33cb2 52 } else {
tass 63:97f481e33cb2 53 uint8_t opt_len;
tass 63:97f481e33cb2 54 p++;
tass 63:97f481e33cb2 55 len--;
tass 63:97f481e33cb2 56 if(len > 0) {
tass 63:97f481e33cb2 57 opt_len = *p;
tass 63:97f481e33cb2 58 p += opt_len + 1;
tass 63:97f481e33cb2 59 len -= opt_len;
tass 63:97f481e33cb2 60 }else
tass 63:97f481e33cb2 61 return 0;
tass 63:97f481e33cb2 62 }
tass 51:ab4529a384a6 63 }
tass 51:ab4529a384a6 64 return 0;
tass 51:ab4529a384a6 65 }
tass 51:ab4529a384a6 66
daniele 3:b4047e8a0123 67 #endif