mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-03 13:40:39 +01:00
libnm-core, libnm: move NMVpnPluginError to nm-errors
Move the definition of NMVpnPluginError to nm-errors and register it with D-Bus. Rename GENERAL to FAILED, and CONNECTION_INVALID to INVALID_CONNECTION, for consistency. (As with the NMSecretAgentError renamings, the renaming here is not an ABI break, because the daemon currently never checks for any specific error codes other than INTERACTIVE_NOT_SUPPORTED.)
This commit is contained in:
parent
821258048b
commit
5a181bcaae
4 changed files with 53 additions and 60 deletions
|
|
@ -24,6 +24,7 @@
|
|||
#include "nm-errors.h"
|
||||
#include "nm-glib-compat.h"
|
||||
#include "nm-dbus-interface.h"
|
||||
#include "nm-vpn-dbus-interface.h"
|
||||
#include "nm-core-internal.h"
|
||||
|
||||
G_DEFINE_QUARK (nm-agent-manager-error-quark, nm_agent_manager_error)
|
||||
|
|
@ -33,6 +34,7 @@ G_DEFINE_QUARK (nm-device-error-quark, nm_device_error)
|
|||
G_DEFINE_QUARK (nm-manager-error-quark, nm_manager_error)
|
||||
G_DEFINE_QUARK (nm-secret-agent-error-quark, nm_secret_agent_error)
|
||||
G_DEFINE_QUARK (nm-settings-error-quark, nm_settings_error)
|
||||
G_DEFINE_QUARK (nm-vpn-plugin-quark, nm_vpn_plugin_error)
|
||||
|
||||
static void
|
||||
register_error_domain (GQuark domain,
|
||||
|
|
@ -77,4 +79,10 @@ _nm_dbus_errors_init (void)
|
|||
register_error_domain (NM_SETTINGS_ERROR,
|
||||
NM_DBUS_INTERFACE_SETTINGS,
|
||||
NM_TYPE_SETTINGS_ERROR);
|
||||
register_error_domain (NM_SETTINGS_ERROR,
|
||||
NM_DBUS_INTERFACE_SETTINGS,
|
||||
NM_TYPE_SETTINGS_ERROR);
|
||||
register_error_domain (NM_VPN_PLUGIN_ERROR,
|
||||
NM_VPN_DBUS_PLUGIN_INTERFACE,
|
||||
NM_TYPE_VPN_PLUGIN_ERROR);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -272,4 +272,48 @@ typedef enum {
|
|||
GQuark nm_settings_error_quark (void);
|
||||
#define NM_SETTINGS_ERROR (nm_settings_error_quark ())
|
||||
|
||||
/**
|
||||
* NMVpnPluginError:
|
||||
* @NM_VPN_PLUGIN_ERROR_FAILED: unknown or unclassified error
|
||||
* @NM_VPN_PLUGIN_ERROR_STARTING_IN_PROGRESS: the plugin is already starting,
|
||||
* and another connect request was received
|
||||
* @NM_VPN_PLUGIN_ERROR_ALREADY_STARTED: the plugin is already connected, and
|
||||
* another connect request was received
|
||||
* @NM_VPN_PLUGIN_ERROR_STOPPING_IN_PROGRESS: the plugin is already stopping,
|
||||
* and another stop request was received
|
||||
* @NM_VPN_PLUGIN_ERROR_ALREADY_STOPPED: the plugin is already stopped, and
|
||||
* another disconnect request was received
|
||||
* @NM_VPN_PLUGIN_ERROR_WRONG_STATE: the operation could not be performed in
|
||||
* this state
|
||||
* @NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS: the operation could not be performed as
|
||||
* the request contained malformed arguments, or arguments of unexpected type.
|
||||
* Usually means that one of the VPN setting data items or secrets was not of
|
||||
* the expected type (ie int, string, bool, etc).
|
||||
* @NM_VPN_PLUGIN_ERROR_LAUNCH_FAILED: a child process failed to launch
|
||||
* @NM_VPN_PLUGIN_ERROR_INVALID_CONNECTION: the operation could not be performed
|
||||
* because the connection was invalid. Usually means that the connection's
|
||||
* VPN setting was missing some required data item or secret.
|
||||
* @NM_VPN_PLUGIN_ERROR_INTERACTIVE_NOT_SUPPORTED: the operation could not be
|
||||
* performed as the plugin does not support interactive operations, such as
|
||||
* ConnectInteractive() or NewSecrets()
|
||||
*
|
||||
* Returned by the VPN service plugin to indicate errors. These codes correspond
|
||||
* to errors in the "org.freedesktop.NetworkManager.VPN.Error" namespace.
|
||||
**/
|
||||
typedef enum {
|
||||
NM_VPN_PLUGIN_ERROR_FAILED, /*< nick=Failed >*/
|
||||
NM_VPN_PLUGIN_ERROR_STARTING_IN_PROGRESS, /*< nick=StartingInProgress >*/
|
||||
NM_VPN_PLUGIN_ERROR_ALREADY_STARTED, /*< nick=AlreadyStarted >*/
|
||||
NM_VPN_PLUGIN_ERROR_STOPPING_IN_PROGRESS, /*< nick=StoppingInProgress >*/
|
||||
NM_VPN_PLUGIN_ERROR_ALREADY_STOPPED, /*< nick=AlreadyStopped >*/
|
||||
NM_VPN_PLUGIN_ERROR_WRONG_STATE, /*< nick=WrongState >*/
|
||||
NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, /*< nick=BadArguments >*/
|
||||
NM_VPN_PLUGIN_ERROR_LAUNCH_FAILED, /*< nick=LaunchFailed >*/
|
||||
NM_VPN_PLUGIN_ERROR_INVALID_CONNECTION, /*< nick=InvalidConnection >*/
|
||||
NM_VPN_PLUGIN_ERROR_INTERACTIVE_NOT_SUPPORTED, /*< nick=InteractiveNotSupported >*/
|
||||
} NMVpnPluginError;
|
||||
|
||||
#define NM_VPN_PLUGIN_ERROR (nm_vpn_plugin_error_quark ())
|
||||
GQuark nm_vpn_plugin_error_quark (void);
|
||||
|
||||
#endif /* __NM_ERRORS_H__ */
|
||||
|
|
|
|||
|
|
@ -91,18 +91,6 @@ enum {
|
|||
static GSList *active_plugins = NULL;
|
||||
|
||||
|
||||
GQuark
|
||||
nm_vpn_plugin_error_quark (void)
|
||||
{
|
||||
static GQuark quark = 0;
|
||||
|
||||
if (!quark)
|
||||
quark = g_quark_from_static_string ("nm_vpn_plugin_error");
|
||||
|
||||
return quark;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
nm_vpn_plugin_set_connection (NMVpnPlugin *plugin,
|
||||
GDBusConnection *connection)
|
||||
|
|
@ -490,7 +478,7 @@ impl_vpn_plugin_need_secrets (NMVpnPlugin *plugin,
|
|||
if (!connection) {
|
||||
g_dbus_method_invocation_return_error (context,
|
||||
NM_VPN_PLUGIN_ERROR,
|
||||
NM_VPN_PLUGIN_ERROR_CONNECTION_INVALID,
|
||||
NM_VPN_PLUGIN_ERROR_INVALID_CONNECTION,
|
||||
"The connection was invalid: %s",
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
|
|
@ -1033,10 +1021,6 @@ nm_vpn_plugin_class_init (NMVpnPluginClass *plugin_class)
|
|||
G_TYPE_NONE, 0,
|
||||
G_TYPE_NONE);
|
||||
|
||||
_nm_dbus_register_error_domain (NM_VPN_PLUGIN_ERROR,
|
||||
NM_DBUS_VPN_ERROR_PREFIX,
|
||||
NM_TYPE_VPN_PLUGIN_ERROR);
|
||||
|
||||
setup_unix_signal_handler ();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,48 +42,6 @@ G_BEGIN_DECLS
|
|||
#define NM_VPN_PLUGIN_DBUS_SERVICE_NAME "service-name"
|
||||
#define NM_VPN_PLUGIN_STATE "state"
|
||||
|
||||
/**
|
||||
* NMVpnPluginError:
|
||||
* @NM_VPN_PLUGIN_ERROR_GENERAL: general failure
|
||||
* @NM_VPN_PLUGIN_ERROR_STARTING_IN_PROGRESS: the plugin is already starting,
|
||||
* and another connect request was received
|
||||
* @NM_VPN_PLUGIN_ERROR_ALREADY_STARTED: the plugin is already connected, and
|
||||
* another connect request was received
|
||||
* @NM_VPN_PLUGIN_ERROR_STOPPING_IN_PROGRESS: the plugin is already stopping,
|
||||
* and another stop request was received
|
||||
* @NM_VPN_PLUGIN_ERROR_ALREADY_STOPPED: the plugin is already stopped, and
|
||||
* another disconnect request was received
|
||||
* @NM_VPN_PLUGIN_ERROR_WRONG_STATE: the operation could not be performed in
|
||||
* this state
|
||||
* @NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS: the operation could not be performed as
|
||||
* the request contained malformed arguments, or arguments of unexpected type.
|
||||
* Usually means that one of the VPN setting data items or secrets was not of
|
||||
* the expected type (ie int, string, bool, etc).
|
||||
* @NM_VPN_PLUGIN_ERROR_LAUNCH_FAILED: a child process failed to launch
|
||||
* @NM_VPN_PLUGIN_ERROR_CONNECTION_INVALID: the operation could not be performed
|
||||
* because the connection was invalid. Usually means that the connection's
|
||||
* VPN setting was missing some required data item or secret.
|
||||
* @NM_VPN_PLUGIN_ERROR_INTERACTIVE_NOT_SUPPORTED: the operation could not be
|
||||
* performed as the plugin does not support interactive operations, such as
|
||||
* ConnectInteractive() or NewSecrets()
|
||||
*
|
||||
* Returned by the VPN service plugin to indicate errors.
|
||||
**/
|
||||
typedef enum {
|
||||
NM_VPN_PLUGIN_ERROR_GENERAL, /*< nick=General >*/
|
||||
NM_VPN_PLUGIN_ERROR_STARTING_IN_PROGRESS, /*< nick=StartingInProgress >*/
|
||||
NM_VPN_PLUGIN_ERROR_ALREADY_STARTED, /*< nick=AlreadyStarted >*/
|
||||
NM_VPN_PLUGIN_ERROR_STOPPING_IN_PROGRESS, /*< nick=StoppingInProgress >*/
|
||||
NM_VPN_PLUGIN_ERROR_ALREADY_STOPPED, /*< nick=AlreadyStopped >*/
|
||||
NM_VPN_PLUGIN_ERROR_WRONG_STATE, /*< nick=WrongState >*/
|
||||
NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, /*< nick=BadArguments >*/
|
||||
NM_VPN_PLUGIN_ERROR_LAUNCH_FAILED, /*< nick=LaunchFailed >*/
|
||||
NM_VPN_PLUGIN_ERROR_CONNECTION_INVALID, /*< nick=ConnectionInvalid >*/
|
||||
NM_VPN_PLUGIN_ERROR_INTERACTIVE_NOT_SUPPORTED /*< nick=InteractiveNotSupported >*/
|
||||
} NMVpnPluginError;
|
||||
|
||||
#define NM_VPN_PLUGIN_ERROR (nm_vpn_plugin_error_quark ())
|
||||
|
||||
typedef struct {
|
||||
GObject parent;
|
||||
} NMVpnPlugin;
|
||||
|
|
@ -139,7 +97,6 @@ typedef struct {
|
|||
} NMVpnPluginClass;
|
||||
|
||||
GType nm_vpn_plugin_get_type (void);
|
||||
GQuark nm_vpn_plugin_error_quark (void);
|
||||
|
||||
GDBusConnection *nm_vpn_plugin_get_connection (NMVpnPlugin *plugin);
|
||||
NMVpnServiceState nm_vpn_plugin_get_state (NMVpnPlugin *plugin);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue