Doug Anson / mbedEndpointNetwork_BLE

Dependencies:   libnsdl_m0 BLE_API Base64 nRF51822 SplitterAssembler

Committer:
ansond
Date:
Wed Feb 11 22:13:25 2015 +0000
Revision:
0:7809547930d9
Child:
2:30f4a0dab604
initial BLE network support

Who changed what in which revision?

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