This email list is read-only. Emails sent to this list will be discarded ---------------------------------- configure.ac | 6 ++++-- doc/device-api.txt | 28 +++++++++++++++++++++++++++- doc/manager-api.txt | 25 +++++++++++++++++++++++++ doc/network-api.txt | 17 ++++++++++++++--- include/device.h | 8 ++++++++ plugins/Makefile.am | 2 ++ plugins/resolvconf.c | 2 -- plugins/supplicant.c | 5 +++++ plugins/supplicant.h | 1 + plugins/wifi.c | 8 +++++++- src/Makefile.am | 2 +- src/device.c | 7 ++----- src/manager.c | 31 +++++++++---------------------- test/Makefile.am | 2 +- test/set-address | 26 ++++++++++++++++++++++++++ 15 files changed, 132 insertions(+), 38 deletions(-)
New commits: commit da067394411a7176d8f6844edc251ae2dcb50355 Author: Marcel Holtmann <[email protected]> Date: Sun Dec 21 23:03:23 2008 +0100 Add test script for setting addresses commit f3570489ceb89d349f3212548f40eff98e33ecf0 Author: Marcel Holtmann <[email protected]> Date: Sun Dec 21 22:56:23 2008 +0100 Add global Policy property and cleanup State property commit 6e6b7abe7bd37d1da6cf32b4f07f3011daeba612 Author: Marcel Holtmann <[email protected]> Date: Sun Dec 21 22:52:38 2008 +0100 Add property for global connection policy. commit 11a58a90b94da926e1263e8cb74b52a271d21dd9 Author: Marcel Holtmann <[email protected]> Date: Sun Dec 21 22:37:45 2008 +0100 Provide udhcpc binary location from configuration commit 8f683573410f1ad35e700347c5018c8c4de22258 Author: Marcel Holtmann <[email protected]> Date: Sun Dec 21 22:34:19 2008 +0100 Use resolvconf binary found during configuration commit e69a80ed4b1e7cd4c4fa1718d429b1515a251409 Author: Marcel Holtmann <[email protected]> Date: Sun Dec 21 22:30:45 2008 +0100 Check for resolvconf binary commit 336ea570b5b9ba6f9e474de882cd91c9a665e22f Author: Marcel Holtmann <[email protected]> Date: Sun Dec 21 22:29:25 2008 +0100 Check for udhcpc binary commit 9b8b75ff570c8c6ca38daf0a9c2a4ddf4356e9a6 Author: Marcel Holtmann <[email protected]> Date: Sun Dec 21 21:33:01 2008 +0100 Re-enable generic device driver infrastructure commit a551cd60c5dba4da4bfc883e97f6b1766506f4ea Author: Marcel Holtmann <[email protected]> Date: Sun Dec 21 21:28:19 2008 +0100 Add device policy constants commit cbec83f07c92c4e5102a17902380719ac6d6f359 Author: Marcel Holtmann <[email protected]> Date: Sun Dec 21 21:23:47 2008 +0100 Add support for exporting the WiFi network mode commit b93f19856e9a31a7615496d90133c4f2effdb4fa Author: Marcel Holtmann <[email protected]> Date: Sun Dec 21 21:07:56 2008 +0100 Create exported symbols list after all objects are built commit 32e29cbf5000a7750f3b3e2fc52f3c6828e778f9 Author: Marcel Holtmann <[email protected]> Date: Sun Dec 21 20:42:38 2008 +0100 Turn warnings into errors when debugging is enabled commit c1f1b9736e2deb99a0849dad70ed069797b12a2a Author: Marcel Holtmann <[email protected]> Date: Sun Dec 21 16:39:34 2008 +0100 Require at minimum autoconf 2.60 commit 7eb0cf5c259469ab07a6ec79cc316afe532cf5ec Author: Marcel Holtmann <[email protected]> Date: Sun Dec 21 16:18:05 2008 +0100 Update property documentation Diff in this email is a maximum of 400 lines. diff --git a/configure.ac b/configure.ac index 0f81dde..fea1130 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_PREREQ(2.50) +AC_PREREQ(2.60) AC_INIT() AM_INIT_AUTOMAKE(connman, 0.5) @@ -32,7 +32,7 @@ AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [enable compiling with debugging information]), [ if (test "${enableval}" = "yes" && test "${ac_cv_prog_cc_g}" = "yes"); then - CFLAGS="$CFLAGS -g -O0" + CFLAGS="$CFLAGS -g -O0 -Werror" fi ]) @@ -45,7 +45,9 @@ AC_ARG_ENABLE(pie, AC_HELP_STRING([--enable-pie], fi ]) +AC_PATH_PROG(UDHCPC, [udhcpc], ,$PATH:/sbin:/usr/sbin) AC_PATH_PROG(DHCLIENT, [dhclient], ,$PATH:/sbin:/usr/sbin) +AC_PATH_PROG(RESOLVCONF, [resolvconf], ,$PATH:/sbin:/usr/sbin) AC_PATH_PROG(WPASUPPLICANT, [wpa_supplicant], ,$PATH:/sbin:/usr/sbin) AC_CHECK_LIB(dl, dlopen, dummy=yes, diff --git a/doc/device-api.txt b/doc/device-api.txt index 7df3791..45c7215 100644 --- a/doc/device-api.txt +++ b/doc/device-api.txt @@ -52,7 +52,25 @@ Properties string Name [readonly] string Type [readonly] - The device type (for example ethernet, wifi etc.) + The device type (for example "ethernet", "wifi" etc.) + + string Policy [readwrite] + + Setting of the device power policy. Possible values + are "off", "ignore" and "auto". + + The policy defines on how the device is initialized + when brought up. The actual device power state can + be changed independently to this value. + + If a device is switched off and the policy is changed + to "auto", the device will be switched. For a current + active device changing the policy to "off" results + in powering down the device. + + The "ignore" policy can be set for devices that are + detected, but managed by a different entity on the + system. For example complex network setups. boolean Powered [readwrite] @@ -60,6 +78,14 @@ Properties string Name [readonly] the list of networks in range. All known networks will be still available via the Networks property. + Changing this value doesn't change the value of the + Policy property. + + The value of this property can be changed by other + parts of the system (including the kernel). An + example would be modifications via the "ifconfig" + command line utility. + boolean Scanning [readonly] Indicates if a device is scanning. Not all device diff --git a/doc/manager-api.txt b/doc/manager-api.txt index 9365e66..bf3d1de 100644 --- a/doc/manager-api.txt +++ b/doc/manager-api.txt @@ -45,6 +45,31 @@ Properties string State [readonly] values are "online" if at least one connection exists and "offline" if no device is connected. + string Policy [readwrite] + + The global connection policy of a system. This + allows to configure how connections are established + and also when they are taken down again. + + Possible values are "single", "multiple" and "ask". + + For the single policy, the priority setting of the + device defines which becomes the default connection + when multiple are available. + + boolean FlightMode [readwrite] + + The flight mode indicates the global setting for + switching all radios on or off. Changing flight mode + to true results in powering down all devices. When + leaving flight mode the individual policy of each + device decides to switch the radio back on or not. + + During flight mode, it is still possible to switch + certain technologies manually back on. For example + the limited usage of WiFi or Bluetooth devices might + be allowed in some situations. + array{object} Profiles [readonly] List of profile object paths. diff --git a/doc/network-api.txt b/doc/network-api.txt index ce487dd..66ad6fb 100644 --- a/doc/network-api.txt +++ b/doc/network-api.txt @@ -53,7 +53,8 @@ Properties string Name [readonly] uint8 Strength [readonly] - Indicates the signal strength of the network. + Indicates the signal strength of the network. This + is a normalized value between 0 and 100. object Device [readonly] @@ -65,6 +66,16 @@ Properties string Name [readonly] If the network type is WiFi, then this property is present and contains the binary SSID value. + string WiFi.Mode [readonly, readwrite] + + If the network type is WiFi, then this property is + present and contains the mode of the network. The + possible values are "managed" or "adhoc". + + For scanned networks this value is read only, but in + case the network was manually created it is also + changeable. + string WiFi.Security [readonly, readwrite] If the network type is WiFi, then this property is @@ -75,7 +86,7 @@ Properties string Name [readonly] case the network was manually created it is also changeable. - Possible values are NONE, WPA and WPA2. + Possible values are "none", "wep", "wpa" and "wpa2". string WiFi.Passphrase [readwrite] @@ -83,5 +94,5 @@ Properties string Name [readonly] requires, then this property is present and contains the passphrase in clear text. - For system using PolicyKit, the access to this value + For systems using PolicyKit, the access to this value will be protected by the security policy. diff --git a/include/device.h b/include/device.h index 85f3581..3153148 100644 --- a/include/device.h +++ b/include/device.h @@ -48,6 +48,13 @@ enum connman_device_capabilities { CONNMAN_DEVICE_CAPABILITY_SCANNING = (1 << 0), }; +enum connman_device_policy { + CONNMAN_DEVICE_POLICY_UNKNOWN = 0, + CONNMAN_DEVICE_POLICY_IGNORE = 1, + CONNMAN_DEVICE_POLICY_AUTO = 2, + CONNMAN_DEVICE_POLICY_OFF = 3, +}; + enum connman_device_state { CONNMAN_DEVICE_STATE_UNKNOWN = 0, CONNMAN_DEVICE_STATE_OFF = 1, @@ -58,6 +65,7 @@ struct connman_device_driver; struct connman_device { struct connman_element *element; unsigned long capabilities; + enum connman_device_policy policy; enum connman_device_state state; struct connman_device_driver *driver; diff --git a/plugins/Makefile.am b/plugins/Makefile.am index 25ec356..2cde74b 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -18,6 +18,7 @@ bluetooth_la_SOURCES = bluetooth.c bluetooth_la_LIBADD = @GDBUS_LIBS@ udhcp_la_SOURCES = udhcp.c +udhcp_la_CFLAGS = @GLIB_CFLAGS@ -DUDHCPC=\"@udh...@\" dhclient_la_SOURCES = dhclient.c inet.h inet.c dhclient_la_CFLAGS = @GLIB_CFLAGS@ @GDBUS_CFLAGS@ -DDHCLIENT=\"@dhcli...@\" \ @@ -30,6 +31,7 @@ rtnllink_la_SOURCES = rtnllink.c inet.h inet.c dnsproxy_la_SOURCES = dnsproxy.c resolvconf_la_SOURCES = resolvconf.c +resolvconf_la_CFLAGS = @GLIB_CFLAGS@ -DRESOLVCONF=\"@resolvc...@\" resolvfile_la_SOURCES = resolvfile.c diff --git a/plugins/resolvconf.c b/plugins/resolvconf.c index 0a1c036..7dc1205 100644 --- a/plugins/resolvconf.c +++ b/plugins/resolvconf.c @@ -33,8 +33,6 @@ #include <glib.h> -#define RESOLVCONF "/sbin/resolvconf" - static int resolvconf_append(const char *interface, const char *domain, const char *server) { diff --git a/plugins/supplicant.c b/plugins/supplicant.c index bca325d..0b84903 100644 --- a/plugins/supplicant.c +++ b/plugins/supplicant.c @@ -655,6 +655,11 @@ static void extract_capabilites(struct supplicant_network *network, { dbus_message_iter_get_basic(value, &network->capabilities); + if (network->capabilities & IEEE80211_CAP_ESS) + network->adhoc = FALSE; + else if (network->capabilities & IEEE80211_CAP_IBSS) + network->adhoc = TRUE; + if (network->capabilities & IEEE80211_CAP_PRIVACY) network->has_wep = TRUE; } diff --git a/plugins/supplicant.h b/plugins/supplicant.h index 4a746a6..2afd003 100644 --- a/plugins/supplicant.h +++ b/plugins/supplicant.h @@ -41,6 +41,7 @@ struct supplicant_network { guint8 *ssid; guint ssid_len; guint16 capabilities; + gboolean adhoc; gboolean has_wep; gboolean has_wpa; gboolean has_rsn; diff --git a/plugins/wifi.c b/plugins/wifi.c index dd769b5..f72cdb8 100644 --- a/plugins/wifi.c +++ b/plugins/wifi.c @@ -328,6 +328,8 @@ static void scan_result(struct connman_element *device, element = find_pending_element(data, network->identifier); if (element == NULL) { + const char *mode; + element = connman_element_create(temp); element->type = CONNMAN_ELEMENT_TYPE_NETWORK; @@ -339,6 +341,10 @@ static void scan_result(struct connman_element *device, connman_element_add_static_array_property(element, "WiFi.SSID", DBUS_TYPE_BYTE, &network->ssid, network->ssid_len); + mode = (network->adhoc == TRUE) ? "adhoc" : "managed"; + connman_element_add_static_property(element, "WiFi.Mode", + DBUS_TYPE_STRING, &mode); + if (element->wifi.security == NULL) { const char *security; @@ -359,7 +365,7 @@ static void scan_result(struct connman_element *device, connman_element_add_static_property(element, "Strength", DBUS_TYPE_BYTE, &element->strength); - DBG("%s (%s) strength %d", network->identifier, + DBG("%s (%s %s) strength %d", network->identifier, mode, element->wifi.security, element->strength); if (connman_element_register(element, device) < 0) { diff --git a/src/Makefile.am b/src/Makefile.am index 170e40a..018fb15 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -42,7 +42,7 @@ EXTRA_DIST = $(dbus_DATA) MAINTAINERCLEANFILES = Makefile.in -connman.exp: +connman.exp: $(connmand_OBJECTS) nm -B *.o | awk '{ print $$3 }' | sort -u | grep -E -e '^connman_' > $@ connman.ver: connman.exp diff --git a/src/device.c b/src/device.c index 3ad61ff..f49c5e7 100644 --- a/src/device.c +++ b/src/device.c @@ -29,7 +29,6 @@ static GSList *driver_list = NULL; -#if 0 static gboolean match_driver(struct connman_device *device, struct connman_device_driver *driver) { @@ -94,21 +93,19 @@ static struct connman_driver device_driver = { .probe = device_probe, .remove = device_remove, }; -#endif int __connman_device_init(void) { DBG(""); - //return connman_driver_register(&device_driver); - return 0; + return connman_driver_register(&device_driver); } void __connman_device_cleanup(void) { DBG(""); - //connman_driver_unregister(&device_driver); + connman_driver_unregister(&device_driver); } static gint compare_priority(gconstpointer a, gconstpointer b) diff --git a/src/manager.c b/src/manager.c index df53fef..14c8a6e 100644 --- a/src/manager.c +++ b/src/manager.c @@ -105,31 +105,12 @@ static void append_connections(DBusMessageIter *dict) dbus_message_iter_close_container(dict, &entry); } -static void append_state(DBusMessageIter *dict, const char *state) -{ - DBusMessageIter entry, value; - const char *key = "State"; - - dbus_message_iter_open_container(dict, DBUS_TYPE_DICT_ENTRY, - NULL, &entry); - - dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &key); - - dbus_message_iter_open_container(&entry, DBUS_TYPE_VARIANT, - DBUS_TYPE_STRING_AS_STRING, &value); - - dbus_message_iter_append_basic(&value, DBUS_TYPE_STRING, &state); - - dbus_message_iter_close_container(&entry, &value); - - dbus_message_iter_close_container(dict, &entry); -} - static DBusMessage *get_properties(DBusConnection *conn, DBusMessage *msg, void *data) { DBusMessage *reply; DBusMessageIter array, dict; + const char *state, *policy = "single"; DBG("conn %p", conn); @@ -150,9 +131,15 @@ static DBusMessage *get_properties(DBusConnection *conn, append_connections(&dict); if (__connman_element_count(NULL, CONNMAN_ELEMENT_TYPE_CONNECTION) > 0) - append_state(&dict, "online"); + state = "online"; else - append_state(&dict, "offline"); + state = "offline"; + + connman_dbus_dict_append_variant(&dict, "State", + DBUS_TYPE_STRING, &state); + + connman_dbus_dict_append_variant(&dict, "Policy", + DBUS_TYPE_STRING, &policy); dbus_message_iter_close_container(&array, &dict); diff --git a/test/Makefile.am b/test/Makefile.am index 2087e88..30546b9 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -2,7 +2,7 @@ EXTRA_DIST = get-state list-profiles list-connections select-connection \ list-devices enable-device disable-device start-scanning \ list-networks select-network disable-network create-network \ - set-passphrase simple-agent show-introspection \ + set-passphrase set-address simple-agent show-introspection \ test-manager test-compat monitor-connman MAINTAINERCLEANFILES = Makefile.in diff --git a/test/set-address b/test/set-address new file mode 100755 index 0000000..ebff30a --- /dev/null +++ b/test/set-address _______________________________________________ Commits mailing list [email protected] https://lists.moblin.org/mailman/listinfo/commits
