2006-02-02 Robert Love <rml@novell.com>

* src/NetworkManagerAP.c: Add 'broadcast' property to the NMAccessPoint
	  structure, which denotes whether or not the AP is hidden.  This is a
	  superset of 'artificial' -- we need 'broadcast' because a hidden AP
	  can show up in the scan list.  Add nm_ap_get_broadcast() and
	  nm_ap_set_broadcast() accessor interfaces.
	* src/NetworkManagerAP.h: Add prototypes for nm_ap_get_broadcast() and
	  nm_ap_set_broadcast().
	* src/nm-dbus-net.c: Add new argument, boolean broadcast, to the
	  "getProperties" method, which denotes whether or not the given
	  network is hidden.
	* src/nm-device-802-11-wireless.c: Set broadcast to FALSE when creating
	  an artificial network.  Set broadcast to TRUE when scanning returns
	  an ESSID and FALSE when not.
	* gnome/applet/applet-dbus-devices.c: Retrieve 'broadcast' argument
	  from "getProperties" method on a network.  Possible TODO is to
	  somehow display this.
	* test/nm-tool.c: Display "Hidden" if the AP does not broadcast.


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1429 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Robert Love 2006-02-02 18:05:19 +00:00 committed by Robert Love
parent ecd009cc7d
commit 2f71e13495
7 changed files with 78 additions and 24 deletions

View file

@ -1,3 +1,23 @@
2006-02-02 Robert Love <rml@novell.com>
* src/NetworkManagerAP.c: Add 'broadcast' property to the NMAccessPoint
structure, which denotes whether or not the AP is hidden. This is a
superset of 'artificial' -- we need 'broadcast' because a hidden AP
can show up in the scan list. Add nm_ap_get_broadcast() and
nm_ap_set_broadcast() accessor interfaces.
* src/NetworkManagerAP.h: Add prototypes for nm_ap_get_broadcast() and
nm_ap_set_broadcast().
* src/nm-dbus-net.c: Add new argument, boolean broadcast, to the
"getProperties" method, which denotes whether or not the given
network is hidden.
* src/nm-device-802-11-wireless.c: Set broadcast to FALSE when creating
an artificial network. Set broadcast to TRUE when scanning returns
an ESSID and FALSE when not.
* gnome/applet/applet-dbus-devices.c: Retrieve 'broadcast' argument
from "getProperties" method on a network. Possible TODO is to
somehow display this.
* test/nm-tool.c: Display "Hidden" if the AP does not broadcast.
2006-02-02 Dan Williams <dcbw@redhat.com> 2006-02-02 Dan Williams <dcbw@redhat.com>
* src/nm-device-802-11-wireless.c * src/nm-device-802-11-wireless.c

View file

