WIZNet W5500 with additional enhancements

Fork of WIZnetInterface by WIZnet

Committer:
Helmut Tschemernjak
Date:
Mon Oct 09 19:58:19 2017 +0200
Revision:
34:7d44648ec5f2
Parent:
0:6f28332c466f
Added support for manual DNS server config or DHCP DNS config.
Now the DNS 8.8.8.8 is only a fallback if no DNS server is specified.
Replaced error() messages with printf() to avoid hanging code in error()

Who changed what in which revision?

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