[PATCH v1 4/4] ondemand: Remove ondemand.c

Daniel Wagner wagi at monom.org
Tue Jan 25 01:59:41 PST 2011


From: Daniel Wagner <daniel.wagner at bmw-carit.de>

---
 Makefile.am        |    8 ++---
 include/ondemand.h |   38 --------------------
 src/connman.h      |    3 --
 src/dnsproxy.c     |   37 +-------------------
 src/main.c         |    2 -
 src/ondemand.c     |   96 ----------------------------------------------------
 6 files changed, 5 insertions(+), 179 deletions(-)
 delete mode 100644 include/ondemand.h
 delete mode 100644 src/ondemand.c

diff --git a/Makefile.am b/Makefile.am
index f09c78c..7582e2a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -7,8 +7,7 @@ include_HEADERS = include/types.h include/log.h include/plugin.h \
 			include/notifier.h \
 			include/storage.h include/service.h \
 			include/resolver.h include/ipconfig.h \
-			include/device.h include/network.h include/inet.h \
-			include/ondemand.h
+			include/device.h include/network.h include/inet.h
 
 nodist_include_HEADERS = include/version.h
 
@@ -72,9 +71,8 @@ src_connmand_SOURCES = $(gdbus_sources) $(gdhcp_sources) \
 			src/utsname.c src/timeserver.c src/rfkill.c \
 			src/wifi.c src/storage.c src/dbus.c src/config.c \
 			src/technology.c src/counter.c src/location.c \
-			src/session.c src/tethering.c src/ondemand.c \
-			src/wpad.c src/wispr.c src/stats.c src/iptables.c \
-			src/dnsproxy.c
+			src/session.c src/tethering.c src/wpad.c src/wispr.c \
+			src/stats.c src/iptables.c src/dnsproxy.c
 
 src_connmand_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ \
 				@CAPNG_LIBS@ @XTABLES_LIBS@ -lresolv -ldl
