Deprecated fork of old network stack source from github. Please use official library instead: https://mbed.org/users/mbed_official/code/EthernetInterface/

Committer:
AdamGreen
Date:
Sat Oct 26 08:51:36 2013 +0000
Revision:
1:eadc868c2acf
Parent:
0:3b00827bb0b7
Fix TCP checksum bug and stranded large TCP segments.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AdamGreen 0:3b00827bb0b7 1 /* Copyright (C) 2012 mbed.org, MIT License
AdamGreen 0:3b00827bb0b7 2 *
AdamGreen 0:3b00827bb0b7 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
AdamGreen 0:3b00827bb0b7 4 * and associated documentation files (the "Software"), to deal in the Software without restriction,
AdamGreen 0:3b00827bb0b7 5 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
AdamGreen 0:3b00827bb0b7 6 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
AdamGreen 0:3b00827bb0b7 7 * furnished to do so, subject to the following conditions:
AdamGreen 0:3b00827bb0b7 8 *
AdamGreen 0:3b00827bb0b7 9 * The above copyright notice and this permission notice shall be included in all copies or
AdamGreen 0:3b00827bb0b7 10 * substantial portions of the Software.
AdamGreen 0:3b00827bb0b7 11 *
AdamGreen 0:3b00827bb0b7 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
AdamGreen 0:3b00827bb0b7 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
AdamGreen 0:3b00827bb0b7 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
AdamGreen 0:3b00827bb0b7 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
AdamGreen 0:3b00827bb0b7 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
AdamGreen 0:3b00827bb0b7 17 */
AdamGreen 0:3b00827bb0b7 18 #ifndef TCPSOCKETSERVER_H
AdamGreen 0:3b00827bb0b7 19 #define TCPSOCKETSERVER_H
AdamGreen 0:3b00827bb0b7 20
AdamGreen 0:3b00827bb0b7 21 #include "Socket/Socket.h"
AdamGreen 0:3b00827bb0b7 22 #include "TCPSocketConnection.h"
AdamGreen 0:3b00827bb0b7 23
AdamGreen 0:3b00827bb0b7 24 /** TCP Server.
AdamGreen 0:3b00827bb0b7 25 */
AdamGreen 0:3b00827bb0b7 26 class TCPSocketServer : public Socket {
AdamGreen 0:3b00827bb0b7 27 public:
AdamGreen 0:3b00827bb0b7 28 /** Instantiate a TCP Server.
AdamGreen 0:3b00827bb0b7 29 */
AdamGreen 0:3b00827bb0b7 30 TCPSocketServer();
AdamGreen 0:3b00827bb0b7 31
AdamGreen 0:3b00827bb0b7 32 /** Bind a socket to a specific port.
AdamGreen 0:3b00827bb0b7 33 \param port The port to listen for incoming connections on.
AdamGreen 0:3b00827bb0b7 34 \return 0 on success, -1 on failure.
AdamGreen 0:3b00827bb0b7 35 */
AdamGreen 0:3b00827bb0b7 36 int bind(int port);
AdamGreen 0:3b00827bb0b7 37
AdamGreen 0:3b00827bb0b7 38 /** Start listening for incoming connections.
AdamGreen 0:3b00827bb0b7 39 \param backlog number of pending connections that can be queued up at any
AdamGreen 0:3b00827bb0b7 40 one time [Default: 1].
AdamGreen 0:3b00827bb0b7 41 \return 0 on success, -1 on failure.
AdamGreen 0:3b00827bb0b7 42 */
AdamGreen 0:3b00827bb0b7 43 int listen(int backlog=1);
AdamGreen 0:3b00827bb0b7 44
AdamGreen 0:3b00827bb0b7 45 /** Accept a new connection.
AdamGreen 0:3b00827bb0b7 46 \param connection A TCPSocketConnection instance that will handle the incoming connection.
AdamGreen 0:3b00827bb0b7 47 \return 0 on success, -1 on failure.
AdamGreen 0:3b00827bb0b7 48 */
AdamGreen 0:3b00827bb0b7 49 int accept(TCPSocketConnection& connection);
AdamGreen 0:3b00827bb0b7 50 };
AdamGreen 0:3b00827bb0b7 51
AdamGreen 0:3b00827bb0b7 52 #endif