device: renew dhcp leases on awake for software devices
[NetworkManager.git] / libnm-util / nm-setting-connection.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 - 2014 Red Hat, Inc.
20  * Copyright 2007 - 2008 Novell, Inc.
21  */
22
23 #ifndef NM_SETTING_CONNECTION_H
24 #define NM_SETTING_CONNECTION_H
25
26 #include "nm-setting.h"
27
28 G_BEGIN_DECLS
29
30 #define NM_TYPE_SETTING_CONNECTION            (nm_setting_connection_get_type ())
31 #define NM_SETTING_CONNECTION(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_CONNECTION, NMSettingConnection))
32 #define NM_SETTING_CONNECTION_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_CONNECTION, NMSettingConnectionClass))
33 #define NM_IS_SETTING_CONNECTION(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_CONNECTION))
34 #define NM_IS_SETTING_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTING_CONNECTION))
35 #define NM_SETTING_CONNECTION_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_CONNECTION, NMSettingConnectionClass))
36
37 #define NM_SETTING_CONNECTION_SETTING_NAME "connection"
38
39 /**
40  * NMSettingConnectionError:
41  * @NM_SETTING_CONNECTION_ERROR_UNKNOWN: unknown or unclassified error
42  * @NM_SETTING_CONNECTION_ERROR_INVALID_PROPERTY: the property's value is
43  *   invalid
44  * @NM_SETTING_CONNECTION_ERROR_MISSING_PROPERTY: a required property is not
45  *   present
46  * @NM_SETTING_CONNECTION_ERROR_TYPE_SETTING_NOT_FOUND: the #NMSetting object
47  *   referenced by the setting name contained in the
48  *   #NMSettingConnection:type property was not present in the #NMConnection
49  * @NM_SETTING_CONNECTION_ERROR_IP_CONFIG_NOT_ALLOWED: ip configuration is not
50  *   allowed to be present.
51  *
52  * Describes errors that may result from operations involving a
53  * #NMSettingConnection.
54  *
55  **/
56 typedef enum
57 {
58         NM_SETTING_CONNECTION_ERROR_UNKNOWN = 0,            /*< nick=UnknownError >*/
59         NM_SETTING_CONNECTION_ERROR_INVALID_PROPERTY,       /*< nick=InvalidProperty >*/
60         NM_SETTING_CONNECTION_ERROR_MISSING_PROPERTY,       /*< nick=MissingProperty >*/
61         NM_SETTING_CONNECTION_ERROR_TYPE_SETTING_NOT_FOUND, /*< nick=TypeSettingNotFound >*/
62         NM_SETTING_CONNECTION_ERROR_IP_CONFIG_NOT_ALLOWED,  /*< nick=IpConfigNotAllowed >*/
63 } NMSettingConnectionError;
64
65 #define NM_SETTING_CONNECTION_ERROR nm_setting_connection_error_quark ()
66 GQuark nm_setting_connection_error_quark (void);
67
68 #define NM_SETTING_CONNECTION_ID             "id"
69 #define NM_SETTING_CONNECTION_UUID           "uuid"
70 #define NM_SETTING_CONNECTION_INTERFACE_NAME "interface-name"
71 #define NM_SETTING_CONNECTION_TYPE           "type"
72 #define NM_SETTING_CONNECTION_AUTOCONNECT    "autoconnect"
73 #define NM_SETTING_CONNECTION_TIMESTAMP      "timestamp"
74 #define NM_SETTING_CONNECTION_READ_ONLY      "read-only"
75 #define NM_SETTING_CONNECTION_PERMISSIONS    "permissions"
76 #define NM_SETTING_CONNECTION_ZONE           "zone"
77 #define NM_SETTING_CONNECTION_MASTER         "master"
78 #define NM_SETTING_CONNECTION_SLAVE_TYPE     "slave-type"
79 #define NM_SETTING_CONNECTION_SECONDARIES    "secondaries"
80 #define NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT "gateway-ping-timeout"
81
82 /**
83  * NMSettingConnection:
84  *
85  * The NMSettingConnection struct contains only private data.
86  * It should only be accessed through the functions described below.
87  */
88 typedef struct {
89         NMSetting parent;
90 } NMSettingConnection;
91
92 typedef struct {
93         NMSettingClass parent;
94
95         /* Padding for future expansion */
96         void (*_reserved1) (void);
97         void (*_reserved2) (void);
98         void (*_reserved3) (void);
99         void (*_reserved4) (void);
100 } NMSettingConnectionClass;
101
102 GType nm_setting_connection_get_type (void);
103
104 NMSetting * nm_setting_connection_new                  (void);
105 const char *nm_setting_connection_get_id               (NMSettingConnection *setting);
106 const char *nm_setting_connection_get_uuid             (NMSettingConnection *setting);
107 NM_AVAILABLE_IN_0_9_10
108 const char *nm_setting_connection_get_interface_name   (NMSettingConnection *setting);
109 const char *nm_setting_connection_get_connection_type  (NMSettingConnection *setting);
110 gboolean    nm_setting_connection_get_autoconnect      (NMSettingConnection *setting);
111 guint64     nm_setting_connection_get_timestamp        (NMSettingConnection *setting);
112 gboolean    nm_setting_connection_get_read_only        (NMSettingConnection *setting);
113
114 guint32     nm_setting_connection_get_num_permissions  (NMSettingConnection *setting);
115 gboolean    nm_setting_connection_get_permission       (NMSettingConnection *setting,
116                                                         guint32 idx,
117                                                         const char **out_ptype,
118                                                         const char **out_pitem,
119                                                         const char **out_detail);
120 const char *nm_setting_connection_get_zone             (NMSettingConnection *setting);
121 gboolean    nm_setting_connection_permissions_user_allowed (NMSettingConnection *setting, const char *uname);
122 gboolean    nm_setting_connection_add_permission       (NMSettingConnection *setting,
123                                                         const char *ptype,
124                                                         const char *pitem,
125                                                         const char *detail);
126 void        nm_setting_connection_remove_permission    (NMSettingConnection *setting,
127                                                         guint32 idx);
128 NM_AVAILABLE_IN_0_9_10
129 gboolean    nm_setting_connection_remove_permission_by_value (NMSettingConnection *setting,
130                                                               const char *ptype,
131                                                               const char *pitem,
132                                                               const char *detail);
133
134 const char *nm_setting_connection_get_master           (NMSettingConnection *setting);
135 gboolean    nm_setting_connection_is_slave_type        (NMSettingConnection *setting,
136                                                         const char *type);
137 const char *nm_setting_connection_get_slave_type       (NMSettingConnection *setting);
138
139 guint32     nm_setting_connection_get_num_secondaries  (NMSettingConnection *setting);
140 const char *nm_setting_connection_get_secondary        (NMSettingConnection *setting, guint32 idx);
141 gboolean    nm_setting_connection_add_secondary        (NMSettingConnection *setting, const char *sec_uuid);
142 void        nm_setting_connection_remove_secondary     (NMSettingConnection *setting, guint32 idx);
143 NM_AVAILABLE_IN_0_9_10
144 gboolean    nm_setting_connection_remove_secondary_by_value (NMSettingConnection *setting, const char *sec_uuid);
145
146 NM_AVAILABLE_IN_0_9_10
147 guint32     nm_setting_connection_get_gateway_ping_timeout (NMSettingConnection *setting);
148
149 G_END_DECLS
150
151 #endif /* NM_SETTING_CONNECTION_H */