device: renew dhcp leases on awake for software devices
[NetworkManager.git] / libnm-util / 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 #include <nm-setting.h>
27
28 G_BEGIN_DECLS
29
30 #define NM_TYPE_SETTING_VPN            (nm_setting_vpn_get_type ())
31 #define NM_SETTING_VPN(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_VPN, NMSettingVPN))
32 #define NM_SETTING_VPN_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_VPN, NMSettingVPNClass))
33 #define NM_IS_SETTING_VPN(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_VPN))
34 #define NM_IS_SETTING_VPN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTING_VPN))
35 #define NM_SETTING_VPN_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_VPN, NMSettingVPNClass))
36
37 #define NM_SETTING_VPN_SETTING_NAME "vpn"
38
39 /**
40  * NMSettingVpnError:
41  * @NM_SETTING_VPN_ERROR_UNKNOWN: unknown or unclassified error
42  * @NM_SETTING_VPN_ERROR_INVALID_PROPERTY: the property was invalid
43  * @NM_SETTING_VPN_ERROR_MISSING_PROPERTY: the property was missing and is
44  * required
45  */
46 typedef enum {
47         NM_SETTING_VPN_ERROR_UNKNOWN = 0,      /*< nick=UnknownError >*/
48         NM_SETTING_VPN_ERROR_INVALID_PROPERTY, /*< nick=InvalidProperty >*/
49         NM_SETTING_VPN_ERROR_MISSING_PROPERTY, /*< nick=MissingProperty >*/
50 } NMSettingVpnError;
51
52 #define NM_SETTING_VPN_ERROR nm_setting_vpn_error_quark ()
53 GQuark nm_setting_vpn_error_quark (void);
54
55 #define NM_SETTING_VPN_SERVICE_TYPE "service-type"
56 #define NM_SETTING_VPN_USER_NAME    "user-name"
57 #define NM_SETTING_VPN_PERSISTENT   "persistent"
58 #define NM_SETTING_VPN_DATA         "data"
59 #define NM_SETTING_VPN_SECRETS      "secrets"
60
61 typedef struct {
62         NMSetting parent;
63 } NMSettingVPN;
64
65 typedef struct {
66         NMSettingClass parent;
67
68         /* Padding for future expansion */
69         void (*_reserved1) (void);
70         void (*_reserved2) (void);
71         void (*_reserved3) (void);
72         void (*_reserved4) (void);
73 } NMSettingVPNClass;
74
75 /**
76  * NMVPNIterFunc:
77  * @key: the name of the data or secret item
78  * @value: the value of the data or secret item
79  * @user_data: User data passed to nm_setting_vpn_foreach_data_item() or
80  * nm_setting_vpn_foreach_secret()
81  **/
82 typedef void (*NMVPNIterFunc) (const char *key, const char *value, gpointer user_data);
83
84 GType nm_setting_vpn_get_type (void);
85
86 NMSetting        *nm_setting_vpn_new               (void);
87 const char       *nm_setting_vpn_get_service_type  (NMSettingVPN *setting);
88 const char       *nm_setting_vpn_get_user_name     (NMSettingVPN *setting);
89 gboolean          nm_setting_vpn_get_persistent    (NMSettingVPN *setting);
90
91 guint32           nm_setting_vpn_get_num_data_items (NMSettingVPN *setting);
92 void              nm_setting_vpn_add_data_item     (NMSettingVPN *setting,
93                                                     const char *key,
94                                                     const char *item);
95 const char *      nm_setting_vpn_get_data_item     (NMSettingVPN *setting,
96                                                     const char *key);
97 gboolean          nm_setting_vpn_remove_data_item  (NMSettingVPN *setting,
98                                                     const char *key);
99 void              nm_setting_vpn_foreach_data_item (NMSettingVPN *setting,
100                                                     NMVPNIterFunc func,
101                                                     gpointer user_data);
102
103 guint32           nm_setting_vpn_get_num_secrets   (NMSettingVPN *setting);
104 void              nm_setting_vpn_add_secret        (NMSettingVPN *setting,
105                                                     const char *key,
106                                                     const char *secret);
107 const char *      nm_setting_vpn_get_secret        (NMSettingVPN *setting,
108                                                     const char *key);
109 gboolean          nm_setting_vpn_remove_secret     (NMSettingVPN *setting,
110                                                     const char *key);
111 void              nm_setting_vpn_foreach_secret    (NMSettingVPN *setting,
112                                                     NMVPNIterFunc func,
113                                                     gpointer user_data);
114
115 #ifdef NM_VPN_LIBNM_COMPAT
116 #define NMSettingVpn NMSettingVPN
117 #endif
118
119 G_END_DECLS
120
121 #endif /* NM_SETTING_VPN_H */