Skip to content

Commit b55f9f2

Browse files
author
Arto Kinnunen
committed
Update WisunBorderRouter class
Add set_dns_query_result to WisunBorderRouter.
1 parent 8c3df3a commit b55f9f2

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,19 @@ class WisunBorderRouter {
260260
* */
261261
mesh_error_t get_radius_shared_secret(uint16_t *shared_secret_len, uint8_t *shared_secret);
262262

263+
/**
264+
* \brief Set DNS query result to Nanostack cache.
265+
*
266+
* Function sets DNS query result to Nanostack cache to get distributed to the devices in the Wi-SUN network.
267+
* Function must be called for a running Wi-SUN Border Router instance.
268+
*
269+
* \param address resolved address of domain_name.
270+
* \param domain_name name of the domain. Must be non-NULL.
271+
* \return MESH_ERROR_NONE on success.
272+
* \return error value in case of failure.
273+
* */
274+
mesh_error_t set_dns_query_result(SocketAddress *address, char *domain_name);
275+
263276
private:
264277
mesh_error_t configure();
265278
mesh_error_t apply_configuration(int8_t mesh_if_id);

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,3 +324,20 @@ mesh_error_t WisunBorderRouter::get_radius_shared_secret(uint16_t *shared_secret
324324

325325
return MESH_ERROR_NONE;
326326
}
327+
328+
mesh_error_t WisunBorderRouter::set_dns_query_result(SocketAddress *address, char *domain_name)
329+
{
330+
if (!domain_name || !address) {
331+
return MESH_ERROR_PARAM;
332+
}
333+
334+
if (_mesh_if_id < 0) {
335+
return MESH_ERROR_STATE;
336+
}
337+
338+
if (ws_bbr_dns_query_result_set(_mesh_if_id, (const uint8_t *)address->get_ip_bytes(), domain_name) >= 0 ) {
339+
return MESH_ERROR_NONE;
340+
}
341+
342+
return MESH_ERROR_UNKNOWN;
343+
}

0 commit comments

Comments
 (0)