anastasis-gtk

Demonstrator GUI for Anastasis
Log | Files | Refs | README | LICENSE

commit 94f31a28be7041c4127df143f19f5fbdafc1d558
parent d957221ae8c31f37c982181cff4855c3f8a01294
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sun, 27 Feb 2022 11:59:13 +0100

add application ID support (-a command-line option)

Diffstat:
Msrc/anastasis/anastasis-gtk.c | 12++++++++++++
Msrc/anastasis/anastasis-gtk.h | 7++++++-
Msrc/anastasis/anastasis-gtk_attributes.c | 4++++
3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/src/anastasis/anastasis-gtk.c b/src/anastasis/anastasis-gtk.c @@ -46,6 +46,11 @@ struct ANASTASIS_PolicyDiscovery *AG_pd; const struct GNUNET_CONFIGURATION_Handle *AG_cfg; /** + * Application ID to include in the user attributes. + */ +char *AG_application_id; + +/** * Closure for #GNUNET_CURL_gnunet_scheduler_reschedule(). */ static struct GNUNET_CURL_RescheduleContext *rc; @@ -253,10 +258,16 @@ main (int argc, char *const *argv) { struct GNUNET_GETOPT_CommandLineOption options[] = { + GNUNET_GETOPT_option_string ('a', + "application", + "ID", + "set the application ID", + &AG_application_id), GNUNET_GETOPT_OPTION_END }; int ret; + AG_application_id = GNUNET_strdup ("anastasis-gtk"); if (GNUNET_OK != GNUNET_GTK_main_loop_start ("anastasis-gtk", "GTK GUI for Anastasis", @@ -268,6 +279,7 @@ main (int argc, ret = 1; else ret = 0; + GNUNET_free (AG_application_id); return ret; } diff --git a/src/anastasis/anastasis-gtk.h b/src/anastasis/anastasis-gtk.h @@ -1,6 +1,6 @@ /* This file is part of anastasis-gtk. - Copyright (C) 2020 Anastasis SARL + Copyright (C) 2020-2022 Anastasis SARL Anastasis is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -42,6 +42,11 @@ extern struct GNUNET_GTK_MainLoop *AG_ml; extern struct ANASTASIS_PolicyDiscovery *AG_pd; /** + * Application ID to include in the user attributes. + */ +extern char *AG_application_id; + +/** * Our configuration. */ extern const struct GNUNET_CONFIGURATION_Handle *AG_cfg; diff --git a/src/anastasis/anastasis-gtk_attributes.c b/src/anastasis/anastasis-gtk_attributes.c @@ -154,6 +154,10 @@ AG_collect_attributes (bool partial) attr_name, val)); } + GNUNET_assert (0 == + json_object_set_new (result, + "application-id", + json_string (AG_application_id))); return GNUNET_JSON_PACK ( GNUNET_JSON_pack_object_steal ("identity_attributes", result));