[network-manager-openswan/lr/libnm: 5/10] service: port to libnm
- From: Lubomir Rintel <lkundrak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-openswan/lr/libnm: 5/10] service: port to libnm
- Date: Sat, 15 Aug 2015 23:07:27 +0000 (UTC)
commit fa6beb89fa62de77e8499b9c3154c36d65524161
Author: Lubomir Rintel <lkundrak v3 sk>
Date: Fri Jul 24 19:03:04 2015 +0200
service: port to libnm
src/Makefile.am | 6 ++--
src/nm-openswan-service-helper.c | 2 +-
src/nm-openswan-service.c | 64 +++++++++++++++++++-------------------
3 files changed, 36 insertions(+), 36 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index d8a1b2a..3309abb 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,7 +1,7 @@
AM_CPPFLAGS = \
$(DBUS_CFLAGS) \
$(GLIB_CFLAGS) \
- $(LIBNM_GLIB_CFLAGS) \
+ $(LIBNM_CFLAGS) \
$(LIBNL_CFLAGS) \
-DG_DISABLE_DEPRECATED \
-DBINDIR=\"$(bindir)\" \
@@ -23,7 +23,7 @@ nm_openswan_service_SOURCES = \
nm_openswan_service_LDADD = \
$(DBUS_LIBS) \
$(GLIB_LIBS) \
- $(LIBNM_GLIB_LIBS) \
+ $(LIBNM_LIBS) \
-lutil
nm_openswan_service_helper_SOURCES = \
@@ -31,7 +31,7 @@ nm_openswan_service_helper_SOURCES = \
nm_openswan_service_helper_LDADD = \
$(DBUS_LIBS) \
- $(LIBNM_GLIB_LIBS) \
+ $(LIBNM_LIBS) \
$(LIBNL_LIBS)
install-exec-hook:
diff --git a/src/nm-openswan-service-helper.c b/src/nm-openswan-service-helper.c
index ac4dfd7..f527c8b 100644
--- a/src/nm-openswan-service-helper.c
+++ b/src/nm-openswan-service-helper.c
@@ -41,7 +41,7 @@
#include <dbus/dbus-glib.h>
#include <NetworkManager.h>
-#include <nm-vpn-plugin.h>
+#include <nm-vpn-service-plugin.h>
#include "nm-openswan-service.h"
#include "nm-utils.h"
diff --git a/src/nm-openswan-service.c b/src/nm-openswan-service.c
index 2251cf1..3303ecb 100644
--- a/src/nm-openswan-service.c
+++ b/src/nm-openswan-service.c
@@ -35,8 +35,8 @@
#include <glib/gi18n.h>
-#include <nm-vpn-plugin.h>
-#include <nm-setting-vpn.h>
+#include <NetworkManager.h>
+#include <nm-vpn-service-plugin.h>
#include "nm-openswan-service.h"
#include "nm-utils.h"
@@ -47,12 +47,12 @@
#define NM_TYPE_OPENSWAN_PLUGIN (nm_openswan_plugin_get_type ())
#define NM_OPENSWAN_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_OPENSWAN_PLUGIN,
NMOpenSwanPlugin))
-typedef NMVPNPlugin NMOpenSwanPlugin;
-typedef NMVPNPluginClass NMOpenSwanPluginClass;
+typedef NMVpnServicePlugin NMOpenSwanPlugin;
+typedef NMVpnServicePluginClass NMOpenSwanPluginClass;
static GType nm_openswan_plugin_get_type (void);
-G_DEFINE_TYPE (NMOpenSwanPlugin, nm_openswan_plugin, NM_TYPE_VPN_PLUGIN)
+G_DEFINE_TYPE (NMOpenSwanPlugin, nm_openswan_plugin, NM_TYPE_VPN_SERVICE_PLUGIN)
/************************************************************/
@@ -225,7 +225,7 @@ validate_one_property (const char *key, const char *value, gpointer user_data)
}
static gboolean
-nm_openswan_properties_validate (NMSettingVPN *s_vpn, GError **error)
+nm_openswan_properties_validate (NMSettingVpn *s_vpn, GError **error)
{
ValidateInfo info = { &valid_properties[0], error, FALSE };
@@ -242,7 +242,7 @@ nm_openswan_properties_validate (NMSettingVPN *s_vpn, GError **error)
}
static gboolean
-nm_openswan_secrets_validate (NMSettingVPN *s_vpn, GError **error)
+nm_openswan_secrets_validate (NMSettingVpn *s_vpn, GError **error)
{
GError *validate_error = NULL;
ValidateInfo info = { &valid_secrets[0], &validate_error, FALSE };
@@ -428,7 +428,7 @@ static void
connect_failed (NMOpenSwanPlugin *self,
gboolean do_stop,
GError *error,
- NMVPNConnectionStateReason reason)
+ NMVpnConnectionStateReason reason)
{
if (error) {
g_warning ("Connect failed: (%s/%d) %s",
@@ -440,7 +440,7 @@ connect_failed (NMOpenSwanPlugin *self,
connect_cleanup (self);
if (do_stop)
ipsec_stop (self, NULL);
- nm_vpn_plugin_failure (NM_VPN_PLUGIN (self), reason);
+ nm_vpn_service_plugin_failure (NM_VPN_SERVICE_PLUGIN (self), reason);
}
static void
@@ -574,7 +574,7 @@ nm_openswan_config_write (gint fd,
gboolean libreswan,
GError **error)
{
- NMSettingVPN *s_vpn = nm_connection_get_setting_vpn (connection);
+ NMSettingVpn *s_vpn = nm_connection_get_setting_vpn (connection);
const char *con_name = nm_connection_get_uuid (connection);
const char *props_username;
const char *default_username;
@@ -638,7 +638,7 @@ nm_openswan_config_write (gint fd,
}
static gboolean
-nm_openswan_config_psk_write (NMSettingVPN *s_vpn,
+nm_openswan_config_psk_write (NMSettingVpn *s_vpn,
const char *secrets_path,
GError **error)
{
@@ -845,7 +845,7 @@ io_cb (GIOChannel *source, GIOCondition condition, gpointer user_data)
GIOStatus status;
gsize bytes_read = 0;
gboolean success = FALSE;
- NMVPNConnectionStateReason reason = NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED;
+ NMVpnConnectionStateReason reason = NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED;
const char *found;
if (condition & (G_IO_ERR | G_IO_HUP)) {
@@ -887,7 +887,7 @@ io_cb (GIOChannel *source, GIOCondition condition, gpointer user_data)
priv->pending_auth = TRUE;
if (priv->interactive) {
DEBUG ("Requesting new secrets: '%s' (%s)", message, hints[0]);
- nm_vpn_plugin_secrets_required (NM_VPN_PLUGIN (self), message, hints);
+ nm_vpn_service_plugin_secrets_required (NM_VPN_SERVICE_PLUGIN (self),
message, hints);
} else {
/* Interactive not allowed, can't ask for more secrets */
g_warning ("More secrets required but cannot ask interactively");
@@ -1058,14 +1058,14 @@ is_libreswan (const char *path)
}
static gboolean
-_connect_common (NMVPNPlugin *plugin,
+_connect_common (NMVpnServicePlugin *plugin,
NMConnection *connection,
- GHashTable *details,
+ GVariant *details,
GError **error)
{
NMOpenSwanPlugin *self = NM_OPENSWAN_PLUGIN (plugin);
NMOpenSwanPluginPrivate *priv = NM_OPENSWAN_PLUGIN_GET_PRIVATE (self);
- NMSettingVPN *s_vpn;
+ NMSettingVpn *s_vpn;
const char *con_name = nm_connection_get_uuid (connection);
if (debug)
@@ -1120,7 +1120,7 @@ _connect_common (NMVPNPlugin *plugin,
}
static gboolean
-real_connect (NMVPNPlugin *plugin,
+real_connect (NMVpnServicePlugin *plugin,
NMConnection *connection,
GError **error)
{
@@ -1128,9 +1128,9 @@ real_connect (NMVPNPlugin *plugin,
}
static gboolean
-real_connect_interactive (NMVPNPlugin *plugin,
+real_connect_interactive (NMVpnServicePlugin *plugin,
NMConnection *connection,
- GHashTable *details,
+ GVariant *details,
GError **error)
{
if (!_connect_common (plugin, connection, details, error))
@@ -1141,22 +1141,22 @@ real_connect_interactive (NMVPNPlugin *plugin,
}
static gboolean
-real_need_secrets (NMVPNPlugin *plugin,
+real_need_secrets (NMVpnServicePlugin *plugin,
NMConnection *connection,
- char **setting_name,
+ const char **setting_name,
GError **error)
{
- NMSettingVPN *s_vpn;
+ NMSettingVpn *s_vpn;
const char *pw_type;
- g_return_val_if_fail (NM_IS_VPN_PLUGIN (plugin), FALSE);
+ g_return_val_if_fail (NM_IS_VPN_SERVICE_PLUGIN (plugin), FALSE);
g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
s_vpn = nm_connection_get_setting_vpn (connection);
if (!s_vpn) {
g_set_error_literal (error,
NM_VPN_PLUGIN_ERROR,
- NM_VPN_PLUGIN_ERROR_CONNECTION_INVALID,
+ NM_VPN_PLUGIN_ERROR_INVALID_CONNECTION,
"Could not process the request because the VPN connection settings were
invalid.");
return FALSE;
}
@@ -1181,13 +1181,13 @@ real_need_secrets (NMVPNPlugin *plugin,
}
static gboolean
-real_new_secrets (NMVPNPlugin *plugin,
+real_new_secrets (NMVpnServicePlugin *plugin,
NMConnection *connection,
GError **error)
{
NMOpenSwanPlugin *self = NM_OPENSWAN_PLUGIN (plugin);
NMOpenSwanPluginPrivate *priv = NM_OPENSWAN_PLUGIN_GET_PRIVATE (self);
- NMSettingVPN *s_vpn;
+ NMSettingVpn *s_vpn;
const char *message = NULL;
const char *hints[] = { NULL, NULL };
@@ -1195,7 +1195,7 @@ real_new_secrets (NMVPNPlugin *plugin,
if (!s_vpn) {
g_set_error_literal (error,
NM_VPN_PLUGIN_ERROR,
- NM_VPN_PLUGIN_ERROR_CONNECTION_INVALID,
+ NM_VPN_PLUGIN_ERROR_INVALID_CONNECTION,
_("Could not process the request because the VPN connection settings
were invalid."));
return FALSE;
}
@@ -1209,7 +1209,7 @@ real_new_secrets (NMVPNPlugin *plugin,
if (!handle_auth (self, &message, &hints[0])) {
g_set_error_literal (error,
NM_VPN_PLUGIN_ERROR,
- NM_VPN_PLUGIN_ERROR_GENERAL,
+ NM_VPN_PLUGIN_ERROR_FAILED,
_("Unhandled pending authentication."));
return FALSE;
}
@@ -1217,14 +1217,14 @@ real_new_secrets (NMVPNPlugin *plugin,
/* Request new secrets if we need any */
if (message) {
DEBUG ("Requesting new secrets: '%s'", message);
- nm_vpn_plugin_secrets_required (plugin, message, hints);
+ nm_vpn_service_plugin_secrets_required (plugin, message, hints);
}
return TRUE;
}
static gboolean
-real_disconnect (NMVPNPlugin *plugin, GError **error)
+real_disconnect (NMVpnServicePlugin *plugin, GError **error)
{
connect_cleanup (NM_OPENSWAN_PLUGIN (plugin));
return ipsec_stop (NM_OPENSWAN_PLUGIN (plugin), error);
@@ -1248,7 +1248,7 @@ static void
nm_openswan_plugin_class_init (NMOpenSwanPluginClass *openswan_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (openswan_class);
- NMVPNPluginClass *parent_class = NM_VPN_PLUGIN_CLASS (openswan_class);
+ NMVpnServicePluginClass *parent_class = NM_VPN_SERVICE_PLUGIN_CLASS (openswan_class);
g_type_class_add_private (object_class, sizeof (NMOpenSwanPluginPrivate));
@@ -1332,7 +1332,7 @@ main (int argc, char *argv[])
g_message ("%s (version " DIST_VERSION ") starting...", argv[0]);
plugin = g_object_new (NM_TYPE_OPENSWAN_PLUGIN,
- NM_VPN_PLUGIN_DBUS_SERVICE_NAME, NM_DBUS_SERVICE_OPENSWAN,
+ NM_VPN_SERVICE_PLUGIN_DBUS_SERVICE_NAME, NM_DBUS_SERVICE_OPENSWAN,
NULL);
if (!plugin)
exit (1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]