include/dbus.h include/rfkill.h include/option.h \
include/provider.h \
include/utsname.h include/timeserver.h include/proxy.h \
- include/location.h include/technology.h \
- include/setting.h
+ include/technology.h include/setting.h
local_headers = $(foreach file,$(include_HEADERS) $(nodist_include_HEADERS) \
$(noinst_HEADERS), include/connman/$(notdir $(file)))
src/dhcp.c src/rtnl.c src/proxy.c \
src/utsname.c src/timeserver.c src/rfkill.c \
src/storage.c src/dbus.c src/config.c \
- src/technology.c src/counter.c src/location.c \
+ src/technology.c src/counter.c \
src/session.c src/tethering.c src/wpad.c src/wispr.c \
src/stats.c src/iptables.c src/dnsproxy.c src/6to4.c
--enable-google \
--enable-meego \
--enable-client \
- --enable-portal \
--enable-hh2serial-gps \
--enable-ntpd \
--enable-openconnect \
builtin_sources += $(builtin_vpn_sources)
-if PORTAL
-if PORTAL_BUILTIN
-builtin_modules += portal
-builtin_sources += plugins/portal.c
-else
-plugin_LTLIBRARIES += plugins/portal.la
-plugin_objects += $(plugins_portal_la_OBJECTS)
-plugins_portal_la_CFLAGS = $(plugin_cflags)
-plugins_portal_la_LDFLAGS = $(plugin_ldflags)
-endif
-endif
-
if PACRUNNER
if PACRUNNER_BUILTIN
builtin_modules += pacrunner
AM_CONDITIONAL(OPENCONNECT, test "${enable_openconnect}" != "no")
AM_CONDITIONAL(OPENCONNECT_BUILTIN, test "${enable_openconnect}" = "builtin")
-AC_ARG_ENABLE(portal,
- AC_HELP_STRING([--enable-portal], [enable portal detection support]),
- [enable_portal=${enableval}], [enable_portal="no"])
-AM_CONDITIONAL(PORTAL, test "${enable_portal}" != "no")
-AM_CONDITIONAL(PORTAL_BUILTIN, test "${enable_portal}" = "builtin")
-
AC_ARG_WITH(openvpn, AC_HELP_STRING([--with-openvpn=PROGRAM],
[specify location of openvpn binary]), [path_openvpn=${withval}])
+++ /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
- *
- */
-
-#ifndef __CONNMAN_LOCATION_H
-#define __CONNMAN_LOCATION_H
-
-#include <connman/service.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define CONNMAN_LOCATION_PRIORITY_LOW -100
-#define CONNMAN_LOCATION_PRIORITY_DEFAULT 0
-#define CONNMAN_LOCATION_PRIORITY_HIGH 100
-
-/**
- * SECTION:location
- * @title: Location premitives
- * @short_description: Functions for detecting locations
- */
-
-enum connman_location_result {
- CONNMAN_LOCATION_RESULT_UNKNOWN = 0,
- CONNMAN_LOCATION_RESULT_PORTAL = 1,
- CONNMAN_LOCATION_RESULT_ONLINE = 2,
-};
-
-struct connman_location;
-
-struct connman_location *connman_location_ref(struct connman_location *location);
-void connman_location_unref(struct connman_location *location);
-
-enum connman_service_type connman_location_get_type(struct connman_location *location);
-char *connman_location_get_interface(struct connman_location *location);
-void connman_location_report_result(struct connman_location *location,
- enum connman_location_result result);
-
-void *connman_location_get_data(struct connman_location *location);
-void connman_location_set_data(struct connman_location *location, void *data);
-
-struct connman_service *connman_location_get_service(
- struct connman_location *location);
-
-struct connman_location_driver {
- const char *name;
- enum connman_service_type type;
- int priority;
- int (*detect) (struct connman_location *location);
- int (*finish) (struct connman_location *location);
-};
-
-int connman_location_driver_register(struct connman_location_driver *driver);
-void connman_location_driver_unregister(struct connman_location_driver *driver);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __CONNMAN_LOCATION_H */
+++ /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 <errno.h>
-#include <stdlib.h>
-
-#include <glib.h>
-
-#define CONNMAN_API_SUBJECT_TO_CHANGE
-#include <connman/plugin.h>
-#include <connman/location.h>
-#include <connman/proxy.h>
-#include <connman/log.h>
-
-#include "gweb/gweb.h"
-
-#define STATUS_URL "http://www.connman.net/online/status.html"
-
-struct server_data {
- unsigned int token;
- GWeb *web;
- guint request_id;
-};
-
-static void web_debug(const char *str, void *data)
-{
- connman_info("%s: %s\n", (const char *) data, str);
-}
-
-static gboolean web_result(GWebResult *result, gpointer user_data)
-{
- struct connman_location *location = user_data;
- struct server_data *data = connman_location_get_data(location);
- const char *str;
- guint16 status;
-
- if (data->request_id == 0)
- return FALSE;
-
- status = g_web_result_get_status(result);
-
- /* If status header is not available, it is a portal */
- if (g_web_result_get_header(result, "X-ConnMan-Status", &str) == FALSE)
- status = 302;
-
- DBG("status %u", status);
-
- switch (status) {
- case 200:
- if (g_web_result_get_header(result, "X-ConnMan-Client-IP",
- &str) == TRUE)
- connman_info("Client-IP: %s", str);
-
- if (g_web_result_get_header(result, "X-ConnMan-Client-Country",
- &str) == TRUE)
- connman_info("Client-Country: %s", str);
-
- if (g_web_result_get_header(result, "X-ConnMan-Client-Region",
- &str) == TRUE)
- connman_info("Client-Region: %s", str);
-
- connman_location_report_result(location,
- CONNMAN_LOCATION_RESULT_ONLINE);
- break;
- case 302:
- connman_location_report_result(location,
- CONNMAN_LOCATION_RESULT_PORTAL);
- break;
- default:
- connman_location_report_result(location,
- CONNMAN_LOCATION_RESULT_UNKNOWN);
- break;
- }
-
- data->request_id = 0;
-
- return FALSE;
-}
-
-static void proxy_callback(const char *proxy, void *user_data)
-{
- struct connman_location *location = user_data;
- struct server_data *data = connman_location_get_data(location);
-
- DBG("proxy %s", proxy);
-
- if (proxy == NULL)
- proxy = getenv("http_proxy");
-
- if (data != NULL) {
- if (proxy != NULL && g_strcmp0(proxy, "DIRECT") != 0)
- g_web_set_proxy(data->web, proxy);
-
- data->request_id = g_web_request_get(data->web, STATUS_URL,
- web_result, location);
-
- data->token = 0;
- }
-
- connman_location_unref(location);
-}
-
-static int location_detect(struct connman_location *location)
-{
- struct server_data *data;
- struct connman_service *service;
- enum connman_service_type service_type;
- char *interface;
- int err;
-
- DBG("location %p", location);
-
- service_type = connman_location_get_type(location);
-
- switch (service_type) {
- case CONNMAN_SERVICE_TYPE_ETHERNET:
- case CONNMAN_SERVICE_TYPE_WIFI:
- case CONNMAN_SERVICE_TYPE_WIMAX:
- case CONNMAN_SERVICE_TYPE_BLUETOOTH:
- case CONNMAN_SERVICE_TYPE_CELLULAR:
- break;
- case CONNMAN_SERVICE_TYPE_UNKNOWN:
- case CONNMAN_SERVICE_TYPE_SYSTEM:
- case CONNMAN_SERVICE_TYPE_GPS:
- case CONNMAN_SERVICE_TYPE_VPN:
- case CONNMAN_SERVICE_TYPE_GADGET:
- return -EOPNOTSUPP;
- }
-
- interface = connman_location_get_interface(location);
- if (interface == NULL)
- return -EINVAL;
-
- DBG("interface %s", interface);
-
- data = g_try_new0(struct server_data, 1);
- if (data == NULL) {
- err = -ENOMEM;
- goto done;
- }
-
- connman_location_set_data(location, data);
-
- data->web = g_web_new(0);
- if (data->web == NULL) {
- g_free(data);
- err = -ENOMEM;
- goto done;
- }
-
- if (getenv("CONNMAN_WEB_DEBUG"))
- g_web_set_debug(data->web, web_debug, "WEB");
-
- g_web_set_accept(data->web, NULL);
- g_web_set_user_agent(data->web, "ConnMan/%s", VERSION);
- g_web_set_close_connection(data->web, TRUE);
-
- connman_location_ref(location);
-
- service = connman_location_get_service(location);
- data->token = connman_proxy_lookup(interface, STATUS_URL,
- service, proxy_callback, location);
-
- if (data->token == 0) {
- connman_location_unref(location);
- err = -EINVAL;
- } else
- err = 0;
-
-done:
- g_free(interface);
- return err;
-}
-
-static int location_finish(struct connman_location *location)
-{
- struct server_data *data = connman_location_get_data(location);
-
- DBG("location %p", location);
-
- connman_location_set_data(location, NULL);
-
- if (data->request_id > 0)
- g_web_cancel_request(data->web, data->request_id);
-
- if (data->token > 0) {
- connman_proxy_lookup_cancel(data->token);
- connman_location_unref(location);
- }
-
- g_web_unref(data->web);
-
- g_free(data);
-
- return 0;
-}
-
-static struct connman_location_driver location = {
- .name = "portal",
- .type = CONNMAN_SERVICE_TYPE_WIFI,
- .priority = CONNMAN_LOCATION_PRIORITY_HIGH,
- .detect = location_detect,
- .finish = location_finish,
-};
-
-static int portal_init(void)
-{
- return connman_location_driver_register(&location);
-}
-
-static void portal_exit(void)
-{
- connman_location_driver_unregister(&location);
-}
-
-CONNMAN_PLUGIN_DEFINE(portal, "Portal detection plugin", VERSION,
- CONNMAN_PLUGIN_PRIORITY_DEFAULT, portal_init, portal_exit)
void __connman_service_session_inc(struct connman_service *service);
connman_bool_t __connman_service_session_dec(struct connman_service *service);
-#include <connman/location.h>
-
-int __connman_location_init(void);
-void __connman_location_cleanup(void);
-
-struct connman_location *__connman_location_create(struct connman_service *service);
-struct connman_location *__connman_service_get_location(struct connman_service *service);
-
-int __connman_location_detect(struct connman_service *service);
-int __connman_location_finish(struct connman_service *service);
-
#include <connman/notifier.h>
int __connman_technology_init(void);
+++ /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 <errno.h>
-
-#include "connman.h"
-
-struct connman_location {
- gint refcount;
- struct connman_service *service;
- enum connman_location_result result;
-
- struct connman_location_driver *driver;
- void *driver_data;
-};
-
-/**
- * connman_location_ref:
- * @location: Location structure
- *
- * Increase reference counter of location
- */
-struct connman_location *connman_location_ref(struct connman_location *location)
-{
- g_atomic_int_inc(&location->refcount);
-
- return location;
-}
-
-/**
- * connman_location_unref:
- * @location: Location structure
- *
- * Decrease reference counter of location
- */
-void connman_location_unref(struct connman_location *location)
-{
- if (g_atomic_int_dec_and_test(&location->refcount) == FALSE)
- return;
-
- if (location->driver) {
- location->driver->finish(location);
- location->driver = NULL;
- }
-
- g_free(location);
-}
-
-/**
- * connman_location_get_type:
- * @location: Location structure
- *
- * Get the service type of location
- */
-enum connman_service_type connman_location_get_type(struct connman_location *location)
-{
- if (location == NULL)
- return CONNMAN_SERVICE_TYPE_UNKNOWN;
-
- return connman_service_get_type(location->service);
-}
-
-/**
- * connman_location_get_interface:
- * @location: location structure
- *
- * Get network interface of location
- */
-char *connman_location_get_interface(struct connman_location *location)
-{
- if (location == NULL)
- return NULL;
-
- return connman_service_get_interface(location->service);
-}
-
-struct connman_service *connman_location_get_service(
- struct connman_location *location)
-{
- return location->service;
-}
-/**
- * connman_location_get_data:
- * @location: Location structure
- *
- * Get private location data pointer
- */
-void *connman_location_get_data(struct connman_location *location)
-{
- return location->driver_data;
-}
-
-/**
- * connman_location_set_data:
- * @location: Location structure
- * @data: data pointer
- *
- * Set private location data pointer
- */
-void connman_location_set_data(struct connman_location *location, void *data)
-{
- location->driver_data = data;
-}
-
-static GSList *driver_list = NULL;
-
-static gint compare_priority(gconstpointer a, gconstpointer b)
-{
- const struct connman_location_driver *driver1 = a;
- const struct connman_location_driver *driver2 = b;
-
- return driver2->priority - driver1->priority;
-}
-
-/**
- * connman_location_driver_register:
- * @driver: Location driver definition
- *
- * Register a new Location driver
- *
- * Returns: %0 on success
- */
-int connman_location_driver_register(struct connman_location_driver *driver)
-{
- DBG("driver %p name %s", driver, driver->name);
-
- driver_list = g_slist_insert_sorted(driver_list, driver,
- compare_priority);
-
- return 0;
-}
-
-/**
- * connman_location_driver_unregister:
- * @driver: Location driver definition
- *
- * Remove a previously registered Location driver
- */
-void connman_location_driver_unregister(struct connman_location_driver *driver)
-{
- DBG("driver %p name %s", driver, driver->name);
-
- driver_list = g_slist_remove(driver_list, driver);
-}
-
-/**
- * connman_location_report_result:
- * @location: location structure
- * @result: result information
- *
- * Report result of a location detection
- */
-void connman_location_report_result(struct connman_location *location,
- enum connman_location_result result)
-{
- DBG("location %p result %d", location, result);
-
- if (location == NULL)
- return;
-
- if (location->result == result)
- return;
-
- location->result = result;
-
- switch (location->result) {
- case CONNMAN_LOCATION_RESULT_UNKNOWN:
- return;
- case CONNMAN_LOCATION_RESULT_PORTAL:
- __connman_service_request_login(location->service);
- break;
- case CONNMAN_LOCATION_RESULT_ONLINE:
- __connman_service_ipconfig_indicate_state(location->service,
- CONNMAN_SERVICE_STATE_ONLINE,
- CONNMAN_IPCONFIG_TYPE_IPV4);
- break;
- }
-}
-
-struct connman_location *__connman_location_create(struct connman_service *service)
-{
- struct connman_location *location;
-
- DBG("service %p", service);
-
- if (service == NULL)
- return NULL;
-
- location = g_try_new0(struct connman_location, 1);
- if (location == NULL)
- return NULL;
-
- DBG("location %p", location);
-
- location->refcount = 1;
-
- location->service = service;
- location->result = CONNMAN_LOCATION_RESULT_UNKNOWN;
-
- return location;
-}
-
-int __connman_location_detect(struct connman_service *service)
-{
- struct connman_location *location;
- GSList *list;
-
- DBG("service %p", service);
-
- location = __connman_service_get_location(service);
- if (location == NULL)
- return -EINVAL;
-
- if (location->driver) {
- location->result = CONNMAN_LOCATION_RESULT_UNKNOWN;
- location->driver->finish(location);
-
- if (location->driver->detect(location) == 0)
- return 0;
-
- location->driver = NULL;
- }
-
- for (list = driver_list; list; list = list->next) {
- struct connman_location_driver *driver = list->data;
-
- DBG("driver %p name %s", driver, driver->name);
-
- if (driver->detect(location) == 0) {
- location->driver = driver;
- break;
- }
- }
-
- if (location->driver == NULL)
- connman_location_report_result(location,
- CONNMAN_LOCATION_RESULT_ONLINE);
-
- return 0;
-}
-
-int __connman_location_finish(struct connman_service *service)
-{
- struct connman_location *location;
-
- DBG("service %p", service);
-
- location = __connman_service_get_location(service);
- if (location == NULL)
- return -EINVAL;
-
- location->result = CONNMAN_LOCATION_RESULT_UNKNOWN;
-
- if (location->driver) {
- location->driver->finish(location);
- location->driver = NULL;
- }
-
- return 0;
-}
-
-int __connman_location_init(void)
-{
- DBG("");
-
- return 0;
-}
-
-void __connman_location_cleanup(void)
-{
- DBG("");
-}
__connman_storage_migrate();
__connman_technology_init();
__connman_notifier_init();
- __connman_location_init();
__connman_service_init();
__connman_provider_init();
__connman_network_init();
__connman_device_cleanup();
__connman_network_cleanup();
__connman_service_cleanup();
- __connman_location_cleanup();
__connman_notifier_cleanup();
__connman_technology_cleanup();
char *phase2;
DBusMessage *pending;
guint timeout;
- struct connman_location *location;
struct connman_stats stats;
struct connman_stats stats_roaming;
GHashTable *counter_table;
service->ipconfig_ipv6 = NULL;
}
- if (service->location != NULL)
- connman_location_unref(service->location);
-
g_strfreev(service->nameservers);
g_strfreev(service->nameservers_config);
g_strfreev(service->domains);
service_initialize(service);
- service->location = __connman_location_create(service);
-
return service;
}
-struct connman_location *__connman_service_get_location(struct connman_service *service)
-{
- return service->location;
-}
-
/**
* connman_service_ref:
* @service: service structure
def_service->provider != NULL)
__connman_provider_disconnect(def_service->provider);
- __connman_location_finish(service);
-
default_changed();
__connman_wpad_stop(service);
default_changed();
- __connman_location_detect(service);
-
return 0;
}