This email list is read-only.  Emails sent to this list will be discarded
----------------------------------
 .gitignore              |    3 +
 configure.ac            |    7 +-
 doc/plugin-api.txt      |    2 +-
 include/Makefile.am     |   12 +++-
 include/network.h       |    7 ++
 include/plugin.h        |    4 +-
 include/version.h.in    |   35 ++++++++++
 plugins/Makefile.am     |    7 ++-
 plugins/connman.policy  |   29 --------
 plugins/polkit.policy   |   29 ++++++++
 plugins/supplicant.c    |    1 +
 src/Makefile.am         |   11 +++-
 src/connman-dbus.conf   |   15 ++++
 src/connman-polkit.conf |   11 +++
 src/connman.conf        |   16 -----
 src/device.c            |   31 ++++++++-
 src/network.c           |  172 ++++++++++++++++++++++++++++++++++++++++++++---
 src/plugin.c            |    3 +
 18 files changed, 328 insertions(+), 67 deletions(-)

New commits:
commit b675c7d61e7d27bdbc233951a5a3ae947a4c2486
Author: Marcel Holtmann <[email protected]>
Date:   Wed Jan 7 17:50:30 2009 +0100

    Remove connman.policy and not polkit.policy on cleanup

commit 70c75fa16808fe7cfd6d98af4770972ebaeee332
Author: Marcel Holtmann <[email protected]>
Date:   Wed Jan 7 17:48:28 2009 +0100

    Change name of policy configuration file for PolicyKit

commit 384be7749672d1ad9e3575d0885d2295d9afaa7c
Author: Marcel Holtmann <[email protected]>
Date:   Wed Jan 7 17:38:31 2009 +0100

    Fix wrong reference to version.h

commit f5b24ac0b5d57328cf8649dcdae73c40db2bb59e
Author: Marcel Holtmann <[email protected]>
Date:   Wed Jan 7 17:37:26 2009 +0100

    Install different D-Bus configuration if PolicyKit is enabled

commit a48010072c90de9278b63fff0fbdf6e98f138517
Author: Marcel Holtmann <[email protected]>
Date:   Wed Jan 7 17:31:48 2009 +0100

    Fix wrong assignment of strength value

commit 0064506b824a1b7963d4fd1e136450453946a5e0
Author: Marcel Holtmann <[email protected]>
Date:   Wed Jan 7 17:25:25 2009 +0100

    Use priority and strength to select known network

commit 7cfbb5b79dc8ec5524d8e78ab543c4597eeb3349
Author: Marcel Holtmann <[email protected]>
Date:   Wed Jan 7 17:24:52 2009 +0100

    Add the generated version.h to ignore list

commit 681cdd4a0c0bf186b9a0cca012992e8d654fd4ca
Author: Marcel Holtmann <[email protected]>
Date:   Wed Jan 7 17:03:51 2009 +0100

    Only load plugins with the same version string

commit 0fc28e0291fd0d878a6605c7f62fcc7debfdbebe
Author: Marcel Holtmann <[email protected]>
Date:   Wed Jan 7 16:47:13 2009 +0100

    Add support for CONNMAN_VERSION declaration

commit fb423121afa4655615a496941c807323f16c9b9a
Author: Marcel Holtmann <[email protected]>
Date:   Wed Jan 7 14:30:44 2009 +0100

    Only store and load security details for known networks

commit cc62d0b1c13ce889b115c607ec206e3f0173e045
Author: Marcel Holtmann <[email protected]>
Date:   Wed Jan 7 14:29:35 2009 +0100

    Add support for network priorities

commit c103c09d8716d7c59918c924b8de7b8b5b70cdda
Author: Marcel Holtmann <[email protected]>
Date:   Wed Jan 7 03:37:41 2009 +0100

    Add support for getting network availability setting

commit 27261f7a7c0c6299aafceae15c86f439af009b86
Author: Marcel Holtmann <[email protected]>
Date:   Wed Jan 7 02:21:23 2009 +0100

    Add support for setting remember state

commit 40c321540fce99a415c3bb49ced39a75399e1f5b
Author: Marcel Holtmann <[email protected]>
Date:   Wed Jan 7 02:18:20 2009 +0100

    Don't send signals for unregistered networks

commit 6f24662363c391c653d4a90518b0ff664f3ae5c4
Author: Marcel Holtmann <[email protected]>
Date:   Wed Jan 7 02:17:35 2009 +0100

    Add support for setting network availability


