Updated connman to version 1.35
[platform/upstream/connman.git] / vpn / plugins / vpn.h
1 /*
2  *
3  *  ConnMan VPN daemon
4  *
5  *  Copyright (C) 2010,2014  BMW Car IT GmbH.
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 #ifndef __CONNMAN_VPND_VPN_H
23 #define __CONNMAN_VPND_VPN_H
24
25 #include "../vpn-provider.h"
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 #define VPN_FLAG_NO_TUN 1
32
33 enum vpn_state {
34         VPN_STATE_UNKNOWN       = 0,
35         VPN_STATE_IDLE          = 1,
36         VPN_STATE_CONNECT       = 2,
37         VPN_STATE_READY         = 3,
38         VPN_STATE_DISCONNECT    = 4,
39         VPN_STATE_FAILURE       = 5,
40         VPN_STATE_AUTH_FAILURE  = 6,
41 };
42
43 #if defined TIZEN_EXT
44 typedef void (*vpn_event_callback)(struct vpn_provider *provider, int state);
45 #endif
46
47 struct vpn_driver {
48         int flags;
49         int (*notify) (DBusMessage *msg, struct vpn_provider *provider);
50 #if defined TIZEN_EXT
51         void (*set_event_cb) (vpn_event_callback event_cb, struct vpn_provider *provider);
52 #endif
53         int (*connect) (struct vpn_provider *provider,
54                         struct connman_task *task, const char *if_name,
55                         vpn_provider_connect_cb_t cb, const char *dbus_sender,
56                         void *user_data);
57         void (*disconnect) (struct vpn_provider *provider);
58         int (*error_code) (struct vpn_provider *provider, int exit_code);
59         int (*save) (struct vpn_provider *provider, GKeyFile *keyfile);
60         int (*device_flags) (struct vpn_provider *provider);
61 };
62
63 int vpn_register(const char *name, struct vpn_driver *driver,
64                         const char *program);
65 void vpn_unregister(const char *provider_name);
66 void vpn_died(struct connman_task *task, int exit_code, void *user_data);
67 int vpn_set_ifname(struct vpn_provider *provider, const char *ifname);
68
69 #ifdef __cplusplus
70 }
71 #endif
72
73 #endif /* __CONNMAN_VPND_VPN_H */