network: introduce connect API for the hidden nets

This commit is contained in:
Tim Kourt 2018-07-10 15:46:55 -07:00 committed by Denis Kenzior
parent bbad6b4ec9
commit d1a8e191e9
2 changed files with 40 additions and 0 deletions

View File

@ -987,6 +987,43 @@ static struct l_dbus_message *network_connect(struct l_dbus *dbus,
}
}
void network_connect_new_hidden_network(struct network *network,
struct l_dbus_message *message)
{
struct device *device = network->device;
struct scan_bss *bss;
struct l_dbus_message *error;
l_debug("");
bss = network_bss_select(network);
if (!bss) {
/* This should never happened for the hidden networks. */
error = dbus_error_not_supported(message);
goto reply_error;
}
switch (network_get_security(network)) {
case SECURITY_PSK:
error = network_connect_psk(network, bss, message);
break;
case SECURITY_NONE:
device_connect_network(device, network, bss, message);
return;
default:
error = dbus_error_not_supported(message);
break;
}
if (error)
goto reply_error;
return;
reply_error:
dbus_pending_reply(&message, error);
}
static bool network_property_get_name(struct l_dbus *dbus,
struct l_dbus_message *message,
struct l_dbus_message_builder *builder,

View File

@ -63,6 +63,9 @@ void network_remove(struct network *network, int reason);
int network_rank_compare(const void *a, const void *b, void *user);
void network_rank_update(struct network *network);
void network_connect_new_hidden_network(struct network *network,
struct l_dbus_message *message);
struct network_info {
char ssid[33];
enum security type;