Diff in this email is a maximum of 400 lines.
diff --git a/.gitignore b/.gitignore
index cff6472..11710f8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,11 +23,14 @@ autom4te.cache
 
 connman.pc
 include/connman
+include/version.h
 src/connmand
 src/connman.exp
 src/connman.ver
+src/connman.conf
 src/connman.service
 src/*-connman.rules
+plugins/connman.policy
 scripts/connman
 scripts/udhcpc-script
 scripts/dhclient-script
diff --git a/configure.ac b/configure.ac
index 570d95f..eafe9e6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -209,6 +209,7 @@ AC_ARG_ENABLE(fake, AC_HELP_STRING([--enable-fake],
                [enable fake device support]), [enable_fake=${enableval}])
 AM_CONDITIONAL(FAKE, test "${enable_fake}" = "yes")
 
-AC_OUTPUT(Makefile gdbus/Makefile include/Makefile src/Makefile doc/Makefile
-               test/Makefile plugins/Makefile client/Makefile scripts/Makefile
-               scripts/connman src/connman.service doc/version.xml connman.pc)
+AC_OUTPUT(Makefile gdbus/Makefile include/Makefile include/version.h
+               src/Makefile src/connman.service scripts/connman
+               scripts/Makefile plugins/Makefile client/Makefile
+               test/Makefile doc/Makefile doc/version.xml connman.pc)
diff --git a/doc/plugin-api.txt b/doc/plugin-api.txt
index e329ced..696e2c1 100644
--- a/doc/plugin-api.txt
+++ b/doc/plugin-api.txt
@@ -20,5 +20,5 @@ static void example_exit(void)
 {
 }
 
-CONNMAN_PLUGIN_DEFINE(example, "Example plugin", VERSION,
+CONNMAN_PLUGIN_DEFINE(example, "Example plugin", CONNMAN_VERSION,
                                                example_init, example_exit)
diff --git a/include/Makefile.am b/include/Makefile.am
index 84eece9..2db0249 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -4,12 +4,20 @@ includedir = @includedir@/connman
 include_HEADERS = types.h log.h plugin.h security.h resolver.h \
                                        storage.h device.h network.h
 
+nodist_include_HEADERS = version.h
+
 noinst_HEADERS = driver.h element.h property.h ipv4.h rtnl.h dbus.h
 
 MAINTAINERCLEANFILES = Makefile.in
 
 all-local:
-       @if [ ! -e connman ] ; then $(LN_S) $(top_srcdir)/include connman ; fi
+       @if [ ! -e connman ]; then \
+         mkdir connman; \
+         list='$(include_HEADERS) $(noinst_HEADERS)'; for i in $$list; \
+           do cp $(top_srcdir)/include/$$i connman/; done; \
+         list='$(nodist_include_HEADERS)'; for i in $$list; \
+           do cp $(top_builddir)/include/$$i connman/; done; \
+       fi
 
 clean-local:
-       @rm -f connman
+       @rm -rf connman
diff --git a/include/network.h b/include/network.h
index 70b7c35..2232dfd 100644
--- a/include/network.h
+++ b/include/network.h
@@ -67,8 +67,13 @@ extern int connman_network_get_index(struct connman_network 
*network);
 extern void connman_network_set_protocol(struct connman_network *network,
                                        enum connman_network_protocol protocol);
 
+extern int connman_network_set_available(struct connman_network *network,
+                                               connman_bool_t available);
+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 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);
 
 extern int connman_network_connect(struct connman_network *network);
@@ -79,6 +84,8 @@ extern const char *connman_network_get_string(struct 
connman_network *network,
                                                        const char *key);
 extern int connman_network_set_uint8(struct connman_network *network,
                                        const char *key, connman_uint8_t value);
+extern connman_uint8_t connman_network_get_uint8(struct connman_network 
*network,
+                                                       const char *key);
 extern int connman_network_set_blob(struct connman_network *network,
                        const char *key, const void *data, unsigned int size);
 extern const void *connman_network_get_blob(struct connman_network *network,
diff --git a/include/plugin.h b/include/plugin.h
index 11a0609..84e0958 100644
--- a/include/plugin.h
+++ b/include/plugin.h
@@ -22,6 +22,8 @@
 #ifndef __CONNMAN_PLUGIN_H
 #define __CONNMAN_PLUGIN_H
 
+#include <connman/version.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -67,7 +69,7 @@ struct connman_plugin_desc {
  * {
  * }
  *
- * CONNMAN_PLUGIN_DEFINE(example, "Example plugin", VERSION,
+ * CONNMAN_PLUGIN_DEFINE(example, "Example plugin", CONNMAN_VERSION,
  *                                     example_init, example_exit)
  * ]|
  */
