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 #ifndef ENDPOINT_H
Marcomissyou 0:4085cc9441f3 19 #define ENDPOINT_H
Marcomissyou 0:4085cc9441f3 20
Marcomissyou 0:4085cc9441f3 21 //following are added by Tsungta
Marcomissyou 0:4085cc9441f3 22 #include "stdint.h"
Marcomissyou 0:4085cc9441f3 23 /* For compatibility with BSD code */
Marcomissyou 0:4085cc9441f3 24 struct in_addr {
Marcomissyou 0:4085cc9441f3 25 uint32_t s_addr;
Marcomissyou 0:4085cc9441f3 26 };
Marcomissyou 0:4085cc9441f3 27
Marcomissyou 0:4085cc9441f3 28 struct sockaddr_in {
Marcomissyou 0:4085cc9441f3 29 uint8_t sin_len;
Marcomissyou 0:4085cc9441f3 30 uint8_t sin_family;
Marcomissyou 0:4085cc9441f3 31 uint16_t sin_port;
Marcomissyou 0:4085cc9441f3 32 struct in_addr sin_addr;
Marcomissyou 0:4085cc9441f3 33 char sin_zero[8];
Marcomissyou 0:4085cc9441f3 34 };
Marcomissyou 0:4085cc9441f3 35 //Tsungta
Marcomissyou 0:4085cc9441f3 36 class UDPSocket;
Marcomissyou 0:4085cc9441f3 37
Marcomissyou 0:4085cc9441f3 38 /*
Marcomissyou 0:4085cc9441f3 39 IP Endpoint (address, port)
Marcomissyou 0:4085cc9441f3 40 */
Marcomissyou 0:4085cc9441f3 41 class Endpoint {
Marcomissyou 0:4085cc9441f3 42 friend class UDPSocket;
Marcomissyou 0:4085cc9441f3 43
Marcomissyou 0:4085cc9441f3 44 private:
Marcomissyou 0:4085cc9441f3 45 char UDP_host[15];
Marcomissyou 0:4085cc9441f3 46 int UDP_port;
Marcomissyou 0:4085cc9441f3 47
Marcomissyou 0:4085cc9441f3 48 public:
Marcomissyou 0:4085cc9441f3 49 /* IP Endpoint (address, port)
Marcomissyou 0:4085cc9441f3 50 */
Marcomissyou 0:4085cc9441f3 51 Endpoint(void);
Marcomissyou 0:4085cc9441f3 52
Marcomissyou 0:4085cc9441f3 53 ~Endpoint(void);
Marcomissyou 0:4085cc9441f3 54
Marcomissyou 0:4085cc9441f3 55 /* Reset the address of this endpoint
Marcomissyou 0:4085cc9441f3 56 */
Marcomissyou 0:4085cc9441f3 57 void reset_address(void);
Marcomissyou 0:4085cc9441f3 58
Marcomissyou 0:4085cc9441f3 59 /* Set the address of this endpoint
Marcomissyou 0:4085cc9441f3 60 \param host The endpoint address (it can either be an IP Address or a hostname that will be resolved with DNS).
Marcomissyou 0:4085cc9441f3 61 \param port The endpoint port
Marcomissyou 0:4085cc9441f3 62 \return 0 on success, -1 on failure (when an hostname cannot be resolved by DNS).
Marcomissyou 0:4085cc9441f3 63 */
Marcomissyou 0:4085cc9441f3 64 int set_address(const char* host, const int port);
Marcomissyou 0:4085cc9441f3 65
Marcomissyou 0:4085cc9441f3 66 /* Get the IP address of this endpoint
Marcomissyou 0:4085cc9441f3 67 \return The IP address of this endpoint.
Marcomissyou 0:4085cc9441f3 68 */
Marcomissyou 0:4085cc9441f3 69 char* get_address(void);
Marcomissyou 0:4085cc9441f3 70
Marcomissyou 0:4085cc9441f3 71 /* Get the port of this endpoint
Marcomissyou 0:4085cc9441f3 72 \return The port of this endpoint
Marcomissyou 0:4085cc9441f3 73 */
Marcomissyou 0:4085cc9441f3 74 int get_port(void);
Marcomissyou 0:4085cc9441f3 75
Marcomissyou 0:4085cc9441f3 76 protected:
Marcomissyou 0:4085cc9441f3 77 char _ipAddress[17];
Marcomissyou 0:4085cc9441f3 78 struct sockaddr_in _remoteHost;
Marcomissyou 0:4085cc9441f3 79
Marcomissyou 0:4085cc9441f3 80 };
Marcomissyou 0:4085cc9441f3 81
Marcomissyou 0:4085cc9441f3 82
Marcomissyou 0:4085cc9441f3 83
Marcomissyou 0:4085cc9441f3 84 #endif