commit d1a8e191e92f5d07e127b3607eea8d4f5e412c59
parent bbad6b4ec91a78fc8fc7726a489a4b2aa4dc6198
Author: Tim Kourt <tim.a.kourt@linux.intel.com>
Date: Tue, 10 Jul 2018 15:46:55 -0700
network: introduce connect API for the hidden nets
Diffstat:
2 files changed, 40 insertions(+), 0 deletions(-)
diff --git a/src/network.c b/src/network.c
@@ -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,
diff --git a/src/network.h b/src/network.h
@@ -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;