summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2010-07-15 10:05:55 -0700
committerMarcel Holtmann <marcel@holtmann.org>2010-07-15 10:05:55 -0700
commit54c3ca35ef4601a5068b7cae464197648d6918dc (patch)
treeeb63fef9a479e9afad00d8e492cd7b6f44936516 /src
parentcd145e6119b67833c68e618dd668a02f828fbadf (diff)
downloadconnman-54c3ca35ef4601a5068b7cae464197648d6918dc.tar.gz
connman-54c3ca35ef4601a5068b7cae464197648d6918dc.tar.bz2
connman-54c3ca35ef4601a5068b7cae464197648d6918dc.zip
Add technology driver callbacks for adding/removing interfaces
Diffstat (limited to 'src')
-rw-r--r--src/connman.h4
-rw-r--r--src/rtnl.c8
-rw-r--r--src/technology.c73
3 files changed, 81 insertions, 4 deletions
diff --git a/src/connman.h b/src/connman.h
index ebd94b3e..6b9a34a7 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -301,6 +301,10 @@ int __connman_technology_update_rfkill(unsigned int index,
connman_bool_t hardblock);
int __connman_technology_remove_rfkill(unsigned int index);
+void __connman_technology_add_interface(enum connman_service_type type,
+ int index, const char *name);
+void __connman_technology_remove_interface(enum connman_service_type type,
+ int index, const char *name);
int __connman_technology_enable_tethering(void);
int __connman_technology_disable_tethering(void);
diff --git a/src/rtnl.c b/src/rtnl.c
index 74eafc69..cbf9bb5d 100644
--- a/src/rtnl.c
+++ b/src/rtnl.c
@@ -68,8 +68,8 @@ static void free_interface(gpointer data)
{
struct interface_data *interface = data;
- connman_info("Remove interface %s [ %s ]", interface->name,
- __connman_service_type2string(interface->type));
+ __connman_technology_remove_interface(interface->type,
+ interface->index, interface->name);
g_free(interface->name);
g_free(interface);
@@ -388,8 +388,8 @@ static void process_newlink(unsigned short type, int index, unsigned flags,
read_uevent(interface);
- connman_info("Create interface %s [ %s ]", interface->name,
- __connman_service_type2string(interface->type));
+ __connman_technology_add_interface(interface->type,
+ interface->index, interface->name);
}
for (list = rtnl_list; list; list = list->next) {
diff --git a/src/technology.c b/src/technology.c
index 0ee91a39..34c50be6 100644
--- a/src/technology.c
+++ b/src/technology.c
@@ -100,6 +100,79 @@ void connman_technology_driver_unregister(struct connman_technology_driver *driv
driver_list = g_slist_remove(driver_list, driver);
}
+void __connman_technology_add_interface(enum connman_service_type type,
+ int index, const char *name)
+{
+ GSList *list;
+
+ switch (type) {
+ case CONNMAN_SERVICE_TYPE_UNKNOWN:
+ case CONNMAN_SERVICE_TYPE_SYSTEM:
+ return;
+ 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:
+ case CONNMAN_SERVICE_TYPE_GPS:
+ case CONNMAN_SERVICE_TYPE_VPN:
+ break;
+ }
+
+ connman_info("Create interface %s [ %s ]", name,
+ __connman_service_type2string(type));
+
+ for (list = technology_list; list; list = list->next) {
+ struct connman_technology *technology = list->data;
+
+ if (technology->type != type)
+ continue;
+
+ if (technology->driver == NULL)
+ continue;
+
+ if (technology->driver->add_interface)
+ technology->driver->add_interface(technology,
+ index, name);
+ }
+}
+
+void __connman_technology_remove_interface(enum connman_service_type type,
+ int index, const char *name)
+{
+ GSList *list;
+
+ switch (type) {
+ case CONNMAN_SERVICE_TYPE_UNKNOWN:
+ case CONNMAN_SERVICE_TYPE_SYSTEM:
+ return;
+ 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:
+ case CONNMAN_SERVICE_TYPE_GPS:
+ case CONNMAN_SERVICE_TYPE_VPN:
+ break;
+ }
+
+ connman_info("Remove interface %s [ %s ]", name,
+ __connman_service_type2string(type));
+
+ for (list = technology_list; list; list = list->next) {
+ struct connman_technology *technology = list->data;
+
+ if (technology->type != type)
+ continue;
+
+ if (technology->driver == NULL)
+ continue;
+
+ if (technology->driver->remove_interface)
+ technology->driver->remove_interface(technology, index);
+ }
+}
+
static int set_tethering(connman_bool_t enabled)
{
GSList *list;