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

source code of include/libnm/nm-errors.h