Websocket_Sample for MurataTypeYD

Dependencies:   mbed picojson

Committer:
komoritan
Date:
Thu Mar 12 12:15:46 2015 +0000
Revision:
1:b5ac0f971f43
Parent:
0:14bd24b5a77f
Fixed

Who changed what in which revision?

UserRevisionLine numberNew contents of line
komoritan 0:14bd24b5a77f 1 /* Copyright (C) 2012 mbed.org, MIT License
komoritan 0:14bd24b5a77f 2 *
komoritan 0:14bd24b5a77f 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
komoritan 0:14bd24b5a77f 4 * and associated documentation files (the "Software"), to deal in the Software without restriction,
komoritan 0:14bd24b5a77f 5 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
komoritan 0:14bd24b5a77f 6 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
komoritan 0:14bd24b5a77f 7 * furnished to do so, subject to the following conditions:
komoritan 0:14bd24b5a77f 8 *
komoritan 0:14bd24b5a77f 9 * The above copyright notice and this permission notice shall be included in all copies or
komoritan 0:14bd24b5a77f 10 * substantial portions of the Software.
komoritan 0:14bd24b5a77f 11 *
komoritan 0:14bd24b5a77f 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
komoritan 0:14bd24b5a77f 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
komoritan 0:14bd24b5a77f 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
komoritan 0:14bd24b5a77f 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
komoritan 0:14bd24b5a77f 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
komoritan 0:14bd24b5a77f 17 */
komoritan 0:14bd24b5a77f 18 /* Copyright (C) 2014 Murata Manufacturing Co.,Ltd., MIT License
komoritan 0:14bd24b5a77f 19 * port to the muRata, SWITCH SCIENCE Wi-FI module TypeYD SNIC-UART.
komoritan 0:14bd24b5a77f 20 */
komoritan 0:14bd24b5a77f 21 #ifndef ENDPOINT_H
komoritan 0:14bd24b5a77f 22 #define ENDPOINT_H
komoritan 0:14bd24b5a77f 23
komoritan 0:14bd24b5a77f 24 class UDPSocket;
komoritan 0:14bd24b5a77f 25
komoritan 0:14bd24b5a77f 26 /**
komoritan 0:14bd24b5a77f 27 IP Endpoint (address, port)
komoritan 0:14bd24b5a77f 28 */
komoritan 0:14bd24b5a77f 29 class Endpoint {
komoritan 0:14bd24b5a77f 30 friend class UDPSocket;
komoritan 0:14bd24b5a77f 31
komoritan 0:14bd24b5a77f 32 public:
komoritan 0:14bd24b5a77f 33 /** IP Endpoint (address, port)
komoritan 0:14bd24b5a77f 34 */
komoritan 0:14bd24b5a77f 35 Endpoint(void);
komoritan 0:14bd24b5a77f 36
komoritan 0:14bd24b5a77f 37 ~Endpoint(void);
komoritan 0:14bd24b5a77f 38
komoritan 0:14bd24b5a77f 39 /** Reset the address of this endpoint
komoritan 0:14bd24b5a77f 40 */
komoritan 0:14bd24b5a77f 41 void reset_address(void);
komoritan 0:14bd24b5a77f 42
komoritan 0:14bd24b5a77f 43 /** Set the address of this endpoint
komoritan 0:14bd24b5a77f 44 \param host_p The endpoint address (it can either be an IP Address or a hostname that will be resolved with DNS).
komoritan 0:14bd24b5a77f 45 \param port The endpoint port
komoritan 0:14bd24b5a77f 46 \return 0 on success, -1 on failure (when an hostname cannot be resolved by DNS).
komoritan 0:14bd24b5a77f 47 */
komoritan 0:14bd24b5a77f 48 int set_address(const char* host_p, const int port);
komoritan 0:14bd24b5a77f 49
komoritan 0:14bd24b5a77f 50 /** Get the IP address of this endpoint
komoritan 0:14bd24b5a77f 51 \return The IP address of this endpoint.
komoritan 0:14bd24b5a77f 52 */
komoritan 0:14bd24b5a77f 53 char* get_address(void);
komoritan 0:14bd24b5a77f 54
komoritan 0:14bd24b5a77f 55 /** Get the port of this endpoint
komoritan 0:14bd24b5a77f 56 \return The port of this endpoint
komoritan 0:14bd24b5a77f 57 */
komoritan 0:14bd24b5a77f 58 int get_port(void);
komoritan 0:14bd24b5a77f 59
komoritan 0:14bd24b5a77f 60 protected:
komoritan 0:14bd24b5a77f 61 char mIpAddress[17];
komoritan 0:14bd24b5a77f 62 int mPort;
komoritan 0:14bd24b5a77f 63 // struct sockaddr_in _remoteHost;
komoritan 0:14bd24b5a77f 64
komoritan 0:14bd24b5a77f 65 };
komoritan 0:14bd24b5a77f 66 #endif