diff --git a/include/ondemand.h b/include/ondemand.h
deleted file mode 100644
index ca68925..0000000
--- a/include/ondemand.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *
- *  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
- *
- */
-
-#ifndef __CONNMAN_ONDEMAND_H
-#define __CONNMAN_ONDEMAND_H
-
-#include <glib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-gboolean connman_ondemand_connected(void);
-int connman_ondemand_start(const char *pref_bearer, unsigned int idle_timeout);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __CONNMAN_ONDEMAND_H */
diff --git a/src/connman.h b/src/connman.h
index d322b1e..a278006 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -580,9 +580,6 @@ struct connman_service *__connman_session_request(const char *bearer, const char
 int __connman_session_init(void);
 void __connman_session_cleanup(void);
 
-int __connman_ondemand_init(void);
-void __connman_ondemand_cleanup(void);
-
 struct connman_stats_data {
 	unsigned int rx_packets;
 	unsigned int tx_packets;
diff --git a/src/dnsproxy.c b/src/dnsproxy.c
index cf907bc..cbd07c3 100644
--- a/src/dnsproxy.c
+++ b/src/dnsproxy.c
@@ -35,9 +35,6 @@
 
 #include <glib.h>
 
-#define CONNMAN_API_SUBJECT_TO_CHANGE
-#include <connman/ondemand.h>
-
 #include "connman.h"
 
 #if __BYTE_ORDER == __LITTLE_ENDIAN
@@ -1120,8 +1117,7 @@ static gboolean tcp_listener_event(GIOChannel *channel, GIOCondition condition,
 	DBG("Received %d bytes (id 0x%04x)", len, buf[2] | buf[3] << 8);
 
 	err = parse_request(buf + 2, len - 2, query, sizeof(query));
-	if (err < 0 || (g_slist_length(server_list) == 0 &&
-				connman_ondemand_connected())) {
+	if (err < 0 || (g_slist_length(server_list) == 0)) {
 		send_response(client_sk, buf, len, NULL, 0, IPPROTO_TCP);
 		return TRUE;
 	}
@@ -1231,8 +1227,7 @@ static gboolean udp_listener_event(GIOChannel *channel, GIOCondition condition,
 	DBG("Received %d bytes (id 0x%04x)", len, buf[0] | buf[1] << 8);
 
 	err = parse_request(buf, len, query, sizeof(query));
-	if (err < 0 || (g_slist_length(server_list) == 0 &&
-				connman_ondemand_connected())) {
+	if (err < 0 || (g_slist_length(server_list) == 0)) {
 		send_response(sk, buf, len, (void *)&client_addr,
 			      client_addr_len, IPPROTO_UDP);
 		return TRUE;
@@ -1259,34 +1254,6 @@ static gboolean udp_listener_event(GIOChannel *channel, GIOCondition condition,
 	buf[0] = req->dstid & 0xff;
 	buf[1] = req->dstid >> 8;
 
-	if (!connman_ondemand_connected()) {
-		DBG("Starting on demand connection");
-		/*
-		 * We're not connected, let's queue the request and start
-		 * an on-demand connection.
-		 */
-		req->request = g_try_malloc0(req->request_len);
-		if (req->request == NULL)
-			return TRUE;
-
-		memcpy(req->request, buf, req->request_len);
-
-		req->name = g_try_malloc0(sizeof(query));
-		if (req->name == NULL) {
-			g_free(req->request);
-			return TRUE;
-		}
-		memcpy(req->name, query, sizeof(query));
-
-		request_pending_list = g_slist_append(request_pending_list,
-									req);
-
-		connman_ondemand_start("", 300);
-
-		return TRUE;
-	}
-
-
 	req->numserv = 0;
 	req->timeout = g_timeout_add_seconds(5, request_timeout, req);
 	request_list = g_slist_append(request_list, req);
diff --git a/src/main.c b/src/main.c
index 8eaab16..01ae243 100644
--- a/src/main.c
+++ b/src/main.c
@@ -222,7 +222,6 @@ int main(int argc, char *argv[])
 	__connman_iptables_init();
 	__connman_tethering_init();
 	__connman_counter_init();
-	__connman_ondemand_init();
 	__connman_manager_init(option_compat);
 	__connman_profile_init();
 	__connman_config_init();
@@ -274,7 +273,6 @@ int main(int argc, char *argv[])
 	__connman_config_cleanup();
 	__connman_profile_cleanup();
 	__connman_manager_cleanup();
-	__connman_ondemand_cleanup();
 	__connman_counter_cleanup();
 	__connman_agent_cleanup();
 	__connman_tethering_cleanup();
diff --git a/src/ondemand.c b/src/ondemand.c
deleted file mode 100644
index 521800c..0000000
--- a/src/ondemand.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- *
- *  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 <connman/service.h>
-#include <connman/ondemand.h>
-#include <connman/notifier.h>
-#include <connman/log.h>
-
-#include "connman.h"
-
-static volatile gint started;
-static gboolean connected;
-struct connman_service *ondemand_service;
-
-static void ondemand_default_changed(struct connman_service *service)
-{
-	DBG("service %p", service);
-
-	if (service == NULL) {
-		connected = FALSE;
-		return;
-	}
-
-	connected = TRUE;
-}
-
-static struct connman_notifier ondemand_notifier = {
-	.name			= "ondemand",
-	.default_changed	= ondemand_default_changed,
-};
-
-gboolean connman_ondemand_connected(void)
-{
-	DBG("connected %d", connected);
-
-	return TRUE;
-//	return connected;
-}
-
-int connman_ondemand_start(const char *bearer, unsigned int idle_timeout)
-{
-	DBG("");
-
-	if (g_atomic_int_get(&started) > 0)
-		return 0;
-
-	g_atomic_int_inc(&started);
-
-	ondemand_service = __connman_session_request(bearer, "__ondemand__");
-	if (ondemand_service == NULL)
-		g_atomic_int_set(&started, 0);
-
-	/* TODO:
-	 * 1) Set IDLETIMER target.
-	 * 2) Listen for the sysfs/netlink event.
-	 * 3) Stop the session.
-	 */
-
-	return 0;
-}
-
-int __connman_ondemand_init(void)
-{
-	DBG("");
-
-	return connman_notifier_register(&ondemand_notifier);
-}
-
-void __connman_ondemand_cleanup(void)
-{
-	DBG("");
-
-	connman_notifier_unregister(&ondemand_notifier);
-}
-- 
1.7.3.4




More information about the connman mailing list