This email list is read-only. Emails sent to this list will be discarded ---------------------------------- ChangeLog | 11 + configure.ac | 2 +- doc/device-api.txt | 13 + doc/manager-api.txt | 14 +- include/device.h | 3 + include/element.h | 10 +- include/network.h | 1 + include/property.h | 12 - include/types.h | 1 + plugins/supplicant.c | 2 + plugins/udhcp.c | 2 +- src/connection.c | 32 +--- src/connman.h | 22 ++- src/device.c | 303 ++++++++++++++++++++++++- src/element.c | 606 +++++++++++++++----------------------------------- src/log.c | 8 + src/main.c | 22 ++- src/manager.c | 18 +- src/network.c | 74 +++++- src/plugin.c | 13 +- test/Makefile.am | 3 +- test/test-connman | 265 ++++++++++++++++++++++ test/test-manager | 2 +- 23 files changed, 916 insertions(+), 523 deletions(-)
New commits: commit 5c370e9cb43f2a7581bde26a96f0b20c38030d41 Author: Marcel Holtmann <[email protected]> Date: Thu Jan 22 19:22:14 2009 +0100 Release 0.9 commit fe697fea5b178b866d566e78d83e793f5aa7d862 Author: Marcel Holtmann <[email protected]> Date: Wed Jan 21 22:51:23 2009 +0100 Reset scan trigger when scanning was performed commit fc12c78cc7d2a442a52c96d1c0c1912bff309a43 Author: Marcel Holtmann <[email protected]> Date: Wed Jan 21 22:44:05 2009 +0100 Add support for ScanInterval property commit 346c30414e8a347aa001758d666124aec4035cd9 Author: Marcel Holtmann <[email protected]> Date: Wed Jan 21 22:11:58 2009 +0100 Add support for toggling debug output commit 8074bba2f209e26bc2ab6cf0426241f5ec30da23 Author: Marcel Holtmann <[email protected]> Date: Wed Jan 21 21:43:53 2009 +0100 Don't try to re-connect to networks out of range commit 0f02f72a8e871f79c8230b9bc954c9db66dbd34b Author: Marcel Holtmann <[email protected]> Date: Wed Jan 21 21:42:41 2009 +0100 Add extra options to exclude devices and plugins commit ec02283f6e4bcfa2cda224cbc23b398c2862c5d1 Author: Marcel Holtmann <[email protected]> Date: Wed Jan 21 21:39:50 2009 +0100 Fix copy and paste mistake commit 621adb59b0fc8d576e5372ae7221aae3e055b726 Author: Marcel Holtmann <[email protected]> Date: Wed Jan 21 21:25:30 2009 +0100 Fix network out of range detection commit 8852fdac8997bf2160c633ed64cadad34cb0ca8a Author: Marcel Holtmann <[email protected]> Date: Wed Jan 21 19:55:37 2009 +0100 Remove the disconnected state once connected commit 6265392bdc7c99f926114c5af3ccf008d8e45710 Author: Marcel Holtmann <[email protected]> Date: Wed Jan 21 19:49:08 2009 +0100 Add support for special disconnected device state commit 2c171d0621ec983c641525d33b6b6c8766e79cb8 Author: Marcel Holtmann <[email protected]> Date: Wed Jan 21 19:26:44 2009 +0100 Introduce global "connecting" state commit 7054e93685c8c18838cc78500566ba4277a5cb26 Author: Marcel Holtmann <[email protected]> Date: Wed Jan 21 18:54:41 2009 +0100 Add more advanced test script for device handling commit 9f02a110ab06991b9bcce6ff1ff651c2069eb3ad Author: Marcel Holtmann <[email protected]> Date: Wed Jan 21 18:46:55 2009 +0100 Reconnecting to last selected network by default commit 9e003a1ccd8b2499ae44b548c3a987a493937839 Author: Marcel Holtmann <[email protected]> Date: Wed Jan 21 18:26:07 2009 +0100 Don't sent available signal for connected networks commit d7480e83fdcc558705237c888cdc6fab8620d846 Author: Marcel Holtmann <[email protected]> Date: Wed Jan 21 18:22:08 2009 +0100 More simplification of property functions commit 03cbc012afd80dbdd75f1293ab2ada6b25044944 Author: Marcel Holtmann <[email protected]> Date: Wed Jan 21 17:01:25 2009 +0100 Add support for static IPv4 settings commit d09ffbb2caf8b7e1e5a092e79f3675eb98861798 Author: Marcel Holtmann <[email protected]> Date: Wed Jan 21 10:33:15 2009 +0100 Track current network within device framework commit 3b6dd9aa9030e27513a4635e7a718feb4eea5ba1 Author: Marcel Holtmann <[email protected]> Date: Wed Jan 21 01:55:57 2009 +0100 Add support for disconnecting networks first commit acd4243c17aa6a9896e2e7de41deb3369e8144c6 Author: Marcel Holtmann <[email protected]> Date: Wed Jan 21 01:55:25 2009 +0100 Switch network to disconnected on removal commit 6e9987061ef9bc393309adfcdba155386d1802c4 Author: Marcel Holtmann <[email protected]> Date: Wed Jan 21 01:44:02 2009 +0100 Add function to get device mode commit 0b95857f52f88596c45679351f6e80ef17d6fc58 Author: Marcel Holtmann <[email protected]> Date: Wed Jan 21 01:36:32 2009 +0100 Verify argument type before processing commit e49304f3457f0d4a135f5f88b7197f144b647636 Author: Marcel Holtmann <[email protected]> Date: Tue Jan 20 22:26:01 2009 +0100 Remove old property system commit 31200365b3a59e89ee6d2d00b01b6cec33075688 Author: Marcel Holtmann <[email protected]> Date: Tue Jan 20 17:44:01 2009 +0100 Rename FlightMode to OfflineMode commit 7b9ccd0409be6c683f4954d417d507e06ed561d5 Author: Marcel Holtmann <[email protected]> Date: Tue Jan 20 14:56:37 2009 +0100 Remove networks that are no longer available Diff in this email is a maximum of 400 lines. diff --git a/ChangeLog b/ChangeLog index 61d9dba..edbb9df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +ver 0.9: + Rename FlightMode to OfflineMode. + Add static IPv4 setting support for Ethernet devices. + Add extra options to exclude devices and plugins. + Add support for toggling debug output. + Add support for ScanInterval property. + Fix handling of disconnect commands from applications. + Fix detection of networks that are out of range. + Fix setting network remember status. + Fix argument type checking of properties. + ver 0.8: Add Device and Network property to connection interface. Add option to disable installation of data files. diff --git a/configure.ac b/configure.ac index 61870b6..f7d245a 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ AC_PREREQ(2.60) AC_INIT() -AM_INIT_AUTOMAKE(connman, 0.8) +AM_INIT_AUTOMAKE(connman, 0.9) AM_CONFIG_HEADER(config.h) AM_MAINTAINER_MODE diff --git a/doc/device-api.txt b/doc/device-api.txt index b0cf440..ce50be7 100644 --- a/doc/device-api.txt +++ b/doc/device-api.txt @@ -106,6 +106,19 @@ Properties string Name [readonly] example would be modifications via the "ifconfig" command line utility. + uint16 ScanInterval [readwrite] + + The scan interval describes the time in seconds + between automated scan attempts. Setting this + value to 0 will disable the background scanning. + + The default value is 300 and so every 5 minutes + a scan procedure will be triggered. + + This property is not available with all types + of devices. Some might not support background + scanning at all. + 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 bf3d1de..1f50d94 100644 --- a/doc/manager-api.txt +++ b/doc/manager-api.txt @@ -45,6 +45,10 @@ Properties string State [readonly] values are "online" if at least one connection exists and "offline" if no device is connected. + In certain situations the state might change to + the value "connected". This can only be seen if + previously no connection was present. + string Policy [readwrite] The global connection policy of a system. This @@ -57,15 +61,15 @@ Properties string State [readonly] device defines which becomes the default connection when multiple are available. - boolean FlightMode [readwrite] + boolean OfflineMode [readwrite] - The flight mode indicates the global setting for - switching all radios on or off. Changing flight mode + The offline mode indicates the global setting for + switching all radios on or off. Changing offline mode to true results in powering down all devices. When - leaving flight mode the individual policy of each + leaving offline 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 + During offline 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. diff --git a/include/device.h b/include/device.h index 350890f..0f30100 100644 --- a/include/device.h +++ b/include/device.h @@ -83,6 +83,7 @@ extern void connman_device_set_policy(struct connman_device *device, enum connman_device_policy policy); extern void connman_device_set_mode(struct connman_device *device, enum connman_device_mode mode); +extern enum connman_device_mode connman_device_get_mode(struct connman_device *device); extern int connman_device_set_powered(struct connman_device *device, connman_bool_t powered); @@ -90,6 +91,8 @@ extern int connman_device_set_carrier(struct connman_device *device, connman_bool_t carrier); extern int connman_device_set_scanning(struct connman_device *device, connman_bool_t scanning); +extern int connman_device_set_disconnected(struct connman_device *device, + connman_bool_t disconnected); extern int connman_device_set_string(struct connman_device *device, const char *key, const char *value); diff --git a/include/element.h b/include/element.h index d91886b..8bdc42c 100644 --- a/include/element.h +++ b/include/element.h @@ -64,6 +64,7 @@ struct connman_element { gchar *path; enum connman_element_type type; gboolean enabled; + gboolean configuring; gchar *devname; struct connman_element *parent; @@ -79,7 +80,7 @@ struct connman_element { struct connman_network *network; }; - GSList *properties; + GHashTable *properties; struct { enum connman_ipv4_method method; @@ -96,15 +97,10 @@ extern struct connman_element *connman_element_create(const char *name); extern struct connman_element *connman_element_ref(struct connman_element *element); extern void connman_element_unref(struct connman_element *element); -extern int connman_element_add_static_property(struct connman_element *element, - const char *name, int type, const void *value); extern int connman_element_set_static_property(struct connman_element *element, const char *name, int type, const void *value); -extern int connman_element_add_static_array_property(struct connman_element *element, +extern int connman_element_set_static_array_property(struct connman_element *element, const char *name, int type, const void *value, int len); -extern int connman_element_define_properties(struct connman_element *element, ...); -extern int connman_element_create_property(struct connman_element *element, - const char *name, int type); extern int connman_element_set_property(struct connman_element *element, enum connman_property_id id, const void *value); extern int connman_element_get_value(struct connman_element *element, diff --git a/include/network.h b/include/network.h index 2232dfd..f5d2e95 100644 --- a/include/network.h +++ b/include/network.h @@ -72,6 +72,7 @@ extern int connman_network_set_available(struct connman_network *network, extern connman_bool_t connman_network_get_available(struct connman_network *network); extern int connman_network_set_connected(struct connman_network *network, connman_bool_t connected); +extern connman_bool_t connman_network_get_connected(struct connman_network *network); extern int connman_network_set_remember(struct connman_network *network, connman_bool_t remember); extern connman_bool_t connman_network_get_remember(struct connman_network *network); diff --git a/include/property.h b/include/property.h index e792487..ec8254c 100644 --- a/include/property.h +++ b/include/property.h @@ -43,20 +43,8 @@ enum connman_property_id { CONNMAN_PROPERTY_ID_IPV4_NAMESERVER, }; -/** - * connman_property_flags: - * @CONNMAN_PROPERTY_FLAG_STATIC: read-only property - * @CONNMAN_PROPERTY_FLAG_REFERENCE: inheritated value (reference only) - */ -enum connman_property_flags { - CONNMAN_PROPERTY_FLAG_STATIC = (1 << 0), - CONNMAN_PROPERTY_FLAG_REFERENCE = (1 << 1), -}; - struct connman_property { - enum connman_property_flags flags; enum connman_property_id id; - char *name; int type; int subtype; void *value; diff --git a/include/types.h b/include/types.h index af2a81b..ab58f1e 100644 --- a/include/types.h +++ b/include/types.h @@ -36,6 +36,7 @@ extern "C" { typedef int connman_bool_t; typedef unsigned char connman_uint8_t; +typedef unsigned short connman_uint16_t; #ifdef __cplusplus } diff --git a/plugins/supplicant.c b/plugins/supplicant.c index f910106..f9af81a 100644 --- a/plugins/supplicant.c +++ b/plugins/supplicant.c @@ -1376,6 +1376,8 @@ int supplicant_disconnect(struct connman_network *network) remove_network(task); + connman_network_set_connected(task->network, FALSE); + connman_network_unref(task->network); return 0; diff --git a/plugins/udhcp.c b/plugins/udhcp.c index e53c435..f58f833 100644 --- a/plugins/udhcp.c +++ b/plugins/udhcp.c @@ -211,5 +211,5 @@ static void udhcp_exit(void) dbus_connection_unref(connection); } -CONNMAN_PLUGIN_DEFINE(dhclient, "uDHCP client plugin", VERSION, +CONNMAN_PLUGIN_DEFINE(udhcp, "uDHCP client plugin", VERSION, udhcp_init, udhcp_exit) diff --git a/src/connection.c b/src/connection.c index 980b770..f011b0c 100644 --- a/src/connection.c +++ b/src/connection.c @@ -207,8 +207,7 @@ static DBusMessage *get_properties(DBusConnection *conn, DBusMessageIter array, dict; connman_uint8_t strength = 0; const char *device, *network; - const char *type = NULL, *method = NULL; - const char *address = NULL, *netmask = NULL, *gateway = NULL; + const char *type = NULL; DBG("conn %p", conn); @@ -255,31 +254,7 @@ static DBusMessage *get_properties(DBusConnection *conn, connman_dbus_dict_append_variant(&dict, "Network", DBUS_TYPE_OBJECT_PATH, &network); - connman_element_get_value(element, - CONNMAN_PROPERTY_ID_IPV4_METHOD, &method); - - connman_element_get_value(element, - CONNMAN_PROPERTY_ID_IPV4_ADDRESS, &address); - connman_element_get_value(element, - CONNMAN_PROPERTY_ID_IPV4_NETMASK, &netmask); - connman_element_get_value(element, - CONNMAN_PROPERTY_ID_IPV4_GATEWAY, &gateway); - - if (method != NULL) - connman_dbus_dict_append_variant(&dict, "IPv4.Method", - DBUS_TYPE_STRING, &method); - - if (address != NULL) - connman_dbus_dict_append_variant(&dict, "IPv4.Address", - DBUS_TYPE_STRING, &address); - - if (netmask != NULL) - connman_dbus_dict_append_variant(&dict, "IPv4.Netmask", - DBUS_TYPE_STRING, &netmask); - - if (gateway != NULL) - connman_dbus_dict_append_variant(&dict, "IPv4.Gateway", - DBUS_TYPE_STRING, &gateway); + __connman_element_append_ipv4(element, &dict); dbus_message_iter_close_container(&array, &dict); @@ -291,6 +266,7 @@ static DBusMessage *set_property(DBusConnection *conn, { DBusMessageIter iter, value; const char *name; + int type; DBG("conn %p", conn); @@ -305,6 +281,8 @@ static DBusMessage *set_property(DBusConnection *conn, CONNMAN_SECURITY_PRIVILEGE_MODIFY) < 0) return __connman_error_permission_denied(msg); + type = dbus_message_iter_get_arg_type(&value); + return g_dbus_create_reply(msg, DBUS_TYPE_INVALID); } diff --git a/src/connman.h b/src/connman.h index 545183e..729dc42 100644 --- a/src/connman.h +++ b/src/connman.h @@ -58,11 +58,12 @@ void __connman_profile_list(DBusMessageIter *iter); int __connman_log_init(gboolean detach, gboolean debug); void __connman_log_cleanup(void); +void __connman_toggle_debug(void); gboolean __connman_debug_enabled(void); #include <connman/plugin.h> -int __connman_plugin_init(const char *pattern); +int __connman_plugin_init(const char *pattern, const char *exclude); void __connman_plugin_cleanup(void); #include <connman/security.h> @@ -100,11 +101,14 @@ void __connman_driver_rescan(struct connman_driver *driver); #include <connman/element.h> -int __connman_element_init(DBusConnection *conn, const char *device); +int __connman_element_init(DBusConnection *conn, const char *device, + const char *nodevice); void __connman_element_start(void); void __connman_element_stop(void); void __connman_element_cleanup(void); +void __connman_element_initialize(struct connman_element *element); + typedef void (* element_cb_t) (struct connman_element *element, gpointer user_data); @@ -130,6 +134,11 @@ static inline void __connman_element_unlock(struct connman_element *element) { } +int __connman_element_append_ipv4(struct connman_element *element, + DBusMessageIter *dict); +int __connman_element_set_ipv4(struct connman_element *element, + const char *name, DBusMessageIter *value); + int __connman_detect_init(void); void __connman_detect_cleanup(void); @@ -161,9 +170,14 @@ void __connman_device_cleanup(void); void __connman_device_increase_connections(struct connman_device *device); void __connman_device_decrease_connections(struct connman_device *device); +void __connman_device_set_network(struct connman_device *device, + struct connman_network *network); + +void __connman_device_disconnect(struct connman_device *device); + connman_bool_t __connman_device_has_driver(struct connman_device *device); -int __connman_device_set_flightmode(connman_bool_t flightmode); +int __connman_device_set_offlinemode(connman_bool_t offlinemode); #include <connman/network.h> @@ -173,6 +187,8 @@ void __connman_network_cleanup(void); void __connman_network_set_device(struct connman_network *network, struct connman_device *device); +int __connman_network_disconnect(struct connman_network *network); + connman_bool_t __connman_network_has_driver(struct connman_network *network); #include <connman/rtnl.h> diff --git a/src/device.c b/src/device.c index 2a65e69..8427a2c 100644 --- a/src/device.c +++ b/src/device.c @@ -36,20 +36,42 @@ struct connman_device { connman_bool_t powered; connman_bool_t carrier; connman_bool_t scanning; + connman_bool_t disconnected; connman_uint8_t priority; + connman_uint16_t scan_interval; char *name; char *node; char *interface; unsigned int connections; + guint scan_timeout; struct connman_device_driver *driver; void *driver_data; connman_bool_t registered; + char *last_network; + struct connman_network *network; GHashTable *networks; }; +static gboolean device_scan_trigger(gpointer user_data) +{ + struct connman_device *device = user_data; + + DBG("device %p", device); + + if (device->driver == NULL) { + device->scan_timeout = 0; + return FALSE; + } + + if (device->driver->scan) + device->driver->scan(device); + _______________________________________________ Commits mailing list [email protected] https://lists.moblin.org/mailman/listinfo/commits
