mirror of https://github.com/ARMmbed/mbed-os.git
Netsocket: Add get_dns_server API for NetworkInterface
With get_dns_server DNS servers can be queried from NetworkInterface objectpull/12606/head
parent
09fe16618a
commit
e776a9bb72
|
@ -72,6 +72,11 @@ nsapi_error_t NetworkInterface::add_dns_server(const SocketAddress &address, con
|
||||||
return NSAPI_ERROR_UNSUPPORTED;
|
return NSAPI_ERROR_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsapi_error_t NetworkInterface::get_dns_server(int index, SocketAddress *address, const char *interface_name)
|
||||||
|
{
|
||||||
|
return NSAPI_ERROR_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
void NetworkInterface::attach(mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb)
|
void NetworkInterface::attach(mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,11 @@ nsapi_error_t NetworkInterface::add_dns_server(const SocketAddress &address, con
|
||||||
return get_stack()->add_dns_server(address, interface_name);
|
return get_stack()->add_dns_server(address, interface_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsapi_error_t NetworkInterface::get_dns_server(int index, SocketAddress *address, const char *interface_name)
|
||||||
|
{
|
||||||
|
return get_stack()->get_dns_server(index, address, interface_name);
|
||||||
|
}
|
||||||
|
|
||||||
void NetworkInterface::attach(mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb)
|
void NetworkInterface::attach(mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb)
|
||||||
{
|
{
|
||||||
// Dummy, that needs to be overwritten when inherited, but cannot be removed
|
// Dummy, that needs to be overwritten when inherited, but cannot be removed
|
||||||
|
|
|
@ -324,6 +324,18 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual nsapi_error_t add_dns_server(const SocketAddress &address, const char *interface_name);
|
virtual nsapi_error_t add_dns_server(const SocketAddress &address, const char *interface_name);
|
||||||
|
|
||||||
|
/** Get a domain name server from a list of servers to query
|
||||||
|
*
|
||||||
|
* Returns a DNS server address for a index. If returns error no more
|
||||||
|
* DNS servers to read.
|
||||||
|
*
|
||||||
|
* @param index Index of the DNS server, starts from zero
|
||||||
|
* @param address Destination for the host address
|
||||||
|
* @param interface_name Network interface name
|
||||||
|
* @return NSAPI_ERROR_OK on success, negative error code on failure
|
||||||
|
*/
|
||||||
|
virtual nsapi_error_t get_dns_server(int index, SocketAddress *address, const char *interface_name = NULL);
|
||||||
|
|
||||||
/** Register callback for status reporting.
|
/** Register callback for status reporting.
|
||||||
*
|
*
|
||||||
* The specified status callback function will be called on status changes
|
* The specified status callback function will be called on status changes
|
||||||
|
|
Loading…
Reference in New Issue