e_connman0_7x: phase-1 - revert to old code
[framework/uifw/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    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    dbus_message_iter_open_container
1170       (&variant, DBUS_TYPE_ARRAY,
1171       (DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
1172        DBUS_TYPE_STRING_AS_STRING
1173        DBUS_TYPE_STRING_AS_STRING
1174        DBUS_DICT_ENTRY_END_CHAR_AS_STRING),
1175       &dict);
1176
1177    dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, NULL, &entry);
1178    dbus_message_iter_append_basic
1179       (&entry, DBUS_TYPE_STRING, &e_connman_prop_method);
1180    dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &method);
1181    dbus_message_iter_close_container(&dict, &entry);
1182
1183    dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, NULL, &entry);
1184    dbus_message_iter_append_basic
1185       (&entry, DBUS_TYPE_STRING, &e_connman_prop_address);
1186    dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &address);
1187    dbus_message_iter_close_container(&dict, &entry);
1188
1189    if (netmask)
1190      {
1191         dbus_message_iter_open_container
1192            (&dict, DBUS_TYPE_DICT_ENTRY, NULL, &entry);
1193         dbus_message_iter_append_basic
1194            (&entry, DBUS_TYPE_STRING, &e_connman_prop_netmask);
1195         dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &netmask);
1196         dbus_message_iter_close_container(&dict, &entry);
1197      }
1198
1199    if (gateway)
1200      {
1201         dbus_message_iter_open_container
1202            (&dict, DBUS_TYPE_DICT_ENTRY, NULL, &entry);
1203         dbus_message_iter_append_basic
1204            (&entry, DBUS_TYPE_STRING, &e_connman_prop_gateway);
1205         dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &gateway);
1206         dbus_message_iter_close_container(&dict, &entry);
1207      }
1208
1209    dbus_message_iter_close_container(&variant, &dict);
1210    dbus_message_iter_close_container(&itr, &variant);
1211
1212    return e_connman_element_message_send
1213              (service, name, NULL, msg, &service->_pending.property_set, cb, data);
1214 }
1215
1216 /**
1217  * Get property "Proxy.Method" value.
1218  *
1219  * If this property isn't found then @c EINA_FALSE is returned.
1220  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1221  * values shall be considered invalid.
1222  *
1223  * Possible values are "direct", "auto" and "manual".
1224  *
1225  * @param service path to get property.
1226  * @param method where to store the property value, must be a pointer
1227  *        to string (const char **), it will not be allocated or
1228  *        copied and references will be valid until element changes,
1229  *        so copy it if you want to use it later.
1230  *
1231  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1232  */
1233 Eina_Bool
1234 e_connman_service_proxy_method_get(const E_Connman_Element *service, const char **method)
1235 {
1236    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1237    EINA_SAFETY_ON_NULL_RETURN_VAL(method, EINA_FALSE);
1238    return e_connman_element_property_dict_get_stringshared
1239              (service, e_connman_prop_proxy, e_connman_prop_method, NULL, method);
1240 }
1241
1242 /**
1243  * Get property "Proxy.URL" value.
1244  *
1245  * If this property isn't found then @c EINA_FALSE is returned.
1246  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1247  * values shall be considered invalid.
1248  *
1249  * Automatic proxy configuration URL. Used by "auto" method.
1250  *
1251  * @param service path to get property.
1252  * @param url where to store the property value, must be a pointer
1253  *        to string (const char **), it will not be allocated or
1254  *        copied and references will be valid until element changes,
1255  *        so copy it if you want to use it later.
1256  *
1257  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1258  */
1259 Eina_Bool
1260 e_connman_service_proxy_url_get(const E_Connman_Element *service, const char **url)
1261 {
1262    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1263    EINA_SAFETY_ON_NULL_RETURN_VAL(url, EINA_FALSE);
1264    return e_connman_element_property_dict_get_stringshared
1265              (service, e_connman_prop_proxy, e_connman_prop_url, NULL, url);
1266 }
1267
1268 /**
1269  * Get property "Proxy.Servers" value.
1270  *
1271  * If this property isn't found then @c EINA_FALSE is returned.
1272  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1273  * values shall be considered invalid.
1274  *
1275  * List of proxy URIs. The URI without a protocol will be interpreted as the
1276  * generic proxy URI. All others will target a specific protocol and only once.
1277  * Example of generic proxy server entry would be like this:
1278  * "server.example.com:911".
1279  *
1280  * Used when "manual" method is set.
1281  *
1282  * @param service path to get property.
1283  * @param count return the number of elements in array.
1284  * @param servers array with pointers to internal strings. These
1285  *        strings are not copied in any way, and they are granted to
1286  *        be eina_stringshare instances, so one can use
1287  *        eina_stringshare_ref() if he wants to save memory and cpu to
1288  *        get an extra reference. The array itself is also NOT
1289  *        allocated or copied, do not modify it. This pointer is just
1290  *        set if return is @c EINA_TRUE.
1291  *
1292  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1293  */
1294 Eina_Bool
1295 e_connman_service_proxy_servers_get(const E_Connman_Element *service, unsigned int *count, const char ***servers)
1296 {
1297    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1298    EINA_SAFETY_ON_NULL_RETURN_VAL(servers, EINA_FALSE);
1299    EINA_SAFETY_ON_NULL_RETURN_VAL(count, EINA_FALSE);
1300    return e_connman_element_property_dict_strings_array_get_stringshared
1301              (service, e_connman_prop_proxy, e_connman_prop_servers, count, servers);
1302 }
1303
1304 /**
1305  * Get property "Proxy.Excludes" value.
1306  *
1307  * If this property isn't found then @c EINA_FALSE is returned.
1308  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1309  * values shall be considered invalid.
1310  *
1311  * List of hosts which can be accessed directly.
1312  *
1313  * Used when "manual" method is set.
1314  *
1315  * @param service path to get property.
1316  * @param count return the number of elements in array.
1317  * @param excludes array with pointers to internal strings. These
1318  *        strings are not copied in any way, and they are granted to
1319  *        be eina_stringshare instances, so one can use
1320  *        eina_stringshare_ref() if he wants to save memory and cpu to
1321  *        get an extra reference. The array itself is also NOT
1322  *        allocated or copied, do not modify it. This pointer is just
1323  *        set if return is @c EINA_TRUE.
1324  *
1325  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1326  */
1327 Eina_Bool
1328 e_connman_service_proxy_excludes_get(const E_Connman_Element *service, unsigned int *count, const char ***excludes)
1329 {
1330    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1331    EINA_SAFETY_ON_NULL_RETURN_VAL(excludes, EINA_FALSE);
1332    EINA_SAFETY_ON_NULL_RETURN_VAL(count, EINA_FALSE);
1333    return e_connman_element_property_dict_strings_array_get_stringshared
1334              (service, e_connman_prop_proxy, e_connman_prop_excludes, count, excludes);
1335 }
1336
1337 /**
1338  * Get property "Proxy.Configuration.Method" value.
1339  *
1340  * Unlike Proxy.Configuration.Method, this is the user-set value, rather than
1341  * the actual value.
1342  *
1343  * If this property isn't found then @c EINA_FALSE is returned.
1344  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1345  * values shall be considered invalid.
1346  *
1347  * Possible values are "direct", "auto" and "manual".
1348  *
1349  * @param service path to get property.
1350  * @param method where to store the property value, must be a pointer
1351  *        to string (const char **), it will not be allocated or
1352  *        copied and references will be valid until element changes,
1353  *        so copy it if you want to use it later.
1354  *
1355  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1356  */
1357 Eina_Bool
1358 e_connman_service_proxy_configuration_method_get(const E_Connman_Element *service, const char **method)
1359 {
1360    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1361    EINA_SAFETY_ON_NULL_RETURN_VAL(method, EINA_FALSE);
1362    return e_connman_element_property_dict_get_stringshared
1363              (service, e_connman_prop_proxy_configuration, e_connman_prop_method, NULL, method);
1364 }
1365
1366 /**
1367  * Get property "Proxy.Configuration.URL" value.
1368  *
1369  * Unlike Proxy.URL, this is the user-set value, rather than the
1370  * actual value.
1371  *
1372  * If this property isn't found then @c EINA_FALSE is returned.
1373  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1374  * values shall be considered invalid.
1375  *
1376  * Automatic proxy configuration URL. Used by "auto" method.
1377  *
1378  * @param service path to get property.
1379  * @param url where to store the property value, must be a pointer
1380  *        to string (const char **), it will not be allocated or
1381  *        copied and references will be valid until element changes,
1382  *        so copy it if you want to use it later.
1383  *
1384  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1385  */
1386 Eina_Bool
1387 e_connman_service_proxy_configuration_url_get(const E_Connman_Element *service, const char **url)
1388 {
1389    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1390    EINA_SAFETY_ON_NULL_RETURN_VAL(url, EINA_FALSE);
1391    return e_connman_element_property_dict_get_stringshared
1392              (service, e_connman_prop_proxy_configuration, e_connman_prop_url, NULL, url);
1393 }
1394
1395 /**
1396  * Get property "Proxy.Configuration.Servers" value.
1397  *
1398  * Unlike Proxy.Servers, this is the user-set value, rather than the
1399  * actual value.
1400  *
1401  * If this property isn't found then @c EINA_FALSE is returned.
1402  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1403  * values shall be considered invalid.
1404  *
1405  * List of proxy URIs. The URI without a protocol will be interpreted as the
1406  * generic proxy URI. All others will target a specific protocol and only once.
1407  * Example of generic proxy server entry would be like this:
1408  * "server.example.com:911".
1409  *
1410  * Used when "manual" method is set.
1411  *
1412  * @param service path to get property.
1413  * @param count return the number of elements in array.
1414  * @param servers array with pointers to internal strings. These
1415  *        strings are not copied in any way, and they are granted to
1416  *        be eina_stringshare instances, so one can use
1417  *        eina_stringshare_ref() if he wants to save memory and cpu to
1418  *        get an extra reference. The array itself is also NOT
1419  *        allocated or copied, do not modify it. This pointer is just
1420  *        set if return is @c EINA_TRUE.
1421  *
1422  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1423  */
1424 Eina_Bool
1425 e_connman_service_proxy_configuration_servers_get(const E_Connman_Element *service, unsigned int *count, const char ***servers)
1426 {
1427    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1428    EINA_SAFETY_ON_NULL_RETURN_VAL(servers, EINA_FALSE);
1429    EINA_SAFETY_ON_NULL_RETURN_VAL(count, EINA_FALSE);
1430    return e_connman_element_property_dict_strings_array_get_stringshared
1431              (service, e_connman_prop_proxy_configuration, e_connman_prop_servers, count, servers);
1432 }
1433
1434 /**
1435  * Get property "Proxy.Configuration.Excludes" value.
1436  *
1437  * Unlike Proxy.Excludes, this is the user-set value, rather than the
1438  * actual value.
1439
1440  * If this property isn't found then @c EINA_FALSE is returned.
1441  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1442  * values shall be considered invalid.
1443  *
1444  * List of hosts which can be accessed directly.
1445  *
1446  * Used when "manual" method is set.
1447  *
1448  * @param service path to get property.
1449  * @param count return the number of elements in array.
1450  * @param excludes array with pointers to internal strings. These
1451  *        strings are not copied in any way, and they are granted to
1452  *        be eina_stringshare instances, so one can use
1453  *        eina_stringshare_ref() if he wants to save memory and cpu to
1454  *        get an extra reference. The array itself is also NOT
1455  *        allocated or copied, do not modify it. This pointer is just
1456  *        set if return is @c EINA_TRUE.
1457  *
1458  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1459  */
1460 Eina_Bool
1461 e_connman_service_proxy_configuration_excludes_get(const E_Connman_Element *service, unsigned int *count, const char ***excludes)
1462 {
1463    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1464    EINA_SAFETY_ON_NULL_RETURN_VAL(excludes, EINA_FALSE);
1465    EINA_SAFETY_ON_NULL_RETURN_VAL(count, EINA_FALSE);
1466    return e_connman_element_property_dict_strings_array_get_stringshared
1467              (service, e_connman_prop_proxy_configuration, e_connman_prop_excludes, count, excludes);
1468 }
1469
1470 /**
1471  * Get property "Ethernet.Interface" value.
1472  *
1473  * If this property isn't found then @c EINA_FALSE is returned.
1474  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1475  * values shall be considered invalid.
1476  *
1477  * Interface name (for example eth0).
1478  *
1479  * @param service path to get property.
1480  * @param iface where to store the property value, must be a pointer
1481  *        to string (const char **), it will not be allocated or
1482  *        copied and references will be valid until element changes,
1483  *        so copy it if you want to use it later.
1484  *
1485  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1486  */
1487 Eina_Bool
1488 e_connman_service_ethernet_interface_get(const E_Connman_Element *service, const char **iface)
1489 {
1490    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1491    EINA_SAFETY_ON_NULL_RETURN_VAL(iface, EINA_FALSE);
1492    return e_connman_element_property_dict_get_stringshared
1493              (service, e_connman_prop_ethernet, e_connman_prop_interface, NULL, iface);
1494 }
1495
1496 /**
1497  * Get property "Ethernet.Method" value.
1498  *
1499  * If this property isn't found then @c EINA_FALSE is returned.
1500  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1501  * values shall be considered invalid.
1502  *
1503  * The Ethernet configuration method. Possible values here "auto" and "manual".
1504  *
1505  * @param service path to get property.
1506  * @param method where to store the property value, must be a pointer
1507  *        to string (const char **), it will not be allocated or
1508  *        copied and references will be valid until element changes,
1509  *        so copy it if you want to use it later.
1510  *
1511  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1512  */
1513 Eina_Bool
1514 e_connman_service_ethernet_method_get(const E_Connman_Element *service, const char **method)
1515 {
1516    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1517    EINA_SAFETY_ON_NULL_RETURN_VAL(method, EINA_FALSE);
1518    return e_connman_element_property_dict_get_stringshared
1519              (service, e_connman_prop_ethernet, e_connman_prop_method, NULL, method);
1520 }
1521
1522 /**
1523  * Get property "Ethernet.Speed" value.
1524  *
1525  * If this property isn't found then @c EINA_FALSE is returned.
1526  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1527  * values shall be considered invalid.
1528  *
1529  * Selected speed of the line. This information might not always be available.
1530  *
1531  * @param service path to get property.
1532  * @param speed where to store the property value.
1533  *
1534  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1535  */
1536 Eina_Bool
1537 e_connman_service_ethernet_speed_get(const E_Connman_Element *service, unsigned short *speed)
1538 {
1539    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1540    EINA_SAFETY_ON_NULL_RETURN_VAL(speed, EINA_FALSE);
1541    return e_connman_element_property_dict_get_stringshared
1542              (service, e_connman_prop_ethernet, e_connman_prop_speed, NULL, speed);
1543 }
1544
1545 /**
1546  * Get property "Ethernet.Address" value.
1547  *
1548  * If this property isn't found then @c EINA_FALSE is returned.
1549  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1550  * values shall be considered invalid.
1551  *
1552  * The current configured Ethernet address (mac-address).
1553  *
1554  * @param service path to get property.
1555  * @param address where to store the property value, must be a pointer
1556  *        to string (const char **), it will not be allocated or
1557  *        copied and references will be valid until element changes,
1558  *        so copy it if you want to use it later.
1559  *
1560  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1561  */
1562 Eina_Bool
1563 e_connman_service_ethernet_address_get(const E_Connman_Element *service, const char **address)
1564 {
1565    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1566    EINA_SAFETY_ON_NULL_RETURN_VAL(address, EINA_FALSE);
1567    return e_connman_element_property_dict_get_stringshared
1568              (service, e_connman_prop_ethernet, e_connman_prop_address, NULL, address);
1569 }
1570
1571 /**
1572  * Get property "Ethernet.Duplex" value.
1573  *
1574  * If this property isn't found then @c EINA_FALSE is returned.
1575  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1576  * values shall be considered invalid.
1577  *
1578  * Selected duplex settings of the line. Possible values are "half" and "full".
1579  * This information might not always be available.
1580  *
1581  * @param service path to get property.
1582  * @param duplex where to store the property value, must be a pointer
1583  *        to string (const char **), it will not be allocated or
1584  *        copied and references will be valid until element changes,
1585  *        so copy it if you want to use it later.
1586  *
1587  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1588  */
1589 Eina_Bool
1590 e_connman_service_ethernet_duplex_get(const E_Connman_Element *service, const char **duplex)
1591 {
1592    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1593    EINA_SAFETY_ON_NULL_RETURN_VAL(duplex, EINA_FALSE);
1594    return e_connman_element_property_dict_get_stringshared
1595              (service, e_connman_prop_ethernet, e_connman_prop_duplex, NULL, duplex);
1596 }
1597
1598 /**
1599  * Get property "Ethernet.MTU" value.
1600  *
1601  * If this property isn't found then @c EINA_FALSE is returned.
1602  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1603  * values shall be considered invalid.
1604  *
1605  * The current configured Ethernet MTU.
1606  *
1607  * @param service path to get property.
1608  * @param gateway where to store the property value, must be a pointer
1609  *        to string (const char **), it will not be allocated or
1610  *        copied and references will be valid until element changes,
1611  *        so copy it if you want to use it later.
1612  *
1613  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1614  */
1615 Eina_Bool
1616 e_connman_service_ethernet_mtu_get(const E_Connman_Element *service, unsigned short *mtu)
1617 {
1618    EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1619    EINA_SAFETY_ON_NULL_RETURN_VAL(mtu, EINA_FALSE);
1620    return e_connman_element_property_dict_get_stringshared
1621              (service, e_connman_prop_ethernet, e_connman_prop_mtu, NULL, mtu);
1622 }