@ -540,6 +540,7 @@ static void nmwa_dbus_net_properties_cb (DBusPendingCall *pcall, void *user_data
dbus_int32_t rate = 0; dbus_int32_t rate = 0;
dbus_int32_t mode = -1; dbus_int32_t mode = -1;
dbus_int32_t capabilities = NM_802_11_CAP_NONE; dbus_int32_t capabilities = NM_802_11_CAP_NONE;
dbus_bool_t broadcast = TRUE;
g_return_if_fail (pcall != NULL); g_return_if_fail (pcall != NULL);
g_return_if_fail (cb_data != NULL); g_return_if_fail (cb_data != NULL);
@ -570,13 +571,14 @@ static void nmwa_dbus_net_properties_cb (DBusPendingCall *pcall, void *user_data
} }
if (dbus_message_get_args (reply, NULL, DBUS_TYPE_OBJECT_PATH, &op, if (dbus_message_get_args (reply, NULL, DBUS_TYPE_OBJECT_PATH, &op,
DBUS_TYPE_STRING, &essid, DBUS_TYPE_STRING, &essid,
DBUS_TYPE_STRING, &hw_addr, DBUS_TYPE_STRING, &hw_addr,
DBUS_TYPE_INT32, &strength, DBUS_TYPE_INT32, &strength,
DBUS_TYPE_DOUBLE, &freq, DBUS_TYPE_DOUBLE, &freq,
DBUS_TYPE_INT32, &rate, DBUS_TYPE_INT32, &rate,
DBUS_TYPE_INT32, &mode, DBUS_TYPE_INT32, &mode,
DBUS_TYPE_INT32, &capabilities, DBUS_TYPE_INT32, &capabilities,
DBUS_TYPE_BOOLEAN, &broadcast,
DBUS_TYPE_INVALID)) DBUS_TYPE_INVALID))
{ {
NetworkDevice * dev; NetworkDevice * dev;

View file

@ -46,6 +46,7 @@ struct NMAccessPoint
/* Non-scanned attributes */ /* Non-scanned attributes */
gboolean invalid; gboolean invalid;
gboolean artificial; /* Whether or not the AP is from a scan */ gboolean artificial; /* Whether or not the AP is from a scan */
gboolean broadcast; /* Whether or not the AP is broadcasting (hidden) */
gboolean user_created; /* Whether or not the AP was created by the user with "Create network..." */ gboolean user_created; /* Whether or not the AP was created by the user with "Create network..." */
GTimeVal last_seen; /* Last time the AP was seen in a scan */ GTimeVal last_seen; /* Last time the AP was seen in a scan */
@ -433,6 +434,24 @@ void nm_ap_set_artificial (NMAccessPoint *ap, gboolean artificial)
} }
/*
* Get/Set functions to indicate whether an access point is broadcasting
* (hidden). This is a superset of artificial.
*/
gboolean nm_ap_get_broadcast (const NMAccessPoint *ap)
{
g_return_val_if_fail (ap != NULL, TRUE);
return ap->broadcast;
}
void nm_ap_set_broadcast (NMAccessPoint *ap, gboolean broadcast)
{
g_return_if_fail (ap != NULL);
ap->broadcast = broadcast;
}
/* /*
* Get/Set functions for how long ago the AP was last seen in a scan. * Get/Set functions for how long ago the AP was last seen in a scan.
* APs older than a certain date are dropped from the list. * APs older than a certain date are dropped from the list.

View file

@ -77,6 +77,9 @@ void nm_ap_set_trusted (NMAccessPoint *ap, gboolean trusted);
gboolean nm_ap_get_artificial (const NMAccessPoint *ap); gboolean nm_ap_get_artificial (const NMAccessPoint *ap);
void nm_ap_set_artificial (NMAccessPoint *ap, gboolean artificial); void nm_ap_set_artificial (NMAccessPoint *ap, gboolean artificial);
gboolean nm_ap_get_broadcast (const NMAccessPoint *ap);
void nm_ap_set_broadcast (NMAccessPoint *ap, gboolean broadcast);
const GTimeVal * nm_ap_get_last_seen (const NMAccessPoint *ap); const GTimeVal * nm_ap_get_last_seen (const NMAccessPoint *ap);
void nm_ap_set_last_seen (NMAccessPoint *ap, const GTimeVal *last_seen); void nm_ap_set_last_seen (NMAccessPoint *ap, const GTimeVal *last_seen);

View file

@ -246,19 +246,21 @@ static DBusMessage *nm_dbus_net_get_properties (DBusConnection *connection, DBus
dbus_int32_t rate = nm_ap_get_rate (data->ap); dbus_int32_t rate = nm_ap_get_rate (data->ap);
dbus_int32_t mode = (dbus_int32_t) nm_ap_get_mode (data->ap); dbus_int32_t mode = (dbus_int32_t) nm_ap_get_mode (data->ap);
dbus_int32_t capabilities = (dbus_int32_t) nm_ap_get_capabilities (data->ap); dbus_int32_t capabilities = (dbus_int32_t) nm_ap_get_capabilities (data->ap);
dbus_bool_t broadcast = (dbus_bool_t) nm_ap_get_broadcast (data->ap);
memset (&hw_addr_buf[0], 0, 20); memset (&hw_addr_buf[0], 0, 20);
if (nm_ap_get_address (data->ap)) if (nm_ap_get_address (data->ap))
iw_ether_ntop((const struct ether_addr *) (nm_ap_get_address (data->ap)), &hw_addr_buf[0]); iw_ether_ntop((const struct ether_addr *) (nm_ap_get_address (data->ap)), &hw_addr_buf[0]);
dbus_message_append_args (reply, DBUS_TYPE_OBJECT_PATH, &op, dbus_message_append_args (reply, DBUS_TYPE_OBJECT_PATH, &op,
DBUS_TYPE_STRING, &essid, DBUS_TYPE_STRING, &essid,
DBUS_TYPE_STRING, &hw_addr_buf_ptr, DBUS_TYPE_STRING, &hw_addr_buf_ptr,
DBUS_TYPE_INT32, &strength, DBUS_TYPE_INT32, &strength,
DBUS_TYPE_DOUBLE, &freq, DBUS_TYPE_DOUBLE, &freq,
DBUS_TYPE_INT32, &rate, DBUS_TYPE_INT32, &rate,
DBUS_TYPE_INT32, &mode, DBUS_TYPE_INT32, &mode,
DBUS_TYPE_INT32, &capabilities, DBUS_TYPE_INT32, &capabilities,
DBUS_TYPE_BOOLEAN, &broadcast,
DBUS_TYPE_INVALID); DBUS_TYPE_INVALID);
g_free (op); g_free (op);
} }

View file

@ -666,6 +666,7 @@ nm_device_802_11_wireless_get_activation_ap (NMDevice80211Wireless *self,
ap = nm_ap_new (); ap = nm_ap_new ();
nm_ap_set_essid (ap, essid); nm_ap_set_essid (ap, essid);
nm_ap_set_artificial (ap, TRUE); nm_ap_set_artificial (ap, TRUE);
nm_ap_set_broadcast (ap, FALSE);
nm_ap_list_append_ap (dev_ap_list, ap); nm_ap_list_append_ap (dev_ap_list, ap);
nm_ap_unref (ap); nm_ap_unref (ap);
} }
@ -2488,7 +2489,7 @@ supplicant_send_network_config (NMDevice80211Wireless *self,
goto out; goto out;
/* For non-broadcast networks, we need to set "scan_ssid 1" to scan with probe request frames. */ /* For non-broadcast networks, we need to set "scan_ssid 1" to scan with probe request frames. */
if (nm_ap_get_artificial (ap)) if (!nm_ap_get_broadcast (ap))
{ {
if (!nm_utils_supplicant_request_with_check (ctrl, "OK", __func__, NULL, if (!nm_utils_supplicant_request_with_check (ctrl, "OK", __func__, NULL,
"SET_NETWORK %i scan_ssid 1", nwid)) "SET_NETWORK %i scan_ssid 1", nwid))
@ -3149,7 +3150,12 @@ process_scan_results (NMDevice80211Wireless *dev,
else if ((strlen (essid) == 8) && (strcmp (essid, "<hidden>") == 0)) /* Stupid ipw drivers use <hidden> */ else if ((strlen (essid) == 8) && (strcmp (essid, "<hidden>") == 0)) /* Stupid ipw drivers use <hidden> */
set = FALSE; set = FALSE;
if (set) if (set)
{
nm_ap_set_broadcast (ap, TRUE);
nm_ap_set_essid (ap, essid); nm_ap_set_essid (ap, essid);
}
else
nm_ap_set_broadcast (ap, FALSE);
g_free (essid); g_free (essid);
} }
break; break;

View file

@ -122,6 +122,7 @@ static void detail_network (DBusConnection *connection, const char *path, const
dbus_int32_t rate = 0; dbus_int32_t rate = 0;
dbus_int32_t capabilities = NM_802_11_CAP_NONE; dbus_int32_t capabilities = NM_802_11_CAP_NONE;
dbus_uint32_t mode = 0; dbus_uint32_t mode = 0;
gboolean broadcast = TRUE;
g_return_if_fail (connection != NULL); g_return_if_fail (connection != NULL);
g_return_if_fail (path != NULL); g_return_if_fail (path != NULL);
@ -141,13 +142,14 @@ static void detail_network (DBusConnection *connection, const char *path, const
} }
if (dbus_message_get_args (reply, NULL, DBUS_TYPE_OBJECT_PATH, &op, if (dbus_message_get_args (reply, NULL, DBUS_TYPE_OBJECT_PATH, &op,
DBUS_TYPE_STRING, &essid, DBUS_TYPE_STRING, &essid,
DBUS_TYPE_STRING, &hw_addr, DBUS_TYPE_STRING, &hw_addr,
DBUS_TYPE_INT32, &strength, DBUS_TYPE_INT32, &strength,
DBUS_TYPE_DOUBLE, &freq, DBUS_TYPE_DOUBLE, &freq,
DBUS_TYPE_INT32, &rate, DBUS_TYPE_INT32, &rate,
DBUS_TYPE_INT32, &mode, DBUS_TYPE_INT32, &mode,
DBUS_TYPE_INT32, &capabilities, DBUS_TYPE_INT32, &capabilities,
DBUS_TYPE_BOOLEAN, &broadcast,
DBUS_TYPE_INVALID)) DBUS_TYPE_INVALID))
{ {
char *temp = NULL; char *temp = NULL;
@ -176,8 +178,8 @@ static void detail_network (DBusConnection *connection, const char *path, const
enc_string = g_string_append (enc_string, ")"); enc_string = g_string_append (enc_string, ")");
} }
temp = g_strdup_printf ("%s Mode, Freq %.3f MHz, Strength %d%%%s", (mode == IW_MODE_INFRA) ? "Infrastructure" : "Ad-Hoc", temp = g_strdup_printf ("%s Mode, Freq %.3f MHz, Strength %d%%%s%s", (mode == IW_MODE_INFRA) ? "Infrastructure" : "Ad-Hoc",
flt_freq, strength, (enc_string && strlen (enc_string->str)) ? enc_string->str : ""); flt_freq, strength, (enc_string && strlen (enc_string->str)) ? enc_string->str : "", !broadcast ? ", Hidden" : "");
temp_essid = g_strdup_printf (" %s%s", active ? "*" : "", essid); temp_essid = g_strdup_printf (" %s%s", active ? "*" : "", essid);
print_string (temp_essid, temp); print_string (temp_essid, temp);
g_string_free (enc_string, TRUE); g_string_free (enc_string, TRUE);