diff --git a/include/version.h.in b/include/version.h.in
new file mode 100644
index 0000000..5d44396
--- /dev/null
+++ b/include/version.h.in
@@ -0,0 +1,35 @@
+/*
+ *
+ *  Connection Manager
+ *
+ *  Copyright (C) 2007-2009  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 version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  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 __CONNMAN_VERSION_H
+#define __CONNMAN_VERSION_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define CONNMAN_VERSION        "@VERSION@"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CONNMAN_VERSION_H */
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index de4b58b..b4c187b 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -122,6 +122,11 @@ AM_CFLAGS = @GLIB_CFLAGS@ @GDBUS_CFLAGS@
 
 INCLUDES = -I$(top_builddir)/include
 
-EXTRA_DIST = connman.policy
+CLEANFILES = connman.policy
+
+EXTRA_DIST = polkit.policy
 
 MAINTAINERCLEANFILES = Makefile.in
+
+connman.policy: polkit.policy
+       cp $< $@
diff --git a/plugins/connman.policy b/plugins/connman.policy
deleted file mode 100644
index bc36a6d..0000000
--- a/plugins/connman.policy
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE policyconfig PUBLIC
- "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
- "http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd";>
-
-<policyconfig>
-
-  <vendor>Connection Manager</vendor>
-  <icon_name>network-wireless</icon_name>
-
-  <action id="org.moblin.connman.modify">
-    <description>Settings configuration</description>
-    <message>Policy prevents modification of settings</message>
-    <defaults>
-      <allow_inactive>no</allow_inactive>
-      <allow_active>auth_admin_keep_always</allow_active>
-    </defaults>
-  </action>
-
-  <action id="org.moblin.connman.secret">
-    <description>Secrets configuration</description>
-    <message>Policy prevents modification of secrets</message>
-    <defaults>
-      <allow_inactive>no</allow_inactive>
-      <allow_active>auth_admin_keep_always</allow_active>
-    </defaults>
-  </action>
-
-</policyconfig>
diff --git a/plugins/polkit.policy b/plugins/polkit.policy
new file mode 100644
index 0000000..bc36a6d
--- /dev/null
+++ b/plugins/polkit.policy
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE policyconfig PUBLIC
+ "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd";>
+
+<policyconfig>
+
+  <vendor>Connection Manager</vendor>
+  <icon_name>network-wireless</icon_name>
+
+  <action id="org.moblin.connman.modify">
+    <description>Settings configuration</description>
+    <message>Policy prevents modification of settings</message>
+    <defaults>
+      <allow_inactive>no</allow_inactive>
+      <allow_active>auth_admin_keep_always</allow_active>
+    </defaults>
+  </action>
+
+  <action id="org.moblin.connman.secret">
+    <description>Secrets configuration</description>
+    <message>Policy prevents modification of secrets</message>
+    <defaults>
+      <allow_inactive>no</allow_inactive>
+      <allow_active>auth_admin_keep_always</allow_active>
+    </defaults>
+  </action>
+
+</policyconfig>
diff --git a/plugins/supplicant.c b/plugins/supplicant.c
index 23acd08..f910106 100644
--- a/plugins/supplicant.c
+++ b/plugins/supplicant.c
@@ -977,6 +977,7 @@ static void properties_reply(DBusPendingCall *call, void 
*user_data)
                }
        }
 
+       connman_network_set_available(network, TRUE);
        connman_network_set_uint8(network, "Strength", strength);
 
        connman_network_set_string(network, "WiFi.Security", security);
diff --git a/src/Makefile.am b/src/Makefile.am
index a1cfcc2..a540bf1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -24,7 +24,7 @@ connmand_LDFLAGS = -Wl,--export-dynamic 
-Wl,--version-script=connman.ver
 
 connmand_DEPENDENCIES = connman.ver
 
-CLEANFILES = connman.ver connman.exp 92-connman.rules
+CLEANFILES = connman.ver connman.exp connman.conf 92-connman.rules
 
 statedir = $(localstatedir)/run/connman
 
@@ -42,7 +42,7 @@ AM_CFLAGS = @UDEV_CFLAGS@ @GLIB_CFLAGS@ @GDBUS_CFLAGS@ \
                                                -DPLUGINDIR=\""$(plugindir)"\"
 INCLUDES = -I$(top_builddir)/include
 
