device: renew dhcp leases on awake for software devices
[NetworkManager.git] / libnm-core / nm-setting-vpn.h
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2
3 /*
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301 USA.
18  *
19  * Copyright 2007 - 2013 Red Hat, Inc.
20  * Copyright 2007 - 2008 Novell, Inc.
21  */
22
23 #ifndef __NM_SETTING_VPN_H__
24 #define __NM_SETTING_VPN_H__
25
26 #if !defined (__NETWORKMANAGER_H_INSIDE__) && !defined (NETWORKMANAGER_COMPILATION)
27 #error "Only <NetworkManager.h> can be included directly."
28 #endif
29
30 #include <nm-setting.h>
31
32 G_BEGIN_DECLS
33
34 #define NM_TYPE_SETTING_VPN            (nm_setting_vpn_get_type ())
35 #define NM_SETTING_VPN(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_VPN, NMSettingVpn))
36 #define NM_SETTING_VPN_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_VPN, NMSettingVpnClass))
37 #define NM_IS_SETTING_VPN(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_VPN))
38 #define NM_IS_SETTING_VPN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTING_VPN))
39 #define NM_SETTING_VPN_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_VPN, NMSettingVpnClass))
40
41 #define NM_SETTING_VPN_SETTING_NAME "vpn"
42
43 #define NM_SETTING_VPN_SERVICE_TYPE "service-type"
44 #define NM_SETTING_VPN_USER_NAME    "user-name"
45 #define NM_SETTING_VPN_PERSISTENT   "persistent"
46 #define NM_SETTING_VPN_DATA         "data"
47 #define NM_SETTING_VPN_SECRETS      "secrets"
48 #define NM_SETTING_VPN_TIMEOUT      "timeout"
49
50 struct _NMSettingVpn {
51         NMSetting parent;
52 };
53
54 typedef struct {
55         NMSettingClass parent;
56
57         /*< private >*/
58         gpointer padding[4];
59 } NMSettingVpnClass;
60
61 /**
62  * NMVpnIterFunc:
63  * @key: the name of the data or secret item
64  * @value: the value of the data or secret item
65  * @user_data: User data passed to nm_setting_vpn_foreach_data_item() or
66  * nm_setting_vpn_foreach_secret()
67  **/
68 typedef void (*NMVpnIterFunc) (const char *key, const char *value, gpointer user_data);
69
70 GType nm_setting_vpn_get_type (void);
71
72 NMSetting        *nm_setting_vpn_new               (void);
73 const char       *nm_setting_vpn_get_service_type  (NMSettingVpn *setting);
74 const char       *nm_setting_vpn_get_user_name     (NMSettingVpn *setting);
75 gboolean          nm_setting_vpn_get_persistent    (NMSettingVpn *setting);
76
77 guint32           nm_setting_vpn_get_num_data_items (NMSettingVpn *setting);
78 void              nm_setting_vpn_add_data_item     (NMSettingVpn *setting,
79                                                     const char *key,
80                                                     const char *item);
81 const char *      nm_setting_vpn_get_data_item     (NMSettingVpn *setting,
82                                                     const char *key);
83 gboolean          nm_setting_vpn_remove_data_item  (NMSettingVpn *setting,
84                                                     const char *key);
85 void              nm_setting_vpn_foreach_data_item (NMSettingVpn *setting,
86                                                     NMVpnIterFunc func,
87                                                     gpointer user_data);
88
89 guint32           nm_setting_vpn_get_num_secrets   (NMSettingVpn *setting);
90 void              nm_setting_vpn_add_secret        (NMSettingVpn *setting,
91                                                     const char *key,
92                                                     const char *secret);
93 const char *      nm_setting_vpn_get_secret        (NMSettingVpn *setting,
94                                                     const char *key);
95 gboolean          nm_setting_vpn_remove_secret     (NMSettingVpn *setting,
96                                                     const char *key);
97 void              nm_setting_vpn_foreach_secret    (NMSettingVpn *setting,
98                                                     NMVpnIterFunc func,
99                                                     gpointer user_data);
100 NM_AVAILABLE_IN_1_2
101 guint32           nm_setting_vpn_get_timeout       (NMSettingVpn *setting);
102
103 G_END_DECLS
104
105 #endif /* __NM_SETTING_VPN_H__ */