vpnd: Add function that quits vpnd if no VPN configurations are found
[platform/upstream/connman.git] / vpn / vpn.h
1 /*
2  *
3  *  ConnMan VPN daemon
4  *
5  *  Copyright (C) 2012  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 <glib.h>
23
24 #define VPN_API_SUBJECT_TO_CHANGE
25
26 #include <connman/dbus.h>
27 #include <connman/types.h>
28
29 int __vpn_manager_init(void);
30 void __vpn_manager_cleanup(void);
31
32 struct vpn_ipconfig;
33
34 unsigned char __vpn_ipconfig_netmask_prefix_len(const char *netmask);
35 unsigned short __vpn_ipconfig_get_type_from_index(int index);
36 unsigned int __vpn_ipconfig_get_flags_from_index(int index);
37 void __vpn_ipconfig_foreach(void (*function) (int index,
38                                     void *user_data), void *user_data);
39 void __vpn_ipconfig_set_local(struct vpn_ipconfig *ipconfig,
40                                                         const char *address);
41 const char *__vpn_ipconfig_get_local(struct vpn_ipconfig *ipconfig);
42 void __vpn_ipconfig_set_peer(struct vpn_ipconfig *ipconfig,
43                                                 const char *address);
44 const char *__vpn_ipconfig_get_peer(struct vpn_ipconfig *ipconfig);
45 void __vpn_ipconfig_set_broadcast(struct vpn_ipconfig *ipconfig,
46                                                 const char *broadcast);
47 void __vpn_ipconfig_set_gateway(struct vpn_ipconfig *ipconfig,
48                                                 const char *gateway);
49 const char *__vpn_ipconfig_get_gateway(struct vpn_ipconfig *ipconfig);
50 void __vpn_ipconfig_set_prefixlen(struct vpn_ipconfig *ipconfig,
51                                                 unsigned char prefixlen);
52 unsigned char __vpn_ipconfig_get_prefixlen(struct vpn_ipconfig *ipconfig);
53 int __vpn_ipconfig_address_add(struct vpn_ipconfig *ipconfig, int family);
54 int __vpn_ipconfig_gateway_add(struct vpn_ipconfig *ipconfig, int family);
55 void __vpn_ipconfig_unref_debug(struct vpn_ipconfig *ipconfig,
56                         const char *file, int line, const char *caller);
57 #define __vpn_ipconfig_unref(ipconfig) \
58         __vpn_ipconfig_unref_debug(ipconfig, __FILE__, __LINE__, __func__)
59 struct vpn_ipconfig *__vpn_ipconfig_create(int index, int family);
60 void __vpn_ipconfig_set_index(struct vpn_ipconfig *ipconfig,
61                                                                 int index);
62 struct rtnl_link_stats;
63
64 void __vpn_ipconfig_newlink(int index, unsigned short type,
65                                 unsigned int flags, const char *address,
66                                 unsigned short mtu,
67                                 struct rtnl_link_stats *stats);
68 void __vpn_ipconfig_dellink(int index, struct rtnl_link_stats *stats);
69 int __vpn_ipconfig_init(void);
70 void __vpn_ipconfig_cleanup(void);
71
72 #include "vpn-provider.h"
73
74 connman_bool_t __vpn_provider_check_routes(struct vpn_provider *provider);
75 int __vpn_provider_append_user_route(struct vpn_provider *provider,
76                         int family, const char *network, const char *netmask);
77 void __vpn_provider_append_properties(struct vpn_provider *provider, DBusMessageIter *iter);
78 void __vpn_provider_list(DBusMessageIter *iter, void *user_data);
79 int __vpn_provider_create(DBusMessage *msg);
80 DBusMessage *__vpn_provider_get_connections(DBusMessage *msg);
81 const char * __vpn_provider_get_ident(struct vpn_provider *provider);
82 int __vpn_provider_indicate_state(struct vpn_provider *provider,
83                                         enum vpn_provider_state state);
84 int __vpn_provider_indicate_error(struct vpn_provider *provider,
85                                         enum vpn_provider_error error);
86 int __vpn_provider_connect(struct vpn_provider *provider);
87 int __vpn_provider_connect_path(const char *path);
88 int __vpn_provider_disconnect(struct vpn_provider *provider);
89 int __vpn_provider_remove(const char *path);
90 void __vpn_provider_check_connections(void);
91 void __vpn_provider_cleanup(void);
92 int __vpn_provider_init(gboolean handle_routes);
93
94 #include "vpn-rtnl.h"
95
96 int __vpn_rtnl_init(void);
97 void __vpn_rtnl_start(void);
98 void __vpn_rtnl_cleanup(void);
99
100 unsigned int __vpn_rtnl_update_interval_add(unsigned int interval);
101 unsigned int __vpn_rtnl_update_interval_remove(unsigned int interval);
102 int __vpn_rtnl_request_update(void);
103 int __vpn_rtnl_send(const void *buf, size_t len);