THREAD_CHECK_INIT_STATUS();
THREAD_VALIDATE_INPUT_PARAMETER(instance);
THREAD_VALIDATE_INPUT_PARAMETER(joiner_passphrase);
+ THREAD_VALIDATE_INPUT_PARAMETER(joiner_uuid);
+ int ret = THREAD_ERROR_NONE;
int joiner_passphrase_len = strlen(joiner_passphrase);
- if (!joiner_uuid || !strcmp(joiner_uuid, ""))
+ if (strcmp(joiner_uuid, "") == 0)
joiner_uuid = "*";
-
int joiner_uuid_len = strlen(joiner_uuid);
retv_if(joiner_passphrase_len < 6 || joiner_passphrase_len > 32, THREAD_ERROR_INVALID_PARAMETER);
retv_if(joiner_uuid_len > 16, THREAD_ERROR_INVALID_PARAMETER);
- int ret = THREAD_ERROR_NONE;
-
char msg[THREAD_COMMISSIONER_JOINER_BUFFER_MAX];
snprintf(msg, THREAD_COMMISSIONER_JOINER_BUFFER_MAX,
"commissioner joiner add %s %s", joiner_uuid, joiner_passphrase);
retv_if(event_data == NULL, THREAD_ERROR_OUT_OF_MEMORY);
event_data->event_name = g_strdup(event_name);
- retv_if(event_data->event_name == NULL, THREAD_ERROR_OUT_OF_MEMORY);
+ if (event_data->event_name == NULL) {
+ THREAD_DBG("Event Name is NULL");
+ g_free(event_data);
+ return THREAD_ERROR_OUT_OF_MEMORY;
+ }
/* Register event */
event_data->event_id = g_dbus_connection_signal_subscribe(g_system_connection,
}
new_network->is_network_active = FALSE;
- g_strlcpy(new_network->name, name, THREAD_NETWORK_NAME_MAX + 1);
- g_strlcpy(new_network->key, key, THREAD_NETWORK_KEY_STRING_MAX + 1);
- g_strlcpy(new_network->pskc, pskc, THREAD_NETWORK_PSKC_STRING_MAX + 1);
+ (void)g_strlcpy(new_network->name, name, THREAD_NETWORK_NAME_MAX + 1);
+ (void)g_strlcpy(new_network->key, key, THREAD_NETWORK_KEY_STRING_MAX + 1);
+ (void)g_strlcpy(new_network->pskc, pskc, THREAD_NETWORK_PSKC_STRING_MAX + 1);
new_network->channel = channel;
new_network->extended_panid = extended_panid;
new_network->panid = panid;
} while (0)
#define MENU_DATA_SIZE 255
-
+#define NETWORK_DATA_SIZE 256
/*
* Horizontal Line - width: 65
* .12345678901234567890123456789012345678901234567890.
#include "thread-log.h"
#include "thread-util.h"
-static char g_name[MENU_DATA_SIZE + 1] = {"Thread-test"};
-static char g_key[MENU_DATA_SIZE + 1];
-static char g_pskc[MENU_DATA_SIZE + 1];
-static char g_str_channel[MENU_DATA_SIZE + 1] = {"07fff800"};
-static char g_str_extended_panid[MENU_DATA_SIZE + 1] = {"18446744073709551615"}; /* UINT64_MAX */
-static char g_str_panid[MENU_DATA_SIZE + 1] = {"65535"}; /* UINT16_MAX */
-static char g_str_buf_length[MENU_DATA_SIZE + 1];
-static char g_str_tlvs_buffer[MENU_DATA_SIZE + 1];
+static char g_name[NETWORK_DATA_SIZE + 1] = {"Thread-test"};
+static char g_key[NETWORK_DATA_SIZE + 1];
+static char g_pskc[NETWORK_DATA_SIZE + 1];
+static char g_str_channel[NETWORK_DATA_SIZE + 1] = {"07fff800"};
+static char g_str_extended_panid[NETWORK_DATA_SIZE + 1] = {"18446744073709551615"}; /* UINT64_MAX */
+static char g_str_panid[NETWORK_DATA_SIZE + 1] = {"65535"}; /* UINT16_MAX */
+static char g_str_buf_length[NETWORK_DATA_SIZE + 1];
+static char g_str_tlvs_buffer[2*NETWORK_DATA_SIZE + 1];
static thread_network_h g_network;
uint32_t g_channel;
uint64_t g_extended_panid;
uint16_t g_panid;
-static char g_str_ipaddr_type[MENU_DATA_SIZE + 1] = "0";
-static char g_str_ipaddr[MENU_DATA_SIZE + 1];
+static char g_str_ipaddr_type[NETWORK_DATA_SIZE + 1] = "0";
+static char g_str_ipaddr[NETWORK_DATA_SIZE + 1];
uint8_t g_ipv6_address[THREAD_IPV6_ADDRESS_SIZE];
static int run_thread_network_get_active_dataset_tlvs(MManager *mm, struct menu_data *menu)
{
FUNC_ENTRY;
+
+ uint8_t *tlvs_buffer = NULL;
+ char buf[1024];
+ int buf_length;
+
thread_instance_h g_instance = mm->t_instance;
if (g_instance == NULL)
goto OUT;
- int buf_length;
- uint8_t *tlvs_buffer;
- char buf[1024];
-
int ret = thread_network_get_active_dataset_tlvs(g_instance, &tlvs_buffer, &buf_length);
if (ret == THREAD_ERROR_NONE) {
msg("thread_network_get_active_dataset_tlvs success");
snprintf(buf + i*2, 3, "%2.2x", tlvs_buffer[i]);
msg("Active dataset tlvs size: %d :: %s", buf_length, buf);
- free(tlvs_buffer);
} else {
msg("thread_network_get_active_dataset_tlvs failed");
}
OUT:
+ if (tlvs_buffer)
+ free(tlvs_buffer);
+
FUNC_EXIT;
return RET_SUCCESS;
}
#include "thread-log.h"
#include "thread-util.h"
-static char g_name[MENU_DATA_SIZE + 1] = {"Thread-test"};
-static char g_key[MENU_DATA_SIZE + 1];
-static char g_pskc[MENU_DATA_SIZE + 1];
-static char g_str_channel[MENU_DATA_SIZE + 1] = {"07fff800"};
-static char g_str_extended_panid[MENU_DATA_SIZE + 1] = {"18446744073709551615"}; /* UINT64_MAX */
-static char g_str_panid[MENU_DATA_SIZE + 1] = {"65535"}; /* UINT16_MAX */
+static char g_name[NETWORK_DATA_SIZE + 1] = {"Thread-test"};
+static char g_key[NETWORK_DATA_SIZE + 1];
+static char g_pskc[NETWORK_DATA_SIZE + 1];
+static char g_str_channel[NETWORK_DATA_SIZE + 1] = {"07fff800"};
+static char g_str_extended_panid[NETWORK_DATA_SIZE + 1] = {"18446744073709551615"}; /* UINT64_MAX */
+static char g_str_panid[NETWORK_DATA_SIZE + 1] = {"65535"}; /* UINT16_MAX */
static thread_network_h g_network;
static char g_joiner_uuid[MENU_DATA_SIZE + 1];
int ret = THREAD_ERROR_NONE;
msg(" ### thread_scenario_cleanup ###");
- thread_instance_h *g_instance = &(mm->t_instance);
+ thread_instance_h g_instance = mm->t_instance;
/* thread disable */
ret = thread_disable(g_instance);