e_dbus/connman: add Nameservers property
authorlucas <lucas@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 14 Nov 2011 15:19:40 +0000 (15:19 +0000)
committerlucas <lucas@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 14 Nov 2011 15:19:40 +0000 (15:19 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/e_dbus@65182 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/connman/E_Connman.h
src/lib/connman/e_connman.c
src/lib/connman/e_connman_private.h
src/lib/connman/e_connman_service.c

index 449c6c7..69f8921 100644 (file)
@@ -151,6 +151,7 @@ EAPI Eina_Bool              e_connman_service_passphrase_required_get(const E_Co
 EAPI Eina_Bool              e_connman_service_login_required_get(const E_Connman_Element *service, Eina_Bool *login_required) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
 
 EAPI Eina_Bool              e_connman_service_roaming_get(const E_Connman_Element *service, Eina_Bool *roaming) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
+EAPI Eina_Bool              e_connman_service_nameservers_get(const E_Connman_Element *service, unsigned int *count, const char ***nameserver) EINA_ARG_NONNULL(1, 2, 3) EINA_WARN_UNUSED_RESULT;
 
 EAPI Eina_Bool              e_connman_service_ipv4_method_get(const E_Connman_Element *service, const char **method) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
 EAPI Eina_Bool              e_connman_service_ipv4_address_get(const E_Connman_Element *service, const char **address) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
index a7414e0..57f086c 100644 (file)
@@ -62,6 +62,7 @@ const char *e_connman_prop_technology_default = NULL;
 const char *e_connman_prop_technologies_available = NULL;
 const char *e_connman_prop_technologies_enabled = NULL;
 const char *e_connman_prop_technologies_connected = NULL;
+const char *e_connman_prop_nameservers = NULL;
 
 int _e_dbus_connman_log_dom = -1;
 
@@ -310,6 +311,7 @@ e_connman_system_init(E_DBus_Connection *edbus_conn)
    ADD_STRINGSHARE(e_connman_prop_technologies_enabled, "EnabledTechnologies");
    ADD_STRINGSHARE(e_connman_prop_technologies_connected,
                    "ConnectedTechnologies");
+   ADD_STRINGSHARE(e_connman_prop_nameservers, "Nameservers");
 
 #undef ADD_STRINGSHARE
 
@@ -403,6 +405,7 @@ e_connman_system_shutdown(void)
    _stringshare_del(&e_connman_prop_technologies_available);
    _stringshare_del(&e_connman_prop_technologies_enabled);
    _stringshare_del(&e_connman_prop_technologies_connected);
+   _stringshare_del(&e_connman_prop_nameservers);
 
    if (pending_get_name_owner)
      {
index 8f7e552..3a87ed1 100644 (file)
@@ -73,6 +73,7 @@ extern const char *e_connman_prop_technologies_available;
 extern const char *e_connman_prop_technologies_enabled;
 extern const char *e_connman_prop_technologies_connected;
 extern const char *e_connman_prop_login_required;
+extern const char *e_connman_prop_nameservers;
 
 extern int _e_dbus_connman_log_dom;
 
index e196130..f593cd6 100644 (file)
@@ -657,6 +657,46 @@ e_connman_service_roaming_get(const E_Connman_Element *service, Eina_Bool *roami
 }
 
 /**
+ * Get property "Nameservers" value.
+ *
+ * If this property isn't found then @c EINA_FALSE is returned.
+ * If @c EINA_FALSE is returned, then this call failed and parameter-returned
+ * values shall be considered invalid.
+ * The list of currently active nameservers for this service. If the server is
+ * not in READY or ONLINE state than this list will be empty.
+ *
+ * Global nameservers are automatically added to this list.
+ *
+ * The array represents a sorted list of the current nameservers. The first one
+ * has the highest priority and is used by default.
+ *
+ * When using DHCP this array represents the nameservers provided by the
+ * network. In case of manual settings, the ones from Nameservers.Configuration
+ * are used.
+ *
+ * @param service path to get property.
+ * @param count return the number of elements in array.
+ * @param nameservers array with pointers to internal strings. These
+ *        strings are not copied in any way, and they are granted to
+ *        be eina_stringshare instances, so one can use
+ *        eina_stringshare_ref() if he wants to save memory and cpu to
+ *        get an extra reference. The array itself is allocated using
+ *        malloc() and should be freed after usage is done. This
+ *        pointer is just set if return is @c EINA_TRUE.
+ *
+ * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
+ */
+Eina_Bool
+e_connman_service_nameservers_get(const E_Connman_Element *service, unsigned int *count, const char ***nameservers)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(nameservers, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(count, EINA_FALSE);
+   return e_connman_element_strings_array_get_stringshared
+             (service, e_connman_prop_nameservers, count, nameservers);
+}
+
+/**
  * Get property "IPv4.Method" value.
  *
  * If this property isn't found then @c EINA_FALSE is returned.