ap

Dependencies:   DnsQuery

Dependents:   WizFi310_TCP_Echo_Server_Example

Fork of NetworkSocketAPI by NetworkSocketAPI

Committer:
Christopher Haster
Date:
Tue Apr 05 06:56:22 2016 -0500
Revision:
75:dea0cdb42241
Child:
76:bbe51641f405
Introduced SocketAddress class for efficient handling of netork addresses

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Christopher Haster 75:dea0cdb42241 1 /* Copyright (C) 2012 mbed.org, MIT License
Christopher Haster 75:dea0cdb42241 2 *
Christopher Haster 75:dea0cdb42241 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
Christopher Haster 75:dea0cdb42241 4 * and associated documentation files (the "Software"), to deal in the Software without restriction,
Christopher Haster 75:dea0cdb42241 5 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
Christopher Haster 75:dea0cdb42241 6 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
Christopher Haster 75:dea0cdb42241 7 * furnished to do so, subject to the following conditions:
Christopher Haster 75:dea0cdb42241 8 *
Christopher Haster 75:dea0cdb42241 9 * The above copyright notice and this permission notice shall be included in all copies or
Christopher Haster 75:dea0cdb42241 10 * substantial portions of the Software.
Christopher Haster 75:dea0cdb42241 11 *
Christopher Haster 75:dea0cdb42241 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
Christopher Haster 75:dea0cdb42241 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
Christopher Haster 75:dea0cdb42241 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
Christopher Haster 75:dea0cdb42241 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
Christopher Haster 75:dea0cdb42241 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Christopher Haster 75:dea0cdb42241 17 */
Christopher Haster 75:dea0cdb42241 18 #ifndef SOCKETADDRESS_H
Christopher Haster 75:dea0cdb42241 19 #define SOCKETADDRESS_H
Christopher Haster 75:dea0cdb42241 20
Christopher Haster 75:dea0cdb42241 21 /**
Christopher Haster 75:dea0cdb42241 22 * A general socket address composed of the IP address and port
Christopher Haster 75:dea0cdb42241 23 */
Christopher Haster 75:dea0cdb42241 24 class SocketAddress {
Christopher Haster 75:dea0cdb42241 25 public:
Christopher Haster 75:dea0cdb42241 26 /** SocketAddress lifetime
Christopher Haster 75:dea0cdb42241 27 */
Christopher Haster 75:dea0cdb42241 28 SocketAddress(const char *addr, uint16_t port);
Christopher Haster 75:dea0cdb42241 29 ~SocketAddress();
Christopher Haster 75:dea0cdb42241 30
Christopher Haster 75:dea0cdb42241 31 /** Set the IP address
Christopher Haster 75:dea0cdb42241 32 \param host Null-terminated string representing the IP address
Christopher Haster 75:dea0cdb42241 33 */
Christopher Haster 75:dea0cdb42241 34 void set_address(const char *host);
Christopher Haster 75:dea0cdb42241 35
Christopher Haster 75:dea0cdb42241 36 /** Set the port
Christopher Haster 75:dea0cdb42241 37 \param port 16-bit port
Christopher Haster 75:dea0cdb42241 38 */
Christopher Haster 75:dea0cdb42241 39 void set_port(uint16_t port);
Christopher Haster 75:dea0cdb42241 40
Christopher Haster 75:dea0cdb42241 41 /** Get the IP address
Christopher Haster 75:dea0cdb42241 42 \return The string representation of the IP Address
Christopher Haster 75:dea0cdb42241 43 */
Christopher Haster 75:dea0cdb42241 44 const char *get_address();
Christopher Haster 75:dea0cdb42241 45
Christopher Haster 75:dea0cdb42241 46 /** Get the port
Christopher Haster 75:dea0cdb42241 47 \return The 16-bit port
Christopher Haster 75:dea0cdb42241 48 */
Christopher Haster 75:dea0cdb42241 49 int get_port(void);
Christopher Haster 75:dea0cdb42241 50 };
Christopher Haster 75:dea0cdb42241 51
Christopher Haster 75:dea0cdb42241 52 #endif