On device reboot enable wpa-supplicant for EAPoL.
[platform/upstream/connman.git] / src / connman.h
1 /*
2  *
3  *  Connection Manager
4  *
5  *  Copyright (C) 2007-2014  Intel Corporation. All rights reserved.
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License version 2 as
9  *  published by the Free Software Foundation.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  *
20  */
21
22 #include <stdbool.h>
23
24 #include <glib.h>
25
26 #define CONNMAN_API_SUBJECT_TO_CHANGE
27 #if defined TIZEN_EXT
28 #define WIFI_COUNTRY_CODE_LEN 2
29 #define WIFI_PHY_MODE_LEN 18
30 #define GIO_SOCKET_RETRY_COUNT 3
31 #endif
32
33 #include <connman/dbus.h>
34
35 dbus_bool_t __connman_dbus_append_objpath_dict_array(DBusMessage *msg,
36                         connman_dbus_append_cb_t function, void *user_data);
37 dbus_bool_t __connman_dbus_append_objpath_array(DBusMessage *msg,
38                         connman_dbus_append_cb_t function, void *user_data);
39 int __connman_dbus_init(DBusConnection *conn);
40 void __connman_dbus_cleanup(void);
41
42 DBusMessage *__connman_error_failed(DBusMessage *msg, int errnum);
43 DBusMessage *__connman_error_invalid_arguments(DBusMessage *msg);
44 DBusMessage *__connman_error_permission_denied(DBusMessage *msg);
45 DBusMessage *__connman_error_passphrase_required(DBusMessage *msg);
46 DBusMessage *__connman_error_not_registered(DBusMessage *msg);
47 DBusMessage *__connman_error_not_unique(DBusMessage *msg);
48 DBusMessage *__connman_error_not_supported(DBusMessage *msg);
49 DBusMessage *__connman_error_not_implemented(DBusMessage *msg);
50 DBusMessage *__connman_error_not_found(DBusMessage *msg);
51 DBusMessage *__connman_error_no_carrier(DBusMessage *msg);
52 DBusMessage *__connman_error_in_progress(DBusMessage *msg);
53 DBusMessage *__connman_error_already_exists(DBusMessage *msg);
54 DBusMessage *__connman_error_already_enabled(DBusMessage *msg);
55 DBusMessage *__connman_error_already_disabled(DBusMessage *msg);
56 DBusMessage *__connman_error_already_connected(DBusMessage *msg);
57 DBusMessage *__connman_error_not_connected(DBusMessage *msg);
58 DBusMessage *__connman_error_operation_aborted(DBusMessage *msg);
59 DBusMessage *__connman_error_operation_timeout(DBusMessage *msg);
60 DBusMessage *__connman_error_invalid_service(DBusMessage *msg);
61 DBusMessage *__connman_error_invalid_property(DBusMessage *msg);
62 #if defined TIZEN_EXT_WIFI_MESH
63 DBusMessage *__connman_error_invalid_command(DBusMessage *msg);
64 DBusMessage *__connman_error_scan_abort_failed(DBusMessage *msg);
65 #endif
66 DBusMessage *__connman_error_operation_canceled(DBusMessage *msg);
67
68 int __connman_manager_init(void);
69 void __connman_manager_cleanup(void);
70
71 enum time_updates {
72         TIME_UPDATES_UNKNOWN = 0,
73         TIME_UPDATES_MANUAL  = 1,
74         TIME_UPDATES_AUTO    = 2,
75 };
76
77 enum time_updates __connman_clock_timeupdates(void);
78 int __connman_clock_init(void);
79 void __connman_clock_cleanup(void);
80
81 void __connman_clock_update_timezone(void);
82
83 int __connman_timezone_init(void);
84 void __connman_timezone_cleanup(void);
85
86 char *__connman_timezone_lookup(void);
87 int __connman_timezone_change(const char *zone);
88
89 int __connman_agent_init(void);
90 void __connman_agent_cleanup(void);
91
92 void __connman_counter_send_usage(const char *path,
93                                         DBusMessage *message);
94 int __connman_counter_register(const char *owner, const char *path,
95                                                 unsigned int interval);
96 int __connman_counter_unregister(const char *owner, const char *path);
97
98 int __connman_counter_init(void);
99 void __connman_counter_cleanup(void);
100
101 #include <connman/agent.h>
102
103 struct connman_service;
104 struct connman_peer;
105
106 void __connman_agent_cancel(struct connman_service *service);
107
108 typedef void (* authentication_cb_t) (struct connman_service *service,
109                                 bool values_received,
110                                 const char *name, int name_len,
111                                 const char *identifier, const char *secret,
112                                 bool wps, const char *wpspin,
113                                 const char *error, void *user_data);
114 typedef void (* browser_authentication_cb_t) (struct connman_service *service,
115                                 bool authentication_done,
116                                 const char *error, void *user_data);
117 typedef void (* peer_wps_cb_t) (struct connman_peer *peer, bool choice_done,
118                                 const char *wpspin, const char *error,
119                                 void *user_data);
120 int __connman_agent_request_passphrase_input(struct connman_service *service,
121                                 authentication_cb_t callback,
122                                 const char *dbus_sender, void *user_data);
123 int __connman_agent_request_login_input(struct connman_service *service,
124                                 authentication_cb_t callback, void *user_data);
125 int __connman_agent_request_browser(struct connman_service *service,
126                                 browser_authentication_cb_t callback,
127                                 const char *url, void *user_data);
128 int __connman_agent_report_peer_error(struct connman_peer *peer,
129                                         const char *path, const char *error,
130                                         report_error_cb_t callback,
131                                         const char *dbus_sender,
132                                         void *user_data);
133 int __connman_agent_request_peer_authorization(struct connman_peer *peer,
134                                                 peer_wps_cb_t callback,
135                                                 bool wps_requested,
136                                                 const char *dbus_sender,
137                                                 void *user_data);
138
139 #include <connman/log.h>
140
141 int __connman_log_init(const char *program, const char *debug,
142                 gboolean detach, gboolean backtrace,
143                 const char *program_name, const char *program_version);
144 void __connman_log_cleanup(gboolean backtrace);
145 void __connman_log_enable(struct connman_debug_desc *start,
146                                         struct connman_debug_desc *stop);
147
148 #include <connman/backtrace.h>
149
150 #include <connman/option.h>
151
152 #include <connman/setting.h>
153
154 #include <connman/plugin.h>
155
156 int __connman_plugin_init(const char *pattern, const char *exclude);
157 void __connman_plugin_cleanup(void);
158
159 #include <connman/task.h>
160
161 int __connman_task_init(void);
162 void __connman_task_cleanup(void);
163
164 #include <connman/inet.h>
165
166 char **__connman_inet_get_running_interfaces(void);
167 int __connman_inet_modify_address(int cmd, int flags, int index, int family,
168                                 const char *address,
169                                 const char *peer,
170                                 unsigned char prefixlen,
171                                 const char *broadcast);
172 int __connman_inet_get_interface_address(int index, int family, void *address);
173 int __connman_inet_get_interface_ll_address(int index, int family, void *address);
174 int __connman_inet_get_interface_mac_address(int index, uint8_t *mac_address);
175
176 bool __connman_inet_is_any_addr(const char *address, int family);
177
178 #include <netinet/ip6.h>
179 #include <netinet/icmp6.h>
180
181 typedef void (*__connman_inet_rs_cb_t) (struct nd_router_advert *reply,
182                                         unsigned int length, void *user_data);
183
184 int __connman_inet_ipv6_send_rs(int index, int timeout,
185                         __connman_inet_rs_cb_t callback, void *user_data);
186 int __connman_inet_ipv6_send_ra(int index, struct in6_addr *src_addr,
187                                 GSList *prefixes, int router_lifetime);
188 #if defined TIZEN_EXT
189 void __connman_network_set_auto_ipv6_gateway(char *gateway, void *user_data);
190 #endif
191
192 typedef void (*__connman_inet_ns_cb_t) (struct nd_neighbor_advert *reply,
193                                         unsigned int length,
194                                         struct in6_addr *addr,
195                                         void *user_data);
196 int __connman_inet_ipv6_do_dad(int index, int timeout_ms,
197                         struct in6_addr *addr,
198                         __connman_inet_ns_cb_t callback, void *user_data);
199
200 typedef void (*__connman_inet_recv_rs_cb_t) (struct nd_router_solicit *reply,
201                                         unsigned int length, void *user_data);
202 int __connman_inet_ipv6_start_recv_rs(int index,
203                                 __connman_inet_recv_rs_cb_t callback,
204                                 void *user_data, void **context);
205 void __connman_inet_ipv6_stop_recv_rs(void *context);
206
207 int __connman_network_refresh_rs_ipv6(struct connman_network *network, int index);
208
209 GSList *__connman_inet_ipv6_get_prefixes(struct nd_router_advert *hdr,
210                                         unsigned int length);
211 typedef void (*connman_inet_addr_cb_t) (const char *src_address, int index,
212                                         void *user_data);
213 int __connman_inet_get_route(const char *dst_address,
214                         connman_inet_addr_cb_t callback, void *user_data);
215
216 struct __connman_inet_rtnl_handle {
217         int                     fd;
218         struct sockaddr_nl      local;
219         struct sockaddr_nl      peer;
220         __u32                   seq;
221         __u32                   dump;
222
223         struct {
224                 struct nlmsghdr n;
225                 union {
226                         struct {
227                                 struct rtmsg rt;
228                         } r;
229                         struct {
230                                 struct ifaddrmsg ifa;
231                         } i;
232                 } u;
233                 char buf[1024];
234         } req;
235 };
236
237 int __connman_inet_rtnl_open(struct __connman_inet_rtnl_handle *rth);
238 typedef void (*__connman_inet_rtnl_cb_t) (struct nlmsghdr *answer,
239                                         void *user_data);
240 int __connman_inet_rtnl_talk(struct __connman_inet_rtnl_handle *rtnl,
241                         struct nlmsghdr *n, int timeout,
242                         __connman_inet_rtnl_cb_t callback, void *user_data);
243 static inline
244 int __connman_inet_rtnl_send(struct __connman_inet_rtnl_handle *rtnl,
245                                                 struct nlmsghdr *n)
246 {
247         return __connman_inet_rtnl_talk(rtnl, n, 0, NULL, NULL);
248 }
249
250 void __connman_inet_rtnl_close(struct __connman_inet_rtnl_handle *rth);
251 int __connman_inet_rtnl_addattr_l(struct nlmsghdr *n, size_t max_length,
252                         int type, const void *data, size_t data_length);
253 int __connman_inet_rtnl_addattr32(struct nlmsghdr *n, size_t maxlen,
254                         int type, __u32 data);
255
256 int __connman_inet_add_fwmark_rule(uint32_t table_id, int family, uint32_t fwmark);
257 int __connman_inet_del_fwmark_rule(uint32_t table_id, int family, uint32_t fwmark);
258 int __connman_inet_add_default_to_table(uint32_t table_id, int ifindex, const char *gateway);
259 int __connman_inet_add_subnet_to_table(uint32_t table_id, int ifindex,
260                         const char *gateway, unsigned char prefixlen);
261 int __connman_inet_del_default_from_table(uint32_t table_id, int ifindex, const char *gateway);
262 int __connman_inet_del_subnet_from_table(uint32_t table_id, int ifindex,
263                         const char *gateway, unsigned char prefixlen);
264 int __connman_inet_get_address_netmask(int ifindex,
265                 struct sockaddr_in *address, struct sockaddr_in *netmask);
266
267 bool __connman_inet_isrootnfs_device(const char *devname);
268 char **__connman_inet_get_pnp_nameservers(const char *pnp_file);
269
270 #include <connman/resolver.h>
271
272 int __connman_resolver_init(gboolean dnsproxy);
273 void __connman_resolver_cleanup(void);
274 void __connman_resolver_append_fallback_nameservers(void);
275 int __connman_resolvfile_append(int index, const char *domain, const char *server);
276 int __connman_resolvfile_remove(int index, const char *domain, const char *server);
277 int __connman_resolver_redo_servers(int index);
278 int __connman_resolver_set_mdns(int index, bool enabled);
279
280 GKeyFile *__connman_storage_open_global(void);
281 GKeyFile *__connman_storage_load_global(void);
282 int __connman_storage_save_global(GKeyFile *keyfile);
283 void __connman_storage_delete_global(void);
284 #if defined TIZEN_EXT
285 GKeyFile *__connman_storage_load_ins(void);
286 int __connman_storage_save_ins(GKeyFile *keyfile);
287 #endif
288
289 GKeyFile *__connman_storage_load_config(const char *ident);
290 GKeyFile *__connman_storage_load_provider_config(const char *ident);
291
292 int __connman_storage_save_service(GKeyFile *keyfile, const char *ident);
293 GKeyFile *__connman_storage_load_provider(const char *identifier);
294 void __connman_storage_save_provider(GKeyFile *keyfile, const char *identifier);
295 bool __connman_storage_remove_provider(const char *identifier);
296 char **__connman_storage_get_providers(void);
297 bool __connman_storage_remove_service(const char *service_id);
298
299 int __connman_detect_init(void);
300 void __connman_detect_cleanup(void);
301
302 #include <connman/inotify.h>
303
304 int __connman_inotify_init(void);
305 void __connman_inotify_cleanup(void);
306
307 #include <connman/proxy.h>
308
309 int __connman_proxy_init(void);
310 void __connman_proxy_cleanup(void);
311
312 #include <connman/ipconfig.h>
313
314 struct connman_ipaddress {
315         int family;
316         unsigned char prefixlen;
317         char *local;
318         char *peer;
319         char *broadcast;
320         char *gateway;
321 };
322
323 struct connman_ipconfig_ops {
324         void (*up) (struct connman_ipconfig *ipconfig, const char *ifname);
325         void (*down) (struct connman_ipconfig *ipconfig, const char *ifname);
326         void (*lower_up) (struct connman_ipconfig *ipconfig, const char *ifname);
327         void (*lower_down) (struct connman_ipconfig *ipconfig, const char *ifname);
328         void (*ip_bound) (struct connman_ipconfig *ipconfig, const char *ifname);
329         void (*ip_release) (struct connman_ipconfig *ipconfig, const char *ifname);
330         void (*route_set) (struct connman_ipconfig *ipconfig, const char *ifname);
331         void (*route_unset) (struct connman_ipconfig *ipconfig, const char *ifname);
332 };
333
334 struct connman_ipconfig *__connman_ipconfig_create(int index,
335                                         enum connman_ipconfig_type type);
336
337 #define __connman_ipconfig_ref(ipconfig) \
338         __connman_ipconfig_ref_debug(ipconfig, __FILE__, __LINE__, __func__)
339 #define __connman_ipconfig_unref(ipconfig) \
340         __connman_ipconfig_unref_debug(ipconfig, __FILE__, __LINE__, __func__)
341
342 struct connman_ipconfig *
343 __connman_ipconfig_ref_debug(struct connman_ipconfig *ipconfig,
344                         const char *file, int line, const char *caller);
345 void __connman_ipconfig_unref_debug(struct connman_ipconfig *ipconfig,
346                         const char *file, int line, const char *caller);
347
348 void *__connman_ipconfig_get_data(struct connman_ipconfig *ipconfig);
349 void __connman_ipconfig_set_data(struct connman_ipconfig *ipconfig, void *data);
350
351 int __connman_ipconfig_get_index(struct connman_ipconfig *ipconfig);
352
353 void __connman_ipconfig_set_ops(struct connman_ipconfig *ipconfig,
354                                 const struct connman_ipconfig_ops *ops);
355 int __connman_ipconfig_set_method(struct connman_ipconfig *ipconfig,
356                                         enum connman_ipconfig_method method);
357 void __connman_ipconfig_disable_ipv6(struct connman_ipconfig *ipconfig);
358 void __connman_ipconfig_enable_ipv6(struct connman_ipconfig *ipconfig);
359
360 int __connman_ipconfig_init(void);
361 void __connman_ipconfig_cleanup(void);
362
363 struct rtnl_link_stats;
364
365 void __connman_ipconfig_newlink(int index, unsigned short type,
366                                 unsigned int flags, const char *address,
367                                                         unsigned short mtu,
368                                                 struct rtnl_link_stats *stats);
369 void __connman_ipconfig_dellink(int index, struct rtnl_link_stats *stats);
370 int __connman_ipconfig_newaddr(int index, int family, const char *label,
371                                 unsigned char prefixlen, const char *address);
372 void __connman_ipconfig_deladdr(int index, int family, const char *label,
373                                 unsigned char prefixlen, const char *address);
374 void __connman_ipconfig_newroute(int index, int family, unsigned char scope,
375                                         const char *dst, const char *gateway);
376 void __connman_ipconfig_delroute(int index, int family, unsigned char scope,
377                                         const char *dst, const char *gateway);
378
379 void __connman_ipconfig_foreach(void (*function) (int index, void *user_data),
380                                                         void *user_data);
381 enum connman_ipconfig_type __connman_ipconfig_get_config_type(
382                                         struct connman_ipconfig *ipconfig);
383 unsigned short __connman_ipconfig_get_type_from_index(int index);
384 unsigned int __connman_ipconfig_get_flags_from_index(int index);
385 const char *__connman_ipconfig_get_gateway_from_index(int index,
386         enum connman_ipconfig_type type);
387 void __connman_ipconfig_set_index(struct connman_ipconfig *ipconfig, int index);
388
389 const char *__connman_ipconfig_get_local(struct connman_ipconfig *ipconfig);
390 void __connman_ipconfig_set_local(struct connman_ipconfig *ipconfig, const char *address);
391 const char *__connman_ipconfig_get_peer(struct connman_ipconfig *ipconfig);
392 void __connman_ipconfig_set_peer(struct connman_ipconfig *ipconfig, const char *address);
393 const char *__connman_ipconfig_get_broadcast(struct connman_ipconfig *ipconfig);
394 void __connman_ipconfig_set_broadcast(struct connman_ipconfig *ipconfig, const char *broadcast);
395 const char *__connman_ipconfig_get_gateway(struct connman_ipconfig *ipconfig);
396 void __connman_ipconfig_set_gateway(struct connman_ipconfig *ipconfig, const char *gateway);
397
398 #if defined TIZEN_EXT
399 void __connman_ipconfig_set_dhcp_lease_duration(struct connman_ipconfig *ipconfig, int dhcp_lease_duration);
400 #endif
401
402 unsigned char __connman_ipconfig_get_prefixlen(struct connman_ipconfig *ipconfig);
403 void __connman_ipconfig_set_prefixlen(struct connman_ipconfig *ipconfig, unsigned char prefixlen);
404
405 int __connman_ipconfig_enable(struct connman_ipconfig *ipconfig);
406 int __connman_ipconfig_disable(struct connman_ipconfig *ipconfig);
407 bool __connman_ipconfig_is_usable(struct connman_ipconfig *ipconfig);
408
409 const char *__connman_ipconfig_method2string(enum connman_ipconfig_method method);
410 const char *__connman_ipconfig_type2string(enum connman_ipconfig_type type);
411 enum connman_ipconfig_method __connman_ipconfig_string2method(const char *method);
412
413 void __connman_ipconfig_append_ipv4(struct connman_ipconfig *ipconfig,
414                                                         DBusMessageIter *iter);
415 void __connman_ipconfig_append_ipv4config(struct connman_ipconfig *ipconfig,
416                                                         DBusMessageIter *iter);
417 void __connman_ipconfig_append_ipv6(struct connman_ipconfig *ipconfig,
418                                         DBusMessageIter *iter,
419                                         struct connman_ipconfig *ip4config);
420 void __connman_ipconfig_append_ipv6config(struct connman_ipconfig *ipconfig,
421                                                         DBusMessageIter *iter);
422 int __connman_ipconfig_set_config(struct connman_ipconfig *ipconfig,
423                                                         DBusMessageIter *array);
424 void __connman_ipconfig_append_ethernet(struct connman_ipconfig *ipconfig,
425                                                         DBusMessageIter *iter);
426 enum connman_ipconfig_method __connman_ipconfig_get_method(
427                                 struct connman_ipconfig *ipconfig);
428
429 int __connman_ipconfig_address_add(struct connman_ipconfig *ipconfig);
430 int __connman_ipconfig_address_remove(struct connman_ipconfig *ipconfig);
431 int __connman_ipconfig_address_unset(struct connman_ipconfig *ipconfig);
432 #if defined TIZEN_EXT
433 /*
434  * Description: __connman_service_lookup_from_index cannot find correct service
435  *              e.g. same interface or same APN of cellular profile
436  */
437 int __connman_ipconfig_gateway_add(struct connman_ipconfig *ipconfig, struct connman_service *service);
438 #else
439 int __connman_ipconfig_gateway_add(struct connman_ipconfig *ipconfig);
440 #endif
441 void __connman_ipconfig_gateway_remove(struct connman_ipconfig *ipconfig);
442
443 int __connman_ipconfig_set_proxy_autoconfig(struct connman_ipconfig *ipconfig,
444                                                         const char *url);
445 const char *__connman_ipconfig_get_proxy_autoconfig(struct connman_ipconfig *ipconfig);
446 void __connman_ipconfig_set_dhcp_address(struct connman_ipconfig *ipconfig,
447                                         const char *address);
448 char *__connman_ipconfig_get_dhcp_address(struct connman_ipconfig *ipconfig);
449 void __connman_ipconfig_set_dhcpv6_prefixes(struct connman_ipconfig *ipconfig,
450                                         char **prefixes);
451 char **__connman_ipconfig_get_dhcpv6_prefixes(struct connman_ipconfig *ipconfig);
452
453 void __connman_ipconfig_load(struct connman_ipconfig *ipconfig,
454                 GKeyFile *keyfile, const char *identifier, const char *prefix);
455 void __connman_ipconfig_save(struct connman_ipconfig *ipconfig,
456                 GKeyFile *keyfile, const char *identifier, const char *prefix);
457 bool __connman_ipconfig_ipv6_privacy_enabled(struct connman_ipconfig *ipconfig);
458 int __connman_ipconfig_ipv6_reset_privacy(struct connman_ipconfig *ipconfig);
459 int __connman_ipconfig_ipv6_set_privacy(struct connman_ipconfig *ipconfig,
460                                         const char *value);
461 bool __connman_ipconfig_ipv6_is_enabled(struct connman_ipconfig *ipconfig);
462
463 int __connman_ipconfig_set_rp_filter();
464 void __connman_ipconfig_unset_rp_filter(int old_value);
465
466 #include <connman/utsname.h>
467
468 int __connman_utsname_set_hostname(const char *hostname);
469 int __connman_utsname_set_domainname(const char *domainname);
470
471 #include <connman/timeserver.h>
472
473 int __connman_timeserver_init(void);
474 void __connman_timeserver_cleanup(void);
475
476 char **__connman_timeserver_system_get();
477
478 GSList *__connman_timeserver_add_list(GSList *server_list,
479                 const char *timeserver);
480 GSList *__connman_timeserver_get_all(struct connman_service *service);
481 int __connman_timeserver_sync(struct connman_service *service);
482
483 enum __connman_dhcpv6_status {
484         CONNMAN_DHCPV6_STATUS_FAIL     = 0,
485         CONNMAN_DHCPV6_STATUS_SUCCEED  = 1,
486         CONNMAN_DHCPV6_STATUS_RESTART  = 2,
487 };
488
489 #if defined TIZEN_EXT
490 void set_dhcp_discover_timeout(int timeout_value);
491 void set_dhcp_discover_retry_count(int retry_count);
492 #endif
493
494 typedef void (* dhcpv6_cb) (struct connman_network *network,
495                         enum __connman_dhcpv6_status status, gpointer data);
496
497 typedef void (* dhcp_cb) (struct connman_ipconfig *ipconfig,
498                         struct connman_network *opt_network,
499                         bool success, gpointer data);
500 char *__connman_dhcp_get_server_address(struct connman_ipconfig *ipconfig);
501 int __connman_dhcp_start(struct connman_ipconfig *ipconfig,
502                         struct connman_network *network, dhcp_cb callback,
503                         gpointer user_data);
504 void __connman_dhcp_stop(struct connman_ipconfig *ipconfig);
505 void __connman_dhcp_decline(struct connman_ipconfig *ipconfig);
506 int __connman_dhcp_init(void);
507 void __connman_dhcp_cleanup(void);
508 int __connman_dhcpv6_init(void);
509 void __connman_dhcpv6_cleanup(void);
510 int __connman_dhcpv6_start_info(struct connman_network *network,
511                                 dhcpv6_cb callback);
512 void __connman_dhcpv6_stop(struct connman_network *network);
513 int __connman_dhcpv6_start(struct connman_network *network,
514                                 GSList *prefixes, dhcpv6_cb callback);
515 int __connman_dhcpv6_start_renew(struct connman_network *network,
516                                 dhcpv6_cb callback);
517 int __connman_dhcpv6_start_release(struct connman_network *network,
518                                 dhcpv6_cb callback);
519 int __connman_dhcpv6_start_pd(int index, GSList *prefixes, dhcpv6_cb callback);
520 void __connman_dhcpv6_stop_pd(int index);
521 int __connman_dhcpv6_start_pd_renew(struct connman_network *network,
522                                                         dhcpv6_cb callback);
523 int __connman_dhcpv6_start_pd_release(struct connman_network *network,
524                                 dhcpv6_cb callback);
525
526 int __connman_ipv4_init(void);
527 void __connman_ipv4_cleanup(void);
528
529 int __connman_connection_init(void);
530 void __connman_connection_cleanup(void);
531
532 int __connman_connection_gateway_add(struct connman_service *service,
533                                         const char *gateway,
534                                         enum connman_ipconfig_type type,
535                                         const char *peer);
536 void __connman_connection_gateway_remove(struct connman_service *service,
537                                         enum connman_ipconfig_type type);
538 int __connman_connection_get_vpn_index(int phy_index);
539
540 bool __connman_connection_update_gateway(void);
541
542 typedef void (*__connman_ntp_cb_t) (bool success, void *user_data);
543 int __connman_ntp_start(char *server, __connman_ntp_cb_t callback,
544                         void *user_data);
545 void __connman_ntp_stop();
546
547 int __connman_wpad_init(void);
548 void __connman_wpad_cleanup(void);
549 int __connman_wpad_start(struct connman_service *service);
550 void __connman_wpad_stop(struct connman_service *service);
551
552 int __connman_wispr_init(void);
553 void __connman_wispr_cleanup(void);
554 int __connman_wispr_start(struct connman_service *service,
555                                         enum connman_ipconfig_type type);
556 void __connman_wispr_stop(struct connman_service *service);
557
558 #include <connman/technology.h>
559
560 void __connman_technology_list_struct(DBusMessageIter *array);
561
562 int __connman_technology_add_device(struct connman_device *device);
563 int __connman_technology_remove_device(struct connman_device *device);
564 int __connman_technology_enabled(enum connman_service_type type);
565 int __connman_technology_disabled(enum connman_service_type type);
566 int __connman_technology_set_offlinemode(bool offlinemode);
567 bool __connman_technology_get_offlinemode(void);
568 void __connman_technology_set_connected(enum connman_service_type type,
569                                         bool connected);
570
571 int __connman_technology_add_rfkill(unsigned int index,
572                                         enum connman_service_type type,
573                                                 bool softblock,
574                                                 bool hardblock);
575 int __connman_technology_update_rfkill(unsigned int index,
576                                         enum connman_service_type type,
577                                                 bool softblock,
578                                                 bool hardblock);
579 int __connman_technology_remove_rfkill(unsigned int index,
580                                         enum connman_service_type type);
581
582 void __connman_technology_scan_started(struct connman_device *device);
583 void __connman_technology_scan_stopped(struct connman_device *device,
584                                         enum connman_service_type type);
585 void __connman_technology_add_interface(enum connman_service_type type,
586                                 int index, const char *ident);
587 void __connman_technology_remove_interface(enum connman_service_type type,
588                                 int index, const char *ident);
589 void __connman_technology_notify_regdom_by_device(struct connman_device *device,
590                                                 int result, const char *alpha2);
591
592 #if defined TIZEN_EXT
593 enum bssid_type {
594         CHECK_BSSID = 0,
595         GET_BSSID   = 1,
596         SET_BSSID   = 2,
597         RESET_BSSID = 3,
598 };
599
600 int set_connman_bssid(enum bssid_type mode, char *bssid, const char *ifname);
601 void technology_save_device(struct connman_device *device);
602 #endif
603
604 #include <connman/device.h>
605
606 int __connman_device_init(const char *device, const char *nodevice);
607 void __connman_device_cleanup(void);
608
609 void __connman_device_list(DBusMessageIter *iter, void *user_data);
610
611 enum connman_service_type __connman_device_get_service_type(struct connman_device *device);
612 struct connman_device *__connman_device_find_device(enum connman_service_type type);
613 int __connman_device_request_scan(enum connman_service_type type);
614 int __connman_device_request_scan_full(enum connman_service_type type);
615 int __connman_device_request_hidden_scan(struct connman_device *device,
616                                 const char *ssid, unsigned int ssid_len,
617                                 const char *identity, const char *passphrase,
618                                 const char *security, void *user_data);
619 void __connman_device_stop_scan(enum connman_service_type type);
620 #if defined TIZEN_EXT
621 int __connman_device_request_specific_scan(enum connman_service_type type,
622                                 const char *ifname, int scan_type, GSList *specific_scan_list);
623 int connman_device_request_device_scan(enum connman_service_type type,
624                                 const char * ifname, bool force_full_scan);
625 #endif
626
627 bool __connman_device_isfiltered(const char *devname);
628
629 void __connman_device_set_network(struct connman_device *device,
630                                         struct connman_network *network);
631 void __connman_device_cleanup_networks(struct connman_device *device);
632
633 int __connman_device_enable(struct connman_device *device);
634 int __connman_device_disable(struct connman_device *device);
635 int __connman_device_disconnect(struct connman_device *device);
636
637 bool __connman_device_has_driver(struct connman_device *device);
638
639 const char *__connman_device_get_type(struct connman_device *device);
640
641 int __connman_rfkill_init(void);
642 void __connman_rfkill_cleanup(void);
643 int __connman_rfkill_block(enum connman_service_type type, bool block);
644
645 #if defined TIZEN_EXT
646 char *index2ident(int index, const char *prefix);
647 char *index2addr(int index);
648 #endif
649
650 #include <connman/network.h>
651
652 int __connman_network_init(void);
653 void __connman_network_cleanup(void);
654
655 void __connman_network_set_device(struct connman_network *network,
656                                         struct connman_device *device);
657
658 int __connman_network_connect(struct connman_network *network);
659 int __connman_network_disconnect(struct connman_network *network);
660 int __connman_network_clear_ipconfig(struct connman_network *network,
661                                         struct connman_ipconfig *ipconfig);
662 int __connman_network_enable_ipconfig(struct connman_network *network,
663                                 struct connman_ipconfig *ipconfig);
664
665 const char *__connman_network_get_type(struct connman_network *network);
666 const char *__connman_network_get_group(struct connman_network *network);
667 const char *__connman_network_get_ident(struct connman_network *network);
668 bool __connman_network_get_weakness(struct connman_network *network);
669
670 int __connman_config_init();
671 void __connman_config_cleanup(void);
672
673 int __connman_config_load_service(GKeyFile *keyfile, const char *group,
674                                   bool persistent);
675 int __connman_config_provision_service(struct connman_service *service);
676 int __connman_config_provision_service_ident(struct connman_service *service,
677                 const char *ident, const char *file, const char *entry);
678
679 char *__connman_config_get_string(GKeyFile *key_file,
680         const char *group_name, const char *key, GError **error);
681
682 char **__connman_config_get_string_list(GKeyFile *key_file,
683         const char *group_name, const char *key, gsize *length, GError **error);
684
685 bool __connman_config_get_bool(GKeyFile *key_file,
686         const char *group_name, const char *key, GError **error);
687 bool __connman_config_address_provisioned(const char *address,
688                                         const char *netmask);
689
690 #include <connman/tethering.h>
691
692 int __connman_tethering_init(void);
693 void __connman_tethering_cleanup(void);
694
695 const char *__connman_tethering_get_bridge(void);
696 int __connman_tethering_set_enabled(void);
697 void __connman_tethering_set_disabled(void);
698 void __connman_tethering_list_clients(DBusMessageIter *array);
699
700 int __connman_private_network_request(DBusMessage *msg, const char *owner);
701 int __connman_private_network_release(const char *path);
702
703 int __connman_ipv6pd_setup(const char *bridge);
704 void __connman_ipv6pd_cleanup(void);
705
706 #include <connman/provider.h>
707
708 bool __connman_provider_check_routes(struct connman_provider *provider);
709 int __connman_provider_append_user_route(struct connman_provider *provider,
710                         int family, const char *network, const char *netmask);
711 void __connman_provider_append_properties(struct connman_provider *provider, DBusMessageIter *iter);
712 void __connman_provider_list(DBusMessageIter *iter, void *user_data);
713 bool __connman_provider_is_immutable(struct connman_provider *provider);
714 int __connman_provider_create_and_connect(DBusMessage *msg);
715 const char * __connman_provider_get_ident(struct connman_provider *provider);
716 int __connman_provider_indicate_state(struct connman_provider *provider,
717                                         enum connman_provider_state state);
718 int __connman_provider_indicate_error(struct connman_provider *provider,
719                                         enum connman_provider_error error);
720 int __connman_provider_connect(struct connman_provider *provider,
721                                         const char *dbus_sender);
722 int __connman_provider_remove_by_path(const char *path);
723 void __connman_provider_cleanup(void);
724 int __connman_provider_init(void);
725
726 #include <connman/service.h>
727
728 int __connman_service_init(void);
729 void __connman_service_cleanup(void);
730 int __connman_service_load_modifiable(struct connman_service *service);
731
732 void __connman_service_list_struct(DBusMessageIter *iter);
733 #if defined TIZEN_EXT_INS
734 void __connman_ins_list_struct(DBusMessageIter *iter);
735 #endif
736
737 #if defined TIZEN_EXT
738 int connman_service_get_ipv6_dns_method(struct connman_service *service);
739 enum connman_dnsconfig_method {
740         CONNMAN_DNSCONFIG_METHOD_UNKNOWN = 0,
741         CONNMAN_DNSCONFIG_METHOD_MANUAL  = 1,
742         CONNMAN_DNSCONFIG_METHOD_DHCP    = 2,
743 };
744 #endif
745
746 int __connman_service_compare(const struct connman_service *a,
747                                         const struct connman_service *b);
748
749 struct connman_service *__connman_service_lookup_from_index(int index);
750 struct connman_service *__connman_service_create_from_network(struct connman_network *network);
751 struct connman_service *__connman_service_create_from_provider(struct connman_provider *provider);
752 bool __connman_service_index_is_default(int index);
753 #if defined TIZEN_EXT
754 void __connman_service_notify_strength_changed(struct connman_network *network);
755 #endif
756 void __connman_service_update_from_network(struct connman_network *network);
757 void __connman_service_remove_from_network(struct connman_network *network);
758 void __connman_service_read_ip4config(struct connman_service *service);
759 void __connman_service_read_ip6config(struct connman_service *service);
760
761 struct connman_ipconfig *__connman_service_get_ip4config(
762                                 struct connman_service *service);
763 struct connman_ipconfig *__connman_service_get_ip6config(
764                                 struct connman_service *service);
765 struct connman_ipconfig *__connman_service_get_ipconfig(
766                                 struct connman_service *service, int family);
767 void __connman_service_notify_ipv4_configuration(
768                                 struct connman_service *service);
769 void __connman_service_wispr_start(struct connman_service *service,
770                                 enum connman_ipconfig_type type);
771 bool __connman_service_is_connected_state(struct connman_service *service,
772                                         enum connman_ipconfig_type type);
773 const char *__connman_service_get_path(struct connman_service *service);
774 const char *__connman_service_get_name(struct connman_service *service);
775 struct connman_network *__connman_service_get_network(struct connman_service *service);
776 enum connman_service_security __connman_service_get_security(struct connman_service *service);
777 const char *__connman_service_get_phase2(struct connman_service *service);
778 bool __connman_service_wps_enabled(struct connman_service *service);
779 #if defined TIZEN_EXT
780 void __connman_service_set_storage_reload(struct connman_service *service,
781                                                 bool storage_reload);
782 #endif
783 int __connman_service_set_favorite(struct connman_service *service,
784                                                 bool favorite);
785 int __connman_service_set_favorite_delayed(struct connman_service *service,
786                                         bool favorite,
787                                         bool delay_ordering);
788 int __connman_service_set_immutable(struct connman_service *service,
789                                                 bool immutable);
790 int __connman_service_set_ignore(struct connman_service *service,
791                                                 bool ignore);
792 void __connman_service_set_search_domains(struct connman_service *service,
793                                         char **domains);
794 int __connman_service_set_mdns(struct connman_service *service,
795                                         bool enabled);
796
797 void __connman_service_set_string(struct connman_service *service,
798                                         const char *key, const char *value);
799 int __connman_service_online_check_failed(struct connman_service *service,
800                                         enum connman_ipconfig_type type);
801 int __connman_service_ipconfig_indicate_state(struct connman_service *service,
802                                         enum connman_service_state new_state,
803                                         enum connman_ipconfig_type type);
804 enum connman_service_state __connman_service_ipconfig_get_state(
805                                         struct connman_service *service,
806                                         enum connman_ipconfig_type type);
807
808 #if defined TIZEN_EXT
809 void connman_check_proxy_setup_and_wispr_start(struct connman_service *service);
810 #endif
811
812 int __connman_service_indicate_error(struct connman_service *service,
813                                         enum connman_service_error error);
814 int __connman_service_clear_error(struct connman_service *service);
815 int __connman_service_indicate_default(struct connman_service *service);
816
817 int __connman_service_connect(struct connman_service *service,
818                         enum connman_service_connect_reason reason);
819 int __connman_service_disconnect(struct connman_service *service);
820 int __connman_service_disconnect_all(void);
821 void __connman_service_set_active_session(bool enable, GSList *list);
822 void __connman_service_auto_connect(enum connman_service_connect_reason reason);
823
824 #if defined TIZEN_EXT
825 bool __connman_service_get_auto_connect_mode(void);
826 void __connman_service_set_auto_connect_mode(bool enable);
827 #endif
828
829 #if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
830 int __connman_service_get_use_eapol(struct connman_service *service);
831 int __connman_service_get_connect_reason(struct connman_service *service);
832 #endif /* defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET */
833
834 bool __connman_service_remove(struct connman_service *service);
835 bool __connman_service_is_provider_pending(struct connman_service *service);
836 void __connman_service_set_provider_pending(struct connman_service *service,
837                                                         DBusMessage *msg);
838 void __connman_service_set_hidden_data(struct connman_service *service,
839                                 gpointer user_data);
840 void __connman_service_return_error(struct connman_service *service,
841                                 int error, gpointer user_data);
842
843 int __connman_service_provision_changed(const char *ident);
844 void __connman_service_set_config(struct connman_service *service,
845                                 const char *file_id, const char *section);
846
847 const char *__connman_service_type2string(enum connman_service_type type);
848 enum connman_service_type __connman_service_string2type(const char *str);
849 enum connman_service_security __connman_service_string2security(const char *str);
850
851 #if defined TIZEN_EXT
852 int __connman_service_nameserver_append(struct connman_service *service,
853                                 const char *nameserver, bool is_auto,
854                                 enum connman_ipconfig_type type);
855 int __connman_service_nameserver_remove(struct connman_service *service,
856                                 const char *nameserver, bool is_auto,
857                                 enum connman_ipconfig_type type);
858 #else
859 int __connman_service_nameserver_append(struct connman_service *service,
860                                 const char *nameserver, bool is_auto);
861 int __connman_service_nameserver_remove(struct connman_service *service,
862                                 const char *nameserver, bool is_auto);
863 #endif
864 void __connman_service_nameserver_clear(struct connman_service *service);
865 void __connman_service_nameserver_add_routes(struct connman_service *service,
866                                                 const char *gw);
867 void __connman_service_nameserver_del_routes(struct connman_service *service,
868                                         enum connman_ipconfig_type type);
869 void __connman_service_set_timeservers(struct connman_service *service,
870                                                 char **timeservers);
871 int __connman_service_timeserver_append(struct connman_service *service,
872                                                 const char *timeserver);
873 int __connman_service_timeserver_remove(struct connman_service *service,
874                                                 const char *timeserver);
875 void __connman_service_timeserver_changed(struct connman_service *service,
876                 GSList *ts_list);
877 void __connman_service_set_pac(struct connman_service *service,
878                                         const char *pac);
879 #if defined TIZEN_EXT
880 /*
881  * Returns profile count if there is any connected profiles
882  * that use same interface
883  */
884 int __connman_service_get_connected_count_of_iface(struct connman_service *service);
885 void __connman_service_set_proxy(struct connman_service *service,
886                                        const char *proxies);
887 int check_passphrase_ext(struct connman_network *network,
888                                         const char *passphrase);
889 #endif
890 bool __connman_service_is_hidden(struct connman_service *service);
891 bool __connman_service_is_split_routing(struct connman_service *service);
892 bool __connman_service_index_is_split_routing(int index);
893 int __connman_service_get_index(struct connman_service *service);
894 void __connman_service_set_hidden(struct connman_service *service);
895 void __connman_service_set_hostname(struct connman_service *service,
896                                                 const char *hostname);
897 const char *__connman_service_get_hostname(struct connman_service *service);
898 void __connman_service_set_domainname(struct connman_service *service,
899                                                 const char *domainname);
900 const char *__connman_service_get_nameserver(struct connman_service *service);
901 void __connman_service_set_proxy_autoconfig(struct connman_service *service,
902                                                         const char *url);
903
904 void __connman_service_set_identity(struct connman_service *service,
905                                         const char *identity);
906 void __connman_service_set_anonymous_identity(struct connman_service *service,
907                                         const char *anonymous_identity);
908 void __connman_service_set_subject_match(struct connman_service *service,
909                                         const char *subject_match);
910 void __connman_service_set_altsubject_match(struct connman_service *service,
911                                         const char *altsubject_match);
912 void __connman_service_set_domain_suffix_match(struct connman_service *service,
913                                         const char *domain_suffix_match);
914 void __connman_service_set_domain_match(struct connman_service *service,
915                                         const char *domain_match);
916 void __connman_service_set_agent_identity(struct connman_service *service,
917                                                 const char *agent_identity);
918 int __connman_service_set_passphrase(struct connman_service *service,
919                                         const char *passphrase);
920 const char *__connman_service_get_passphrase(struct connman_service *service);
921 int __connman_service_check_passphrase(enum connman_service_security security,
922                                         const char *passphrase);
923 int __connman_service_reset_ipconfig(struct connman_service *service,
924                 enum connman_ipconfig_type type, DBusMessageIter *array,
925                 enum connman_service_state *new_state);
926
927 void __connman_service_notify(struct connman_service *service,
928                         unsigned int rx_packets, unsigned int tx_packets,
929                         unsigned int rx_bytes, unsigned int tx_bytes,
930                         unsigned int rx_error, unsigned int tx_error,
931                         unsigned int rx_dropped, unsigned int tx_dropped);
932
933 int __connman_service_counter_register(const char *counter);
934 void __connman_service_counter_unregister(const char *counter);
935
936 #include <connman/peer.h>
937
938 int __connman_peer_init(void);
939 void __connman_peer_cleanup(void);
940
941 void __connman_peer_list_struct(DBusMessageIter *array);
942 const char *__connman_peer_get_path(struct connman_peer *peer);
943 void __connman_peer_disconnect_all(void);
944
945 int __connman_peer_service_init(void);
946 void __connman_peer_service_cleanup(void);
947
948 void __connman_peer_service_set_driver(struct connman_peer_driver *driver);
949 int __connman_peer_service_register(const char *owner, DBusMessage *msg,
950                                         const unsigned char *specification,
951                                         int specification_length,
952                                         const unsigned char *query,
953                                         int query_length, int version,
954                                         bool master);
955 int __connman_peer_service_unregister(const char *owner,
956                                         const unsigned char *specification,
957                                         int specification_length,
958                                         const unsigned char *query,
959                                         int query_length, int version);
960
961 #if defined TIZEN_EXT_WIFI_MESH
962 #include <connman/mesh.h>
963
964 int __connman_mesh_init(void);
965 void __connman_mesh_cleanup(void);
966 bool __connman_technology_get_connected(enum connman_service_type type);
967 void __connman_technology_mesh_interface_create_finished(
968                                                 enum connman_service_type type, bool success,
969                                                 const char *error);
970 void __connman_technology_mesh_interface_remove_finished(
971                                                 enum connman_service_type type, bool success);
972 void __connman_mesh_peer_list_struct(DBusMessageIter *array);
973 void __connman_mesh_connected_peer_list_struct(DBusMessageIter *array);
974 void __connman_mesh_disconnected_peer_list_struct(DBusMessageIter *array);
975 int __connman_mesh_dhcp_start(struct connman_ipconfig *ipconfig,
976                         dhcp_cb callback, gpointer user_data);
977 int __connman_device_abort_scan(enum connman_service_type type);
978 void __connman_technology_notify_abort_scan(enum connman_service_type type,
979                                                 int result);
980 int __connman_device_request_mesh_specific_scan(enum connman_service_type type,
981                                 const char *name, unsigned int freq);
982 void __connman_mesh_auto_connect(void);
983 #endif /* TIZEN_EXT_WIFI_MESH */
984
985 #include <connman/session.h>
986
987 void __connman_service_mark_dirty();
988 void __connman_service_save(struct connman_service *service);
989
990 #include <connman/notifier.h>
991
992 int __connman_technology_init(void);
993 void __connman_technology_cleanup(void);
994
995 int __connman_notifier_init(void);
996 void __connman_notifier_cleanup(void);
997
998 void __connman_notifier_service_add(struct connman_service *service,
999                                         const char *name);
1000 void __connman_notifier_service_remove(struct connman_service *service);
1001 void __connman_notifier_enter_online(enum connman_service_type type);
1002 void __connman_notifier_leave_online(enum connman_service_type type);
1003 void __connman_notifier_connect(enum connman_service_type type);
1004 void __connman_notifier_disconnect(enum connman_service_type type);
1005 void __connman_notifier_offlinemode(bool enabled);
1006 void __connman_notifier_default_changed(struct connman_service *service);
1007 void __connman_notifier_proxy_changed(struct connman_service *service);
1008 void __connman_notifier_service_state_changed(struct connman_service *service,
1009                                         enum connman_service_state state);
1010 void __connman_notifier_ipconfig_changed(struct connman_service *service,
1011                                         struct connman_ipconfig *ipconfig);
1012
1013 bool __connman_notifier_is_connected(void);
1014 const char *__connman_notifier_get_state(void);
1015
1016 #include <connman/rtnl.h>
1017
1018 #if defined TIZEN_EXT
1019 int __connman_rtnl_init(int retry_count);
1020 #else
1021 int __connman_rtnl_init(void);
1022 #endif
1023 void __connman_rtnl_start(void);
1024 void __connman_rtnl_cleanup(void);
1025
1026 #if defined TIZEN_EXT
1027 void __connman_wifi_vsie_list_struct(DBusMessageIter *iter);
1028 #endif
1029
1030 enum connman_device_type __connman_rtnl_get_device_type(int index);
1031 unsigned int __connman_rtnl_update_interval_add(unsigned int interval);
1032 unsigned int __connman_rtnl_update_interval_remove(unsigned int interval);
1033 int __connman_rtnl_request_update(void);
1034 int __connman_rtnl_send(const void *buf, size_t len);
1035
1036 #if defined TIZEN_EXT
1037 void rtnl_nameserver_add_all(struct connman_service *service,
1038                         enum connman_ipconfig_type type);
1039 #endif
1040
1041 bool __connman_session_policy_autoconnect(enum connman_service_connect_reason reason);
1042
1043 int __connman_session_create(DBusMessage *msg);
1044 int __connman_session_destroy(DBusMessage *msg);
1045
1046 int __connman_session_init(void);
1047 void __connman_session_cleanup(void);
1048
1049 struct connman_stats_data {
1050         unsigned int rx_packets;
1051         unsigned int tx_packets;
1052         unsigned int rx_bytes;
1053         unsigned int tx_bytes;
1054         unsigned int rx_errors;
1055         unsigned int tx_errors;
1056         unsigned int rx_dropped;
1057         unsigned int tx_dropped;
1058         unsigned int time;
1059 };
1060
1061 int __connman_stats_init(void);
1062 void __connman_stats_cleanup(void);
1063 int __connman_stats_service_register(struct connman_service *service);
1064 void __connman_stats_service_unregister(struct connman_service *service);
1065 int  __connman_stats_update(struct connman_service *service,
1066                                 bool roaming,
1067                                 struct connman_stats_data *data);
1068 int __connman_stats_get(struct connman_service *service,
1069                                 bool roaming,
1070                                 struct connman_stats_data *data);
1071
1072 int __connman_iptables_dump(int type,
1073                                 const char *table_name);
1074 int __connman_iptables_new_chain(int type,
1075                                 const char *table_name,
1076                                 const char *chain);
1077 int __connman_iptables_delete_chain(int type,
1078                                 const char *table_name,
1079                                 const char *chain);
1080 int __connman_iptables_flush_chain(int type,
1081                                 const char *table_name,
1082                                 const char *chain);
1083 int __connman_iptables_find_chain(int type,
1084                                 const char *table_name,
1085                                 const char *chain);
1086 int __connman_iptables_change_policy(int type,
1087                                 const char *table_name,
1088                                 const char *chain,
1089                                 const char *policy);
1090 int __connman_iptables_append(int type,
1091                                 const char *table_name,
1092                                 const char *chain,
1093                                 const char *rule_spec);
1094 int __connman_iptables_insert(int type,
1095                                 const char *table_name,
1096                                 const char *chain,
1097                                 const char *rule_spec);
1098 int __connman_iptables_delete(int type,
1099                                 const char *table_name,
1100                                 const char *chain,
1101                                 const char *rule_spec);
1102
1103 typedef void (*connman_iptables_iterate_chains_cb_t) (const char *chain_name,
1104                                                         void *user_data);
1105 int __connman_iptables_iterate_chains(int type,
1106                                 const char *table_name,
1107                                 connman_iptables_iterate_chains_cb_t cb,
1108                                 void *user_data);
1109
1110 int __connman_iptables_init(void);
1111 void __connman_iptables_cleanup(void);
1112 int __connman_iptables_commit(int type, const char *table_name);
1113
1114 int __connman_dnsproxy_init(void);
1115 void __connman_dnsproxy_cleanup(void);
1116 int __connman_dnsproxy_add_listener(int index);
1117 void __connman_dnsproxy_remove_listener(int index);
1118 int __connman_dnsproxy_append(int index, const char *domain, const char *server);
1119 int __connman_dnsproxy_remove(int index, const char *domain, const char *server);
1120 int __connman_dnsproxy_set_mdns(int index, bool enabled);
1121
1122 int __connman_6to4_probe(struct connman_service *service);
1123 void __connman_6to4_remove(struct connman_ipconfig *ipconfig);
1124 int __connman_6to4_check(struct connman_ipconfig *ipconfig);
1125
1126 struct connman_ippool;
1127
1128 typedef void (*ippool_collision_cb_t) (struct connman_ippool *pool,
1129                                         void *user_data);
1130
1131 int __connman_ippool_init(void);
1132 void __connman_ippool_cleanup(void);
1133
1134 void __connman_ippool_free(struct connman_ippool *pool);
1135
1136 struct connman_ippool *__connman_ippool_create(int index,
1137                                         unsigned int start,
1138                                         unsigned int range,
1139                                         ippool_collision_cb_t collision_cb,
1140                                         void *user_data);
1141
1142 const char *__connman_ippool_get_gateway(struct connman_ippool *pool);
1143 const char *__connman_ippool_get_broadcast(struct connman_ippool *pool);
1144 const char *__connman_ippool_get_subnet_mask(struct connman_ippool *pool);
1145 const char *__connman_ippool_get_start_ip(struct connman_ippool *pool);
1146 const char *__connman_ippool_get_end_ip(struct connman_ippool *pool);
1147
1148 void __connman_ippool_newaddr(int index, const char *address,
1149                                 unsigned char prefixlen);
1150 void __connman_ippool_deladdr(int index, const char *address,
1151                                 unsigned char prefixlen);
1152
1153 int __connman_bridge_create(const char *name);
1154 int __connman_bridge_remove(const char *name);
1155 int __connman_bridge_enable(const char *name, const char *ip_address,
1156                         int prefix_len, const char *broadcast);
1157 int __connman_bridge_disable(const char *name);
1158
1159 int __connman_nat_init(void);
1160 void __connman_nat_cleanup(void);
1161
1162 int __connman_nat_enable(const char *name, const char *address,
1163                                 unsigned char prefixlen);
1164 void __connman_nat_disable(const char *name);
1165
1166 struct firewall_context;
1167
1168 struct firewall_context *__connman_firewall_create(void);
1169 void __connman_firewall_destroy(struct firewall_context *ctx);
1170 int __connman_firewall_enable_nat(struct firewall_context *ctx,
1171                                         char *address, unsigned char prefixlen,
1172                                         char *interface);
1173 int __connman_firewall_disable_nat(struct firewall_context *ctx);
1174 int __connman_firewall_enable_snat(struct firewall_context *ctx,
1175                                 int index, const char *ifname,
1176                                 const char *addr);
1177 int __connman_firewall_disable_snat(struct firewall_context *ctx);
1178 int __connman_firewall_enable_marking(struct firewall_context *ctx,
1179                                         enum connman_session_id_type id_type,
1180                                         char *id, const char *src_ip,
1181                                         uint32_t mark);
1182 int __connman_firewall_disable_marking(struct firewall_context *ctx);
1183
1184 int __connman_firewall_init(void);
1185 void __connman_firewall_cleanup(void);
1186
1187 typedef int (* connman_nfacct_flush_cb_t) (unsigned int error, void *user_data);
1188
1189 int __connman_nfacct_flush(connman_nfacct_flush_cb_t cb, void *user_data);
1190
1191 struct nfacct_context;
1192
1193 typedef void (* connman_nfacct_enable_cb_t) (unsigned int error,
1194                                                 struct nfacct_context *ctx,
1195                                                 void *user_data);
1196 typedef void (* connman_nfacct_disable_cb_t) (unsigned int error,
1197                                                 struct nfacct_context *ctx,
1198                                                 void *user_data);
1199 typedef void (* connman_nfacct_stats_cb_t) (struct nfacct_context *ctx,
1200                                                 uint64_t packets,
1201                                                 uint64_t bytes,
1202                                                 void *user_data);
1203
1204 struct nfacct_context *__connman_nfacct_create_context(void);
1205 void __connman_nfacct_destroy_context(struct nfacct_context *ctx);
1206
1207 int __connman_nfacct_add(struct nfacct_context *ctx, const char *name,
1208                                 connman_nfacct_stats_cb_t cb,
1209                                 void *user_data);
1210 int __connman_nfacct_enable(struct nfacct_context *ctx,
1211                                 connman_nfacct_enable_cb_t cb,
1212                                 void *user_data);
1213 int __connman_nfacct_disable(struct nfacct_context *ctx,
1214                                 connman_nfacct_disable_cb_t cb,
1215                                 void *user_data);
1216
1217 void __connman_nfacct_cleanup(void);
1218
1219 #include <connman/machine.h>
1220
1221 int __connman_machine_init(void);
1222 void __connman_machine_cleanup(void);
1223
1224 int __connman_util_get_random(uint64_t *val);
1225 unsigned int __connman_util_random_delay_ms(unsigned int secs);
1226 int __connman_util_init(void);
1227 void __connman_util_cleanup(void);
1228
1229 #ifdef TIZEN_EXT
1230 __attribute__ ((unused)) static int __tizentvextension = -1;
1231 #define TIZEN_TV_EXT (__builtin_expect(__tizentvextension != -1, 1) ? \
1232         __tizentvextension : \
1233         (__tizentvextension = connman_setting_get_bool("TizenTVExtension")))
1234 #else /* TIZEN_EXT */
1235 #define TIZEN_TV_EXT (0) /* Always False */
1236 #endif /* TIZEN_EXT */