Mistake on this page?
Report an issue in GitHub or email us
Public Types | Public Member Functions
DNS Class Referenceabstract
Inheritance diagram for DNS:
NetworkInterface NetworkStack CellularBase EMACInterface EthInterface InterfaceNanostack mbed::CellularNetwork MeshInterface WiFiInterface mbed::AT_CellularStack NetworkStackWrapper OnboardNetworkStack

Public Types

typedef mbed::Callback< void(nsapi_error_t result, SocketAddress *address)> hostbyname_cb_t
 

Public Member Functions

virtual nsapi_error_t gethostbyname (const char *host, SocketAddress *address, nsapi_version_t version=NSAPI_UNSPEC)=0
 
virtual nsapi_value_or_error_t gethostbyname_async (const char *host, hostbyname_cb_t callback, nsapi_version_t version=NSAPI_UNSPEC)=0
 
virtual nsapi_error_t gethostbyname_async_cancel (int id)=0
 
virtual nsapi_error_t add_dns_server (const SocketAddress &address)=0
 

Member Typedef Documentation

Hostname translation callback (asynchronous)

Callback will be called after DNS resolution completes or a failure occurs.

Callback should not take more than 10ms to execute, otherwise it might prevent underlying thread processing. A portable user of the callback should not make calls to network operations due to stack size limitations. The callback should not perform expensive operations such as socket recv/send calls or blocking operations.

Parameters
status0 on success, negative error code on failure
addressOn success, destination for the host SocketAddress

Member Function Documentation

virtual nsapi_error_t DNS::add_dns_server ( const SocketAddress address)
pure virtual

Add a domain name server to list of servers to query

Parameters
addressDestination for the host address
Returns
0 on success, negative error code on failure

Implemented in NetworkInterface, NetworkStackWrapper, and NetworkStack.

virtual nsapi_error_t DNS::gethostbyname ( const char *  host,
SocketAddress address,
nsapi_version_t  version = NSAPI_UNSPEC 
)
pure virtual

Translates a hostname to an IP address with specific version

The hostname may be either a domain name or an IP address. If the hostname is an IP address, no network transactions will be performed.

If no stack-specific DNS resolution is provided, the hostname will be resolve using a UDP socket on the stack.

Parameters
hostHostname to resolve
addressDestination for the host SocketAddress
versionIP version of address to resolve, NSAPI_UNSPEC indicates version is chosen by the stack (defaults to NSAPI_UNSPEC)
Returns
0 on success, negative error code on failure

Implemented in NetworkStackWrapper, NetworkInterface, and NetworkStack.

virtual nsapi_value_or_error_t DNS::gethostbyname_async ( const char *  host,
hostbyname_cb_t  callback,
nsapi_version_t  version = NSAPI_UNSPEC 
)
pure virtual

Translates a hostname to an IP address (asynchronous)

The hostname may be either a domain name or an IP address. If the hostname is an IP address, no network transactions will be performed.

If no stack-specific DNS resolution is provided, the hostname will be resolve using a UDP socket on the stack.

Call is non-blocking. Result of the DNS operation is returned by the callback. If this function returns failure, callback will not be called. In case result is success (IP address was found from DNS cache), callback will be called before function returns.

Parameters
hostHostname to resolve
callbackCallback that is called for result
versionIP version of address to resolve, NSAPI_UNSPEC indicates version is chosen by the stack (defaults to NSAPI_UNSPEC)
Returns
0 on immediate success, negative error code on immediate failure or a positive unique id that represents the hostname translation operation and can be passed to cancel

Implemented in NetworkInterface, and NetworkStack.

virtual nsapi_error_t DNS::gethostbyname_async_cancel ( int  id)
pure virtual

Cancels asynchronous hostname translation

When translation is cancelled, callback will not be called.

Parameters
idUnique id of the hostname translation operation
Returns
0 on success, negative error code on failure

Implemented in NetworkInterface, and NetworkStack.


The documentation for this class was generated from the following file:
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.