#define IPV4_MAX_LENGTH 16
#define BUF_LENGTH 256
+#define MESH_DEFAULT_BASE_INTERFACE "wlan0"
+#define MESH_DEFAULT_MESH_INTERFACE "mesh0"
+#define MESH_DEFAULT_BRIDGE_INTERFACE "br0"
+#define MESH_DEFAULT_EXTERNAL_INTERFACE "eth0"
+#define MESH_DEFAULT_SOFTAP_INTERFACE "wlan1"
+
typedef enum {
ETHERNET_CABLE_DETACHED = 0,
ETHERNET_CABLE_ATTACHED
return MESHD_ERROR_NONE;
}
+#if 0
/* Returns interface name in sequence order which is exists */
static char* _get_interface_exists_in_seq(const char* prefix)
{
return res;
}
+#endif
/* Returns interface name in sequence order which is exists */
static bool _check_interface_exists(const char* if_name)
int mesh_interface_initialize(mesh_interface_s *info)
{
- info->bridge_interface = _get_interface_not_exists_in_seq("br");
+ if (NULL == info) {
+ MESH_LOGE("Invalid parameter");
+ return MESHD_ERROR_INVALID_PARAMETER;
+ }
+
+ info->bridge_interface = g_strdup(MESH_DEFAULT_BRIDGE_INTERFACE);
if (NULL == info->bridge_interface) {
MESH_LOGE("Failed to get bridge interface !");
return MESHD_ERROR_OPERATION_FAILED;
}
- info->base_interface = _get_interface_exists_in_seq("wlan");
+ info->base_interface = g_strdup(MESH_DEFAULT_BASE_INTERFACE);
if (NULL == info->bridge_interface) {
MESH_LOGE("Failed to get base interface !");
return MESHD_ERROR_OPERATION_FAILED;
}
- info->mesh_interface = _get_interface_not_exists_in_seq("mesh");
+ info->mesh_interface = g_strdup(MESH_DEFAULT_MESH_INTERFACE);
if (NULL == info->bridge_interface) {
MESH_LOGE("Failed to get mesh interface !");
return MESHD_ERROR_OPERATION_FAILED;
}
- info->softap_interface = g_strdup("wlan1"); /* CHECK: interface changed */
- info->external_interface = _get_interface_exists_in_seq("eth");
- info->mesh_id = g_strdup("meshnet");
- if (NULL == info->bridge_interface) {
- MESH_LOGE("Failed to get mesh id !");
- return MESHD_ERROR_OPERATION_FAILED;
- }
- info->mesh_channel = 7;
+ info->softap_interface = g_strdup(MESH_DEFAULT_SOFTAP_INTERFACE);
+ info->external_interface = g_strdup(MESH_DEFAULT_EXTERNAL_INTERFACE);
+
+ MESH_LOGD("Interface configuration for mesh network :");
+ MESH_LOGD(" Base : [%s]", info->base_interface);
+ MESH_LOGD(" Mesh : [%s]", info->mesh_interface);
+ MESH_LOGD(" Bridge : [%s]", info->bridge_interface);
+ MESH_LOGD(" SoftAP : [%s]", info->softap_interface);
+ MESH_LOGD(" External: [%s]", info->external_interface);
return MESHD_ERROR_NONE;
}