Dependents:   W5500-SNTPClient-example

Committer:
star297
Date:
Thu May 02 20:47:25 2019 +0000
Revision:
0:e9275bdfa393
First commit

Who changed what in which revision?

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