This is WIZnet Ethernet Interface using Hardware TCP/IP chip, W5500, W5200 and W5100. One of them can be selected by enabling it in wiznet.h.

Fork of WIZnet_Library by WIZnet

Committer:
Bongjun
Date:
Sun May 31 10:25:40 2015 +0000
Revision:
8:cb8808b47e69
Parent:
0:b72d22e10709
fix some codes of reading Sn_RX_RSR, Sn_TX_FSR in W5100.cpp, W5200.cpp; added is_fin_received()  in W5100, W5200 files

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jbkim 0:b72d22e10709 1 /* Copyright (C) 2012 mbed.org, MIT License
jbkim 0:b72d22e10709 2 *
jbkim 0:b72d22e10709 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
jbkim 0:b72d22e10709 4 * and associated documentation files (the "Software"), to deal in the Software without restriction,
jbkim 0:b72d22e10709 5 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
jbkim 0:b72d22e10709 6 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
jbkim 0:b72d22e10709 7 * furnished to do so, subject to the following conditions:
jbkim 0:b72d22e10709 8 *
jbkim 0:b72d22e10709 9 * The above copyright notice and this permission notice shall be included in all copies or
jbkim 0:b72d22e10709 10 * substantial portions of the Software.
jbkim 0:b72d22e10709 11 *
jbkim 0:b72d22e10709 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
jbkim 0:b72d22e10709 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
jbkim 0:b72d22e10709 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
jbkim 0:b72d22e10709 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
jbkim 0:b72d22e10709 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
jbkim 0:b72d22e10709 17 */
jbkim 0:b72d22e10709 18
jbkim 0:b72d22e10709 19 #ifndef UDPSOCKET_H
jbkim 0:b72d22e10709 20 #define UDPSOCKET_H
jbkim 0:b72d22e10709 21
jbkim 0:b72d22e10709 22 #include "Endpoint.h"
jbkim 0:b72d22e10709 23 #include "Socket.h"
jbkim 0:b72d22e10709 24
jbkim 0:b72d22e10709 25 /**
jbkim 0:b72d22e10709 26 UDP Socket
jbkim 0:b72d22e10709 27 */
jbkim 0:b72d22e10709 28 class UDPSocket: public Socket {
jbkim 0:b72d22e10709 29
jbkim 0:b72d22e10709 30 public:
jbkim 0:b72d22e10709 31 /** Instantiate an UDP Socket.
jbkim 0:b72d22e10709 32 */
jbkim 0:b72d22e10709 33 UDPSocket();
jbkim 0:b72d22e10709 34
jbkim 0:b72d22e10709 35 /** Init the UDP Client Socket without binding it to any specific port
jbkim 0:b72d22e10709 36 \return 0 on success, -1 on failure.
jbkim 0:b72d22e10709 37 */
jbkim 0:b72d22e10709 38 int init(void);
jbkim 0:b72d22e10709 39
jbkim 0:b72d22e10709 40 /** Bind a UDP Server Socket to a specific port
jbkim 0:b72d22e10709 41 \param port The port to listen for incoming connections on
jbkim 0:b72d22e10709 42 \return 0 on success, -1 on failure.
jbkim 0:b72d22e10709 43 */
jbkim 0:b72d22e10709 44 int bind(int port = -1);
jbkim 0:b72d22e10709 45
jbkim 0:b72d22e10709 46 /** Send a packet to a remote endpoint
jbkim 0:b72d22e10709 47 \param remote The remote endpoint
jbkim 0:b72d22e10709 48 \param packet The packet to be sent
jbkim 0:b72d22e10709 49 \param length The length of the packet to be sent
jbkim 0:b72d22e10709 50 \return the number of written bytes on success (>=0) or -1 on failure
jbkim 0:b72d22e10709 51 */
jbkim 0:b72d22e10709 52 int sendTo(Endpoint &remote, char *packet, int length);
jbkim 0:b72d22e10709 53
jbkim 0:b72d22e10709 54 /** Receive a packet from a remote endpoint
jbkim 0:b72d22e10709 55 \param remote The remote endpoint
jbkim 0:b72d22e10709 56 \param buffer The buffer for storing the incoming packet data. If a packet
jbkim 0:b72d22e10709 57 is too long to fit in the supplied buffer, excess bytes are discarded
jbkim 0:b72d22e10709 58 \param length The length of the buffer
jbkim 0:b72d22e10709 59 \return the number of received bytes on success (>=0) or -1 on failure
jbkim 0:b72d22e10709 60 */
jbkim 0:b72d22e10709 61 int receiveFrom(Endpoint &remote, char *buffer, int length);
jbkim 0:b72d22e10709 62
jbkim 0:b72d22e10709 63 private:
jbkim 0:b72d22e10709 64 void confEndpoint(Endpoint & ep);
jbkim 0:b72d22e10709 65 void readEndpoint(Endpoint & ep, uint8_t info[]);
jbkim 0:b72d22e10709 66 };
jbkim 0:b72d22e10709 67
jbkim 0:b72d22e10709 68 #endif
jbkim 0:b72d22e10709 69