Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of DnsQuery by
DnsQuery.h@10:0fe2c42a0261, 2016-02-28 (annotated)
- Committer:
- Christopher Haster
- Date:
- Sun Feb 28 22:07:29 2016 -0600
- Revision:
- 10:0fe2c42a0261
- Parent:
- 9:16e5208cc4ef
- Child:
- 18:2cb1fffed50c
Rearranged DnsQuery to expose errors
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| sarahmarshy | 2:12d08f0f20cf | 1 | /* |
| sarahmarshy | 0:fff4b9055396 | 2 | * |
| sarahmarshy | 0:fff4b9055396 | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
| sarahmarshy | 0:fff4b9055396 | 4 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
| sarahmarshy | 0:fff4b9055396 | 5 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
| sarahmarshy | 0:fff4b9055396 | 6 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
| sarahmarshy | 0:fff4b9055396 | 7 | * furnished to do so, subject to the following conditions: |
| sarahmarshy | 0:fff4b9055396 | 8 | * |
| sarahmarshy | 0:fff4b9055396 | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
| sarahmarshy | 0:fff4b9055396 | 10 | * substantial portions of the Software. |
| sarahmarshy | 0:fff4b9055396 | 11 | * |
| sarahmarshy | 0:fff4b9055396 | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
| sarahmarshy | 0:fff4b9055396 | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| sarahmarshy | 0:fff4b9055396 | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
| sarahmarshy | 0:fff4b9055396 | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| sarahmarshy | 0:fff4b9055396 | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| sarahmarshy | 0:fff4b9055396 | 17 | */ |
| sarahmarshy | 0:fff4b9055396 | 18 | #ifndef __DNSQUERY_H__ |
| sarahmarshy | 0:fff4b9055396 | 19 | #define __DNSQUERY_H__ |
| sarahmarshy | 0:fff4b9055396 | 20 | |
| Christopher Haster |
10:0fe2c42a0261 | 21 | #include "NetworkInterface.h" |
| Christopher Haster |
5:d85c1a7e0e9f | 22 | #include "UDPSocket.h" |
| Christopher Haster |
5:d85c1a7e0e9f | 23 | |
| Christopher Haster |
5:d85c1a7e0e9f | 24 | |
| Christopher Haster |
10:0fe2c42a0261 | 25 | /** Function dnsQuery implements the functionality to query a domain name |
| Christopher Haster |
10:0fe2c42a0261 | 26 | * server for an IP-Address of a given hostname. |
| Christopher Haster |
10:0fe2c42a0261 | 27 | * @param iface : Network interface to use for DNS resolution. |
| Christopher Haster |
10:0fe2c42a0261 | 28 | * @param sock : Previously opened socket to use for DNS resolution. |
| Christopher Haster |
10:0fe2c42a0261 | 29 | * @param hostname : The hostname of interest as a string. |
| Christopher Haster |
10:0fe2c42a0261 | 30 | * Format must be without http:// or www. IE google.com, mbed.org, etc. |
| Christopher Haster |
10:0fe2c42a0261 | 31 | * If a standard IP Address is passed, it will be copied into ip unmodified. |
| Christopher Haster |
10:0fe2c42a0261 | 32 | * @param ipaddress : A reference to a IPADDRESS_t object which will receive |
| Christopher Haster |
10:0fe2c42a0261 | 33 | * the resolved IP Address of the host in question. |
| Christopher Haster |
10:0fe2c42a0261 | 34 | * @returns 0 on succes, NS_DNS_FAILURE if host is not found, |
| Christopher Haster |
10:0fe2c42a0261 | 35 | * or a negative value for other errors. |
| Christopher Haster |
10:0fe2c42a0261 | 36 | */ |
| Christopher Haster |
10:0fe2c42a0261 | 37 | int32_t dnsQuery(NetworkInterface *iface, const char *host, char *ip); |
| Christopher Haster |
10:0fe2c42a0261 | 38 | int32_t dnsQuery(UDPSocket *sock, const char *host, char *ip); |
| sarahmarshy | 0:fff4b9055396 | 39 | |
| sarahmarshy | 0:fff4b9055396 | 40 | |
| Christopher Haster |
4:3749346dcd59 | 41 | #endif // __DNSQUERY_H__ |
