+++ /dev/null
-# git ls-files --others --exclude-from=.git/info/exclude
-# Lines that start with '#' are comments.
-# For a project mostly in C, the following would be a good set of
-# exclude patterns (uncomment them if you want to use them):
-# *.[oa]
-# *~
-build_log
-*.log
-*.pyc
-usr
-opt
-*.o
-*.a
-*.os
-*.exe
-packages
-binaries
-*.ipk
-*~
-*.lo
-*.la
-.deps
-.libs
-.dirstamp
-Makefile
-Makefile.in
-aclocal.m4
-build-stamp
-client/cm
-config.guess
-config.h
-config.h.in
-config.log
-config.status
-config.sub
-configure
-connman.pc
-debian/connman-dev.install
-debian/connman.install
-debian/net.connman.service
-debian/connman-dbg.substvars
-debian/connman-dbg
-debian/connman-dev.substvars
-debian/connman-dev
-debian/connman.substvars
-debian/connman
-debian/files
-debian/tmp
-depcomp
-compile
-doc/version.xml
-include/connman/
-include/version.h
-install-sh
-libtool
-ltmain.sh
-missing
-stamp-h1
-autom4te.cache
-
-connman.pc
-include/connman
-include/version.h
-src/builtin.h
-src/connmand
-src/connman.conf
-src/connman.service
-src/*-connman.rules
-plugins/connman.policy
-scripts/connman
-scripts/openconnect-script
-client/cm
-tools/wispr
-tools/dhcp-test
-tools/dhcp-server-test
-tools/addr-test
-tools/tap-test
-tools/web-test
-tools/wpad-test
-tools/resolv-test
-tools/polkit-test
-tools/iptables-test
-tools/supplicant-test
-tools/alg-test
-tools/dbus-test
-tools/stats-tool
-tools/stats-ringbuffer-dump
-tools/private-network-test
-unit/test-session
-
-doc/*.bak
-doc/*.stamp
-doc/connman.*
-doc/connman-*.txt
-doc/*.sgml
-doc/version.xml
-doc/xml
-doc/html
-.cproject
-.project
--enable-wifi \
--enable-bluetooth \
--enable-ofono \
- --enable-sonet \
+ --enable-telephony \
--enable-tizen-ext \
- --enable-alwayson \
--enable-pacrunner \
--enable-google \
--enable-meego \
endif
endif
-if SONET
-if SONET_BUILTIN
-builtin_modules += sonet
-builtin_sources += plugins/sonet.c
+if TELEPHONY
+if TELEPHONY_BUILTIN
+builtin_modules += telephony
+builtin_sources += plugins/telephony.c
else
-plugin_LTLIBRARIES += plugins/sonet.la
-plugin_objects += $(plugins_sonet_la_OBJECTS)
-plugins_sonet_la_CFLAGS = $(plugin_cflags)
-plugins_sonet_la_LDFLAGS = $(plugin_ldflags)
-endif
-endif
-
-if ALWAYSON
-if ALWAYSON_BUILTIN
-builtin_modules += alwayson
-builtin_sources += plugins/alwayson.c
-else
-plugin_LTLIBRARIES += plugins/alwayson.la
-plugin_objects += $(plugins_alwayson_la_OBJECTS)
-plugins_alwayson_la_CFLAGS = $(plugin_cflags)
-plugins_alwayson_la_LDFLAGS = $(plugin_ldflags)
+plugin_LTLIBRARIES += plugins/telephony.la
+plugin_objects += $(plugins_telephony_la_OBJECTS)
+plugins_telephony_la_CFLAGS = $(plugin_cflags)
+plugins_telephony_la_LDFLAGS = $(plugin_ldflags)
endif
endif
AC_ARG_ENABLE(ethernet,
AC_HELP_STRING([--enable-ethernet], [enable Ethernet support]),
- [enable_ethernet=${enableval}], [enable_ethernet="no"])
+ [enable_ethernet=${enableval}], [enable_ethernet="yes"])
AM_CONDITIONAL(ETHERNET, test "${enable_ethernet}" != "no")
AM_CONDITIONAL(ETHERNET_BUILTIN, test "${enable_ethernet}" = "builtin")
AM_CONDITIONAL(OFONO, test "${enable_ofono}" != "no")
AM_CONDITIONAL(OFONO_BUILTIN, test "${enable_ofono}" = "builtin")
-AC_ARG_ENABLE(sonet,
- AC_HELP_STRING([--enable-sonet], [enable Sonet support]),
- [enable_sonet=${enableval}], [enable_sonet="no"])
-AM_CONDITIONAL(SONET, test "${enable_sonet}" != "no")
-AM_CONDITIONAL(SONET_BUILTIN, test "${enable_sonet}" = "builtin")
-
-AC_ARG_ENABLE(alwayson,
- AC_HELP_STRING([--enable-alwayson], [enable AlwaysOn support]),
- [enable_alwayson=${enableval}], [enable_alwayson="no"])
-AM_CONDITIONAL(ALWAYSON, test "${enable_alwayson}" != "no")
-AM_CONDITIONAL(ALWAYSON_BUILTIN, test "${enable_alwayson}" = "builtin")
+AC_ARG_ENABLE(telephony,
+ AC_HELP_STRING([--enable-telephony], [enable Telephony support]),
+ [enable_telephony=${enableval}], [enable_telephony="yes"])
+AM_CONDITIONAL(TELEPHONY, test "${enable_telephony}" != "no")
+AM_CONDITIONAL(TELEPHONY_BUILTIN, test "${enable_telephony}" = "builtin")
AC_ARG_ENABLE(tizen-ext, AC_HELP_STRING([--enable-tizen-ext],
[enable TIZEN extensions]), [
+connman (0.77.2-0slp2+75) unstable; urgency=low
+
+ * Fix a bug which connman can't update MAC address of Wi-Fi
+ * Git: pkgs/c/connman
+ * Tag: connman_0.77.2-0slp2+75
+
+ -- root <jeik01.kim@samsung.com> Thu, 12 Apr 2012 18:23:04 +0900
+
+connman (0.77.2-0slp2+74) unstable; urgency=low
+
+ * Fix cellular profile add bugs
+ * Git: pkgs/c/connman
+ * Tag: connman_0.77.2-0slp2+74
+
+ -- Jaehyun Kim <jeik01.kim@samsung.com> Mon, 09 Apr 2012 17:47:31 +0900
+
+connman (0.77.2-0slp2+73) unstable; urgency=low
+
+ * Fix Wi-Fi tethering state bugs
+ * Git: pkgs/c/connman
+ * Tag: connman_0.77.2-0slp2+73
+
+ -- Danny Jeongseok Seo <s.seo@samsung.com> Mon, 02 Apr 2012 14:14:38 +0900
+
+connman (0.77.2-0slp2+72) unstable; urgency=low
+
+ * Fix default network info update
+ * Git: pkgs/c/connman
+ * Tag: connman_0.77.2-0slp2+72
+
+ -- Danny Jeongseok Seo <s.seo@samsung.com> Thu, 29 Mar 2012 21:48:36 +0900
+
+connman (0.77.2-0slp2+71) unstable; urgency=low
+
+ * Fix bugs on event handling(flight mode/data allowed/roaming)
+ * Git: pkgs/c/connman
+ * Tag: connman_0.77.2-0slp2+71
+
+ -- Jaehyun Kim <jeik01.kim@samsung.com> Fri, 23 Mar 2012 19:27:26 +0900
+
+connman (0.77.2-0slp2+70) unstable; urgency=low
+
+ * Enable ConnMan debug log for developers
+ * Git: pkgs/c/connman
+ * Tag: connman_0.77.2-0slp2+70
+
+ -- Danny Jeongseok Seo <s.seo@samsung.com> Thu, 22 Mar 2012 20:00:15 +0900
+
+connman (0.77.2-0slp2+69) unstable; urgency=low
+
+ * Revise Wi-Fi device scan
+ * If deivce is connecing, do no make scan
+ * Git: pkgs/c/connman
+ * Tag: connman_0.77.2-0slp2+69
+
+ -- Danny Jeongseok Seo <s.seo@samsung.com> Fri, 16 Mar 2012 17:09:01 +0900
+
+connman (0.77.2-0slp2+68) unstable; urgency=low
+
+ * Fix ConnMan __connman_service_connect_default
+ * Git: pkgs/c/connman
+ * Tag: connman_0.77.2-0slp2+68
+
+ -- Danny Jeongseok Seo <s.seo@samsung.com> Fri, 16 Mar 2012 16:46:34 +0900
+
+connman (0.77.2-0slp2+67) unstable; urgency=low
+
+ * Revise New Telephony DBus interface name
+ * Git: pkgs/c/connman
+ * Tag: connman_0.77.2-0slp2+67
+
+ -- Danny Jeongseok Seo <s.seo@samsung.com> Thu, 15 Mar 2012 13:31:17 +0900
+
+connman (0.77.2-0slp2+66) unstable; urgency=low
+
+ * Rename sonet plug-in to telephony plug-in
+ * Git: pkgs/c/connman
+ * Tag: connman_0.77.2-0slp2+66
+
+ -- Danny Jeongseok Seo <s.seo@samsung.com> Fri, 09 Mar 2012 17:37:20 +0900
+
+connman (0.77.2-0slp2+65) unstable; urgency=low
+
+ * Write log routine without syslogd
+ * Git: pkgs/c/connman
+ * Tag: connman_0.77.2-0slp2+65
+
+ -- Danny Jeongseok Seo <s.seo@samsung.com> Fri, 09 Mar 2012 16:35:07 +0900
+
+connman (0.77.2-0slp2+64) unstable; urgency=low
+
+ * Revise connection management of Tizen data network to fit New Telepony
+ * Git: pkgs/c/connman
+ * Tag: connman_0.77.2-0slp2+64
+
+ -- Danny Jeongseok Seo <s.seo@samsung.com> Fri, 09 Mar 2012 11:33:46 +0900
+
connman (0.77.2-0slp2+63) unstable; urgency=low
* Change sonet's dbus service name
@PREFIX@/share/dbus-1/services/*
@PREFIX@/etc/dbus-1/system.d/*
@PREFIX@/etc/connman/main.conf
+/var/lib/connman/default.profile
/etc/rc.d/init.d/connman
/etc/rc.d/rc3.d/S61connman
/etc/rc.d/rc5.d/S61connman
--- /dev/null
+#!/bin/sh
+
+chmod 600 /var/lib/connman/default.profile
+
CONFIGURE_ARGS = \
--localstatedir=/var \
--enable-threads \
- --enable-sonet \
--enable-tizen-ext \
- --enable-alwayson \
--enable-wifi=builtin \
$(NULL)
# --enable-debug \
# $(NULL)
-
-
configure: configure.ac
./autogen.sh
clean:
dh_testdir
dh_testroot
- rm -f build-stamp
+ rm -f build-stamp
# Add here commands to clean up after the build process.
-$(MAKE) distclean
-ifneq "$(wildcard /usr/share/misc/config.sub)" ""
- cp -f /usr/share/misc/config.sub config.sub
-endif
-ifneq "$(wildcard /usr/share/misc/config.guess)" ""
- cp -f /usr/share/misc/config.guess config.guess
-endif
for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
rm -f $${f%.in}; \
done
+ rm -f depcomp
+ rm -f compile
+ rm -f missing
+ rm -f ltmain.sh
+ rm -f install-sh
+ rm -f config.guess
+ rm -f configh.h
+ rm -f config.h.in
+ rm -f config.log
+ rm -f config.sub
+ rm -f config.guess
+ rm -f configure
+ rm -f Makefile.in
+ rm -f aclocal.m4
+ rm -f ../connman_*.deb
+ rm -f ../connman-*.deb
+ rm -f ../connman_*.changes
+ rm -f ../connman_*.dsc
+ rm -f ../connman_*.tar.gz
+
dh_clean
install: build
dh_testdir
dh_testroot
- dh_clean -k
+ dh_clean -k
dh_installdirs
# Add here commands to install the package into debian/connman.
$(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
+ mkdir -p $(CURDIR)/debian/tmp/var/lib/connman
+ cp -f $(CURDIR)/resources/var/lib/connman/default.profile \
+ $(CURDIR)/debian/tmp/var/lib/connman/default.profile
mkdir -p $(CURDIR)/debian/tmp$(PREFIX)/share/dbus-1/services
- cp -f $(CURDIR)/debian/net.connman.service \
- $(CURDIR)/debian/tmp$(PREFIX)/share/dbus-1/services
- mkdir -p $(CURDIR)/debian/tmp$(PREFIX)/etc
+ cp -f $(CURDIR)/resources$(PREFIX)/share/dbus-1/services/net.connman.service \
+ $(CURDIR)/debian/tmp$(PREFIX)/share/dbus-1/services/net.connman.service
mkdir -p $(CURDIR)/debian/tmp$(PREFIX)/etc/connman
- cp -f $(CURDIR)/src/main.conf $(CURDIR)/debian/tmp$(PREFIX)/etc/connman
+ cp -f $(CURDIR)/src/main.conf $(CURDIR)/debian/tmp$(PREFIX)/etc/connman/main.conf
mkdir -p $(CURDIR)/debian/tmp/etc/rc.d/init.d
- cp -f $(CURDIR)/etc/rc.d/init.d/connman $(CURDIR)/debian/tmp/etc/rc.d/init.d/connman
+ cp -f $(CURDIR)/resources/etc/rc.d/init.d/connman \
+ $(CURDIR)/debian/tmp/etc/rc.d/init.d/connman
mkdir -p $(CURDIR)/debian/tmp/etc/rc.d/rc3.d
ln -s ../init.d/connman $(CURDIR)/debian/tmp/etc/rc.d/rc3.d/S61connman
mkdir -p $(CURDIR)/debian/tmp/etc/rc.d/rc5.d
binary-arch: build install
dh_testdir
dh_testroot
-# dh_installchangelogs
+# dh_installchangelogs
# dh_installdocs
# dh_installexamples
dh_install --sourcedir=debian/tmp
# dh_installmenu
-# dh_installdebconf
+# dh_installdebconf
# dh_installlogrotate
# dh_installemacsen
# dh_installpam
method calls are disallowed.
The default value is false.
-
- byte ScanMode [readwrite]
- This decides background scan interval. It should be one of
- 0(default-300s), 1(periodic-10s) and 2(exponential-4,8,16,...,128s).
- Background scan trigger is restarted if the same mode is set again.
-
- The default value is 0.
-
int connman_device_set_powered(struct connman_device *device,
connman_bool_t powered);
#if defined TIZEN_EXT
-int connman_device_set_cellular_service_enabled(struct connman_device *device, connman_bool_t enabled);
/*
* Description: It checks significant and effective Wi-Fi profiles which can make an auto-connection.
* It saves power consumption not to scan if there is no valid profile to make an auto-connection.
void __connman_ipconfig_disable_ipv6(struct connman_ipconfig *ipconfig);
void __connman_ipconfig_enable_ipv6(struct connman_ipconfig *ipconfig);
-#if defined TIZEN_EXT
-const char *connman_ipconfig_get_local(struct connman_ipconfig *ipconfig);
-#endif
-
-
#ifdef __cplusplus
}
#endif
struct connman_debug_desc {
const char *name;
const char *file;
+#if defined TIZEN_EXT
+#define CONNMAN_DEBUG_FLAG_DEFAULT (1)
+#else
#define CONNMAN_DEBUG_FLAG_DEFAULT (0)
+#endif
#define CONNMAN_DEBUG_FLAG_PRINT (1 << 0)
#define CONNMAN_DEBUG_FLAG_ALIAS (1 << 1)
unsigned int flags;
__attribute__((used, section("__debug"), aligned(8))) = { \
.file = __FILE__, .flags = CONNMAN_DEBUG_FLAG_DEFAULT, \
}; \
- connman_debug("%s:%s() " fmt, __FILE__, __FUNCTION__ , ## arg); \
- /*if (__connman_debug_desc.flags & CONNMAN_DEBUG_FLAG_PRINT) \
+ if (__connman_debug_desc.flags & CONNMAN_DEBUG_FLAG_PRINT) \
connman_debug("%s:%s() " fmt, \
__FILE__, __FUNCTION__ , ## arg); \
- */\
} while (0)
#ifdef __cplusplus
const char *domain);
#if defined TIZEN_EXT
/*
- * Description: SONET plug-in requires manual PROXY setting function
+ * Description: Telephony plug-in requires manual PROXY setting function
*/
int connman_network_set_proxy(struct connman_network *network,
const char *proxies);
int connman_network_set_enc_mode(struct connman_network *network,
const char *encryption_mode);
const char *connman_network_get_enc_mode(struct connman_network *network);
+
+const char *connman_network_get_ifname(struct connman_network *network);
#endif
int connman_network_set_name(struct connman_network *network,
void (*service_enabled) (enum connman_service_type type,
connman_bool_t enabled);
void (*offline_mode) (connman_bool_t enabled);
-#if defined TIZEN_EXT
- void (*cellular_service_enabled) (connman_bool_t enabled);
-#endif
void (*proxy_changed) (struct connman_service *service);
void (*service_state_changed) (struct connman_service *service,
enum connman_service_state state);
const char *connman_service_get_proxy_autoconfig(struct connman_service *service);
#if defined TIZEN_EXT
-struct connman_ipconfig* connman_service_get_ipv4config(struct connman_service* service);
-struct connman_network* connman_service_get_network(struct connman_service* service);
-int connman_service_connect(struct connman_service* service);
-int connman_service_disconnect(struct connman_service* service);
-struct connman_service* connman_service_lookup_from_network(struct connman_network * network);
-void connman_service_set_alwayson(struct connman_service *service, connman_bool_t state);
-#endif
-
-#if defined TIZEN_EXT
/*
* Description: TIZEN implements system global connection management.
* It's only for PDP (cellular) bearer. Wi-Fi is managed by ConnMan automatically.
*/
/*
- * Increase reference count of user-initiated pdp connection
+ * Increase reference count of user-initiated packet data network connection
*/
-void connman_service_user_initiated_pdp_connection_ref(struct connman_service *service);
+void connman_service_user_initiated_pdn_connection_ref(struct connman_service *service);
/*
- * Decrease reference count of user initiated pdp connection and return TRUE if counter is zero.
+ * Decrease reference count of user initiated packet data network connection and return TRUE if counter is zero.
*/
-connman_bool_t connman_service_user_initiated_pdp_connection_unref_and_test(struct connman_service *service);
+connman_bool_t connman_service_user_initiated_pdn_connection_unref_and_test(struct connman_service *service);
/*
- * Test reference count of user initiated pdp connection and return TRUE if counter is zero.
+ * Test reference count of user initiated packet data network connection and return TRUE if counter is zero.
* No impact to reference count
*/
-connman_bool_t connman_service_is_no_ref_user_initiated_pdp_connection(struct connman_service *service);
+connman_bool_t connman_service_is_no_ref_user_initiated_pdn_connection(struct connman_service *service);
#endif
#ifdef __cplusplus
connman_bool_t connman_setting_get_bool(const char *key);
-#if defined TIZEN_EXT
-connman_uint16_t connman_setting_get_int(const char * key);
-#endif
#ifdef __cplusplus
}
#endif
+#sbs-git:pkgs/c/connman connman 0.77.2
+
Name: connman
Summary: Connection Manager
-Version: 0.77.2
+Version: 0.77.2_75
Release: 1
-Group: System/Networking
-License: GPLv2
-URL: http://connman.net/
-Source0: http://www.kernel.org/pub/linux/network/connman/connman-%{version}.tar.gz
-Patch0: connman_args.patch
-Requires: wpa_supplicant >= 0.7.1
-BuildRequires: pkgconfig(libiptc)
-BuildRequires: pkgconfig(xtables)
+Group: System/Network
+License: GNU General Public License version 2
+URL: http://connman.net
+Source0: %{name}-%{version}.tar.gz
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(dbus-1)
-BuildRequires: pkgconfig(libudev) >= 145
-
+BuildRequires: pkgconfig(xtables)
+BuildRequires: pkgconfig(libiptc)
%description
Connection Manager provides a daemon for managing Internet connections
within embedded devices running the Linux operating system.
+%prep
+%setup -q
-%package devel
-Summary: Development files for Connection Manager
-Group: Development/Libraries
-Requires: %{name} = %{version}-%{release}
+%build
-%description devel
-connman-devel contains development files for use with connman.
+./autogen.sh
-%package test
-Summary: Test Scripts for Connection Manager
-Group: Development/Tools
-Requires: %{name} = %{version}-%{release}
-Requires: dbus-python
-Requires: pygobject2
-
-%description test
-Scripts for testing Connman and its functionality
+./configure --prefix=/usr \
+ --localstatedir=/var \
+ --enable-threads \
+ --enable-tizen-ext \
+ --enable-wifi=builtin
-%prep
-%setup -q -n %{name}-%{version}
-%patch0 -p1
-
-%build
-./bootstrap
-%configure \
- --localstatedir=/var \
-%ifarch %ix86
- --enable-ethernet \
- --enable-wifi \
-%endif
- --enable-threads \
- --enable-sonet \
- --enable-tizen-ext \
- --enable-alwayson \
- --enable-test
make %{?jobs:-j%jobs}
%install
+rm -rf %{buildroot}
%make_install
+mkdir -p %{buildroot}/var/lib/connman
+cp resources/var/lib/connman/default.profile %{buildroot}/var/lib/connman/default.profile
+mkdir -p %{buildroot}/usr/share/dbus-1/services
+cp resources/usr/share/dbus-1/services/net.connman.service %{buildroot}/usr/share/dbus-1/services/net.connman.service
+mkdir -p %{buildroot}/usr/etc/connman
+cp src/main.conf %{buildroot}/usr/etc/connman/main.conf
mkdir -p %{buildroot}/etc/rc.d/init.d
-cp etc/rc.d/init.d/connman %{buildroot}/etc/rc.d/init.d/connman
+cp resources/etc/rc.d/init.d/connman %{buildroot}/etc/rc.d/init.d/connman
+mkdir -p %{buildroot}/etc/rc.d/rc3.d
+ln -s ../init.d/connman %{buildroot}/etc/rc.d/rc3.d/S61connman
+mkdir -p %{buildroot}/etc/rc.d/rc5.d
+ln -s ../init.d/connman %{buildroot}/etc/rc.d/rc5.d/S61connman
-%post
+rm -rf %{buildroot}/usr/include/
+rm -rf %{buildroot}/usr/lib/pkgconfig/
+rm %{buildroot}/etc/dbus-1/system.d/*.conf
-ln -sf ../init.d/connman /etc/rc.d/rc3.d/S61connman
-ln -sf ../init.d/connman /etc/rc.d/rc5.d/S61connman
+mkdir -p %{buildroot}/usr/etc/dbus-1/system.d/
+cp src/connman.conf %{buildroot}/usr/etc/dbus-1/system.d/
-%files
-%doc COPYING
-%{_sbindir}/*
-/usr/lib/connman/plugins/*.so
-/etc/rc.d/init.d/connman
-%config %{_sysconfdir}/dbus-1/system.d/*.conf
+%post
+#Resource
+chmod 600 /var/lib/connman/default.profile
-%files devel
-%{_includedir}/%{name}/*.h
-%{_libdir}/pkgconfig/*.pc
-%files test
-%defattr(-,root,root,-)
-%{_libdir}/%{name}/test/*
+%files
+%defattr(-,root,root,-)
+#%doc AUTHORS COPYING INSTALL ChangeLog NEWS README
+%{_sbindir}/*
+%{_var}/lib/connman/default.profile
+%{_libdir}/connman/plugins/*.so
+%{_datadir}/dbus-1/services/*
+%{_prefix}/etc/dbus-1/system.d/*
+%{_prefix}/etc/connman/main.conf
+%{_prefix}/etc/dbus-1/system.d/*.conf
+%{_sysconfdir}/rc.d/init.d/connman
+%{_sysconfdir}/rc.d/rc3.d/S61connman
+%{_sysconfdir}/rc.d/rc5.d/S61connman
+++ /dev/null
- /*
- *
- * Connection Manager
- *
- * Copyright (C) 2007-2010 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
- *
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <glib.h>
-#include <string.h>
-#include <gdbus.h>
-#include <errno.h>
-#include <stdlib.h>
-
-#define CONNMAN_API_SUBJECT_TO_CHANGE
-#include <connman/plugin.h>
-#include <connman/notifier.h>
-#include <connman/service.h>
-#include <connman/network.h>
-#include <connman/ipconfig.h>
-#include <connman/dbus.h>
-#include <connman/log.h>
-
-#define TIMEOUT_DEFAULT 5
-#define TIMEOUT_MAX 1280
-
-guint connection_timeout;
-guint timer_src;
-static gboolean cellular_enabled = FALSE;
-
-static DBusConnection *connection;
-struct connman_service *celluar_default_service;
-struct connman_service *connected_default_service;
-
-int __request_service_connect(struct connman_service *service);
-void __request_service_disconnect(struct connman_service *service);
-void __unset_default_connected_service(struct connman_service *service, enum connman_service_state state);
-void __set_default_connected_service(struct connman_service *service, enum connman_service_state state);
-static gboolean __connect_timeout_handler(gpointer user_data);
-static void __reset_retry_timer(void);
-
-//tmp code - send the default connection info to sonet
-static int __dbus_request(const char *path, const char *interface, const char *method,
- DBusPendingCallNotifyFunction notify, void *user_data,
- DBusFreeFunction free_function, int type, ...);
-void __send_default_connection_info(struct connman_service *service, enum connman_service_state state);
-
-const char *__always_on_service_type2string(enum connman_service_type type)
-{
- switch (type) {
- case CONNMAN_SERVICE_TYPE_UNKNOWN:
- break;
- case CONNMAN_SERVICE_TYPE_SYSTEM:
- return "system";
- case CONNMAN_SERVICE_TYPE_ETHERNET:
- return "ethernet";
- case CONNMAN_SERVICE_TYPE_WIFI:
- return "wifi";
- case CONNMAN_SERVICE_TYPE_WIMAX:
- return "wimax";
- case CONNMAN_SERVICE_TYPE_BLUETOOTH:
- return "bluetooth";
- case CONNMAN_SERVICE_TYPE_CELLULAR:
- return "cellular";
- case CONNMAN_SERVICE_TYPE_GPS:
- return "gps";
- case CONNMAN_SERVICE_TYPE_VPN:
- return "vpn";
- case CONNMAN_SERVICE_TYPE_GADGET:
- return "gadget";
- }
-
- return NULL;
-}
-
-const char *__always_on_state2string(enum connman_service_state state)
-{
- switch (state) {
- case CONNMAN_SERVICE_STATE_UNKNOWN:
- break;
- case CONNMAN_SERVICE_STATE_IDLE:
- return "idle";
- case CONNMAN_SERVICE_STATE_ASSOCIATION:
- return "association";
- case CONNMAN_SERVICE_STATE_CONFIGURATION:
- return "configuration";
- case CONNMAN_SERVICE_STATE_READY:
- return "ready";
- case CONNMAN_SERVICE_STATE_ONLINE:
- return "online";
- case CONNMAN_SERVICE_STATE_DISCONNECT:
- return "disconnect";
- case CONNMAN_SERVICE_STATE_FAILURE:
- return "failure";
- }
-
- return NULL;
-}
-
-
-static void __always_on_service_added(struct connman_service *service, const char *name)
-{
- DBG("service added notifier");
- struct connman_network *network;
- const char *path = NULL;
- int service_type = 0, svc_category_id = 0;
-
- service_type = connman_service_get_type(service);
- network = connman_service_get_network(service);
- path = connman_network_get_string(network,"Name");
-
- if(service_type != CONNMAN_SERVICE_TYPE_CELLULAR){
- DBG("service type is not cellular device");
- return;
- }
-
- gchar **strv;
- int index = 0;
-
- strv = g_strsplit_set(path, "_", -1);
- index = g_strv_length(strv);
- svc_category_id = atoi(strv[index-1]);
- g_strfreev(strv);
-
- DBG("svc category id (%d)",svc_category_id);
-
- //internet service
- if(svc_category_id == 1){
- celluar_default_service = service;
-
- __reset_retry_timer();
-
- DBG("cellular internet service path (%s), service(%p) added", path, service);
-
- if(connected_default_service == NULL){
- DBG("request to connect default cellular service");
- __request_service_connect(service);
- }
- }
-
- return;
-}
-
-static void __always_on_service_removed(struct connman_service *service)
-{
- DBG("service removed notifier");
- int service_type = 0;
-
- service_type = connman_service_get_type(service);
- if(service_type != CONNMAN_SERVICE_TYPE_CELLULAR){
- DBG("service type is not cellular device");
- return;
- }
-
- if(celluar_default_service == service){
- DBG("cellular internet service removed");
- celluar_default_service = NULL;
-
- __reset_retry_timer();
-
- if(connected_default_service == service){
- DBG("default connected service removed");
- connected_default_service = NULL;
- __send_default_connection_info(service, CONNMAN_SERVICE_STATE_IDLE);
- }
- }
-
- return;
-}
-
-static void __always_on_service_enabled(enum connman_service_type type, connman_bool_t enabled)
-{
- DBG("service enabled notifier");
- return;
-}
-
-void __always_on_cellular_service_enabled(connman_bool_t enabled)
-{
- cellular_enabled = enabled;
-
- __reset_retry_timer();
- DBG("device cellular service enabled notifier");
-
- if(celluar_default_service == NULL){
- DBG("no cellular default service");
- return;
- }
-
- if(enabled && connected_default_service == NULL){
- DBG("connect default cellular service");
- __request_service_connect(celluar_default_service);
-
- }
- else if(enabled == FALSE && connected_default_service == celluar_default_service){
- DBG("disconnect default cellular service");
- __request_service_disconnect(celluar_default_service);
- }
-
- return;
-}
-
-static void __always_on_service_state_changed(struct connman_service *service, enum connman_service_state state)
-{
- if(state > CONNMAN_SERVICE_STATE_IDLE && state < CONNMAN_SERVICE_STATE_READY){
- return;
- }
-
- DBG("service state changed service type[%d] state[%d]",connman_service_get_type(service), state);
-
- if(state == CONNMAN_SERVICE_STATE_IDLE){
- __unset_default_connected_service(service, state);
- }
- else if(state == CONNMAN_SERVICE_STATE_READY){
- __set_default_connected_service(service, state);
- }
- else if(state == CONNMAN_SERVICE_STATE_FAILURE && celluar_default_service == service){
- DBG("fail to connect default cellular service(%p)", service);
-
- if(connected_default_service == NULL && cellular_enabled ){
- timer_src = g_timeout_add_seconds(connection_timeout, __connect_timeout_handler, service);
- DBG("cellular service timer started timer src(%d), timeout(%d)", timer_src, connection_timeout);
-
- connection_timeout = connection_timeout*2;
- if(connection_timeout > TIMEOUT_MAX)
- connection_timeout = TIMEOUT_MAX;
- }
-
- }
-
- return;
-}
-
-static void __always_on_service_proxy_changed(struct connman_service *service)
-{
- DBG("service proxy changed notifier");
- int service_state = 0;
-
- if(connected_default_service == NULL ||service != connected_default_service){
- return;
- }
-
- service_state = CONNMAN_SERVICE_STATE_READY;
- __send_default_connection_info(service, service_state);
-
- return;
-}
-
-int __request_service_connect(struct connman_service *service)
-{
- int err = 0;
- int service_type = 0;
-
- if (service == NULL) {
- DBG("requested service is null");
- return;
- }
-
- service_type = connman_service_get_type(service);
- if (service_type == CONNMAN_SERVICE_TYPE_CELLULAR) {
- connman_service_set_alwayson(service, TRUE);
- }
-
- err = connman_service_connect(service);
- DBG("return value (%d)", err);
-
- return err;
-}
-
-void __request_service_disconnect(struct connman_service *service)
-{
- int service_type = 0;
-
- if (service == NULL) {
- DBG("requested service is null");
- return;
- }
-
- service_type = connman_service_get_type(service);
- if (service_type == CONNMAN_SERVICE_TYPE_CELLULAR) {
- connman_service_set_alwayson(service, FALSE);
- }
-
- connman_service_disconnect(service);
- return;
-}
-
-void __unset_default_connected_service(struct connman_service *service, enum connman_service_state state)
-{
- int service_type = 0;
- int err = 0;
- service_type = connman_service_get_type(service);
-
- if(service_type == CONNMAN_SERVICE_TYPE_CELLULAR && celluar_default_service != service){
- DBG("not a default cellular service");
- return;
- }
-
- if(connected_default_service == NULL || connected_default_service == service){
- DBG("request default cellular service connect");
- connected_default_service = NULL;
- __send_default_connection_info(service, state);
- err = __request_service_connect(celluar_default_service);
-
- if (err == -EISCONN) {
- __send_default_connection_info(celluar_default_service, CONNMAN_SERVICE_STATE_READY);
- }
- return;
- }
-
- DBG("current default connected service (%p)", connected_default_service);
- return;
-}
-
-void __set_default_connected_service(struct connman_service *service, enum connman_service_state state)
-{
- int service_type = 0;
- service_type = connman_service_get_type(service);
-
- if(service_type == CONNMAN_SERVICE_TYPE_CELLULAR && celluar_default_service != service){
- DBG("not a default cellular service");
- return;
- }
-
- __reset_retry_timer();
-
- //set default connection service
- if(connected_default_service == NULL || connected_default_service == service ){
- DBG("set connected default service");
- connected_default_service = service;
- __send_default_connection_info(service, state);
- return;
- }
-
- //connected_default_service != service
- if(connected_default_service == celluar_default_service){
- DBG("set connected default service");
- connected_default_service = service;
- __send_default_connection_info(service, state);
- //check cellualr connection user request
- if(connman_service_is_no_ref_user_initiated_pdp_connection(celluar_default_service)){
- __request_service_disconnect(celluar_default_service);
- return;
- }
- }
-
- //disconnect default cellular service when other service is connected
- if(service_type == CONNMAN_SERVICE_TYPE_CELLULAR && celluar_default_service == service){
- DBG("disconnect lazy cellular service");
- if(connman_service_is_no_ref_user_initiated_pdp_connection(celluar_default_service)){
- __request_service_disconnect(celluar_default_service);
- return;
- }
- }
-
- DBG("current default connected service (%p)", connected_default_service);
- return;
-}
-
-static int __dbus_request(const char *path, const char *interface, const char *method,
- DBusPendingCallNotifyFunction notify, void *user_data,
- DBusFreeFunction free_function, int type, ...){
-
- DBG("dbus request");
-
- DBusMessage *message;
- DBusPendingCall *call;
- dbus_bool_t ok;
- va_list va;
-
- DBG("path %s %s.%s", path, interface, method);
-
- if (path == NULL)
- return -EINVAL;
-
- message = dbus_message_new_method_call("net.sonet", path, interface, method);
- if (message == NULL)
- return -ENOMEM;
-
- dbus_message_set_auto_start(message, FALSE);
-
- va_start(va, type);
- ok = dbus_message_append_args_valist(message, type, va);
- va_end(va);
-
- if (!ok)
- return -ENOMEM;
-
- if (dbus_connection_send_with_reply(connection, message, &call, 40000) == FALSE) {
- connman_error("Failed to call %s.%s", interface, method);
- dbus_message_unref(message);
- return -EINVAL;
- }
-
- if (call == NULL) {
- connman_error("D-Bus connection not available");
- dbus_message_unref(message);
- return -EINVAL;
- }
-
- dbus_pending_call_set_notify(call, notify, user_data, free_function);
-
- dbus_message_unref(message);
-
- return -EINPROGRESS;
-}
-
-void __send_default_connection_info(struct connman_service *service, enum connman_service_state state)
-{
- struct connman_ipconfig *ip_config = NULL;
- gchar *connection_type = NULL, *connection_state = NULL, *ip_addr = NULL, *proxy_addr = NULL;
- int service_type = 0;
- gchar **proxy_list = NULL;
-
- service_type = connman_service_get_type(service);
- const char* tmp = __always_on_service_type2string(service_type);
- connection_type = g_strdup(tmp);
-
- tmp = __always_on_state2string(state);
- connection_state = g_strdup(tmp);
-
- ip_config = connman_service_get_ipv4config(service);
- DBG("ip_config %p", ip_config);
- if (ip_config == NULL)
- return;
-
- tmp = connman_ipconfig_get_local(ip_config);
- ip_addr = g_strdup(tmp);
-
- proxy_list = connman_service_get_proxy_servers(service);
- if(proxy_list != NULL){
- proxy_addr = g_strdup(proxy_list[0]);
- }
-
- if(ip_addr == NULL)
- ip_addr = g_strdup("");
-
- if(proxy_addr == NULL)
- proxy_addr = g_strdup("");
-
- __dbus_request("/", "net.sonet.master", "UpdateDefaultConnectionInfo",
- NULL, NULL, NULL,
- DBUS_TYPE_STRING,&connection_type, DBUS_TYPE_STRING,&connection_state,
- DBUS_TYPE_STRING,&ip_addr, DBUS_TYPE_STRING,&proxy_addr,DBUS_TYPE_INVALID);
-
- g_free(connection_type);
- g_free(connection_state);
- g_free(ip_addr);
- g_free(proxy_addr);
- g_strfreev(proxy_list);
-
- return;
-}
-
-static gboolean __connect_timeout_handler(gpointer user_data)
-{
- DBG("connection timeout");
-
- struct connman_service *service = (struct connman_service *)user_data;
-
- __request_service_connect(service);
- timer_src = 0;
-
- return FALSE;
-}
-
-static void __reset_retry_timer(void)
-{
- connection_timeout = TIMEOUT_DEFAULT;
-
- if (timer_src != 0) {
- DBG("remove connection retry timer (%d)", timer_src);
- g_source_remove(timer_src);
- timer_src = 0;
- }
-
- return;
-}
-
-static struct connman_notifier notifier = {
- .name = "alwayson",
- .priority = CONNMAN_NOTIFIER_PRIORITY_HIGH,
- .default_changed = NULL,
- .service_add = __always_on_service_added,
- .service_remove = __always_on_service_removed,
- .service_enabled = __always_on_service_enabled,
- .offline_mode = NULL,
- .cellular_service_enabled = __always_on_cellular_service_enabled,
- .proxy_changed = __always_on_service_proxy_changed,
- .service_state_changed= __always_on_service_state_changed,
- .ipconfig_changed = NULL,
-};
-
-static int alwayson_init(void)
-{
- DBG("alwayson init");
- connection = connman_dbus_get_connection();
- connman_notifier_register(¬ifier);
- connection_timeout = TIMEOUT_DEFAULT;
- return 0;
-}
-
-static void alwayson_exit(void)
-{
- return;
-}
-
-CONNMAN_PLUGIN_DEFINE(alwayson, "AlwaysOn features plugin", VERSION,
- CONNMAN_PLUGIN_PRIORITY_DEFAULT, alwayson_init, alwayson_exit)
#include <connman/technology.h>
#include <connman/log.h>
-#define SONET_SERVICE "net.sonet"
+#define PS_DBUS_SERVICE "com.tcore.ps"
-#define SONET_MASTER_INTERFACE SONET_SERVICE ".master"
-#define SONET_MODEM_INTERFACE SONET_SERVICE ".modem"
-#define SONET_NETWORK_INTERFACE SONET_SERVICE ".network"
+#define PS_MASTER_INTERFACE PS_DBUS_SERVICE ".master"
+#define PS_MODEM_INTERFACE PS_DBUS_SERVICE ".modem"
+#define PS_SERVICE_INTERFACE PS_DBUS_SERVICE ".service"
+#define PS_CONTEXT_INTERFACE PS_DBUS_SERVICE ".context"
//methods
#define GET_MODEMS "GetModems"
-#define GET_NETWORKS "GetNetworks"
-#define ACTIVATE_NETWORK "Activate"
-#define DEACTIVATE_NETWORK "Deactivate"
+#define GET_SERVICES "GetServices"
+#define GET_CONTEXTS "GetContexts"
+#define ACTIVATE_CONTEXT "Activate"
+#define DEACTIVATE_CONTEXT "Deactivate"
#define GET_PROPERTIES "GetProperties"
#define SET_PROPERTY "SetProperties"
//signals
#define MODEM_ADDED "ModemAdded"
#define MODEM_REMOVED "ModemRemoved"
-#define NETWORK_ADDED "NetworkAdded"
-#define NETWORK_REMOVED "NetworkRemoved"
+#define SERVICE_ADDED "ServiceAdded"
+#define SERVICE_REMOVED "ServiceRemoved"
+#define CONTEXT_ADDED "ContextAdded"
+#define CONTEXT_REMOVED "ContextRemoved"
#define PROPERTY_CHANGED "PropertyChanged"
#define TIMEOUT 40000
static DBusConnection *connection;
static GHashTable *modem_hash;
+static GHashTable *service_hash;
static GHashTable *network_hash;
-struct sonet_modem {
+struct telephony_service {
char* path;
- struct connman_device *device;
-
- char *operator;
- gboolean powered; //modem registered (if TAPI is not ready)
- gboolean online; //flight_mode, data_allowed, sim_init
- gboolean sim_init; //sim init
+ gpointer p_modem;
+ char *act;
gboolean roaming; //global roaming state
gboolean ps_attached; //packet service is available
+};
- gboolean roaming_allowed; //roaming setting
+struct telephony_modem {
+ char* path;
+
+ char *operator;
+ gboolean powered;
+ gboolean sim_init;
+ gboolean flight_mode;
+ gboolean data_allowed;
+ gboolean roaming_allowed;
+
+ struct connman_device *device;
+ struct telephony_service *s_service;
};
-struct sonet_network {
+struct telephony_network {
char *path;
struct connman_network *network;
};
// function prototype
-static void sonet_connect(DBusConnection *connection, void *user_data);
-static void sonet_disconnect(DBusConnection *connection, void *user_data);
+static void telephony_connect(DBusConnection *connection, void *user_data);
+static void telephony_disconnect(DBusConnection *connection, void *user_data);
static void __remove_modem(gpointer data);
+static void __remove_service(gpointer data);
static void __remove_network(gpointer data);
static int __modem_probe(struct connman_device *device);
static int __request_get_modems(void);
static void __response_get_modems(DBusPendingCall *call, void *user_data);
-static int __request_get_networks(const char* path);
-static void __response_get_networks(DBusPendingCall *call, void *user_data);
+static int __request_get_services(const char* path);
+static void __response_get_services(DBusPendingCall *call, void *user_data);
+static int __request_get_contexts(struct telephony_modem* modem);
+static void __response_get_contexts(DBusPendingCall *call, void *user_data);
static int __request_network_activate(struct connman_network *network);
static void __response_network_activate(DBusPendingCall *call, void *user_data);
static int __request_network_deactivate(struct connman_network *network);
-// sonet internal function
+// telephony internal function
static void __add_modem(const char *path, DBusMessageIter *prop);
+static void __add_service(struct telephony_modem* modem, const char *service_path, DBusMessageIter *prop);
static void __add_connman_device(const char* modem_path, const char* operator);
-static void __remove_connman_device(struct sonet_modem *modem);
+static void __remove_connman_device(struct telephony_modem *modem);
static void __remove_connman_networks(struct connman_device *device);
-static void __set_device_online(struct sonet_modem *modem, gboolean online);
-static int __check_device_online(const char *path, gboolean online);
+static void __set_device_powered(struct telephony_modem *modem, gboolean powered);
+static int __check_device_powered(const char *path, gboolean online);
static gboolean __check_network_available(struct connman_network *network);
static void __create_service(struct connman_network *network);
-static int __add_network(struct connman_device *device, const char *path, DBusMessageIter *prop);
-static gboolean __set_network_ipconfig(struct sonet_network *network, DBusMessageIter *dict);
-static void __set_network_connected(struct sonet_network *network, gboolean connected);
+static int __add_context(struct connman_device *device, const char *path, DBusMessageIter *prop);
+static gboolean __set_network_ipconfig(struct telephony_network *network, DBusMessageIter *dict);
+static void __set_network_connected(struct telephony_network *network, gboolean connected);
static char *__get_ident(const char *path);
// signal handler
static gboolean __changed_modem(DBusConnection *connection, DBusMessage *message, void *user_data);
static gboolean __added_modem(DBusConnection *connection, DBusMessage *message, void *user_data);
static gboolean __removed_modem(DBusConnection *connection, DBusMessage *message, void *user_data);
-static gboolean __changed_network(DBusConnection *connection, DBusMessage *message, void *user_data);
-static gboolean __added_network(DBusConnection *connection, DBusMessage *message, void *user_data);
-static gboolean __removed_network(DBusConnection *connection, DBusMessage *message, void *user_data);
+static gboolean __changed_service(DBusConnection *connection, DBusMessage *message, void *user_data);
+static gboolean __added_service(DBusConnection *connection, DBusMessage *message, void *user_data);
+static gboolean __removed_service(DBusConnection *connection, DBusMessage *message, void *user_data);
+static gboolean __changed_context(DBusConnection *connection, DBusMessage *message, void *user_data);
+static gboolean __added_context(DBusConnection *connection, DBusMessage *message, void *user_data);
+static gboolean __removed_context(DBusConnection *connection, DBusMessage *message, void *user_data);
// device driver
static struct connman_device_driver modem_driver = {
};
// local function
-static void sonet_connect(DBusConnection *connection, void *user_data)
+static void telephony_connect(DBusConnection *connection, void *user_data)
{
DBG("connection %p", connection);
modem_hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, __remove_modem);
+ service_hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, __remove_service);
network_hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, __remove_network);
__request_get_modems();
return;
}
-static void sonet_disconnect(DBusConnection *connection, void *user_data)
+static void telephony_disconnect(DBusConnection *connection, void *user_data)
{
DBG("connection %p", connection);
static void __remove_modem(gpointer data)
{
- struct sonet_modem *modem = data;
+ struct telephony_modem *modem = data;
__remove_connman_device(modem);
g_free(modem);
}
+static void __remove_service(gpointer data)
+{
+ struct telephony_service *service = data;
+
+ g_free(service->path);
+ g_free(service->act);
+ g_free(service);
+}
+
static void __remove_network(gpointer data)
{
- struct sonet_network *info = data;
+ struct telephony_network *info = data;
struct connman_device *device;
device = connman_network_get_device(info->network);
const char *path = connman_device_get_string(device, "Path");
DBG("device %p, path, %s", device, path);
- return __check_device_online(path, TRUE);
+ return __check_device_powered(path, TRUE);
}
static int __modem_disable(struct connman_device *device)
const char *path = connman_device_get_string(device, "Path");
DBG("device %p, path, %s", device, path);
- return __check_device_online(path, FALSE);
+ return __check_device_powered(path, FALSE);
}
static int __network_probe(struct connman_network *network)
static int __network_connect(struct connman_network *network)
{
struct connman_device *device;
- struct sonet_modem *modem;
+ struct telephony_modem *modem;
DBG("network %p", network);
if (modem->powered == FALSE)
return -ENOLINK;
- if (modem->online == FALSE)
+/* if (modem->online == FALSE)
return -ENOLINK;
if (modem->roaming_allowed == FALSE && modem->roaming == TRUE)
- return -ENOLINK;
+ return -ENOLINK;*/
return __request_network_activate(network);
}
DBusPendingCallNotifyFunction notify, void *user_data,
DBusFreeFunction free_function, int type, ...)
{
- DBG("sonet request");
+ DBG("telephony request");
DBusMessage *message;
DBusPendingCall *call;
if (path == NULL)
return -EINVAL;
- message = dbus_message_new_method_call(SONET_SERVICE, path, interface, method);
+ message = dbus_message_new_method_call(PS_DBUS_SERVICE, path, interface, method);
if (message == NULL)
return -ENOMEM;
{
DBG("request get modem");
//call connect master
- return __dbus_request("/", SONET_MASTER_INTERFACE, GET_MODEMS,
+ return __dbus_request("/", PS_MASTER_INTERFACE, GET_MODEMS,
__response_get_modems, NULL, NULL, DBUS_TYPE_INVALID);
}
return;
}
-static int __request_get_networks(const char* path)
+static int __request_get_services(const char* path)
+{
+ DBG("request get service");
+ return __dbus_request(path,PS_MODEM_INTERFACE,GET_SERVICES,
+ __response_get_services, g_strdup(path), g_free, DBUS_TYPE_INVALID);
+}
+
+static void __response_get_services(DBusPendingCall *call, void *user_data)
+{
+ DBusMessage *reply;
+ DBusError error;
+ DBusMessageIter args, dict;
+
+ const char *path = user_data;
+ struct telephony_modem *modem;
+
+ modem = g_hash_table_lookup(modem_hash, path);
+ if (modem == NULL)
+ return;
+ if (modem->device == NULL)
+ return;
+
+ DBG("");
+
+ reply = dbus_pending_call_steal_reply(call);
+
+ dbus_error_init(&error);
+
+ if (dbus_set_error_from_message(&error, reply)) {
+ connman_error("GetServices() %s %s",error.name, error.message);
+ dbus_error_free(&error);
+ goto done;
+ }
+
+ DBG("message signature (%s)", dbus_message_get_signature(reply));
+
+ if (dbus_message_iter_init(reply, &args) == FALSE)
+ goto done;
+
+ dbus_message_iter_recurse(&args, &dict);
+
+ //DBG("message type (%d) dic(%d)", dbus_message_iter_get_arg_type(&dict), DBUS_TYPE_DICT_ENTRY);
+
+ while (dbus_message_iter_get_arg_type(&dict) != DBUS_TYPE_INVALID) {
+ DBusMessageIter entry, property;
+ const char *service_path;
+
+ dbus_message_iter_recurse(&dict, &entry);
+ dbus_message_iter_get_basic(&entry, &service_path);
+ DBG("service path (%s)", service_path);
+
+ dbus_message_iter_next(&entry);
+ dbus_message_iter_recurse(&entry, &property);
+
+ __add_service(modem, service_path,&property);
+
+ dbus_message_iter_next(&dict);
+ }
+
+done:
+ dbus_message_unref(reply);
+ dbus_pending_call_unref(call);
+ return;
+}
+
+static int __request_get_contexts(struct telephony_modem* modem)
{
- DBG("request get networks");
- return __dbus_request(path,SONET_MODEM_INTERFACE,GET_NETWORKS,
- __response_get_networks, g_strdup(path), g_free, DBUS_TYPE_INVALID);
+ DBG("request get contexts");
+ return __dbus_request(modem->s_service->path,PS_SERVICE_INTERFACE,GET_CONTEXTS,
+ __response_get_contexts, g_strdup(modem->path), g_free, DBUS_TYPE_INVALID);
}
-static void __response_get_networks(DBusPendingCall *call, void *user_data)
+static void __response_get_contexts(DBusPendingCall *call, void *user_data)
{
DBusError error;
DBusMessage *reply;
DBusMessageIter args, dict;
const char *path = user_data;
- struct sonet_modem *modem;
+ struct telephony_modem *modem;
DBG("");
modem = g_hash_table_lookup(modem_hash, path);
if (modem == NULL)
return;
+ if (modem->s_service == NULL)
+ return;
if (modem->device == NULL)
return;
dbus_error_init(&error);
if (dbus_set_error_from_message(&error, reply)) {
- connman_error("GetModem() %s %s",error.name, error.message);
+ connman_error("GetContexts() %s %s",error.name, error.message);
dbus_error_free(&error);
goto done;
}
while (dbus_message_iter_get_arg_type(&dict) != DBUS_TYPE_INVALID) {
DBusMessageIter entry, property;
- const char *network_path;
+ const char *context_path;
dbus_message_iter_recurse(&dict, &entry);
- dbus_message_iter_get_basic(&entry, &network_path);
- DBG("network path (%s)", network_path);
+ dbus_message_iter_get_basic(&entry, &context_path);
+ DBG("context path (%s)", context_path);
dbus_message_iter_next(&entry);
dbus_message_iter_recurse(&entry, &property);
- __add_network(modem->device, network_path, &property);
+ __add_context(modem->device, context_path, &property);
dbus_message_iter_next(&dict);
}
const char *path = connman_network_get_string(network, "Path");
DBG("network %p, path %s", network, path);
- return __dbus_request(path,SONET_NETWORK_INTERFACE,ACTIVATE_NETWORK,
+ return __dbus_request(path,PS_CONTEXT_INTERFACE,ACTIVATE_CONTEXT,
__response_network_activate, g_strdup(path), NULL, DBUS_TYPE_INVALID);
}
DBusError error;
DBusMessage *reply;
- struct sonet_network *info;
+ struct telephony_network *info;
const char* path = user_data;
info = g_hash_table_lookup(network_hash, path);
goto done;
}
- if (connman_network_get_index(info->network) >= 0)
- __set_network_connected(info, TRUE);
-
done:
dbus_message_unref(reply);
dbus_pending_call_unref(call);
const char *path = connman_network_get_string(network, "Path");
DBG("network %p, path %s", network, path);
- return __dbus_request(path,SONET_NETWORK_INTERFACE,DEACTIVATE_NETWORK,
+ return __dbus_request(path,PS_CONTEXT_INTERFACE,DEACTIVATE_CONTEXT,
NULL, NULL, NULL, DBUS_TYPE_INVALID);
}
static void __add_modem(const char *path, DBusMessageIter *prop)
{
- struct sonet_modem *modem;
+ struct telephony_modem *modem;
modem = g_hash_table_lookup(modem_hash, path);
if (modem != NULL)
return;
- modem = (struct sonet_modem *)malloc( sizeof(struct sonet_modem));
- memset(modem, 0, sizeof(struct sonet_modem));
+ modem = (struct telephony_modem *)malloc( sizeof(struct telephony_modem));
+ memset(modem, 0, sizeof(struct telephony_modem));
modem->path = g_strdup(path);
modem->device = NULL;
+ modem->s_service = NULL;
g_hash_table_insert(modem_hash, g_strdup(path), modem);
modem->powered = STRING2BOOL(tmp);
} else if (g_str_equal(key, "operator") == TRUE) {
modem->operator = g_strdup(tmp);
- } else if (g_str_equal(key, "roaming") == TRUE) {
- modem->roaming = STRING2BOOL(tmp);
- } else if (g_str_equal(key, "roaming_allowed") == TRUE) {
- modem->roaming_allowed = STRING2BOOL(tmp);
- } else if (g_str_equal(key, "online") == TRUE) {
- modem->online = STRING2BOOL(tmp);
} else if (g_str_equal(key, "sim_init") == TRUE) {
modem->sim_init = STRING2BOOL(tmp);
- } else if (g_str_equal(key, "ps_attached") == TRUE) {
- modem->ps_attached = STRING2BOOL(tmp);
+ } else if (g_str_equal(key, "flight_mode") == TRUE) {
+ modem->flight_mode = STRING2BOOL(tmp);
+ } else if (g_str_equal(key, "roaming_allowed") == TRUE) {
+ modem->roaming_allowed = STRING2BOOL(tmp);
+ } else if (g_str_equal(key, "data_allowed") == TRUE) {
+ modem->data_allowed = STRING2BOOL(tmp);
}
-
dbus_message_iter_next(prop);
}
+ __add_connman_device(path, modem->operator);
+ __set_device_powered(modem, modem->powered);
+
if (modem->powered != TRUE) {
DBG("modem is not powered");
return;
}
- __set_device_online(modem, modem->online);
+ __request_get_services(modem->path);
+
+ return;
+}
+
+static void __add_service(struct telephony_modem* modem, const char *service_path, DBusMessageIter *prop)
+{
+ struct telephony_service *service;
- if (modem->online != TRUE) {
- DBG("modem is now off-line. do nothing");
+ if (modem->s_service != NULL)
return;
+
+ service = (struct telephony_service *)malloc( sizeof(struct telephony_service));
+ memset(service, 0, sizeof(struct telephony_service));
+
+ service->path = g_strdup(service_path);
+ service->p_modem = modem;
+ g_hash_table_insert(service_hash, g_strdup(service_path), service);
+
+ while (dbus_message_iter_get_arg_type(prop) != DBUS_TYPE_INVALID) {
+ DBusMessageIter entry;
+ const char *key, *tmp;
+
+ dbus_message_iter_recurse(prop, &entry);
+ dbus_message_iter_get_basic(&entry, &key);
+
+ dbus_message_iter_next(&entry);
+ dbus_message_iter_get_basic(&entry, &tmp);
+
+ DBG("key (%s) value(%s)", key, tmp);
+
+ if (g_str_equal(key, "roaming") == TRUE) {
+ service->roaming = STRING2BOOL(tmp);
+ } else if (g_str_equal(key, "act") == TRUE) {
+ service->act = g_strdup(tmp);
+ } else if (g_str_equal(key, "ps_attached") == TRUE) {
+ service->ps_attached = STRING2BOOL(tmp);
+ }
+
+ dbus_message_iter_next(prop);
}
- __add_connman_device(path, modem->operator);
+ modem->s_service = service;
+ __request_get_contexts(modem);
return;
}
static void __add_connman_device(const char* modem_path, const char* operator)
{
- struct sonet_modem *modem;
+ struct telephony_modem *modem;
struct connman_device *device;
DBG("path %s operator %s", modem_path, operator);
modem->device = device;
- if (modem->online == TRUE)
- __request_get_networks(modem_path);
-
return;
}
-static void __remove_connman_device(struct sonet_modem *modem)
+static void __remove_connman_device(struct telephony_modem *modem)
{
DBG("modem %p path %s device %p", modem, modem->path, modem->device);
g_hash_table_iter_init(&iter, network_hash);
while (g_hash_table_iter_next(&iter, &key, &value) == TRUE) {
- struct sonet_network *info = value;
+ struct telephony_network *info = value;
if (connman_network_get_device(info->network) != device)
continue;
}
for (list = info_list; list != NULL; list = list->next) {
- struct sonet_network *info = list->data;
+ struct telephony_network *info = list->data;
connman_device_remove_network(device, info->network);
}
g_slist_free(info_list);
}
-static void __set_device_online(struct sonet_modem *modem, gboolean online)
+static void __set_device_powered(struct telephony_modem *modem, gboolean powered)
{
- DBG("set modem(%s) online(%d)", modem->path, online);
- modem->online = online;
+ DBG("set modem(%s) powered(%d)", modem->path, powered);
if (modem->device) {
- connman_device_set_powered(modem->device, online);
+ connman_device_set_powered(modem->device, powered);
}
return;
}
-static int __check_device_online(const char *path, gboolean online)
+static int __check_device_powered(const char *path, gboolean powered)
{
- struct sonet_modem *modem = g_hash_table_lookup(modem_hash, path);
+ struct telephony_modem *modem = g_hash_table_lookup(modem_hash, path);
if (modem == NULL)
return -ENODEV;
- DBG("check modem (%s) online (%d)", modem->path, modem->online);
+ DBG("check modem (%s) powered (%d)", modem->path, modem->powered);
- if (modem->online == online)
+ if (modem->powered == powered)
return -EALREADY;
return 0;
return TRUE;
}
-static int __add_network(struct connman_device *device, const char *path, DBusMessageIter *prop)
+static int __add_context(struct connman_device *device, const char *path, DBusMessageIter *prop)
{
char *ident;
gboolean active = FALSE;
- struct sonet_modem *modem = connman_device_get_data(device);
+ struct telephony_modem *modem = connman_device_get_data(device);
struct connman_network *network;
- struct sonet_network *info;
+ struct telephony_network *info;
DBG("modem %p device %p path %s", modem, device, path);
if (network == NULL)
return -ENOMEM;
- info = (struct sonet_network *)malloc( sizeof(struct sonet_network));
- memset(info, 0, sizeof(struct sonet_network));
+ info = (struct telephony_network *)malloc( sizeof(struct telephony_network));
+ memset(info, 0, sizeof(struct telephony_network));
if (info == NULL) {
connman_network_unref(network);
connman_network_set_available(network, TRUE);
connman_network_set_index(network, -1);
- connman_network_set_roaming(network, modem->roaming);
+ connman_network_set_roaming(network, modem->s_service->roaming);
if (connman_device_add_network(device, network) != 0) {
g_hash_table_remove(network_hash, path);
active = __set_network_ipconfig(info, prop);
- if (active && connman_network_get_connecting(network) == TRUE)
+ if (active && (connman_network_get_connecting(network) || connman_network_get_associating(network)))
__set_network_connected(info, active);
return 0;
connman_network_set_group(network, group);
}
-static gboolean __set_network_ipconfig(struct sonet_network *network, DBusMessageIter *dict)
+static gboolean __set_network_ipconfig(struct telephony_network *network, DBusMessageIter *dict)
{
DBG("set network info");
char *dev_name=NULL, *proxy_addr=NULL;
char *ipv4_addr=NULL, *ipv4_gw=NULL, *ipv4_netmask=NULL, *ipv4_dns1=NULL, *ipv4_dns2=NULL;
char *ipv6_addr=NULL, *ipv6_gw=NULL, *ipv6_netmask=NULL, *ipv6_dns1=NULL, *ipv6_dns2=NULL;
+ int index;
while (dbus_message_iter_get_arg_type(dict) != DBUS_TYPE_INVALID) {
DBusMessageIter entry;
dbus_message_iter_get_basic(&entry, &ipv6_dns2);
} else if (g_str_equal(key, "active") == TRUE) {
dbus_message_iter_get_basic(&entry, &tmp);
+ DBG("active (%s)", tmp);
active = STRING2BOOL(tmp);
}
}
// interface index set
- int index = connman_inet_ifindex(dev_name);
+ if (g_str_equal(dev_name ,"")) {
+ const char *ifname = NULL;
+ ifname = connman_network_get_ifname(network->network);
+ index = connman_inet_ifindex(ifname);
+ } else
+ index = connman_inet_ifindex(dev_name);
+
DBG("interface %s, index %d", dev_name, index);
connman_network_set_index(network->network, index);
connman_network_set_nameservers(network->network, nameservers);
}
+ if(active)
+ connman_network_set_associating(network->network, TRUE);
+
return active;
}
-static void __set_network_connected(struct sonet_network *network, gboolean connected)
+static void __set_network_connected(struct telephony_network *network, gboolean connected)
{
gboolean setip = FALSE;
DBusMessageIter args, dict;
const char *path = dbus_message_get_path(message);
- struct sonet_modem *modem;
- gboolean pre_online = TRUE, roaming_option = TRUE;
+ struct telephony_modem *modem;
DBG("modem path %s", path);
modem->powered = STRING2BOOL(tmp);
} else if (g_str_equal(key, "operator") == TRUE) {
modem->operator = g_strdup(tmp);
- } else if (g_str_equal(key, "roaming") == TRUE) {
- modem->roaming = STRING2BOOL(tmp);
- } else if (g_str_equal(key, "roaming_allowed") == TRUE) {
- modem->roaming_allowed = STRING2BOOL(tmp);
- } else if (g_str_equal(key, "online") == TRUE) {
- pre_online = modem->online;
- modem->online = STRING2BOOL(tmp);
} else if (g_str_equal(key, "sim_init") == TRUE) {
modem->sim_init = STRING2BOOL(tmp);
- } else if (g_str_equal(key, "ps_attached") == TRUE) {
- modem->ps_attached = STRING2BOOL(tmp);
+ } else if (g_str_equal(key, "flight_mode") == TRUE) {
+ modem->flight_mode = STRING2BOOL(tmp);
+ } else if (g_str_equal(key, "roaming_allowed") == TRUE) {
+ modem->roaming_allowed = STRING2BOOL(tmp);
+ } else if (g_str_equal(key, "data_allowed") == TRUE) {
+ modem->data_allowed = STRING2BOOL(tmp);
}
dbus_message_iter_next(&dict);
}
- if (modem->powered == FALSE) {
- __remove_connman_device(modem);
- return TRUE;
- }
-
- if (pre_online != modem->online) {
- __set_device_online(modem, modem->online);
-
- if (modem->online != TRUE) {
- return TRUE;
- }
+ if (modem->device == NULL)
+ __add_connman_device(path, modem->operator);
- if (modem->device == NULL) {
- __add_connman_device(path, modem->operator);
- } else {
- __request_get_networks(path);
- }
+ __set_device_powered(modem, modem->powered);
+ if (modem->powered != TRUE) {
+ DBG("modem is not powered");
return TRUE;
}
- roaming_option &= (!modem->roaming && !modem->roaming_allowed) || modem->roaming_allowed;
-
- if (modem->ps_attached == TRUE) {
- connman_device_set_cellular_service_enabled(modem->device, roaming_option);
+ if(!modem->s_service){
+ __request_get_services(modem->path);
return TRUE;
}
- if (roaming_option != TRUE)
- connman_device_set_cellular_service_enabled(modem->device, roaming_option);
+ if(modem->flight_mode || !modem->data_allowed){
+ DBG("modem(%s) flight mode(%d) data allowed(%d)", modem->path, modem->flight_mode, modem->data_allowed);
+ return TRUE;
+ }
return TRUE;
}
return TRUE;
}
-static gboolean __changed_network(DBusConnection *connection, DBusMessage *message, void *user_data)
+static gboolean __changed_service(DBusConnection *connection, DBusMessage *message, void *user_data)
+{
+ DBG("service changed signal");
+
+ DBusMessageIter args, dict;
+ const char *service_path = dbus_message_get_path(message);
+ struct telephony_modem *modem;
+ struct telephony_service *s_service;
+ gboolean roaming_option = TRUE;
+
+ DBG("service path %s", service_path);
+
+ s_service = g_hash_table_lookup(service_hash, service_path);
+ if (s_service == NULL) {
+ DBG("service object does not exists");
+ return TRUE;
+ }
+
+ modem = s_service->p_modem;
+ if (modem == NULL) {
+ DBG("modem object does not exists");
+ return TRUE;
+ }
+
+ DBG("message signature (%s)", dbus_message_get_signature(message));
+
+ if (dbus_message_iter_init(message, &args) == FALSE) {
+ DBG("error to read message");
+ return TRUE;
+ }
+
+ dbus_message_iter_recurse(&args, &dict);
+
+ while (dbus_message_iter_get_arg_type(&dict) != DBUS_TYPE_INVALID) {
+ DBusMessageIter entry;
+ const char* key, *tmp;
+
+ dbus_message_iter_recurse(&dict, &entry);
+ dbus_message_iter_get_basic(&entry, &key);
+
+ dbus_message_iter_next(&entry);
+ dbus_message_iter_get_basic(&entry, &tmp);
+
+ DBG("key(%s), value(%s)", key, tmp);
+
+ if (g_str_equal(key, "roaming") == TRUE) {
+ s_service->roaming = STRING2BOOL(tmp);
+ } else if (g_str_equal(key, "act") == TRUE) {
+ s_service->act = g_strdup(tmp);
+ } else if (g_str_equal(key, "ps_attached") == TRUE) {
+ s_service->ps_attached = STRING2BOOL(tmp);
+ }
+
+ dbus_message_iter_next(&dict);
+ }
+
+ roaming_option &= (!s_service->roaming && !modem->roaming_allowed) || modem->roaming_allowed;
+
+ return TRUE;
+}
+
+
+static gboolean __added_service(DBusConnection *connection, DBusMessage *message, void *user_data)
+{
+ DBG("service added signal");
+
+ const char *path = dbus_message_get_path(message);
+ const char *service_path = NULL;
+ DBusMessageIter args, dict, tmp;
+ struct telephony_modem *modem;
+
+ modem = g_hash_table_lookup(modem_hash, path);
+ if (modem == NULL || modem->device == NULL)
+ return TRUE;
+
+ DBG("message signature (%s)", dbus_message_get_signature(message));
+ if (dbus_message_iter_init(message, &args) == FALSE) {
+ DBG("error to read message");
+ return TRUE;
+ }
+
+ dbus_message_iter_recurse(&args, &dict);
+ memcpy(&tmp, &dict, sizeof(struct DBusMessageIter));
+
+ while (dbus_message_iter_get_arg_type(&tmp) != DBUS_TYPE_INVALID) {
+ DBusMessageIter entry;
+ const char *key, *value;
+
+ dbus_message_iter_recurse(&tmp, &entry);
+ dbus_message_iter_get_basic(&entry, &key);
+
+ dbus_message_iter_next(&entry);
+ dbus_message_iter_get_basic(&entry, &value);
+
+ DBG("key (%s) value(%s)", key, value);
+
+ if (g_str_equal(key, "path") == TRUE) {
+ service_path = g_strdup(value);
+ }
+
+ dbus_message_iter_next(&tmp);
+ }
+
+ if (service_path != NULL) {
+ __add_service(modem, service_path, &dict);
+ }
+
+ return TRUE;
+}
+
+static gboolean __removed_service(DBusConnection *connection, DBusMessage *message, void *user_data)
+{
+ DBG("service removed signal");
+
+ DBusMessageIter iter;
+ const char *service_path;
+
+ if (dbus_message_iter_init(message, &iter) == FALSE) {
+ DBG("error to read message");
+ return TRUE;
+ }
+
+ dbus_message_iter_get_basic(&iter, &service_path);
+ g_hash_table_remove(service_hash, service_path);
+
+ return TRUE;
+}
+
+static gboolean __changed_context(DBusConnection *connection, DBusMessage *message, void *user_data)
{
DBG("network changed signal");
gboolean active = FALSE;
const char *path = dbus_message_get_path(message);
- struct sonet_network *info;
+ struct telephony_network *info;
DBusMessageIter args, dict;
DBG("path %s", path);
if (active == FALSE)
__set_network_connected(info, active);
- else if (connman_network_get_connecting(info->network) == TRUE)
+ else if ( (connman_network_get_connecting(info->network) ||
+ connman_network_get_associating(info->network)) )
__set_network_connected(info, active);
return TRUE;
}
-static gboolean __added_network(DBusConnection *connection, DBusMessage *message, void *user_data)
+static gboolean __added_context(DBusConnection *connection, DBusMessage *message, void *user_data)
{
DBG("network added signal");
DBusMessageIter args, dict, tmp;
const char *path = dbus_message_get_path(message);
const char *network_path = NULL;
- struct sonet_modem *modem;
+ struct telephony_service *service = NULL;
+ struct telephony_modem *modem = NULL;
- modem = g_hash_table_lookup(modem_hash, path);
- if (modem == NULL || modem->device == NULL)
+ service = g_hash_table_lookup(service_hash, path);
+ if (service == NULL || service->p_modem == NULL)
+ return TRUE;
+
+ modem = service->p_modem;
+ if(modem == NULL || modem->device == NULL)
return TRUE;
DBG("message signature (%s)", dbus_message_get_signature(message));
}
if (network_path != NULL) {
- __add_network(modem->device, network_path, &dict);
+ __add_context(modem->device, network_path, &dict);
}
return TRUE;
}
-static gboolean __removed_network(DBusConnection *connection, DBusMessage *message, void *user_data)
+static gboolean __removed_context(DBusConnection *connection, DBusMessage *message, void *user_data)
{
DBG("network removed signal");
DBusMessageIter iter;
const char *path = dbus_message_get_path(message);
const char *network_path = NULL;
- struct sonet_modem *modem;
+ struct telephony_service *service = NULL;
+ struct telephony_modem *modem = NULL;
- modem = g_hash_table_lookup(modem_hash, path);
- if (modem == NULL || modem->device == NULL)
+ service = g_hash_table_lookup(service_hash, path);
+ if (service == NULL || service->p_modem == NULL)
return TRUE;
if (dbus_message_iter_init(message, &iter) == FALSE) {
return TRUE;
}
-/*
-static void __response_network_deactivate(DBusPendingCall *call, void *user_data)
-{
- struct sonet_network *network;
- DBusMessage *reply;
- DBusError error;
- DBusMessageIter args, dict;
-
- DBG("");
- network = (struct sonet_network*) user_data;
-
- reply = dbus_pending_call_steal_reply(call);
-
- dbus_error_init(&error);
-
- if (dbus_set_error_from_message(&error, reply)) {
- connman_error("connection deactivate() %s %s",error.name, error.message);
- dbus_error_free(&error);
- goto done;
- }
-
- DBG("message signature (%s)", dbus_message_get_signature(reply));
-
- if (dbus_message_iter_init(reply, &args) == FALSE)
- goto done;
-
- //extract network path
- const char* network_path;
- dbus_message_iter_get_basic(&args, &network_path);
-
- DBG("network_path is (%s)", network_path);
-
- //compare the path
- __clean_network_ip_info(network);
- __set_connman_connected(network, FALSE);
-
-done:
- dbus_message_unref(reply);
- dbus_pending_call_unref(call);
- return;
-}
-*/
-
-// sonet initialization
+// telephony initialization
static guint watch;
static guint modem_watch;
static guint modem_added_watch;
static guint modem_removed_watch;
-static guint network_watch;
-static guint network_added_watch;
-static guint network_removed_watch;
-
-static int sonet_init(void)
+static guint service_watch;
+static guint service_added_watch;
+static guint service_removed_watch;
+static guint context_watch;
+static guint context_added_watch;
+static guint context_removed_watch;
+
+static int telephony_init(void)
{
- DBG("sonet plugin");
+ DBG("telephony plugin");
int err;
connection = connman_dbus_get_connection();
if (connection == NULL)
return -EIO;
- // sonet watch
- watch = g_dbus_add_service_watch(connection, SONET_SERVICE, sonet_connect, sonet_disconnect, NULL, NULL);
+ // telephony watch
+ watch = g_dbus_add_service_watch(connection, PS_DBUS_SERVICE, telephony_connect, telephony_disconnect, NULL, NULL);
- modem_watch = g_dbus_add_signal_watch(connection, NULL, NULL, SONET_MODEM_INTERFACE,
+ modem_watch = g_dbus_add_signal_watch(connection, NULL, NULL, PS_MODEM_INTERFACE,
PROPERTY_CHANGED, __changed_modem, NULL, NULL);
- modem_added_watch = g_dbus_add_signal_watch(connection, NULL, NULL, SONET_MASTER_INTERFACE,
+ modem_added_watch = g_dbus_add_signal_watch(connection, NULL, NULL, PS_MASTER_INTERFACE,
MODEM_ADDED, __added_modem, NULL, NULL);
- modem_removed_watch = g_dbus_add_signal_watch(connection, NULL, NULL, SONET_MASTER_INTERFACE,
+ modem_removed_watch = g_dbus_add_signal_watch(connection, NULL, NULL, PS_MASTER_INTERFACE,
MODEM_REMOVED, __removed_modem, NULL, NULL);
- network_watch = g_dbus_add_signal_watch(connection, NULL, NULL, SONET_NETWORK_INTERFACE,
- PROPERTY_CHANGED, __changed_network, NULL, NULL);
+ service_watch = g_dbus_add_signal_watch(connection, NULL, NULL, PS_SERVICE_INTERFACE,
+ PROPERTY_CHANGED, __changed_service, NULL, NULL);
+
+ service_added_watch = g_dbus_add_signal_watch(connection, NULL, NULL, PS_MODEM_INTERFACE,
+ SERVICE_ADDED, __added_service, NULL, NULL);
+
+ service_removed_watch = g_dbus_add_signal_watch(connection, NULL, NULL, PS_MODEM_INTERFACE,
+ SERVICE_REMOVED, __removed_service, NULL, NULL);
+
+ context_watch = g_dbus_add_signal_watch(connection, NULL, NULL, PS_CONTEXT_INTERFACE,
+ PROPERTY_CHANGED, __changed_context, NULL, NULL);
- network_added_watch = g_dbus_add_signal_watch(connection, NULL, NULL, SONET_MODEM_INTERFACE,
- NETWORK_ADDED, __added_network, NULL, NULL);
+ context_added_watch = g_dbus_add_signal_watch(connection, NULL, NULL, PS_SERVICE_INTERFACE,
+ CONTEXT_ADDED, __added_context, NULL, NULL);
- network_removed_watch = g_dbus_add_signal_watch(connection, NULL, NULL, SONET_MODEM_INTERFACE,
- NETWORK_REMOVED, __removed_network, NULL, NULL);
+ context_removed_watch = g_dbus_add_signal_watch(connection, NULL, NULL, PS_SERVICE_INTERFACE,
+ CONTEXT_REMOVED, __removed_context, NULL, NULL);
- if (watch == 0 || modem_watch == 0 || modem_added_watch == 0 || modem_removed_watch == 0 ||
- network_watch == 0 || network_added_watch == 0 || network_removed_watch == 0) {
+ if (watch == 0 || modem_watch == 0 || modem_added_watch == 0 || modem_removed_watch == 0
+ || service_watch == 0 || service_added_watch == 0 || service_removed_watch == 0
+ || context_watch == 0 || context_added_watch == 0 || context_removed_watch == 0) {
err = -EIO;
goto remove;
}
g_dbus_remove_watch(connection, modem_watch);
g_dbus_remove_watch(connection, modem_added_watch);
g_dbus_remove_watch(connection, modem_removed_watch);
- g_dbus_remove_watch(connection, network_watch);
- g_dbus_remove_watch(connection, network_added_watch);
- g_dbus_remove_watch(connection, network_removed_watch);
+ g_dbus_remove_watch(connection, service_watch);
+ g_dbus_remove_watch(connection, service_added_watch);
+ g_dbus_remove_watch(connection, service_removed_watch);
+ g_dbus_remove_watch(connection, context_watch);
+ g_dbus_remove_watch(connection, context_added_watch);
+ g_dbus_remove_watch(connection, context_removed_watch);
dbus_connection_unref(connection);
return err;
}
-static void sonet_exit(void)
+static void telephony_exit(void)
{
g_dbus_remove_watch(connection, watch);
g_dbus_remove_watch(connection, modem_watch);
g_dbus_remove_watch(connection, modem_added_watch);
g_dbus_remove_watch(connection, modem_removed_watch);
- g_dbus_remove_watch(connection, network_watch);
- g_dbus_remove_watch(connection, network_added_watch);
- g_dbus_remove_watch(connection, network_removed_watch);
+ g_dbus_remove_watch(connection, service_watch);
+ g_dbus_remove_watch(connection, service_added_watch);
+ g_dbus_remove_watch(connection, service_removed_watch);
+ g_dbus_remove_watch(connection, context_watch);
+ g_dbus_remove_watch(connection, context_added_watch);
+ g_dbus_remove_watch(connection, context_removed_watch);
- sonet_disconnect(connection, NULL);
+ telephony_disconnect(connection, NULL);
connman_device_driver_unregister(&modem_driver);
connman_network_driver_unregister(&network_driver);
dbus_connection_unref(connection);
}
-CONNMAN_PLUGIN_DEFINE(sonet, "Samsung OpenSrc Network Framework plugin", VERSION,
- CONNMAN_PLUGIN_PRIORITY_DEFAULT, sonet_init, sonet_exit)
+CONNMAN_PLUGIN_DEFINE(telephony, "Samsung Telephony Framework plug-in", VERSION,
+ CONNMAN_PLUGIN_PRIORITY_DEFAULT, telephony_init, telephony_exit)
[D-BUS Service]
Name=net.connman
-Exec=@PREFIX@/sbin/connmand -W wext
+Exec=/usr/sbin/connmand -W wext
User=root
--- /dev/null
+
+[device_Wireless]
+Powered=false
int __connman_device_set_offlinemode(connman_bool_t offlinemode);
-#if defined TIZEN_EXT
-connman_uint8_t __connman_device_get_bgscan_mode();
-int __connman_device_set_bgscan_mode(connman_uint8_t scanmode);
-#endif
-
#include <connman/network.h>
int __connman_network_init(void);
const char *pac);
#if defined TIZEN_EXT
/*
- * Description: SONET plug-in requires manual PROXY setting function
+ * Description: Telephony plug-in requires manual PROXY setting function
*/
void __connman_service_set_proxy(struct connman_service *service,
const char *proxies);
void __connman_notifier_disconnect(enum connman_service_type type);
void __connman_notifier_offlinemode(connman_bool_t enabled);
#if defined TIZEN_EXT
-void __connman_notifier_cellular_service_enabled(connman_bool_t enabled);
-#endif
-#if defined TIZEN_EXT
void __connman_notifier_scan_completed(connman_bool_t success);
#endif
void __connman_notifier_default_changed(struct connman_service *service);
int __connman_6to4_probe(struct connman_service *service);
void __connman_6to4_remove(struct connman_ipconfig *ipconfig);
int __connman_6to4_check(struct connman_ipconfig *ipconfig);
-
-#if defined TIZEN_EXT
-enum connman_bgscan_mode
-{
- CONNMAN_BGSCAN_MODE_DEFAULT,
- CONNMAN_BGSCAN_MODE_PERIODIC,
- CONNMAN_BGSCAN_MODE_EXPONENTIAL,
-};
-#endif
GHashTable *networks;
#if defined TIZEN_EXT
- connman_bool_t cellular_service_enabled;
- enum connman_bgscan_mode bgscan_mode;
+ /* It contains number of favorite Wi-Fi profile.
+ * If significant wifi profile is 0, Wi-Fi device does not trigger scan. */
gint significant_wifi_profile_refcount;
#endif
};
#define SCAN_INITIAL_DELAY 10
#if defined TIZEN_EXT
-#define SCAN_PERIODIC_DELAY 10
-#define SCAN_DEFAULT_DELAY 300
-#define SCAN_EXPONENTIAL_MAX 128
-#define SCAN_EXPONENTIAL_MIN 4
-
-static void set_next_scan_trigger(struct connman_device * device);
-#endif
-
-#if defined TIZEN_EXT
static void __connman_device_set_significant_wifi_profile_refcount(struct connman_device *device, gint refcount)
{
g_atomic_int_set(&device->significant_wifi_profile_refcount, refcount);
static gboolean device_scan_trigger(gpointer user_data)
{
-#if defined TIZEN_EXT
- GHashTableIter iter;
- gpointer key, value;
- connman_bool_t connected = FALSE;
- connman_bool_t connecting = FALSE;
- connman_bool_t associating = FALSE;
-#endif
struct connman_device *device = user_data;
DBG("device %p", device);
return FALSE;
}
-#if defined TIZEN_EXT
- g_hash_table_iter_init(&iter, device->networks);
-
- while (g_hash_table_iter_next(&iter, &key, &value) == TRUE) {
- struct connman_network *network = value;
-
- if (connman_network_get_type(network) != CONNMAN_NETWORK_TYPE_WIFI)
- continue;
-
- /*
- * If there is a connected or connecting network, don't try to scan.
- */
- connected = connman_network_get_connected(network);
- connecting = connman_network_get_connecting(network);
- associating = connman_network_get_associating(network);
-
- if (device->bgscan_mode == CONNMAN_BGSCAN_MODE_EXPONENTIAL) {
- if (connected == TRUE) {
- DBG("network(%s) is connected.", connman_network_get_string(network, "Name"));
-
- set_next_scan_trigger(device);
- return TRUE;
- } else if ((connecting == TRUE) || (associating == TRUE)) {
- DBG("network(%s) is connecting.", connman_network_get_string(network, "Name"));
-
- set_next_scan_trigger(device);
- return TRUE;
- }
-
- if (__connman_device_is_no_ref_significant_wifi_profile(device) == TRUE) {
- DBG("There is no saved profile and no need to scan.");
-
- set_next_scan_trigger(device);
- return TRUE;
- }
- }
- }
-
- set_next_scan_trigger(device);
-#endif
-
if (device->driver->scan)
device->driver->scan(device);
}
}
-#if defined TIZEN_EXT
-static void create_scan_trigger(struct connman_device * device)
-{
- clear_scan_trigger(device);
-
- if(device->bgscan_mode == CONNMAN_BGSCAN_MODE_PERIODIC)
- device->scan_interval = SCAN_PERIODIC_DELAY;
- else if(device->bgscan_mode == CONNMAN_BGSCAN_MODE_EXPONENTIAL)
- device->scan_interval = SCAN_EXPONENTIAL_MIN;
- else
- device->scan_interval = SCAN_DEFAULT_DELAY;
-
- DBG("interval %d", device->scan_interval);
-
- device->scan_timeout = g_timeout_add_seconds(device->scan_interval,
- device_scan_trigger, device);
-}
-
-static void set_next_scan_trigger(struct connman_device * device)
-{
- clear_scan_trigger(device);
-
- DBG("bgscan mode (%d) , current interval (%d)", device->bgscan_mode, device->scan_interval);
-
- if(device->scan_interval <= 0)
- return;
-
- guint interval;
-
- if(device->bgscan_mode == CONNMAN_BGSCAN_MODE_DEFAULT)
- {
- if (g_hash_table_size(device->networks) == 0) {
- if (device->backoff_interval >= device->scan_interval)
- device->backoff_interval = SCAN_INITIAL_DELAY;
- interval = device->backoff_interval;
- } else
- interval = device->scan_interval;
-
- device->backoff_interval *= 2;
- if (device->backoff_interval > device->scan_interval)
- device->backoff_interval = device->scan_interval;
- }
- else if(device->bgscan_mode == CONNMAN_BGSCAN_MODE_EXPONENTIAL)
- {
- if(device->scan_interval >= SCAN_EXPONENTIAL_MAX)
- device->scan_interval = SCAN_EXPONENTIAL_MAX;
- else
- device->scan_interval *= 2;
- }
-
- interval = device->scan_interval;
-
- DBG("next interval (%d)", interval);
-
- device->scan_timeout = g_timeout_add_seconds(interval,
- device_scan_trigger, device);
-}
-#endif
-
static void reset_scan_trigger(struct connman_device *device)
{
clear_scan_trigger(device);
if (device->scan_interval > 0) {
guint interval;
-#if defined TIZEN_EXT
- interval = device->scan_interval;
-
- DBG("interval %d", interval);
- device->scan_timeout = g_timeout_add_seconds(interval,
- device_scan_trigger, device);
-#else
if (g_hash_table_size(device->networks) == 0) {
if (device->backoff_interval >= device->scan_interval)
device->backoff_interval = SCAN_INITIAL_DELAY;
device->backoff_interval *= 2;
if (device->backoff_interval > device->scan_interval)
device->backoff_interval = device->scan_interval;
-#endif
}
}
struct connman_device *device;
enum connman_service_type service_type;
connman_bool_t bg_scan;
-#if defined TIZEN_EXT
- connman_uint8_t bg_scan_mode;
-#endif
DBG("node %s type %d", node, type);
device->refcount = 1;
bg_scan = connman_setting_get_bool("BackgroundScanning");
-
-#if defined TIZEN_EXT
- bg_scan_mode = connman_setting_get_int("BackgroundScanningMode");
- device->cellular_service_enabled = TRUE;
-#endif
#if defined TIZEN_EXT
if (type == CONNMAN_DEVICE_TYPE_WIFI) {
/* Load significant_wifi_profile_refcount */
break;
case CONNMAN_DEVICE_TYPE_WIFI:
if (bg_scan == TRUE)
- {
-#if defined TIZEN_EXT
- device->bgscan_mode = bg_scan_mode;
-#endif
device->scan_interval = 300;
-
-#if defined TIZEN_EXT
- create_scan_trigger(device);
-#endif
- }
else
device->scan_interval = 0;
break;
return device->ident;
}
-#if defined TIZEN_EXT
-int connman_device_set_cellular_service_enabled(struct connman_device *device, connman_bool_t enabled)
-{
- if (device == NULL)
- return 0;
-
- DBG("device (%p), cellular service enabled (%d)", device, enabled);
-
- device->cellular_service_enabled = enabled;
- __connman_notifier_cellular_service_enabled(enabled);
-
- return 0;
-}
-#endif
-
/**
* connman_device_set_powered:
* @device: device structure
if (err < 0 && err != -EINPROGRESS && err != -EALREADY)
return err;
-#if defined TIZEN_EXT
- device->cellular_service_enabled =powered;
-#endif
-
device->powered = powered;
device->powered_pending = powered;
return -ENOLINK;
#if defined TIZEN_EXT
- /* scan trigger should be started with initial interval */
- create_scan_trigger(device);
-#else
- reset_scan_trigger(device);
-#endif
-
- return device->driver->scan(device);
-}
-
-#if defined TIZEN_EXT
-connman_uint8_t __connman_device_get_bgscan_mode()
-{
- struct connman_device * device = __connman_device_find_device(CONNMAN_SERVICE_TYPE_WIFI);
-
- if ((device == NULL) || (!device->driver))
- return -EOPNOTSUPP;
-
- if (device->powered == FALSE)
- return -ENOLINK;
-
- DBG("current bgscan mode : %d", device->bgscan_mode);
-
- return device->bgscan_mode;
-}
-
-int __connman_device_set_bgscan_mode(connman_uint8_t scanmode)
-{
- struct connman_device * device = __connman_device_find_device(CONNMAN_SERVICE_TYPE_WIFI);
+ GHashTableIter iter;
+ gpointer key, value;
- if ((device == NULL) || (!device->driver))
- return -EOPNOTSUPP;
+ g_hash_table_iter_init(&iter, device->networks);
- if (device->powered == FALSE)
- return -ENOLINK;
+ while (g_hash_table_iter_next(&iter, &key, &value) == TRUE) {
+ struct connman_network *network = value;
- DBG("bgscan mode : %d", scanmode);
+ DBG("network type %s", __connman_network_get_type(network));
+ if (connman_network_get_type(network) != CONNMAN_NETWORK_TYPE_WIFI)
+ continue;
- device->bgscan_mode = scanmode;
+ /* If there is a connected or connecting network, don't try to scan. */
+ if (connman_network_get_connecting(network) == TRUE ||
+ connman_network_get_associating(network) == TRUE) {
+ DBG("network(%s) is connecting", connman_network_get_string(network, "Name"));
+ return 0;
+ }
+ }
+#endif
- create_scan_trigger(device);
+ reset_scan_trigger(device);
- return 0;
+ return device->driver->scan(device);
}
-#endif
int __connman_device_enable_persistent(struct connman_device *device)
{
ipconfig->ops->down(ipconfig);
}
+#if defined TIZEN_EXT
+ if (g_strcmp0(ipdevice->address, address) != 0) {
+ g_free(ipdevice->address);
+ ipdevice->address = g_strdup(address);
+ }
+#endif
+
if (lower_up)
__connman_ipconfig_lower_up(ipdevice);
if (lower_down)
return ipconfig->address->local;
}
-#if defined TIZEN_EXT
-const char *connman_ipconfig_get_local(struct connman_ipconfig *ipconfig)
-{
- return __connman_ipconfig_get_local(ipconfig);
-}
-#endif
-
void __connman_ipconfig_set_local(struct connman_ipconfig *ipconfig, const char *address)
{
if (ipconfig->address == NULL)
#include "connman.h"
+#if defined TIZEN_EXT
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/stat.h>
+
+#define LOG_FILE_PATH "/var/log/connman.log"
+#define MAX_LOG_SIZE 2 * 1024 * 1024
+#define MAX_LOG_COUNT 9
+
+#define openlog __connman_log_open
+#define closelog __connman_log_close
+#define vsyslog __connman_log
+#define syslog __connman_log_s
+
+static FILE *log_file = NULL;
+
+void __connman_log_open(const char *ident, int option, int facility)
+{
+ if (log_file == NULL)
+ log_file = (FILE *)fopen(LOG_FILE_PATH, "a+");
+}
+
+void __connman_log_close(void)
+{
+ fclose(log_file);
+ log_file = NULL;
+}
+
+static void __connman_log_update_file_revision(int rev)
+{
+ int next_log_rev = 0;
+ char *log_file = NULL;
+ char *next_log_file = NULL;
+
+ next_log_rev = rev + 1;
+
+ log_file = g_strdup_printf("%s.%d", LOG_FILE_PATH, rev);
+ next_log_file = g_strdup_printf("%s.%d", LOG_FILE_PATH, next_log_rev);
+
+ if (next_log_rev >= MAX_LOG_COUNT)
+ remove(next_log_file);
+
+ if (access(next_log_file, F_OK) == 0)
+ __connman_log_update_file_revision(next_log_rev);
+
+ if (rename(log_file, next_log_file) != 0)
+ remove(log_file);
+
+ g_free(log_file);
+ g_free(next_log_file);
+}
+
+static void __connman_log_make_backup(void)
+{
+ const int rev = 0;
+ char *backup = NULL;
+
+ backup = g_strdup_printf("%s.%d", LOG_FILE_PATH, rev);
+
+ if (access(backup, F_OK) == 0)
+ __connman_log_update_file_revision(rev);
+
+ if (rename(LOG_FILE_PATH, backup) != 0)
+ remove(LOG_FILE_PATH);
+
+ g_free(backup);
+}
+
+static void __connman_log_get_local_time(char *strtime, const int size)
+{
+ time_t buf;
+ struct tm *local_ptm;
+
+ time(&buf);
+ buf = time(NULL);
+ local_ptm = localtime(&buf);
+
+ strftime(strtime, size, "%D %H:%M:%S", local_ptm);
+}
+
+void __connman_log(const int log_priority, const char *format, va_list ap)
+{
+ int log_size = 0;
+ struct stat buf;
+ char str[256];
+ char strtime[40];
+
+ if (log_file == NULL)
+ log_file = (FILE *)fopen(LOG_FILE_PATH, "a+");
+
+ if (log_file == NULL)
+ return;
+
+ fstat(fileno(log_file), &buf);
+ log_size = buf.st_size;
+
+ if (log_size >= MAX_LOG_SIZE) {
+ fclose(log_file);
+ log_file = NULL;
+
+ __connman_log_make_backup();
+
+ log_file = (FILE *)fopen(LOG_FILE_PATH, "a+");
+
+ if (log_file == NULL)
+ return;
+ }
+
+ __connman_log_get_local_time(strtime, sizeof(strtime));
+
+ if (vsnprintf(str, sizeof(str), format, ap) > 0)
+ fprintf(log_file, "%s %s\n", strtime, str);
+}
+
+void __connman_log_s(int log_priority, const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+
+ vsyslog(LOG_DEBUG, format, ap);
+
+ va_end(ap);
+}
+#endif
+
/**
* connman_info:
* @format: format string
static struct {
connman_bool_t bg_scan;
-#if defined TIZEN_EXT
- connman_uint8_t bg_scan_mode;
-#endif
+ connman_bool_t single_connection;
} connman_settings = {
.bg_scan = TRUE,
-#if defined TIZEN_EXT
- .bg_scan_mode = CONNMAN_BGSCAN_MODE_DEFAULT,
-#endif
+ .single_connection = FALSE,
};
static GKeyFile *load_config(const char *file)
if (error == NULL)
connman_settings.bg_scan = boolean;
-#if defined TIZEN_EXT
- {
- unsigned char mode;
+ g_clear_error(&error);
- DBG("-------------bg scan : %d", boolean);
+ boolean = g_key_file_get_boolean(config, "General",
+ "SingleConnection", &error);
+ if (error == NULL)
+ connman_settings.single_connection = boolean;
- mode = g_key_file_get_integer(config, "General", "BackgroundScanningMode", &error);
- if (error == NULL)
- connman_settings.bg_scan_mode = mode;
-
- DBG("-------------bg scan mode : %d", mode);
- }
-#endif
g_clear_error(&error);
}
if (g_str_equal(key, "BackgroundScanning") == TRUE)
return connman_settings.bg_scan;
- return FALSE;
-}
-
-#if defined TIZEN_EXT
-connman_uint16_t connman_setting_get_int(const char * key)
-{
- if (g_str_equal(key, "BackgroundScanningMode") == TRUE)
- return connman_settings.bg_scan_mode;
+ if (g_str_equal(key, "SingleConnection") == TRUE)
+ return connman_settings.single_connection;
- return 0;
+ return FALSE;
}
-#endif
int main(int argc, char *argv[])
{
# mechanism starting from 10s up to 5 minutes will run.
BackgroundScanning = true
-BackgroundScanningMode = 2
+SingleConnection = true
DBusMessage *reply;
DBusMessageIter array, dict;
connman_bool_t offlinemode, sessionmode;
-#if defined TIZEN_EXT
- connman_uint8_t bgscanmode;
-#endif
const char *str;
DBG("conn %p", conn);
connman_dbus_dict_append_basic(&dict, "SessionMode",
DBUS_TYPE_BOOLEAN,
&sessionmode);
-#if defined TIZEN_EXT
- bgscanmode = __connman_device_get_bgscan_mode();
- connman_dbus_dict_append_basic(&dict, "ScanMode", DBUS_TYPE_BYTE, &bgscanmode);
-#endif
+
connman_dbus_dict_close(&array, &dict);
return reply;
return NULL;
}
-#if defined TIZEN_EXT
- } else if (g_str_equal(name, "ScanMode") == TRUE) {
- connman_uint16_t scanmode;
-
- dbus_message_iter_get_basic(&value, &scanmode);
-
- if ((scanmode > CONNMAN_BGSCAN_MODE_EXPONENTIAL) || (scanmode < CONNMAN_BGSCAN_MODE_DEFAULT))
- return __connman_error_invalid_arguments(msg);
-
- __connman_device_set_bgscan_mode(scanmode);
-#endif
} else
return __connman_error_invalid_property(msg);
}
#if defined TIZEN_EXT
- int service_type = 0;
- service_type = connman_service_get_type(service);
- if(service_type == CONNMAN_SERVICE_TYPE_CELLULAR){
+ if (connman_service_get_type(service) ==
+ CONNMAN_SERVICE_TYPE_CELLULAR) {
network->connecting = FALSE;
connman_network_set_associating(network, FALSE);
}
CONNMAN_IPCONFIG_TYPE_IPV6);
#if defined TIZEN_EXT
- if(service_type == CONNMAN_SERVICE_TYPE_CELLULAR){
+ if (connman_service_get_type(service) ==
+ CONNMAN_SERVICE_TYPE_CELLULAR)
return FALSE;
- }
#endif
}
#if defined TIZEN_EXT
if (network->type != CONNMAN_NETWORK_TYPE_CELLULAR)
- __connman_device_disconnect(network->device);
#endif
+ __connman_device_disconnect(network->device);
err = network->driver->connect(network);
if (err < 0) {
#if defined TIZEN_EXT
/*
- * Description: SONET plug-in requires manual PROXY setting function
+ * Description: Telephony plug-in requires manual PROXY setting function
*/
int connman_network_set_proxy(struct connman_network *network,
const char *proxies)
{
return (const char *)network->wifi.encryption_mode;
}
+
+const char *connman_network_get_ifname(struct connman_network *network)
+{
+ struct connman_service *service;
+ struct connman_ipconfig *ipconfig;
+ const char *ifname = NULL;
+
+ service = __connman_service_lookup_from_network(network);
+ if (service == NULL)
+ return NULL;
+
+ ipconfig = __connman_service_get_ip4config(service);
+
+ if (ipconfig != NULL)
+ ifname = connman_ipconfig_get_ifname(ipconfig);
+
+ DBG("index %d, service %p ip4config %p ifname %s",
+ network->index, service, ipconfig, ifname);
+ return ifname;
+}
#endif
int connman_network_set_nameservers(struct connman_network *network,
}
#if defined TIZEN_EXT
-void __connman_notifier_cellular_service_enabled(connman_bool_t enabled)
-{
- GSList *list;
- DBG("cellular connection available");
-
- for (list = notifier_list; list; list = list->next) {
- struct connman_notifier *notifier = list->data;
-
- if (notifier->cellular_service_enabled)
- notifier->cellular_service_enabled(enabled);
- }
-}
-#endif
-
-#if defined TIZEN_EXT
/*
* August 22nd, 2011. TIZEN
*
if (type == ARPHRD_ETHER)
read_uevent(interface);
-
+
#if defined TIZEN_EXT
- if(type == ARPHRD_PPP){
+ if (type == ARPHRD_PPP) {
interface->service_type = CONNMAN_SERVICE_TYPE_CELLULAR;
interface->device_type = CONNMAN_DEVICE_TYPE_CELLULAR;
}
* It's only for PDP (cellular) bearer. Wi-Fi is managed by ConnMan automatically.
* Reference count can help to manage open/close connection requests by each application.
*/
- gint user_initiated_pdp_connection_refcount;
- connman_bool_t alwayson;
+ gint user_initiated_pdn_connection_refcount;
#endif
};
#if defined TIZEN_EXT
/*
- * Public APIs to use user_initiated_pdp_connection_refcount
+ * Public APIs to use user_initiated_pdn_connection_refcount
*/
-void connman_service_user_initiated_pdp_connection_ref(struct connman_service *service)
+void connman_service_user_initiated_pdn_connection_ref(
+ struct connman_service *service)
{
- g_atomic_int_inc(&service->user_initiated_pdp_connection_refcount);
- DBG("User try to make a PDP connection with already referenced count: %d", service->user_initiated_pdp_connection_refcount);
+ g_atomic_int_inc(&service->user_initiated_pdn_connection_refcount);
+ DBG("User try to make a PDP connection with already referenced count: %d",
+ service->user_initiated_pdn_connection_refcount);
}
-connman_bool_t connman_service_user_initiated_pdp_connection_unref_and_test(struct connman_service *service)
+connman_bool_t connman_service_user_initiated_pdn_connection_unref_and_test(
+ struct connman_service *service)
{
connman_bool_t test_zero = TRUE;
- if (service->user_initiated_pdp_connection_refcount > 0)
- test_zero = g_atomic_int_dec_and_test(&service->user_initiated_pdp_connection_refcount);
+ if (service->user_initiated_pdn_connection_refcount > 0)
+ test_zero = g_atomic_int_dec_and_test(&service->user_initiated_pdn_connection_refcount);
- DBG("User try to disconnect existing PDP connection with already unreferenced count: %d", service->user_initiated_pdp_connection_refcount);
+ DBG("User try to disconnect existing PDP connection with already unreferenced count: %d",
+ service->user_initiated_pdn_connection_refcount);
return test_zero;
}
-connman_bool_t connman_service_is_no_ref_user_initiated_pdp_connection(struct connman_service *service)
+connman_bool_t connman_service_is_no_ref_user_initiated_pdn_connection(
+ struct connman_service *service)
{
- return g_atomic_int_compare_and_exchange(&service->user_initiated_pdp_connection_refcount, 0, 0);
-}
-
-void connman_service_set_alwayson(struct connman_service *service, connman_bool_t state)
-{
- if (service == NULL) {
- DBG("serivce does not exist");
- return;
- }
-
- DBG("always on old state(%d) new state (%d)", service->alwayson, state);
- service->alwayson = state;
- return;
+ return g_atomic_int_compare_and_exchange(&service->user_initiated_pdn_connection_refcount,
+ 0, 0);
}
#endif
static void state_changed(struct connman_service *service)
{
const char *str;
-#if defined TIZEN_EXT
- const char *str_err;
-#endif
__connman_notifier_service_state_changed(service, service->state);
return;
#if defined TIZEN_EXT
- str_err = error2string(service->error);
+ const char *str_err = error2string(service->error);
if ((service->state == CONNMAN_SERVICE_STATE_FAILURE) && (str_err != NULL))
connman_dbus_service_property_changed_with_error_cause(service->path,
CONNMAN_SERVICE_INTERFACE, "State", DBUS_TYPE_STRING, &str,
DBUS_TYPE_STRING, append_domainconfig, service);
}
+#if defined TIZEN_EXT
+static int __connman_service_dbus_update_default_info(int type, ...)
+{
+#define NETCONFIG_SERVICE "net.netconfig"
+#define NETCONFIG_NETWORK_STATE_INTERFACE NETCONFIG_SERVICE ".network"
+#define NETCONFIG_NETWORK_STATE_PATH "/net/netconfig/network"
+ DBusMessage *message;
+ DBusPendingCall *call;
+ dbus_bool_t ok;
+ va_list va;
+
+ message = dbus_message_new_method_call(NETCONFIG_SERVICE,
+ NETCONFIG_NETWORK_STATE_PATH,
+ NETCONFIG_NETWORK_STATE_INTERFACE, "UpdateDefaultConnectionInfo");
+
+ if (message == NULL)
+ return -ENOMEM;
+
+ dbus_message_set_auto_start(message, FALSE);
+
+ va_start(va, type);
+ ok = dbus_message_append_args_valist(message, type, va);
+ va_end(va);
+
+ if (!ok)
+ return -ENOMEM;
+
+ if (dbus_connection_send_with_reply(connection, message, &call, 40000) == FALSE) {
+ connman_error("Failed to call %s.%s", NETCONFIG_NETWORK_STATE_INTERFACE,
+ "UpdateDefaultConnectionInfo");
+ dbus_message_unref(message);
+ return -EINVAL;
+ }
+
+ if (call == NULL) {
+ connman_error("D-Bus connection not available");
+ dbus_message_unref(message);
+ return -EINVAL;
+ }
+
+ dbus_message_unref(message);
+
+ return -EINPROGRESS;
+}
+
+static connman_bool_t __connman_service_is_internet_profile(
+ struct connman_service *cellular)
+{
+ DBG("Service path: %s", cellular->path);
+
+ const char internet_suffix[] = "_1";
+ char *suffix = NULL;
+
+ if (strstr(cellular->path, "cellular_") != NULL) {
+ suffix = strrchr(cellular->path, '_');
+ if (strcmp(suffix, internet_suffix) == 0)
+ return TRUE;
+ }
+
+ DBG("Not Internet profile.");
+ return FALSE;
+}
+
+static struct connman_service *__connman_service_get_default(void)
+{
+ GSequenceIter *iter;
+ struct connman_service *default_service = NULL;
+
+ iter = g_sequence_get_begin_iter(service_list);
+
+ while (g_sequence_iter_is_end(iter) == FALSE) {
+ struct connman_service *service = g_sequence_get(iter);
+
+ DBG("service: %p %s %s %s", service, service->name,
+ state2string(service->state),
+ __connman_service_type2string(service->type));
+
+ if (service->type == CONNMAN_SERVICE_TYPE_WIFI &&
+ is_connected(service) == TRUE)
+ return service;
+
+ if (service->type == CONNMAN_SERVICE_TYPE_CELLULAR)
+ if (__connman_service_is_internet_profile(service) == TRUE) {
+ if (default_service == NULL)
+ default_service = service;
+ else if (is_connected(default_service) == FALSE &&
+ is_connected(service) == TRUE)
+ default_service = service;
+ }
+
+ iter = g_sequence_iter_next(iter);
+ }
+
+ return default_service;
+}
+
+static void __connman_service_update_default_info(struct connman_service *service)
+{
+ struct connman_ipconfig *ip_config = NULL;
+ gchar *connection_type = NULL, *connection_state = NULL;
+ gchar *ip_addr = NULL, *proxy_addr = NULL;
+ gchar **proxy_list = NULL;
+
+ ip_config = __connman_service_get_ip4config(service);
+ if (ip_config == NULL)
+ return;
+
+ DBG("Update state %p %s %s", service, service->path, state2string(service->state));
+
+ ip_addr = g_strdup(__connman_ipconfig_get_local(ip_config));
+ if (ip_addr == NULL)
+ ip_addr = g_strdup("");
+
+ connection_type = g_strdup(
+ __connman_service_type2string(connman_service_get_type(service)));
+
+ connection_state = g_strdup(state2string(service->state));
+
+ proxy_list = connman_service_get_proxy_servers(service);
+ if (proxy_list != NULL)
+ proxy_addr = g_strdup(proxy_list[0]);
+ if (proxy_addr == NULL)
+ proxy_addr = g_strdup("");
+
+ __connman_service_dbus_update_default_info(
+ DBUS_TYPE_STRING, &connection_type, DBUS_TYPE_STRING, &connection_state,
+ DBUS_TYPE_STRING, &ip_addr, DBUS_TYPE_STRING, &proxy_addr, DBUS_TYPE_INVALID);
+
+ g_free(connection_type);
+ g_free(connection_state);
+ g_free(ip_addr);
+ g_free(proxy_addr);
+ g_strfreev(proxy_list);
+}
+
+static void __connman_service_update_default(struct connman_service *service)
+{
+ struct connman_service *default_service = NULL;
+
+ default_service = __connman_service_get_default();
+
+ DBG("service %p %s %s", service, service->path, state2string(service->state));
+ if (default_service != NULL)
+ DBG("default service %p %s %s", default_service, default_service->path,
+ state2string(default_service->state));
+ else
+ DBG("default service is NULL");
+
+ if (is_connected(service) == TRUE) {
+ if (service == default_service)
+ __connman_service_update_default_info(service);
+
+ return;
+ }
+
+ if (default_service == NULL) {
+ __connman_service_update_default_info(service);
+ return;
+ }
+
+ if (service != default_service) {
+ if (default_service->type == CONNMAN_SERVICE_TYPE_WIFI)
+ return;
+
+ if (is_connected(default_service) == TRUE)
+ __connman_service_update_default_info(default_service);
+ else
+ __connman_service_update_default_info(service);
+ } else
+ __connman_service_update_default_info(service);
+}
+#endif
+
static void proxy_changed(struct connman_service *service)
{
connman_dbus_property_changed_dict(service->path,
CONNMAN_SERVICE_INTERFACE, "Proxy",
append_proxy, service);
+#if defined TIZEN_EXT
+ DBG("");
+ if (is_connected(service) == TRUE)
+ __connman_service_update_default(service);
+#endif
}
static void proxy_configuration_changed(struct connman_service *service)
#if defined TIZEN_EXT
/*
- * Description: SONET plug-in requires manual PROXY setting function
+ * Description: Telephony plug-in requires manual PROXY setting function
*/
void __connman_service_set_proxy(struct connman_service *service,
const char *proxies)
service = g_sequence_get(iter);
#if defined TIZEN_EXT
- DBG("service : %p, network name : %s, type : %d", service, service->name, service->type);
-
- /*
- * Currently, we use only cellular and Wi-Fi.
- * But if any type will be added later, this block should be modified as a new concept.
- */
- if(service->type == CONNMAN_SERVICE_TYPE_CELLULAR)
- {
- service = NULL;
- iter = g_sequence_iter_next(iter);
- continue;
- }
+ DBG("service: %p %s %s %s, favorite(%d), ignore(%d)", service, service->name,
+ state2string(service->state),
+ __connman_service_type2string(service->type),
+ service->favorite, is_ignore(service));
+
+ /* Tizen takes Wi-Fi as the highest priority into consideration. */
+ if (service->type != CONNMAN_SERVICE_TYPE_WIFI)
+ if (is_connecting(service) == TRUE || is_connected(service) == TRUE) {
+ service = NULL;
+ iter = g_sequence_iter_next(iter);
+ continue;
+ }
#endif
if (service->pending != NULL)
- {
- DBG("pending");
return;
- }
if (is_connecting(service) == TRUE)
- {
- DBG("connecting");
return;
- }
if (service->favorite == FALSE)
- {
- DBG("favorite is FALSE");
return;
- }
if (is_connected(service) == TRUE)
- {
- DBG("connected");
return;
- }
if (is_ignore(service) == FALSE && service->state ==
CONNMAN_SERVICE_STATE_IDLE)
- {
- DBG("try auto connecting");
break;
- }
- DBG("check the next service..");
service = NULL;
iter = g_sequence_iter_next(iter);
* Description: TIZEN implements system global connection management.
*/
if (service->type == CONNMAN_SERVICE_TYPE_CELLULAR)
- connman_service_user_initiated_pdp_connection_ref(service);
+ connman_service_user_initiated_pdn_connection_ref(service);
#endif
if (service->pending != NULL)
/*
* Description: TIZEN implements system global connection management.
*/
- if (service->type == CONNMAN_SERVICE_TYPE_CELLULAR)
- if (connman_service_user_initiated_pdp_connection_unref_and_test(service) != TRUE)
+ if (service->type == CONNMAN_SERVICE_TYPE_CELLULAR) {
+ if (connman_service_user_initiated_pdn_connection_unref_and_test(service) != TRUE)
return __connman_error_failed(msg, EISCONN);
- if (service->alwayson == TRUE)
- return __connman_error_failed(msg, EISCONN);
+ if (is_connected(service) == TRUE &&
+ service == __connman_service_get_default())
+ return __connman_error_failed(msg, EISCONN);
+ }
#endif
reply_pending(service, ECONNABORTED);
/*
* Description: TIZEN implements system global connection management.
*/
- g_atomic_int_set(&service->user_initiated_pdp_connection_refcount, 0);
- service->alwayson = FALSE;
+ g_atomic_int_set(&service->user_initiated_pdn_connection_refcount, 0);
#endif
}
return (gint) service_b->strength - (gint) service_a->strength;
}
-#if defined TIZEN_EXT
-struct connman_network* connman_service_get_network(struct connman_service* service){
- return service->network;
-}
-
-struct connman_ipconfig* connman_service_get_ipv4config(struct connman_service* service){
- return __connman_service_get_ip4config(service);
-}
-#endif
-
/**
* connman_service_get_type:
* @service: service structure
connman_bool_t favorite)
{
GSequenceIter *iter;
+
#if defined TIZEN_EXT
- struct connman_device *device = NULL;
+ if (service->type == CONNMAN_SERVICE_TYPE_CELLULAR)
+ return -EIO;
#endif
-
iter = g_hash_table_lookup(service_hash, service->identifier);
if (iter == NULL)
return -ENOENT;
__connman_profile_changed(FALSE);
#if defined TIZEN_EXT
- device = connman_network_get_device(service->network);
+ {
+ struct connman_device *device = connman_network_get_device(service->network);
- if (connman_device_get_type(device) == CONNMAN_DEVICE_TYPE_WIFI) {
- if (service->favorite == TRUE)
- connman_device_significant_wifi_profile_ref(device);
- else
- connman_device_significant_wifi_profile_unref_and_test(device);
- }
+ if (connman_device_get_type(device) == CONNMAN_DEVICE_TYPE_WIFI) {
+ if (service->favorite == TRUE)
+ connman_device_significant_wifi_profile_ref(device);
+ else
+ connman_device_significant_wifi_profile_unref_and_test(device);
+ }
- connman_device_save_significant_wifi_profile_refcount_to_storage(device);
+ connman_device_save_significant_wifi_profile_refcount_to_storage(device);
+ }
#endif
-
return 0;
}
}
}
+#if defined TIZEN_EXT
+static connman_bool_t __connman_service_can_drop_cellular(
+ struct connman_service *cellular)
+{
+ if (cellular->type == CONNMAN_SERVICE_TYPE_CELLULAR &&
+ is_connected(cellular) == TRUE)
+ if (connman_service_is_no_ref_user_initiated_pdn_connection(cellular) == TRUE)
+ return TRUE;
+ return FALSE;
+}
+
+static void __connman_service_connect_default(void)
+{
+ static struct connman_device *connecting_device = NULL;
+ struct connman_service *default_service = NULL;
+ struct connman_device *default_device = NULL;
+
+ default_service = __connman_service_get_default();
+
+ if (default_service != NULL) {
+ if (is_connecting(default_service) == FALSE &&
+ is_connected(default_service) == FALSE) {
+
+ default_device = connman_network_get_device(
+ __connman_service_get_network(default_service));
+
+ DBG("connecting_device %p", connecting_device);
+
+ if (connecting_device == default_device)
+ return;
+
+ connecting_device = default_device;
+ default_service->userconnect = FALSE;
+
+ DBG("Connecting default service %p %s",
+ default_service, default_service->path);
+ DBG("Connecting device %p %s", connecting_device,
+ connman_device_get_string(connecting_device, "Name"));
+
+ __connman_service_connect(default_service);
+ } else if (is_connected(default_service) == TRUE) {
+ DBG("default service connected %s", default_service->path);
+ connecting_device = NULL;
+ }
+ }
+}
+#endif
+
+static void service_single_connection(struct connman_service *allowed)
+{
+ GSequenceIter *iter;
+ GSList *services = NULL, *list;
+
+#if defined TIZEN_EXT
+ if (allowed->type == CONNMAN_SERVICE_TYPE_CELLULAR)
+ return;
+#endif
+
+ iter = g_sequence_get_begin_iter(service_list);
+
+ while (g_sequence_iter_is_end(iter) == FALSE) {
+ struct connman_service *service = g_sequence_get(iter);
+
+ if (service != allowed && is_connected(service))
+#if defined TIZEN_EXT
+ if (__connman_service_can_drop_cellular(service) == TRUE)
+#endif
+ services = g_slist_prepend(services, service);
+
+ iter = g_sequence_iter_next(iter);
+ }
+
+ DBG("Allowed %p %s", allowed, allowed->path);
+
+ for (list = services; list != NULL; list = list->next) {
+ struct connman_service *service = list->data;
+
+ DBG("Disconnecting %p %s", service, service->path);
+ __connman_service_disconnect(service);
+ }
+
+ g_slist_free(services);
+}
+
static int __connman_service_indicate_state(struct connman_service *service)
{
enum connman_service_state old_state, new_state;
reply_pending(service, ECONNABORTED);
__connman_device_request_scan(service->type);
-#else
+
+ __connman_service_update_default(service);
+#endif
connman_bool_t reconnect;
reconnect = get_reconnect_state(service);
__connman_service_auto_connect();
__connman_device_request_scan(CONNMAN_DEVICE_TYPE_UNKNOWN);
-#endif
}
if (new_state == CONNMAN_SERVICE_STATE_READY) {
set_reconnect_state(service, TRUE);
-#if defined TIZEN_EXT
- if (service->type != CONNMAN_SERVICE_TYPE_CELLULAR)
- __connman_service_set_favorite(service, TRUE);
-#else
__connman_service_set_favorite(service, TRUE);
-#endif
reply_pending(service, 0);
__connman_ipconfig_disable_ipv6(
service->ipconfig_ipv6);
+#if defined TIZEN_EXT
+ __connman_service_update_default(service);
+#endif
+ if (connman_setting_get_bool("SingleConnection") == TRUE)
+ service_single_connection(service);
+
} else if (new_state == CONNMAN_SERVICE_STATE_DISCONNECT) {
struct connman_service *def_service = get_default();
} else
service->error = CONNMAN_SERVICE_ERROR_UNKNOWN;
+#if defined TIZEN_EXT
+ __connman_service_connect_default();
+#endif
iter = g_hash_table_lookup(service_hash, service->identifier);
if (iter != NULL)
g_sequence_sort_changed(iter, service_compare, NULL);
#if defined TIZEN_EXT
if (new_state == CONNMAN_SERVICE_STATE_FAILURE &&
- service->type == CONNMAN_SERVICE_TYPE_CELLULAR) {
- g_atomic_int_set(&service->user_initiated_pdp_connection_refcount, 0);
- }
+ service->type == CONNMAN_SERVICE_TYPE_CELLULAR)
+ g_atomic_int_set(&service->user_initiated_pdn_connection_refcount, 0);
#endif
/* Any change? */
if (old_state == new_state)
return err;
}
-#if defined TIZEN_EXT
-int connman_service_connect(struct connman_service* service){
- DBG("service connect request path=%s", connman_network_get_identifier(service->network) );
- return __connman_service_connect(service);
-}
-#endif
-
int __connman_service_connect(struct connman_service *service)
{
int err;
return err;
}
-#if defined TIZEN_EXT
-int connman_service_disconnect(struct connman_service* service){
- DBG("service disconnect request path=%s", connman_network_get_identifier(service->network) );
- return __connman_service_disconnect(service);
-}
-#endif
-
int __connman_service_disconnect(struct connman_service *service)
{
int err;
char *group = NULL, *ident = NULL;
int err = 0;
struct connman_service *service;
-#if defined TIZEN_EXT
- struct connman_device * device;
- const char *mode = "managed", *security = "ieee8021x";
- char * name = NULL, *type = NULL;
- char * device_ident = NULL;
- int name_len = 0;
-#endif
DBG("");
if (err < 0)
goto done;
-#if !defined TIZEN_EXT
ident = group + strlen("service_");
-#else
- device = __connman_device_find_device(CONNMAN_SERVICE_TYPE_WIFI);
- if (device == NULL) {
- err = -EOPNOTSUPP;
- goto done;
- }
-
- device_ident = connman_device_get_ident(device);
- if (device_ident == NULL) {
- err = -EOPNOTSUPP;
- goto done;
- }
- type = g_key_file_get_string(keyfile, group, "Type", NULL);
- if(type == NULL) {
- err = -EINVAL;
- goto done;
- }
-
- name = g_key_file_get_string(keyfile, group, "Name", NULL);
- if(name == NULL) {
- err = -EINVAL;
- goto done;
- }
-
- name_len = strlen(name);
-
- group = wifi_build_group_name((unsigned char *) name,
- name_len, mode, security);
- if (group == NULL) {
- err = -EINVAL;
- goto done;
- }
-
- DBG("group %s ", group);
-
- ident = g_strdup_printf("%s_%s_%s", type, device_ident, group);
-#endif
/* trigger service provisioning if service exists */
service = lookup_by_identifier(ident);
if (service != NULL)
}
break;
-#if defined TIZEN_EXT
- case CONNMAN_SERVICE_TYPE_CELLULAR:
- break;
-#endif
}
str = g_key_file_get_string(keyfile,