e_dbus/connman: add readonly Proxy properties
authorlucas <lucas@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 14 Nov 2011 15:19:58 +0000 (15:19 +0000)
committerlucas <lucas@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 14 Nov 2011 15:19:58 +0000 (15:19 +0000)
Properties inside Proxy dictionary include: Method, URL, Servers and
Excludes.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/e_dbus@65185 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 caf179c..a24d5f9 100644 (file)
@@ -164,6 +164,11 @@ EAPI Eina_Bool              e_connman_service_ipv4_configuration_address_get(con
 EAPI Eina_Bool              e_connman_service_ipv4_configuration_gateway_get(const E_Connman_Element *service, const char **gateway) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
 EAPI Eina_Bool              e_connman_service_ipv4_configuration_netmask_get(const E_Connman_Element *service, const char **netmask) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
 
+EAPI Eina_Bool              e_connman_service_proxy_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_proxy_url_get(const E_Connman_Element *service, const char **url) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
+EAPI Eina_Bool              e_connman_service_proxy_servers_get(const E_Connman_Element *service, unsigned int *count, const char ***servers) EINA_ARG_NONNULL(1, 2, 3) EINA_WARN_UNUSED_RESULT;
+EAPI Eina_Bool              e_connman_service_proxy_excludes_get(const E_Connman_Element *service, unsigned int *count, const char ***excludes) EINA_ARG_NONNULL(1, 2, 3) EINA_WARN_UNUSED_RESULT;
+
 EAPI Eina_Bool              e_connman_service_ethernet_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_ethernet_interface_get(const E_Connman_Element *service, const char **iface) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
 EAPI Eina_Bool              e_connman_service_ethernet_address_get(const E_Connman_Element *service, const char **address) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
index d8306c4..58a3e75 100644 (file)
@@ -64,6 +64,10 @@ const char *e_connman_prop_technologies_enabled = NULL;
 const char *e_connman_prop_technologies_connected = NULL;
 const char *e_connman_prop_nameservers = NULL;
 const char *e_connman_prop_domains = NULL;
+const char *e_connman_prop_proxy = NULL;
+const char *e_connman_prop_url = NULL;
+const char *e_connman_prop_servers = NULL;
+const char *e_connman_prop_excludes = NULL;
 
 int _e_dbus_connman_log_dom = -1;
 
@@ -314,6 +318,10 @@ e_connman_system_init(E_DBus_Connection *edbus_conn)
                    "ConnectedTechnologies");
    ADD_STRINGSHARE(e_connman_prop_nameservers, "Nameservers");
    ADD_STRINGSHARE(e_connman_prop_domains, "Domains");
+   ADD_STRINGSHARE(e_connman_prop_proxy, "Proxy");
+   ADD_STRINGSHARE(e_connman_prop_url, "URL");
+   ADD_STRINGSHARE(e_connman_prop_servers, "Servers");
+   ADD_STRINGSHARE(e_connman_prop_excludes, "Excludes");
 
 #undef ADD_STRINGSHARE
 
@@ -409,6 +417,10 @@ e_connman_system_shutdown(void)
    _stringshare_del(&e_connman_prop_technologies_connected);
    _stringshare_del(&e_connman_prop_nameservers);
    _stringshare_del(&e_connman_prop_domains);
