Skip to content

Commit d02561e

Browse files
author
Arto Kinnunen
committed
Update WisunBorderRouter class
Add set_dns_query_result to WisunBorderRouter.
1 parent da8f3be commit d02561e

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

connectivity/nanostack/mbed-mesh-api/mbed-mesh-api/WisunBorderRouter.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,19 @@ class WisunBorderRouter {
307307
* */
308308
mesh_error_t validate_radius_timing(ws_br_radius_timing_t *timing);
309309

310+
/**
311+
* \brief Set DNS query result to Nanostack cache.
312+
*
313+
* Function sets DNS query result to Nanostack cache to get distributed to the devices in the Wi-SUN network.
314+
* Function must be called for a running Wi-SUN Border Router instance.
315+
*
316+
* \param address resolved address of domain_name.
317+
* \param domain_name name of the domain. Must be non-NULL.
318+
* \return MESH_ERROR_NONE on success.
319+
* \return error value in case of failure.
320+
* */
321+
mesh_error_t set_dns_query_result(SocketAddress *address, char *domain_name);
322+
310323
private:
311324
mesh_error_t configure();
312325
mesh_error_t apply_configuration(int8_t mesh_if_id);

connectivity/nanostack/mbed-mesh-api/source/WisunBorderRouter.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,3 +452,20 @@ mesh_error_t WisunBorderRouter::validate_radius_timing(ws_br_radius_timing_t *ti
452452

453453
return MESH_ERROR_NONE;
454454
}
455+
456+
mesh_error_t WisunBorderRouter::set_dns_query_result(SocketAddress *address, char *domain_name)
457+
{
458+
if (!domain_name || !address) {
459+
return MESH_ERROR_PARAM;
460+
}
461+
462+
if (_mesh_if_id < 0) {
463+
return MESH_ERROR_STATE;
464+
}
465+
466+
if (ws_bbr_dns_query_result_set(_mesh_if_id, (const uint8_t *)address->get_ip_bytes(), domain_name) >= 0 ) {
467+
return MESH_ERROR_NONE;
468+
}
469+
470+
return MESH_ERROR_UNKNOWN;
471+
}

0 commit comments

Comments
 (0)