e_connman0_7x: phase-1 - revert to old code
[framework/uifw/edbus.git] / src / lib / connman / e_connman_service.c
index 12f1f26..9638b4f 100644 (file)
@@ -342,20 +342,23 @@ e_connman_service_type_get(const E_Connman_Element *service, const char **type)
  * services.
  *
  * @param service path to get property.
+ * @param count where to return the number of elements in @a security
  * @param security where to store the property value, must be a pointer
- *        to E_Connman_Array, it will not be allocated or
+ *        to array of strings, 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_security_get(const E_Connman_Element *service, const E_Connman_Array **security)
+e_connman_service_security_get(const E_Connman_Element *service, unsigned int *count, const char ***security)
 {
    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(count, EINA_FALSE);
    EINA_SAFETY_ON_NULL_RETURN_VAL(security, EINA_FALSE);
-   return e_connman_element_property_get_stringshared
-             (service, e_connman_prop_security, NULL, security);
+
+   return e_connman_element_strings_array_get_stringshared
+     (service, e_connman_prop_security, count, security);
 }
 
 /**
@@ -680,9 +683,9 @@ e_connman_service_roaming_get(const E_Connman_Element *service, Eina_Bool *roami
  *        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.
+ *        get an extra reference. The array itself is also NOT
+ *        allocated or copied, do not modify it. This pointer is just
+ *        set if return is @c EINA_TRUE.
  *
  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
  */
@@ -697,6 +700,80 @@ e_connman_service_nameservers_get(const E_Connman_Element *service, unsigned int
 }
 
 /**
+ * Get property "Nameservers.Configuration" 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.
+ *
+ * Unlike Nameservers, this is the user-set value, rather than the
+ * actual value.
+ *
+ * @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 also NOT
+ *        allocated or copied, do not modify it. 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_configuration_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_configuration,
+              count, nameservers);
+}
+
+/**
+ * Set property "Nameservers.Configuration" 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.
+ *
+ * Unlike Nameservers, this is the user-set value, rather than the actual value.
+ * It allows user to override the default setting.  When using manual
+ * configuration and no global nameservers are configured, then it is useful to
+ * configure this setting as well.
+ *
+ * This list is sorted by priority and the first entry represents the nameserver
+ * with the highest priority.
+ *
+ * Changes to the domain name servers can be done at any time. It will not cause
+ * a disconnect of the service. However there might be small window where name
+ * resolution might fail.
+ *
+ * @param service path to set property.
+ * @param nameservers sorted list of the current nameservers. The first one has
+ * the highest priority and is used by default.
+ * @param cb function to call when server replies or some error happens.
+ * @param data data to give to cb when it is called.
+ *
+ * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
+ * @see e_connman_service_nameservers_configuration_get()
+ */
+Eina_Bool
+e_connman_service_nameservers_configuration_set(E_Connman_Element *service, unsigned int count, const char **nameservers, E_DBus_Method_Return_Cb cb, const void *data)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(nameservers, EINA_FALSE);
+   return e_connman_element_property_array_set_full
+             (service, e_connman_prop_nameservers_configuration,
+              DBUS_TYPE_STRING, count,
+              (const void * const *)nameservers, cb, data);
+}
+
+/**
  * Get property "Domains" value.
  *
  * If this property isn't found then @c EINA_FALSE is returned.
@@ -713,9 +790,9 @@ e_connman_service_nameservers_get(const E_Connman_Element *service, unsigned int
  *        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.
+ *        get an extra reference. The array itself is also NOT
+ *        allocated or copied, do not modify it. This pointer is just
+ *        set if return is @c EINA_TRUE.
  *
  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
  */
@@ -728,6 +805,81 @@ e_connman_service_domains_get(const E_Connman_Element *service, unsigned int *co
    return e_connman_element_strings_array_get_stringshared
              (service, e_connman_prop_domains, count, domains);
 }
+
+/**
+ * Get property "Domains.Configuration" 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 domains for this service. If the server is
+ * not in READY or ONLINE state than this list will be empty.
+ *
+ * Unlike Domains, this is the user-set value, rather than the
+ * actual value.
+ *
+ * @param service path to get property.
+ * @param count return the number of elements in array.
+ * @param domains 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 also NOT
+ *        allocated or copied, do not modify it. 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_domains_configuration_get(const E_Connman_Element *service, unsigned int *count, const char ***domains)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(domains, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(count, EINA_FALSE);
+   return e_connman_element_strings_array_get_stringshared
+             (service, e_connman_prop_domains_configuration, count, domains);
+}
+
+/**
+ * Set property "Domains.Configuration" 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.
+ *
+ * Unlike Domains, this is the user-set value, rather than the actual value.
+ * It allows user to override the default setting.  When using manual
+ * configuration and no global domains are configured, then it is useful to
+ * configure this setting as well.
+ *
+ * This list is sorted by priority and the first entry represents the nameserver
+ * with the highest priority.
+ *
+ * Changes to the domain name servers can be done at any time. It will not cause
+ * a disconnect of the service. However there might be small window where name
+ * resolution might fail.
+ *
+ * @param service path to set property.
+ * @param count number of elements in @a domain.
+ * @param domains sorted list of the current domains. The first one has
+ * the highest priority and is used by default.
+ * @param cb function to call when server replies or some error happens.
+ * @param data data to give to cb when it is called.
+ *
+ * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
+ * @see e_connman_service_domains_configuration_get()
+ */
+Eina_Bool
+e_connman_service_domains_configuration_set(E_Connman_Element *service, unsigned int count, const char **domains, E_DBus_Method_Return_Cb cb, const void *data)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(domains, EINA_FALSE);
+   return e_connman_element_property_array_set_full
+             (service, e_connman_prop_domains_configuration,
+              DBUS_TYPE_STRING, count,
+              (const void * const *)domains, cb, data);
+}
+
 /**
  * Get property "IPv4.Method" value.
  *
@@ -1062,13 +1214,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 +1231,240 @@ 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 also NOT
+ *        allocated or copied, do not modify it. 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 also NOT
+ *        allocated or copied, do not modify it. 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);
+}
+
+/**
+ * Get property "Proxy.Configuration.Method" value.
+ *
+ * Unlike Proxy.Configuration.Method, this is the user-set value, rather than
+ * the actual 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.
+ *
+ * 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
+ *        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_configuration_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_proxy_configuration, e_connman_prop_method, NULL, method);
+}
+
+/**
+ * Get property "Proxy.Configuration.URL" value.
+ *
+ * Unlike Proxy.URL, this is the user-set value, rather than the
+ * actual 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_configuration_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_configuration, e_connman_prop_url, NULL, url);
+}
+
+/**
+ * Get property "Proxy.Configuration.Servers" value.
+ *
+ * Unlike Proxy.Servers, this is the user-set value, rather than the
+ * actual 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 also NOT
+ *        allocated or copied, do not modify it. 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_configuration_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_configuration, e_connman_prop_servers, count, servers);
+}
+
+/**
+ * Get property "Proxy.Configuration.Excludes" value.
+ *
+ * Unlike Proxy.Excludes, this is the user-set value, rather than the
+ * actual 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 also NOT
+ *        allocated or copied, do not modify it. 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_configuration_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_configuration, e_connman_prop_excludes, count, excludes);
 }
 
 /**
@@ -1114,6 +1494,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.