+   _stringshare_del(&e_connman_prop_proxy);
+   _stringshare_del(&e_connman_prop_url);
+   _stringshare_del(&e_connman_prop_servers);
+   _stringshare_del(&e_connman_prop_excludes);
 
    if (pending_get_name_owner)
      {
index ddc3e5e..1a76656 100644 (file)
@@ -75,6 +75,10 @@ extern const char *e_connman_prop_technologies_connected;
 extern const char *e_connman_prop_login_required;
 extern const char *e_connman_prop_nameservers;
 extern const char *e_connman_prop_domains;
+extern const char *e_connman_prop_proxy;
+extern const char *e_connman_prop_url;
+extern const char *e_connman_prop_servers;
+extern const char *e_connman_prop_excludes;
 
 extern int _e_dbus_connman_log_dom;
 
index 12f1f26..e3dd199 100644 (file)
@@ -1062,13 +1062,13 @@ e_connman_service_ipv4_configure_manual(E_Connman_Element *service, const char *
 }
 
 /**
- * Get property "Ethernet.Method" value.
+ * Get property "Proxy.Method" 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 Ethernet configuration method. Possible values here "auto" and "manual".
+ * Possible values are "direct", "auto" and "manual".
  *
  * @param service path to get property.
  * @param method where to store the property value, must be a pointer
@@ -1079,12 +1079,107 @@ e_connman_service_ipv4_configure_manual(E_Connman_Element *service, const char *
  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
  */
 Eina_Bool
-e_connman_service_ethernet_method_get(const E_Connman_Element *service, const char **method)
+e_connman_service_proxy_method_get(const E_Connman_Element *service, const char **method)
 {
    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
    EINA_SAFETY_ON_NULL_RETURN_VAL(method, EINA_FALSE);
    return e_connman_element_property_dict_get_stringshared
-             (service, e_connman_prop_ethernet, e_connman_prop_method, NULL, method);
+             (service, e_connman_prop_proxy, e_connman_prop_method, NULL, method);
+}
+
+/**
+ * Get property "Proxy.URL" 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.
+ *
+ * Automatic proxy configuration URL. Used by "auto" method.
+ *
+ * @param service path to get property.
+ * @param url where to store the property value, must be a pointer
+ *        to string (const char **), it will not be allocated or
+ *        copied and references will be valid until element changes,
+ *        so copy it if you want to use it later.
+ *
+ * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
+ */
+Eina_Bool
+e_connman_service_proxy_url_get(const E_Connman_Element *service, const char **url)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(url, EINA_FALSE);
+   return e_connman_element_property_dict_get_stringshared
+             (service, e_connman_prop_proxy, e_connman_prop_url, NULL, url);
+}
+
+/**
+ * Get property "Proxy.Servers" 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.
+ *
+ * List of proxy URIs. The URI without a protocol will be interpreted as the
+ * generic proxy URI. All others will target a specific protocol and only once.
+ * Example of generic proxy server entry would be like this:
+ * "server.example.com:911".
+ *
+ * Used when "manual" method is set.
+ *
+ * @param service path to get property.
+ * @param count return the number of elements in array.
+ * @param servers 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_proxy_servers_get(const E_Connman_Element *service, unsigned int *count, const char ***servers)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(servers, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(count, EINA_FALSE);
+   return e_connman_element_property_dict_strings_array_get_stringshared
+             (service, e_connman_prop_proxy, e_connman_prop_servers, count, servers);
+}
+
+/**
+ * Get property "Proxy.Excludes" 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.
+ *
+ * List of hosts which can be accessed directly.
+ *
+ * Used when "manual" method is set.
+ *
+ * @param service path to get property.
+ * @param count return the number of elements in array.
+ * @param excludes 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_proxy_excludes_get(const E_Connman_Element *service, unsigned int *count, const char ***excludes)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(excludes, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(count, EINA_FALSE);
+   return e_connman_element_property_dict_strings_array_get_stringshared
+             (service, e_connman_prop_proxy, e_connman_prop_excludes, count, excludes);
 }
 
 /**
@@ -1114,6 +1209,32 @@ e_connman_service_ethernet_interface_get(const E_Connman_Element *service, const
 }
 
 /**
+ * Get property "Ethernet.Method" 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 Ethernet configuration method. Possible values here "auto" and "manual".
+ *
+ * @param service path to get property.
+ * @param method where to store the property value, must be a pointer
+ *        to string (const char **), it will not be allocated or
+ *        copied and references will be valid until element changes,
+ *        so copy it if you want to use it later.
+ *
+ * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
+ */
+Eina_Bool
+e_connman_service_ethernet_method_get(const E_Connman_Element *service, const char **method)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(method, EINA_FALSE);
+   return e_connman_element_property_dict_get_stringshared
+             (service, e_connman_prop_ethernet, e_connman_prop_method, NULL, method);
+}
+
+/**
  * Get property "Ethernet.Speed" value.
  *
  * If this property isn't found then @c EINA_FALSE is returned.