Commit 1bc10b1a authored by Lorn Potter's avatar Lorn Potter

Squashed 'connman/' changes from 97c3189..f5a441e

f5a441e Release 1.23
c9a72ea technology: Do not refcount P2P technology as it is dependent on WiFi
2bc0c67 gsupplicant: Output a relevant warning about P2P support
85f9600 dhcp: Network hash table fixes
9080023 dhcp: Fix memory leak
354da04 main: DHCP cleanup done too early
aef3021 dhcp: Indentation fixes
484a4e5 vpn-plugin: Possible memory leak when getting DNS results
cb506fd client: Print out associating, configuration and disconnect states
b5c0678 client: Add support to print out one specific peer
5dda549 peer: Add and implement support for GetProperties method
88a8492 client: Add basic support for P2P peers
3f3bdb6 wifi: Handle gsupplicant peer event and link it with the core logic
c04bf32 peer: Add the logic for signaling PeersChanged()
2e10a77 service: Use the D-Bus helper to add an object path array
284601d dbus: Factor out a useful function for changed objects
1a3b1a1 manager: Extend the API with P2P peers related method and signal
4f1b1cf peer: Add necessary functions to get the properties through D-Bus
a27d206 peer: Add basic core logic for P2P peer objects
74d31df gsupplicant: Add logic handling events/properties related to P2P peers
d5bf228 wifi: Handle P2P find when P2P service type is given to scan
3606e87 device: Provide the service type to the scanning method
1869cfe gsupplicant: Add function to start/stop P2P discovery process
f1fdded wifi: Register and unregister the P2P technology if present
4ef3ab7 gsupplicant: Add a mechanism to know whether P2P is supported or not
e1dea86 technology: Explicitely set the technology that started the scan.
7511037 technology: Handle enabling/disabling of P2P technology
d6e0d65 technology: Move Powered related functions up
9e463b4 technology: Add P2P technology support
16b8ddf technology: Move down dbus registration related functions
0b0c5a7 technology: Check if a driver exists already before registration
c492e98 src: Add a new service type for P2P
34c450c doc: Add an overview documentation about WiFi P2P in ConnMan
f3fcffd AUTHORS: Mention Eric's contributions
3a48ea4 ofono: Test if IP address is NULL only for fixed method.
2b2a273 vpn: Clean up STATEDIR usage
e3e7454 device: Remove unused function
b318e7f plugins: Remove gadget network when enabling tethering
8203a60 bluetooth: Create and remove PAN networks also on adapter change
4cf9fef AUTHORS: Mention Guoqiang's contributions
e268668 tethering: Fix issue where tether bridge may not be destroyed
28d2afc tethering: Remove IPv6PD and DNS proxy after disabling tethering
1193448 gdhcp: Restart DHCP before calling callback
2f2168c ofono: Possible memory leak when setting IPv6 name servers
0a11d61 ofono: Possible memory leak when setting IPv4 name servers
52c9a8b ofono: IPv4 index was set too late if method is set to DHCP
31c8b20 ofono: Do not break loop too early if IPv4 method is dhcp
29c8e6b service: Don't force a service to idle state
a7fb517 service: Clear up error path when connecting a service
e89d4ab service: Clear up connect logic when called from D-Bus
3bbc03d network: A network is disconnected except on -EINPROGRESS
fc72d74 dhcp: Release dhcp structure before freeing it
0f831a5 connection: Remove VPN host route
f433e48 gdbus: Add g_dbus_proxy_set_property_array
1a8bb0e bluetooth: Do not derefernce NULL pointer
ea13db4 device: Remove unused function
f2cfe6f technology: Fix a possible memory leak and cleanup
5b03364 doc: Fix a typo on error description for GetPeers() method
7802fdc rtnl: Process ipconfig dellink for ARPHDR_PHONET_PIPE and ARPHRD_PPP
53967fe plugins: Ethernet interface is already down after disabling tethering
fa3ab75 plugins: Remove etherent network when enabling tethering
8198bb4 AUTHORS: Mention Eduardo's contributions
ff015ea test: Fix typo in p2p-on-supplicant p2p_service_flush
95e2ca2 plugins: Check that bluetooth devices exist before setting tethering
030b071 service: Disconnect service always when other service is connecting
deed805 client: Don't call readline when in non-interactive mode
1bb60b3 service: Add autoconnect getter helper function
8525485 session: Add connect/disconnect services
e3f7d44 session: Add policy plugin allowed callback
ad2a5df session: Add policy session_changed callback
4e37c67 session: Add set_active_session() helper
15b4d3c session: On session connect check service is already available
9e54614 doc: Missing PeersChanged description information added
962702b vpn: Update copyright year(s)
4227ca7 src: Update copyright year(s)
39ab56c scripts: Update copyright year(s)
5070dca plugins: Update copyright year(s)
9320330 include: Update copyright year(s)
c41bfb9 gweb: Update copyright year(s)
159f9d2 gsupplicant: Update copyright year(s)
819b831 gdhcp: Update copyright year(s)
a84af9e client: Update copyright year(s)

