diff options
author | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2011-01-26 09:50:32 +0100 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2011-01-26 09:56:37 +0100 |
commit | eae376791c4c19ceb0c09b26f722d685eed6d03f (patch) | |
tree | 80c1fc343744404f62263b68524ba58576ccd684 | |
parent | 2abadb22447f8d693c4cc7bae00b8cf869b625fa (diff) | |
download | connman-eae376791c4c19ceb0c09b26f722d685eed6d03f.tar.gz connman-eae376791c4c19ceb0c09b26f722d685eed6d03f.tar.bz2 connman-eae376791c4c19ceb0c09b26f722d685eed6d03f.zip |
ondemand: Remove ondemand.c
-rw-r--r-- | Makefile.am | 8 | ||||
-rw-r--r-- | include/ondemand.h | 38 | ||||
-rw-r--r-- | src/connman.h | 3 | ||||
-rw-r--r-- | src/dnsproxy.c | 37 | ||||
-rw-r--r-- | src/main.c | 2 | ||||
-rw-r--r-- | src/ondemand.c | 96 |
6 files changed, 5 insertions, 179 deletions
diff --git a/Makefile.am b/Makefile.am index f09c78c4..7582e2a7 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 ca689254..00000000 --- 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 6a9386e6..24d5d2c7 100644 --- a/src/connman.h +++ b/src/connman.h @@ -582,9 +582,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 e9241c28..31e91805 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 @@ -1113,8 +1110,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; } @@ -1224,8 +1220,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; @@ -1252,34 +1247,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); @@ -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(); @@ -272,7 +271,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 521800c3..00000000 --- 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); -} |