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
- Committer:
- Christopher Haster
- Date:
- 2016-02-28
- Revision:
- 10:0fe2c42a0261
- Parent:
- 9:16e5208cc4ef
- Child:
- 18:2cb1fffed50c
File content as of revision 10:0fe2c42a0261:
/*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef __DNSQUERY_H__
#define __DNSQUERY_H__
#include "NetworkInterface.h"
#include "UDPSocket.h"
/** Function dnsQuery implements the functionality to query a domain name
* server for an IP-Address of a given hostname.
* @param iface : Network interface to use for DNS resolution.
* @param sock : Previously opened socket to use for DNS resolution.
* @param hostname : The hostname of interest as a string.
* Format must be without http:// or www. IE google.com, mbed.org, etc.
* If a standard IP Address is passed, it will be copied into ip unmodified.
* @param ipaddress : A reference to a IPADDRESS_t object which will receive
* the resolved IP Address of the host in question.
* @returns 0 on succes, NS_DNS_FAILURE if host is not found,
* or a negative value for other errors.
*/
int32_t dnsQuery(NetworkInterface *iface, const char *host, char *ip);
int32_t dnsQuery(UDPSocket *sock, const char *host, char *ip);
#endif // __DNSQUERY_H__
