2004-07-27 Dan Williams <dcbw@redhat.com>
* src/NetworkManagerAPList.[ch] src/Makefile.am - Add. Deal with allowed network list additions, deletions, and updates * dispatcher-daemon/NetworkManagerDispatcher.c - Add missing <dbus/dbus.h> header * info-daemon/NetworkManagerInfo.[ch] - Add missing <dbus/dbus.h> header - Implement the GConf notify callback to signal NetworkManager of an allowed network change - Better error checking * info-daemon/NetworkManagerInfoDbus.[ch] - Add missing <dbus/dbus.h> header - Convert to using dbus_message_append_args/dbus_message_get_args - Implement nmi_dbus_signal_update_allowed_network() to signal NetworkManager that an allowed network changed. We don't want to signal on individual keys _inside_ an allowed network really, just want NM to query the info daemon for updated info on all keys. - Better error checking * src/NetworkManager.[ch] - Add missing <dbus/dbus.h> header - Move allowed_ap_list free functions to NetworkManagerAPList.[ch] - Zero out NMData structure on free - No longer use a thread for allowed_ap_list updating, instead its now done through dbus queries against NetworkManagerInfo - Populate allowed_ap_list initially before adding existing network devices to the device list, so wireless devices can get their "best" AP * src/NetworkManagerDbus.[ch] - Convert to using dbus_message_append_args/dbus_message_get_args - Better error checking - Implement Allowed Network info functions to request allowed network info from NetworkManagerInfo - Implement the filter function to process signals from NetworkManagerInfo about changing allowed networks * src/NetworkManagerDevice.c - Fix file descriptor leak in nm_device_update_ip4_address() `CVS: Modified Files: git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@22 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
44
ChangeLog
44
ChangeLog
@@ -1,3 +1,47 @@
|
|||||||
|
2004-07-27 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
|
* src/NetworkManagerAPList.[ch]
|
||||||
|
src/Makefile.am
|
||||||
|
- Add. Deal with allowed network list additions, deletions, and updates
|
||||||
|
|
||||||
|
* dispatcher-daemon/NetworkManagerDispatcher.c
|
||||||
|
- Add missing <dbus/dbus.h> header
|
||||||
|
|
||||||
|
* info-daemon/NetworkManagerInfo.[ch]
|
||||||
|
- Add missing <dbus/dbus.h> header
|
||||||
|
- Implement the GConf notify callback to signal NetworkManager of an allowed
|
||||||
|
network change
|
||||||
|
- Better error checking
|
||||||
|
|
||||||
|
* info-daemon/NetworkManagerInfoDbus.[ch]
|
||||||
|
- Add missing <dbus/dbus.h> header
|
||||||
|
- Convert to using dbus_message_append_args/dbus_message_get_args
|
||||||
|
- Implement nmi_dbus_signal_update_allowed_network() to signal NetworkManager
|
||||||
|
that an allowed network changed. We don't want to signal on individual
|
||||||
|
keys _inside_ an allowed network really, just want NM to query the info
|
||||||
|
daemon for updated info on all keys.
|
||||||
|
- Better error checking
|
||||||
|
|
||||||
|
* src/NetworkManager.[ch]
|
||||||
|
- Add missing <dbus/dbus.h> header
|
||||||
|
- Move allowed_ap_list free functions to NetworkManagerAPList.[ch]
|
||||||
|
- Zero out NMData structure on free
|
||||||
|
- No longer use a thread for allowed_ap_list updating, instead its now done
|
||||||
|
through dbus queries against NetworkManagerInfo
|
||||||
|
- Populate allowed_ap_list initially before adding existing network devices
|
||||||
|
to the device list, so wireless devices can get their "best" AP
|
||||||
|
|
||||||
|
* src/NetworkManagerDbus.[ch]
|
||||||
|
- Convert to using dbus_message_append_args/dbus_message_get_args
|
||||||
|
- Better error checking
|
||||||
|
- Implement Allowed Network info functions to request allowed network
|
||||||
|
info from NetworkManagerInfo
|
||||||
|
- Implement the filter function to process signals from NetworkManagerInfo
|
||||||
|
about changing allowed networks
|
||||||
|
|
||||||
|
* src/NetworkManagerDevice.c
|
||||||
|
- Fix file descriptor leak in nm_device_update_ip4_address()
|
||||||
|
|
||||||
2004-07-27 Dan Williams <dcbw@redhat.com>
|
2004-07-27 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
* .cvsignore
|
* .cvsignore
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include <dbus/dbus.h>
|
||||||
#include <dbus/dbus-glib.h>
|
#include <dbus/dbus-glib.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@@ -21,6 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include <dbus/dbus.h>
|
||||||
#include <dbus/dbus-glib.h>
|
#include <dbus/dbus-glib.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@@ -221,8 +222,38 @@ static void nmi_interface_init (NMIAppInfo *info)
|
|||||||
void nmi_gconf_notify_callback (GConfClient *client, guint connection_id, GConfEntry *entry, gpointer user_data)
|
void nmi_gconf_notify_callback (GConfClient *client, guint connection_id, GConfEntry *entry, gpointer user_data)
|
||||||
{
|
{
|
||||||
NMIAppInfo *info = (NMIAppInfo *)user_data;
|
NMIAppInfo *info = (NMIAppInfo *)user_data;
|
||||||
|
const char *key = NULL;
|
||||||
|
|
||||||
|
g_return_if_fail (client != NULL);
|
||||||
|
g_return_if_fail (entry != NULL);
|
||||||
g_return_if_fail (info != NULL);
|
g_return_if_fail (info != NULL);
|
||||||
|
|
||||||
|
key = gconf_entry_get_key (entry);
|
||||||
|
if (key)
|
||||||
|
{
|
||||||
|
static int gconf_path_len = 0;
|
||||||
|
|
||||||
|
if (!gconf_path_len)
|
||||||
|
gconf_path_len = strlen (NMI_GCONF_ALLOWED_NETWORKS_PATH) + 1;
|
||||||
|
|
||||||
|
/* Extract the network name from the key */
|
||||||
|
if (strncmp ( NMI_GCONF_ALLOWED_NETWORKS_PATH
|
||||||
|
"/",
|
||||||
|
key, gconf_path_len) == 0)
|
||||||
|
{
|
||||||
|
char *network = g_strdup ((key + gconf_path_len));
|
||||||
|
char *slash_pos;
|
||||||
|
|
||||||
|
/* If its a key under the network name, zero out the slash so we
|
||||||
|
* are left with only the network name.
|
||||||
|
*/
|
||||||
|
if ((slash_pos = strchr (network, '/')))
|
||||||
|
*slash_pos = '\0';
|
||||||
|
|
||||||
|
nmi_dbus_signal_update_allowed_network (info->connection, network);
|
||||||
|
g_free (network);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <glade/glade.h>
|
#include <glade/glade.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include <dbus/dbus.h>
|
||||||
#include <dbus/dbus-glib.h>
|
#include <dbus/dbus-glib.h>
|
||||||
#include <gconf/gconf-client.h>
|
#include <gconf/gconf-client.h>
|
||||||
|
|
||||||
@@ -39,6 +40,7 @@ typedef struct NMIAppInfo NMIAppInfo;
|
|||||||
|
|
||||||
|
|
||||||
#define NMI_GCONF_WIRELESS_NETWORKING_PATH "/system/networking/wireless"
|
#define NMI_GCONF_WIRELESS_NETWORKING_PATH "/system/networking/wireless"
|
||||||
|
#define NMI_GCONF_ALLOWED_NETWORKS_PATH "/system/networking/wireless/allowed_networks"
|
||||||
|
|
||||||
|
|
||||||
void nmi_show_user_key_dialog (const char *device, const char *network, NMIAppInfo *info);
|
void nmi_show_user_key_dialog (const char *device, const char *network, NMIAppInfo *info);
|
||||||
|
@@ -21,6 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include <dbus/dbus.h>
|
||||||
#include <dbus/dbus-glib.h>
|
#include <dbus/dbus-glib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -65,30 +66,21 @@ static DBusMessage *nmi_dbus_create_error_message (DBusMessage *message, const c
|
|||||||
*/
|
*/
|
||||||
static void nmi_dbus_get_key_for_network (NMIAppInfo *info, DBusMessage *message)
|
static void nmi_dbus_get_key_for_network (NMIAppInfo *info, DBusMessage *message)
|
||||||
{
|
{
|
||||||
DBusMessageIter iter;
|
DBusError error;
|
||||||
char *dbus_string;
|
|
||||||
char *device = NULL;
|
char *device = NULL;
|
||||||
char *network = NULL;
|
char *network = NULL;
|
||||||
|
|
||||||
dbus_message_iter_init (message, &iter);
|
dbus_error_init (&error);
|
||||||
/* Grab device */
|
if (dbus_message_get_args (message, &error,
|
||||||
dbus_string = dbus_message_iter_get_string (&iter);
|
DBUS_TYPE_STRING, &device,
|
||||||
device = (dbus_string == NULL ? NULL : strdup (dbus_string));
|
DBUS_TYPE_STRING, &network,
|
||||||
dbus_free (dbus_string);
|
DBUS_TYPE_INVALID))
|
||||||
|
|
||||||
/* Grab network to get key for */
|
|
||||||
if (dbus_message_iter_next (&iter))
|
|
||||||
{
|
{
|
||||||
dbus_string = dbus_message_iter_get_string (&iter);
|
|
||||||
network = (dbus_string == NULL ? NULL : strdup (dbus_string));
|
|
||||||
dbus_free (dbus_string);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (device && network)
|
|
||||||
nmi_show_user_key_dialog (device, network, info);
|
nmi_show_user_key_dialog (device, network, info);
|
||||||
|
|
||||||
g_free (device);
|
dbus_free (device);
|
||||||
g_free (network);
|
dbus_free (network);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -102,7 +94,6 @@ void nmi_dbus_return_user_key (DBusConnection *connection, const char *device,
|
|||||||
const char *network, const char *passphrase)
|
const char *network, const char *passphrase)
|
||||||
{
|
{
|
||||||
DBusMessage *message;
|
DBusMessage *message;
|
||||||
DBusMessageIter iter;
|
|
||||||
|
|
||||||
g_return_if_fail (connection != NULL);
|
g_return_if_fail (connection != NULL);
|
||||||
g_return_if_fail (device != NULL);
|
g_return_if_fail (device != NULL);
|
||||||
@@ -120,16 +111,48 @@ void nmi_dbus_return_user_key (DBusConnection *connection, const char *device,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Add network name and passphrase */
|
/* Add network name and passphrase */
|
||||||
dbus_message_iter_init (message, &iter);
|
if (dbus_message_append_args (message, DBUS_TYPE_STRING, device,
|
||||||
dbus_message_iter_append_string (&iter, device);
|
DBUS_TYPE_STRING, network,
|
||||||
dbus_message_iter_append_string (&iter, network);
|
DBUS_TYPE_STRING, passphrase,
|
||||||
dbus_message_iter_append_string (&iter, passphrase);
|
DBUS_TYPE_INVALID))
|
||||||
|
|
||||||
if (!dbus_connection_send (connection, message, NULL))
|
|
||||||
{
|
{
|
||||||
fprintf (stderr, "nmi_dbus_return_user_key(): dbus could not send the message\n");
|
if (!dbus_connection_send (connection, message, NULL))
|
||||||
|
fprintf (stderr, "nmi_dbus_return_user_key(): dbus could not send the message\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
dbus_message_unref (message);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* nmi_dbus_signal_update_allowed_network
|
||||||
|
*
|
||||||
|
* Signal NetworkManager that it needs to update info associated with a particular
|
||||||
|
* allowed network.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void nmi_dbus_signal_update_allowed_network (DBusConnection *connection, const char *network)
|
||||||
|
{
|
||||||
|
DBusMessage *message;
|
||||||
|
|
||||||
|
g_return_if_fail (connection != NULL);
|
||||||
|
g_return_if_fail (network != NULL);
|
||||||
|
|
||||||
|
fprintf( stderr, "nmi_dbus_signal_update_allowed_network() signaling update for '%s'\n", network);
|
||||||
|
|
||||||
|
message = dbus_message_new_signal ("/org/freedesktop/NetworkManagerInfo", "org.freedesktop.NetworkManagerInfo",
|
||||||
|
"AllowedNetworkUpdate");
|
||||||
|
if (!message)
|
||||||
|
{
|
||||||
|
fprintf (stderr, "nmi_dbus_signal_update_allowed_network(): Not enough memory for new dbus message!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dbus_message_append_args (message, DBUS_TYPE_STRING, network, DBUS_TYPE_INVALID);
|
||||||
|
if (!dbus_connection_send (connection, message, NULL))
|
||||||
|
fprintf (stderr, "nmi_dbus_signal_update_allowed_network(): Could not raise the AllowedNetworkUpdate signal!\n");
|
||||||
|
|
||||||
|
dbus_message_unref (message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -147,12 +170,12 @@ static DBusMessage *nmi_dbus_get_allowed_networks (NMIAppInfo *info, DBusMessage
|
|||||||
DBusMessage *reply_message = NULL;
|
DBusMessage *reply_message = NULL;
|
||||||
DBusMessageIter iter;
|
DBusMessageIter iter;
|
||||||
DBusMessageIter iter_array;
|
DBusMessageIter iter_array;
|
||||||
gchar *path = NULL;
|
|
||||||
|
g_return_val_if_fail (info != NULL, NULL);
|
||||||
|
g_return_val_if_fail (message != NULL, NULL);
|
||||||
|
|
||||||
/* List all allowed access points that gconf knows about */
|
/* List all allowed access points that gconf knows about */
|
||||||
path = g_strdup_printf ("%s/allowed_networks", NMI_GCONF_WIRELESS_NETWORKING_PATH);
|
element = dir_list = gconf_client_all_dirs (info->gconf_client, NMI_GCONF_ALLOWED_NETWORKS_PATH, NULL);
|
||||||
element = dir_list = gconf_client_all_dirs (info->gconf_client, path, NULL);
|
|
||||||
g_free (path);
|
|
||||||
|
|
||||||
reply_message = dbus_message_new_method_return (message);
|
reply_message = dbus_message_new_method_return (message);
|
||||||
dbus_message_iter_init (reply_message, &iter);
|
dbus_message_iter_init (reply_message, &iter);
|
||||||
@@ -208,11 +231,13 @@ static DBusMessage *nmi_dbus_get_allowed_network_prio (NMIAppInfo *info, DBusMes
|
|||||||
gchar *key = NULL;
|
gchar *key = NULL;
|
||||||
char *network = NULL;
|
char *network = NULL;
|
||||||
GConfValue *value;
|
GConfValue *value;
|
||||||
DBusMessageIter iter;
|
DBusError error;
|
||||||
|
|
||||||
dbus_message_iter_init (message, &iter);
|
g_return_val_if_fail (info != NULL, NULL);
|
||||||
network = dbus_message_iter_get_string (&iter);
|
g_return_val_if_fail (message != NULL, NULL);
|
||||||
if (!network)
|
|
||||||
|
dbus_error_init (&error);
|
||||||
|
if (!dbus_message_get_args (message, &error, DBUS_TYPE_STRING, &network, DBUS_TYPE_INVALID))
|
||||||
{
|
{
|
||||||
reply_message = nmi_dbus_create_error_message (message, NMI_DBUS_NMI_NAMESPACE, "InvalidNetwork",
|
reply_message = nmi_dbus_create_error_message (message, NMI_DBUS_NMI_NAMESPACE, "InvalidNetwork",
|
||||||
"NetworkManagerInfo::getAllowedNetworkPriority called with invalid network.");
|
"NetworkManagerInfo::getAllowedNetworkPriority called with invalid network.");
|
||||||
@@ -220,15 +245,14 @@ static DBusMessage *nmi_dbus_get_allowed_network_prio (NMIAppInfo *info, DBusMes
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* List all allowed access points that gconf knows about */
|
/* List all allowed access points that gconf knows about */
|
||||||
key = g_strdup_printf ("%s/allowed_networks/%s/priority", NMI_GCONF_WIRELESS_NETWORKING_PATH, network);
|
key = g_strdup_printf ("%s/%s/priority", NMI_GCONF_ALLOWED_NETWORKS_PATH, network);
|
||||||
value = gconf_client_get (info->gconf_client, key, NULL);
|
value = gconf_client_get (info->gconf_client, key, NULL);
|
||||||
g_free (key);
|
g_free (key);
|
||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
{
|
{
|
||||||
reply_message = dbus_message_new_method_return (message);
|
reply_message = dbus_message_new_method_return (message);
|
||||||
dbus_message_iter_init (reply_message, &iter);
|
dbus_message_append_args (reply_message, DBUS_TYPE_UINT32, gconf_value_get_int (value), DBUS_TYPE_INVALID);
|
||||||
dbus_message_iter_append_uint32 (&iter, gconf_value_get_int (value));
|
|
||||||
gconf_value_free (value);
|
gconf_value_free (value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -237,6 +261,7 @@ static DBusMessage *nmi_dbus_get_allowed_network_prio (NMIAppInfo *info, DBusMes
|
|||||||
"NetworkManagerInfo::getAllowedNetworkPriority could not access data for network '%s'", network);
|
"NetworkManagerInfo::getAllowedNetworkPriority could not access data for network '%s'", network);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dbus_free (network);
|
||||||
return (reply_message);
|
return (reply_message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,11 +279,13 @@ static DBusMessage *nmi_dbus_get_allowed_network_essid (NMIAppInfo *info, DBusMe
|
|||||||
gchar *key = NULL;
|
gchar *key = NULL;
|
||||||
char *network = NULL;
|
char *network = NULL;
|
||||||
GConfValue *value;
|
GConfValue *value;
|
||||||
DBusMessageIter iter;
|
DBusError error;
|
||||||
|
|
||||||
dbus_message_iter_init (message, &iter);
|
g_return_val_if_fail (info != NULL, NULL);
|
||||||
network = dbus_message_iter_get_string (&iter);
|
g_return_val_if_fail (message != NULL, NULL);
|
||||||
if (!network)
|
|
||||||
|
dbus_error_init (&error);
|
||||||
|
if (!dbus_message_get_args (message, &error, DBUS_TYPE_STRING, &network, DBUS_TYPE_INVALID))
|
||||||
{
|
{
|
||||||
reply_message = nmi_dbus_create_error_message (message, NMI_DBUS_NMI_NAMESPACE, "InvalidNetwork",
|
reply_message = nmi_dbus_create_error_message (message, NMI_DBUS_NMI_NAMESPACE, "InvalidNetwork",
|
||||||
"NetworkManagerInfo::getAllowedNetworkEssid called with invalid network.");
|
"NetworkManagerInfo::getAllowedNetworkEssid called with invalid network.");
|
||||||
@@ -266,15 +293,14 @@ static DBusMessage *nmi_dbus_get_allowed_network_essid (NMIAppInfo *info, DBusMe
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* List all allowed access points that gconf knows about */
|
/* List all allowed access points that gconf knows about */
|
||||||
key = g_strdup_printf ("%s/allowed_networks/%s/essid", NMI_GCONF_WIRELESS_NETWORKING_PATH, network);
|
key = g_strdup_printf ("%s/%s/essid", NMI_GCONF_ALLOWED_NETWORKS_PATH, network);
|
||||||
value = gconf_client_get (info->gconf_client, key, NULL);
|
value = gconf_client_get (info->gconf_client, key, NULL);
|
||||||
g_free (key);
|
g_free (key);
|
||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
{
|
{
|
||||||
reply_message = dbus_message_new_method_return (message);
|
reply_message = dbus_message_new_method_return (message);
|
||||||
dbus_message_iter_init (reply_message, &iter);
|
dbus_message_append_args (reply_message, DBUS_TYPE_STRING, gconf_value_get_string (value), DBUS_TYPE_INVALID);
|
||||||
dbus_message_iter_append_string (&iter, gconf_value_get_string (value));
|
|
||||||
gconf_value_free (value);
|
gconf_value_free (value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -283,6 +309,7 @@ static DBusMessage *nmi_dbus_get_allowed_network_essid (NMIAppInfo *info, DBusMe
|
|||||||
"NetworkManagerInfo::getAllowedNetworkEssid could not access data for network '%s'", network);
|
"NetworkManagerInfo::getAllowedNetworkEssid could not access data for network '%s'", network);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dbus_free (network);
|
||||||
return (reply_message);
|
return (reply_message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,11 +327,13 @@ static DBusMessage *nmi_dbus_get_allowed_network_key (NMIAppInfo *info, DBusMess
|
|||||||
gchar *key = NULL;
|
gchar *key = NULL;
|
||||||
char *network = NULL;
|
char *network = NULL;
|
||||||
GConfValue *value;
|
GConfValue *value;
|
||||||
DBusMessageIter iter;
|
DBusError error;
|
||||||
|
|
||||||
dbus_message_iter_init (message, &iter);
|
g_return_val_if_fail (info != NULL, NULL);
|
||||||
network = dbus_message_iter_get_string (&iter);
|
g_return_val_if_fail (message != NULL, NULL);
|
||||||
if (!network)
|
|
||||||
|
dbus_error_init (&error);
|
||||||
|
if (!dbus_message_get_args (message, &error, DBUS_TYPE_STRING, &network, DBUS_TYPE_INVALID))
|
||||||
{
|
{
|
||||||
reply_message = nmi_dbus_create_error_message (message, NMI_DBUS_NMI_NAMESPACE, "InvalidNetwork",
|
reply_message = nmi_dbus_create_error_message (message, NMI_DBUS_NMI_NAMESPACE, "InvalidNetwork",
|
||||||
"NetworkManagerInfo::getAllowedNetworkKey called with invalid network.");
|
"NetworkManagerInfo::getAllowedNetworkKey called with invalid network.");
|
||||||
@@ -312,21 +341,19 @@ static DBusMessage *nmi_dbus_get_allowed_network_key (NMIAppInfo *info, DBusMess
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* List all allowed access points that gconf knows about */
|
/* List all allowed access points that gconf knows about */
|
||||||
key = g_strdup_printf ("%s/allowed_networks/%s/key", NMI_GCONF_WIRELESS_NETWORKING_PATH, network);
|
key = g_strdup_printf ("%s/%s/key", NMI_GCONF_ALLOWED_NETWORKS_PATH, network);
|
||||||
value = gconf_client_get (info->gconf_client, key, NULL);
|
value = gconf_client_get (info->gconf_client, key, NULL);
|
||||||
g_free (key);
|
g_free (key);
|
||||||
|
|
||||||
/* In the case of the key, we don't error out if no key was found in gconf */
|
/* We don't error out if no key was found in gconf, we return blank key */
|
||||||
reply_message = dbus_message_new_method_return (message);
|
reply_message = dbus_message_new_method_return (message);
|
||||||
dbus_message_iter_init (reply_message, &iter);
|
|
||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
{
|
{
|
||||||
dbus_message_iter_append_string (&iter, gconf_value_get_string (value));
|
dbus_message_append_args (reply_message, DBUS_TYPE_STRING, gconf_value_get_string (value), DBUS_TYPE_INVALID);
|
||||||
gconf_value_free (value);
|
gconf_value_free (value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
dbus_message_iter_append_string (&iter, "");
|
dbus_message_append_args (reply_message, DBUS_TYPE_STRING, "", DBUS_TYPE_INVALID);
|
||||||
|
|
||||||
return (reply_message);
|
return (reply_message);
|
||||||
}
|
}
|
||||||
|
@@ -24,12 +24,15 @@
|
|||||||
#define NETWORK_MANAGER_INFO_DBUS_SERVICE_H
|
#define NETWORK_MANAGER_INFO_DBUS_SERVICE_H
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include <dbus/dbus.h>
|
||||||
#include <dbus/dbus-glib.h>
|
#include <dbus/dbus-glib.h>
|
||||||
#include "NetworkManagerInfo.h"
|
#include "NetworkManagerInfo.h"
|
||||||
|
|
||||||
int nmi_dbus_service_init (DBusConnection *dbus_connection, NMIAppInfo *info);
|
int nmi_dbus_service_init (DBusConnection *dbus_connection, NMIAppInfo *info);
|
||||||
|
|
||||||
void nmi_dbus_return_user_key (DBusConnection *connection, const char *device,
|
void nmi_dbus_return_user_key (DBusConnection *connection, const char *device,
|
||||||
const char *network, const char *passphrase);
|
const char *network, const char *passphrase);
|
||||||
|
|
||||||
|
void nmi_dbus_signal_update_allowed_network (DBusConnection *connection, const char *network);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -13,6 +13,8 @@ bin_PROGRAMS = NetworkManager
|
|||||||
NetworkManager_SOURCES = \
|
NetworkManager_SOURCES = \
|
||||||
NetworkManagerAP.c \
|
NetworkManagerAP.c \
|
||||||
NetworkManagerAP.h \
|
NetworkManagerAP.h \
|
||||||
|
NetworkManagerAPList.c \
|
||||||
|
NetworkManagerAPList.h \
|
||||||
NetworkManagerDbus.c \
|
NetworkManagerDbus.c \
|
||||||
NetworkManagerDbus.h \
|
NetworkManagerDbus.h \
|
||||||
NetworkManagerDevice.c \
|
NetworkManagerDevice.c \
|
||||||
|
452
src/Makefile.in
452
src/Makefile.in
@@ -1,452 +0,0 @@
|
|||||||
# Makefile.in generated by automake 1.7.9 from Makefile.am.
|
|
||||||
# @configure_input@
|
|
||||||
|
|
||||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# This Makefile.in is free software; the Free Software Foundation
|
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
|
||||||
# with or without modifications, as long as this notice is preserved.
|
|
||||||
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
|
||||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
||||||
# PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
@SET_MAKE@
|
|
||||||
|
|
||||||
srcdir = @srcdir@
|
|
||||||
top_srcdir = @top_srcdir@
|
|
||||||
VPATH = @srcdir@
|
|
||||||
pkgdatadir = $(datadir)/@PACKAGE@
|
|
||||||
pkglibdir = $(libdir)/@PACKAGE@
|
|
||||||
pkgincludedir = $(includedir)/@PACKAGE@
|
|
||||||
top_builddir = ..
|
|
||||||
|
|
||||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
|
||||||
INSTALL = @INSTALL@
|
|
||||||
install_sh_DATA = $(install_sh) -c -m 644
|
|
||||||
install_sh_PROGRAM = $(install_sh) -c
|
|
||||||
install_sh_SCRIPT = $(install_sh) -c
|
|
||||||
INSTALL_HEADER = $(INSTALL_DATA)
|
|
||||||
transform = $(program_transform_name)
|
|
||||||
NORMAL_INSTALL = :
|
|
||||||
PRE_INSTALL = :
|
|
||||||
POST_INSTALL = :
|
|
||||||
NORMAL_UNINSTALL = :
|
|
||||||
PRE_UNINSTALL = :
|
|
||||||
POST_UNINSTALL = :
|
|
||||||
ACLOCAL = @ACLOCAL@
|
|
||||||
AMDEP_FALSE = @AMDEP_FALSE@
|
|
||||||
AMDEP_TRUE = @AMDEP_TRUE@
|
|
||||||
AMTAR = @AMTAR@
|
|
||||||
AUTOCONF = @AUTOCONF@
|
|
||||||
AUTOHEADER = @AUTOHEADER@
|
|
||||||
AUTOMAKE = @AUTOMAKE@
|
|
||||||
AWK = @AWK@
|
|
||||||
CC = @CC@
|
|
||||||
CCDEPMODE = @CCDEPMODE@
|
|
||||||
CFLAGS = @CFLAGS@
|
|
||||||
CPP = @CPP@
|
|
||||||
CPPFLAGS = @CPPFLAGS@
|
|
||||||
CYGPATH_W = @CYGPATH_W@
|
|
||||||
DEFS = @DEFS@
|
|
||||||
DEPDIR = @DEPDIR@
|
|
||||||
ECHO_C = @ECHO_C@
|
|
||||||
ECHO_N = @ECHO_N@
|
|
||||||
ECHO_T = @ECHO_T@
|
|
||||||
EGREP = @EGREP@
|
|
||||||
EXEEXT = @EXEEXT@
|
|
||||||
GCONF_CFLAGS = @GCONF_CFLAGS@
|
|
||||||
GCONF_LIBS = @GCONF_LIBS@
|
|
||||||
GLADE_CFLAGS = @GLADE_CFLAGS@
|
|
||||||
GLADE_LIBS = @GLADE_LIBS@
|
|
||||||
INSTALL_DATA = @INSTALL_DATA@
|
|
||||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
|
||||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
|
||||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
|
||||||
IWLIB = @IWLIB@
|
|
||||||
LDFLAGS = @LDFLAGS@
|
|
||||||
LIBOBJS = @LIBOBJS@
|
|
||||||
LIBS = @LIBS@
|
|
||||||
LTLIBOBJS = @LTLIBOBJS@
|
|
||||||
MAKEINFO = @MAKEINFO@
|
|
||||||
NM_CFLAGS = @NM_CFLAGS@
|
|
||||||
NM_LIBS = @NM_LIBS@
|
|
||||||
OBJEXT = @OBJEXT@
|
|
||||||
PACKAGE = @PACKAGE@
|
|
||||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
|
||||||
PACKAGE_NAME = @PACKAGE_NAME@
|
|
||||||
PACKAGE_STRING = @PACKAGE_STRING@
|
|
||||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
|
||||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
|
||||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
|
||||||
PKG_CONFIG = @PKG_CONFIG@
|
|
||||||
SET_MAKE = @SET_MAKE@
|
|
||||||
SHELL = @SHELL@
|
|
||||||
STRIP = @STRIP@
|
|
||||||
VERSION = @VERSION@
|
|
||||||
ac_ct_CC = @ac_ct_CC@
|
|
||||||
ac_ct_STRIP = @ac_ct_STRIP@
|
|
||||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
|
||||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
|
||||||
am__include = @am__include@
|
|
||||||
am__leading_dot = @am__leading_dot@
|
|
||||||
am__quote = @am__quote@
|
|
||||||
bindir = @bindir@
|
|
||||||
build_alias = @build_alias@
|
|
||||||
datadir = @datadir@
|
|
||||||
exec_prefix = @exec_prefix@
|
|
||||||
host_alias = @host_alias@
|
|
||||||
includedir = @includedir@
|
|
||||||
infodir = @infodir@
|
|
||||||
install_sh = @install_sh@
|
|
||||||
libdir = @libdir@
|
|
||||||
libexecdir = @libexecdir@
|
|
||||||
localstatedir = @localstatedir@
|
|
||||||
mandir = @mandir@
|
|
||||||
oldincludedir = @oldincludedir@
|
|
||||||
prefix = @prefix@
|
|
||||||
program_transform_name = @program_transform_name@
|
|
||||||
sbindir = @sbindir@
|
|
||||||
sharedstatedir = @sharedstatedir@
|
|
||||||
sysconfdir = @sysconfdir@
|
|
||||||
target_alias = @target_alias@
|
|
||||||
EXTRA_DIST = NetworkManager.conf
|
|
||||||
|
|
||||||
INCLUDES = \
|
|
||||||
$(NM_CFLAGS) \
|
|
||||||
-Wall \
|
|
||||||
-DDBUS_API_SUBJECT_TO_CHANGE \
|
|
||||||
-DG_DISABLE_DEPRECATED \
|
|
||||||
-DBINDIR=\"$(bindir)\" \
|
|
||||||
-DDATADIR=\"$(datadir)\"
|
|
||||||
|
|
||||||
|
|
||||||
bin_PROGRAMS = NetworkManager
|
|
||||||
|
|
||||||
NetworkManager_SOURCES = \
|
|
||||||
NetworkManagerAP.c \
|
|
||||||
NetworkManagerAP.h \
|
|
||||||
NetworkManagerDbus.c \
|
|
||||||
NetworkManagerDbus.h \
|
|
||||||
NetworkManagerDevice.c \
|
|
||||||
NetworkManagerDevice.h \
|
|
||||||
NetworkManager.c \
|
|
||||||
NetworkManager.h \
|
|
||||||
NetworkManagerPolicy.c \
|
|
||||||
NetworkManagerPolicy.h \
|
|
||||||
NetworkManagerUtils.c \
|
|
||||||
NetworkManagerUtils.h \
|
|
||||||
NetworkManagerWireless.c \
|
|
||||||
NetworkManagerWireless.h
|
|
||||||
|
|
||||||
|
|
||||||
NetworkManager_LDADD = $(NM_LIBS) $(IWLIB)
|
|
||||||
|
|
||||||
dbusservicedir = $(sysconfdir)/dbus-1/system.d
|
|
||||||
dbusservice_DATA = NetworkManager.conf
|
|
||||||
subdir = src
|
|
||||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
|
||||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
|
||||||
CONFIG_CLEAN_FILES =
|
|
||||||
bin_PROGRAMS = NetworkManager$(EXEEXT)
|
|
||||||
PROGRAMS = $(bin_PROGRAMS)
|
|
||||||
|
|
||||||
am_NetworkManager_OBJECTS = NetworkManagerAP.$(OBJEXT) \
|
|
||||||
NetworkManagerDbus.$(OBJEXT) NetworkManagerDevice.$(OBJEXT) \
|
|
||||||
NetworkManager.$(OBJEXT) NetworkManagerPolicy.$(OBJEXT) \
|
|
||||||
NetworkManagerUtils.$(OBJEXT) NetworkManagerWireless.$(OBJEXT)
|
|
||||||
NetworkManager_OBJECTS = $(am_NetworkManager_OBJECTS)
|
|
||||||
NetworkManager_DEPENDENCIES =
|
|
||||||
NetworkManager_LDFLAGS =
|
|
||||||
|
|
||||||
DEFAULT_INCLUDES = -I. -I$(srcdir)
|
|
||||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
|
||||||
am__depfiles_maybe = depfiles
|
|
||||||
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/NetworkManager.Po \
|
|
||||||
@AMDEP_TRUE@ ./$(DEPDIR)/NetworkManagerAP.Po \
|
|
||||||
@AMDEP_TRUE@ ./$(DEPDIR)/NetworkManagerDbus.Po \
|
|
||||||
@AMDEP_TRUE@ ./$(DEPDIR)/NetworkManagerDevice.Po \
|
|
||||||
@AMDEP_TRUE@ ./$(DEPDIR)/NetworkManagerPolicy.Po \
|
|
||||||
@AMDEP_TRUE@ ./$(DEPDIR)/NetworkManagerUtils.Po \
|
|
||||||
@AMDEP_TRUE@ ./$(DEPDIR)/NetworkManagerWireless.Po
|
|
||||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
|
||||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
|
||||||
CCLD = $(CC)
|
|
||||||
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
|
||||||
DIST_SOURCES = $(NetworkManager_SOURCES)
|
|
||||||
DATA = $(dbusservice_DATA)
|
|
||||||
|
|
||||||
DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
|
|
||||||
SOURCES = $(NetworkManager_SOURCES)
|
|
||||||
|
|
||||||
all: all-am
|
|
||||||
|
|
||||||
.SUFFIXES:
|
|
||||||
.SUFFIXES: .c .o .obj
|
|
||||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
|
||||||
cd $(top_srcdir) && \
|
|
||||||
$(AUTOMAKE) --gnu src/Makefile
|
|
||||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
|
||||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
|
|
||||||
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
|
|
||||||
install-binPROGRAMS: $(bin_PROGRAMS)
|
|
||||||
@$(NORMAL_INSTALL)
|
|
||||||
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
|
||||||
@list='$(bin_PROGRAMS)'; for p in $$list; do \
|
|
||||||
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
|
|
||||||
if test -f $$p \
|
|
||||||
; then \
|
|
||||||
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
|
|
||||||
echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \
|
|
||||||
$(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \
|
|
||||||
else :; fi; \
|
|
||||||
done
|
|
||||||
|
|
||||||
uninstall-binPROGRAMS:
|
|
||||||
@$(NORMAL_UNINSTALL)
|
|
||||||
@list='$(bin_PROGRAMS)'; for p in $$list; do \
|
|
||||||
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
|
|
||||||
echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
|
|
||||||
rm -f $(DESTDIR)$(bindir)/$$f; \
|
|
||||||
done
|
|
||||||
|
|
||||||
clean-binPROGRAMS:
|
|
||||||
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
|
|
||||||
NetworkManager$(EXEEXT): $(NetworkManager_OBJECTS) $(NetworkManager_DEPENDENCIES)
|
|
||||||
@rm -f NetworkManager$(EXEEXT)
|
|
||||||
$(LINK) $(NetworkManager_LDFLAGS) $(NetworkManager_OBJECTS) $(NetworkManager_LDADD) $(LIBS)
|
|
||||||
|
|
||||||
mostlyclean-compile:
|
|
||||||
-rm -f *.$(OBJEXT) core *.core
|
|
||||||
|
|
||||||
distclean-compile:
|
|
||||||
-rm -f *.tab.c
|
|
||||||
|
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NetworkManager.Po@am__quote@
|
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NetworkManagerAP.Po@am__quote@
|
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NetworkManagerDbus.Po@am__quote@
|
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NetworkManagerDevice.Po@am__quote@
|
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NetworkManagerPolicy.Po@am__quote@
|
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NetworkManagerUtils.Po@am__quote@
|
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NetworkManagerWireless.Po@am__quote@
|
|
||||||
|
|
||||||
.c.o:
|
|
||||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
|
|
||||||
@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
|
|
||||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
|
|
||||||
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
|
|
||||||
@am__fastdepCC_TRUE@ fi
|
|
||||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
|
||||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
|
||||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
|
||||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
|
|
||||||
|
|
||||||
.c.obj:
|
|
||||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
|
|
||||||
@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
|
|
||||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
|
|
||||||
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
|
|
||||||
@am__fastdepCC_TRUE@ fi
|
|
||||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
|
||||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
|
||||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
|
||||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
|
|
||||||
uninstall-info-am:
|
|
||||||
dbusserviceDATA_INSTALL = $(INSTALL_DATA)
|
|
||||||
install-dbusserviceDATA: $(dbusservice_DATA)
|
|
||||||
@$(NORMAL_INSTALL)
|
|
||||||
$(mkinstalldirs) $(DESTDIR)$(dbusservicedir)
|
|
||||||
@list='$(dbusservice_DATA)'; for p in $$list; do \
|
|
||||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
|
||||||
f="`echo $$p | sed -e 's|^.*/||'`"; \
|
|
||||||
echo " $(dbusserviceDATA_INSTALL) $$d$$p $(DESTDIR)$(dbusservicedir)/$$f"; \
|
|
||||||
$(dbusserviceDATA_INSTALL) $$d$$p $(DESTDIR)$(dbusservicedir)/$$f; \
|
|
||||||
done
|
|
||||||
|
|
||||||
uninstall-dbusserviceDATA:
|
|
||||||
@$(NORMAL_UNINSTALL)
|
|
||||||
@list='$(dbusservice_DATA)'; for p in $$list; do \
|
|
||||||
f="`echo $$p | sed -e 's|^.*/||'`"; \
|
|
||||||
echo " rm -f $(DESTDIR)$(dbusservicedir)/$$f"; \
|
|
||||||
rm -f $(DESTDIR)$(dbusservicedir)/$$f; \
|
|
||||||
done
|
|
||||||
|
|
||||||
ETAGS = etags
|
|
||||||
ETAGSFLAGS =
|
|
||||||
|
|
||||||
CTAGS = ctags
|
|
||||||
CTAGSFLAGS =
|
|
||||||
|
|
||||||
tags: TAGS
|
|
||||||
|
|
||||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
|
||||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
|
||||||
unique=`for i in $$list; do \
|
|
||||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
|
||||||
done | \
|
|
||||||
$(AWK) ' { files[$$0] = 1; } \
|
|
||||||
END { for (i in files) print i; }'`; \
|
|
||||||
mkid -fID $$unique
|
|
||||||
|
|
||||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
|
||||||
$(TAGS_FILES) $(LISP)
|
|
||||||
tags=; \
|
|
||||||
here=`pwd`; \
|
|
||||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
|
||||||
unique=`for i in $$list; do \
|
|
||||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
|
||||||
done | \
|
|
||||||
$(AWK) ' { files[$$0] = 1; } \
|
|
||||||
END { for (i in files) print i; }'`; \
|
|
||||||
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|
|
||||||
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
|
||||||
$$tags $$unique
|
|
||||||
|
|
||||||
ctags: CTAGS
|
|
||||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
|
||||||
$(TAGS_FILES) $(LISP)
|
|
||||||
tags=; \
|
|
||||||
here=`pwd`; \
|
|
||||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
|
||||||
unique=`for i in $$list; do \
|
|
||||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
|
||||||
done | \
|
|
||||||
$(AWK) ' { files[$$0] = 1; } \
|
|
||||||
END { for (i in files) print i; }'`; \
|
|
||||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
|
||||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
|
||||||
$$tags $$unique
|
|
||||||
|
|
||||||
GTAGS:
|
|
||||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
|
||||||
&& cd $(top_srcdir) \
|
|
||||||
&& gtags -i $(GTAGS_ARGS) $$here
|
|
||||||
|
|
||||||
distclean-tags:
|
|
||||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
|
||||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
|
||||||
|
|
||||||
top_distdir = ..
|
|
||||||
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
|
|
||||||
|
|
||||||
distdir: $(DISTFILES)
|
|
||||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
|
||||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
|
||||||
list='$(DISTFILES)'; for file in $$list; do \
|
|
||||||
case $$file in \
|
|
||||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
|
||||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
|
||||||
esac; \
|
|
||||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
|
||||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
|
||||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
|
||||||
dir="/$$dir"; \
|
|
||||||
$(mkinstalldirs) "$(distdir)$$dir"; \
|
|
||||||
else \
|
|
||||||
dir=''; \
|
|
||||||
fi; \
|
|
||||||
if test -d $$d/$$file; then \
|
|
||||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
|
||||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
|
||||||
fi; \
|
|
||||||
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
|
|
||||||
else \
|
|
||||||
test -f $(distdir)/$$file \
|
|
||||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
|
||||||
|| exit 1; \
|
|
||||||
fi; \
|
|
||||||
done
|
|
||||||
check-am: all-am
|
|
||||||
check: check-am
|
|
||||||
all-am: Makefile $(PROGRAMS) $(DATA)
|
|
||||||
|
|
||||||
installdirs:
|
|
||||||
$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(dbusservicedir)
|
|
||||||
install: install-am
|
|
||||||
install-exec: install-exec-am
|
|
||||||
install-data: install-data-am
|
|
||||||
uninstall: uninstall-am
|
|
||||||
|
|
||||||
install-am: all-am
|
|
||||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
|
||||||
|
|
||||||
installcheck: installcheck-am
|
|
||||||
install-strip:
|
|
||||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
|
||||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
|
||||||
`test -z '$(STRIP)' || \
|
|
||||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
|
||||||
mostlyclean-generic:
|
|
||||||
|
|
||||||
clean-generic:
|
|
||||||
|
|
||||||
distclean-generic:
|
|
||||||
-rm -f $(CONFIG_CLEAN_FILES)
|
|
||||||
|
|
||||||
maintainer-clean-generic:
|
|
||||||
@echo "This command is intended for maintainers to use"
|
|
||||||
@echo "it deletes files that may require special tools to rebuild."
|
|
||||||
clean: clean-am
|
|
||||||
|
|
||||||
clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
|
|
||||||
|
|
||||||
distclean: distclean-am
|
|
||||||
-rm -rf ./$(DEPDIR)
|
|
||||||
-rm -f Makefile
|
|
||||||
distclean-am: clean-am distclean-compile distclean-generic \
|
|
||||||
distclean-tags
|
|
||||||
|
|
||||||
dvi: dvi-am
|
|
||||||
|
|
||||||
dvi-am:
|
|
||||||
|
|
||||||
info: info-am
|
|
||||||
|
|
||||||
info-am:
|
|
||||||
|
|
||||||
install-data-am: install-dbusserviceDATA
|
|
||||||
|
|
||||||
install-exec-am: install-binPROGRAMS
|
|
||||||
|
|
||||||
install-info: install-info-am
|
|
||||||
|
|
||||||
install-man:
|
|
||||||
|
|
||||||
installcheck-am:
|
|
||||||
|
|
||||||
maintainer-clean: maintainer-clean-am
|
|
||||||
-rm -rf ./$(DEPDIR)
|
|
||||||
-rm -f Makefile
|
|
||||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
|
||||||
|
|
||||||
mostlyclean: mostlyclean-am
|
|
||||||
|
|
||||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic
|
|
||||||
|
|
||||||
pdf: pdf-am
|
|
||||||
|
|
||||||
pdf-am:
|
|
||||||
|
|
||||||
ps: ps-am
|
|
||||||
|
|
||||||
ps-am:
|
|
||||||
|
|
||||||
uninstall-am: uninstall-binPROGRAMS uninstall-dbusserviceDATA \
|
|
||||||
uninstall-info-am
|
|
||||||
|
|
||||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
|
|
||||||
clean-generic ctags distclean distclean-compile \
|
|
||||||
distclean-generic distclean-tags distdir dvi dvi-am info \
|
|
||||||
info-am install install-am install-binPROGRAMS install-data \
|
|
||||||
install-data-am install-dbusserviceDATA install-exec \
|
|
||||||
install-exec-am install-info install-info-am install-man \
|
|
||||||
install-strip installcheck installcheck-am installdirs \
|
|
||||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
|
||||||
mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
|
|
||||||
tags uninstall uninstall-am uninstall-binPROGRAMS \
|
|
||||||
uninstall-dbusserviceDATA uninstall-info-am
|
|
||||||
|
|
||||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
|
||||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
|
||||||
.NOEXPORT:
|
|
@@ -20,6 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include <dbus/dbus.h>
|
||||||
#include <dbus/dbus-glib.h>
|
#include <dbus/dbus-glib.h>
|
||||||
#include <hal/libhal.h>
|
#include <hal/libhal.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
@@ -35,6 +36,7 @@
|
|||||||
#include "NetworkManagerPolicy.h"
|
#include "NetworkManagerPolicy.h"
|
||||||
#include "NetworkManagerWireless.h"
|
#include "NetworkManagerWireless.h"
|
||||||
#include "NetworkManagerDbus.h"
|
#include "NetworkManagerDbus.h"
|
||||||
|
#include "NetworkManagerAPList.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -414,19 +416,6 @@ static NMData *nm_data_new (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* nm_data_allowed_ap_list_element_free
|
|
||||||
*
|
|
||||||
* Frees each member of the allowed access point list before the list is
|
|
||||||
* disposed of.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
static void nm_data_allowed_ap_list_element_free (void *element, void *user_data)
|
|
||||||
{
|
|
||||||
nm_ap_unref (element);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* nm_data_dev_list_element_free
|
* nm_data_dev_list_element_free
|
||||||
*
|
*
|
||||||
@@ -457,9 +446,10 @@ static void nm_data_free (NMData *data)
|
|||||||
g_slist_free (data->dev_list);
|
g_slist_free (data->dev_list);
|
||||||
g_mutex_free (data->dev_list_mutex);
|
g_mutex_free (data->dev_list_mutex);
|
||||||
|
|
||||||
g_slist_foreach (data->allowed_ap_list, nm_data_allowed_ap_list_element_free, NULL);
|
nm_ap_list_free (data->allowed_ap_list);
|
||||||
g_slist_free (data->allowed_ap_list);
|
|
||||||
g_mutex_free (data->allowed_ap_list_mutex);
|
g_mutex_free (data->allowed_ap_list_mutex);
|
||||||
|
|
||||||
|
memset (data, 0, sizeof (NMData));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -512,7 +502,6 @@ int main( int argc, char *argv[] )
|
|||||||
guint policy_source;
|
guint policy_source;
|
||||||
guint wireless_scan_source;
|
guint wireless_scan_source;
|
||||||
gboolean become_daemon = TRUE;
|
gboolean become_daemon = TRUE;
|
||||||
GThread *allowed_ap_thread = NULL;
|
|
||||||
|
|
||||||
/* Parse options */
|
/* Parse options */
|
||||||
while (1)
|
while (1)
|
||||||
@@ -610,17 +599,16 @@ int main( int argc, char *argv[] )
|
|||||||
nm_data->hal_ctx = ctx;
|
nm_data->hal_ctx = ctx;
|
||||||
hal_ctx_set_user_data (nm_data->hal_ctx, nm_data);
|
hal_ctx_set_user_data (nm_data->hal_ctx, nm_data);
|
||||||
|
|
||||||
/* Grab network devices that are already present and add them to our list */
|
|
||||||
nm_add_current_devices (nm_data);
|
|
||||||
|
|
||||||
/* Initialize our list of allowed access points */
|
|
||||||
nm_policy_update_allowed_access_points (nm_data);
|
|
||||||
allowed_ap_thread = g_thread_create (nm_policy_allowed_ap_refresh_worker, nm_data, FALSE, NULL);
|
|
||||||
|
|
||||||
/* Create our dbus service */
|
/* Create our dbus service */
|
||||||
nm_data->dbus_connection = nm_dbus_init (nm_data);
|
nm_data->dbus_connection = nm_dbus_init (nm_data);
|
||||||
if (nm_data->dbus_connection)
|
if (nm_data->dbus_connection)
|
||||||
{
|
{
|
||||||
|
/* Initialize our list of allowed access points */
|
||||||
|
nm_ap_list_populate (nm_data);
|
||||||
|
|
||||||
|
/* Grab network devices that are already present and add them to our list */
|
||||||
|
nm_add_current_devices (nm_data);
|
||||||
|
|
||||||
/* Create a watch function that monitors cards for link status (hal doesn't do
|
/* Create a watch function that monitors cards for link status (hal doesn't do
|
||||||
* this for wireless cards yet).
|
* this for wireless cards yet).
|
||||||
*/
|
*/
|
||||||
@@ -648,8 +636,7 @@ int main( int argc, char *argv[] )
|
|||||||
loop = g_main_loop_new (NULL, FALSE);
|
loop = g_main_loop_new (NULL, FALSE);
|
||||||
g_main_loop_run (loop);
|
g_main_loop_run (loop);
|
||||||
|
|
||||||
/* Kill the watch functions & threads */
|
/* Kill the watch functions */
|
||||||
allowed_ap_worker_exit = TRUE;
|
|
||||||
g_source_remove (link_source);
|
g_source_remove (link_source);
|
||||||
g_source_remove (policy_source);
|
g_source_remove (policy_source);
|
||||||
g_source_remove (wireless_scan_source);
|
g_source_remove (wireless_scan_source);
|
||||||
|
@@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <glib/gthread.h>
|
#include <glib/gthread.h>
|
||||||
|
#include <dbus/dbus.h>
|
||||||
#include <hal/libhal.h>
|
#include <hal/libhal.h>
|
||||||
#include "NetworkManagerAP.h"
|
#include "NetworkManagerAP.h"
|
||||||
|
|
||||||
|
157
src/NetworkManagerAPList.c
Normal file
157
src/NetworkManagerAPList.c
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
/* 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-glib.h>
|
||||||
|
#include "NetworkManagerAP.h"
|
||||||
|
#include "NetworkManagerAPList.h"
|
||||||
|
#include "NetworkManagerUtils.h"
|
||||||
|
#include "NetworkManagerDbus.h"
|
||||||
|
|
||||||
|
extern gboolean debug;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* nm_ap_list_get_ap_by_essid
|
||||||
|
*
|
||||||
|
* Search through an allowed access point list and return the access point
|
||||||
|
* that has a given essid.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
NMAccessPoint *nm_ap_list_get_ap_by_essid (NMData *data, const char *network)
|
||||||
|
{
|
||||||
|
NMAccessPoint *found_ap = NULL;
|
||||||
|
|
||||||
|
g_return_val_if_fail (data != NULL, NULL);
|
||||||
|
g_return_val_if_fail (network != NULL, NULL);
|
||||||
|
|
||||||
|
if (nm_try_acquire_mutex (data->allowed_ap_list_mutex, __FUNCTION__))
|
||||||
|
{
|
||||||
|
GSList *element = data->allowed_ap_list;
|
||||||
|
|
||||||
|
while (element)
|
||||||
|
{
|
||||||
|
NMAccessPoint *ap = (NMAccessPoint *)(element->data);
|
||||||
|
|
||||||
|
if (ap && (nm_null_safe_strcmp (nm_ap_get_essid (ap), network) == 0))
|
||||||
|
{
|
||||||
|
found_ap = ap;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
element = g_slist_next (element);
|
||||||
|
}
|
||||||
|
nm_unlock_mutex (data->allowed_ap_list_mutex, __FUNCTION__);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
NM_DEBUG_PRINT( "nm_ap_list_get_ap_by_essid() could not acquire allowed access point mutex.\n" );
|
||||||
|
|
||||||
|
return (found_ap);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* nm_ap_list_update_network
|
||||||
|
*
|
||||||
|
* Given a network ID,
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void nm_ap_list_update_network (NMData *data, const char *network)
|
||||||
|
{
|
||||||
|
NMAccessPoint *ap = NULL;
|
||||||
|
char *essid = NULL;
|
||||||
|
|
||||||
|
g_return_if_fail (data != NULL);
|
||||||
|
g_return_if_fail (network != NULL);
|
||||||
|
|
||||||
|
/* Find access point in list */
|
||||||
|
if (!(ap = nm_ap_list_get_ap_by_essid (data, network)))
|
||||||
|
{
|
||||||
|
ap = nm_ap_new ();
|
||||||
|
data->allowed_ap_list = g_slist_append (data->allowed_ap_list, ap);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get the allowed access point's details from NetworkManagerInfo */
|
||||||
|
if ((essid = nm_dbus_get_allowed_network_essid (data->dbus_connection, network)))
|
||||||
|
{
|
||||||
|
char *key = nm_dbus_get_allowed_network_key (data->dbus_connection, network);
|
||||||
|
guint priority = nm_dbus_get_allowed_network_priority (data->dbus_connection, network);
|
||||||
|
|
||||||
|
nm_ap_set_essid (ap, essid);
|
||||||
|
nm_ap_set_wep_key (ap, key);
|
||||||
|
nm_ap_set_priority (ap, priority);
|
||||||
|
|
||||||
|
g_free (essid);
|
||||||
|
g_free (key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* nm_ap_list_populate
|
||||||
|
*
|
||||||
|
* Populate the initial list of allowed access points
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void nm_ap_list_populate (NMData *data)
|
||||||
|
{
|
||||||
|
char **networks;
|
||||||
|
int num_networks;
|
||||||
|
|
||||||
|
g_return_if_fail (data != NULL);
|
||||||
|
|
||||||
|
networks = nm_dbus_get_allowed_networks (data->dbus_connection, &num_networks);
|
||||||
|
if (networks && (num_networks > 0))
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < num_networks; i++)
|
||||||
|
nm_ap_list_update_network (data, networks[i]);
|
||||||
|
|
||||||
|
dbus_free_string_array (networks);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fprintf( stderr, "nm_ap_list_populate(): networks 0x%X, num_networks %d\n", networks, num_networks);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* nm_ap_list_element_free
|
||||||
|
*
|
||||||
|
* Frees each member of the allowed access point list before the list is
|
||||||
|
* disposed of.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static void nm_ap_list_element_free (void *element, void *user_data)
|
||||||
|
{
|
||||||
|
nm_ap_unref (element);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* nm_ap_list_free
|
||||||
|
*
|
||||||
|
* Free all access points in an allowed access point list
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void nm_ap_list_free (GSList *ap_list)
|
||||||
|
{
|
||||||
|
g_slist_foreach (ap_list, nm_ap_list_element_free, NULL);
|
||||||
|
g_slist_free (ap_list);
|
||||||
|
}
|
||||||
|
|
36
src/NetworkManagerAPList.h
Normal file
36
src/NetworkManagerAPList.h
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
/* 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_AP_LIST_H
|
||||||
|
#define NETWORK_MANAGER_AP_LIST_H
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
#include "NetworkManager.h"
|
||||||
|
|
||||||
|
NMAccessPoint *nm_ap_list_get_ap_by_essid (NMData *data, const char *network);
|
||||||
|
|
||||||
|
void nm_ap_list_update_network (NMData *data, const char *network);
|
||||||
|
|
||||||
|
void nm_ap_list_populate (NMData *data);
|
||||||
|
|
||||||
|
void nm_ap_list_free (GSList *ap_list);
|
||||||
|
|
||||||
|
#endif
|
@@ -31,6 +31,7 @@ extern gboolean debug;
|
|||||||
#include "NetworkManagerDevice.h"
|
#include "NetworkManagerDevice.h"
|
||||||
#include "NetworkManagerDbus.h"
|
#include "NetworkManagerDbus.h"
|
||||||
#include "NetworkManagerAP.h"
|
#include "NetworkManagerAP.h"
|
||||||
|
#include "NetworkManagerAPList.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -160,7 +161,6 @@ NMAccessPoint *nm_dbus_get_network_from_object_path (const char *path, NMDevice
|
|||||||
static DBusMessage *nm_dbus_nm_get_active_device (DBusConnection *connection, DBusMessage *message, NMData *data)
|
static DBusMessage *nm_dbus_nm_get_active_device (DBusConnection *connection, DBusMessage *message, NMData *data)
|
||||||
{
|
{
|
||||||
DBusMessage *reply_message = NULL;
|
DBusMessage *reply_message = NULL;
|
||||||
DBusMessageIter iter;
|
|
||||||
|
|
||||||
g_return_val_if_fail (data != NULL, NULL);
|
g_return_val_if_fail (data != NULL, NULL);
|
||||||
g_return_val_if_fail (connection != NULL, NULL);
|
g_return_val_if_fail (connection != NULL, NULL);
|
||||||
@@ -170,17 +170,15 @@ static DBusMessage *nm_dbus_nm_get_active_device (DBusConnection *connection, DB
|
|||||||
if (!reply_message)
|
if (!reply_message)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
dbus_message_iter_init (reply_message, &iter);
|
|
||||||
|
|
||||||
/* Construct object path of "active" device and return it */
|
/* Construct object path of "active" device and return it */
|
||||||
if (data->active_device)
|
if (data->active_device)
|
||||||
{
|
{
|
||||||
char *object_path = g_strdup_printf ("%s/%s", NM_DBUS_DEVICES_OBJECT_PATH_PREFIX, nm_device_get_iface (data->active_device));
|
char *object_path = g_strdup_printf ("%s/%s", NM_DBUS_DEVICES_OBJECT_PATH_PREFIX, nm_device_get_iface (data->active_device));
|
||||||
dbus_message_iter_append_string (&iter, object_path);
|
dbus_message_append_args (reply_message, DBUS_TYPE_STRING, object_path, DBUS_TYPE_INVALID);
|
||||||
g_free (object_path);
|
g_free (object_path);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
dbus_message_iter_append_string (&iter, "");
|
dbus_message_append_args (reply_message, DBUS_TYPE_STRING, "", DBUS_TYPE_INVALID);
|
||||||
|
|
||||||
return (reply_message);
|
return (reply_message);
|
||||||
}
|
}
|
||||||
@@ -214,7 +212,7 @@ static DBusMessage *nm_dbus_nm_get_devices (DBusConnection *connection, DBusMess
|
|||||||
if (!data->dev_list)
|
if (!data->dev_list)
|
||||||
{
|
{
|
||||||
dbus_message_iter_append_string (&iter_array, "");
|
dbus_message_iter_append_string (&iter_array, "");
|
||||||
goto end;
|
return (reply_message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Iterate over device list and grab index of "active device" */
|
/* Iterate over device list and grab index of "active device" */
|
||||||
@@ -252,8 +250,7 @@ static DBusMessage *nm_dbus_nm_get_devices (DBusConnection *connection, DBusMess
|
|||||||
"NetworkManager could not lock device list, try again.");
|
"NetworkManager could not lock device list, try again.");
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
return (reply_message);
|
||||||
return (reply_message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -370,7 +367,6 @@ void nm_dbus_get_user_key_for_network_callback (DBusPendingCall *pending, void *
|
|||||||
{
|
{
|
||||||
char *key = NULL;
|
char *key = NULL;
|
||||||
DBusMessage *reply;
|
DBusMessage *reply;
|
||||||
DBusMessageIter iter;
|
|
||||||
NMDevice *dev = (NMDevice *)user_data;
|
NMDevice *dev = (NMDevice *)user_data;
|
||||||
|
|
||||||
g_return_if_fail (dev != NULL);
|
g_return_if_fail (dev != NULL);
|
||||||
@@ -378,12 +374,16 @@ void nm_dbus_get_user_key_for_network_callback (DBusPendingCall *pending, void *
|
|||||||
reply = dbus_pending_call_get_reply (pending);
|
reply = dbus_pending_call_get_reply (pending);
|
||||||
if (reply && !dbus_message_is_error (reply, DBUS_ERROR_NO_REPLY))
|
if (reply && !dbus_message_is_error (reply, DBUS_ERROR_NO_REPLY))
|
||||||
{
|
{
|
||||||
dbus_message_iter_init (reply, &iter);
|
DBusError error;
|
||||||
key = dbus_message_iter_get_string (&iter);
|
|
||||||
nm_device_pending_action_set_user_key (dev, key);
|
dbus_error_init (&error);
|
||||||
fprintf (stderr, "dbus user key callback got key '%s'\n", key );
|
if (dbus_message_get_args (reply, &error, DBUS_TYPE_STRING, &key, DBUS_TYPE_INVALID))
|
||||||
dbus_free (key);
|
{
|
||||||
dbus_pending_call_unref (pending);
|
nm_device_pending_action_set_user_key (dev, key);
|
||||||
|
fprintf (stderr, "dbus user key callback got key '%s'\n", key );
|
||||||
|
dbus_free (key);
|
||||||
|
dbus_pending_call_unref (pending);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -412,7 +412,6 @@ void nm_dbus_get_user_key_for_network (DBusConnection *connection, NMDevice *dev
|
|||||||
DBusPendingCall **pending)
|
DBusPendingCall **pending)
|
||||||
{
|
{
|
||||||
DBusMessage *message;
|
DBusMessage *message;
|
||||||
DBusMessageIter iter;
|
|
||||||
|
|
||||||
g_return_if_fail (connection != NULL);
|
g_return_if_fail (connection != NULL);
|
||||||
g_return_if_fail (dev != NULL);
|
g_return_if_fail (dev != NULL);
|
||||||
@@ -429,10 +428,9 @@ void nm_dbus_get_user_key_for_network (DBusConnection *connection, NMDevice *dev
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dbus_message_iter_init (message, &iter);
|
dbus_message_append_args (message, DBUS_TYPE_STRING, nm_device_get_iface (dev),
|
||||||
dbus_message_iter_append_string (&iter, nm_device_get_iface (dev));
|
DBUS_TYPE_STRING, nm_ap_get_essid (ap),
|
||||||
dbus_message_iter_append_string (&iter, nm_ap_get_essid (ap));
|
DBUS_TYPE_INVALID);
|
||||||
|
|
||||||
|
|
||||||
if (!dbus_connection_send (connection, message, NULL))
|
if (!dbus_connection_send (connection, message, NULL))
|
||||||
NM_DEBUG_PRINT ("nm_dbus_get_user_key_for_network(): could not send dbus message\n");
|
NM_DEBUG_PRINT ("nm_dbus_get_user_key_for_network(): could not send dbus message\n");
|
||||||
@@ -465,43 +463,30 @@ void nm_dbus_get_user_key_for_network (DBusConnection *connection, NMDevice *dev
|
|||||||
*/
|
*/
|
||||||
static void nm_dbus_set_user_key_for_network (DBusConnection *connection, DBusMessage *message, NMData *data)
|
static void nm_dbus_set_user_key_for_network (DBusConnection *connection, DBusMessage *message, NMData *data)
|
||||||
{
|
{
|
||||||
DBusMessageIter iter;
|
DBusError error;
|
||||||
char *device;
|
char *device;
|
||||||
char *network;
|
char *network;
|
||||||
char *passphrase;
|
char *passphrase;
|
||||||
char *dbus_string;
|
|
||||||
|
|
||||||
g_return_if_fail (data != NULL);
|
g_return_if_fail (data != NULL);
|
||||||
g_return_if_fail (connection != NULL);
|
g_return_if_fail (connection != NULL);
|
||||||
g_return_if_fail (message != NULL);
|
g_return_if_fail (message != NULL);
|
||||||
|
|
||||||
dbus_message_iter_init (message, &iter);
|
dbus_error_init (&error);
|
||||||
|
if (dbus_message_get_args (message, &error,
|
||||||
/* Grab device */
|
DBUS_TYPE_STRING, &device,
|
||||||
dbus_string = dbus_message_iter_get_string (&iter);
|
DBUS_TYPE_STRING, &network,
|
||||||
device = (dbus_string == NULL ? NULL : strdup (dbus_string));
|
DBUS_TYPE_STRING, &passphrase,
|
||||||
dbus_free (dbus_string);
|
DBUS_TYPE_INVALID))
|
||||||
|
|
||||||
/* Grab network */
|
|
||||||
dbus_string = dbus_message_iter_get_string (&iter);
|
|
||||||
network = (dbus_string == NULL ? NULL : strdup (dbus_string));
|
|
||||||
dbus_free (dbus_string);
|
|
||||||
|
|
||||||
/* Grab passphrase */
|
|
||||||
dbus_string = dbus_message_iter_get_string (&iter);
|
|
||||||
passphrase = (dbus_string == NULL ? NULL : strdup (dbus_string));
|
|
||||||
dbus_free (dbus_string);
|
|
||||||
|
|
||||||
if (device && network && passphrase)
|
|
||||||
{
|
{
|
||||||
NMDevice *dev;
|
NMDevice *dev;
|
||||||
if ((dev = nm_get_device_by_iface (data, device)))
|
if ((dev = nm_get_device_by_iface (data, device)))
|
||||||
nm_device_pending_action_set_user_key (dev, passphrase);
|
nm_device_pending_action_set_user_key (dev, passphrase);
|
||||||
}
|
|
||||||
|
|
||||||
g_free (device);
|
dbus_free (device);
|
||||||
g_free (network);
|
dbus_free (network);
|
||||||
g_free (passphrase);
|
dbus_free (passphrase);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -533,6 +518,221 @@ void nm_dbus_cancel_get_user_key_for_network (DBusConnection *connection)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* nm_dbus_get_allowed_network_essid
|
||||||
|
*
|
||||||
|
* Get an allowed network's essid from NetworkManagerInfo
|
||||||
|
*
|
||||||
|
* NOTE: caller MUST free returned value
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
char * nm_dbus_get_allowed_network_essid (DBusConnection *connection, const char *network)
|
||||||
|
{
|
||||||
|
DBusMessage *message;
|
||||||
|
DBusError error;
|
||||||
|
DBusMessage *reply;
|
||||||
|
char *essid = NULL;
|
||||||
|
|
||||||
|
g_return_val_if_fail (connection != NULL, NULL);
|
||||||
|
g_return_val_if_fail (network != NULL, NULL);
|
||||||
|
|
||||||
|
message = dbus_message_new_method_call ("org.freedesktop.NetworkManagerInfo",
|
||||||
|
"/org/freedesktop/NetworkManagerInfo",
|
||||||
|
"org.freedesktop.NetworkManagerInfo",
|
||||||
|
"getAllowedNetworkEssid");
|
||||||
|
if (!message)
|
||||||
|
{
|
||||||
|
NM_DEBUG_PRINT ("nm_dbus_get_allowed_network_essid(): Couldn't allocate the dbus message\n");
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
dbus_message_append_args (message, DBUS_TYPE_STRING, network, DBUS_TYPE_INVALID);
|
||||||
|
|
||||||
|
/* Send message and get essid back from NetworkManagerInfo */
|
||||||
|
dbus_error_init (&error);
|
||||||
|
reply = dbus_connection_send_with_reply_and_block (connection, message, -1, &error);
|
||||||
|
if (dbus_error_is_set (&error))
|
||||||
|
NM_DEBUG_PRINT_2 ("nm_dbus_get_allowed_network_essid(): error during getAllowedNetworkEssid. %s raised %s\n", error.name, error.message)
|
||||||
|
else if (!reply)
|
||||||
|
NM_DEBUG_PRINT ("nm_dbus_get_allowed_network_essid(): reply for getAllowedNetworkEssid was NULL.\n")
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char *dbus_string;
|
||||||
|
|
||||||
|
dbus_error_init (&error);
|
||||||
|
if (dbus_message_get_args (reply, &error, DBUS_TYPE_STRING, &dbus_string, DBUS_TYPE_INVALID))
|
||||||
|
{
|
||||||
|
essid = (dbus_string == NULL ? NULL : strdup (dbus_string));
|
||||||
|
dbus_free (dbus_string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dbus_message_unref (message);
|
||||||
|
if (reply)
|
||||||
|
dbus_message_unref (reply);
|
||||||
|
|
||||||
|
return (essid);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* nm_dbus_get_allowed_network_key
|
||||||
|
*
|
||||||
|
* Get an allowed network's key from NetworkManagerInfo.
|
||||||
|
*
|
||||||
|
* NOTE: caller MUST free returned value
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
char * nm_dbus_get_allowed_network_key (DBusConnection *connection, const char *network)
|
||||||
|
{
|
||||||
|
DBusMessage *message;
|
||||||
|
DBusError error;
|
||||||
|
DBusMessage *reply;
|
||||||
|
char *key = NULL;
|
||||||
|
|
||||||
|
g_return_val_if_fail (connection != NULL, NULL);
|
||||||
|
g_return_val_if_fail (network != NULL, NULL);
|
||||||
|
|
||||||
|
message = dbus_message_new_method_call ("org.freedesktop.NetworkManagerInfo",
|
||||||
|
"/org/freedesktop/NetworkManagerInfo",
|
||||||
|
"org.freedesktop.NetworkManagerInfo",
|
||||||
|
"getAllowedNetworkKey");
|
||||||
|
if (!message)
|
||||||
|
{
|
||||||
|
NM_DEBUG_PRINT ("nm_dbus_get_allowed_network_key(): Couldn't allocate the dbus message\n");
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
dbus_message_append_args (message, DBUS_TYPE_STRING, network, DBUS_TYPE_INVALID);
|
||||||
|
|
||||||
|
/* Send message and get essid back from NetworkManagerInfo */
|
||||||
|
dbus_error_init (&error);
|
||||||
|
reply = dbus_connection_send_with_reply_and_block (connection, message, -1, &error);
|
||||||
|
if (dbus_error_is_set (&error))
|
||||||
|
NM_DEBUG_PRINT_2 ("nm_dbus_get_allowed_network_key(): error during getAllowedNetworkKey %s raised %s\n", error.name, error.message)
|
||||||
|
else if (!reply)
|
||||||
|
NM_DEBUG_PRINT ("nm_dbus_get_allowed_network_key(): reply for getAllowedNetworkKey was NULL.\n")
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char *dbus_string;
|
||||||
|
|
||||||
|
dbus_error_init (&error);
|
||||||
|
if (dbus_message_get_args (reply, &error, DBUS_TYPE_STRING, &dbus_string, DBUS_TYPE_INVALID))
|
||||||
|
{
|
||||||
|
key = (dbus_string == NULL ? NULL : strdup (dbus_string));
|
||||||
|
dbus_free (dbus_string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dbus_message_unref (message);
|
||||||
|
if (reply)
|
||||||
|
dbus_message_unref (reply);
|
||||||
|
|
||||||
|
return (key);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* nm_dbus_get_allowed_network_priority
|
||||||
|
*
|
||||||
|
* Get an allowed network's priority from NetworkManagerInfo
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
guint nm_dbus_get_allowed_network_priority (DBusConnection *connection, const char *network)
|
||||||
|
{
|
||||||
|
DBusMessage *message;
|
||||||
|
DBusError error;
|
||||||
|
DBusMessage *reply;
|
||||||
|
guint priority = NM_AP_PRIORITY_WORST;
|
||||||
|
|
||||||
|
g_return_val_if_fail (connection != NULL, NM_AP_PRIORITY_WORST);
|
||||||
|
g_return_val_if_fail (network != NULL, NM_AP_PRIORITY_WORST);
|
||||||
|
|
||||||
|
message = dbus_message_new_method_call ("org.freedesktop.NetworkManagerInfo",
|
||||||
|
"/org/freedesktop/NetworkManagerInfo",
|
||||||
|
"org.freedesktop.NetworkManagerInfo",
|
||||||
|
"getAllowedNetworkPriority");
|
||||||
|
if (!message)
|
||||||
|
{
|
||||||
|
NM_DEBUG_PRINT ("nm_dbus_get_allowed_network_priority(): Couldn't allocate the dbus message\n");
|
||||||
|
return (NM_AP_PRIORITY_WORST);
|
||||||
|
}
|
||||||
|
|
||||||
|
dbus_message_append_args (message, DBUS_TYPE_STRING, network, DBUS_TYPE_INVALID);
|
||||||
|
|
||||||
|
/* Send message and get essid back from NetworkManagerInfo */
|
||||||
|
dbus_error_init (&error);
|
||||||
|
reply = dbus_connection_send_with_reply_and_block (connection, message, -1, &error);
|
||||||
|
if (dbus_error_is_set (&error))
|
||||||
|
NM_DEBUG_PRINT_2 ("nm_dbus_get_allowed_network_priority(): error during getAllowedNetworkPriority. %s raised %s\n", error.name, error.message)
|
||||||
|
else if (!reply)
|
||||||
|
NM_DEBUG_PRINT ("nm_dbus_get_allowed_network_priority(): reply for getAllowedNetworkPriority was NULL.\n")
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dbus_error_init (&error);
|
||||||
|
if (!dbus_message_get_args (reply, &error, DBUS_TYPE_UINT32, &priority, DBUS_TYPE_INVALID))
|
||||||
|
priority = NM_AP_PRIORITY_WORST;
|
||||||
|
}
|
||||||
|
|
||||||
|
dbus_message_unref (message);
|
||||||
|
if (reply)
|
||||||
|
dbus_message_unref (reply);
|
||||||
|
|
||||||
|
return (priority);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* nm_dbus_get_allowed_networks
|
||||||
|
*
|
||||||
|
* Get all allowed networks from NetworkManagerInfo
|
||||||
|
*
|
||||||
|
* NOTE: caller MUST free returned value using dbus_free_string_array()
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
char ** nm_dbus_get_allowed_networks (DBusConnection *connection, int *num_networks)
|
||||||
|
{
|
||||||
|
DBusMessage *message;
|
||||||
|
DBusError error;
|
||||||
|
DBusMessage *reply;
|
||||||
|
char **networks = NULL;
|
||||||
|
|
||||||
|
*num_networks = 0;
|
||||||
|
g_return_val_if_fail (connection != NULL, NULL);
|
||||||
|
|
||||||
|
message = dbus_message_new_method_call ("org.freedesktop.NetworkManagerInfo",
|
||||||
|
"/org/freedesktop/NetworkManagerInfo",
|
||||||
|
"org.freedesktop.NetworkManagerInfo",
|
||||||
|
"getAllowedNetworks");
|
||||||
|
if (!message)
|
||||||
|
{
|
||||||
|
NM_DEBUG_PRINT ("nm_dbus_get_allowed_networks(): Couldn't allocate the dbus message\n");
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Send message and get essid back from NetworkManagerInfo */
|
||||||
|
dbus_error_init (&error);
|
||||||
|
reply = dbus_connection_send_with_reply_and_block (connection, message, -1, &error);
|
||||||
|
if (dbus_error_is_set (&error))
|
||||||
|
NM_DEBUG_PRINT_2 ("nm_dbus_get_allowed_networks(): error during getAllowedNetworks. %s raised %s\n", error.name, error.message)
|
||||||
|
else if (!reply)
|
||||||
|
NM_DEBUG_PRINT ("nm_dbus_get_allowed_networks(): reply for getAllowedNetworks was NULL.\n")
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DBusMessageIter iter;
|
||||||
|
|
||||||
|
dbus_message_iter_init (reply, &iter);
|
||||||
|
dbus_message_iter_get_string_array (&iter, &networks, num_networks);
|
||||||
|
}
|
||||||
|
|
||||||
|
dbus_message_unref (message);
|
||||||
|
if (reply)
|
||||||
|
dbus_message_unref (reply);
|
||||||
|
|
||||||
|
return (networks);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* nm_dbus_nmi_filter
|
* nm_dbus_nmi_filter
|
||||||
*
|
*
|
||||||
@@ -541,12 +741,32 @@ void nm_dbus_cancel_get_user_key_for_network (DBusConnection *connection)
|
|||||||
*/
|
*/
|
||||||
static DBusHandlerResult nm_dbus_nmi_filter (DBusConnection *connection, DBusMessage *message, void *user_data)
|
static DBusHandlerResult nm_dbus_nmi_filter (DBusConnection *connection, DBusMessage *message, void *user_data)
|
||||||
{
|
{
|
||||||
NMData *data = (NMData *)user_data;
|
NMData *data = (NMData *)user_data;
|
||||||
|
const char *object_path;
|
||||||
|
|
||||||
g_return_val_if_fail (data != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
|
g_return_val_if_fail (data != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
|
||||||
g_return_val_if_fail (connection != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
|
g_return_val_if_fail (connection != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
|
||||||
g_return_val_if_fail (message != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
|
g_return_val_if_fail (message != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
|
||||||
|
|
||||||
|
object_path = dbus_message_get_path (message);
|
||||||
|
if (!object_path || (strcmp (object_path, "/org/freedesktop/NetworkManager") != 0))
|
||||||
|
return (DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
|
||||||
|
|
||||||
|
if (dbus_message_is_signal (message, "org.freedesktop.NetworkManager", "AllowedNetworkUpdate"))
|
||||||
|
{
|
||||||
|
char *network = NULL;
|
||||||
|
DBusError error;
|
||||||
|
fprintf( stderr, "nmi_filter(): got signal AllowedNetworkUpdate\n");
|
||||||
|
|
||||||
|
dbus_error_init (&error);
|
||||||
|
if (!dbus_message_get_args (message, &error, DBUS_TYPE_STRING, &network, DBUS_TYPE_INVALID))
|
||||||
|
return (DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
|
||||||
|
|
||||||
|
fprintf( stderr, "nmi_filter(): updating network '%s'\n", network);
|
||||||
|
nm_ap_list_update_network (data, network);
|
||||||
|
dbus_free (network);
|
||||||
|
}
|
||||||
|
|
||||||
return (DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
|
return (DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -562,7 +782,6 @@ static DBusMessage *nm_dbus_devices_handle_networks_request (DBusConnection *con
|
|||||||
{
|
{
|
||||||
NMAccessPoint *ap;
|
NMAccessPoint *ap;
|
||||||
DBusMessage *reply_message = NULL;
|
DBusMessage *reply_message = NULL;
|
||||||
DBusMessageIter iter;
|
|
||||||
|
|
||||||
g_return_val_if_fail (data != NULL, NULL);
|
g_return_val_if_fail (data != NULL, NULL);
|
||||||
g_return_val_if_fail (connection != NULL, NULL);
|
g_return_val_if_fail (connection != NULL, NULL);
|
||||||
@@ -578,29 +797,27 @@ static DBusMessage *nm_dbus_devices_handle_networks_request (DBusConnection *con
|
|||||||
return (reply_message);
|
return (reply_message);
|
||||||
}
|
}
|
||||||
|
|
||||||
reply_message = dbus_message_new_method_return (message);
|
if (!(reply_message = dbus_message_new_method_return (message)));
|
||||||
if (!reply_message)
|
|
||||||
return (NULL);
|
return (NULL);
|
||||||
dbus_message_iter_init (reply_message, &iter);
|
|
||||||
|
|
||||||
if (strcmp ("getName", request) == 0)
|
if (strcmp ("getName", request) == 0)
|
||||||
dbus_message_iter_append_string (&iter, nm_ap_get_essid (ap));
|
dbus_message_append_args (reply_message, DBUS_TYPE_STRING, nm_ap_get_essid (ap), DBUS_TYPE_INVALID);
|
||||||
else if (strcmp ("getAddress", request) == 0)
|
else if (strcmp ("getAddress", request) == 0)
|
||||||
{
|
{
|
||||||
char buf[20];
|
char buf[20];
|
||||||
|
|
||||||
memset (&buf[0], 0, 20);
|
memset (&buf[0], 0, 20);
|
||||||
iw_ether_ntop((const struct ether_addr *) (nm_ap_get_address (ap)), &buf[0]);
|
iw_ether_ntop((const struct ether_addr *) (nm_ap_get_address (ap)), &buf[0]);
|
||||||
dbus_message_iter_append_string (&iter, &buf[0]);
|
dbus_message_append_args (reply_message, DBUS_TYPE_STRING, &buf[0], DBUS_TYPE_INVALID);
|
||||||
}
|
}
|
||||||
else if (strcmp ("getQuality", request) == 0)
|
else if (strcmp ("getQuality", request) == 0)
|
||||||
dbus_message_iter_append_int32 (&iter, nm_ap_get_quality (ap));
|
dbus_message_append_args (reply_message, DBUS_TYPE_INT32, nm_ap_get_quality (ap), DBUS_TYPE_INVALID);
|
||||||
else if (strcmp ("getFrequency", request) == 0)
|
else if (strcmp ("getFrequency", request) == 0)
|
||||||
dbus_message_iter_append_double (&iter, nm_ap_get_freq (ap));
|
dbus_message_append_args (reply_message, DBUS_TYPE_DOUBLE, nm_ap_get_freq (ap), DBUS_TYPE_INVALID);
|
||||||
else if (strcmp ("getRate", request) == 0)
|
else if (strcmp ("getRate", request) == 0)
|
||||||
dbus_message_iter_append_int32 (&iter, nm_ap_get_rate (ap));
|
dbus_message_append_args (reply_message, DBUS_TYPE_INT32, nm_ap_get_rate (ap), DBUS_TYPE_INVALID);
|
||||||
else if (strcmp ("getStamp", request) == 0)
|
else if (strcmp ("getStamp", request) == 0)
|
||||||
dbus_message_iter_append_int32 (&iter, nm_ap_get_stamp (ap));
|
dbus_message_append_args (reply_message, DBUS_TYPE_INT32, nm_ap_get_stamp (ap), DBUS_TYPE_INVALID);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Must destroy the allocated message */
|
/* Must destroy the allocated message */
|
||||||
@@ -625,7 +842,6 @@ static DBusMessage *nm_dbus_devices_handle_request (DBusConnection *connection,
|
|||||||
{
|
{
|
||||||
NMDevice *dev;
|
NMDevice *dev;
|
||||||
DBusMessage *reply_message = NULL;
|
DBusMessage *reply_message = NULL;
|
||||||
DBusMessageIter iter;
|
|
||||||
char *object_path;
|
char *object_path;
|
||||||
|
|
||||||
g_return_val_if_fail (data != NULL, NULL);
|
g_return_val_if_fail (data != NULL, NULL);
|
||||||
@@ -651,17 +867,15 @@ static DBusMessage *nm_dbus_devices_handle_request (DBusConnection *connection,
|
|||||||
}
|
}
|
||||||
free (object_path);
|
free (object_path);
|
||||||
|
|
||||||
reply_message = dbus_message_new_method_return (message);
|
if (!(reply_message = dbus_message_new_method_return (message)))
|
||||||
if (!reply_message)
|
|
||||||
return (NULL);
|
return (NULL);
|
||||||
dbus_message_iter_init (reply_message, &iter);
|
|
||||||
|
|
||||||
if (strcmp ("getName", request) == 0)
|
if (strcmp ("getName", request) == 0)
|
||||||
dbus_message_iter_append_string (&iter, nm_device_get_iface (dev));
|
dbus_message_append_args (reply_message, DBUS_TYPE_STRING, nm_device_get_iface (dev), DBUS_TYPE_INVALID);
|
||||||
else if (strcmp ("getType", request) == 0)
|
else if (strcmp ("getType", request) == 0)
|
||||||
dbus_message_iter_append_int32 (&iter, nm_device_get_iface_type (dev));
|
dbus_message_append_args (reply_message, DBUS_TYPE_INT32, nm_device_get_iface_type (dev), DBUS_TYPE_INVALID);
|
||||||
else if (strcmp ("getIP4Address", request) == 0)
|
else if (strcmp ("getIP4Address", request) == 0)
|
||||||
dbus_message_iter_append_uint32 (&iter, nm_device_get_ip4_address (dev));
|
dbus_message_append_args (reply_message, DBUS_TYPE_UINT32, nm_device_get_ip4_address (dev), DBUS_TYPE_INVALID);
|
||||||
else if (strcmp ("getActiveNetwork", request) == 0)
|
else if (strcmp ("getActiveNetwork", request) == 0)
|
||||||
{
|
{
|
||||||
NMAccessPoint *ap;
|
NMAccessPoint *ap;
|
||||||
@@ -669,18 +883,20 @@ static DBusMessage *nm_dbus_devices_handle_request (DBusConnection *connection,
|
|||||||
{
|
{
|
||||||
object_path = g_strdup_printf ("%s/%s/Networks/%s", NM_DBUS_DEVICES_OBJECT_PATH_PREFIX,
|
object_path = g_strdup_printf ("%s/%s/Networks/%s", NM_DBUS_DEVICES_OBJECT_PATH_PREFIX,
|
||||||
nm_device_get_iface (dev), nm_ap_get_essid (ap));
|
nm_device_get_iface (dev), nm_ap_get_essid (ap));
|
||||||
dbus_message_iter_append_string (&iter, object_path);
|
dbus_message_append_args (reply_message, DBUS_TYPE_STRING, object_path, DBUS_TYPE_INVALID);
|
||||||
g_free (object_path);
|
g_free (object_path);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
dbus_message_iter_append_string (&iter, "");
|
dbus_message_append_args (reply_message, DBUS_TYPE_STRING, "", DBUS_TYPE_INVALID);
|
||||||
}
|
}
|
||||||
else if (strcmp ("getNetworks", request) == 0)
|
else if (strcmp ("getNetworks", request) == 0)
|
||||||
{
|
{
|
||||||
|
DBusMessageIter iter;
|
||||||
DBusMessageIter iter_array;
|
DBusMessageIter iter_array;
|
||||||
NMAccessPoint *ap = NULL;
|
NMAccessPoint *ap = NULL;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
|
dbus_message_iter_init (reply_message, &iter);
|
||||||
dbus_message_iter_append_array (&iter, &iter_array, DBUS_TYPE_STRING);
|
dbus_message_iter_append_array (&iter, &iter_array, DBUS_TYPE_STRING);
|
||||||
while ((ap = nm_device_ap_list_get_ap_by_index (dev, i)) != NULL)
|
while ((ap = nm_device_ap_list_get_ap_by_index (dev, i)) != NULL)
|
||||||
{
|
{
|
||||||
|
@@ -23,6 +23,7 @@
|
|||||||
#define NETWORK_MANAGER_DBUS_H
|
#define NETWORK_MANAGER_DBUS_H
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include <dbus/dbus.h>
|
||||||
#include <dbus/dbus-glib.h>
|
#include <dbus/dbus-glib.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -44,4 +45,12 @@ void nm_dbus_get_user_key_for_network (DBusConnection *connection, NMDevice
|
|||||||
|
|
||||||
void nm_dbus_cancel_get_user_key_for_network (DBusConnection *connection);
|
void nm_dbus_cancel_get_user_key_for_network (DBusConnection *connection);
|
||||||
|
|
||||||
|
char * nm_dbus_get_allowed_network_essid (DBusConnection *connection, const char *network);
|
||||||
|
|
||||||
|
char * nm_dbus_get_allowed_network_key (DBusConnection *connection, const char *network);
|
||||||
|
|
||||||
|
guint nm_dbus_get_allowed_network_priority (DBusConnection *connection, const char *network);
|
||||||
|
|
||||||
|
char ** nm_dbus_get_allowed_networks (DBusConnection *connection, int *num_networks);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -637,9 +637,10 @@ guint32 nm_device_get_ip4_address(NMDevice *dev)
|
|||||||
|
|
||||||
void nm_device_update_ip4_address (NMDevice *dev)
|
void nm_device_update_ip4_address (NMDevice *dev)
|
||||||
{
|
{
|
||||||
guint32 new_address;
|
guint32 new_address;
|
||||||
struct ifreq req;
|
struct ifreq req;
|
||||||
int socket;
|
int socket;
|
||||||
|
int err;
|
||||||
|
|
||||||
g_return_if_fail (dev != NULL);
|
g_return_if_fail (dev != NULL);
|
||||||
g_return_if_fail (dev->app_data != NULL);
|
g_return_if_fail (dev->app_data != NULL);
|
||||||
@@ -650,7 +651,9 @@ void nm_device_update_ip4_address (NMDevice *dev)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
strncpy ((char *)(&req.ifr_name), nm_device_get_iface (dev), 16); // 16 == IF_NAMESIZE
|
strncpy ((char *)(&req.ifr_name), nm_device_get_iface (dev), 16); // 16 == IF_NAMESIZE
|
||||||
if (ioctl (socket, SIOCGIFADDR, &req) != 0)
|
err = ioctl (socket, SIOCGIFADDR, &req);
|
||||||
|
close (socket);
|
||||||
|
if (err != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
new_address = ((struct sockaddr_in *)(&req.ifr_addr))->sin_addr.s_addr;
|
new_address = ((struct sockaddr_in *)(&req.ifr_addr))->sin_addr.s_addr;
|
||||||
|
@@ -52,6 +52,7 @@ gboolean nm_wireless_is_most_prefered_ap (NMData *data, NMAccessPoint *ap, int *
|
|||||||
if (nm_try_acquire_mutex (data->allowed_ap_list_mutex, __FUNCTION__))
|
if (nm_try_acquire_mutex (data->allowed_ap_list_mutex, __FUNCTION__))
|
||||||
{
|
{
|
||||||
element = data->allowed_ap_list;
|
element = data->allowed_ap_list;
|
||||||
|
|
||||||
while (element)
|
while (element)
|
||||||
{
|
{
|
||||||
NMAccessPoint *allowed_ap = (NMAccessPoint *)(element->data);
|
NMAccessPoint *allowed_ap = (NMAccessPoint *)(element->data);
|
||||||
|
Reference in New Issue
Block a user