device: renew dhcp leases on awake for software devices
[NetworkManager.git] / libnm-core / nm-errors.h
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /*
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License along
14  * with this program; if not, write to the Free Software Foundation, Inc.,
15  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16  *
17  * Copyright 2004 - 2014 Red Hat, Inc.
18  */
19
20 #ifndef __NM_ERRORS_H__
21 #define __NM_ERRORS_H__
22
23 /**
24  * NMAgentManagerError:
25  * @NM_AGENT_MANAGER_ERROR_FAILED: unknown or unspecified error
26  * @NM_AGENT_MANAGER_ERROR_PERMISSION_DENIED: The caller does not have permission
27  *   to register a secret agent, or is trying to register the same secret agent
28  *   twice.
29  * @NM_AGENT_MANAGER_ERROR_INVALID_IDENTIFIER: The identifier is not a valid
30  *   secret agent identifier.
31  * @NM_AGENT_MANAGER_ERROR_NOT_REGISTERED: The caller tried to unregister an agent
32  *   that was not registered.
33  * @NM_AGENT_MANAGER_ERROR_NO_SECRETS: No secret agent returned secrets for this
34  *   request
35  * @NM_AGENT_MANAGER_ERROR_USER_CANCELED: The user canceled the secrets request.
36  *
37  * Errors returned from the secret-agent manager.
38  *
39  * These errors may be returned from operations that could cause secrets to be
40  * requested (such as nm_client_activate_connection()), and correspond to D-Bus
41  * errors in the "org.freedesktop.NetworkManager.AgentManager" namespace.
42  */
43 typedef enum {
44         NM_AGENT_MANAGER_ERROR_FAILED = 0,         /*< nick=Failed >*/
45         NM_AGENT_MANAGER_ERROR_PERMISSION_DENIED,  /*< nick=PermissionDenied >*/
46         NM_AGENT_MANAGER_ERROR_INVALID_IDENTIFIER, /*< nick=InvalidIdentifier >*/
47         NM_AGENT_MANAGER_ERROR_NOT_REGISTERED,     /*< nick=NotRegistered >*/
48         NM_AGENT_MANAGER_ERROR_NO_SECRETS,         /*< nick=NoSecrets >*/
49         NM_AGENT_MANAGER_ERROR_USER_CANCELED,      /*< nick=UserCanceled >*/
50 } NMAgentManagerError;
51
52 GQuark nm_agent_manager_error_quark (void);
53 #define NM_AGENT_MANAGER_ERROR (nm_agent_manager_error_quark ())
54
55 /**
56  * NMConnectionError:
57  * @NM_CONNECTION_ERROR_FAILED: unknown or unclassified error
58  * @NM_CONNECTION_ERROR_SETTING_NOT_FOUND: the #NMConnection object
59  *   did not contain the specified #NMSetting object
60  * @NM_CONNECTION_ERROR_PROPERTY_NOT_FOUND: the #NMConnection did not contain the
61  *   requested #NMSetting property
62  * @NM_CONNECTION_ERROR_PROPERTY_NOT_SECRET: an operation which requires a secret
63  *   was attempted on a non-secret property
64  * @NM_CONNECTION_ERROR_MISSING_SETTING: the #NMConnection object is missing an
65  *   #NMSetting which is required for its configuration. The error message will
66  *   always be prefixed with "&lt;setting-name>: ", where "&lt;setting-name>" is the
67  *   name of the setting that is missing.
68  * @NM_CONNECTION_ERROR_INVALID_SETTING: the #NMConnection object contains an
69  *   invalid or inappropriate #NMSetting. The error message will always be
70  *   prefixed with "&lt;setting-name>: ", where "&lt;setting-name>" is the name of the
71  *   setting that is invalid.
72  * @NM_CONNECTION_ERROR_MISSING_PROPERTY: the #NMConnection object is invalid
73  *   because it is missing a required property. The error message will always be
74  *   prefixed with "&lt;setting-name>.&lt;property-name>: ", where "&lt;setting-name>" is
75  *   the name of the setting with the missing property, and "&lt;property-name>" is
76  *   the property that is missing.
77  * @NM_CONNECTION_ERROR_INVALID_PROPERTY: the #NMConnection object is invalid
78  *   because a property has an invalid value. The error message will always be
79  *   prefixed with "&lt;setting-name>.&lt;property-name>: ", where "&lt;setting-name>" is
80  *   the name of the setting with the invalid property, and "&lt;property-name>" is
81  *   the property that is invalid.
82  *
83  * Describes errors that may result from operations involving a #NMConnection
84  * or its #NMSettings.
85  *
86  * These errors may be returned directly from #NMConnection and #NMSetting
87  * methods, or may be returned from D-Bus operations (eg on #NMClient or
88  * #NMDevice), where they correspond to errors in the
89  * "org.freedesktop.NetworkManager.Settings.Connection" namespace.
90  */
91 typedef enum {
92         NM_CONNECTION_ERROR_FAILED = 0,                   /*< nick=Failed >*/
93         NM_CONNECTION_ERROR_SETTING_NOT_FOUND,            /*< nick=SettingNotFound >*/
94         NM_CONNECTION_ERROR_PROPERTY_NOT_FOUND,           /*< nick=PropertyNotFound >*/
95         NM_CONNECTION_ERROR_PROPERTY_NOT_SECRET,          /*< nick=PropertyNotSecret >*/
96         NM_CONNECTION_ERROR_MISSING_SETTING,              /*< nick=MissingSetting >*/
97         NM_CONNECTION_ERROR_INVALID_SETTING,              /*< nick=InvalidSetting >*/
98         NM_CONNECTION_ERROR_MISSING_PROPERTY,             /*< nick=MissingProperty >*/
99         NM_CONNECTION_ERROR_INVALID_PROPERTY,             /*< nick=InvalidProperty >*/
100 } NMConnectionError;
101
102 #define NM_CONNECTION_ERROR nm_connection_error_quark ()
103 GQuark nm_connection_error_quark (void);
104
105 /**
106  * NMCryptoError:
107  * @NM_CRYPTO_ERROR_FAILED: generic failure
108  * @NM_CRYPTO_ERROR_INVALID_DATA: the certificate or key data provided
109  *   was invalid
110  * @NM_CRYPTO_ERROR_INVALID_PASSWORD: the password was invalid
111  * @NM_CRYPTO_ERROR_UNKNOWN_CIPHER: the data uses an unknown cipher
112  * @NM_CRYPTO_ERROR_DECRYPTION_FAILED: decryption failed
113  * @NM_CRYPTO_ERROR_ENCRYPTION_FAILED: encryption failed
114  *
115  * Cryptography-related errors that can be returned from some nm-utils methods,
116  * and some #NMSetting8021x operations.
117  */
118 typedef enum {
119         NM_CRYPTO_ERROR_FAILED = 0,
120         NM_CRYPTO_ERROR_INVALID_DATA,
121         NM_CRYPTO_ERROR_INVALID_PASSWORD,
122         NM_CRYPTO_ERROR_UNKNOWN_CIPHER,
123         NM_CRYPTO_ERROR_DECRYPTION_FAILED,
124         NM_CRYPTO_ERROR_ENCRYPTION_FAILED,
125 } NMCryptoError;
126
127 #define NM_CRYPTO_ERROR nm_crypto_error_quark ()
128 GQuark nm_crypto_error_quark (void);
129
130 /**
131  * NMDeviceError:
132  * @NM_DEVICE_ERROR_FAILED: unknown or unclassified error
133  * @NM_DEVICE_ERROR_CREATION_FAILED: NetworkManager failed to create the device
134  * @NM_DEVICE_ERROR_INVALID_CONNECTION: the specified connection is not valid
135  * @NM_DEVICE_ERROR_INCOMPATIBLE_CONNECTION: the specified connection is not
136  *   compatible with this device.
137  * @NM_DEVICE_ERROR_NOT_ACTIVE: the device does not have an active connection
138  * @NM_DEVICE_ERROR_NOT_SOFTWARE: the requested operation is only valid on
139  *   software devices.
140  * @NM_DEVICE_ERROR_NOT_ALLOWED: the requested operation is not allowed at
141  *   this time.
142  * @NM_DEVICE_ERROR_SPECIFIC_OBJECT_NOT_FOUND: the "specific object" in the
143  *   activation request (eg, the #NMAccessPoint or #NMWimaxNsp) was not
144  *   found.
145  * @NM_DEVICE_ERROR_VERSION_ID_MISMATCH: the version id did not match.
146  *
147  * Device-related errors.
148  *
149  * These errors may be returned directly from #NMDevice methods, or may be
150  * returned from D-Bus operations (where they correspond to errors in the
151  * "org.freedesktop.NetworkManager.Device" namespace).
152  */
153 typedef enum {
154         NM_DEVICE_ERROR_FAILED = 0,                /*< nick=Failed >*/
155         NM_DEVICE_ERROR_CREATION_FAILED,           /*< nick=CreationFailed >*/
156         NM_DEVICE_ERROR_INVALID_CONNECTION,        /*< nick=InvalidConnection >*/
157         NM_DEVICE_ERROR_INCOMPATIBLE_CONNECTION,   /*< nick=IncompatibleConnection >*/
158         NM_DEVICE_ERROR_NOT_ACTIVE,                /*< nick=NotActive >*/
159         NM_DEVICE_ERROR_NOT_SOFTWARE,              /*< nick=NotSoftware >*/
160         NM_DEVICE_ERROR_NOT_ALLOWED,               /*< nick=NotAllowed >*/
161         NM_DEVICE_ERROR_SPECIFIC_OBJECT_NOT_FOUND, /*< nick=SpecificObjectNotFound >*/
162         NM_DEVICE_ERROR_VERSION_ID_MISMATCH,       /*< nick=VersionIdMismatch >*/
163 } NMDeviceError;
164
165 #define NM_DEVICE_ERROR nm_device_error_quark ()
166 GQuark nm_device_error_quark (void);
167
168 /**
169  * NMManagerError:
170  * @NM_MANAGER_ERROR_FAILED: unknown or unclassified error
171  * @NM_MANAGER_ERROR_PERMISSION_DENIED: Permission denied.
172  * @NM_MANAGER_ERROR_UNKNOWN_CONNECTION: The requested connection is not known.
173  * @NM_MANAGER_ERROR_UNKNOWN_DEVICE: The requested device is not known.
174  * @NM_MANAGER_ERROR_CONNECTION_NOT_AVAILABLE: The requested connection cannot be
175  *   activated at this time.
176  * @NM_MANAGER_ERROR_CONNECTION_NOT_ACTIVE: The request could not be completed
177  *   because a required connection is not active.
178  * @NM_MANAGER_ERROR_CONNECTION_ALREADY_ACTIVE: The connection to be activated was
179  *   already active on another device.
180  * @NM_MANAGER_ERROR_DEPENDENCY_FAILED: An activation request failed due to a
181  *   dependency being unavailable.
182  * @NM_MANAGER_ERROR_ALREADY_ASLEEP_OR_AWAKE: The manager is already in the requested
183  *   sleep/wake state.
184  * @NM_MANAGER_ERROR_ALREADY_ENABLED_OR_DISABLED: The network is already
185  *   enabled/disabled.
186  * @NM_MANAGER_ERROR_UNKNOWN_LOG_LEVEL: Unknown log level in SetLogging
187  * @NM_MANAGER_ERROR_UNKNOWN_LOG_DOMAIN: Unknown log domain in SetLogging
188  *
189  * Errors related to the main "network management" interface of NetworkManager.
190  * These may be returned from #NMClient methods that invoke D-Bus operations on
191  * the "org.freedesktop.NetworkManager" interface, and correspond to D-Bus
192  * errors in that namespace.
193  */
194 typedef enum {
195         NM_MANAGER_ERROR_FAILED = 0,                  /*< nick=Failed >*/
196         NM_MANAGER_ERROR_PERMISSION_DENIED,           /*< nick=PermissionDenied >*/
197         NM_MANAGER_ERROR_UNKNOWN_CONNECTION,          /*< nick=UnknownConnection >*/
198         NM_MANAGER_ERROR_UNKNOWN_DEVICE,              /*< nick=UnknownDevice >*/
199         NM_MANAGER_ERROR_CONNECTION_NOT_AVAILABLE,    /*< nick=ConnectionNotAvailable >*/
200         NM_MANAGER_ERROR_CONNECTION_NOT_ACTIVE,       /*< nick=ConnectionNotActive >*/
201         NM_MANAGER_ERROR_CONNECTION_ALREADY_ACTIVE,   /*< nick=ConnectionAlreadyActive >*/
202         NM_MANAGER_ERROR_DEPENDENCY_FAILED,           /*< nick=DependencyFailed >*/
203         NM_MANAGER_ERROR_ALREADY_ASLEEP_OR_AWAKE,     /*< nick=AlreadyAsleepOrAwake >*/
204         NM_MANAGER_ERROR_ALREADY_ENABLED_OR_DISABLED, /*< nick=AlreadyEnabledOrDisabled >*/
205         NM_MANAGER_ERROR_UNKNOWN_LOG_LEVEL,           /*< nick=UnknownLogLevel >*/
206         NM_MANAGER_ERROR_UNKNOWN_LOG_DOMAIN,          /*< nick=UnknownLogDomain >*/
207 } NMManagerError;
208
209 GQuark nm_manager_error_quark (void);
210 #define NM_MANAGER_ERROR (nm_manager_error_quark ())
211
212 /**
213  * NMSecretAgentError:
214  * @NM_SECRET_AGENT_ERROR_FAILED: unknown or unclassified error
215  * @NM_SECRET_AGENT_ERROR_PERMISSION_DENIED: the caller (ie, NetworkManager) is
216  *   not authorized to make this request
217  * @NM_SECRET_AGENT_ERROR_INVALID_CONNECTION: the connection for which secrets
218  *   were requested is invalid
219  * @NM_SECRET_AGENT_ERROR_USER_CANCELED: the request was canceled by the user
220  * @NM_SECRET_AGENT_ERROR_AGENT_CANCELED: the agent canceled the request
221  *   because it was requested to do so by NetworkManager
222  * @NM_SECRET_AGENT_ERROR_NO_SECRETS: the agent cannot find any secrets for this
223  *   connection
224  *
225  * #NMSecretAgentError values are passed by secret agents back to NetworkManager
226  * when they encounter problems retrieving secrets on behalf of NM. They
227  * correspond to errors in the "org.freedesktop.NetworkManager.SecretManager"
228  * namespace.
229  *
230  * Client APIs such as nm_client_activate_connection() will not see these error
231  * codes; instead, the secret agent manager will translate them to the
232  * corresponding #NMAgentManagerError codes.
233  */
234 typedef enum {
235         NM_SECRET_AGENT_ERROR_FAILED = 0,         /*< nick=Failed >*/
236         NM_SECRET_AGENT_ERROR_PERMISSION_DENIED,  /*< nick=PermissionDenied >*/
237         NM_SECRET_AGENT_ERROR_INVALID_CONNECTION, /*< nick=InvalidConnection >*/
238         NM_SECRET_AGENT_ERROR_USER_CANCELED,      /*< nick=UserCanceled >*/
239         NM_SECRET_AGENT_ERROR_AGENT_CANCELED,     /*< nick=AgentCanceled >*/
240         NM_SECRET_AGENT_ERROR_NO_SECRETS,         /*< nick=NoSecrets >*/
241 } NMSecretAgentError;
242
243 GQuark nm_secret_agent_error_quark (void);
244 #define NM_SECRET_AGENT_ERROR         (nm_secret_agent_error_quark ())
245
246 /**
247  * NMSettingsError:
248  * @NM_SETTINGS_ERROR_FAILED: unknown or unclassified error
249  * @NM_SETTINGS_ERROR_PERMISSION_DENIED: permission denied
250  * @NM_SETTINGS_ERROR_NOT_SUPPORTED: the requested operation is not supported by any
251  *   active settings backend
252  * @NM_SETTINGS_ERROR_INVALID_CONNECTION: the connection was invalid
253  * @NM_SETTINGS_ERROR_READ_ONLY_CONNECTION: attempted to modify a read-only connection
254  * @NM_SETTINGS_ERROR_UUID_EXISTS: a connection with that UUID already exists
255  * @NM_SETTINGS_ERROR_INVALID_HOSTNAME: attempted to set an invalid hostname
256  *
257  * Errors related to the settings/persistent configuration interface of
258  * NetworkManager.
259  *
260  * These may be returned from #NMClient methods that invoke D-Bus operations on
261  * the "org.freedesktop.NetworkManager.Settings" interface, and correspond to
262  * D-Bus errors in that namespace.
263  */
264 typedef enum {
265         NM_SETTINGS_ERROR_FAILED = 0,           /*< nick=Failed >*/
266         NM_SETTINGS_ERROR_PERMISSION_DENIED,    /*< nick=PermissionDenied >*/
267         NM_SETTINGS_ERROR_NOT_SUPPORTED,        /*< nick=NotSupported >*/
268         NM_SETTINGS_ERROR_INVALID_CONNECTION,   /*< nick=InvalidConnection >*/
269         NM_SETTINGS_ERROR_READ_ONLY_CONNECTION, /*< nick=ReadOnlyConnection >*/
270         NM_SETTINGS_ERROR_UUID_EXISTS,          /*< nick=UuidExists >*/
271         NM_SETTINGS_ERROR_INVALID_HOSTNAME,     /*< nick=InvalidHostname >*/
272 } NMSettingsError;
273
274 GQuark nm_settings_error_quark (void);
275 #define NM_SETTINGS_ERROR (nm_settings_error_quark ())
276
277 /**
278  * NMVpnPluginError:
279  * @NM_VPN_PLUGIN_ERROR_FAILED: unknown or unclassified error
280  * @NM_VPN_PLUGIN_ERROR_STARTING_IN_PROGRESS: the plugin is already starting,
281  *   and another connect request was received
282  * @NM_VPN_PLUGIN_ERROR_ALREADY_STARTED: the plugin is already connected, and
283  *   another connect request was received
284  * @NM_VPN_PLUGIN_ERROR_STOPPING_IN_PROGRESS: the plugin is already stopping,
285  *   and another stop request was received
286  * @NM_VPN_PLUGIN_ERROR_ALREADY_STOPPED: the plugin is already stopped, and
287  *   another disconnect request was received
288  * @NM_VPN_PLUGIN_ERROR_WRONG_STATE: the operation could not be performed in
289  *   this state
290  * @NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS: the operation could not be performed as
291  *   the request contained malformed arguments, or arguments of unexpected type.
292  *   Usually means that one of the VPN setting data items or secrets was not of
293  *   the expected type (ie int, string, bool, etc).
294  * @NM_VPN_PLUGIN_ERROR_LAUNCH_FAILED: a child process failed to launch
295  * @NM_VPN_PLUGIN_ERROR_INVALID_CONNECTION: the operation could not be performed
296  *   because the connection was invalid.  Usually means that the connection's
297  *   VPN setting was missing some required data item or secret.
298  * @NM_VPN_PLUGIN_ERROR_INTERACTIVE_NOT_SUPPORTED: the operation could not be
299  *   performed as the plugin does not support interactive operations, such as
300  *   ConnectInteractive() or NewSecrets()
301  *
302  * Returned by the VPN service plugin to indicate errors. These codes correspond
303  * to errors in the "org.freedesktop.NetworkManager.VPN.Error" namespace.
304  **/
305 typedef enum {
306         NM_VPN_PLUGIN_ERROR_FAILED,                    /*< nick=Failed >*/
307         NM_VPN_PLUGIN_ERROR_STARTING_IN_PROGRESS,      /*< nick=StartingInProgress >*/
308         NM_VPN_PLUGIN_ERROR_ALREADY_STARTED,           /*< nick=AlreadyStarted >*/
309         NM_VPN_PLUGIN_ERROR_STOPPING_IN_PROGRESS,      /*< nick=StoppingInProgress >*/
310         NM_VPN_PLUGIN_ERROR_ALREADY_STOPPED,           /*< nick=AlreadyStopped >*/
311         NM_VPN_PLUGIN_ERROR_WRONG_STATE,               /*< nick=WrongState >*/
312         NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,             /*< nick=BadArguments >*/
313         NM_VPN_PLUGIN_ERROR_LAUNCH_FAILED,             /*< nick=LaunchFailed >*/
314         NM_VPN_PLUGIN_ERROR_INVALID_CONNECTION,        /*< nick=InvalidConnection >*/
315         NM_VPN_PLUGIN_ERROR_INTERACTIVE_NOT_SUPPORTED, /*< nick=InteractiveNotSupported >*/
316 } NMVpnPluginError;
317
318 #define NM_VPN_PLUGIN_ERROR      (nm_vpn_plugin_error_quark ())
319 GQuark nm_vpn_plugin_error_quark    (void);
320
321 #endif /* __NM_ERRORS_H__ */