For DFCM-NNN40-DT1R,32K RAM,

Committer:
Marcomissyou
Date:
Fri Jun 26 09:44:35 2015 +0000
Revision:
0:4085cc9441f3
Commit WIFI_API_32kRAM; This API works on DFCM-NNN40-DT1R(32K RAM).

Who changed what in which revision?

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