summaryrefslogtreecommitdiff
path: root/vpn/plugins/vpn.h
blob: 893e9a1dded432305f1158865d79ce9f4485754e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
 *
 *  ConnMan VPN daemon
 *
 *  Copyright (C) 2010,2014  BMW Car IT GmbH.
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License version 2 as
 *  published by the Free Software Foundation.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */

#ifndef __CONNMAN_VPND_VPN_H
#define __CONNMAN_VPND_VPN_H

#include "../vpn-provider.h"

#ifdef __cplusplus
extern "C" {
#endif

#define VPN_FLAG_NO_TUN     1
#define VPN_FLAG_NO_DAEMON  2

enum vpn_state {
	VPN_STATE_UNKNOWN       = 0,
	VPN_STATE_IDLE          = 1,
	VPN_STATE_CONNECT       = 2,
	VPN_STATE_READY         = 3,
	VPN_STATE_DISCONNECT    = 4,
	VPN_STATE_FAILURE       = 5,
	VPN_STATE_AUTH_FAILURE  = 6,
};

#if defined TIZEN_EXT
typedef void (*vpn_event_callback)(struct vpn_provider *provider, int state);
#endif

struct vpn_driver {
	int flags;
	int (*notify) (DBusMessage *msg, struct vpn_provider *provider);
#if defined TIZEN_EXT
	void (*set_event_cb) (vpn_event_callback event_cb, struct vpn_provider *provider);
#endif
	int (*connect) (struct vpn_provider *provider,
			struct connman_task *task, const char *if_name,
			vpn_provider_connect_cb_t cb, const char *dbus_sender,
			void *user_data);
	void (*disconnect) (struct vpn_provider *provider);
	int (*remove) (struct vpn_provider *provider);
	int (*error_code) (struct vpn_provider *provider, int exit_code);
	int (*save) (struct vpn_provider *provider, GKeyFile *keyfile);
	int (*device_flags) (struct vpn_provider *provider);
	int (*route_env_parse) (struct vpn_provider *provider, const char *key,
			int *family, unsigned long *idx,
			enum vpn_provider_route_type *type);
};

int vpn_register(const char *name, struct vpn_driver *driver,
			const char *program);
void vpn_unregister(const char *provider_name);
void vpn_died(struct connman_task *task, int exit_code, void *user_data);
int vpn_set_ifname(struct vpn_provider *provider, const char *ifname);

#ifdef __cplusplus
}
#endif

#endif /* __CONNMAN_VPND_VPN_H */