Wireless Daemon for Linux
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: James Prestwood <prestwoj@gmail.com>, iwd@lists.linux.dev
Subject: Re: [PATCH 3/8] station: add debug method GetNetworks
Date: Thu, 11 Aug 2022 09:39:08 -0500	[thread overview]
Message-ID: <feae9344-ab84-e0c1-90e5-a652ad17bd47@gmail.com> (raw)
In-Reply-To: <20220810231621.372514-3-prestwoj@gmail.com>

Hi James,

On 8/10/22 18:16, James Prestwood wrote:
> This gets all networks but includes individual entries for each
> BSS.
> ---
>   src/station.c | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 94 insertions(+)
> 

You really should start with a commit in doc/ describing this API.

> +static void station_append_bss_list(struct l_dbus_message_builder *builder,
> +					const struct l_queue_entry *entry)
> +{
> +	for (; entry; entry = entry->next) {
> +		struct scan_bss *bss = entry->data;
> +		int32_t rssi = bss->signal_strength / 100;
> +
> +		l_dbus_message_builder_enter_array(builder, "{sv}");
> +
> +		dbus_append_dict_basic(builder, "Frequency", 'u',
> +						&bss->frequency);
> +		dbus_append_dict_basic(builder, "RSSI", 'i',
> +						&rssi);
> +		dbus_append_dict_basic(builder, "Rank", 'i', &bss->rank);

Rank is a uint16.

> +
> +		station_append_byte_array(builder, "Address", bss->addr, 6);

Are you sure you don't want Address in string form?

> +		station_append_byte_array(builder, "MDE", bss->mde, 3);
> +
> +		l_dbus_message_builder_leave_array(builder);
> +	}
> +}
> +
> +static struct l_dbus_message *station_debug_get_networks(struct l_dbus *dbus,
> +						struct l_dbus_message *message,
> +						void *user_data)
> +{
> +	struct station *station = user_data;
> +	struct l_dbus_message *reply =
> +				l_dbus_message_new_method_return(message);
> +	struct l_dbus_message_builder *builder =
> +				l_dbus_message_builder_new(reply);
> +	const struct l_queue_entry *entry;
> +
> +	l_dbus_message_builder_enter_array(builder, "{sv}");
> +
> +	for (entry = l_queue_get_entries(station->networks_sorted); entry;
> +							entry = entry->next) {
> +		const struct network *network = entry->data;
> +
> +		l_dbus_message_builder_enter_dict(builder, "sv");
> +		l_dbus_message_builder_append_basic(builder, 's',
> +						network_get_ssid(network));

Using the SSID as the key is not a good idea.  You can have multiple network 
types with the same SSID.  This should probably just be an array of some sort. 
Or maybe a dict where the key is the .Network object path.  Something like 
a(oa{sv}) or a{oa{sv}}.

> +		l_dbus_message_builder_enter_variant(builder, "aa{sv}");
> +		l_dbus_message_builder_enter_array(builder, "a{sv}");
> +
> +		station_append_bss_list(builder,
> +					network_bss_list_get_entries(network));
> +
> +		l_dbus_message_builder_leave_array(builder);
> +		l_dbus_message_builder_leave_variant(builder);
> +		l_dbus_message_builder_leave_dict(builder);
> +	}
> +
> +	/* Hidden Networks. Use an empty string for the SSID */
> +	l_dbus_message_builder_enter_dict(builder, "sv");
> +	l_dbus_message_builder_append_basic(builder, 's', "");
> +	l_dbus_message_builder_enter_variant(builder, "aa{sv}");
> +	l_dbus_message_builder_enter_array(builder, "a{sv}");
> +	station_append_bss_list(builder,
> +			l_queue_get_entries(station->hidden_bss_list_sorted));
> +	l_dbus_message_builder_leave_array(builder);
> +	l_dbus_message_builder_leave_variant(builder);
> +	l_dbus_message_builder_leave_dict(builder);
> +
> +	l_dbus_message_builder_leave_array(builder);
> +
> +	l_dbus_message_builder_finalize(builder);
> +	l_dbus_message_builder_destroy(builder);
> +
> +	return reply;
> +}
> +
>   static void station_setup_debug_interface(
>   					struct l_dbus_interface *interface)
>   {

Regards,
-Denis

  reply	other threads:[~2022-08-11 14:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-10 23:16 [PATCH 1/8] network: make network const in network_bss_list_get_entries James Prestwood
2022-08-10 23:16 ` [PATCH 2/8] station: check for matching SSID in Roam() James Prestwood
2022-08-10 23:16 ` [PATCH 3/8] station: add debug method GetNetworks James Prestwood
2022-08-11 14:39   ` Denis Kenzior [this message]
2022-08-10 23:16 ` [PATCH 4/8] client: add developer mode option (-E) James Prestwood
2022-08-11 14:40   ` Denis Kenzior
2022-08-10 23:16 ` [PATCH 5/8] client: allow entity name to be passed to completion James Prestwood
2022-08-10 23:16 ` [PATCH 6/8] client: add STATION_DEBUG_INTERFACE definition James Prestwood
2022-08-11 14:46   ` Denis Kenzior
2022-08-10 23:16 ` [PATCH 7/8] client: add station-debug command interface James Prestwood
2022-08-10 23:16 ` [PATCH 8/8] client: fix station autocomplete with multiple phys James Prestwood
2022-08-11 14:48   ` Denis Kenzior
2022-08-11 14:39 ` [PATCH 1/8] network: make network const in network_bss_list_get_entries Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=feae9344-ab84-e0c1-90e5-a652ad17bd47@gmail.com \
    --to=denkenz@gmail.com \
    --cc=iwd@lists.linux.dev \
    --cc=prestwoj@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox