From 99322121cd4b1cad16e5a56b23021fd3991e5ee0 Mon Sep 17 00:00:00 2001 From: saerome kim Date: Tue, 22 Aug 2017 19:00:28 +0900 Subject: [PATCH] Added new CAPI to get Mesh Configratiion Parameters Change-Id: I074e4af75f459037a36beaa7c9b6c9409a663395 Signed-off-by: Saurav Babu --- include/wifi-mesh-internal.h | 293 +++++++++++++++++++++++++++++++++++ include/wifi-mesh_dbus.h | 2 + include/wifi-mesh_private.h | 15 ++ src/wifi-mesh-dbus.c | 97 ++++++++++++ src/wifi-mesh-internal.c | 276 +++++++++++++++++++++++++++++++++ test/wifi-mesh-network.c | 85 ++++++++++ 6 files changed, 768 insertions(+) diff --git a/include/wifi-mesh-internal.h b/include/wifi-mesh-internal.h index 5fdcdb9..48e70c8 100644 --- a/include/wifi-mesh-internal.h +++ b/include/wifi-mesh-internal.h @@ -55,6 +55,12 @@ typedef void* wifi_mesh_station_info_h; */ typedef void* wifi_mesh_mpath_info_h; +/** + * @brief The mesh conf information handle. + * @since_tizen 4.0 +*/ +typedef void* wifi_mesh_meshconf_info_h; + /** * @brief Gets the maximum data rate. * @details This function is to get the maximum data rate @@ -2360,6 +2366,293 @@ int wifi_mesh_get_mpath_flags(wifi_mesh_mpath_info_h mpath, guchar* flags); int wifi_mesh_set_interfaces(wifi_mesh_h handle, const char *mesh, const char* gate, const char *softap); +/** + * @brief Get information of mesh configurations. + * @details Get information about mesh configurations present in the currently + * connected mesh network. + * + * @since_tizen 4.0 + * + * @param[in] handle The Wi-Fi mesh handle + * @param[out] meshconf The Mesh conf information handle + * + * + * @return 0 on success, otherwise a negative error value. + * @retval #WIFI_MESH_ERROR_NONE Successful + * @retval #WIFI_MESH_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #WIFI_MESH_ERROR_IO_ERROR Unexpected d-bus error + * + * @see wifi_mesh_destroy_meshconf_info() + * + */ +int wifi_mesh_get_meshconf_info(wifi_mesh_h handle, + wifi_mesh_meshconf_info_h *meshconf); + +/** + * @brief Destroys the Mesh Configuration Info handle. + * + * @since_tizen 4.0 + * + * @param[in] meshconf The Mesh conf information handle + * + * + * @return 0 on success, otherwise a negative error value. + * @retval #WIFI_MESH_ERROR_NONE Successful + * @retval #WIFI_MESH_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #WIFI_MESH_ERROR_IO_ERROR Unexpected d-bus error + * + * @pre The mesh configuration must be initialized using wifi_mesh_get_meshconf_info() + * + * @see wifi_mesh_get_meshconf_info() + * + */ +int wifi_mesh_destroy_meshconf_info(wifi_mesh_meshconf_info_h meshconf); + +/* + * @brief Gets the retry timeout value of Mesh Configuration. + * + * @since_tizen 4.0 + * + * @param[in] meshconf The Wi-Fi mesh conf handle + * @param[out] retry_timeout Retry timeout value + * + * + * @return 0 on success, otherwise a negative error value. + * @retval #WIFI_MESH_ERROR_NONE Successful + * @retval #WIFI_MESH_ERROR_INVALID_PARAMETER Invalid parameter + * + * @see wifi_mesh_get_meshconf_info() + * @see mesh_meshconf_cb() + * + */ +int wifi_mesh_get_meshconf_retry_timeout(wifi_mesh_meshconf_info_h meshconf, + gushort *retry_timeout); + +/* + * @brief Gets the HWMP Max PREQ Retries. + * + * @since_tizen 4.0 + * + * @param[in] meshconf The Wi-Fi mesh conf handle + * @param[out] hwmp_max_preq_retries HWMP Max PREQ Retries + * + * + * @return 0 on success, otherwise a negative error value. + * @retval #WIFI_MESH_ERROR_NONE Successful + * @retval #WIFI_MESH_ERROR_INVALID_PARAMETER Invalid parameter + * + * @see wifi_mesh_get_meshconf_info() + * @see mesh_meshconf_cb() + * + */ + +int wifi_mesh_get_meshconf_hwmp_max_preq_retries( + wifi_mesh_meshconf_info_h meshconf, + guchar *hwmp_max_preq_retries); + +/* + * @brief Gets the Confirm Timeout + * + * @since_tizen 4.0 + * + * @param[in] meshconf The Wi-Fi mesh conf handle + * @param[out] confirm_timeout Confirm Timeout + * + * + * @return 0 on success, otherwise a negative error value. + * @retval #WIFI_MESH_ERROR_NONE Successful + * @retval #WIFI_MESH_ERROR_INVALID_PARAMETER Invalid parameter + * + * @see wifi_mesh_get_meshconf_info() + * @see mesh_meshconf_cb() + * + */ +int wifi_mesh_get_meshconf_confirm_timeout(wifi_mesh_meshconf_info_h meshconf, + gushort *confirm_timeout); + +/* + * @brief Gets the Path Refresh Time. + * + * @since_tizen 4.0 + * + * @param[in] meshconf The Wi-Fi mesh conf handle + * @param[out] path_refresh_time Path Refresh Time + * + * + * @return 0 on success, otherwise a negative error value. + * @retval #WIFI_MESH_ERROR_NONE Successful + * @retval #WIFI_MESH_ERROR_INVALID_PARAMETER Invalid parameter + * + * @see wifi_mesh_get_meshconf_info() + * @see mesh_meshconf_cb() + * + */ +int wifi_mesh_get_meshconf_path_refresh_time(wifi_mesh_meshconf_info_h meshconf, + guint *path_refresh_time); + +/* + * @brief Gets the Holding Timeout. + * + * @since_tizen 4.0 + * + * @param[in] meshconf The Wi-Fi mesh conf handle + * @param[out] holding_timeout Holding Timeout + * + * + * @return 0 on success, otherwise a negative error value. + * @retval #WIFI_MESH_ERROR_NONE Successful + * @retval #WIFI_MESH_ERROR_INVALID_PARAMETER Invalid parameter + * + * @see wifi_mesh_get_meshconf_info() + * @see mesh_meshconf_cb() + * + */ +int wifi_mesh_get_meshconf_holding_timeout(wifi_mesh_meshconf_info_h meshconf, + gushort *holding_timeout); + +/* + * @brief Gets the Minimum Discovery Timeout. + * + * @since_tizen 4.0 + * + * @param[in] meshconf The Wi-Fi mesh conf handle + * @param[out] min_disc_timeout Minimum Discovery Timeout + * + * + * @return 0 on success, otherwise a negative error value. + * @retval #WIFI_MESH_ERROR_NONE Successful + * @retval #WIFI_MESH_ERROR_INVALID_PARAMETER Invalid parameter + * + * @see wifi_mesh_get_meshconf_info() + * @see mesh_meshconf_cb() + * + */ +int wifi_mesh_get_meshconf_min_disc_timeout(wifi_mesh_meshconf_info_h meshconf, + gushort *min_disc_timeout); + +/* + * @brief Gets the Max Peer Links. + * + * @since_tizen 4.0 + * + * @param[in] meshconf The Wi-Fi mesh conf handle + * @param[out] max_peer_links Max Peer Links + * + * + * @return 0 on success, otherwise a negative error value. + * @retval #WIFI_MESH_ERROR_NONE Successful + * @retval #WIFI_MESH_ERROR_INVALID_PARAMETER Invalid parameter + * + * @see wifi_mesh_get_meshconf_info() + * @see mesh_meshconf_cb() + * + */ +int wifi_mesh_get_meshconf_max_peer_links(wifi_mesh_meshconf_info_h meshconf, + gushort *max_peer_links); + +/* + * @brief Gets the HWMP PREQ Minimum Interval. + * + * @since_tizen 4.0 + * + * @param[in] meshconf The Wi-Fi mesh conf handle + * @param[out] hwmp_preq_min_interval HWMP PREQ Minimum Interval + * + * + * @return 0 on success, otherwise a negative error value. + * @retval #WIFI_MESH_ERROR_NONE Successful + * @retval #WIFI_MESH_ERROR_INVALID_PARAMETER Invalid parameter + * + * @see wifi_mesh_get_meshconf_info() + * @see mesh_meshconf_cb() + * + */ +int wifi_mesh_get_meshconf_hwmp_preq_min_interval( + wifi_mesh_meshconf_info_h meshconf, + gushort *hwmp_preq_min_interval); + +/* + * @brief Gets the TTL. + * + * @since_tizen 4.0 + * + * @param[in] meshconf The Wi-Fi mesh conf handle + * @param[out] ttl TTL + * + * + * @return 0 on success, otherwise a negative error value. + * @retval #WIFI_MESH_ERROR_NONE Successful + * @retval #WIFI_MESH_ERROR_INVALID_PARAMETER Invalid parameter + * + * @see wifi_mesh_get_meshconf_info() + * @see mesh_meshconf_cb() + * + */ +int wifi_mesh_get_meshconf_ttl( + wifi_mesh_meshconf_info_h meshconf, guchar *ttl); + +/* + * @brief Gets the HWMP Active Path Timeout. + * + * @since_tizen 4.0 + * + * @param[in] meshconf The Wi-Fi mesh conf handle + * @param[out] hwmp_active_path_timeout HWMP Active Path Timeout + * + * + * @return 0 on success, otherwise a negative error value. + * @retval #WIFI_MESH_ERROR_NONE Successful + * @retval #WIFI_MESH_ERROR_INVALID_PARAMETER Invalid parameter + * + * @see wifi_mesh_get_meshconf_info() + * @see mesh_meshconf_cb() + * + */ +int wifi_mesh_get_meshconf_hwmp_active_path_timeout( + wifi_mesh_meshconf_info_h meshconf, + guint *hwmp_active_path_timeout); + +/* + * @brief Gets the Element TTL. + * + * @since_tizen 4.0 + * + * @param[in] meshconf The Wi-Fi mesh conf handle + * @param[out] element_ttl Element TTL + * + * + * @return 0 on success, otherwise a negative error value. + * @retval #WIFI_MESH_ERROR_NONE Successful + * @retval #WIFI_MESH_ERROR_INVALID_PARAMETER Invalid parameter + * + * @see wifi_mesh_get_meshconf_info() + * @see mesh_meshconf_cb() + * + */ +int wifi_mesh_get_meshconf_element_ttl(wifi_mesh_meshconf_info_h meshconf, + guchar *element_ttl); + +/* + * @brief Gets the HWMP RANN Interval. + * + * @since_tizen 4.0 + * + * @param[in] meshconf The Wi-Fi mesh conf handle + * @param[out] hwmp_rann_interval HWMP RANN Interval + * + * + * @return 0 on success, otherwise a negative error value. + * @retval #WIFI_MESH_ERROR_NONE Successful + * @retval #WIFI_MESH_ERROR_INVALID_PARAMETER Invalid parameter + * + * @see wifi_mesh_get_meshconf_info() + * @see mesh_meshconf_cb() + * + */ +int wifi_mesh_get_meshconf_hwmp_rann_interval( + wifi_mesh_meshconf_info_h meshconf, + gushort *hwmp_rann_interval); + #ifdef __cplusplus } #endif diff --git a/include/wifi-mesh_dbus.h b/include/wifi-mesh_dbus.h index 6bafc2a..1e5e225 100644 --- a/include/wifi-mesh_dbus.h +++ b/include/wifi-mesh_dbus.h @@ -67,6 +67,8 @@ int _mesh_set_interface(wifi_mesh_h handle, const char *mesh, const char *gate, int _wifi_mesh_get_stations_info(wifi_mesh_h handle, wifi_mesh_found_station_cb cb, void *user_data); int _wifi_mesh_get_mpath_info(wifi_mesh_h handle, mesh_found_mpath_cb cb, void *user_data); int _wifi_mesh_set_interfaces(wifi_mesh_h handle, const char *mesh, const char *gate, const char *softap); +int _wifi_mesh_get_meshconf_info(wifi_mesh_h handle, + wifi_mesh_meshconf_info_h *meshconf); #ifdef __cplusplus } diff --git a/include/wifi-mesh_private.h b/include/wifi-mesh_private.h index 55ba371..15ebee5 100644 --- a/include/wifi-mesh_private.h +++ b/include/wifi-mesh_private.h @@ -133,6 +133,21 @@ struct mesh_mpath_dump_s { guchar flags; /**< Flags */ }; +struct mesh_meshconf_dump_s { + gushort retry_timeout; /**< Retry Timeout */ + guchar hwmp_max_preq_retries; /**< HWMP Max Preq Retries */ + gushort confirm_timeout; /**< Confirm Timeout */ + guint path_refresh_time; /**< Path Refresh Time */ + gushort holding_timeout; /**< Holding Timeout */ + gushort min_disc_timeout; /**< Min Discovery Timeout */ + gushort max_peer_links; /**< Max Peer Links */ + gushort hwmp_preq_min_interval; /**< HWMP PREQ Min Interval */ + guchar ttl; /**< TTL */ + guint hwmp_active_path_timeout; /**< HWMP Active Path Timeout */ + guchar element_ttl; /**< Element TTL */ + gushort hwmp_rann_interval; /**< HWMP RANN Interval */ +}; + #define NOTUSED(var) (var = var) #endif /* __CAPI_WIFI_MESH_PRIVATE_H__ */ diff --git a/src/wifi-mesh-dbus.c b/src/wifi-mesh-dbus.c index 4930d75..22ecb02 100644 --- a/src/wifi-mesh-dbus.c +++ b/src/wifi-mesh-dbus.c @@ -1773,6 +1773,103 @@ int _wifi_mesh_get_mpath_info(wifi_mesh_h handle, mesh_found_mpath_cb cb, void * return result; } +int _wifi_mesh_get_meshconf_info(wifi_mesh_h handle, + wifi_mesh_meshconf_info_h *meshconf) +{ + GVariant *variant = NULL; + int result = WIFI_MESH_ERROR_NONE; + GError *error = NULL; + struct mesh_handle *h = handle; + + GVariantIter *iter = NULL; + + gchar *key; + GVariant *val; + + if (NULL == h) { + /* LCOV_EXCL_START */ + LOGE("Invaild parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + if (NULL == h->dbus_connection || NULL == _gproxy_mesh_service) { + /* LCOV_EXCL_START */ + LOGE("I/O error"); + return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ + } + + variant = g_dbus_proxy_call_sync(_gproxy_mesh_service, "get_meshconf_info", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, &error); + if (variant) { + g_variant_get(variant, "(a{sv}i)", &iter, &result); + /* LCOV_EXCL_START */ + struct mesh_meshconf_dump_s *meshparam = + g_malloc0(sizeof(struct mesh_meshconf_dump_s)); + + while (g_variant_iter_loop(iter, "{sv}", &key, &val)) { + if (strcasecmp(key, "RETRY_TIMEOUT") == 0) { + meshparam->retry_timeout = g_variant_get_uint16(val); + LOGE("RETRY_TIMEOUT=%u", meshparam->retry_timeout); + } else if (strcasecmp(key, "HWMP_MAX_PREQ_RETRIES") == 0) { + meshparam->hwmp_max_preq_retries = g_variant_get_byte(val); + LOGE("HWMP_MAX_PREQ_RETRIES=%u", + meshparam->hwmp_max_preq_retries); + } else if (strcasecmp(key, "CONFIRM_TIMEOUT") == 0) { + meshparam->confirm_timeout = g_variant_get_uint16(val); + LOGE("CONFIRM_TIMEOUT=%u", meshparam->confirm_timeout); + } else if (strcasecmp(key, "PATH_REFRESH_TIME") == 0) { + meshparam->path_refresh_time = g_variant_get_uint32(val); + LOGE("PATH_REFRESH_TIME=%u", meshparam->path_refresh_time); + } else if (strcasecmp(key, "HOLDING_TIMEOUT") == 0) { + meshparam->holding_timeout = g_variant_get_uint16(val); + LOGE("HOLDING_TIMEOUT=%u", meshparam->holding_timeout); + } else if (strcasecmp(key, "MIN_DISC_TIMEOUT") == 0) { + meshparam->min_disc_timeout = g_variant_get_uint16(val); + LOGE("MIN_DISC_TIMEOUT=%u", meshparam->min_disc_timeout); + } else if (strcasecmp(key, "MAX_PEER_LINKS") == 0) { + meshparam->max_peer_links = g_variant_get_uint16(val); + LOGE("MAX_PEER_LINKS=%u", meshparam->max_peer_links); + } else if (strcasecmp(key, "HWMP_PREQ_MIN_INTERVAL") == 0) { + meshparam->hwmp_preq_min_interval = g_variant_get_uint16(val); + LOGE("HWMP_PREQ_MIN_INTERVAL=%u", + meshparam->hwmp_preq_min_interval); + } else if (strcasecmp(key, "TTL") == 0) { + meshparam->ttl = g_variant_get_byte(val); + LOGE("TTL=%u", meshparam->ttl); + } else if (strcasecmp(key, "HWMP_ACTIVE_PATH_TIMEOUT") == 0) { + meshparam->hwmp_active_path_timeout = g_variant_get_uint32(val); + LOGE("HWMP_ACTIVE_PATH_TIMEOUT=%u", + meshparam->hwmp_active_path_timeout); + } else if (strcasecmp(key, "ELEMENT_TTL") == 0) { + meshparam->element_ttl = g_variant_get_byte(val); + LOGE("ELEMENT_TTL=%u", meshparam->element_ttl); + } else if (strcasecmp(key, "HWMP_RANN_INTERVAL") == 0) { + meshparam->hwmp_rann_interval = g_variant_get_uint16(val); + LOGE("HWMP_RANN_INTERVAL=%u", meshparam->hwmp_rann_interval); + } + } + /* LCOV_EXCL_STOP */ + g_variant_iter_free(iter); + LOGD("get_meshconf_info status 0x%x", result); + result = __convert_service_error_type(result); + + *meshconf = (wifi_mesh_meshconf_info_h) meshparam; + } else if (error) { + /* LCOV_EXCL_START */ + LOGE("Failed DBus call [%s]", error->message); + g_error_free(error); + return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ + } + + return result; +} + int _wifi_mesh_set_interfaces(wifi_mesh_h handle, const char *mesh, const char *gate, const char *softap) { GVariant *variant = NULL; diff --git a/src/wifi-mesh-internal.c b/src/wifi-mesh-internal.c index 8b48797..e9319c5 100644 --- a/src/wifi-mesh-internal.c +++ b/src/wifi-mesh-internal.c @@ -997,3 +997,279 @@ EXPORT_API int wifi_mesh_set_interfaces(wifi_mesh_h handle, return rv; } +EXPORT_API int wifi_mesh_get_meshconf_info(wifi_mesh_h handle, + wifi_mesh_meshconf_info_h *meshconf) +{ + int rv = 0; + CHECK_FEATURE_SUPPORTED(MESH_FEATURE); + + if (NULL == handle || NULL == meshconf) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + rv = _wifi_mesh_get_meshconf_info(handle, meshconf); + return rv; +} + +EXPORT_API int wifi_mesh_destroy_meshconf_info( + wifi_mesh_meshconf_info_h meshconf) +{ + struct mesh_meshconf_dump_s *meshparam = meshconf; + CHECK_FEATURE_SUPPORTED(MESH_FEATURE); + + if (NULL == meshparam) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + g_free(meshparam); + return WIFI_MESH_ERROR_NONE; +} + +EXPORT_API int wifi_mesh_get_meshconf_retry_timeout( + wifi_mesh_meshconf_info_h meshconf, gushort *retry_timeout) +{ + int rv = WIFI_MESH_ERROR_NONE; + struct mesh_meshconf_dump_s *pdump = meshconf; + + CHECK_FEATURE_SUPPORTED(MESH_FEATURE); + + if (NULL == meshconf || NULL == retry_timeout) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + *retry_timeout = pdump->retry_timeout; + + return rv; +} + +EXPORT_API int wifi_mesh_get_meshconf_hwmp_max_preq_retries( + wifi_mesh_meshconf_info_h meshconf, + guchar *hwmp_max_preq_retries) +{ + int rv = WIFI_MESH_ERROR_NONE; + struct mesh_meshconf_dump_s *pdump = meshconf; + + CHECK_FEATURE_SUPPORTED(MESH_FEATURE); + + if (NULL == meshconf || NULL == hwmp_max_preq_retries) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + *hwmp_max_preq_retries = pdump->hwmp_max_preq_retries; + + return rv; +} + +EXPORT_API int wifi_mesh_get_meshconf_confirm_timeout( + wifi_mesh_meshconf_info_h meshconf, gushort *confirm_timeout) +{ + int rv = WIFI_MESH_ERROR_NONE; + struct mesh_meshconf_dump_s *pdump = meshconf; + + CHECK_FEATURE_SUPPORTED(MESH_FEATURE); + + if (NULL == meshconf || NULL == confirm_timeout) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + *confirm_timeout = pdump->confirm_timeout; + + return rv; +} + +EXPORT_API int wifi_mesh_get_meshconf_path_refresh_time( + wifi_mesh_meshconf_info_h meshconf, guint *path_refresh_time) +{ + int rv = WIFI_MESH_ERROR_NONE; + struct mesh_meshconf_dump_s *pdump = meshconf; + + CHECK_FEATURE_SUPPORTED(MESH_FEATURE); + + if (NULL == meshconf || NULL == path_refresh_time) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + *path_refresh_time = pdump->path_refresh_time; + + return rv; +} + +EXPORT_API int wifi_mesh_get_meshconf_holding_timeout( + wifi_mesh_meshconf_info_h meshconf, gushort *holding_timeout) +{ + int rv = WIFI_MESH_ERROR_NONE; + struct mesh_meshconf_dump_s *pdump = meshconf; + + CHECK_FEATURE_SUPPORTED(MESH_FEATURE); + + if (NULL == meshconf || NULL == holding_timeout) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + *holding_timeout = pdump->holding_timeout; + + return rv; +} + +EXPORT_API int wifi_mesh_get_meshconf_min_disc_timeout( + wifi_mesh_meshconf_info_h meshconf, gushort *min_disc_timeout) +{ + int rv = WIFI_MESH_ERROR_NONE; + struct mesh_meshconf_dump_s *pdump = meshconf; + + CHECK_FEATURE_SUPPORTED(MESH_FEATURE); + + if (NULL == meshconf || NULL == min_disc_timeout) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + *min_disc_timeout = pdump->min_disc_timeout; + + return rv; +} + +EXPORT_API int wifi_mesh_get_meshconf_max_peer_links( + wifi_mesh_meshconf_info_h meshconf, gushort *max_peer_links) +{ + int rv = WIFI_MESH_ERROR_NONE; + struct mesh_meshconf_dump_s *pdump = meshconf; + + CHECK_FEATURE_SUPPORTED(MESH_FEATURE); + + if (NULL == meshconf || NULL == max_peer_links) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + *max_peer_links = pdump->max_peer_links; + + return rv; +} + +EXPORT_API int wifi_mesh_get_meshconf_hwmp_preq_min_interval( + wifi_mesh_meshconf_info_h meshconf, + gushort *hwmp_preq_min_interval) +{ + int rv = WIFI_MESH_ERROR_NONE; + struct mesh_meshconf_dump_s *pdump = meshconf; + + CHECK_FEATURE_SUPPORTED(MESH_FEATURE); + + if (NULL == meshconf || NULL == hwmp_preq_min_interval) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + *hwmp_preq_min_interval = pdump->hwmp_preq_min_interval; + + return rv; +} + +EXPORT_API int wifi_mesh_get_meshconf_ttl( + wifi_mesh_meshconf_info_h meshconf, guchar *ttl) +{ + int rv = WIFI_MESH_ERROR_NONE; + struct mesh_meshconf_dump_s *pdump = meshconf; + + CHECK_FEATURE_SUPPORTED(MESH_FEATURE); + + if (NULL == meshconf || NULL == ttl) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + *ttl = pdump->ttl; + + return rv; +} + +EXPORT_API int wifi_mesh_get_meshconf_hwmp_active_path_timeout( + wifi_mesh_meshconf_info_h meshconf, + guint *hwmp_active_path_timeout) +{ + int rv = WIFI_MESH_ERROR_NONE; + struct mesh_meshconf_dump_s *pdump = meshconf; + + CHECK_FEATURE_SUPPORTED(MESH_FEATURE); + + if (NULL == meshconf || NULL == hwmp_active_path_timeout) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + *hwmp_active_path_timeout = pdump->hwmp_active_path_timeout; + + return rv; +} + +EXPORT_API int wifi_mesh_get_meshconf_element_ttl( + wifi_mesh_meshconf_info_h meshconf, guchar *element_ttl) +{ + int rv = WIFI_MESH_ERROR_NONE; + struct mesh_meshconf_dump_s *pdump = meshconf; + + CHECK_FEATURE_SUPPORTED(MESH_FEATURE); + + if (NULL == meshconf || NULL == element_ttl) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + *element_ttl = pdump->element_ttl; + + return rv; +} + +EXPORT_API int wifi_mesh_get_meshconf_hwmp_rann_interval( + wifi_mesh_meshconf_info_h meshconf, gushort *hwmp_rann_interval) +{ + int rv = WIFI_MESH_ERROR_NONE; + struct mesh_meshconf_dump_s *pdump = meshconf; + + CHECK_FEATURE_SUPPORTED(MESH_FEATURE); + + if (NULL == meshconf || NULL == hwmp_rann_interval) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + *hwmp_rann_interval = pdump->hwmp_rann_interval; + + return rv; +} diff --git a/test/wifi-mesh-network.c b/test/wifi-mesh-network.c index 3faf3bb..6d1c33d 100644 --- a/test/wifi-mesh-network.c +++ b/test/wifi-mesh-network.c @@ -802,6 +802,89 @@ static int run_get_mpath_information(MManager *mm, struct menu_data *menu) return RET_SUCCESS; } + +static int run_get_meshconf_information(MManager *mm, struct menu_data *menu) +{ + int ret; + wifi_mesh_meshconf_info_h meshconf; + gushort retry_timeout; /**< Retry Timeout */ + guchar hwmp_max_preq_retries; /**< HWMP Max Preq Retries */ + gushort confirm_timeout; /**< Confirm Timeout */ + guint path_refresh_time; /**< Path Refresh Time */ + gushort holding_timeout; /**< Holding Timeout */ + gushort min_disc_timeout; /**< Min Discovery Timeout */ + gushort max_peer_links; /**< Max Peer Links */ + gushort hwmp_preq_min_interval; /**< HWMP PREQ Min Interval */ + guchar ttl; /**< TTL */ + guint hwmp_active_path_timeout; /**< HWMP Active Path Timeout */ + guchar element_ttl; /**< Element TTL */ + gushort hwmp_rann_interval; /**< HWMP RANN Interval */ + msg("Get Mesh Conf Information"); + + g_idx = 1; + + ret = wifi_mesh_get_meshconf_info(mesh, &meshconf); + if (WIFI_MESH_ERROR_NONE != ret) { + msgr("Failed to wifi_mesh_get_meshconf_info: [%s(0x%X)]", + wifi_mesh_error_to_string(ret), ret); + return RET_FAILURE; + } + + msg("Mesh Configuration Informations:"); + + ret = wifi_mesh_get_meshconf_retry_timeout(meshconf, &retry_timeout); + if (WIFI_MESH_ERROR_NONE == ret) + msg("retry_timeout = %u", retry_timeout); + ret = wifi_mesh_get_meshconf_hwmp_max_preq_retries(meshconf, + &hwmp_max_preq_retries); + if (WIFI_MESH_ERROR_NONE == ret) + msg("hwmp_max_preq_retries = %u", hwmp_max_preq_retries); + ret = wifi_mesh_get_meshconf_confirm_timeout(meshconf, &confirm_timeout); + if (WIFI_MESH_ERROR_NONE == ret) + msg("confirm_timeout = %u", confirm_timeout); + ret = wifi_mesh_get_meshconf_path_refresh_time(meshconf, + &path_refresh_time); + if (WIFI_MESH_ERROR_NONE == ret) + msg("path_refresh_time = %u", path_refresh_time); + ret = wifi_mesh_get_meshconf_holding_timeout(meshconf, &holding_timeout); + if (WIFI_MESH_ERROR_NONE == ret) + msg("holding_timeout = %u", holding_timeout); + ret = wifi_mesh_get_meshconf_min_disc_timeout(meshconf, &min_disc_timeout); + if (WIFI_MESH_ERROR_NONE == ret) + msg("min_disc_timeout = %u", min_disc_timeout); + ret = wifi_mesh_get_meshconf_max_peer_links(meshconf, &max_peer_links); + if (WIFI_MESH_ERROR_NONE == ret) + msg("max_peer_links = %u", max_peer_links); + ret = wifi_mesh_get_meshconf_hwmp_preq_min_interval(meshconf, + &hwmp_preq_min_interval); + if (WIFI_MESH_ERROR_NONE == ret) + msg("hwmp_preq_min_interval = %u", hwmp_preq_min_interval); + ret = wifi_mesh_get_meshconf_ttl(meshconf, &ttl); + if (WIFI_MESH_ERROR_NONE == ret) + msg("ttl = %u", ttl); + ret = wifi_mesh_get_meshconf_hwmp_active_path_timeout(meshconf, + &hwmp_active_path_timeout); + if (WIFI_MESH_ERROR_NONE == ret) + msg("hwmp_active_path_timeout = %u", hwmp_active_path_timeout); + ret = wifi_mesh_get_meshconf_element_ttl(meshconf, &element_ttl); + if (WIFI_MESH_ERROR_NONE == ret) + msg("element_ttl = %u", element_ttl); + ret = wifi_mesh_get_meshconf_hwmp_rann_interval(meshconf, + &hwmp_rann_interval); + if (WIFI_MESH_ERROR_NONE == ret) + msg("hwmp_rann_interval = %u", hwmp_rann_interval); + + ret = wifi_mesh_destroy_meshconf_info(meshconf); + if (WIFI_MESH_ERROR_NONE != ret) { + msgr("Failed to wifi_mesh_destroy_meshconf_info: [%s(0x%X)]", + wifi_mesh_error_to_string(ret), ret); + return RET_FAILURE; + } + msg("Successfully destroyed meshconf info"); + + return RET_SUCCESS; +} + static struct menu_data menu_specific_scan[] = { { "1", "Mesh ID", NULL, NULL, meshid }, { "2", "Channel", NULL, NULL, mesh_channel }, @@ -881,5 +964,7 @@ struct menu_data menu_mesh_network[] = { { "17", "Unset gate", NULL, run_unset_gate, NULL }, { "18", "Get mesh station information", NULL, run_get_station_information, NULL }, { "19", "Get mesh path information", NULL, run_get_mpath_information, NULL }, + { "20", "Get mesh conf information", NULL, run_get_meshconf_information, + NULL }, { NULL, NULL, }, }; -- 2.34.1