summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/connection-api.txt12
-rw-r--r--src/connection.c11
-rw-r--r--src/connman.h3
-rw-r--r--src/element.c24
4 files changed, 50 insertions, 0 deletions
diff --git a/doc/connection-api.txt b/doc/connection-api.txt
index a0c97da3..8e2e8bca 100644
--- a/doc/connection-api.txt
+++ b/doc/connection-api.txt
@@ -39,6 +39,18 @@ Properties string Type [readonly]
Indicates if it is a default connection. It is
possible to have multiple default connections.
+ object Device [readonly]
+
+ The object path of the device this connection has
+ been established with.
+
+ object Network [readonly]
+
+ The object path of the network this connection
+ belongs to.
+
+ This property is optional and not always present.
+
string IPv4.Method [readonly]
Indicates the way how the IPv4 settings were
diff --git a/src/connection.c b/src/connection.c
index ad381470..980b770f 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -206,6 +206,7 @@ static DBusMessage *get_properties(DBusConnection *conn,
DBusMessage *reply;
DBusMessageIter array, dict;
connman_uint8_t strength = 0;
+ const char *device, *network;
const char *type = NULL, *method = NULL;
const char *address = NULL, *netmask = NULL, *gateway = NULL;
@@ -244,6 +245,16 @@ static DBusMessage *get_properties(DBusConnection *conn,
connman_dbus_dict_append_variant(&dict, "Default",
DBUS_TYPE_BOOLEAN, &element->enabled);
+ device = __connman_element_get_device(element);
+ if (device != NULL)
+ connman_dbus_dict_append_variant(&dict, "Device",
+ DBUS_TYPE_OBJECT_PATH, &device);
+
+ network = __connman_element_get_network(element);
+ if (network != NULL)
+ connman_dbus_dict_append_variant(&dict, "Network",
+ DBUS_TYPE_OBJECT_PATH, &network);
+
connman_element_get_value(element,
CONNMAN_PROPERTY_ID_IPV4_METHOD, &method);
diff --git a/src/connman.h b/src/connman.h
index cca7ea8a..545183e3 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -117,6 +117,9 @@ void __connman_element_list(struct connman_element *element,
int __connman_element_count(struct connman_element *element,
enum connman_element_type type);
+const char *__connman_element_get_device(struct connman_element *element);
+const char *__connman_element_get_network(struct connman_element *element);
+
const char *__connman_element_type2string(enum connman_element_type type);
static inline void __connman_element_lock(struct connman_element *element)
diff --git a/src/element.c b/src/element.c
index fb11f79c..2baeb1a3 100644
--- a/src/element.c
+++ b/src/element.c
@@ -427,6 +427,30 @@ int __connman_element_count(struct connman_element *element,
return data.count;
}
+const char *__connman_element_get_device(struct connman_element *element)
+{
+ if (element->type == CONNMAN_ELEMENT_TYPE_DEVICE &&
+ element->device != NULL)
+ return element->path;
+
+ if (element->parent == NULL)
+ return NULL;
+
+ return __connman_element_get_device(element->parent);
+}
+
+const char *__connman_element_get_network(struct connman_element *element)
+{
+ if (element->type == CONNMAN_ELEMENT_TYPE_NETWORK &&
+ element->network != NULL)
+ return element->path;
+
+ if (element->parent == NULL)
+ return NULL;
+
+ return __connman_element_get_network(element->parent);
+}
+
static gint compare_priority(gconstpointer a, gconstpointer b)
{
const struct connman_driver *driver1 = a;