service: Simplify nameserver route adding and removing
[framework/connectivity/connman.git] / plugins / vpn.h
1 /*
2  *
3  *  Connection Manager
4  *
5  *  Copyright (C) 2010  BMW Car IT GmbH. 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 #define VPN_FLAG_NO_TUN 1
23
24 enum vpn_state {
25         VPN_STATE_UNKNOWN       = 0,
26         VPN_STATE_IDLE          = 1,
27         VPN_STATE_CONNECT       = 2,
28         VPN_STATE_READY         = 3,
29         VPN_STATE_DISCONNECT    = 4,
30         VPN_STATE_FAILURE       = 5,
31         VPN_STATE_AUTH_FAILURE  = 6,
32 };
33
34 struct vpn_driver {
35         int flags;
36         int (*notify) (DBusMessage *msg, struct connman_provider *provider);
37         int (*connect) (struct connman_provider *provider,
38                         struct connman_task *task, const char *if_name);
39         void (*disconnect) (void);
40         int (*error_code) (int exit_code);
41         int (*save) (struct connman_provider *provider, GKeyFile *keyfile);
42 };
43
44 int vpn_register(const char *name, struct vpn_driver *driver,
45                         const char *program);
46 void vpn_unregister(const char *provider_name);
47 void vpn_died(struct connman_task *task, int exit_code, void *user_data);
48 int vpn_set_ifname(struct connman_provider *provider, const char *ifname);