Development mbed library for MAX32630FTHR

Dependents:   blinky_max32630fthr

Committer:
switches
Date:
Fri Dec 16 16:27:57 2016 +0000
Revision:
3:1198227e6421
Parent:
0:5c4d7b2438d3
Changed ADC scale for MAX32625 platforms to 1.2V full scale to match MAX32630 platforms

Who changed what in which revision?

UserRevisionLine numberNew contents of line
switches 0:5c4d7b2438d3 1
switches 0:5c4d7b2438d3 2 /** \addtogroup netsocket */
switches 0:5c4d7b2438d3 3 /** @{*/
switches 0:5c4d7b2438d3 4 /* nsapi_dns.h
switches 0:5c4d7b2438d3 5 * Original work Copyright (c) 2013 Henry Leinen (henry[dot]leinen [at] online [dot] de)
switches 0:5c4d7b2438d3 6 * Modified work Copyright (c) 2015 ARM Limited
switches 0:5c4d7b2438d3 7 *
switches 0:5c4d7b2438d3 8 * Licensed under the Apache License, Version 2.0 (the "License");
switches 0:5c4d7b2438d3 9 * you may not use this file except in compliance with the License.
switches 0:5c4d7b2438d3 10 * You may obtain a copy of the License at
switches 0:5c4d7b2438d3 11 *
switches 0:5c4d7b2438d3 12 * http://www.apache.org/licenses/LICENSE-2.0
switches 0:5c4d7b2438d3 13 *
switches 0:5c4d7b2438d3 14 * Unless required by applicable law or agreed to in writing, software
switches 0:5c4d7b2438d3 15 * distributed under the License is distributed on an "AS IS" BASIS,
switches 0:5c4d7b2438d3 16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
switches 0:5c4d7b2438d3 17 * See the License for the specific language governing permissions and
switches 0:5c4d7b2438d3 18 * limitations under the License.
switches 0:5c4d7b2438d3 19 */
switches 0:5c4d7b2438d3 20 #ifndef NSAPI_DNS_H
switches 0:5c4d7b2438d3 21 #define NSAPI_DNS_H
switches 0:5c4d7b2438d3 22
switches 0:5c4d7b2438d3 23 #include "nsapi_types.h"
switches 0:5c4d7b2438d3 24 #ifdef __cplusplus
switches 0:5c4d7b2438d3 25 #include "netsocket/NetworkStack.h"
switches 0:5c4d7b2438d3 26 #endif
switches 0:5c4d7b2438d3 27
switches 0:5c4d7b2438d3 28 #ifndef __cplusplus
switches 0:5c4d7b2438d3 29
switches 0:5c4d7b2438d3 30
switches 0:5c4d7b2438d3 31 /** Query a domain name server for an IP address of a given hostname
switches 0:5c4d7b2438d3 32 *
switches 0:5c4d7b2438d3 33 * @param stack Network stack as target for DNS query
switches 0:5c4d7b2438d3 34 * @param host Hostname to resolve
switches 0:5c4d7b2438d3 35 * @param addr Destination for the host address
switches 0:5c4d7b2438d3 36 * @param version IP version to resolve
switches 0:5c4d7b2438d3 37 * @return 0 on success, negative error code on failure
switches 0:5c4d7b2438d3 38 * NSAPI_ERROR_DNS_FAILURE indicates the host could not be found
switches 0:5c4d7b2438d3 39 */
switches 0:5c4d7b2438d3 40 nsapi_error_t nsapi_dns_query(nsapi_stack_t *stack, const char *host,
switches 0:5c4d7b2438d3 41 nsapi_addr_t *addr, nsapi_version_t version);
switches 0:5c4d7b2438d3 42
switches 0:5c4d7b2438d3 43 /** Query a domain name server for multiple IP address of a given hostname
switches 0:5c4d7b2438d3 44 *
switches 0:5c4d7b2438d3 45 * @param stack Network stack as target for DNS query
switches 0:5c4d7b2438d3 46 * @param host Hostname to resolve
switches 0:5c4d7b2438d3 47 * @param addr Array for the host addresses
switches 0:5c4d7b2438d3 48 * @param addr_count Number of addresses allocated in the array
switches 0:5c4d7b2438d3 49 * @param version IP version to resolve
switches 0:5c4d7b2438d3 50 * @return Number of addresses found on success, negative error code on failure
switches 0:5c4d7b2438d3 51 * NSAPI_ERROR_DNS_FAILURE indicates the host could not be found
switches 0:5c4d7b2438d3 52 */
switches 0:5c4d7b2438d3 53 nsapi_size_or_error_t nsapi_dns_query_multiple(nsapi_stack_t *stack, const char *host,
switches 0:5c4d7b2438d3 54 nsapi_addr_t *addr, nsapi_size_t addr_count, nsapi_version_t version);
switches 0:5c4d7b2438d3 55
switches 0:5c4d7b2438d3 56 /** Add a domain name server to list of servers to query
switches 0:5c4d7b2438d3 57 *
switches 0:5c4d7b2438d3 58 * @param addr Destination for the host address
switches 0:5c4d7b2438d3 59 * @return 0 on success, negative error code on failure
switches 0:5c4d7b2438d3 60 */
switches 0:5c4d7b2438d3 61 nsapi_error_t nsapi_dns_add_server(nsapi_addr_t addr);
switches 0:5c4d7b2438d3 62
switches 0:5c4d7b2438d3 63
switches 0:5c4d7b2438d3 64 #else
switches 0:5c4d7b2438d3 65
switches 0:5c4d7b2438d3 66
switches 0:5c4d7b2438d3 67 /** Query a domain name server for an IP address of a given hostname
switches 0:5c4d7b2438d3 68 *
switches 0:5c4d7b2438d3 69 * @param stack Network stack as target for DNS query
switches 0:5c4d7b2438d3 70 * @param host Hostname to resolve
switches 0:5c4d7b2438d3 71 * @param addr Destination for the host address
switches 0:5c4d7b2438d3 72 * @param version IP version to resolve (defaults to NSAPI_IPv4)
switches 0:5c4d7b2438d3 73 * @return 0 on success, negative error code on failure
switches 0:5c4d7b2438d3 74 * NSAPI_ERROR_DNS_FAILURE indicates the host could not be found
switches 0:5c4d7b2438d3 75 */
switches 0:5c4d7b2438d3 76 nsapi_error_t nsapi_dns_query(NetworkStack *stack, const char *host,
switches 0:5c4d7b2438d3 77 SocketAddress *addr, nsapi_version_t version = NSAPI_IPv4);
switches 0:5c4d7b2438d3 78
switches 0:5c4d7b2438d3 79 /** Query a domain name server for an IP address of a given hostname
switches 0:5c4d7b2438d3 80 *
switches 0:5c4d7b2438d3 81 * @param stack Network stack as target for DNS query
switches 0:5c4d7b2438d3 82 * @param host Hostname to resolve
switches 0:5c4d7b2438d3 83 * @param addr Destination for the host address
switches 0:5c4d7b2438d3 84 * @param version IP version to resolve (defaults to NSAPI_IPv4)
switches 0:5c4d7b2438d3 85 * @return 0 on success, negative error code on failure
switches 0:5c4d7b2438d3 86 * NSAPI_ERROR_DNS_FAILURE indicates the host could not be found
switches 0:5c4d7b2438d3 87 */
switches 0:5c4d7b2438d3 88 extern "C" nsapi_error_t nsapi_dns_query(nsapi_stack_t *stack, const char *host,
switches 0:5c4d7b2438d3 89 nsapi_addr_t *addr, nsapi_version_t version = NSAPI_IPv4);
switches 0:5c4d7b2438d3 90
switches 0:5c4d7b2438d3 91 /** Query a domain name server for an IP address of a given hostname
switches 0:5c4d7b2438d3 92 *
switches 0:5c4d7b2438d3 93 * @param stack Network stack as target for DNS query
switches 0:5c4d7b2438d3 94 * @param host Hostname to resolve
switches 0:5c4d7b2438d3 95 * @param addr Destination for the host address
switches 0:5c4d7b2438d3 96 * @param version IP version to resolve (defaults to NSAPI_IPv4)
switches 0:5c4d7b2438d3 97 * @return 0 on success, negative error code on failure
switches 0:5c4d7b2438d3 98 * NSAPI_ERROR_DNS_FAILURE indicates the host could not be found
switches 0:5c4d7b2438d3 99 */
switches 0:5c4d7b2438d3 100 template <typename S>
switches 0:5c4d7b2438d3 101 nsapi_error_t nsapi_dns_query(S *stack, const char *host,
switches 0:5c4d7b2438d3 102 SocketAddress *addr, nsapi_version_t version = NSAPI_IPv4)
switches 0:5c4d7b2438d3 103 {
switches 0:5c4d7b2438d3 104 return nsapi_dns_query(nsapi_create_stack(stack), host, addr, version);
switches 0:5c4d7b2438d3 105 }
switches 0:5c4d7b2438d3 106
switches 0:5c4d7b2438d3 107 /** Query a domain name server for multiple IP address of a given hostname
switches 0:5c4d7b2438d3 108 *
switches 0:5c4d7b2438d3 109 * @param stack Network stack as target for DNS query
switches 0:5c4d7b2438d3 110 * @param host Hostname to resolve
switches 0:5c4d7b2438d3 111 * @param addr Array for the host addresses
switches 0:5c4d7b2438d3 112 * @param addr_count Number of addresses allocated in the array
switches 0:5c4d7b2438d3 113 * @param version IP version to resolve (defaults to NSAPI_IPv4)
switches 0:5c4d7b2438d3 114 * @return Number of addresses found on success, negative error code on failure
switches 0:5c4d7b2438d3 115 * NSAPI_ERROR_DNS_FAILURE indicates the host could not be found
switches 0:5c4d7b2438d3 116 */
switches 0:5c4d7b2438d3 117 nsapi_size_or_error_t nsapi_dns_query_multiple(NetworkStack *stack, const char *host,
switches 0:5c4d7b2438d3 118 SocketAddress *addr, nsapi_size_t addr_count, nsapi_version_t version = NSAPI_IPv4);
switches 0:5c4d7b2438d3 119
switches 0:5c4d7b2438d3 120 /** Query a domain name server for multiple IP address of a given hostname
switches 0:5c4d7b2438d3 121 *
switches 0:5c4d7b2438d3 122 * @param stack Network stack as target for DNS query
switches 0:5c4d7b2438d3 123 * @param host Hostname to resolve
switches 0:5c4d7b2438d3 124 * @param addr Array for the host addresses
switches 0:5c4d7b2438d3 125 * @param addr_count Number of addresses allocated in the array
switches 0:5c4d7b2438d3 126 * @param version IP version to resolve (defaults to NSAPI_IPv4)
switches 0:5c4d7b2438d3 127 * @return Number of addresses found on success, negative error code on failure
switches 0:5c4d7b2438d3 128 * NSAPI_ERROR_DNS_FAILURE indicates the host could not be found
switches 0:5c4d7b2438d3 129 */
switches 0:5c4d7b2438d3 130 extern "C" nsapi_size_or_error_t nsapi_dns_query_multiple(nsapi_stack_t *stack, const char *host,
switches 0:5c4d7b2438d3 131 nsapi_addr_t *addr, nsapi_size_t addr_count, nsapi_version_t version = NSAPI_IPv4);
switches 0:5c4d7b2438d3 132
switches 0:5c4d7b2438d3 133 /** Query a domain name server for multiple IP address of a given hostname
switches 0:5c4d7b2438d3 134 *
switches 0:5c4d7b2438d3 135 * @param stack Network stack as target for DNS query
switches 0:5c4d7b2438d3 136 * @param host Hostname to resolve
switches 0:5c4d7b2438d3 137 * @param addr Array for the host addresses
switches 0:5c4d7b2438d3 138 * @param addr_count Number of addresses allocated in the array
switches 0:5c4d7b2438d3 139 * @param version IP version to resolve (defaults to NSAPI_IPv4)
switches 0:5c4d7b2438d3 140 * @return Number of addresses found on success, negative error code on failure
switches 0:5c4d7b2438d3 141 * NSAPI_ERROR_DNS_FAILURE indicates the host could not be found
switches 0:5c4d7b2438d3 142 */
switches 0:5c4d7b2438d3 143 template <typename S>
switches 0:5c4d7b2438d3 144 nsapi_size_or_error_t nsapi_dns_query_multiple(S *stack, const char *host,
switches 0:5c4d7b2438d3 145 SocketAddress *addr, nsapi_size_t addr_count, nsapi_version_t version = NSAPI_IPv4)
switches 0:5c4d7b2438d3 146 {
switches 0:5c4d7b2438d3 147 return nsapi_dns_query_multiple(nsapi_create_stack(stack),
switches 0:5c4d7b2438d3 148 host, addr, addr_count, version);
switches 0:5c4d7b2438d3 149 }
switches 0:5c4d7b2438d3 150
switches 0:5c4d7b2438d3 151 /** Add a domain name server to list of servers to query
switches 0:5c4d7b2438d3 152 *
switches 0:5c4d7b2438d3 153 * @param addr Destination for the host address
switches 0:5c4d7b2438d3 154 * @return 0 on success, negative error code on failure
switches 0:5c4d7b2438d3 155 */
switches 0:5c4d7b2438d3 156 extern "C" nsapi_error_t nsapi_dns_add_server(nsapi_addr_t addr);
switches 0:5c4d7b2438d3 157
switches 0:5c4d7b2438d3 158 /** Add a domain name server to list of servers to query
switches 0:5c4d7b2438d3 159 *
switches 0:5c4d7b2438d3 160 * @param addr Destination for the host address
switches 0:5c4d7b2438d3 161 * @return 0 on success, negative error code on failure
switches 0:5c4d7b2438d3 162 */
switches 0:5c4d7b2438d3 163 static inline nsapi_error_t nsapi_dns_add_server(const SocketAddress &address)
switches 0:5c4d7b2438d3 164 {
switches 0:5c4d7b2438d3 165 return nsapi_dns_add_server(address.get_addr());
switches 0:5c4d7b2438d3 166 }
switches 0:5c4d7b2438d3 167
switches 0:5c4d7b2438d3 168 /** Add a domain name server to list of servers to query
switches 0:5c4d7b2438d3 169 *
switches 0:5c4d7b2438d3 170 * @param addr Destination for the host address
switches 0:5c4d7b2438d3 171 * @return 0 on success, negative error code on failure
switches 0:5c4d7b2438d3 172 */
switches 0:5c4d7b2438d3 173 static inline nsapi_error_t nsapi_dns_add_server(const char *address)
switches 0:5c4d7b2438d3 174 {
switches 0:5c4d7b2438d3 175 return nsapi_dns_add_server(SocketAddress(address));
switches 0:5c4d7b2438d3 176 }
switches 0:5c4d7b2438d3 177
switches 0:5c4d7b2438d3 178
switches 0:5c4d7b2438d3 179 #endif
switches 0:5c4d7b2438d3 180
switches 0:5c4d7b2438d3 181 #endif
switches 0:5c4d7b2438d3 182
switches 0:5c4d7b2438d3 183 /** @}*/