e_dbus/connman: add Domains.Configuration property
[framework/uifw/edbus.git] / src / lib / connman / 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 security where to store the property value, must be a pointer
346  *        to E_Connman_Array, it will not be allocated or
347  *        copied and references will be valid until element changes,
348  *        so copy it if you want to use it later.
349  *
350  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
351  */
352 Eina_Bool
353 e_connman_service_security_get(const E_Connman_Element *service, const E_Connman_Array **security)
354 {
355    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
356    EINA_SAFETY_ON_NULL_RETURN_VAL(security, EINA_FALSE);
357    return e_connman_element_property_get_stringshared
358              (service, e_connman_prop_security, NULL, security);
359 }
360
361 /**
362  * Get property "Passphrase" value.
363  *
364  * If this property isn't found then @c EINA_FALSE is returned.
365  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
366  * values shall be considered invalid.
367  *
368  * If the service type is WiFi, then this property
369  * can be used to store a passphrase.
370  *
371  * No PropertyChanged signals will be send for this
372  * property. The PassphraseRequired property should
373  * be monitored instead.
374  *
375  * This property might also not always be included
376  * since it is protected by a different security policy.
377  *
378  * @param service path to get property.
379  * @param passphrase where to store the property value, must be a pointer
380  *        to string (const char **), it will not be allocated or
381  *        copied and references will be valid until element changes,
382  *        so copy it if you want to use it later.
383  *
384  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
385  * @see e_connman_service_passphrase_set()
386  */
387 Eina_Bool
388 e_connman_service_passphrase_get(const E_Connman_Element *service, const char **passphrase)
389 {
390    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
391    EINA_SAFETY_ON_NULL_RETURN_VAL(passphrase, EINA_FALSE);
392    return e_connman_element_property_get_stringshared
393              (service, e_connman_prop_passphrase, NULL, passphrase);
394 }
395
396 /**
397  * Set property "Passphrase" value.
398  *
399  * If this property isn't found then @c EINA_FALSE is returned.
400  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
401  * values shall be considered invalid.
402  *
403  * If the service type is WiFi, then this property
404  * can be used to store a passphrase.
405  *
406  * No PropertyChanged signals will be send for this
407  * property. The PassphraseRequired property should
408  * be monitored instead.
409  *
410  * This property might also not always be included
411  * since it is protected by a different security policy.
412  *
413  * @param service path to get property.
414  * @param passphrase value to set.
415  * @param cb function to call when server replies or some error happens.
416  * @param data data to give to cb when it is called.
417  *
418  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
419  * @see e_connman_service_passphrase_get()
420  */
421 Eina_Bool
422 e_connman_service_passphrase_set(E_Connman_Element *service, const char *passphrase, E_DBus_Method_Return_Cb cb, const void *data)
423 {
424    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
425    return e_connman_element_property_set_full
426              (service, e_connman_prop_passphrase, DBUS_TYPE_STRING,
427              passphrase, cb, data);
428 }
429
430 /**
431  * Get property "PassphraseRequired" value.
432  *
433  * If this property isn't found then @c EINA_FALSE is returned.
434  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
435  * values shall be considered invalid.
436  *
437  * If the service type is WiFi, then this property
438  * indicates if a passphrase is required.
439  *
440  * If a passphrase has been set already or if no
441  * passphrase is needed, then this property will
442  * be set to false.
443  *
444  * @param service path to get property.
445  * @param passphrase_required where to store the property value, must be a
446  *        pointer to Eina_Bool (Eina_Bool *).
447  *
448  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
449  */
450 Eina_Bool
451 e_connman_service_passphrase_required_get(const E_Connman_Element *service, Eina_Bool *passphrase_required)
452 {
453    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
454    EINA_SAFETY_ON_NULL_RETURN_VAL(passphrase_required, EINA_FALSE);
455    return e_connman_element_property_get_stringshared
456              (service, e_connman_prop_passphrase_required, NULL, passphrase_required);
457 }
458
459 /**
460  * Get property "LoginRequired" value.
461  *
462  * If this property isn't found then @c EINA_FALSE is returned.
463  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
464  * values shall be considered invalid.
465  *
466  * Indicates that a manual configuration must be done to login the
467  * user, likely access an website using a browser.
468  *
469  * If a login has been set already or if no
470  * login is needed, then this property will
471  * be set to false.
472  *
473  * @param service path to get property.
474  * @param login_required where to store the property value, must be a
475  *        pointer to Eina_Bool (Eina_Bool *).
476  *
477  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
478  *
479  * @since 1.1.0
480  */
481 Eina_Bool
482 e_connman_service_login_required_get(const E_Connman_Element *service, Eina_Bool *login_required)
483 {
484    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
485    EINA_SAFETY_ON_NULL_RETURN_VAL(login_required, EINA_FALSE);
486    return e_connman_element_property_get_stringshared
487              (service, e_connman_prop_login_required, NULL, login_required);
488 }
489
490 /**
491  * Get property "Strength" value.
492  *
493  * If this property isn't found then @c EINA_FALSE is returned.
494  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
495  * values shall be considered invalid.
496  *
497  * Indicates the signal strength of the service. This
498  * is a normalized value between 0 and 100.
499  *
500  * This property will not be present for Ethernet
501  * devices.
502  *
503  * @param service path to get property.
504  * @param strength where to store the property value, must be a pointer
505  *        to byte (unsigned char*).
506  *
507  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
508  */
509 Eina_Bool
510 e_connman_service_strength_get(const E_Connman_Element *service, unsigned char *strength)
511 {
512    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
513    EINA_SAFETY_ON_NULL_RETURN_VAL(strength, EINA_FALSE);
514    return e_connman_element_property_get_stringshared
515              (service, e_connman_prop_strength, NULL, strength);
516 }
517
518 /**
519  * Get property "Favorite" value.
520  *
521  * If this property isn't found then @c EINA_FALSE is returned.
522  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
523  * values shall be considered invalid.
524  *
525  * Will be true if a cable is plugged in or the user
526  * selected and successfully connected to this service.
527  *
528  * This value is automatically changed and to revert
529  * it back to false the Remove() method needs to be
530  * used.
531  *
532  * @param service path to get property.
533  * @param favorite where to store the property value, must be a
534  *        pointer to Eina_Bool (Eina_Bool *).
535  *
536  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
537  */
538 Eina_Bool
539 e_connman_service_favorite_get(const E_Connman_Element *service, Eina_Bool *favorite)
540 {
541    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
542    EINA_SAFETY_ON_NULL_RETURN_VAL(favorite, EINA_FALSE);
543    return e_connman_element_property_get_stringshared
544              (service, e_connman_prop_favorite, NULL, favorite);
545 }
546
547 /**
548  * Get property "Immutable" value.
549  *
550  * This value will be set to true if the service is configured
551  * externally via a configuration file.
552  *
553  * The only valid operation are e_connman_service_connect() and
554  * e_connman_service_disconnect(). The e_connman_service_remove()
555  * method will result in an error.
556
557  * @param service path to get property.
558  * @param immutable where to store the property value, must be a
559  *        pointer to Eina_Bool (Eina_Bool *).
560  *
561  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
562  */
563 Eina_Bool
564 e_connman_service_immutable_get(const E_Connman_Element *service, Eina_Bool *immutable)
565 {
566    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
567    EINA_SAFETY_ON_NULL_RETURN_VAL(immutable, EINA_FALSE);
568    return e_connman_element_property_get_stringshared
569              (service, e_connman_prop_immutable, NULL, immutable);
570 }
571
572 /**
573  * Get property "AutoConnect" value.
574  *
575  * If this property isn't found then @c EINA_FALSE is returned.
576  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
577  * values shall be considered invalid.
578  *
579  * If set to true, this service will auto-connect
580  * when not other connection is available.
581  *
582  * For favorite services it is possible to change
583  * this value to prevent or permit automatic
584  * connection attempts.
585  *
586  * @param service path to get property.
587  * @param auto_connect where to store the property value, must be a
588  *        pointer to Eina_Bool (Eina_Bool *).
589  *
590  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
591  * @see e_connman_service_auto_connect_set()
592  */
593 Eina_Bool
594 e_connman_service_auto_connect_get(const E_Connman_Element *service, Eina_Bool *auto_connect)
595 {
596    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
597    EINA_SAFETY_ON_NULL_RETURN_VAL(auto_connect, EINA_FALSE);
598    return e_connman_element_property_get_stringshared
599              (service, e_connman_prop_auto_connect, NULL, auto_connect);
600 }
601
602 /**
603  * Set property "AutoConnect" value.
604  *
605  * If this property isn't found then @c EINA_FALSE is returned.
606  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
607  * values shall be considered invalid.
608  *
609  * If set to true, this service will auto-connect
610  * when not other connection is available.
611  *
612  * For favorite services it is possible to change
613  * this value to prevent or permit automatic
614  * connection attempts.
615  *
616  * @param service path to get property.
617  * @param service_favorite where to store the property value, must be a
618  *        pointer to Eina_Bool (Eina_Bool *).
619  *
620  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
621  * @see e_connman_service_auto_connect_get()
622  */
623 Eina_Bool
624 e_connman_service_auto_connect_set(E_Connman_Element *service, Eina_Bool auto_connect, E_DBus_Method_Return_Cb cb, const void *data)
625 {
626    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
627    return e_connman_element_property_set_full
628              (service, e_connman_prop_auto_connect, DBUS_TYPE_BOOLEAN, &auto_connect, cb, data);
629 }
630
631 /**
632  * Get property "Roaming" value.
633  *
634  * If this property isn't found then @c EINA_FALSE is returned.
635  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
636  * values shall be considered invalid.
637  *
638  * This property indicates if this service is roaming.
639  *
640  * In the case of Cellular services this normally
641  * indicates connections to a foreign provider when
642  * traveling abroad.
643  *
644  * @param service path to get property.
645  * @param roaming where to store the property value, must be a
646  *        pointer to Eina_Bool (Eina_Bool *).
647  *
648  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
649  */
650 Eina_Bool
651 e_connman_service_roaming_get(const E_Connman_Element *service, Eina_Bool *roaming)
652 {
653    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
654    EINA_SAFETY_ON_NULL_RETURN_VAL(roaming, EINA_FALSE);
655    return e_connman_element_property_get_stringshared
656              (service, e_connman_prop_roaming, NULL, roaming);
657 }
658
659 /**
660  * Get property "Nameservers" value.
661  *
662  * If this property isn't found then @c EINA_FALSE is returned.
663  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
664  * values shall be considered invalid.
665  * The list of currently active nameservers for this service. If the server is
666  * not in READY or ONLINE state than this list will be empty.
667  *
668  * Global nameservers are automatically added to this list.
669  *
670  * The array represents a sorted list of the current nameservers. The first one
671  * has the highest priority and is used by default.
672  *
673  * When using DHCP this array represents the nameservers provided by the
674  * network. In case of manual settings, the ones from Nameservers.Configuration
675  * are used.
676  *
677  * @param service path to get property.
678  * @param count return the number of elements in array.
679  * @param nameservers array with pointers to internal strings. These
680  *        strings are not copied in any way, and they are granted to
681  *        be eina_stringshare instances, so one can use
682  *        eina_stringshare_ref() if he wants to save memory and cpu to
683  *        get an extra reference. The array itself is allocated using
684  *        malloc() and should be freed after usage is done. This
685  *        pointer is just set if return is @c EINA_TRUE.
686  *
687  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
688  */
689 Eina_Bool
690 e_connman_service_nameservers_get(const E_Connman_Element *service, unsigned int *count, const char ***nameservers)
691 {
692    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
693    EINA_SAFETY_ON_NULL_RETURN_VAL(nameservers, EINA_FALSE);
694    EINA_SAFETY_ON_NULL_RETURN_VAL(count, EINA_FALSE);
695    return e_connman_element_strings_array_get_stringshared
696              (service, e_connman_prop_nameservers, count, nameservers);
697 }
698
699 /**
700  * Get property "Nameservers.Configuration" value.
701  *
702  * If this property isn't found then @c EINA_FALSE is returned.
703  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
704  * values shall be considered invalid.
705  * The list of currently active nameservers for this service. If the server is
706  * not in READY or ONLINE state than this list will be empty.
707  *
708  * Unlike Nameservers, this is the user-set value, rather than the
709  * actual value.
710  *
711  * @param service path to get property.
712  * @param count return the number of elements in array.
713  * @param nameservers array with pointers to internal strings. These
714  *        strings are not copied in any way, and they are granted to
715  *        be eina_stringshare instances, so one can use
716  *        eina_stringshare_ref() if he wants to save memory and cpu to
717  *        get an extra reference. The array itself is allocated using
718  *        malloc() and should be freed after usage is done. This
719  *        pointer is just set if return is @c EINA_TRUE.
720  *
721  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
722  */
723 Eina_Bool
724 e_connman_service_nameservers_configuration_get(const E_Connman_Element *service, unsigned int *count, const char ***nameservers)
725 {
726    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
727    EINA_SAFETY_ON_NULL_RETURN_VAL(nameservers, EINA_FALSE);
728    EINA_SAFETY_ON_NULL_RETURN_VAL(count, EINA_FALSE);
729    return e_connman_element_strings_array_get_stringshared
730              (service, e_connman_prop_nameservers_configuration, count, nameservers);
731 }
732
733 /**
734  * Set property "Nameservers.Configuration" value.
735  *
736  * If this property isn't found then @c EINA_FALSE is returned.
737  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
738  * values shall be considered invalid.
739  *
740  * Unlike Nameservers, this is the user-set value, rather than the actual value.
741  * It allows user to override the default setting.  When using manual
742  * configuration and no global nameservers are configured, then it is useful to
743  * configure this setting as well.
744  *
745  * This list is sorted by priority and the first entry represents the nameserver
746  * with the highest priority.
747  *
748  * Changes to the domain name servers can be done at any time. It will not cause
749  * a disconnect of the service. However there might be small window where name
750  * resolution might fail.
751  *
752  * @param service path to set property.
753  * @param nameservers sorted list of the current nameservers. The first one has
754  * the highest priority and is used by default.
755  * @param cb function to call when server replies or some error happens.
756  * @param data data to give to cb when it is called.
757  *
758  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
759  * @see e_connman_service_nameservers_configuration_get()
760  */
761 Eina_Bool
762 e_connman_service_nameservers_configuration_set(E_Connman_Element *service, Eina_List *nameservers, E_DBus_Method_Return_Cb cb, const void *data)
763 {
764    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
765    EINA_SAFETY_ON_NULL_RETURN_VAL(nameservers, EINA_FALSE);
766    return e_connman_element_property_array_set_full
767              (service, e_connman_prop_nameservers_configuration,
768              DBUS_TYPE_STRING, nameservers, cb, data);
769 }
770
771 /**
772  * Get property "Domains" value.
773  *
774  * If this property isn't found then @c EINA_FALSE is returned.
775  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
776  * values shall be considered invalid.
777  * The list of currently active domains for this service. If the server is
778  * not in READY or ONLINE state than this list will be empty.
779  *
780  * The list of currently used search domains.
781  *
782  * @param service path to get property.
783  * @param count return the number of elements in array.
784  * @param domains array with pointers to internal strings. These
785  *        strings are not copied in any way, and they are granted to
786  *        be eina_stringshare instances, so one can use
787  *        eina_stringshare_ref() if he wants to save memory and cpu to
788  *        get an extra reference. The array itself is allocated using
789  *        malloc() and should be freed after usage is done. This
790  *        pointer is just set if return is @c EINA_TRUE.
791  *
792  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
793  */
794 Eina_Bool
795 e_connman_service_domains_get(const E_Connman_Element *service, unsigned int *count, const char ***domains)
796 {
797    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
798    EINA_SAFETY_ON_NULL_RETURN_VAL(domains, EINA_FALSE);
799    EINA_SAFETY_ON_NULL_RETURN_VAL(count, EINA_FALSE);
800    return e_connman_element_strings_array_get_stringshared
801              (service, e_connman_prop_domains, count, domains);
802 }
803
804 /**
805  * Get property "Domains.Configuration" value.
806  *
807  * If this property isn't found then @c EINA_FALSE is returned.
808  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
809  * values shall be considered invalid.
810  * The list of currently active domains for this service. If the server is
811  * not in READY or ONLINE state than this list will be empty.
812  *
813  * Unlike Domains, this is the user-set value, rather than the
814  * actual value.
815  *
816  * @param service path to get property.
817  * @param count return the number of elements in array.
818  * @param domains array with pointers to internal strings. These
819  *        strings are not copied in any way, and they are granted to
820  *        be eina_stringshare instances, so one can use
821  *        eina_stringshare_ref() if he wants to save memory and cpu to
822  *        get an extra reference. The array itself is allocated using
823  *        malloc() and should be freed after usage is done. This
824  *        pointer is just set if return is @c EINA_TRUE.
825  *
826  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
827  */
828 Eina_Bool
829 e_connman_service_domains_configuration_get(const E_Connman_Element *service, unsigned int *count, const char ***domains)
830 {
831    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
832    EINA_SAFETY_ON_NULL_RETURN_VAL(domains, EINA_FALSE);
833    EINA_SAFETY_ON_NULL_RETURN_VAL(count, EINA_FALSE);
834    return e_connman_element_strings_array_get_stringshared
835              (service, e_connman_prop_domains_configuration, count, domains);
836 }
837
838 /**
839  * Set property "Domains.Configuration" value.
840  *
841  * If this property isn't found then @c EINA_FALSE is returned.
842  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
843  * values shall be considered invalid.
844  *
845  * Unlike Domains, this is the user-set value, rather than the actual value.
846  * It allows user to override the default setting.  When using manual
847  * configuration and no global domains are configured, then it is useful to
848  * configure this setting as well.
849  *
850  * This list is sorted by priority and the first entry represents the nameserver
851  * with the highest priority.
852  *
853  * Changes to the domain name servers can be done at any time. It will not cause
854  * a disconnect of the service. However there might be small window where name
855  * resolution might fail.
856  *
857  * @param service path to set property.
858  * @param domains sorted list of the current domains. The first one has
859  * the highest priority and is used by default.
860  * @param cb function to call when server replies or some error happens.
861  * @param data data to give to cb when it is called.
862  *
863  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
864  * @see e_connman_service_domains_configuration_get()
865  */
866 Eina_Bool
867 e_connman_service_domains_configuration_set(E_Connman_Element *service, Eina_List *domains, E_DBus_Method_Return_Cb cb, const void *data)
868 {
869    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
870    EINA_SAFETY_ON_NULL_RETURN_VAL(domains, EINA_FALSE);
871    return e_connman_element_property_array_set_full
872              (service, e_connman_prop_domains_configuration,
873              DBUS_TYPE_STRING, domains, cb, data);
874 }
875
876 /**
877  * Get property "IPv4.Method" value.
878  *
879  * If this property isn't found then @c EINA_FALSE is returned.
880  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
881  * values shall be considered invalid.
882  *
883  * The IPv4 method in use. Possible values here are "dhcp" and
884  * "static".
885  *
886  * @param service path to get property.
887  * @param method where to store the property value, must be a pointer
888  *        to string (const char **), it will not be allocated or
889  *        copied and references will be valid until element changes,
890  *        so copy it if you want to use it later.
891  *
892  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
893  */
894 Eina_Bool
895 e_connman_service_ipv4_method_get(const E_Connman_Element *service, const char **method)
896 {
897    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
898    EINA_SAFETY_ON_NULL_RETURN_VAL(method, EINA_FALSE);
899    return e_connman_element_property_dict_get_stringshared
900              (service, e_connman_prop_ipv4, e_connman_prop_method, NULL, method);
901 }
902
903 /**
904  * Get property "IPv4.Address" value.
905  *
906  * If this property isn't found then @c EINA_FALSE is returned.
907  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
908  * values shall be considered invalid.
909  *
910  * The current IPv4 address.
911  *
912  * @param service path to get property.
913  * @param address where to store the property value, must be a pointer
914  *        to string (const char **), it will not be allocated or
915  *        copied and references will be valid until element changes,
916  *        so copy it if you want to use it later.
917  *
918  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
919  */
920 Eina_Bool
921 e_connman_service_ipv4_address_get(const E_Connman_Element *service, const char **address)
922 {
923    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
924    EINA_SAFETY_ON_NULL_RETURN_VAL(address, EINA_FALSE);
925    return e_connman_element_property_dict_get_stringshared
926              (service, e_connman_prop_ipv4, e_connman_prop_address, NULL, address);
927 }
928
929 /**
930  * Get property "IPv4.Gateway" value.
931  *
932  * If this property isn't found then @c EINA_FALSE is returned.
933  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
934  * values shall be considered invalid.
935  *
936  * The current IPv4 gateway.
937  *
938  * @param service path to get property.
939  * @param gateway where to store the property value, must be a pointer
940  *        to string (const char **), it will not be allocated or
941  *        copied and references will be valid until element changes,
942  *        so copy it if you want to use it later.
943  *
944  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
945  */
946 Eina_Bool
947 e_connman_service_ipv4_gateway_get(const E_Connman_Element *service, const char **gateway)
948 {
949    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
950    EINA_SAFETY_ON_NULL_RETURN_VAL(gateway, EINA_FALSE);
951    return e_connman_element_property_dict_get_stringshared
952              (service, e_connman_prop_ipv4, e_connman_prop_gateway, NULL, gateway);
953 }
954
955 /**
956  * Get property "IPv4.Netmask" value.
957  *
958  * If this property isn't found then @c EINA_FALSE is returned.
959  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
960  * values shall be considered invalid.
961  *
962  * The current IPv4 netmask.
963  *
964  * @param service path to get property.
965  * @param netmask where to store the property value, must be a pointer
966  *        to string (const char **), it will not be allocated or
967  *        copied and references will be valid until element changes,
968  *        so copy it if you want to use it later.
969  *
970  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
971  */
972 Eina_Bool
973 e_connman_service_ipv4_netmask_get(const E_Connman_Element *service, const char **netmask)
974 {
975    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
976    EINA_SAFETY_ON_NULL_RETURN_VAL(netmask, EINA_FALSE);
977    return e_connman_element_property_dict_get_stringshared
978              (service, e_connman_prop_ipv4, e_connman_prop_netmask, NULL, netmask);
979 }
980
981 /**
982  * Get property "IPv4.Configuration.Method" value.
983  *
984  * Unlike IPv4.Method, this is the user-set value, rather than the
985  * actual value.
986  *
987  * If this property isn't found then @c EINA_FALSE is returned.
988  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
989  * values shall be considered invalid.
990  *
991  * The IPv4 configured method. Possible values here are "dhcp" and
992  * "static".
993  *
994  * @param service path to get property.
995  * @param method where to store the property value, must be a pointer
996  *        to string (const char **), it will not be allocated or
997  *        copied and references will be valid until element changes,
998  *        so copy it if you want to use it later.
999  *
1000  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1001  */
1002 Eina_Bool
1003 e_connman_service_ipv4_configuration_method_get(const E_Connman_Element *service, const char **method)
1004 {
1005    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1006    EINA_SAFETY_ON_NULL_RETURN_VAL(method, EINA_FALSE);
1007    return e_connman_element_property_dict_get_stringshared
1008              (service, e_connman_prop_ipv4_configuration, e_connman_prop_method,
1009              NULL, method);
1010 }
1011
1012 /**
1013  * Get property "IPv4.Configuration.Address" value.
1014  *
1015  * Unlike IPv4.Address, this is the user-set value, rather than the
1016  * actual value.
1017  *
1018  * If this property isn't found then @c EINA_FALSE is returned.
1019  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1020  * values shall be considered invalid.
1021  *
1022  * The current configured IPv4 address.
1023  *
1024  * @param service path to get property.
1025  * @param address where to store the property value, must be a pointer
1026  *        to string (const char **), it will not be allocated or
1027  *        copied and references will be valid until element changes,
1028  *        so copy it if you want to use it later.
1029  *
1030  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1031  */
1032 Eina_Bool
1033 e_connman_service_ipv4_configuration_address_get(const E_Connman_Element *service, const char **address)
1034 {
1035    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1036    EINA_SAFETY_ON_NULL_RETURN_VAL(address, EINA_FALSE);
1037    return e_connman_element_property_dict_get_stringshared
1038              (service, e_connman_prop_ipv4_configuration, e_connman_prop_address,
1039              NULL, address);
1040 }
1041
1042 /**
1043  * Get property "IPv4.Configuration.Gateway" value.
1044  *
1045  * Unlike IPv4.Gateway, this is the user-set value, rather than the
1046  * actual value.
1047  *
1048  * If this property isn't found then @c EINA_FALSE is returned.
1049  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1050  * values shall be considered invalid.
1051  *
1052  * The current configured IPv4 gateway.
1053  *
1054  * @param service path to get property.
1055  * @param gateway where to store the property value, must be a pointer
1056  *        to string (const char **), it will not be allocated or
1057  *        copied and references will be valid until element changes,
1058  *        so copy it if you want to use it later.
1059  *
1060  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1061  */
1062 Eina_Bool
1063 e_connman_service_ipv4_configuration_gateway_get(const E_Connman_Element *service, const char **gateway)
1064 {
1065    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1066    EINA_SAFETY_ON_NULL_RETURN_VAL(gateway, EINA_FALSE);
1067    return e_connman_element_property_dict_get_stringshared
1068              (service, e_connman_prop_ipv4_configuration, e_connman_prop_gateway,
1069              NULL, gateway);
1070 }
1071
1072 /**
1073  * Get property "IPv4.Configuration.Netmask" value.
1074  *
1075  * Unlike IPv4.Netmask, this is the user-set value, rather than the
1076  * actual value.
1077  *
1078  * If this property isn't found then @c EINA_FALSE is returned.
1079  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1080  * values shall be considered invalid.
1081  *
1082  * The current configured IPv4 netmask.
1083  *
1084  * @param service path to get property.
1085  * @param netmask where to store the property value, must be a pointer
1086  *        to string (const char **), it will not be allocated or
1087  *        copied and references will be valid until element changes,
1088  *        so copy it if you want to use it later.
1089  *
1090  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1091  */
1092 Eina_Bool
1093 e_connman_service_ipv4_configuration_netmask_get(const E_Connman_Element *service, const char **netmask)
1094 {
1095    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1096    EINA_SAFETY_ON_NULL_RETURN_VAL(netmask, EINA_FALSE);
1097    return e_connman_element_property_dict_get_stringshared
1098              (service, e_connman_prop_ipv4_configuration, e_connman_prop_netmask,
1099              NULL, netmask);
1100 }
1101
1102 /**
1103  * Set IPv4 to connect automatically using DHCP.
1104  *
1105  * @param service path to set.
1106  * @param cb function to call when server replies or some error happens.
1107  * @param data data to give to cb when it is called.
1108  *
1109  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1110  */
1111 Eina_Bool
1112 e_connman_service_ipv4_configure_dhcp(E_Connman_Element *service, E_DBus_Method_Return_Cb cb, const void *data)
1113 {
1114    const char method[] = "dhcp";
1115    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1116    return e_connman_element_property_dict_set_full
1117              (service, e_connman_prop_ipv4_configuration, e_connman_prop_method,
1118              DBUS_TYPE_STRING, method, cb, data);
1119 }
1120
1121 /**
1122  * Set IPv4 to connect using manually set parameters.
1123  *
1124  * @param service path to set.
1125  * @param address IPv4 address.
1126  * @param netmask IPv4 netmask, or @c NULL for "/32".
1127  * @param gateway IPv4 gateway address.
1128  * @param cb function to call when server replies or some error happens.
1129  * @param data data to give to cb when it is called.
1130  *
1131  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1132  */
1133 Eina_Bool
1134 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)
1135 {
1136    const char name[] = "SetProperty";
1137    const char *method = "manual"; /* not method[] as gcc screws it with dbus */
1138    DBusMessage *msg;
1139    DBusMessageIter itr, variant, dict, entry;
1140
1141    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1142    EINA_SAFETY_ON_NULL_RETURN_VAL(address, EINA_FALSE);
1143
1144    msg = dbus_message_new_method_call
1145          (e_connman_system_bus_name_get(), service->path, service->interface, name);
1146
1147    if (!msg)
1148       return 0;
1149
1150    dbus_message_iter_init_append(msg, &itr);
1151    dbus_message_iter_append_basic
1152       (&itr, DBUS_TYPE_STRING, &e_connman_prop_ipv4_configuration);
1153
1154    dbus_message_iter_open_container
1155       (&itr, DBUS_TYPE_VARIANT,
1156       (DBUS_TYPE_ARRAY_AS_STRING
1157        DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
1158        DBUS_TYPE_STRING_AS_STRING
1159        DBUS_TYPE_STRING_AS_STRING
1160        DBUS_DICT_ENTRY_END_CHAR_AS_STRING),
1161       &variant);
1162    dbus_message_iter_open_container
1163       (&variant, DBUS_TYPE_ARRAY,
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       &dict);
1169
1170    dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, NULL, &entry);
1171    dbus_message_iter_append_basic
1172       (&entry, DBUS_TYPE_STRING, &e_connman_prop_method);
1173    dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &method);
1174    dbus_message_iter_close_container(&dict, &entry);
1175
1176    dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, NULL, &entry);
1177    dbus_message_iter_append_basic
1178       (&entry, DBUS_TYPE_STRING, &e_connman_prop_address);
1179    dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &address);
1180    dbus_message_iter_close_container(&dict, &entry);
1181
1182    if (netmask)
1183      {
1184         dbus_message_iter_open_container
1185            (&dict, DBUS_TYPE_DICT_ENTRY, NULL, &entry);
1186         dbus_message_iter_append_basic
1187            (&entry, DBUS_TYPE_STRING, &e_connman_prop_netmask);
1188         dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &netmask);
1189         dbus_message_iter_close_container(&dict, &entry);
1190      }
1191
1192    if (gateway)
1193      {
1194         dbus_message_iter_open_container
1195            (&dict, DBUS_TYPE_DICT_ENTRY, NULL, &entry);
1196         dbus_message_iter_append_basic
1197            (&entry, DBUS_TYPE_STRING, &e_connman_prop_gateway);
1198         dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &gateway);
1199         dbus_message_iter_close_container(&dict, &entry);
1200      }
1201
1202    dbus_message_iter_close_container(&variant, &dict);
1203    dbus_message_iter_close_container(&itr, &variant);
1204
1205    return e_connman_element_message_send
1206              (service, name, NULL, msg, &service->_pending.property_set, cb, data);
1207 }
1208
1209 /**
1210  * Get property "Proxy.Method" value.
1211  *
1212  * If this property isn't found then @c EINA_FALSE is returned.
1213  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1214  * values shall be considered invalid.
1215  *
1216  * Possible values are "direct", "auto" and "manual".
1217  *
1218  * @param service path to get property.
1219  * @param method where to store the property value, must be a pointer
1220  *        to string (const char **), it will not be allocated or
1221  *        copied and references will be valid until element changes,
1222  *        so copy it if you want to use it later.
1223  *
1224  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1225  */
1226 Eina_Bool
1227 e_connman_service_proxy_method_get(const E_Connman_Element *service, const char **method)
1228 {
1229    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1230    EINA_SAFETY_ON_NULL_RETURN_VAL(method, EINA_FALSE);
1231    return e_connman_element_property_dict_get_stringshared
1232              (service, e_connman_prop_proxy, e_connman_prop_method, NULL, method);
1233 }
1234
1235 /**
1236  * Get property "Proxy.URL" value.
1237  *
1238  * If this property isn't found then @c EINA_FALSE is returned.
1239  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1240  * values shall be considered invalid.
1241  *
1242  * Automatic proxy configuration URL. Used by "auto" method.
1243  *
1244  * @param service path to get property.
1245  * @param url where to store the property value, must be a pointer
1246  *        to string (const char **), it will not be allocated or
1247  *        copied and references will be valid until element changes,
1248  *        so copy it if you want to use it later.
1249  *
1250  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1251  */
1252 Eina_Bool
1253 e_connman_service_proxy_url_get(const E_Connman_Element *service, const char **url)
1254 {
1255    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1256    EINA_SAFETY_ON_NULL_RETURN_VAL(url, EINA_FALSE);
1257    return e_connman_element_property_dict_get_stringshared
1258              (service, e_connman_prop_proxy, e_connman_prop_url, NULL, url);
1259 }
1260
1261 /**
1262  * Get property "Proxy.Servers" value.
1263  *
1264  * If this property isn't found then @c EINA_FALSE is returned.
1265  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1266  * values shall be considered invalid.
1267  *
1268  * List of proxy URIs. The URI without a protocol will be interpreted as the
1269  * generic proxy URI. All others will target a specific protocol and only once.
1270  * Example of generic proxy server entry would be like this:
1271  * "server.example.com:911".
1272  *
1273  * Used when "manual" method is set.
1274  *
1275  * @param service path to get property.
1276  * @param count return the number of elements in array.
1277  * @param servers array with pointers to internal strings. These
1278  *        strings are not copied in any way, and they are granted to
1279  *        be eina_stringshare instances, so one can use
1280  *        eina_stringshare_ref() if he wants to save memory and cpu to
1281  *        get an extra reference. The array itself is allocated using
1282  *        malloc() and should be freed after usage is done. This
1283  *        pointer is just set if return is @c EINA_TRUE.
1284  *
1285  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1286  */
1287 Eina_Bool
1288 e_connman_service_proxy_servers_get(const E_Connman_Element *service, unsigned int *count, const char ***servers)
1289 {
1290    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1291    EINA_SAFETY_ON_NULL_RETURN_VAL(servers, EINA_FALSE);
1292    EINA_SAFETY_ON_NULL_RETURN_VAL(count, EINA_FALSE);
1293    return e_connman_element_property_dict_strings_array_get_stringshared
1294              (service, e_connman_prop_proxy, e_connman_prop_servers, count, servers);
1295 }
1296
1297 /**
1298  * Get property "Proxy.Excludes" value.
1299  *
1300  * If this property isn't found then @c EINA_FALSE is returned.
1301  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1302  * values shall be considered invalid.
1303  *
1304  * List of hosts which can be accessed directly.
1305  *
1306  * Used when "manual" method is set.
1307  *
1308  * @param service path to get property.
1309  * @param count return the number of elements in array.
1310  * @param excludes array with pointers to internal strings. These
1311  *        strings are not copied in any way, and they are granted to
1312  *        be eina_stringshare instances, so one can use
1313  *        eina_stringshare_ref() if he wants to save memory and cpu to
1314  *        get an extra reference. The array itself is allocated using
1315  *        malloc() and should be freed after usage is done. This
1316  *        pointer is just set if return is @c EINA_TRUE.
1317  *
1318  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1319  */
1320 Eina_Bool
1321 e_connman_service_proxy_excludes_get(const E_Connman_Element *service, unsigned int *count, const char ***excludes)
1322 {
1323    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1324    EINA_SAFETY_ON_NULL_RETURN_VAL(excludes, EINA_FALSE);
1325    EINA_SAFETY_ON_NULL_RETURN_VAL(count, EINA_FALSE);
1326    return e_connman_element_property_dict_strings_array_get_stringshared
1327              (service, e_connman_prop_proxy, e_connman_prop_excludes, count, excludes);
1328 }
1329
1330 /**
1331  * Get property "Proxy.Configuration.Method" value.
1332  *
1333  * Unlike Proxy.Configuration.Method, this is the user-set value, rather than
1334  * the actual value.
1335  *
1336  * If this property isn't found then @c EINA_FALSE is returned.
1337  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1338  * values shall be considered invalid.
1339  *
1340  * Possible values are "direct", "auto" and "manual".
1341  *
1342  * @param service path to get property.
1343  * @param method where to store the property value, must be a pointer
1344  *        to string (const char **), it will not be allocated or
1345  *        copied and references will be valid until element changes,
1346  *        so copy it if you want to use it later.
1347  *
1348  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1349  */
1350 Eina_Bool
1351 e_connman_service_proxy_configuration_method_get(const E_Connman_Element *service, const char **method)
1352 {
1353    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1354    EINA_SAFETY_ON_NULL_RETURN_VAL(method, EINA_FALSE);
1355    return e_connman_element_property_dict_get_stringshared
1356              (service, e_connman_prop_proxy_configuration, e_connman_prop_method, NULL, method);
1357 }
1358
1359 /**
1360  * Get property "Proxy.Configuration.URL" value.
1361  *
1362  * Unlike Proxy.URL, this is the user-set value, rather than the
1363  * actual value.
1364  *
1365  * If this property isn't found then @c EINA_FALSE is returned.
1366  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1367  * values shall be considered invalid.
1368  *
1369  * Automatic proxy configuration URL. Used by "auto" method.
1370  *
1371  * @param service path to get property.
1372  * @param url where to store the property value, must be a pointer
1373  *        to string (const char **), it will not be allocated or
1374  *        copied and references will be valid until element changes,
1375  *        so copy it if you want to use it later.
1376  *
1377  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1378  */
1379 Eina_Bool
1380 e_connman_service_proxy_configuration_url_get(const E_Connman_Element *service, const char **url)
1381 {
1382    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1383    EINA_SAFETY_ON_NULL_RETURN_VAL(url, EINA_FALSE);
1384    return e_connman_element_property_dict_get_stringshared
1385              (service, e_connman_prop_proxy_configuration, e_connman_prop_url, NULL, url);
1386 }
1387
1388 /**
1389  * Get property "Proxy.Configuration.Servers" value.
1390  *
1391  * Unlike Proxy.Servers, this is the user-set value, rather than the
1392  * actual value.
1393  *
1394  * If this property isn't found then @c EINA_FALSE is returned.
1395  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1396  * values shall be considered invalid.
1397  *
1398  * List of proxy URIs. The URI without a protocol will be interpreted as the
1399  * generic proxy URI. All others will target a specific protocol and only once.
1400  * Example of generic proxy server entry would be like this:
1401  * "server.example.com:911".
1402  *
1403  * Used when "manual" method is set.
1404  *
1405  * @param service path to get property.
1406  * @param count return the number of elements in array.
1407  * @param servers array with pointers to internal strings. These
1408  *        strings are not copied in any way, and they are granted to
1409  *        be eina_stringshare instances, so one can use
1410  *        eina_stringshare_ref() if he wants to save memory and cpu to
1411  *        get an extra reference. The array itself is allocated using
1412  *        malloc() and should be freed after usage is done. This
1413  *        pointer is just set if return is @c EINA_TRUE.
1414  *
1415  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1416  */
1417 Eina_Bool
1418 e_connman_service_proxy_configuration_servers_get(const E_Connman_Element *service, unsigned int *count, const char ***servers)
1419 {
1420    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1421    EINA_SAFETY_ON_NULL_RETURN_VAL(servers, EINA_FALSE);
1422    EINA_SAFETY_ON_NULL_RETURN_VAL(count, EINA_FALSE);
1423    return e_connman_element_property_dict_strings_array_get_stringshared
1424              (service, e_connman_prop_proxy_configuration, e_connman_prop_servers, count, servers);
1425 }
1426
1427 /**
1428  * Get property "Proxy.Configuration.Excludes" value.
1429  *
1430  * Unlike Proxy.Excludes, this is the user-set value, rather than the
1431  * actual value.
1432
1433  * If this property isn't found then @c EINA_FALSE is returned.
1434  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1435  * values shall be considered invalid.
1436  *
1437  * List of hosts which can be accessed directly.
1438  *
1439  * Used when "manual" method is set.
1440  *
1441  * @param service path to get property.
1442  * @param count return the number of elements in array.
1443  * @param excludes array with pointers to internal strings. These
1444  *        strings are not copied in any way, and they are granted to
1445  *        be eina_stringshare instances, so one can use
1446  *        eina_stringshare_ref() if he wants to save memory and cpu to
1447  *        get an extra reference. The array itself is allocated using
1448  *        malloc() and should be freed after usage is done. This
1449  *        pointer is just set if return is @c EINA_TRUE.
1450  *
1451  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1452  */
1453 Eina_Bool
1454 e_connman_service_proxy_configuration_excludes_get(const E_Connman_Element *service, unsigned int *count, const char ***excludes)
1455 {
1456    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1457    EINA_SAFETY_ON_NULL_RETURN_VAL(excludes, EINA_FALSE);
1458    EINA_SAFETY_ON_NULL_RETURN_VAL(count, EINA_FALSE);
1459    return e_connman_element_property_dict_strings_array_get_stringshared
1460              (service, e_connman_prop_proxy_configuration, e_connman_prop_excludes, count, excludes);
1461 }
1462
1463 /**
1464  * Get property "Ethernet.Interface" value.
1465  *
1466  * If this property isn't found then @c EINA_FALSE is returned.
1467  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1468  * values shall be considered invalid.
1469  *
1470  * Interface name (for example eth0).
1471  *
1472  * @param service path to get property.
1473  * @param iface where to store the property value, must be a pointer
1474  *        to string (const char **), it will not be allocated or
1475  *        copied and references will be valid until element changes,
1476  *        so copy it if you want to use it later.
1477  *
1478  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1479  */
1480 Eina_Bool
1481 e_connman_service_ethernet_interface_get(const E_Connman_Element *service, const char **iface)
1482 {
1483    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1484    EINA_SAFETY_ON_NULL_RETURN_VAL(iface, EINA_FALSE);
1485    return e_connman_element_property_dict_get_stringshared
1486              (service, e_connman_prop_ethernet, e_connman_prop_interface, NULL, iface);
1487 }
1488
1489 /**
1490  * Get property "Ethernet.Method" value.
1491  *
1492  * If this property isn't found then @c EINA_FALSE is returned.
1493  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1494  * values shall be considered invalid.
1495  *
1496  * The Ethernet configuration method. Possible values here "auto" and "manual".
1497  *
1498  * @param service path to get property.
1499  * @param method where to store the property value, must be a pointer
1500  *        to string (const char **), it will not be allocated or
1501  *        copied and references will be valid until element changes,
1502  *        so copy it if you want to use it later.
1503  *
1504  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1505  */
1506 Eina_Bool
1507 e_connman_service_ethernet_method_get(const E_Connman_Element *service, const char **method)
1508 {
1509    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1510    EINA_SAFETY_ON_NULL_RETURN_VAL(method, EINA_FALSE);
1511    return e_connman_element_property_dict_get_stringshared
1512              (service, e_connman_prop_ethernet, e_connman_prop_method, NULL, method);
1513 }
1514
1515 /**
1516  * Get property "Ethernet.Speed" value.
1517  *
1518  * If this property isn't found then @c EINA_FALSE is returned.
1519  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1520  * values shall be considered invalid.
1521  *
1522  * Selected speed of the line. This information might not always be available.
1523  *
1524  * @param service path to get property.
1525  * @param speed where to store the property value.
1526  *
1527  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1528  */
1529 Eina_Bool
1530 e_connman_service_ethernet_speed_get(const E_Connman_Element *service, unsigned short *speed)
1531 {
1532    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1533    EINA_SAFETY_ON_NULL_RETURN_VAL(speed, EINA_FALSE);
1534    return e_connman_element_property_dict_get_stringshared
1535              (service, e_connman_prop_ethernet, e_connman_prop_speed, NULL, speed);
1536 }
1537
1538 /**
1539  * Get property "Ethernet.Address" value.
1540  *
1541  * If this property isn't found then @c EINA_FALSE is returned.
1542  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1543  * values shall be considered invalid.
1544  *
1545  * The current configured Ethernet address (mac-address).
1546  *
1547  * @param service path to get property.
1548  * @param address where to store the property value, must be a pointer
1549  *        to string (const char **), it will not be allocated or
1550  *        copied and references will be valid until element changes,
1551  *        so copy it if you want to use it later.
1552  *
1553  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1554  */
1555 Eina_Bool
1556 e_connman_service_ethernet_address_get(const E_Connman_Element *service, const char **address)
1557 {
1558    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1559    EINA_SAFETY_ON_NULL_RETURN_VAL(address, EINA_FALSE);
1560    return e_connman_element_property_dict_get_stringshared
1561              (service, e_connman_prop_ethernet, e_connman_prop_address, NULL, address);
1562 }
1563
1564 /**
1565  * Get property "Ethernet.Duplex" value.
1566  *
1567  * If this property isn't found then @c EINA_FALSE is returned.
1568  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1569  * values shall be considered invalid.
1570  *
1571  * Selected duplex settings of the line. Possible values are "half" and "full".
1572  * This information might not always be available.
1573  *
1574  * @param service path to get property.
1575  * @param duplex where to store the property value, must be a pointer
1576  *        to string (const char **), it will not be allocated or
1577  *        copied and references will be valid until element changes,
1578  *        so copy it if you want to use it later.
1579  *
1580  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1581  */
1582 Eina_Bool
1583 e_connman_service_ethernet_duplex_get(const E_Connman_Element *service, const char **duplex)
1584 {
1585    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1586    EINA_SAFETY_ON_NULL_RETURN_VAL(duplex, EINA_FALSE);
1587    return e_connman_element_property_dict_get_stringshared
1588              (service, e_connman_prop_ethernet, e_connman_prop_duplex, NULL, duplex);
1589 }
1590
1591 /**
1592  * Get property "Ethernet.MTU" value.
1593  *
1594  * If this property isn't found then @c EINA_FALSE is returned.
1595  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1596  * values shall be considered invalid.
1597  *
1598  * The current configured Ethernet MTU.
1599  *
1600  * @param service path to get property.
1601  * @param gateway where to store the property value, must be a pointer
1602  *        to string (const char **), it will not be allocated or
1603  *        copied and references will be valid until element changes,
1604  *        so copy it if you want to use it later.
1605  *
1606  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1607  */
1608 Eina_Bool
1609 e_connman_service_ethernet_mtu_get(const E_Connman_Element *service, unsigned short *mtu)
1610 {
1611    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1612    EINA_SAFETY_ON_NULL_RETURN_VAL(mtu, EINA_FALSE);
1613    return e_connman_element_property_dict_get_stringshared
1614              (service, e_connman_prop_ethernet, e_connman_prop_mtu, NULL, mtu);
1615 }