git-subtree-dir: connman
git-subtree-split: f5a441e9d636eefd98335322e79e71ca7e4f55cc
parent c447d841
......@@ -71,3 +71,6 @@ Glenn Schmottlach <Glenn.Schmottlach@xs-embedded.com>
Jonathan Liu <net147@gmail.com>
Andrew LeCain <electricalpanel@gmail.com>
Maneesh Jain <maneesh.jain@samsung.com>
Eduardo Abinader <eduardo.abinader@openbossa.org>
Guoqiang Liu <guoqiang.liu@archermind.com>
Eric Bouxirot <eric.bouxirot@azimut-monitoring.com>
ver 1.23:
Fix issue with memory leak in technology handling.
Fix issue with not removing host route of OpenVPN.
Fix issue with double free in DHCP cleanup handling.
Fix issue with handling DHCP method from oFono.
Fix issue with IPv6-PD when disabling tethering.
Fix issue with DNS proxy when disabling tethering.
Fix issue with Bluetooth start and stop interaction.
Fix issue with Bluetooth PAN networks on adapter change.
ver 1.22:
Fix issue with WPS state synchronization.
Fix issue with DNS servers and default service.
......
......@@ -11,7 +11,7 @@ include_HEADERS = include/log.h include/plugin.h \
include/device.h include/network.h include/inet.h \
include/storage.h include/provision.h \
include/session.h include/ipaddress.h include/agent.h \
include/inotify.h
include/inotify.h include/peer.h
nodist_include_HEADERS = include/version.h
......@@ -105,7 +105,7 @@ src_connmand_SOURCES = $(gdhcp_sources) $(gweb_sources) \
src/session.c src/tethering.c src/wpad.c src/wispr.c \
src/stats.c src/iptables.c src/dnsproxy.c src/6to4.c \
src/ippool.c src/bridge.c src/nat.c src/ipaddress.c \
src/inotify.c src/firewall.c src/ipv6pd.c
src/inotify.c src/firewall.c src/ipv6pd.c src/peer.c
src_connmand_LDADD = gdbus/libgdbus-internal.la $(builtin_libadd) \
@GLIB_LIBS@ @DBUS_LIBS@ @XTABLES_LIBS@ @GNUTLS_LIBS@ \
......@@ -153,6 +153,7 @@ endif
CLEANFILES = src/connman.conf $(BUILT_SOURCES)
statedir = $(localstatedir)/run/connman
vpn_statedir = $(localstatedir)/run/connman-vpn
if VPN
vpn_plugindir = $(libdir)/connman/plugins-vpn
......@@ -185,6 +186,7 @@ AM_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ @XTABLES_CFLAGS@ \
@GNUTLS_CFLAGS@ $(builtin_cflags) \
-DCONNMAN_PLUGIN_BUILTIN \
-DSTATEDIR=\""$(statedir)"\" \
-DVPN_STATEDIR=\""$(vpn_statedir)"\" \
-DPLUGINDIR=\""$(build_plugindir)"\" \
-DSCRIPTDIR=\""$(build_scriptdir)"\" \
-DSTORAGEDIR=\""$(storagedir)\"" \
......@@ -215,7 +217,7 @@ if VPN
vpn_connman_vpnd_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ \
$(builtin_vpn_cflags) \
-DCONNMAN_PLUGIN_BUILTIN \
-DSTATEDIR=\""$(statedir)"\" \
-DVPN_STATEDIR=\""$(vpn_statedir)"\" \
-DPLUGINDIR=\""$(build_vpn_plugindir)"\" \
-DSCRIPTDIR=\""$(build_scriptdir)"\" \
-DSTORAGEDIR=\""$(storagedir)\"" \
......@@ -243,6 +245,7 @@ client_connmanctl_SOURCES = client/dbus_helpers.h client/dbus_helpers.c \
client/commands.h client/commands.c \
client/input.h client/input.c \
client/agent.h client/agent.c \
client/peers.h client/peers.c \
client/vpnconnections.h client/vpnconnections.c \
client/main.c
......
......@@ -75,7 +75,7 @@ vpn_plugins_openconnect_la_SOURCES = vpn/plugins/vpn.h vpn/plugins/vpn.c \
vpn/plugins/openconnect.c
vpn_plugins_openconnect_la_CFLAGS = $(plugin_cflags) \
-DOPENCONNECT=\"@OPENCONNECT@\" \
-DSTATEDIR=\""$(statedir)"\" \
-DVPN_STATEDIR=\""$(vpn_statedir)"\" \
-DSCRIPTDIR=\""$(build_scriptdir)"\"
vpn_plugins_openconnect_la_LDFLAGS = $(plugin_ldflags)
endif
......@@ -93,7 +93,7 @@ vpn_plugin_objects += $(plugins_openvpn_la_OBJECTS)
vpn_plugins_openvpn_la_SOURCES = vpn/plugins/vpn.h vpn/plugins/vpn.c \
vpn/plugins/openvpn.c
vpn_plugins_openvpn_la_CFLAGS = $(plugin_cflags) -DOPENVPN=\"@OPENVPN@\" \
-DSTATEDIR=\""$(statedir)"\" \
-DVPN_STATEDIR=\""$(vpn_statedir)"\" \
-DSCRIPTDIR=\""$(build_scriptdir)"\"
vpn_plugins_openvpn_la_LDFLAGS = $(plugin_ldflags)
endif
......@@ -111,7 +111,7 @@ vpn_plugin_objects += $(plugins_vpnc_la_OBJECTS)
vpn_plugins_vpnc_la_SOURCES = vpn/plugins/vpn.h vpn/plugins/vpn.c \
vpn/plugins/vpnc.c
vpn_plugins_vpnc_la_CFLAGS = $(plugin_cflags) -DVPNC=\"@VPNC@\" \
-DSTATEDIR=\""$(statedir)"\" \
-DVPN_STATEDIR=\""$(vpn_statedir)"\" \
-DSCRIPTDIR=\""$(build_scriptdir)"\"
vpn_plugins_vpnc_la_LDFLAGS = $(plugin_ldflags)
endif
......@@ -129,7 +129,7 @@ vpn_plugin_objects += $(plugins_l2tp_la_OBJECTS)
vpn_plugins_l2tp_la_SOURCES = vpn/plugins/vpn.h vpn/plugins/vpn.c \
vpn/plugins/l2tp.c
vpn_plugins_l2tp_la_CFLAGS = $(plugin_cflags) -DL2TP=\"@L2TP@\" \
-DSTATEDIR=\""$(statedir)"\" \
-DVPN_STATEDIR=\""$(vpn_statedir)"\" \
-DSCRIPTDIR=\""$(build_scriptdir)"\"
vpn_plugins_l2tp_la_LDFLAGS = $(plugin_ldflags)
endif
......@@ -148,7 +148,7 @@ vpn_plugins_pptp_la_SOURCES = vpn/plugins/vpn.h vpn/plugins/vpn.c \
vpn/plugins/pptp.c
vpn_plugins_pptp_la_CFLAGS = $(plugin_cflags) -DPPPD=\"@PPPD@\" \
-DPPTP=\"@PPTP@\" \
-DSTATEDIR=\""$(statedir)"\" \
-DVPN_STATEDIR=\""$(vpn_statedir)"\" \
-DSCRIPTDIR=\""$(build_scriptdir)"\"
vpn_plugins_pptp_la_LDFLAGS = $(plugin_ldflags)
endif
......
......@@ -2,7 +2,7 @@
*
* Connection Manager
*
* Copyright (C) 2012-2013 Intel Corporation. All rights reserved.
* Copyright (C) 2012-2014 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -38,12 +38,14 @@
#include "dbus_helpers.h"
#include "input.h"
#include "services.h"
#include "peers.h"
#include "commands.h"
#include "agent.h"
#include "vpnconnections.h"
static DBusConnection *connection;
static GHashTable *service_hash;
static GHashTable *peer_hash;
static GHashTable *technology_hash;
static char *session_notify_path;
static char *session_path;
......@@ -275,8 +277,20 @@ static int services_list(DBusMessageIter *iter, const char *error,
return 0;
}
static int services_properties(DBusMessageIter *iter, const char *error,
void *user_data)
static int peers_list(DBusMessageIter *iter,
const char *error, void *user_data)
{
if (!error) {
__connmanctl_peers_list(iter);
fprintf(stdout, "\n");
} else
fprintf(stderr, "Error: %s\n", error);
return 0;
}
static int object_properties(DBusMessageIter *iter,
const char *error, void *user_data)
{
char *path = user_data;
char *str;
......@@ -343,7 +357,34 @@ static int cmd_services(char *args[], int num, struct connman_option *options)
path = g_strdup_printf("/net/connman/service/%s", service_name);
return __connmanctl_dbus_method_call(connection, CONNMAN_SERVICE, path,
"net.connman.Service", "GetProperties",
services_properties, path, NULL, NULL);
object_properties, path, NULL, NULL);
}
static int cmd_peers(char *args[], int num, struct connman_option *options)
{
char *peer_name = NULL;
char *path;
if (num > 2)
return -E2BIG;
if (num == 2)
peer_name = args[1];
if (!peer_name) {
return __connmanctl_dbus_method_call(connection,
CONNMAN_SERVICE, CONNMAN_PATH,
"net.connman.Manager", "GetPeers",
peers_list, NULL, NULL, NULL);
}
if (check_dbus_name(peer_name) == false)
return -EINVAL;
path = g_strdup_printf("/net/connman/peer/%s", peer_name);
return __connmanctl_dbus_method_call(connection, CONNMAN_SERVICE,
path, "net.connman.Peer", "GetProperties",
object_properties, path, NULL, NULL);
}
static int technology_print(DBusMessageIter *iter, const char *error,
......@@ -1054,10 +1095,18 @@ static DBusHandlerResult monitor_changed(DBusConnection *connection,
__connmanctl_redraw_rl();
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
} else if (dbus_message_is_signal(message, "net.connman.Manager",
"PeersChanged")) {
fprintf(stdout, "%-12s %-20s = {\n", interface,
"PeersChanged");
dbus_message_iter_init(message, &iter);
__connmanctl_peers_list(&iter);
fprintf(stdout, "\n}\n");
__connmanctl_redraw_rl();
if (dbus_message_is_signal(message, "net.connman.vpn.Manager",
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
} else if (dbus_message_is_signal(message, "net.connman.vpn.Manager",
"ConnectionAdded") ||
dbus_message_is_signal(message,
"net.connman.vpn.Manager",
......@@ -1259,6 +1308,12 @@ static int cmd_monitor(char *args[], int num, struct connman_option *options)
static int cmd_agent(char *args[], int num, struct connman_option *options)
{
if (!__connmanctl_is_interactive()) {
fprintf(stderr, "Error: Not supported in non-interactive "
"mode\n");
return 0;
}
if (num > 2)
return -E2BIG;
......@@ -1355,6 +1410,12 @@ static int cmd_vpnconnections(char *args[], int num,
static int cmd_vpnagent(char *args[], int num, struct connman_option *options)
{
if (!__connmanctl_is_interactive()) {
fprintf(stderr, "Error: Not supported in non-interactive "
"mode\n");
return 0;
}
if (num > 2)
return -E2BIG;
......@@ -1795,6 +1856,36 @@ static char *lookup_service_arg(const char *text, int state)
return lookup_service(text, state);
}
static char *lookup_peer(const char *text, int state)
{
static GHashTableIter iter;
gpointer key, value;
static int len = 0;
if (state == 0) {
g_hash_table_iter_init(&iter, peer_hash);
len = strlen(text);
}
while (g_hash_table_iter_next(&iter, &key, &value)) {
const char *peer = key;
if (strncmp(text, peer, len) == 0)
return strdup(peer);
}
return NULL;
}
static char *lookup_peer_arg(const char *text, int state)
{
if (__connmanctl_input_calc_level() > 1) {
__connmanctl_input_lookup_end();
return NULL;
}
return lookup_peer(text, state);
}
static char *lookup_technology(const char *text, int state)
{
static int len = 0;
......@@ -2019,6 +2110,8 @@ static const struct {
lookup_tether },
{ "services", "[<service>]", service_options, cmd_services,
"Display services", lookup_service_arg },
{ "peers", "[peer]", NULL, cmd_peers,
"Display peers", lookup_peer_arg },
{ "scan", "<technology>", NULL, cmd_scan,
"Scans for new services for given technology",
lookup_technology_arg },
......@@ -2226,6 +2319,67 @@ static int populate_service_hash(DBusMessageIter *iter, const char *error,
return 0;
}
static void add_peer_id(const char *path)
{
g_hash_table_replace(peer_hash, g_strdup(path), GINT_TO_POINTER(TRUE));
}
static void remove_peer_id(const char *path)
{
g_hash_table_remove(peer_hash, path);
}
static void peers_added(DBusMessageIter *iter)
{
DBusMessageIter array;
char *path = NULL;
while (dbus_message_iter_get_arg_type(iter) == DBUS_TYPE_STRUCT) {
dbus_message_iter_recurse(iter, &array);
if (dbus_message_iter_get_arg_type(&array) !=
DBUS_TYPE_OBJECT_PATH)
return;
dbus_message_iter_get_basic(&array, &path);
add_peer_id(get_path(path));
dbus_message_iter_next(iter);
}
}
static void update_peers(DBusMessageIter *iter)
{
DBusMessageIter array;
char *path;
if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_ARRAY)
return;
dbus_message_iter_recurse(iter, &array);
peers_added(&array);
dbus_message_iter_next(iter);
if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_ARRAY)
return;
dbus_message_iter_recurse(iter, &array);
while (dbus_message_iter_get_arg_type(&array) ==
DBUS_TYPE_OBJECT_PATH) {
dbus_message_iter_get_basic(&array, &path);
remove_peer_id(get_path(path));
dbus_message_iter_next(&array);
}
}
static int populate_peer_hash(DBusMessageIter *iter,
const char *error, void *user_data)
{
update_peers(iter);
return 0;
}
static void add_technology_id(const char *path)
{
g_hash_table_replace(technology_hash, g_strdup(path),
......@@ -2307,6 +2461,13 @@ static DBusHandlerResult monitor_completions_changed(
return handled;
}
if (dbus_message_is_signal(message, "net.connman.Manager",
"PeersChanged")) {
dbus_message_iter_init(message, &iter);
update_peers(&iter);
return handled;
}
if (dbus_message_is_signal(message, "net.connman.Manager",
"TechnologyAdded")) {
dbus_message_iter_init(message, &iter);
......@@ -2358,6 +2519,9 @@ void __connmanctl_monitor_completions(DBusConnection *dbus_conn)
service_hash = g_hash_table_new_full(g_str_hash, g_str_equal,
g_free, NULL);
peer_hash = g_hash_table_new_full(g_str_hash, g_str_equal,
g_free, NULL);
technology_hash = g_hash_table_new_full(g_str_hash, g_str_equal,
g_free, NULL);
......@@ -2366,6 +2530,11 @@ void __connmanctl_monitor_completions(DBusConnection *dbus_conn)
"net.connman.Manager", "GetServices",
populate_service_hash, NULL, NULL, NULL);
__connmanctl_dbus_method_call(connection,
CONNMAN_SERVICE, CONNMAN_PATH,
"net.connman.Manager", "GetPeers",
populate_peer_hash, NULL, NULL, NULL);
__connmanctl_dbus_method_call(connection,
CONNMAN_SERVICE, CONNMAN_PATH,
"net.connman.Manager", "GetTechnologies",
......
......@@ -2,7 +2,7 @@
*
* Connection Manager
*
* Copyright (C) 2012-2013 Intel Corporation. All rights reserved.
* Copyright (C) 2012-2014 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -214,16 +214,6 @@ void __connmanctl_command_mode(void)
rl_attempted_completion_function = complete_command;
}
static void no_handler(char *input)
{
}
static void no_handler_mode(void)
{
rl_callback_handler_install("", no_handler);
rl_attempted_completion_function = NULL;
}
int __connmanctl_input_init(int argc, char *argv[])
{
char *help[] = {
......@@ -244,22 +234,22 @@ int __connmanctl_input_init(int argc, char *argv[])
return 1;
}
channel = g_io_channel_unix_new(fileno(stdin));
source = g_io_add_watch(channel, G_IO_IN|G_IO_ERR|G_IO_HUP|G_IO_NVAL,
input_handler, NULL);
g_io_channel_unref(channel);
if (argc < 2) {
interactive = true;
channel = g_io_channel_unix_new(fileno(stdin));
source = g_io_add_watch(channel,
G_IO_IN|G_IO_ERR|G_IO_HUP|G_IO_NVAL,
input_handler, NULL);
g_io_channel_unref(channel);
__connmanctl_monitor_completions(connection);
__connmanctl_command_mode();
err = -EINPROGRESS;
err = -EINPROGRESS;
} else {
interactive = false;
no_handler_mode();
if (strcmp(argv[1], "--help") == 0 ||
strcmp(argv[1], "-h") == 0)
......@@ -276,13 +266,13 @@ int __connmanctl_input_init(int argc, char *argv[])
err = 0;
}
g_source_remove(source);
if (interactive)
if (interactive) {
g_source_remove(source);
__connmanctl_monitor_completions(NULL);
rl_callback_handler_remove();
rl_message("");
rl_callback_handler_remove();
rl_message("");
}
dbus_connection_unref(connection);
if (main_loop)
......
......@@ -2,7 +2,7 @@
*
* Connection Manager
*
* Copyright (C) 2012-2013 Intel Corporation. All rights reserved.
* Copyright (C) 2012-2014 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......
/*
*
* Connection Manager
*
* Copyright (C) 2014 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <string.h>
#include "peers.h"
static void print_peer(char *path, DBusMessageIter *iter)
{
char *name = "", *state = "";
char *str, *property;
DBusMessageIter entry, val;
int count = 0;
while (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_INVALID) {
dbus_message_iter_recurse(iter, &entry);
dbus_message_iter_get_basic(&entry, &property);
if (strcmp(property, "Name") == 0) {
dbus_message_iter_next(&entry);
dbus_message_iter_recurse(&entry, &val);
dbus_message_iter_get_basic(&val, &name);
} else if (strcmp(property, "State") == 0) {
dbus_message_iter_next(&entry);
dbus_message_iter_recurse(&entry, &val);
dbus_message_iter_get_basic(&val, &state);
}
dbus_message_iter_next(iter);
count++;
}
str = strrchr(path, '/');
if (str)
str++;
else
str = path;
if (count > 0)
fprintf(stdout, "%s %s %s", name, state, str);
else
fprintf(stdout, "%s %s", "unchanged", str);
}
static void list_peer_array(DBusMessageIter *iter)
{
DBusMessageIter array, dict;
char *path = NULL;
while (dbus_message_iter_get_arg_type(iter) == DBUS_TYPE_STRUCT) {
dbus_message_iter_recurse(iter, &array);
if (dbus_message_iter_get_arg_type(&array)
!= DBUS_TYPE_OBJECT_PATH)
return;
dbus_message_iter_get_basic(&array, &path);
dbus_message_iter_next(&array);
if (dbus_message_iter_get_arg_type(&array)
== DBUS_TYPE_ARRAY) {
dbus_message_iter_recurse(&array, &dict);
print_peer(path, &dict);
}
if (dbus_message_iter_has_next(iter))
fprintf(stdout, "\n");
dbus_message_iter_next(iter);
}
}
void __connmanctl_peers_list(DBusMessageIter *iter)
{
DBusMessageIter array;
char *path;
if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_ARRAY)
return;
dbus_message_iter_recurse(iter, &array);
list_peer_array(&array);
dbus_message_iter_next(iter);
if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_ARRAY)
return;
fprintf(stdout, "\n}, {");
dbus_message_iter_recurse(iter, &array);
while (dbus_message_iter_get_arg_type(&array)
== DBUS_TYPE_OBJECT_PATH) {
dbus_message_iter_get_basic(&array, &path);
fprintf(stdout, "\n%s %s", "removed", path);
dbus_message_iter_next(&array);
}
}
/*
*
* Connection Manager
*
* Copyright (C) 2014 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __CONNMANCTL_PEERS_H
#define __CONNMANCTL_PEERS_H
#include <dbus/dbus.h>
#ifdef __cplusplus
extern "C" {
#endif
void __connmanctl_peers_list(DBusMessageIter *iter);
#ifdef __cplusplus
}
#endif
#endif /* __CONNMANCTL_PEERS_H */
......@@ -62,6 +62,12 @@ static void print_service(char *path, DBusMessageIter *iter)
state = 'O';
else if (strcmp(str, "ready") == 0)
state = 'R';
else if (!strcmp(str, "association"))
state = 'a';
else if (!strcmp(str, "configuration"))
state = 'c';
else if (!strcmp(str, "disconnect"))
state = 'd';
}
} else if (strcmp(property, "AutoConnect") == 0) {
......
AC_PREREQ(2.60)
AC_INIT(connman, 1.22)
AC_INIT(connman, 1.23)
AM_INIT_AUTOMAKE([foreign subdir-objects color-tests])
AC_CONFIG_HEADERS([config.h])
......
......@@ -44,7 +44,7 @@ Methods dict GetProperties()
Returns a sorted list of tuples with peer object path
and dictionary of peer properties
Possible Errors: [peer].Error.InvalidArguments
Possible Errors: [service].Error.InvalidArguments
object ConnectProvider(dict provider) [deprecated]
......@@ -193,7 +193,7 @@ Signals TechnologyAdded(object path, dict properties)
required to watch the PropertyChanged signal of
the service object.
PeersChanged(array{object, dict}) [experimental]
PeersChanged(array{object, dict}, array{object}) [experimental]
Signals a list of peers that have been changed via the
first array. And a list of peer that have been removed
......
......@@ -5,7 +5,17 @@ Service net.connman
Interface net.connman.Peer
Object path [variable prefix]/{peer0,peer1,...}
Methods void Connect() [experimental]
Methods dict GetProperties() [deprecated]
Returns properties for the peer object. See the
properties sections for available properties.
Usage of this method is highly discouraged. Use
the Manager.GetPeers() method instead.
Possible Errors: [service].Error.InvalidArguments
void Connect() [experimental]
Connect this peer.
......
WiFi P2P Functionality [experimental]
*************************************
Note: Nothing about WiFi P2P Services is exposed, this is yet to be specified.
Summary
=======
WiFi P2P is supported as follows:
- if hardware and wpa_supplicant supports it, a "p2p" technology will appear
in the technology list
- "p2p" technology, as for "wifi" technology, supports a Scan() method. Such
method will trigger a P2P find process. The results will be available
through the Manager interface, comparable to services being available
through this same interface after a Scan() on "wifi" technology.
- the result of a "p2p" Scan() consists into a list of "peer" objects
- it is then possible to access peer information, connecting and disconnecting
it via the Peer API.
API Usage
=========
The UI willing to access to WiFi P2P technology should proceed this way: