Imported Upstream version 1.7.1
[platform/upstream/edbus.git] / src / lib / connman0_7x / e_connman_service.c
1 #include "e_connman_private.h"
2
3 E_Connman_Element *
4 e_connman_service_get(const char *path)
5 {
6    E_Connman_Element *service;
7
8    EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL);
9
10    service = e_connman_element_get(path);
11    if (!service)
12       return NULL;
13
14    if (!e_connman_element_is_service(service))
15      {
16         WRN("path '%s' is not a service!", path);
17         return NULL;
18      }
19
20    return service;
21 }
22
23 /**
24  * Connect this service.
25  *
26  * Connect this service. It will attempt to connect
27  * WiFi, WiMAX or Bluetooth services.
28  *
29  * For Ethernet devices this method can only be used
30  * if it has previously been disconnected. Otherwise
31  * the plugging of a cable will trigger connecting
32  * automatically. If no cable is plugged in this method
33  * will fail.
34  *
35  * @param service path to call method on server.
36  * @param cb function to call when server replies or some error happens.
37  * @param data data to give to cb when it is called.
38  *
39  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
40  */
41 Eina_Bool
42 e_connman_service_connect(E_Connman_Element *service, E_DBus_Method_Return_Cb cb, const void *data)
43 {
44    const char name[] = "Connect";
45
46    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
47    return e_connman_element_call_full
48              (service, name, NULL, &service->_pending.service_connect, cb, data);
49 }
50
51 /**
52  * Disconnect this service.
53  *
54  * Disconnect this service. If the service is not
55  * connected an error message will be generated.
56  *
57  * On Ethernet devices this will disconnect the IP
58  * details from the service. It will not magically
59  * unplug the cable. When no cable is plugged in this
60  * method will fail.
61  *
62  * This method can also be used to abort a previous
63  * connectiong attempt via the Connect method.
64  *
65  * @param service path to call method on server.
66  * @param cb function to call when server replies or some error happens.
67  * @param data data to give to cb when it is called.
68  *
69  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
70  */
71 Eina_Bool
72 e_connman_service_disconnect(E_Connman_Element *service, E_DBus_Method_Return_Cb cb, const void *data)
73 {
74    const char name[] = "Disconnect";
75
76    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
77    return e_connman_element_call_full
78              (service, name, NULL, &service->_pending.service_disconnect, cb, data);
79 }
80
81 /**
82  * Remove this service.
83  *
84  * A successfully connected service with Favorite=true
85  * can be removed this way. If it is connected, it will
86  * be automatically disconnected first.
87  *
88  * If the service requires a passphrase it will be
89  * cleared and forgotten when removing.
90  *
91  * This is similar to setting the Favorite property
92  * to false, but that is currently not supported.
93  *
94  * In the case a connection attempt failed and the
95  * service is in the State=failure, this method can
96  * also be used to reset the service.
97  *
98  * Calling this method on Ethernet devices will cause
99  * an error message. It is not possible to remove these
100  * kind of devices.
101  *
102  * @param service path to call method on server.
103  * @param cb function to call when server replies or some error happens.
104  * @param data data to give to cb when it is called.
105  *
106  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
107  */
108 Eina_Bool
109 e_connman_service_remove(E_Connman_Element *service, E_DBus_Method_Return_Cb cb, const void *data)
110 {
111    const char name[] = "Remove";
112
113    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
114    return e_connman_element_call_full
115              (service, name, NULL, &service->_pending.service_remove, cb, data);
116 }
117
118 /**
119  * Clears the value of the specified property.
120  *
121  *
122  * @param service path to call method on server.
123  * @param property to be cleared.
124  * @param cb function to call when server replies or some error happens.
125  * @param data data to give to cb when it is called.
126  *
127  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
128  */
129 Eina_Bool
130 e_connman_service_clear_property(E_Connman_Element *service, const char *property, E_DBus_Method_Return_Cb cb, const void *data)
131 {
132    const char name[] = "ClearProperty";
133
134    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
135    EINA_SAFETY_ON_NULL_RETURN_VAL(property, EINA_FALSE);
136    return e_connman_element_call_with_string
137              (service, name, property, NULL, &service->_pending.service_clear_property,
138              cb, data);
139 }
140
141 /**
142  * Move service before in favorites list.
143  *
144  * Call method MoveBefore(object service) at the given service on server.
145  *
146  * If a service has been used before, this allows a
147  * reorder of the favorite services.
148  *
149  * The target service object must be part of this
150  * profile. Moving between profiles is not supported.
151  *
152  * @param service path to call method on server.
153  * @param object_path object service.
154  * @param cb function to call when server replies or some error happens.
155  * @param data data to give to cb when it is called.
156  *
157  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
158  */
159 Eina_Bool
160 e_connman_service_move_before(E_Connman_Element *service, const char *object_path, E_DBus_Method_Return_Cb cb, const void *data)
161 {
162    const char name[] = "MoveBefore";
163
164    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
165    EINA_SAFETY_ON_NULL_RETURN_VAL(object_path, EINA_FALSE);
166    return e_connman_element_call_with_path
167              (service, name, object_path, NULL,
168              &service->_pending.service_move_before, cb, data);
169 }
170
171 /**
172  * Move service after in favorites list.
173  *
174  * Call method MoveAfter(object service) at the given service on server.
175  *
176  * If a service has been used before, this allows a
177  * reorder of the favorite services.
178  *
179  * The target service object must be part of this
180  * profile. Moving between profiles is not supported.
181  *
182  * @param service path to call method on server.
183  * @param cb function to call when server replies or some error happens.
184  * @param data data to give to cb when it is called.
185  *
186  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
187  */
188 Eina_Bool
189 e_connman_service_move_after(E_Connman_Element *service, const char *object_path, E_DBus_Method_Return_Cb cb, const void *data)
190 {
191    const char name[] = "MoveAfter";
192
193    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
194    EINA_SAFETY_ON_NULL_RETURN_VAL(object_path, EINA_FALSE);
195    return e_connman_element_call_with_path
196              (service, name, object_path, NULL,
197              &service->_pending.service_move_after, cb, data);
198 }
199
200 /**
201  * Get property "State" value.
202  *
203  * If this property isn't found then @c EINA_FALSE is returned.
204  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
205  * values shall be considered invalid.
206  *
207  * The service state information.
208  *
209  * Valid states are "idle", "failure", "association",
210  * "configuration", "ready", "login" and "online".
211  *
212  * @param service path to get property.
213  * @param state where to store the property value, must be a pointer
214  *        to string (const char **), it will not be allocated or
215  *        copied and references will be valid until element changes,
216  *        so copy it if you want to use it later.
217  *
218  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
219  */
220 Eina_Bool
221 e_connman_service_state_get(const E_Connman_Element *service, const char **state)
222 {
223    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
224    EINA_SAFETY_ON_NULL_RETURN_VAL(state, EINA_FALSE);
225    return e_connman_element_property_get_stringshared
226              (service, e_connman_prop_state, NULL, state);
227 }
228
229 /**
230  * Get property "Error" value.
231  *
232  * If this property isn't found then @c EINA_FALSE is returned.
233  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
234  * values shall be considered invalid.
235  *
236  * The service error status details.
237  *
238  * When error occur during connection or disconnection
239  * the detailed information are represented in this
240  * property to help the user interface to present the
241  * user with alternate options.
242  *
243  * This property is only valid when the service is in
244  * the "failure" state. Otherwise it might be empty or
245  * not present at all.
246  *
247  * Current defined error code is "dhcp-failed".
248  *
249  * @param service path to get property.
250  * @param error where to store the property value, must be a pointer
251  *        to string (const char **), it will not be allocated or
252  *        copied and references will be valid until element changes,
253  *        so copy it if you want to use it later.
254  *
255  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
256  */
257 Eina_Bool
258 e_connman_service_error_get(const E_Connman_Element *service, const char **error)
259 {
260    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
261    EINA_SAFETY_ON_NULL_RETURN_VAL(error, EINA_FALSE);
262    return e_connman_element_property_get_stringshared
263              (service, e_connman_prop_error, NULL, error);
264 }
265
266 /**
267  * Get property "Name" value.
268  *
269  * If this property isn't found then @c EINA_FALSE is returned.
270  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
271  * values shall be considered invalid.
272  *
273  * The service name (for example "Wireless" etc.)
274  *
275  * This name can be used for directly displaying it in
276  * the application. It has pure informational purpose.
277  *
278  * For Ethernet devices and hidden WiFi networks it is
279  * not guaranteed that this property is present.
280  *
281  * @param service path to get property.
282  * @param name where to store the property value, must be a pointer
283  *        to string (const char **), it will not be allocated or
284  *        copied and references will be valid until element changes,
285  *        so copy it if you want to use it later.
286  *
287  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
288  */
289 Eina_Bool
290 e_connman_service_name_get(const E_Connman_Element *service, const char **name)
291 {
292    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
293    EINA_SAFETY_ON_NULL_RETURN_VAL(name, EINA_FALSE);
294    return e_connman_element_property_get_stringshared
295              (service, e_connman_prop_name, NULL, name);
296 }
297
298 /**
299  * Get property "Type" value.
300  *
301  * If this property isn't found then @c EINA_FALSE is returned.
302  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
303  * values shall be considered invalid.
304  *
305  * The service type (for example "ethernet", "wifi" etc.)
306  *
307  * This information should only be used to determine
308  * advanced properties or showing the correct icon
309  * to the user.
310  *
311  * @param service path to get property.
312  * @param type where to store the property value, must be a pointer
313  *        to string (const char **), it will not be allocated or
314  *        copied and references will be valid until element changes,
315  *        so copy it if you want to use it later.
316  *
317  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
318  */
319 Eina_Bool
320 e_connman_service_type_get(const E_Connman_Element *service, const char **type)
321 {
322    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
323    EINA_SAFETY_ON_NULL_RETURN_VAL(type, EINA_FALSE);
324    return e_connman_element_property_get_stringshared
325              (service, e_connman_prop_type, NULL, type);
326 }
327
328 /**
329  * Get property "Security" value.
330  *
331  * If this property isn't found then @c EINA_FALSE is returned.
332  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
333  * values shall be considered invalid.
334  *
335  * If the service type is WiFi, then this property is
336  * present and contains the list of security method or key
337  * management setting.
338  *
339  * Possible values are "none", "wep", "wpa", "rsn", "psk", "ieee8021x" and "wps"
340  *
341  * This property might be only present for WiFi
342  * services.
343  *
344  * @param service path to get property.
345  * @param count where to return the number of elements in @a security
346  * @param security where to store the property value, must be a pointer
347  *        to array of strings, it will not be allocated or
348  *        copied and references will be valid until element changes,
349  *        so copy it if you want to use it later.
350  *
351  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
352  */
353 Eina_Bool
354 e_connman_service_security_get(const E_Connman_Element *service, unsigned int *count, const char ***security)
355 {
356    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
357    EINA_SAFETY_ON_NULL_RETURN_VAL(count, EINA_FALSE);
358    EINA_SAFETY_ON_NULL_RETURN_VAL(security, EINA_FALSE);
359
360    return e_connman_element_strings_array_get_stringshared
361      (service, e_connman_prop_security, count, security);
362 }
363
364 /**
365  * Get property "Passphrase" value.
366  *
367  * If this property isn't found then @c EINA_FALSE is returned.
368  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
369  * values shall be considered invalid.
370  *
371  * If the service type is WiFi, then this property
372  * can be used to store a passphrase.
373  *
374  * No PropertyChanged signals will be send for this
375  * property. The PassphraseRequired property should
376  * be monitored instead.
377  *
378  * This property might also not always be included
379  * since it is protected by a different security policy.
380  *
381  * @param service path to get property.
382  * @param passphrase where to store the property value, must be a pointer
383  *        to string (const char **), it will not be allocated or
384  *        copied and references will be valid until element changes,
385  *        so copy it if you want to use it later.
386  *
387  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
388  * @see e_connman_service_passphrase_set()
389  */
390 Eina_Bool
391 e_connman_service_passphrase_get(const E_Connman_Element *service, const char **passphrase)
392 {
393    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
394    EINA_SAFETY_ON_NULL_RETURN_VAL(passphrase, EINA_FALSE);
395    return e_connman_element_property_get_stringshared
396              (service, e_connman_prop_passphrase, NULL, passphrase);
397 }
398
399 /**
400  * Set property "Passphrase" value.
401  *
402  * If this property isn't found then @c EINA_FALSE is returned.
403  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
404  * values shall be considered invalid.
405  *
406  * If the service type is WiFi, then this property
407  * can be used to store a passphrase.
408  *
409  * No PropertyChanged signals will be send for this
410  * property. The PassphraseRequired property should
411  * be monitored instead.
412  *
413  * This property might also not always be included
414  * since it is protected by a different security policy.
415  *
416  * @param service path to get property.
417  * @param passphrase value to set.
418  * @param cb function to call when server replies or some error happens.
419  * @param data data to give to cb when it is called.
420  *
421  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
422  * @see e_connman_service_passphrase_get()
423  */
424 Eina_Bool
425 e_connman_service_passphrase_set(E_Connman_Element *service, const char *passphrase, E_DBus_Method_Return_Cb cb, const void *data)
426 {
427    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
428    return e_connman_element_property_set_full
429              (service, e_connman_prop_passphrase, DBUS_TYPE_STRING,
430              passphrase, cb, data);
431 }
432
433 /**
434  * Get property "PassphraseRequired" value.
435  *
436  * If this property isn't found then @c EINA_FALSE is returned.
437  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
438  * values shall be considered invalid.
439  *
440  * If the service type is WiFi, then this property
441  * indicates if a passphrase is required.
442  *
443  * If a passphrase has been set already or if no
444  * passphrase is needed, then this property will
445  * be set to false.
446  *
447  * @param service path to get property.
448  * @param passphrase_required where to store the property value, must be a
449  *        pointer to Eina_Bool (Eina_Bool *).
450  *
451  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
452  */
453 Eina_Bool
454 e_connman_service_passphrase_required_get(const E_Connman_Element *service, Eina_Bool *passphrase_required)
455 {
456    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
457    EINA_SAFETY_ON_NULL_RETURN_VAL(passphrase_required, EINA_FALSE);
458    return e_connman_element_property_get_stringshared
459              (service, e_connman_prop_passphrase_required, NULL, passphrase_required);
460 }
461
462 /**
463  * Get property "LoginRequired" value.
464  *
465  * If this property isn't found then @c EINA_FALSE is returned.
466  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
467  * values shall be considered invalid.
468  *
469  * Indicates that a manual configuration must be done to login the
470  * user, likely access an website using a browser.
471  *
472  * If a login has been set already or if no
473  * login is needed, then this property will
474  * be set to false.
475  *
476  * @param service path to get property.
477  * @param login_required where to store the property value, must be a
478  *        pointer to Eina_Bool (Eina_Bool *).
479  *
480  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
481  *
482  * @since 1.1.0
483  */
484 Eina_Bool
485 e_connman_service_login_required_get(const E_Connman_Element *service, Eina_Bool *login_required)
486 {
487    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
488    EINA_SAFETY_ON_NULL_RETURN_VAL(login_required, EINA_FALSE);
489    return e_connman_element_property_get_stringshared
490              (service, e_connman_prop_login_required, NULL, login_required);
491 }
492
493 /**
494  * Get property "Strength" value.
495  *
496  * If this property isn't found then @c EINA_FALSE is returned.
497  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
498  * values shall be considered invalid.
499  *
500  * Indicates the signal strength of the service. This
501  * is a normalized value between 0 and 100.
502  *
503  * This property will not be present for Ethernet
504  * devices.
505  *
506  * @param service path to get property.
507  * @param strength where to store the property value, must be a pointer
508  *        to byte (unsigned char*).
509  *
510  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
511  */
512 Eina_Bool
513 e_connman_service_strength_get(const E_Connman_Element *service, unsigned char *strength)
514 {
515    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
516    EINA_SAFETY_ON_NULL_RETURN_VAL(strength, EINA_FALSE);
517    return e_connman_element_property_get_stringshared
518              (service, e_connman_prop_strength, NULL, strength);
519 }
520
521 /**
522  * Get property "Favorite" value.
523  *
524  * If this property isn't found then @c EINA_FALSE is returned.
525  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
526  * values shall be considered invalid.
527  *
528  * Will be true if a cable is plugged in or the user
529  * selected and successfully connected to this service.
530  *
531  * This value is automatically changed and to revert
532  * it back to false the Remove() method needs to be
533  * used.
534  *
535  * @param service path to get property.
536  * @param favorite where to store the property value, must be a
537  *        pointer to Eina_Bool (Eina_Bool *).
538  *
539  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
540  */
541 Eina_Bool
542 e_connman_service_favorite_get(const E_Connman_Element *service, Eina_Bool *favorite)
543 {
544    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
545    EINA_SAFETY_ON_NULL_RETURN_VAL(favorite, EINA_FALSE);
546    return e_connman_element_property_get_stringshared
547              (service, e_connman_prop_favorite, NULL, favorite);
548 }
549
550 /**
551  * Get property "Immutable" value.
552  *
553  * This value will be set to true if the service is configured
554  * externally via a configuration file.
555  *
556  * The only valid operation are e_connman_service_connect() and
557  * e_connman_service_disconnect(). The e_connman_service_remove()
558  * method will result in an error.
559
560  * @param service path to get property.
561  * @param immutable where to store the property value, must be a
562  *        pointer to Eina_Bool (Eina_Bool *).
563  *
564  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
565  */
566 Eina_Bool
567 e_connman_service_immutable_get(const E_Connman_Element *service, Eina_Bool *immutable)
568 {
569    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
570    EINA_SAFETY_ON_NULL_RETURN_VAL(immutable, EINA_FALSE);
571    return e_connman_element_property_get_stringshared
572              (service, e_connman_prop_immutable, NULL, immutable);
573 }
574
575 /**
576  * Get property "AutoConnect" value.
577  *
578  * If this property isn't found then @c EINA_FALSE is returned.
579  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
580  * values shall be considered invalid.
581  *
582  * If set to true, this service will auto-connect
583  * when not other connection is available.
584  *
585  * For favorite services it is possible to change
586  * this value to prevent or permit automatic
587  * connection attempts.
588  *
589  * @param service path to get property.
590  * @param auto_connect where to store the property value, must be a
591  *        pointer to Eina_Bool (Eina_Bool *).
592  *
593  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
594  * @see e_connman_service_auto_connect_set()
595  */
596 Eina_Bool
597 e_connman_service_auto_connect_get(const E_Connman_Element *service, Eina_Bool *auto_connect)
598 {
599    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
600    EINA_SAFETY_ON_NULL_RETURN_VAL(auto_connect, EINA_FALSE);
601    return e_connman_element_property_get_stringshared
602              (service, e_connman_prop_auto_connect, NULL, auto_connect);
603 }
604
605 /**
606  * Set property "AutoConnect" value.
607  *
608  * If this property isn't found then @c EINA_FALSE is returned.
609  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
610  * values shall be considered invalid.
611  *
612  * If set to true, this service will auto-connect
613  * when not other connection is available.
614  *
615  * For favorite services it is possible to change
616  * this value to prevent or permit automatic
617  * connection attempts.
618  *
619  * @param service path to get property.
620  * @param service_favorite where to store the property value, must be a
621  *        pointer to Eina_Bool (Eina_Bool *).
622  *
623  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
624  * @see e_connman_service_auto_connect_get()
625  */
626 Eina_Bool
627 e_connman_service_auto_connect_set(E_Connman_Element *service, Eina_Bool auto_connect, E_DBus_Method_Return_Cb cb, const void *data)
628 {
629    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
630    return e_connman_element_property_set_full
631              (service, e_connman_prop_auto_connect, DBUS_TYPE_BOOLEAN, &auto_connect, cb, data);
632 }
633
634 /**
635  * Get property "Roaming" value.
636  *
637  * If this property isn't found then @c EINA_FALSE is returned.
638  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
639  * values shall be considered invalid.
640  *
641  * This property indicates if this service is roaming.
642  *
643  * In the case of Cellular services this normally
644  * indicates connections to a foreign provider when
645  * traveling abroad.
646  *
647  * @param service path to get property.
648  * @param roaming where to store the property value, must be a
649  *        pointer to Eina_Bool (Eina_Bool *).
650  *
651  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
652  */
653 Eina_Bool
654 e_connman_service_roaming_get(const E_Connman_Element *service, Eina_Bool *roaming)
655 {
656    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
657    EINA_SAFETY_ON_NULL_RETURN_VAL(roaming, EINA_FALSE);
658    return e_connman_element_property_get_stringshared
659              (service, e_connman_prop_roaming, NULL, roaming);
660 }
661
662 /**
663  * Get property "Nameservers" value.
664  *
665  * If this property isn't found then @c EINA_FALSE is returned.
666  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
667  * values shall be considered invalid.
668  * The list of currently active nameservers for this service. If the server is
669  * not in READY or ONLINE state than this list will be empty.
670  *
671  * Global nameservers are automatically added to this list.
672  *
673  * The array represents a sorted list of the current nameservers. The first one
674  * has the highest priority and is used by default.
675  *
676  * When using DHCP this array represents the nameservers provided by the
677  * network. In case of manual settings, the ones from Nameservers.Configuration
678  * are used.
679  *
680  * @param service path to get property.
681  * @param count return the number of elements in array.
682  * @param nameservers array with pointers to internal strings. These
683  *        strings are not copied in any way, and they are granted to
684  *        be eina_stringshare instances, so one can use
685  *        eina_stringshare_ref() if he wants to save memory and cpu to
686  *        get an extra reference. The array itself is also NOT
687  *        allocated or copied, do not modify it. This pointer is just
688  *        set if return is @c EINA_TRUE.
689  *
690  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
691  */
692 Eina_Bool
693 e_connman_service_nameservers_get(const E_Connman_Element *service, unsigned int *count, const char ***nameservers)
694 {
695    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
696    EINA_SAFETY_ON_NULL_RETURN_VAL(nameservers, EINA_FALSE);
697    EINA_SAFETY_ON_NULL_RETURN_VAL(count, EINA_FALSE);
698    return e_connman_element_strings_array_get_stringshared
699              (service, e_connman_prop_nameservers, count, nameservers);
700 }
701
702 /**
703  * Get property "Nameservers.Configuration" value.
704  *
705  * If this property isn't found then @c EINA_FALSE is returned.
706  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
707  * values shall be considered invalid.
708  * The list of currently active nameservers for this service. If the server is
709  * not in READY or ONLINE state than this list will be empty.
710  *
711  * Unlike Nameservers, this is the user-set value, rather than the
712  * actual value.
713  *
714  * @param service path to get property.
715  * @param count return the number of elements in array.
716  * @param nameservers array with pointers to internal strings. These
717  *        strings are not copied in any way, and they are granted to
718  *        be eina_stringshare instances, so one can use
719  *        eina_stringshare_ref() if he wants to save memory and cpu to
720  *        get an extra reference. The array itself is also NOT
721  *        allocated or copied, do not modify it. This pointer is just
722  *        set if return is @c EINA_TRUE.
723  *
724  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
725  */
726 Eina_Bool
727 e_connman_service_nameservers_configuration_get(const E_Connman_Element *service, unsigned int *count, const char ***nameservers)
728 {
729    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
730    EINA_SAFETY_ON_NULL_RETURN_VAL(nameservers, EINA_FALSE);
731    EINA_SAFETY_ON_NULL_RETURN_VAL(count, EINA_FALSE);
732    return e_connman_element_strings_array_get_stringshared
733              (service, e_connman_prop_nameservers_configuration,
734               count, nameservers);
735 }
736
737 /**
738  * Set property "Nameservers.Configuration" value.
739  *
740  * If this property isn't found then @c EINA_FALSE is returned.
741  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
742  * values shall be considered invalid.
743  *
744  * Unlike Nameservers, this is the user-set value, rather than the actual value.
745  * It allows user to override the default setting.  When using manual
746  * configuration and no global nameservers are configured, then it is useful to
747  * configure this setting as well.
748  *
749  * This list is sorted by priority and the first entry represents the nameserver
750  * with the highest priority.
751  *
752  * Changes to the domain name servers can be done at any time. It will not cause
753  * a disconnect of the service. However there might be small window where name
754  * resolution might fail.
755  *
756  * @param service path to set property.
757  * @param nameservers sorted list of the current nameservers. The first one has
758  * the highest priority and is used by default.
759  * @param cb function to call when server replies or some error happens.
760  * @param data data to give to cb when it is called.
761  *
762  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
763  * @see e_connman_service_nameservers_configuration_get()
764  */
765 Eina_Bool
766 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)
767 {
768    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
769    EINA_SAFETY_ON_NULL_RETURN_VAL(nameservers, EINA_FALSE);
770    return e_connman_element_property_array_set_full
771              (service, e_connman_prop_nameservers_configuration,
772               DBUS_TYPE_STRING, count,
773               (const void * const *)nameservers, cb, data);
774 }
775
776 /**
777  * Get property "Domains" value.
778  *
779  * If this property isn't found then @c EINA_FALSE is returned.
780  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
781  * values shall be considered invalid.
782  * The list of currently active domains for this service. If the server is
783  * not in READY or ONLINE state than this list will be empty.
784  *
785  * The list of currently used search domains.
786  *
787  * @param service path to get property.
788  * @param count return the number of elements in array.
789  * @param domains array with pointers to internal strings. These
790  *        strings are not copied in any way, and they are granted to
791  *        be eina_stringshare instances, so one can use
792  *        eina_stringshare_ref() if he wants to save memory and cpu to
793  *        get an extra reference. The array itself is also NOT
794  *        allocated or copied, do not modify it. This pointer is just
795  *        set if return is @c EINA_TRUE.
796  *
797  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
798  */
799 Eina_Bool
800 e_connman_service_domains_get(const E_Connman_Element *service, unsigned int *count, const char ***domains)
801 {
802    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
803    EINA_SAFETY_ON_NULL_RETURN_VAL(domains, EINA_FALSE);
804    EINA_SAFETY_ON_NULL_RETURN_VAL(count, EINA_FALSE);
805    return e_connman_element_strings_array_get_stringshared
806              (service, e_connman_prop_domains, count, domains);
807 }
808
809 /**
810  * Get property "Domains.Configuration" value.
811  *
812  * If this property isn't found then @c EINA_FALSE is returned.
813  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
814  * values shall be considered invalid.
815  * The list of currently active domains for this service. If the server is
816  * not in READY or ONLINE state than this list will be empty.
817  *
818  * Unlike Domains, this is the user-set value, rather than the
819  * actual value.
820  *
821  * @param service path to get property.
822  * @param count return the number of elements in array.
823  * @param domains array with pointers to internal strings. These
824  *        strings are not copied in any way, and they are granted to
825  *        be eina_stringshare instances, so one can use
826  *        eina_stringshare_ref() if he wants to save memory and cpu to
827  *        get an extra reference. The array itself is also NOT
828  *        allocated or copied, do not modify it. This pointer is just
829  *        set if return is @c EINA_TRUE.
830  *
831  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
832  */
833 Eina_Bool
834 e_connman_service_domains_configuration_get(const E_Connman_Element *service, unsigned int *count, const char ***domains)
835 {
836    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
837    EINA_SAFETY_ON_NULL_RETURN_VAL(domains, EINA_FALSE);
838    EINA_SAFETY_ON_NULL_RETURN_VAL(count, EINA_FALSE);
839    return e_connman_element_strings_array_get_stringshared
840              (service, e_connman_prop_domains_configuration, count, domains);
841 }
842
843 /**
844  * Set property "Domains.Configuration" value.
845  *
846  * If this property isn't found then @c EINA_FALSE is returned.
847  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
848  * values shall be considered invalid.
849  *
850  * Unlike Domains, this is the user-set value, rather than the actual value.
851  * It allows user to override the default setting.  When using manual
852  * configuration and no global domains are configured, then it is useful to
853  * configure this setting as well.
854  *
855  * This list is sorted by priority and the first entry represents the nameserver
856  * with the highest priority.
857  *
858  * Changes to the domain name servers can be done at any time. It will not cause
859  * a disconnect of the service. However there might be small window where name
860  * resolution might fail.
861  *
862  * @param service path to set property.
863  * @param count number of elements in @a domain.
864  * @param domains sorted list of the current domains. The first one has
865  * the highest priority and is used by default.
866  * @param cb function to call when server replies or some error happens.
867  * @param data data to give to cb when it is called.
868  *
869  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
870  * @see e_connman_service_domains_configuration_get()
871  */
872 Eina_Bool
873 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)
874 {
875    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
876    EINA_SAFETY_ON_NULL_RETURN_VAL(domains, EINA_FALSE);
877    return e_connman_element_property_array_set_full
878              (service, e_connman_prop_domains_configuration,
879               DBUS_TYPE_STRING, count,
880               (const void * const *)domains, cb, data);
881 }
882
883 /**
884  * Get property "IPv4.Method" value.
885  *
886  * If this property isn't found then @c EINA_FALSE is returned.
887  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
888  * values shall be considered invalid.
889  *
890  * The IPv4 method in use. Possible values here are "dhcp" and
891  * "static".
892  *
893  * @param service path to get property.
894  * @param method where to store the property value, must be a pointer
895  *        to string (const char **), it will not be allocated or
896  *        copied and references will be valid until element changes,
897  *        so copy it if you want to use it later.
898  *
899  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
900  */
901 Eina_Bool
902 e_connman_service_ipv4_method_get(const E_Connman_Element *service, const char **method)
903 {
904    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
905    EINA_SAFETY_ON_NULL_RETURN_VAL(method, EINA_FALSE);
906    return e_connman_element_property_dict_get_stringshared
907              (service, e_connman_prop_ipv4, e_connman_prop_method, NULL, method);
908 }
909
910 /**
911  * Get property "IPv4.Address" value.
912  *
913  * If this property isn't found then @c EINA_FALSE is returned.
914  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
915  * values shall be considered invalid.
916  *
917  * The current IPv4 address.
918  *
919  * @param service path to get property.
920  * @param address where to store the property value, must be a pointer
921  *        to string (const char **), it will not be allocated or
922  *        copied and references will be valid until element changes,
923  *        so copy it if you want to use it later.
924  *
925  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
926  */
927 Eina_Bool
928 e_connman_service_ipv4_address_get(const E_Connman_Element *service, const char **address)
929 {
930    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
931    EINA_SAFETY_ON_NULL_RETURN_VAL(address, EINA_FALSE);
932    return e_connman_element_property_dict_get_stringshared
933              (service, e_connman_prop_ipv4, e_connman_prop_address, NULL, address);
934 }
935
936 /**
937  * Get property "IPv4.Gateway" value.
938  *
939  * If this property isn't found then @c EINA_FALSE is returned.
940  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
941  * values shall be considered invalid.
942  *
943  * The current IPv4 gateway.
944  *
945  * @param service path to get property.
946  * @param gateway where to store the property value, must be a pointer
947  *        to string (const char **), it will not be allocated or
948  *        copied and references will be valid until element changes,
949  *        so copy it if you want to use it later.
950  *
951  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
952  */
953 Eina_Bool
954 e_connman_service_ipv4_gateway_get(const E_Connman_Element *service, const char **gateway)
955 {
956    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
957    EINA_SAFETY_ON_NULL_RETURN_VAL(gateway, EINA_FALSE);
958    return e_connman_element_property_dict_get_stringshared
959              (service, e_connman_prop_ipv4, e_connman_prop_gateway, NULL, gateway);
960 }
961
962 /**
963  * Get property "IPv4.Netmask" value.
964  *
965  * If this property isn't found then @c EINA_FALSE is returned.
966  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
967  * values shall be considered invalid.
968  *
969  * The current IPv4 netmask.
970  *
971  * @param service path to get property.
972  * @param netmask where to store the property value, must be a pointer
973  *        to string (const char **), it will not be allocated or
974  *        copied and references will be valid until element changes,
975  *        so copy it if you want to use it later.
976  *
977  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
978  */
979 Eina_Bool
980 e_connman_service_ipv4_netmask_get(const E_Connman_Element *service, const char **netmask)
981 {
982    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
983    EINA_SAFETY_ON_NULL_RETURN_VAL(netmask, EINA_FALSE);
984    return e_connman_element_property_dict_get_stringshared
985              (service, e_connman_prop_ipv4, e_connman_prop_netmask, NULL, netmask);
986 }
987
988 /**
989  * Get property "IPv4.Configuration.Method" value.
990  *
991  * Unlike IPv4.Method, this is the user-set value, rather than the
992  * actual value.
993  *
994  * If this property isn't found then @c EINA_FALSE is returned.
995  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
996  * values shall be considered invalid.
997  *
998  * The IPv4 configured method. Possible values here are "dhcp" and
999  * "static".
1000  *
1001  * @param service path to get property.
1002  * @param method where to store the property value, must be a pointer
1003  *        to string (const char **), it will not be allocated or
1004  *        copied and references will be valid until element changes,
1005  *        so copy it if you want to use it later.
1006  *
1007  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1008  */
1009 Eina_Bool
1010 e_connman_service_ipv4_configuration_method_get(const E_Connman_Element *service, const char **method)
1011 {
1012    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1013    EINA_SAFETY_ON_NULL_RETURN_VAL(method, EINA_FALSE);
1014    return e_connman_element_property_dict_get_stringshared
1015              (service, e_connman_prop_ipv4_configuration, e_connman_prop_method,
1016              NULL, method);
1017 }
1018
1019 /**
1020  * Get property "IPv4.Configuration.Address" value.
1021  *
1022  * Unlike IPv4.Address, this is the user-set value, rather than the
1023  * actual value.
1024  *
1025  * If this property isn't found then @c EINA_FALSE is returned.
1026  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1027  * values shall be considered invalid.
1028  *
1029  * The current configured IPv4 address.
1030  *
1031  * @param service path to get property.
1032  * @param address where to store the property value, must be a pointer
1033  *        to string (const char **), it will not be allocated or
1034  *        copied and references will be valid until element changes,
1035  *        so copy it if you want to use it later.
1036  *
1037  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1038  */
1039 Eina_Bool
1040 e_connman_service_ipv4_configuration_address_get(const E_Connman_Element *service, const char **address)
1041 {
1042    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1043    EINA_SAFETY_ON_NULL_RETURN_VAL(address, EINA_FALSE);
1044    return e_connman_element_property_dict_get_stringshared
1045              (service, e_connman_prop_ipv4_configuration, e_connman_prop_address,
1046              NULL, address);
1047 }
1048
1049 /**
1050  * Get property "IPv4.Configuration.Gateway" value.
1051  *
1052  * Unlike IPv4.Gateway, this is the user-set value, rather than the
1053  * actual value.
1054  *
1055  * If this property isn't found then @c EINA_FALSE is returned.
1056  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1057  * values shall be considered invalid.
1058  *
1059  * The current configured IPv4 gateway.
1060  *
1061  * @param service path to get property.
1062  * @param gateway where to store the property value, must be a pointer
1063  *        to string (const char **), it will not be allocated or
1064  *        copied and references will be valid until element changes,
1065  *        so copy it if you want to use it later.
1066  *
1067  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1068  */
1069 Eina_Bool
1070 e_connman_service_ipv4_configuration_gateway_get(const E_Connman_Element *service, const char **gateway)
1071 {
1072    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1073    EINA_SAFETY_ON_NULL_RETURN_VAL(gateway, EINA_FALSE);
1074    return e_connman_element_property_dict_get_stringshared
1075              (service, e_connman_prop_ipv4_configuration, e_connman_prop_gateway,
1076              NULL, gateway);
1077 }
1078
1079 /**
1080  * Get property "IPv4.Configuration.Netmask" value.
1081  *
1082  * Unlike IPv4.Netmask, this is the user-set value, rather than the
1083  * actual value.
1084  *
1085  * If this property isn't found then @c EINA_FALSE is returned.
1086  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1087  * values shall be considered invalid.
1088  *
1089  * The current configured IPv4 netmask.
1090  *
1091  * @param service path to get property.
1092  * @param netmask where to store the property value, must be a pointer
1093  *        to string (const char **), it will not be allocated or
1094  *        copied and references will be valid until element changes,
1095  *        so copy it if you want to use it later.
1096  *
1097  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1098  */
1099 Eina_Bool
1100 e_connman_service_ipv4_configuration_netmask_get(const E_Connman_Element *service, const char **netmask)
1101 {
1102    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1103    EINA_SAFETY_ON_NULL_RETURN_VAL(netmask, EINA_FALSE);
1104    return e_connman_element_property_dict_get_stringshared
1105              (service, e_connman_prop_ipv4_configuration, e_connman_prop_netmask,
1106              NULL, netmask);
1107 }
1108
1109 /**
1110  * Set IPv4 to connect automatically using DHCP.
1111  *
1112  * @param service path to set.
1113  * @param cb function to call when server replies or some error happens.
1114  * @param data data to give to cb when it is called.
1115  *
1116  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1117  */
1118 Eina_Bool
1119 e_connman_service_ipv4_configure_dhcp(E_Connman_Element *service, E_DBus_Method_Return_Cb cb, const void *data)
1120 {
1121    const char method[] = "dhcp";
1122    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1123    return e_connman_element_property_dict_set_full
1124              (service, e_connman_prop_ipv4_configuration, e_connman_prop_method,
1125              DBUS_TYPE_STRING, method, cb, data);
1126 }
1127
1128 /**
1129  * Set IPv4 to connect using manually set parameters.
1130  *
1131  * @param service path to set.
1132  * @param address IPv4 address.
1133  * @param netmask IPv4 netmask, or @c NULL for "/32".
1134  * @param gateway IPv4 gateway address.
1135  * @param cb function to call when server replies or some error happens.
1136  * @param data data to give to cb when it is called.
1137  *
1138  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1139  */
1140 Eina_Bool
1141 e_connman_service_ipv4_configure_manual(E_Connman_Element *service, const char *address, const char *netmask, const char *gateway, E_DBus_Method_Return_Cb cb, const void *data)
1142 {
1143    const char name[] = "SetProperty";
1144    const char *method = "manual"; /* not method[] as gcc screws it with dbus */
1145    DBusMessage *msg;
1146    DBusMessageIter itr, variant, dict, entry;
1147
1148    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1149    EINA_SAFETY_ON_NULL_RETURN_VAL(address, EINA_FALSE);
1150
1151    msg = dbus_message_new_method_call
1152          (e_connman_system_bus_name_get(), service->path, service->interface, name);
1153
1154    if (!msg)
1155       return 0;
1156
1157    dbus_message_iter_init_append(msg, &itr);
1158    dbus_message_iter_append_basic
1159       (&itr, DBUS_TYPE_STRING, &e_connman_prop_ipv4_configuration);
1160
1161    if (dbus_message_iter_open_container
1162        (&itr, DBUS_TYPE_VARIANT,
1163            (DBUS_TYPE_ARRAY_AS_STRING
1164                DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
1165                DBUS_TYPE_STRING_AS_STRING
1166                DBUS_TYPE_STRING_AS_STRING
1167                DBUS_DICT_ENTRY_END_CHAR_AS_STRING),
1168            &variant))
1169      {
1170         if (dbus_message_iter_open_container
1171             (&variant, DBUS_TYPE_ARRAY,
1172                 (DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
1173                     DBUS_TYPE_STRING_AS_STRING
1174                     DBUS_TYPE_STRING_AS_STRING
1175                     DBUS_DICT_ENTRY_END_CHAR_AS_STRING),
1176                 &dict))
1177           {
1178              if (dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, NULL, &entry))
1179                {
1180                   dbus_message_iter_append_basic
1181                     (&entry, DBUS_TYPE_STRING, &e_connman_prop_method);
1182                   dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &method);
1183                   dbus_message_iter_close_container(&dict, &entry);
1184                }
1185              if (dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, NULL, &entry))
1186                {
1187                   dbus_message_iter_append_basic
1188                     (&entry, DBUS_TYPE_STRING, &e_connman_prop_address);
1189                   dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &address);
1190                   dbus_message_iter_close_container(&dict, &entry);
1191                }
1192              if (netmask)
1193                {
1194                   if (dbus_message_iter_open_container
1195                       (&dict, DBUS_TYPE_DICT_ENTRY, NULL, &entry))
1196                     {
1197                        dbus_message_iter_append_basic
1198                          (&entry, DBUS_TYPE_STRING, &e_connman_prop_netmask);
1199                        dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &netmask);
1200                        dbus_message_iter_close_container(&dict, &entry);
1201                     }
1202                   else
1203                     {
1204                        ERR("dbus_message_iter_open_container() failed");
1205                     }
1206                }
1207              
1208              if (gateway)
1209                {
1210                   if (dbus_message_iter_open_container
1211                       (&dict, DBUS_TYPE_DICT_ENTRY, NULL, &entry))
1212                     {
1213                        dbus_message_iter_append_basic
1214                          (&entry, DBUS_TYPE_STRING, &e_connman_prop_gateway);
1215                        dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &gateway);
1216                        dbus_message_iter_close_container(&dict, &entry);
1217                     }
1218                   else
1219                     {
1220                        ERR("dbus_message_iter_open_container() failed");
1221                     }
1222                }
1223              dbus_message_iter_close_container(&variant, &dict);
1224           }
1225         else
1226           {
1227              ERR("dbus_message_iter_open_container() failed");
1228           }
1229         dbus_message_iter_close_container(&itr, &variant);
1230      }
1231    else
1232      {
1233         ERR("dbus_message_iter_open_container() failed");
1234      }
1235
1236    return e_connman_element_message_send
1237              (service, name, NULL, msg, &service->_pending.property_set, cb, data);
1238 }
1239
1240 /**
1241  * Get property "Proxy.Method" value.
1242  *
1243  * If this property isn't found then @c EINA_FALSE is returned.
1244  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1245  * values shall be considered invalid.
1246  *
1247  * Possible values are "direct", "auto" and "manual".
1248  *
1249  * @param service path to get property.
1250  * @param method where to store the property value, must be a pointer
1251  *        to string (const char **), it will not be allocated or
1252  *        copied and references will be valid until element changes,
1253  *        so copy it if you want to use it later.
1254  *
1255  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1256  */
1257 Eina_Bool
1258 e_connman_service_proxy_method_get(const E_Connman_Element *service, const char **method)
1259 {
1260    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1261    EINA_SAFETY_ON_NULL_RETURN_VAL(method, EINA_FALSE);
1262    return e_connman_element_property_dict_get_stringshared
1263              (service, e_connman_prop_proxy, e_connman_prop_method, NULL, method);
1264 }
1265
1266 /**
1267  * Get property "Proxy.URL" value.
1268  *
1269  * If this property isn't found then @c EINA_FALSE is returned.
1270  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1271  * values shall be considered invalid.
1272  *
1273  * Automatic proxy configuration URL. Used by "auto" method.
1274  *
1275  * @param service path to get property.
1276  * @param url where to store the property value, must be a pointer
1277  *        to string (const char **), it will not be allocated or
1278  *        copied and references will be valid until element changes,
1279  *        so copy it if you want to use it later.
1280  *
1281  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1282  */
1283 Eina_Bool
1284 e_connman_service_proxy_url_get(const E_Connman_Element *service, const char **url)
1285 {
1286    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1287    EINA_SAFETY_ON_NULL_RETURN_VAL(url, EINA_FALSE);
1288    return e_connman_element_property_dict_get_stringshared
1289              (service, e_connman_prop_proxy, e_connman_prop_url, NULL, url);
1290 }
1291
1292 /**
1293  * Get property "Proxy.Servers" value.
1294  *
1295  * If this property isn't found then @c EINA_FALSE is returned.
1296  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1297  * values shall be considered invalid.
1298  *
1299  * List of proxy URIs. The URI without a protocol will be interpreted as the
1300  * generic proxy URI. All others will target a specific protocol and only once.
1301  * Example of generic proxy server entry would be like this:
1302  * "server.example.com:911".
1303  *
1304  * Used when "manual" method is set.
1305  *
1306  * @param service path to get property.
1307  * @param count return the number of elements in array.
1308  * @param servers array with pointers to internal strings. These
1309  *        strings are not copied in any way, and they are granted to
1310  *        be eina_stringshare instances, so one can use
1311  *        eina_stringshare_ref() if he wants to save memory and cpu to
1312  *        get an extra reference. The array itself is also NOT
1313  *        allocated or copied, do not modify it. This pointer is just
1314  *        set if return is @c EINA_TRUE.
1315  *
1316  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1317  */
1318 Eina_Bool
1319 e_connman_service_proxy_servers_get(const E_Connman_Element *service, unsigned int *count, const char ***servers)
1320 {
1321    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1322    EINA_SAFETY_ON_NULL_RETURN_VAL(servers, EINA_FALSE);
1323    EINA_SAFETY_ON_NULL_RETURN_VAL(count, EINA_FALSE);
1324    return e_connman_element_property_dict_strings_array_get_stringshared
1325              (service, e_connman_prop_proxy, e_connman_prop_servers, count, servers);
1326 }
1327
1328 /**
1329  * Get property "Proxy.Excludes" value.
1330  *
1331  * If this property isn't found then @c EINA_FALSE is returned.
1332  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1333  * values shall be considered invalid.
1334  *
1335  * List of hosts which can be accessed directly.
1336  *
1337  * Used when "manual" method is set.
1338  *
1339  * @param service path to get property.
1340  * @param count return the number of elements in array.
1341  * @param excludes array with pointers to internal strings. These
1342  *        strings are not copied in any way, and they are granted to
1343  *        be eina_stringshare instances, so one can use
1344  *        eina_stringshare_ref() if he wants to save memory and cpu to
1345  *        get an extra reference. The array itself is also NOT
1346  *        allocated or copied, do not modify it. This pointer is just
1347  *        set if return is @c EINA_TRUE.
1348  *
1349  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1350  */
1351 Eina_Bool
1352 e_connman_service_proxy_excludes_get(const E_Connman_Element *service, unsigned int *count, const char ***excludes)
1353 {
1354    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1355    EINA_SAFETY_ON_NULL_RETURN_VAL(excludes, EINA_FALSE);
1356    EINA_SAFETY_ON_NULL_RETURN_VAL(count, EINA_FALSE);
1357    return e_connman_element_property_dict_strings_array_get_stringshared
1358              (service, e_connman_prop_proxy, e_connman_prop_excludes, count, excludes);
1359 }
1360
1361 /**
1362  * Get property "Proxy.Configuration.Method" value.
1363  *
1364  * Unlike Proxy.Configuration.Method, this is the user-set value, rather than
1365  * the actual value.
1366  *
1367  * If this property isn't found then @c EINA_FALSE is returned.
1368  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1369  * values shall be considered invalid.
1370  *
1371  * Possible values are "direct", "auto" and "manual".
1372  *
1373  * @param service path to get property.
1374  * @param method where to store the property value, must be a pointer
1375  *        to string (const char **), it will not be allocated or
1376  *        copied and references will be valid until element changes,
1377  *        so copy it if you want to use it later.
1378  *
1379  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1380  */
1381 Eina_Bool
1382 e_connman_service_proxy_configuration_method_get(const E_Connman_Element *service, const char **method)
1383 {
1384    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1385    EINA_SAFETY_ON_NULL_RETURN_VAL(method, EINA_FALSE);
1386    return e_connman_element_property_dict_get_stringshared
1387              (service, e_connman_prop_proxy_configuration, e_connman_prop_method, NULL, method);
1388 }
1389
1390 /**
1391  * Get property "Proxy.Configuration.URL" value.
1392  *
1393  * Unlike Proxy.URL, this is the user-set value, rather than the
1394  * actual value.
1395  *
1396  * If this property isn't found then @c EINA_FALSE is returned.
1397  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1398  * values shall be considered invalid.
1399  *
1400  * Automatic proxy configuration URL. Used by "auto" method.
1401  *
1402  * @param service path to get property.
1403  * @param url where to store the property value, must be a pointer
1404  *        to string (const char **), it will not be allocated or
1405  *        copied and references will be valid until element changes,
1406  *        so copy it if you want to use it later.
1407  *
1408  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1409  */
1410 Eina_Bool
1411 e_connman_service_proxy_configuration_url_get(const E_Connman_Element *service, const char **url)
1412 {
1413    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1414    EINA_SAFETY_ON_NULL_RETURN_VAL(url, EINA_FALSE);
1415    return e_connman_element_property_dict_get_stringshared
1416              (service, e_connman_prop_proxy_configuration, e_connman_prop_url, NULL, url);
1417 }
1418
1419 /**
1420  * Get property "Proxy.Configuration.Servers" value.
1421  *
1422  * Unlike Proxy.Servers, this is the user-set value, rather than the
1423  * actual value.
1424  *
1425  * If this property isn't found then @c EINA_FALSE is returned.
1426  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1427  * values shall be considered invalid.
1428  *
1429  * List of proxy URIs. The URI without a protocol will be interpreted as the
1430  * generic proxy URI. All others will target a specific protocol and only once.
1431  * Example of generic proxy server entry would be like this:
1432  * "server.example.com:911".
1433  *
1434  * Used when "manual" method is set.
1435  *
1436  * @param service path to get property.
1437  * @param count return the number of elements in array.
1438  * @param servers array with pointers to internal strings. These
1439  *        strings are not copied in any way, and they are granted to
1440  *        be eina_stringshare instances, so one can use
1441  *        eina_stringshare_ref() if he wants to save memory and cpu to
1442  *        get an extra reference. The array itself is also NOT
1443  *        allocated or copied, do not modify it. This pointer is just
1444  *        set if return is @c EINA_TRUE.
1445  *
1446  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1447  */
1448 Eina_Bool
1449 e_connman_service_proxy_configuration_servers_get(const E_Connman_Element *service, unsigned int *count, const char ***servers)
1450 {
1451    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1452    EINA_SAFETY_ON_NULL_RETURN_VAL(servers, EINA_FALSE);
1453    EINA_SAFETY_ON_NULL_RETURN_VAL(count, EINA_FALSE);
1454    return e_connman_element_property_dict_strings_array_get_stringshared
1455              (service, e_connman_prop_proxy_configuration, e_connman_prop_servers, count, servers);
1456 }
1457
1458 /**
1459  * Get property "Proxy.Configuration.Excludes" value.
1460  *
1461  * Unlike Proxy.Excludes, this is the user-set value, rather than the
1462  * actual value.
1463
1464  * If this property isn't found then @c EINA_FALSE is returned.
1465  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1466  * values shall be considered invalid.
1467  *
1468  * List of hosts which can be accessed directly.
1469  *
1470  * Used when "manual" method is set.
1471  *
1472  * @param service path to get property.
1473  * @param count return the number of elements in array.
1474  * @param excludes array with pointers to internal strings. These
1475  *        strings are not copied in any way, and they are granted to
1476  *        be eina_stringshare instances, so one can use
1477  *        eina_stringshare_ref() if he wants to save memory and cpu to
1478  *        get an extra reference. The array itself is also NOT
1479  *        allocated or copied, do not modify it. This pointer is just
1480  *        set if return is @c EINA_TRUE.
1481  *
1482  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1483  */
1484 Eina_Bool
1485 e_connman_service_proxy_configuration_excludes_get(const E_Connman_Element *service, unsigned int *count, const char ***excludes)
1486 {
1487    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1488    EINA_SAFETY_ON_NULL_RETURN_VAL(excludes, EINA_FALSE);
1489    EINA_SAFETY_ON_NULL_RETURN_VAL(count, EINA_FALSE);
1490    return e_connman_element_property_dict_strings_array_get_stringshared
1491              (service, e_connman_prop_proxy_configuration, e_connman_prop_excludes, count, excludes);
1492 }
1493
1494 /**
1495  * Get property "Ethernet.Interface" value.
1496  *
1497  * If this property isn't found then @c EINA_FALSE is returned.
1498  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1499  * values shall be considered invalid.
1500  *
1501  * Interface name (for example eth0).
1502  *
1503  * @param service path to get property.
1504  * @param iface where to store the property value, must be a pointer
1505  *        to string (const char **), it will not be allocated or
1506  *        copied and references will be valid until element changes,
1507  *        so copy it if you want to use it later.
1508  *
1509  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1510  */
1511 Eina_Bool
1512 e_connman_service_ethernet_interface_get(const E_Connman_Element *service, const char **iface)
1513 {
1514    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1515    EINA_SAFETY_ON_NULL_RETURN_VAL(iface, EINA_FALSE);
1516    return e_connman_element_property_dict_get_stringshared
1517              (service, e_connman_prop_ethernet, e_connman_prop_interface, NULL, iface);
1518 }
1519
1520 /**
1521  * Get property "Ethernet.Method" value.
1522  *
1523  * If this property isn't found then @c EINA_FALSE is returned.
1524  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1525  * values shall be considered invalid.
1526  *
1527  * The Ethernet configuration method. Possible values here "auto" and "manual".
1528  *
1529  * @param service path to get property.
1530  * @param method where to store the property value, must be a pointer
1531  *        to string (const char **), it will not be allocated or
1532  *        copied and references will be valid until element changes,
1533  *        so copy it if you want to use it later.
1534  *
1535  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1536  */
1537 Eina_Bool
1538 e_connman_service_ethernet_method_get(const E_Connman_Element *service, const char **method)
1539 {
1540    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1541    EINA_SAFETY_ON_NULL_RETURN_VAL(method, EINA_FALSE);
1542    return e_connman_element_property_dict_get_stringshared
1543              (service, e_connman_prop_ethernet, e_connman_prop_method, NULL, method);
1544 }
1545
1546 /**
1547  * Get property "Ethernet.Speed" value.
1548  *
1549  * If this property isn't found then @c EINA_FALSE is returned.
1550  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1551  * values shall be considered invalid.
1552  *
1553  * Selected speed of the line. This information might not always be available.
1554  *
1555  * @param service path to get property.
1556  * @param speed where to store the property value.
1557  *
1558  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1559  */
1560 Eina_Bool
1561 e_connman_service_ethernet_speed_get(const E_Connman_Element *service, unsigned short *speed)
1562 {
1563    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1564    EINA_SAFETY_ON_NULL_RETURN_VAL(speed, EINA_FALSE);
1565    return e_connman_element_property_dict_get_stringshared
1566              (service, e_connman_prop_ethernet, e_connman_prop_speed, NULL, speed);
1567 }
1568
1569 /**
1570  * Get property "Ethernet.Address" value.
1571  *
1572  * If this property isn't found then @c EINA_FALSE is returned.
1573  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1574  * values shall be considered invalid.
1575  *
1576  * The current configured Ethernet address (mac-address).
1577  *
1578  * @param service path to get property.
1579  * @param address where to store the property value, must be a pointer
1580  *        to string (const char **), it will not be allocated or
1581  *        copied and references will be valid until element changes,
1582  *        so copy it if you want to use it later.
1583  *
1584  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1585  */
1586 Eina_Bool
1587 e_connman_service_ethernet_address_get(const E_Connman_Element *service, const char **address)
1588 {
1589    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1590    EINA_SAFETY_ON_NULL_RETURN_VAL(address, EINA_FALSE);
1591    return e_connman_element_property_dict_get_stringshared
1592              (service, e_connman_prop_ethernet, e_connman_prop_address, NULL, address);
1593 }
1594
1595 /**
1596  * Get property "Ethernet.Duplex" value.
1597  *
1598  * If this property isn't found then @c EINA_FALSE is returned.
1599  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1600  * values shall be considered invalid.
1601  *
1602  * Selected duplex settings of the line. Possible values are "half" and "full".
1603  * This information might not always be available.
1604  *
1605  * @param service path to get property.
1606  * @param duplex where to store the property value, must be a pointer
1607  *        to string (const char **), it will not be allocated or
1608  *        copied and references will be valid until element changes,
1609  *        so copy it if you want to use it later.
1610  *
1611  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1612  */
1613 Eina_Bool
1614 e_connman_service_ethernet_duplex_get(const E_Connman_Element *service, const char **duplex)
1615 {
1616    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1617    EINA_SAFETY_ON_NULL_RETURN_VAL(duplex, EINA_FALSE);
1618    return e_connman_element_property_dict_get_stringshared
1619              (service, e_connman_prop_ethernet, e_connman_prop_duplex, NULL, duplex);
1620 }
1621
1622 /**
1623  * Get property "Ethernet.MTU" value.
1624  *
1625  * If this property isn't found then @c EINA_FALSE is returned.
1626  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1627  * values shall be considered invalid.
1628  *
1629  * The current configured Ethernet MTU.
1630  *
1631  * @param service path to get property.
1632  * @param gateway where to store the property value, must be a pointer
1633  *        to string (const char **), it will not be allocated or
1634  *        copied and references will be valid until element changes,
1635  *        so copy it if you want to use it later.
1636  *
1637  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1638  */
1639 Eina_Bool
1640 e_connman_service_ethernet_mtu_get(const E_Connman_Element *service, unsigned short *mtu)
1641 {
1642    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1643    EINA_SAFETY_ON_NULL_RETURN_VAL(mtu, EINA_FALSE);
1644    return e_connman_element_property_dict_get_stringshared
1645              (service, e_connman_prop_ethernet, e_connman_prop_mtu, NULL, mtu);
1646 }