From: Denis Kenzior <denkenz at gmail.com>
To: iwd at lists.01.org
Subject: Re: [PATCH v4 07/10] dpp-util: add dpp_parse_configuration_object
Date: Thu, 16 Dec 2021 14:36:19 -0600 [thread overview]
Message-ID: <2c079caf-7519-7589-6947-55fc223ae0f7@gmail.com> (raw)
In-Reply-To: 20211216180854.39470-7-prestwoj@gmail.com
[-- Attachment #1: Type: text/plain, Size: 1885 bytes --]
Hi James,
On 12/16/21 12:08, James Prestwood wrote:
> This parses the configuration JSON object from the configuration
> response. Only a minimal configuration object is supported for
> now.
> ---
> Makefile.am | 3 +-
> src/dpp-util.c | 110 +++++++++++++++++++++++++++++++++++++++++++++++++
> src/dpp-util.h | 12 ++++++
> 3 files changed, 124 insertions(+), 1 deletion(-)
>
<snip>
> +/*
> + * TODO: This handles the most basic configuration. i.e. a configuration object
> + * with ssid/passphrase/akm.
> + */
> +struct dpp_configuration *dpp_parse_configuration_object(const char *json,
> + size_t json_len)
> +{
> + struct dpp_configuration *config;
> + struct json_contents *c;
> + struct json_iter iter;
> + struct json_iter discovery;
> + struct json_iter cred;
> + _auto_(l_free)char *tech = NULL;
> + _auto_(l_free)char *ssid = NULL;
> + _auto_(l_free)char *akm = NULL;
> + _auto_(l_free)char *pass = NULL;
> + _auto_(l_free)char *psk = NULL;
nit: I changed these to have a space after l_free) and char *
> +
> + c = json_contents_new(json, json_len);
> + if (!c)
> + return NULL;
> +
> + json_iter_init(&iter, c);
> +
> + if (!json_iter_parse(&iter,
> + JSON_MANDATORY("wi-fi_tech", JSON_STRING, &tech),
> + JSON_MANDATORY("discovery", JSON_OBJECT, &discovery),
> + JSON_MANDATORY("cred", JSON_OBJECT, &cred),
> + JSON_UNDEFINED))
> + goto free_contents;
> +
> + if (!tech || strncmp(tech, "infra", 5))
> + goto free_contents;
> +
> +
Got rid of this double empty line.
> + if (!json_iter_parse(&discovery,
> + JSON_MANDATORY("ssid", JSON_STRING, &ssid),
> + JSON_UNDEFINED))
> + goto free_contents;
> +
> + if (!ssid || !util_ssid_is_utf8(strlen(ssid),(const uint8_t *)ssid))
And added a few spaces here for coding style reasons.
Applied, thanks.
Regards,
-Denis
next reply other threads:[~2021-12-16 20:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-16 20:36 Denis Kenzior [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-12-16 18:08 [PATCH v4 07/10] dpp-util: add dpp_parse_configuration_object James Prestwood
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=2c079caf-7519-7589-6947-55fc223ae0f7@gmail.com \
--to=iwd@lists.linux.dev \
/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