fdsf

Dependents:   sisk_proj_stat MQTT Hello_FXOS8700Q WireFSHandControl ... more

Committer:
grzemich
Date:
Wed Dec 07 23:47:50 2016 +0000
Revision:
0:d7bd7384a37c
dgd

Who changed what in which revision?

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