-EXTRA_DIST = $(dbus_DATA) connman.rules
+EXTRA_DIST = connman-dbus.conf connman-polkit.conf connman.rules
 
 MAINTAINERCLEANFILES = Makefile.in
 
@@ -54,5 +54,12 @@ connman.ver: connman.exp
        cat $< | sed -e "s/\(.*\)/\1;/" >> $@
        echo "local: *; };" >> $@
 
+connman.conf: connman-dbus.conf connman-polkit.conf
+if POLKIT
+       cp $(top_srcdir)/src/connman-polkit.conf $@
+else
+       cp $(top_srcdir)/src/connman-dbus.conf $@
+endif
+
 92-connman.rules: connman.rules
        cp $< $@
diff --git a/src/connman-dbus.conf b/src/connman-dbus.conf
new file mode 100644
index 0000000..b4d4acd
--- /dev/null
+++ b/src/connman-dbus.conf
@@ -0,0 +1,15 @@
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 
1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd";>
+<busconfig>
+    <policy user="root">
+        <allow own="org.moblin.connman"/>
+        <allow send_destination="org.moblin.connman"/>
+        <allow send_interface="org.moblin.connman.Agent"/>
+    </policy>
+    <policy at_console="true">
+        <allow send_destination="org.moblin.connman"/>
+    </policy>
+    <policy context="default">
+        <deny send_destination="org.moblin.connman"/>
+    </policy>
+</busconfig>
diff --git a/src/connman-polkit.conf b/src/connman-polkit.conf
new file mode 100644
index 0000000..9e44b8b
--- /dev/null
+++ b/src/connman-polkit.conf
@@ -0,0 +1,11 @@
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 
1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd";>
+<busconfig>
+    <policy user="root">
+        <allow own="org.moblin.connman"/>
+        <allow send_interface="org.moblin.connman.Agent"/>
+    </policy>
+    <policy context="default">
+        <allow send_destination="org.moblin.connman"/>
+    </policy>
+</busconfig>
diff --git a/src/connman.conf b/src/connman.conf
deleted file mode 100644
index 55f76d6..0000000
--- a/src/connman.conf
+++ /dev/null
@@ -1,16 +0,0 @@
-<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 
1.0//EN"
- "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd";>
-<busconfig>
-    <policy user="root">
-        <allow own="org.moblin.connman"/>
-        <allow send_destination="org.moblin.connman"/>
-        <allow send_interface="org.moblin.connman.Agent"/>
-    </policy>
-    <policy at_console="true">
-        <allow send_destination="org.moblin.connman"/>
-    </policy>
-    <policy context="default">
-        <!-- use "allow" with enabled PolicyKit support -->
-        <deny send_destination="org.moblin.connman"/>
-    </policy>
-</busconfig>
diff --git a/src/device.c b/src/device.c
index d865ad4..4575dd2 100644
--- a/src/device.c
+++ b/src/device.c
@@ -976,6 +976,7 @@ int connman_device_set_carrier(struct connman_device 
*device,
 
 static void connect_known_network(struct connman_device *device)
 {
+       struct connman_network *network = NULL;
        GHashTableIter iter;
        gpointer key, value;
        unsigned int count = 0;
@@ -985,13 +986,37 @@ static void connect_known_network(struct connman_device 
*device)
        g_hash_table_iter_init(&iter, device->networks);
 
        while (g_hash_table_iter_next(&iter, &key, &value) == TRUE) {
-               struct connman_network *network = value;
-               int err;
+               connman_uint8_t old_priority, new_priority;
+               connman_uint8_t old_strength, new_strength;
 
                count++;
 
-               if (connman_network_get_remember(network) == FALSE)
+               if (connman_network_get_remember(value) == FALSE)
+                       continue;
+
+               if (network == NULL) {
+                       network = value;
+                       continue;
+               }
+
+               old_priority = connman_network_get_uint8(network, "Priority");
+               new_priority = connman_network_get_uint8(value, "Priority");
+
+               if (new_priority != old_priority) {
+                       if (new_priority > old_priority)
+                               network = value;
                        continue;
+               }
+
+               old_strength = connman_network_get_uint8(network, "Strength");
+               new_strength = connman_network_get_uint8(value, "Strength");
+
_______________________________________________
Commits mailing list
[email protected]
https://lists.moblin.org/mailman/listinfo/commits

Reply via email to