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 Jan 28 15:12:00 2016 +0100
Revision:
155:a70f34550c34
Parent:
5:445d2fc04784
Adding TCP flag for FIN.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tass 5:445d2fc04784 1 /*
tass 5:445d2fc04784 2 *
tass 5:445d2fc04784 3 * PicoTCP Socket interface for mbed.
tass 5:445d2fc04784 4 * Copyright (C) 2013 TASS Belgium NV
tass 5:445d2fc04784 5 *
tass 5:445d2fc04784 6 * Released under GPL v2
tass 5:445d2fc04784 7 *
tass 5:445d2fc04784 8 * Other licensing models might apply at the sole discretion of the copyright holders.
tass 5:445d2fc04784 9 *
tass 5:445d2fc04784 10 *
tass 5:445d2fc04784 11 * This software is based on the mbed.org EthernetInterface implementation:
tass 5:445d2fc04784 12 * Copyright (C) 2012 mbed.org, MIT License
tass 5:445d2fc04784 13 *
tass 5:445d2fc04784 14 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
tass 5:445d2fc04784 15 * and associated documentation files (the "Software"), to deal in the Software without restriction,
tass 5:445d2fc04784 16 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
tass 5:445d2fc04784 17 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
tass 5:445d2fc04784 18 * furnished to do so, subject to the following conditions:
tass 5:445d2fc04784 19 *
tass 5:445d2fc04784 20 * The above copyright notice and this permission notice shall be included in all copies or
tass 5:445d2fc04784 21 * substantial portions of the Software.
tass 5:445d2fc04784 22 *
tass 5:445d2fc04784 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
tass 5:445d2fc04784 24 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
tass 5:445d2fc04784 25 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
tass 5:445d2fc04784 26 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
tass 5:445d2fc04784 27 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
tass 5:445d2fc04784 28 */
tass 5:445d2fc04784 29
tass 5:445d2fc04784 30 #ifndef UDPSOCKET_H
tass 5:445d2fc04784 31 #define UDPSOCKET_H
tass 5:445d2fc04784 32
tass 5:445d2fc04784 33 #include "Socket/Socket.h"
tass 5:445d2fc04784 34 #include "Socket/Endpoint.h"
tass 5:445d2fc04784 35 #include "EthernetInterface.h"
tass 5:445d2fc04784 36 #include <cstdint>
tass 5:445d2fc04784 37
tass 5:445d2fc04784 38 /**
tass 5:445d2fc04784 39 UDP Socket
tass 5:445d2fc04784 40 */
tass 5:445d2fc04784 41 class UDPSocket : public Socket {
tass 5:445d2fc04784 42
tass 5:445d2fc04784 43 public:
tass 5:445d2fc04784 44 /** Instantiate an UDP Socket.
tass 5:445d2fc04784 45 */
tass 5:445d2fc04784 46 UDPSocket();
tass 5:445d2fc04784 47
tass 5:445d2fc04784 48 /** Init the UDP Client Socket without binding it to any specific port
tass 5:445d2fc04784 49 \return 0 on success, -1 on failure.
tass 5:445d2fc04784 50 */
tass 5:445d2fc04784 51 int init(void);
tass 5:445d2fc04784 52
tass 5:445d2fc04784 53 /** Bind a UDP Server Socket to a specific port
tass 5:445d2fc04784 54 \param port The port to listen for incoming connections on
tass 5:445d2fc04784 55 \return 0 on success, -1 on failure.
tass 5:445d2fc04784 56 */
tass 5:445d2fc04784 57 int bind(int port);
tass 5:445d2fc04784 58
tass 5:445d2fc04784 59 /** Join the multicast group at the given address
tass 5:445d2fc04784 60 \param address The address of the multicast group
tass 5:445d2fc04784 61 \return 0 on success, -1 on failure.
tass 5:445d2fc04784 62 */
tass 5:445d2fc04784 63 int join_multicast_group(EthernetInterface& eth, const char* address);
tass 5:445d2fc04784 64
tass 5:445d2fc04784 65 /** Set the socket in broadcasting mode
tass 5:445d2fc04784 66 \return 0 on success, -1 on failure.
tass 5:445d2fc04784 67 */
tass 5:445d2fc04784 68 int set_broadcasting(void);
tass 5:445d2fc04784 69
tass 5:445d2fc04784 70 /** Send a packet to a remote endpoint
tass 5:445d2fc04784 71 \param remote The remote endpoint
tass 5:445d2fc04784 72 \param packet The packet to be sent
tass 5:445d2fc04784 73 \param length The length of the packet to be sent
tass 5:445d2fc04784 74 \return the number of written bytes on success (>=0) or -1 on failure
tass 5:445d2fc04784 75 */
tass 5:445d2fc04784 76 int sendTo(Endpoint &remote, char *packet, int length);
tass 5:445d2fc04784 77
tass 5:445d2fc04784 78 /** Receive a packet from a remote endpoint
tass 5:445d2fc04784 79 \param remote The remote endpoint
tass 5:445d2fc04784 80 \param buffer The buffer for storing the incoming packet data. If a packet
tass 5:445d2fc04784 81 is too long to fit in the supplied buffer, excess bytes are discarded
tass 5:445d2fc04784 82 \param length The length of the buffer
tass 5:445d2fc04784 83 \return the number of received bytes on success (>=0) or -1 on failure
tass 5:445d2fc04784 84 */
tass 5:445d2fc04784 85 int receiveFrom(Endpoint &remote, char *buffer, int length);
tass 5:445d2fc04784 86 };
tass 5:445d2fc04784 87
tass 5:445d2fc04784 88 #endif