2007-08-30 Dan Williams <dcbw@redhat.com>
* src/Makefile.am src/NetworkManagerDbus.c src/NetworkManagerDbus.h src/vpn-manager/nm-dbus-vpn.c - Remove, no longer necessary. Move last bits to the only place its used, in nm-dbus-vpn.c * src/NetworkManagerAPList.c src/nm-device.c src/NetworkManager.c src/nm-device-802-11-wireless.c src/vpn-manager/nm-vpn-manager.c src/vpn-manager/nm-vpn-service.c src/NetworkManagerPolicy.c src/nm-manager.c - Remove usage of NetworkManagerDbus.h, and kill the obfuscation that was message_is_error() git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2757 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
20
ChangeLog
20
ChangeLog
@@ -1,3 +1,23 @@
|
|||||||
|
2007-08-30 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
|
* src/Makefile.am
|
||||||
|
src/NetworkManagerDbus.c
|
||||||
|
src/NetworkManagerDbus.h
|
||||||
|
src/vpn-manager/nm-dbus-vpn.c
|
||||||
|
- Remove, no longer necessary. Move last bits to the only place its
|
||||||
|
used, in nm-dbus-vpn.c
|
||||||
|
|
||||||
|
* src/NetworkManagerAPList.c
|
||||||
|
src/nm-device.c
|
||||||
|
src/NetworkManager.c
|
||||||
|
src/nm-device-802-11-wireless.c
|
||||||
|
src/vpn-manager/nm-vpn-manager.c
|
||||||
|
src/vpn-manager/nm-vpn-service.c
|
||||||
|
src/NetworkManagerPolicy.c
|
||||||
|
src/nm-manager.c
|
||||||
|
- Remove usage of NetworkManagerDbus.h, and kill the obfuscation
|
||||||
|
that was message_is_error()
|
||||||
|
|
||||||
2007-08-30 Dan Williams <dcbw@redhat.com>
|
2007-08-30 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
* libnm-util/sha1.c
|
* libnm-util/sha1.c
|
||||||
|
@@ -27,11 +27,9 @@ NetworkManager_SOURCES = \
|
|||||||
NetworkManagerAP.h \
|
NetworkManagerAP.h \
|
||||||
NetworkManagerAPList.c \
|
NetworkManagerAPList.c \
|
||||||
NetworkManagerAPList.h \
|
NetworkManagerAPList.h \
|
||||||
NetworkManagerDbus.c \
|
|
||||||
NetworkManagerDbus.h \
|
|
||||||
NetworkManagerDbusUtils.c \
|
NetworkManagerDbusUtils.c \
|
||||||
NetworkManagerDialup.h \
|
|
||||||
NetworkManagerDbusUtils.h \
|
NetworkManagerDbusUtils.h \
|
||||||
|
NetworkManagerDialup.h \
|
||||||
nm-dbus-manager.h \
|
nm-dbus-manager.h \
|
||||||
nm-dbus-manager.c \
|
nm-dbus-manager.c \
|
||||||
nm-hal-manager.c \
|
nm-hal-manager.c \
|
||||||
|
@@ -47,7 +47,6 @@
|
|||||||
#include "nm-device-802-3-ethernet.h"
|
#include "nm-device-802-3-ethernet.h"
|
||||||
#include "nm-device-802-11-wireless.h"
|
#include "nm-device-802-11-wireless.h"
|
||||||
#include "NetworkManagerPolicy.h"
|
#include "NetworkManagerPolicy.h"
|
||||||
#include "NetworkManagerDbus.h"
|
|
||||||
#include "NetworkManagerAP.h"
|
#include "NetworkManagerAP.h"
|
||||||
#include "NetworkManagerAPList.h"
|
#include "NetworkManagerAPList.h"
|
||||||
#include "NetworkManagerSystem.h"
|
#include "NetworkManagerSystem.h"
|
||||||
@@ -361,12 +360,6 @@ main (int argc, char *argv[])
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
nm_dbus_manager_register_signal_handler (dbus_mgr,
|
|
||||||
NMI_DBUS_INTERFACE,
|
|
||||||
NULL,
|
|
||||||
nm_dbus_nmi_signal_handler,
|
|
||||||
manager);
|
|
||||||
|
|
||||||
/* Initialize the supplicant manager */
|
/* Initialize the supplicant manager */
|
||||||
sup_mgr = nm_supplicant_manager_get ();
|
sup_mgr = nm_supplicant_manager_get ();
|
||||||
if (!sup_mgr) {
|
if (!sup_mgr) {
|
||||||
|
@@ -25,7 +25,6 @@
|
|||||||
#include "NetworkManagerAP.h"
|
#include "NetworkManagerAP.h"
|
||||||
#include "NetworkManagerAPList.h"
|
#include "NetworkManagerAPList.h"
|
||||||
#include "NetworkManagerUtils.h"
|
#include "NetworkManagerUtils.h"
|
||||||
#include "NetworkManagerDbus.h"
|
|
||||||
#include "nm-utils.h"
|
#include "nm-utils.h"
|
||||||
#include "nm-dbus-manager.h"
|
#include "nm-dbus-manager.h"
|
||||||
|
|
||||||
|
@@ -1,131 +0,0 @@
|
|||||||
/* NetworkManager -- Network link manager
|
|
||||||
*
|
|
||||||
* Dan Williams <dcbw@redhat.com>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
*
|
|
||||||
* (C) Copyright 2004 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
#include <dbus/dbus.h>
|
|
||||||
#include <dbus/dbus-glib-lowlevel.h>
|
|
||||||
#include <dbus/dbus-glib.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <iwlib.h>
|
|
||||||
#include <netinet/ether.h>
|
|
||||||
|
|
||||||
#include "NetworkManager.h"
|
|
||||||
#include "NetworkManagerUtils.h"
|
|
||||||
#include "nm-device.h"
|
|
||||||
#include "NetworkManagerDbus.h"
|
|
||||||
#include "NetworkManagerDbusUtils.h"
|
|
||||||
#include "NetworkManagerAP.h"
|
|
||||||
#include "NetworkManagerAPList.h"
|
|
||||||
#include "NetworkManagerPolicy.h"
|
|
||||||
#include "nm-utils.h"
|
|
||||||
#include "nm-dhcp-manager.h"
|
|
||||||
#include "nm-dbus-manager.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* nm_dbus_create_error_message
|
|
||||||
*
|
|
||||||
* Make a DBus error message
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
DBusMessage *
|
|
||||||
nm_dbus_create_error_message (DBusMessage *message,
|
|
||||||
const char *exception_namespace,
|
|
||||||
const char *exception,
|
|
||||||
const char *format,
|
|
||||||
...)
|
|
||||||
{
|
|
||||||
char *exception_text;
|
|
||||||
DBusMessage *reply_message;
|
|
||||||
va_list args;
|
|
||||||
char error_text[512];
|
|
||||||
|
|
||||||
va_start (args, format);
|
|
||||||
vsnprintf (error_text, 512, format, args);
|
|
||||||
va_end (args);
|
|
||||||
|
|
||||||
exception_text = g_strdup_printf ("%s.%s", exception_namespace, exception);
|
|
||||||
reply_message = dbus_message_new_error (message, exception_text, error_text);
|
|
||||||
g_free (exception_text);
|
|
||||||
|
|
||||||
return (reply_message);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DBusMessage *
|
|
||||||
nm_dbus_new_invalid_args_error (DBusMessage *replyto,
|
|
||||||
const char *namespace)
|
|
||||||
{
|
|
||||||
return nm_dbus_create_error_message (replyto,
|
|
||||||
namespace,
|
|
||||||
"InvalidArguments",
|
|
||||||
"Invalid method arguments.");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------*/
|
|
||||||
/* Handler code */
|
|
||||||
/*-------------------------------------------------------------*/
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
nm_dbus_nmi_signal_handler (DBusConnection *connection,
|
|
||||||
DBusMessage *message,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
NMManager *manager = NM_MANAGER (user_data);
|
|
||||||
const char * object_path;
|
|
||||||
gboolean handled = FALSE;
|
|
||||||
|
|
||||||
g_return_val_if_fail (manager != NULL, FALSE);
|
|
||||||
|
|
||||||
if (!(object_path = dbus_message_get_path (message)))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (strcmp (object_path, NMI_DBUS_PATH) != 0)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (dbus_message_is_signal (message, NMI_DBUS_INTERFACE, "WirelessNetworkUpdate")) {
|
|
||||||
char *network = NULL;
|
|
||||||
|
|
||||||
if (dbus_message_get_args (message,
|
|
||||||
NULL,
|
|
||||||
DBUS_TYPE_STRING, &network,
|
|
||||||
DBUS_TYPE_INVALID)) {
|
|
||||||
/* Update a single wireless network's data */
|
|
||||||
nm_debug ("NetworkManagerInfo triggered update of wireless network '%s'", network);
|
|
||||||
// FIXME: convert to connection update signal
|
|
||||||
handled = TRUE;
|
|
||||||
}
|
|
||||||
} else if (dbus_message_is_signal (message, NMI_DBUS_INTERFACE, "UserInterfaceActivated")) {
|
|
||||||
GSList *iter;
|
|
||||||
|
|
||||||
for (iter = nm_manager_get_devices (manager); iter; iter = iter-> next) {
|
|
||||||
NMDevice *device = NM_DEVICE (iter->data);
|
|
||||||
|
|
||||||
if (NM_IS_DEVICE_802_11_WIRELESS (device))
|
|
||||||
nm_device_802_11_wireless_reset_scan_interval (NM_DEVICE_802_11_WIRELESS (device));
|
|
||||||
}
|
|
||||||
|
|
||||||
handled = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return handled;
|
|
||||||
}
|
|
||||||
|
|
@@ -1,50 +0,0 @@
|
|||||||
/* NetworkManager -- Network link manager
|
|
||||||
*
|
|
||||||
* Dan Williams <dcbw@redhat.com>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
*
|
|
||||||
* (C) Copyright 2004 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NETWORK_MANAGER_DBUS_H
|
|
||||||
#define NETWORK_MANAGER_DBUS_H
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
#include <dbus/dbus.h>
|
|
||||||
#include <dbus/dbus-glib.h>
|
|
||||||
#include "NetworkManager.h"
|
|
||||||
#include "NetworkManagerMain.h"
|
|
||||||
#include "nm-device.h"
|
|
||||||
#include "nm-device-802-11-wireless.h"
|
|
||||||
#include "NetworkManagerAPList.h"
|
|
||||||
|
|
||||||
|
|
||||||
static inline gboolean message_is_error (DBusMessage *msg)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (msg != NULL, FALSE);
|
|
||||||
|
|
||||||
return (dbus_message_get_type (msg) == DBUS_MESSAGE_TYPE_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
DBusMessage * nm_dbus_create_error_message (DBusMessage *message, const char *exception_namespace, const char *exception, const char *format, ...);
|
|
||||||
|
|
||||||
DBusMessage * nm_dbus_new_invalid_args_error (DBusMessage *replyto, const char *namespace);
|
|
||||||
|
|
||||||
gboolean nm_dbus_nmi_signal_handler (DBusConnection *connection,
|
|
||||||
DBusMessage *message,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
#endif
|
|
@@ -32,7 +32,6 @@
|
|||||||
#include "NetworkManagerUtils.h"
|
#include "NetworkManagerUtils.h"
|
||||||
#include "NetworkManagerAP.h"
|
#include "NetworkManagerAP.h"
|
||||||
#include "NetworkManagerAPList.h"
|
#include "NetworkManagerAPList.h"
|
||||||
#include "NetworkManagerDbus.h"
|
|
||||||
#include "nm-activation-request.h"
|
#include "nm-activation-request.h"
|
||||||
#include "nm-utils.h"
|
#include "nm-utils.h"
|
||||||
#include "nm-device-interface.h"
|
#include "nm-device-interface.h"
|
||||||
|
@@ -25,7 +25,6 @@
|
|||||||
#include "NetworkManager.h"
|
#include "NetworkManager.h"
|
||||||
#include "nm-manager.h"
|
#include "nm-manager.h"
|
||||||
#include "nm-device.h"
|
#include "nm-device.h"
|
||||||
#include "NetworkManagerDbus.h"
|
|
||||||
#include "nm-activation-request.h"
|
#include "nm-activation-request.h"
|
||||||
|
|
||||||
typedef struct NMPolicy NMPolicy;
|
typedef struct NMPolicy NMPolicy;
|
||||||
|
@@ -36,7 +36,6 @@
|
|||||||
#include "nm-device-interface.h"
|
#include "nm-device-interface.h"
|
||||||
#include "nm-device-private.h"
|
#include "nm-device-private.h"
|
||||||
#include "NetworkManagerAPList.h"
|
#include "NetworkManagerAPList.h"
|
||||||
#include "NetworkManagerDbus.h"
|
|
||||||
#include "nm-utils.h"
|
#include "nm-utils.h"
|
||||||
#include "NetworkManagerUtils.h"
|
#include "NetworkManagerUtils.h"
|
||||||
#include "NetworkManagerPolicy.h"
|
#include "NetworkManagerPolicy.h"
|
||||||
|
@@ -28,7 +28,6 @@
|
|||||||
#include "nm-device-interface.h"
|
#include "nm-device-interface.h"
|
||||||
#include "nm-device.h"
|
#include "nm-device.h"
|
||||||
#include "nm-device-private.h"
|
#include "nm-device-private.h"
|
||||||
#include "NetworkManagerDbus.h"
|
|
||||||
#include "NetworkManagerPolicy.h"
|
#include "NetworkManagerPolicy.h"
|
||||||
#include "NetworkManagerUtils.h"
|
#include "NetworkManagerUtils.h"
|
||||||
#include "NetworkManagerSystem.h"
|
#include "NetworkManagerSystem.h"
|
||||||
|
@@ -8,7 +8,6 @@
|
|||||||
#include "nm-device-interface.h"
|
#include "nm-device-interface.h"
|
||||||
#include "nm-device-802-11-wireless.h"
|
#include "nm-device-802-11-wireless.h"
|
||||||
#include "NetworkManagerSystem.h"
|
#include "NetworkManagerSystem.h"
|
||||||
#include "NetworkManagerDbus.h"
|
|
||||||
|
|
||||||
static gboolean impl_manager_get_devices (NMManager *manager, GPtrArray **devices, GError **err);
|
static gboolean impl_manager_get_devices (NMManager *manager, GPtrArray **devices, GError **err);
|
||||||
static gboolean impl_manager_sleep (NMManager *manager, gboolean sleep, GError **err);
|
static gboolean impl_manager_sleep (NMManager *manager, gboolean sleep, GError **err);
|
||||||
|
@@ -23,7 +23,6 @@
|
|||||||
#include <dbus/dbus.h>
|
#include <dbus/dbus.h>
|
||||||
#include "NetworkManagerMain.h"
|
#include "NetworkManagerMain.h"
|
||||||
#include "nm-device.h"
|
#include "nm-device.h"
|
||||||
#include "NetworkManagerDbus.h"
|
|
||||||
#include "NetworkManagerUtils.h"
|
#include "NetworkManagerUtils.h"
|
||||||
#include "NetworkManagerVPN.h"
|
#include "NetworkManagerVPN.h"
|
||||||
#include "nm-dbus-vpn.h"
|
#include "nm-dbus-vpn.h"
|
||||||
@@ -34,6 +33,46 @@
|
|||||||
#include "nm-utils.h"
|
#include "nm-utils.h"
|
||||||
#include "nm-dbus-manager.h"
|
#include "nm-dbus-manager.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* nm_dbus_create_error_message
|
||||||
|
*
|
||||||
|
* Make a DBus error message
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
DBusMessage *
|
||||||
|
nm_dbus_create_error_message (DBusMessage *message,
|
||||||
|
const char *exception_namespace,
|
||||||
|
const char *exception,
|
||||||
|
const char *format,
|
||||||
|
...)
|
||||||
|
{
|
||||||
|
char *exception_text;
|
||||||
|
DBusMessage *reply_message;
|
||||||
|
va_list args;
|
||||||
|
char error_text[512];
|
||||||
|
|
||||||
|
va_start (args, format);
|
||||||
|
vsnprintf (error_text, 512, format, args);
|
||||||
|
va_end (args);
|
||||||
|
|
||||||
|
exception_text = g_strdup_printf ("%s.%s", exception_namespace, exception);
|
||||||
|
reply_message = dbus_message_new_error (message, exception_text, error_text);
|
||||||
|
g_free (exception_text);
|
||||||
|
|
||||||
|
return (reply_message);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DBusMessage *
|
||||||
|
nm_dbus_new_invalid_args_error (DBusMessage *replyto,
|
||||||
|
const char *namespace)
|
||||||
|
{
|
||||||
|
return nm_dbus_create_error_message (replyto,
|
||||||
|
namespace,
|
||||||
|
"InvalidArguments",
|
||||||
|
"Invalid method arguments.");
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Pending Call Debug stuff
|
* Pending Call Debug stuff
|
||||||
*
|
*
|
||||||
@@ -647,7 +686,7 @@ nm_dbus_vpn_connections_update_cb (DBusPendingCall *pcall,
|
|||||||
if (!(reply = dbus_pending_call_steal_reply (pcall)))
|
if (!(reply = dbus_pending_call_steal_reply (pcall)))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (message_is_error (reply))
|
if (dbus_message_get_type (reply) == DBUS_MESSAGE_TYPE_ERROR)
|
||||||
goto unref_reply;
|
goto unref_reply;
|
||||||
|
|
||||||
nm_info ("Updating VPN Connections...");
|
nm_info ("Updating VPN Connections...");
|
||||||
|
@@ -26,7 +26,6 @@
|
|||||||
#include "nm-named-manager.h"
|
#include "nm-named-manager.h"
|
||||||
#include "NetworkManager.h"
|
#include "NetworkManager.h"
|
||||||
#include "NetworkManagerMain.h"
|
#include "NetworkManagerMain.h"
|
||||||
#include "NetworkManagerDbus.h"
|
|
||||||
#include "NetworkManagerSystem.h"
|
#include "NetworkManagerSystem.h"
|
||||||
#include "nm-vpn-act-request.h"
|
#include "nm-vpn-act-request.h"
|
||||||
#include "nm-vpn-connection.h"
|
#include "nm-vpn-connection.h"
|
||||||
|
@@ -29,7 +29,6 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "NetworkManagerDbus.h"
|
|
||||||
#include "nm-dbus-vpn.h"
|
#include "nm-dbus-vpn.h"
|
||||||
#include "nm-vpn-service.h"
|
#include "nm-vpn-service.h"
|
||||||
#include "nm-vpn-act-request.h"
|
#include "nm-vpn-act-request.h"
|
||||||
@@ -515,7 +514,7 @@ nm_vpn_service_stage3_connect_cb (DBusPendingCall *pcall,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message_is_error (reply)) {
|
if (dbus_message_get_type (reply) == DBUS_MESSAGE_TYPE_ERROR) {
|
||||||
const char *member = dbus_message_get_member (reply);
|
const char *member = dbus_message_get_member (reply);
|
||||||
char *message;
|
char *message;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user