From d63771f255057b27485c1fc96a0713d64d0ae1af Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 24 Jul 2021 22:50:22 +0200 Subject: minimal test for new pq event functionality --- src/pq/pq_connect.c | 84 ++++++++++++----------------------------------------- src/pq/pq_event.c | 3 +- src/pq/test_pq.c | 64 ++++++++++++++++++++++++++++++++++++++-- 3 files changed, 83 insertions(+), 68 deletions(-) (limited to 'src') diff --git a/src/pq/pq_connect.c b/src/pq/pq_connect.c index 00664dcd0..8722d2151 100644 --- a/src/pq/pq_connect.c +++ b/src/pq/pq_connect.c @@ -24,6 +24,7 @@ */ #include "platform.h" #include "pq.h" +#include /** @@ -63,28 +64,6 @@ pq_notice_processor_cb (void *arg, } -/** - * Create a connection to the Postgres database using @a config_str for the - * configuration. Initialize logging via GNUnet's log routines and disable - * Postgres's logger. Also ensures that the statements in @a load_path and @a - * es are executed whenever we (re)connect to the database, and that the - * prepared statements in @a ps are "ready". If statements in @es fail that - * were created with #GNUNET_PQ_make_execute(), then the entire operation - * fails. - * - * In @a load_path, a list of "$XXXX.sql" files is expected where $XXXX - * must be a sequence of contiguous integer values starting at 0000. - * These files are then loaded in sequence using "psql $config_str" before - * running statements from @e es. The directory is inspected again on - * reconnect. - * - * @param config_str configuration to use - * @param load_path path to directory with SQL transactions to run, can be NULL - * @param es #GNUNET_PQ_PREPARED_STATEMENT_END-terminated - * array of statements to execute upon EACH connection, can be NULL - * @param ps array of prepared statements to prepare, can be NULL - * @return NULL on error - */ struct GNUNET_PQ_Context * GNUNET_PQ_connect (const char *config_str, const char *load_path, @@ -122,6 +101,11 @@ GNUNET_PQ_connect (const char *config_str, ps, plen * sizeof (struct GNUNET_PQ_PreparedStatement)); } + db->channel_map = GNUNET_CONTAINER_multishortmap_create (16, + GNUNET_YES); + GNUNET_assert (0 == + pthread_mutex_init (&db->notify_lock, + NULL)); GNUNET_PQ_reconnect (db); if (NULL == db->conn) { @@ -142,7 +126,7 @@ GNUNET_PQ_connect (const char *config_str, * @param i patch number to append to the @a load_path * @return #GNUNET_OK on success, #GNUNET_NO if patch @a i does not exist, #GNUNET_SYSERR on error */ -static int +static enum GNUNET_GenericReturnValue apply_patch (struct GNUNET_PQ_Context *db, const char *load_path, unsigned int i) @@ -200,15 +184,6 @@ apply_patch (struct GNUNET_PQ_Context *db, } -/** - * Within the @a db context, run all the SQL files - * from the @a load_path from 0000-9999.sql (as long - * as the files exist contiguously). - * - * @param db database context to use - * @param load_path where to find the XXXX.sql files - * @return #GNUNET_OK on success - */ enum GNUNET_GenericReturnValue GNUNET_PQ_run_sql (struct GNUNET_PQ_Context *db, const char *load_path) @@ -304,11 +279,6 @@ GNUNET_PQ_run_sql (struct GNUNET_PQ_Context *db, } -/** - * Reinitialize the database @a db if the connection is down. - * - * @param db database connection to reinitialize - */ void GNUNET_PQ_reconnect_if_down (struct GNUNET_PQ_Context *db) { @@ -321,14 +291,12 @@ GNUNET_PQ_reconnect_if_down (struct GNUNET_PQ_Context *db) } -/** - * Reinitialize the database @a db. - * - * @param db database connection to reinitialize - */ void GNUNET_PQ_reconnect (struct GNUNET_PQ_Context *db) { + if (NULL != db->sc) + db->sc (db->sc_cls, + -1); if (NULL != db->conn) PQfinish (db->conn); db->conn = PQconnectdb (db->config_str); @@ -448,26 +416,13 @@ GNUNET_PQ_reconnect (struct GNUNET_PQ_Context *db) db->conn = NULL; return; } + if ( (NULL != db->sc) && + (0 != GNUNET_CONTAINER_multishortmap_size (db->channel_map)) ) + db->sc (db->sc_cls, + PQsocket (db->conn)); } -/** - * Connect to a postgres database using the configuration - * option "CONFIG" in @a section. Also ensures that the - * statements in @a es are executed whenever we (re)connect to the - * database, and that the prepared statements in @a ps are "ready". - * - * The caller does not have to ensure that @a es and @a ps remain allocated - * and initialized in memory until #GNUNET_PQ_disconnect() is called, as a copy will be made. - * - * @param cfg configuration - * @param section configuration section to use to get Postgres configuration options - * @param load_path_suffix suffix to append to the SQL_DIR in the configuration - * @param es #GNUNET_PQ_PREPARED_STATEMENT_END-terminated - * array of statements to execute upon EACH connection, can be NULL - * @param ps array of prepared statements to prepare, can be NULL - * @return the postgres handle, NULL on error - */ struct GNUNET_PQ_Context * GNUNET_PQ_connect_with_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, @@ -509,15 +464,14 @@ GNUNET_PQ_connect_with_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg, } -/** - * Disconnect from the database, destroying the prepared statements - * and releasing other associated resources. - * - * @param db database handle to disconnect (will be free'd) - */ void GNUNET_PQ_disconnect (struct GNUNET_PQ_Context *db) { + GNUNET_assert (0 == + GNUNET_CONTAINER_multishortmap_size (db->channel_map)); + GNUNET_CONTAINER_multishortmap_destroy (db->channel_map); + GNUNET_assert (0 == + pthread_mutex_destroy (&db->notify_lock)); GNUNET_free (db->es); GNUNET_free (db->ps); GNUNET_free (db->load_path); diff --git a/src/pq/pq_event.c b/src/pq/pq_event.c index ecb942230..b87aa6c5a 100644 --- a/src/pq/pq_event.c +++ b/src/pq/pq_event.c @@ -346,6 +346,7 @@ GNUNET_PQ_event_listen_cancel (struct GNUNET_PQ_EventHandler *eh) } GNUNET_assert (0 == pthread_mutex_unlock (&db->notify_lock)); + GNUNET_free (eh); } @@ -364,7 +365,7 @@ GNUNET_PQ_event_notify (struct GNUNET_PQ_Context *db, end = es_to_channel (es, end); end = stpcpy (end, - "'"); + ", '"); end = GNUNET_STRINGS_data_to_string (extra, extra_size, end, diff --git a/src/pq/test_pq.c b/src/pq/test_pq.c index e588da45d..b3747dfc3 100644 --- a/src/pq/test_pq.c +++ b/src/pq/test_pq.c @@ -220,6 +220,64 @@ run_queries (struct GNUNET_PQ_Context *db) } +static void +event_cb (void *cls, + const void *extra, + size_t extra_size) +{ + unsigned int *cnt = cls; + + GNUNET_assert (5 == extra_size); + GNUNET_assert (0 == memcmp ("world", + extra, + 5)); + (*cnt)++; +} + + +/** + * Run subscribe/notify tests. + * + * @param db database handle + * @return 0 on success + */ +static int +test_notify (struct GNUNET_PQ_Context *db) +{ + struct GNUNET_PQ_EventHeaderP e1 = { + .size = htons (sizeof (e1)), + .type = htons (1) + }; + struct GNUNET_PQ_EventHeaderP e2 = { + .size = htons (sizeof (e2)), + .type = htons (2) + }; + unsigned int called = 0; + struct GNUNET_PQ_EventHandler *eh; + + eh = GNUNET_PQ_event_listen (db, + &e1, + &event_cb, + &called); + GNUNET_assert (NULL != eh); + GNUNET_PQ_event_notify (db, + &e2, + "hello", + 5); + GNUNET_PQ_event_do_poll (db); + GNUNET_assert (0 == called); + GNUNET_PQ_event_notify (db, + &e1, + "world", + 5); + GNUNET_PQ_event_do_poll (db); + GNUNET_assert (1 == called); + GNUNET_PQ_event_listen_cancel (eh); + return 0; +} + + + int main (int argc, const char *const argv[]) @@ -272,12 +330,14 @@ main (int argc, return 1; } ret = run_queries (db); + ret |= test_notify (db); + ret |= test_notify (db); #if TEST_RESTART fprintf (stderr, "Please restart Postgres database now!\n"); sleep (60); - ret = run_queries (db); + ret |= run_queries (db); fprintf (stderr, "Result: %d (expect: 1 -- if you restarted the DB)\n", ret); - ret = run_queries (db); + ret |= run_queries (db); fprintf (stderr, "Result: %d (expect: 0)\n", ret); #endif { -- cgit v1.2.3 From aaeebebf670a2019a7ac8accb40e23cd923d396b Mon Sep 17 00:00:00 2001 From: TheJackiMonster Date: Sat, 24 Jul 2021 23:44:11 +0200 Subject: -added sent flag to messenger service Signed-off-by: TheJackiMonster --- src/include/gnunet_messenger_service.h | 8 ++++++- src/messenger/gnunet-messenger.c | 7 +++++- src/messenger/gnunet-service-messenger_handle.c | 32 ++++++++++++++++++++++--- 3 files changed, 42 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/include/gnunet_messenger_service.h b/src/include/gnunet_messenger_service.h index ecd856eb9..ff5a91409 100644 --- a/src/include/gnunet_messenger_service.h +++ b/src/include/gnunet_messenger_service.h @@ -499,6 +499,7 @@ struct GNUNET_MESSENGER_Message /** * Enum for the different supported flags used by message handling + * Compatible flags can be OR'ed together. */ enum GNUNET_MESSENGER_MessageFlags { @@ -507,10 +508,15 @@ enum GNUNET_MESSENGER_MessageFlags */ GNUNET_MESSENGER_FLAG_NONE = 0, + /** + * The sent flag. The flag indicates that the message was sent by the client. + */ + GNUNET_MESSENGER_FLAG_SENT = 1, + /** * The private flag. The flag indicates that the message was privately encrypted. */ - GNUNET_MESSENGER_FLAG_PRIVATE = 1, + GNUNET_MESSENGER_FLAG_PRIVATE = 2, }; /** diff --git a/src/messenger/gnunet-messenger.c b/src/messenger/gnunet-messenger.c index 094ae398d..28fa4b147 100644 --- a/src/messenger/gnunet-messenger.c +++ b/src/messenger/gnunet-messenger.c @@ -80,7 +80,12 @@ on_message (void *cls, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_M } case GNUNET_MESSENGER_KIND_TEXT: { - printf ("* '%s' says: \"%s\"\n", sender_name, message->body.text.text); + if (flags & GNUNET_MESSENGER_FLAG_SENT) + printf (">"); + else + printf ("<"); + + printf (" '%s' says: \"%s\"\n", sender_name, message->body.text.text); break; } default: diff --git a/src/messenger/gnunet-service-messenger_handle.c b/src/messenger/gnunet-service-messenger_handle.c index 4d2318d62..d7007dbf6 100644 --- a/src/messenger/gnunet-service-messenger_handle.c +++ b/src/messenger/gnunet-service-messenger_handle.c @@ -474,6 +474,28 @@ get_next_member_session_contect(const struct GNUNET_MESSENGER_MemberSession *ses return get_member_session_context(session); } +static const struct GNUNET_MESSENGER_MemberSession* +get_handle_member_session (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key) +{ + GNUNET_assert((handle) && (key) && (handle->service)); + + const struct GNUNET_ShortHashCode *id = get_handle_member_id(handle, key); + struct GNUNET_MESSENGER_SrvRoom *room = get_service_room(handle->service, key); + + if ((!id) || (!room)) + return NULL; + + struct GNUNET_MESSENGER_MemberStore *store = get_room_member_store(room); + struct GNUNET_MESSENGER_Member *member = get_store_member(store, id); + + const struct GNUNET_MESSENGER_Ego *ego = get_handle_ego(handle); + + if (!ego) + return NULL; + + return get_member_session(member, &(ego->pub)); +} + void notify_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, const struct GNUNET_MESSENGER_MemberSession *session, @@ -523,9 +545,13 @@ notify_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, const struct G GNUNET_memcpy(&(msg->context), context, sizeof(msg->context)); GNUNET_memcpy(&(msg->hash), hash, sizeof(msg->hash)); - msg->flags = (uint32_t) ( - private_message? GNUNET_MESSENGER_FLAG_PRIVATE : GNUNET_MESSENGER_FLAG_NONE - ); + msg->flags = (uint32_t) GNUNET_MESSENGER_FLAG_NONE; + + if (get_handle_member_session(handle, key) == session) + msg->flags |= (uint32_t) GNUNET_MESSENGER_FLAG_SENT; + + if (private_message) + msg->flags |= (uint32_t) GNUNET_MESSENGER_FLAG_PRIVATE; char *buffer = ((char*) msg) + sizeof(*msg); encode_message (message, length, buffer, GNUNET_YES); -- cgit v1.2.3 From b1a0dcd618befbbef049d1c2ce262c97f1c70a6f Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 25 Jul 2021 16:05:56 +0200 Subject: -complete new PQ event implementation, alas undertested --- src/pq/pq.h | 15 ++++++++++ src/pq/pq_event.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 100 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/pq/pq.h b/src/pq/pq.h index 3c89626a9..bad99b307 100644 --- a/src/pq/pq.h +++ b/src/pq/pq.h @@ -77,6 +77,21 @@ struct GNUNET_PQ_Context * Lock to access @e channel_map. */ pthread_mutex_t notify_lock; + + /** + * Task responsible for processing events. + */ + struct GNUNET_SCHEDULER_Task *event_task; + + /** + * File descriptor wrapper for @e event_task. + */ + struct GNUNET_NETWORK_Handle *rfd; + + /** + * Is scheduling via the GNUnet scheduler desired? + */ + bool scheduler_on; }; #endif diff --git a/src/pq/pq_event.c b/src/pq/pq_event.c index b87aa6c5a..879caf842 100644 --- a/src/pq/pq_event.c +++ b/src/pq/pq_event.c @@ -235,17 +235,100 @@ GNUNET_PQ_event_do_poll (struct GNUNET_PQ_Context *db) } +/** + * Function called when the Postgres FD changes and we need + * to update the scheduler event loop task. + * + * @param cls a `struct GNUNET_PQ_Context *` + * @param fd the file descriptor, possibly -1 + */ +static void +scheduler_fd_cb (void *cls, + int fd); + + +/** + * The GNUnet scheduler notifies us that we need to + * trigger the DB event poller. + * + * @param cls a `struct GNUNET_PQ_Context *` + */ +static void +do_scheduler_notify (void *cls) +{ + struct GNUNET_PQ_Context *db = cls; + + GNUNET_assert (db->scheduler_on); + GNUNET_assert (NULL != db->rfd); + GNUNET_PQ_event_do_poll (db); + db->event_task + = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_ZERO, + db->rfd, + &do_scheduler_notify, + db); +} + + +/** + * Function called when the Postgres FD changes and we need + * to update the scheduler event loop task. + * + * @param cls a `struct GNUNET_PQ_Context *` + * @param fd the file descriptor, possibly -1 + */ +static void +scheduler_fd_cb (void *cls, + int fd) +{ + struct GNUNET_PQ_Context *db = cls; + + if (NULL != db->event_task) + { + GNUNET_SCHEDULER_cancel (db->event_task); + db->event_task = NULL; + } + GNUNET_free (db->rfd); + if (-1 == fd) + return; + if (0 == GNUNET_CONTAINER_multishortmap_size (db->channel_map)) + return; + db->rfd = GNUNET_NETWORK_socket_box_native (fd); + db->event_task + = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_ZERO, + db->rfd, + &do_scheduler_notify, + db); +} + + void GNUNET_PQ_event_scheduler_start (struct GNUNET_PQ_Context *db) { - GNUNET_break (0); // FIXME: not implemented + int fd; + + GNUNET_assert (! db->scheduler_on); + GNUNET_assert (NULL == db->sc); + db->scheduler_on = true; + db->sc = &scheduler_fd_cb; + db->sc_cls = db; + fd = PQsocket (db->conn); + scheduler_fd_cb (db, + fd); } void GNUNET_PQ_event_scheduler_stop (struct GNUNET_PQ_Context *db) { - GNUNET_break (0); // FIXME: not implemented + GNUNET_assert (db->scheduler_on); + GNUNET_free (db->rfd); + db->sc = NULL; + db->scheduler_on = false; + if (NULL != db->event_task) + { + GNUNET_SCHEDULER_cancel (db->event_task); + db->event_task = NULL; + } } -- cgit v1.2.3 From 3ac1088039a3c5315c4a336775b31e08671ddd81 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 25 Jul 2021 16:36:25 +0200 Subject: -extend tests, include reconnect handling for events --- src/pq/pq.h | 11 +++++ src/pq/pq_connect.c | 1 + src/pq/pq_event.c | 36 ++++++++++++++++ src/pq/test_pq.c | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 167 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/pq/pq.h b/src/pq/pq.h index bad99b307..107fd116c 100644 --- a/src/pq/pq.h +++ b/src/pq/pq.h @@ -94,4 +94,15 @@ struct GNUNET_PQ_Context bool scheduler_on; }; + +/** + * Internal API. Reconnect should re-register notifications + * after a disconnect. + * + * @param db the DB handle + */ +void +GNUNET_PQ_event_reconnect_ (struct GNUNET_PQ_Context *db); + + #endif diff --git a/src/pq/pq_connect.c b/src/pq/pq_connect.c index 8722d2151..4e614526b 100644 --- a/src/pq/pq_connect.c +++ b/src/pq/pq_connect.c @@ -416,6 +416,7 @@ GNUNET_PQ_reconnect (struct GNUNET_PQ_Context *db) db->conn = NULL; return; } + GNUNET_PQ_event_reconnect_ (db); if ( (NULL != db->sc) && (0 != GNUNET_CONTAINER_multishortmap_size (db->channel_map)) ) db->sc (db->sc_cls, diff --git a/src/pq/pq_event.c b/src/pq/pq_event.c index 879caf842..74b8b3653 100644 --- a/src/pq/pq_event.c +++ b/src/pq/pq_event.c @@ -365,6 +365,42 @@ manage_subscribe (struct GNUNET_PQ_Context *db, } +/** + * Re-subscribe to notifications after disconnect. + * + * @param cls the DB context + * @param sh the short hash of the channel + * @param eh the event handler + * @return #GNUNET_OK to continue to iterate + */ +static int +register_notify (void *cls, + const struct GNUNET_ShortHashCode *sh, + void *value) +{ + struct GNUNET_PQ_Context *db = cls; + struct GNUNET_PQ_EventHandler *eh = value; + + manage_subscribe (db, + "LISTEN ", + eh); + return GNUNET_OK; +} + + +void +GNUNET_PQ_event_reconnect_ (struct GNUNET_PQ_Context *db) +{ + GNUNET_assert (0 == + pthread_mutex_lock (&db->notify_lock)); + GNUNET_CONTAINER_multishortmap_iterate (db->channel_map, + ®ister_notify, + db); + GNUNET_assert (0 == + pthread_mutex_unlock (&db->notify_lock)); +} + + struct GNUNET_PQ_EventHandler * GNUNET_PQ_event_listen (struct GNUNET_PQ_Context *db, const struct GNUNET_PQ_EventHeaderP *es, diff --git a/src/pq/test_pq.c b/src/pq/test_pq.c index b3747dfc3..1df1cd126 100644 --- a/src/pq/test_pq.c +++ b/src/pq/test_pq.c @@ -25,6 +25,26 @@ #include "platform.h" #include "pq.h" +/** + * Database handle. + */ +static struct GNUNET_PQ_Context *db; + +/** + * Global return value, 0 on success. + */ +static int ret; + +/** + * An event handler. + */ +static struct GNUNET_PQ_EventHandler *eh; + +/** + * Timeout task. + */ +static struct GNUNET_SCHEDULER_Task *tt; + /** * Setup prepared statements. @@ -277,6 +297,91 @@ test_notify (struct GNUNET_PQ_Context *db) } +/** + * Task called on shutdown. + * + * @param cls NULL + */ +static void +event_end (void *cls) +{ + GNUNET_PQ_event_scheduler_stop (db); + GNUNET_PQ_event_listen_cancel (eh); + eh = NULL; + if (NULL != tt) + { + GNUNET_SCHEDULER_cancel (tt); + tt = NULL; + } +} + + +/** + * Task called on timeout. Should not happen, means + * we did not get the expected event. + * + * @param cls NULL + */ +static void +timeout_cb (void *cls) +{ + ret = 2; + GNUNET_break (0); + tt = NULL; + GNUNET_SCHEDULER_shutdown (); +} + + +/** + * Task called on expected event + * + * @param cls NULL + */ +static void +event_sched_cb (void *cls, + const void *extra, + size_t extra_size) +{ + GNUNET_assert (5 == extra_size); + GNUNET_assert (0 == + memcmp ("hello", + extra, + 5)); + GNUNET_SCHEDULER_shutdown (); +} + + +/** + * Run tests that need a scheduler. + * + * @param cls NULL + */ +static void +sched_tests (void *cls) +{ + struct GNUNET_PQ_EventHeaderP es = { + .size = htons (sizeof (es)), + .type = htons (42) + }; + + + tt = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, + &timeout_cb, + NULL); + GNUNET_PQ_event_scheduler_start (db); + eh = GNUNET_PQ_event_listen (db, + &es, + &event_sched_cb, + NULL); + GNUNET_PQ_reconnect (db); + GNUNET_SCHEDULER_add_shutdown (&event_end, + NULL); + GNUNET_PQ_event_notify (db, + &es, + "hello", + 5); +} + int main (int argc, @@ -297,8 +402,6 @@ main (int argc, ")"), GNUNET_PQ_EXECUTE_STATEMENT_END }; - struct GNUNET_PQ_Context *db; - int ret; GNUNET_log_setup ("test-pq", "WARNING", @@ -332,6 +435,20 @@ main (int argc, ret = run_queries (db); ret |= test_notify (db); ret |= test_notify (db); + if (0 != ret) + { + GNUNET_break (0); + GNUNET_PQ_disconnect (db); + return ret; + } + GNUNET_SCHEDULER_run (&sched_tests, + NULL); + if (0 != ret) + { + GNUNET_break (0); + GNUNET_PQ_disconnect (db); + return ret; + } #if TEST_RESTART fprintf (stderr, "Please restart Postgres database now!\n"); sleep (60); -- cgit v1.2.3 From 8be49ca6ed306bc8c5833fb006b22f1099df93ba Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 26 Jul 2021 09:05:26 +0200 Subject: simplify linkage --- src/testbed/Makefile.am | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/testbed/Makefile.am b/src/testbed/Makefile.am index a9837daf5..cca8c59bc 100644 --- a/src/testbed/Makefile.am +++ b/src/testbed/Makefile.am @@ -101,8 +101,6 @@ gnunet_cmds_helper_SOURCES = \ gnunet_cmds_helper_LDADD = $(XLIB) \ $(top_builddir)/src/util/libgnunetutil.la \ $(top_builddir)/src/testing/libgnunettesting.la \ - $(top_builddir)/src/transport/libgnunettransport.la \ - libgnunettestbed.la \ $(LTLIBINTL) $(Z_LIBS) gnunet_daemon_testbed_blacklist_SOURCES = gnunet-daemon-testbed-blacklist.c -- cgit v1.2.3 From 51990dbbf5b7d5332526ed31285f50a5fcb75666 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 26 Jul 2021 15:31:14 +0200 Subject: JSON: add draft for new GNUNET_JSON_PACK API --- src/include/gnunet_json_lib.h | 318 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 318 insertions(+) (limited to 'src') diff --git a/src/include/gnunet_json_lib.h b/src/include/gnunet_json_lib.h index 3dc79105e..7cb687593 100644 --- a/src/include/gnunet_json_lib.h +++ b/src/include/gnunet_json_lib.h @@ -521,6 +521,324 @@ GNUNET_JSON_getopt (char shortName, const char *description, json_t **json); + +/* ****************** JSON PACK helper ******************* */ + + +/** + * Element in the array to give to the packer. + */ +struct GNUNET_JSON_PackSpec; + + +/** + * Function called to pack an element into the JSON + * object as part of #GNUNET_JSON_pack_(). + * + * @param se pack specification to execute + * @return json object to pack, NULL to pack nothing + */ +typedef json_t * +(GNUNET_JSON_PackCallback)(const struct GNUNET_JSON_PackSpec *se); + + +/** + * Element in the array to give to the packer. + */ +struct GNUNET_JSON_PackSpec +{ + /** + * Name of the field to pack. + */ + const char *field_name; + + /** + * Function that will do the packing. + */ + GNUNET_JSON_PackCallback packer; + + /** + * Closure for @e packer. + */ + void *packer_cls; + + /** + * Pointer to be provided to the packer. + */ + const void *value_ptr; + + /** + * Numeric value for the packer, could be + * the length of the data in @e value_ptr, + * or something different depending on the type. + */ + uint64_t value_num; + + /** + * True if a NULL (or 0) argument is allowed. In this + * case, if the argument is NULL the @e packer should + * return NULL and the field should be skipped (omitted from + * the generated object) and not be serialized at all. + */ + bool allow_null; +}; + + +/** + * Pack a JSON object from a @a spec. Aborts if + * packing fails. + * + * @param spec specification object + * @return JSON object + */ +json_t * +GNUNET_JSON_pack_ (struct GNUNET_JSON_PackSpec spec[]); + + +/** + * Pack a JSON object from a @a spec. Aborts if + * packing fails. + * + * @param ... list of specification objects + * @return JSON object + */ +#define GNUNET_JSON_PACK(...) \ + GNUNET_JSON_pack_ ((struct GNUNET_JSON_PackSpec[]) {__VA_ARGS__, GNUNET_JSON_pack_end_ ()}) + + +/** + * Do not use directly. Use #GNUNET_JSON_PACK. + * + * @return array terminator + */ +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_end_(void); + + +/** + * Modify packer instruction to allow NULL as a value. + * + * @param in json pack specification to modify + * @return json pack specification + */ +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_allow_null (struct GNUNET_JSON_PackSpec in); + + +/** + * Generate packer instruction for a JSON field of type + * bool. + * + * @param name name of the field to add to the object + * @param b boolean value + * @return json pack specification + */ +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_bool (const char *name, + bool b); + + +/** + * Generate packer instruction for a JSON field of type + * string. + * + * @param name name of the field to add to the object + * @param s string value + * @return json pack specification + */ +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_string (const char *name, + const char *s); + + +/** + * Generate packer instruction for a JSON field of type + * unsigned integer. Note that the maximum allowed + * value is still limited by JSON and not UINT64_MAX. + * + * @param name name of the field to add to the object + * @param num numeric value + * @return json pack specification + */ +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_uint64 (const char *name, + uint64_t num); + + +/** + * Generate packer instruction for a JSON field of type + * signed integer. + * + * @param name name of the field to add to the object + * @param num numeric value + * @return json pack specification + */ +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_int64 (const char *name, + int64_t num); + + +/** + * Generate packer instruction for a JSON field of type + * JSON object where the reference is taken over by + * the packer. + * + * @param name name of the field to add to the object + * @param o object to steal + * @return json pack specification + */ +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_object_steal (const char *name, + json_t *o); + + +/** + * Generate packer instruction for a JSON field of type JSON object where the + * reference counter is incremented by the packer. Note that a deep copy is + * not performed. + * + * @param name name of the field to add to the object + * @param o object to increment reference counter of + * @return json pack specification + */ +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_object_incref (const char *name, + json_t *o); + + +/** + * Generate packer instruction for a JSON field of type + * JSON array where the reference is taken over by + * the packer. + * + * @param name name of the field to add to the object + * @param a array to steal + * @return json pack specification + */ +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_array_steal (const char *name, + json_t *a); + + +/** + * Generate packer instruction for a JSON field of type JSON array where the + * reference counter is incremented by the packer. Note that a deep copy is + * not performed. + * + * @param name name of the field to add to the object + * @param a array to increment reference counter of + * @return json pack specification + */ +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_array_incref (const char *name, + json_t *a); + + +/** + * Generate packer instruction for a JSON field of type + * variable size binary blob. + * + * @param name name of the field to add to the object + * @param blob binary data to pack + * @param blob_size number of bytes in @a blob + * @return json pack specification + */ +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_data_varsize (const char *name, + const void *blob, + size_t blob_size); + + +/** + * Generate packer instruction for a JSON field where the + * size is automatically determined from the argument. + * + * @param name name of the field to add to the object + * @param blob data to pack, must not be an array + * @return json pack specification + */ +#define GNUNET_JSON_pack_data_auto(name,blob) \ + GNUNET_JSON_pack_data_varsize (name, blob, sizeof (*blob)) + + +/** + * Generate packer instruction for a JSON field of type + * absolute time. + * + * @param name name of the field to add to the object + * @param at absolute time to pack + * @return json pack specification + */ +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_time_abs (const char *name, + struct GNUNET_TIME_Absolute at); + + +/** + * Generate packer instruction for a JSON field of type + * absolute time in network byte order. + * + * @param name name of the field to add to the object + * @param at absolute time to pack + * @return json pack specification + */ +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_time_abs_nbo (const char *name, + struct GNUNET_TIME_AbsoluteNBO at); + + +/** + * Generate packer instruction for a JSON field of type + * relative time. + * + * @param name name of the field to add to the object + * @param rt relative time to pack + * @return json pack specification + */ +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_time_rel (const char *name, + struct GNUNET_TIME_Relative rt); + + +/** + * Generate packer instruction for a JSON field of type + * relative time in network byte order. + * + * @param name name of the field to add to the object + * @param rt relative time to pack + * @return json pack specification + */ +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_time_rel (const char *name, + struct GNUNET_TIME_RelativeNBO rt); + + +/** + * Generate packer instruction for a JSON field of type + * RSA public key. + * + * @param name name of the field to add to the object + * @param pk RSA public key + * @return json pack specification + */ +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_rsa_public_key (const char *name, + const struct GNUNET_CRYPTO_RsaPublicKey *pk); + + +/** + * Generate packer instruction for a JSON field of type + * RSA signature. + * + * @param name name of the field to add to the object + * @param sig RSA signature + * @return json pack specification + */ +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_ (const char *name, + const struct GNUNET_CRYPTO_RsaSignature *sig); + + #endif /* end of gnunet_json_lib.h */ -- cgit v1.2.3 From e5b94227dfa1ceae8125530316103eacf17155e2 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 26 Jul 2021 15:34:38 +0200 Subject: -missing library --- src/testbed/Makefile.am | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/testbed/Makefile.am b/src/testbed/Makefile.am index cca8c59bc..c1d89607c 100644 --- a/src/testbed/Makefile.am +++ b/src/testbed/Makefile.am @@ -44,6 +44,7 @@ libgnunet_plugin_testcmd_la_SOURCES = \ plugin_testcmd.c libgnunet_plugin_testcmd_la_LIBADD = \ $(top_builddir)/src/util/libgnunetutil.la \ + $(top_builddir)/src/arm/libgnunetarm.la \ $(top_builddir)/src/testing/libgnunettesting.la \ $(top_builddir)/src/statistics/libgnunetstatistics.la \ libgnunettestbed.la \ -- cgit v1.2.3 From 3f2cfc1d9c26afa625d8cb469d29e27f62d3f8cb Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 26 Jul 2021 15:43:51 +0200 Subject: -fix FTBFS in json pack header --- src/include/gnunet_json_lib.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/include/gnunet_json_lib.h b/src/include/gnunet_json_lib.h index 7cb687593..e962bd9cd 100644 --- a/src/include/gnunet_json_lib.h +++ b/src/include/gnunet_json_lib.h @@ -555,7 +555,7 @@ struct GNUNET_JSON_PackSpec /** * Function that will do the packing. */ - GNUNET_JSON_PackCallback packer; + GNUNET_JSON_PackCallback *packer; /** * Closure for @e packer. @@ -809,8 +809,8 @@ GNUNET_JSON_pack_time_rel (const char *name, * @return json pack specification */ struct GNUNET_JSON_PackSpec -GNUNET_JSON_pack_time_rel (const char *name, - struct GNUNET_TIME_RelativeNBO rt); +GNUNET_JSON_pack_time_rel_nbo (const char *name, + struct GNUNET_TIME_RelativeNBO rt); /** @@ -835,8 +835,8 @@ GNUNET_JSON_pack_rsa_public_key (const char *name, * @return json pack specification */ struct GNUNET_JSON_PackSpec -GNUNET_JSON_pack_ (const char *name, - const struct GNUNET_CRYPTO_RsaSignature *sig); +GNUNET_JSON_pack_rsa_public_key_ (const char *name, + const struct GNUNET_CRYPTO_RsaSignature *sig); #endif -- cgit v1.2.3 From caa326c94792deb0d6718515ab6a0589fae4c270 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 26 Jul 2021 15:45:51 +0200 Subject: -fix ftbfs --- src/include/gnunet_json_lib.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/include/gnunet_json_lib.h b/src/include/gnunet_json_lib.h index 7cb687593..2b582669f 100644 --- a/src/include/gnunet_json_lib.h +++ b/src/include/gnunet_json_lib.h @@ -539,7 +539,7 @@ struct GNUNET_JSON_PackSpec; * @return json object to pack, NULL to pack nothing */ typedef json_t * -(GNUNET_JSON_PackCallback)(const struct GNUNET_JSON_PackSpec *se); +(*GNUNET_JSON_PackCallback)(const struct GNUNET_JSON_PackSpec *se); /** @@ -809,8 +809,8 @@ GNUNET_JSON_pack_time_rel (const char *name, * @return json pack specification */ struct GNUNET_JSON_PackSpec -GNUNET_JSON_pack_time_rel (const char *name, - struct GNUNET_TIME_RelativeNBO rt); +GNUNET_JSON_pack_time_rel_nbo (const char *name, + struct GNUNET_TIME_RelativeNBO rt); /** @@ -835,8 +835,8 @@ GNUNET_JSON_pack_rsa_public_key (const char *name, * @return json pack specification */ struct GNUNET_JSON_PackSpec -GNUNET_JSON_pack_ (const char *name, - const struct GNUNET_CRYPTO_RsaSignature *sig); +GNUNET_JSON_pack_rsa_signature (const char *name, + const struct GNUNET_CRYPTO_RsaSignature *sig); #endif -- cgit v1.2.3 From 90095d19b4da40e79dce43a31af398a8925bcc4a Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 26 Jul 2021 16:32:34 +0200 Subject: implement typed JSON packer --- src/include/gnunet_json_lib.h | 21 +-- src/json/Makefile.am | 5 +- src/json/json.c | 34 ----- src/json/json_pack.c | 291 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 296 insertions(+), 55 deletions(-) create mode 100644 src/json/json_pack.c (limited to 'src') diff --git a/src/include/gnunet_json_lib.h b/src/include/gnunet_json_lib.h index 27a4a20cd..144ddb64a 100644 --- a/src/include/gnunet_json_lib.h +++ b/src/include/gnunet_json_lib.h @@ -553,26 +553,9 @@ struct GNUNET_JSON_PackSpec const char *field_name; /** - * Function that will do the packing. + * Object to pack. */ - GNUNET_JSON_PackCallback *packer; - - /** - * Closure for @e packer. - */ - void *packer_cls; - - /** - * Pointer to be provided to the packer. - */ - const void *value_ptr; - - /** - * Numeric value for the packer, could be - * the length of the data in @e value_ptr, - * or something different depending on the type. - */ - uint64_t value_num; + json_t *object; /** * True if a NULL (or 0) argument is allowed. In this diff --git a/src/json/Makefile.am b/src/json/Makefile.am index d4ea38adf..3c19f96bf 100644 --- a/src/json/Makefile.am +++ b/src/json/Makefile.am @@ -16,9 +16,10 @@ libgnunetjson_la_LDFLAGS = \ libgnunetjson_la_CFLAGS = $(MHD_CFLAGS) $(AM_CFLAGS) libgnunetjson_la_SOURCES = \ json.c \ - json_mhd.c \ json_generator.c \ - json_helper.c + json_helper.c \ + json_mhd.c \ + json_pack.c libgnunetjson_la_LIBADD = \ $(top_builddir)/src/util/libgnunetutil.la \ -ljansson \ diff --git a/src/json/json.c b/src/json/json.c index d55189804..4dabd4d22 100644 --- a/src/json/json.c +++ b/src/json/json.c @@ -28,19 +28,6 @@ #include "gnunet_json_lib.h" -/** - * Navigate and parse data in a JSON tree. Tries to parse the @a root - * to find all of the values given in the @a spec. If one of the - * entries in @a spec cannot be found or parsed, the name of the JSON - * field is returned in @a error_json_name, and the offset of the - * entry in @a spec is returned in @a error_line. - * - * @param root the JSON node to start the navigation at. - * @param spec parse specification array - * @param[out] error_json_name which JSON field was problematic - * @param[out] which index into @a spec did we encounter an error - * @return #GNUNET_OK on success, #GNUNET_SYSERR on error - */ enum GNUNET_GenericReturnValue GNUNET_JSON_parse (const json_t *root, struct GNUNET_JSON_Specification *spec, @@ -85,12 +72,6 @@ GNUNET_JSON_parse (const json_t *root, } -/** - * Set the "optional" flag for a parser specification entry. - * - * @param spec specification to modify - * @return spec copy of @a spec with optional bit set - */ struct GNUNET_JSON_Specification GNUNET_JSON_spec_mark_optional (struct GNUNET_JSON_Specification spec) { @@ -101,12 +82,6 @@ GNUNET_JSON_spec_mark_optional (struct GNUNET_JSON_Specification spec) } -/** - * Frees all elements allocated during a #GNUNET_JSON_parse() - * operation. - * - * @param spec specification of the parse operation - */ void GNUNET_JSON_parse_free (struct GNUNET_JSON_Specification *spec) { @@ -151,15 +126,6 @@ set_json (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, } -/** - * Allow user to specify a JSON input value. - * - * @param shortName short name of the option - * @param name long name of the option - * @param argumentHelp help text for the option argument - * @param description long help text for the option - * @param[out] val set to the JSON specified at the command line - */ struct GNUNET_GETOPT_CommandLineOption GNUNET_JSON_getopt (char shortName, const char *name, diff --git a/src/json/json_pack.c b/src/json/json_pack.c new file mode 100644 index 000000000..88edaca5f --- /dev/null +++ b/src/json/json_pack.c @@ -0,0 +1,291 @@ +/* + This file is part of GNUnet + Copyright (C) 2021 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet 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 + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + + SPDX-License-Identifier: AGPL3.0-or-later + */ +/** + * @file json/json_pack.c + * @brief functions to pack JSON objects + * @author Christian Grothoff + */ +#include "platform.h" +#include "gnunet_json_lib.h" + + +json_t * +GNUNET_JSON_pack_ (struct GNUNET_JSON_PackSpec spec[]) +{ + json_t *ret; + + ret = json_object (); + GNUNET_assert (NULL != ret); + for (unsigned int i=0; + NULL != spec[i].field_name; + i++) + { + if (NULL == spec[i].object) + { + GNUNET_assert (spec[i].allow_null); + } + else + { + GNUNET_assert (0 == + json_object_set_new (ret, + spec[i].field_name, + spec[i].object)); + spec[i].object = NULL; + } + } + return ret; +} + + +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_end_(void) +{ + struct GNUNET_JSON_PackSpec ps = { + .field_name = NULL + }; + + return ps; +} + + +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_allow_null (struct GNUNET_JSON_PackSpec in) +{ + in.allow_null = true; + return in; +} + + +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_bool (const char *name, + bool b) +{ + struct GNUNET_JSON_PackSpec ps = { + .field_name = name, + .object = json_boolean (b) + }; + + return ps; +} + + +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_string (const char *name, + const char *s) +{ + struct GNUNET_JSON_PackSpec ps = { + .field_name = name, + .object = json_string (s) + }; + + return ps; +} + + +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_uint64 (const char *name, + uint64_t num) +{ + struct GNUNET_JSON_PackSpec ps = { + .field_name = name, + .object = json_integer ((json_int_t) num) + }; + +#if JSON_INTEGER_IS_LONG_LONG + GNUNET_assert (num <= LONG_LONG_MAX); +#else + GNUNET_assert (num <= LONG_MAX); +#endif + return ps; +} + + +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_int64 (const char *name, + int64_t num) +{ + struct GNUNET_JSON_PackSpec ps = { + .field_name = name, + .object = json_integer ((json_int_t) num) + }; + +#if JSON_INTEGER_IS_LONG_LONG + GNUNET_assert (num <= LONG_LONG_MAX); + GNUNET_assert (num >= LONG_LONG_MIN); +#else + GNUNET_assert (num <= LONG_MAX); + GNUNET_assert (num >= LONG_MIN); +#endif + return ps; +} + + +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_object_steal (const char *name, + json_t *o) +{ + struct GNUNET_JSON_PackSpec ps = { + .field_name = name, + .object = o + }; + + if (NULL == o) + return ps; + GNUNET_assert (json_is_object (o)); + return ps; +} + + +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_object_incref (const char *name, + json_t *o) +{ + struct GNUNET_JSON_PackSpec ps = { + .field_name = name, + .object = o + }; + + if (NULL == o) + return ps; + (void) json_incref (o); + GNUNET_assert (json_is_object (o)); + return ps; +} + + +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_array_steal (const char *name, + json_t *a) +{ + struct GNUNET_JSON_PackSpec ps = { + .field_name = name, + .object = a + }; + + if (NULL == a) + return ps; + GNUNET_assert (json_is_array (a)); + return ps; +} + + +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_array_incref (const char *name, + json_t *a) +{ + struct GNUNET_JSON_PackSpec ps = { + .field_name = name, + .object = a + }; + + if (NULL == a) + return ps; + (void) json_incref (a); + GNUNET_assert (json_is_array (a)); + return ps; +} + + +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_data_varsize (const char *name, + const void *blob, + size_t blob_size) +{ + json_t *json; + + json = GNUNET_JSON_from_data (blob, + blob_size); + GNUNET_assert (NULL != json); + return GNUNET_JSON_pack_object_steal (name, + json); +} + + +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_time_abs (const char *name, + struct GNUNET_TIME_Absolute at) +{ + json_t *json; + + json = GNUNET_JSON_from_time_abs (at); + GNUNET_assert (NULL != json); + return GNUNET_JSON_pack_object_steal (name, + json); +} + + +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_time_abs_nbo (const char *name, + struct GNUNET_TIME_AbsoluteNBO at) +{ + return GNUNET_JSON_pack_time_abs (name, + GNUNET_TIME_absolute_ntoh (at)); +} + + +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_time_rel (const char *name, + struct GNUNET_TIME_Relative rt) +{ + json_t *json; + + json = GNUNET_JSON_from_time_rel (rt); + GNUNET_assert (NULL != json); + return GNUNET_JSON_pack_object_steal (name, + json); +} + + +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_time_rel_nbo (const char *name, + struct GNUNET_TIME_RelativeNBO rt) +{ + return GNUNET_JSON_pack_time_rel (name, + GNUNET_TIME_relative_ntoh (rt)); +} + + +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_rsa_public_key (const char *name, + const struct GNUNET_CRYPTO_RsaPublicKey *pk) +{ + json_t *json; + + json = GNUNET_JSON_from_rsa_public_key (pk); + GNUNET_assert (NULL != json); + return GNUNET_JSON_pack_object_steal (name, + json); +} + + +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_rsa_signature (const char *name, + const struct GNUNET_CRYPTO_RsaSignature *sig) +{ + json_t *json; + + json = GNUNET_JSON_from_rsa_signature (sig); + GNUNET_assert (NULL != json); + return GNUNET_JSON_pack_object_steal (name, + json); +} + + +/* end of json_pack.c */ -- cgit v1.2.3 From 16fe9a808202ba33e944a2ca6bdef0f4e4f3aeb7 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 26 Jul 2021 19:33:38 +0200 Subject: config: resolve symlinks for @INLINE@-ed files Otherwise, relative includes won't work properly. --- src/util/configuration.c | 68 +++++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/util/configuration.c b/src/util/configuration.c index d0090ae53..8ca3681af 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c @@ -308,45 +308,47 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, "@INLINE@ ", strlen ("@INLINE@ "))) { - /* @INLINE@ value */ - value = &line[strlen ("@INLINE@ ")]; - if (NULL != basedir) - { - if ('/' == *value) - { - if (GNUNET_OK != - GNUNET_CONFIGURATION_parse (cfg, - value)) - { - ret = GNUNET_SYSERR; /* failed to parse included config */ - break; - } - } - else - { - char *fn; - - GNUNET_asprintf (&fn, "%s/%s", - basedir, - value); - if (GNUNET_OK != - GNUNET_CONFIGURATION_parse (cfg, - fn)) - { - GNUNET_free (fn); - ret = GNUNET_SYSERR; /* failed to parse included config */ - break; - } - GNUNET_free (fn); - } - } - else + char *inline_path; + char *inline_realpath; + + if (NULL == basedir) { LOG (GNUNET_ERROR_TYPE_DEBUG, "Ignoring parsing @INLINE@ configurations, not allowed!\n"); ret = GNUNET_SYSERR; break; } + /* FIXME: also trim space and end of line comment? */ + value = &line[strlen ("@INLINE@ ")]; + if ('/' == *value) + inline_path = GNUNET_strdup (value); + else + GNUNET_asprintf (&inline_path, + "%s/%s", + basedir, + value); + /* We compute the canonical, absolute path first, + so that relative imports resolve properly with symlinked + config files. */ + inline_realpath = realpath (inline_path, + NULL); + GNUNET_free (inline_path); + if (NULL == inline_realpath) + { + /* Couldn't even resolve path of included file. */ + GNUNET_break (0); + ret = GNUNET_SYSERR; /* failed to parse included config */ + break; + } + if (GNUNET_OK != + GNUNET_CONFIGURATION_parse (cfg, + inline_realpath)) + { + GNUNET_free (inline_realpath); + ret = GNUNET_SYSERR; /* failed to parse included config */ + break; + } + GNUNET_free (inline_realpath); continue; } if (('[' == line[0]) && (']' == line[line_size - 1])) -- cgit v1.2.3 From cda72d5c4cdde29baedb57ed07be7779b3cd46fc Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 26 Jul 2021 19:59:29 +0200 Subject: config: resolve realpath of base dir, not config --- src/util/configuration.c | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/util/configuration.c b/src/util/configuration.c index 8ca3681af..fd1ab2ecb 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c @@ -309,7 +309,6 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, strlen ("@INLINE@ "))) { char *inline_path; - char *inline_realpath; if (NULL == basedir) { @@ -323,32 +322,35 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, if ('/' == *value) inline_path = GNUNET_strdup (value); else + { + /* We compute the canonical, absolute path first, + so that relative imports resolve properly with symlinked + config files. */ + char *basedir_realpath; + + basedir_realpath = realpath (basedir, + NULL); + if (NULL == basedir_realpath) + { + /* Couldn't even resolve path of base dir. */ + GNUNET_break (0); + ret = GNUNET_SYSERR; /* failed to parse included config */ + break; + } GNUNET_asprintf (&inline_path, "%s/%s", - basedir, + basedir_realpath, value); - /* We compute the canonical, absolute path first, - so that relative imports resolve properly with symlinked - config files. */ - inline_realpath = realpath (inline_path, - NULL); - GNUNET_free (inline_path); - if (NULL == inline_realpath) - { - /* Couldn't even resolve path of included file. */ - GNUNET_break (0); - ret = GNUNET_SYSERR; /* failed to parse included config */ - break; } if (GNUNET_OK != GNUNET_CONFIGURATION_parse (cfg, - inline_realpath)) + inline_path)) { - GNUNET_free (inline_realpath); + GNUNET_free (inline_path); ret = GNUNET_SYSERR; /* failed to parse included config */ break; } - GNUNET_free (inline_realpath); + GNUNET_free (inline_path); continue; } if (('[' == line[0]) && (']' == line[line_size - 1])) -- cgit v1.2.3 From 51e5fab47cb0e9c45600fca44eecd80f8087c8f8 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 26 Jul 2021 20:03:29 +0200 Subject: config: free real basepath --- src/util/configuration.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/util/configuration.c b/src/util/configuration.c index fd1ab2ecb..506df5e1f 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c @@ -341,6 +341,7 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, "%s/%s", basedir_realpath, value); + free (basedir_realpath); } if (GNUNET_OK != GNUNET_CONFIGURATION_parse (cfg, -- cgit v1.2.3 From 28dfb1220bd257ba29fc2ae786c6952cc086c561 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 26 Jul 2021 20:30:28 +0200 Subject: config: resolve realpath of parent config file, fix docs --- src/include/gnunet_configuration_lib.h | 7 +++---- src/util/configuration.c | 32 +++++++++++++++++++------------- 2 files changed, 22 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/include/gnunet_configuration_lib.h b/src/include/gnunet_configuration_lib.h index 21a5ab810..68ed570a3 100644 --- a/src/include/gnunet_configuration_lib.h +++ b/src/include/gnunet_configuration_lib.h @@ -144,16 +144,15 @@ GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg, * @param cfg configuration to update * @param mem the memory block of serialized configuration * @param size the size of the memory block - * @param allow_inline set to the base directory if we recursively load configuration - * from inlined configurations; NULL if not and raise warnings - * when we come across them + * @param source_filename source filename, will be used + * to resolve relative @INLINE@ statements * @return #GNUNET_OK on success, #GNUNET_SYSERR on error */ enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, const char *mem, size_t size, - const char *basedir); + const char *source_filename); /** diff --git a/src/util/configuration.c b/src/util/configuration.c index 506df5e1f..4a1af10d3 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c @@ -94,6 +94,11 @@ struct GNUNET_CONFIGURATION_Handle * #GNUNET_SYSERR on error (i.e. last save failed) */ enum GNUNET_GenericReturnValue dirty; + + /** + * Name of the entry point configuration file. + */ + char *main_filename; }; @@ -230,7 +235,7 @@ enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, const char *mem, size_t size, - const char *basedir) + const char *source_filename) { char *line; char *line_orig; @@ -310,10 +315,11 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, { char *inline_path; - if (NULL == basedir) + if (NULL == source_filename) { LOG (GNUNET_ERROR_TYPE_DEBUG, - "Ignoring parsing @INLINE@ configurations, not allowed!\n"); + "Refusing to parse @INLINE@ configurations, " + "not allowed without source filename!\n"); ret = GNUNET_SYSERR; break; } @@ -326,22 +332,26 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, /* We compute the canonical, absolute path first, so that relative imports resolve properly with symlinked config files. */ - char *basedir_realpath; + char *source_realpath; + char *endsep; - basedir_realpath = realpath (basedir, - NULL); - if (NULL == basedir_realpath) + source_realpath = realpath (source_filename, + NULL); + if (NULL == source_realpath) { /* Couldn't even resolve path of base dir. */ GNUNET_break (0); ret = GNUNET_SYSERR; /* failed to parse included config */ break; } + endsep = strrchr (source_realpath, '/'); + GNUNET_assert (NULL != endsep); + *endsep = '\0'; GNUNET_asprintf (&inline_path, "%s/%s", - basedir_realpath, + source_realpath, value); - free (basedir_realpath); + free (source_realpath); } if (GNUNET_OK != GNUNET_CONFIGURATION_parse (cfg, @@ -415,7 +425,6 @@ GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg, size_t fs; char *fn; char *mem; - char *endsep; int dirty; enum GNUNET_GenericReturnValue ret; ssize_t sret; @@ -451,9 +460,6 @@ GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg, return GNUNET_SYSERR; } LOG (GNUNET_ERROR_TYPE_DEBUG, "Deserializing contents of file `%s'\n", fn); - endsep = strrchr (fn, (int) '/'); - if (NULL != endsep) - *endsep = '\0'; ret = GNUNET_CONFIGURATION_deserialize (cfg, mem, fs, -- cgit v1.2.3 From 8175353f1f9966c0125b89a3cb3e3352de54a5ff Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 28 Jul 2021 09:39:30 +0200 Subject: -nicer logging --- src/json/json_pack.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/json/json_pack.c b/src/json/json_pack.c index 88edaca5f..e104ad602 100644 --- a/src/json/json_pack.c +++ b/src/json/json_pack.c @@ -148,7 +148,13 @@ GNUNET_JSON_pack_object_steal (const char *name, if (NULL == o) return ps; - GNUNET_assert (json_is_object (o)); + if (! json_is_object (o)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Expected JSON object for field `%s'\n", + name); + GNUNET_assert (0); + } return ps; } @@ -165,7 +171,13 @@ GNUNET_JSON_pack_object_incref (const char *name, if (NULL == o) return ps; (void) json_incref (o); - GNUNET_assert (json_is_object (o)); + if (! json_is_object (o)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Expected JSON object for field `%s'\n", + name); + GNUNET_assert (0); + } return ps; } @@ -181,7 +193,13 @@ GNUNET_JSON_pack_array_steal (const char *name, if (NULL == a) return ps; - GNUNET_assert (json_is_array (a)); + if (! json_is_array (a)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Expected JSON array for field `%s'\n", + name); + GNUNET_assert (0); + } return ps; } @@ -198,7 +216,13 @@ GNUNET_JSON_pack_array_incref (const char *name, if (NULL == a) return ps; (void) json_incref (a); - GNUNET_assert (json_is_array (a)); + if (! json_is_array (a)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Expected JSON array for field `%s'\n", + name); + GNUNET_assert (0); + } return ps; } -- cgit v1.2.3 From 391794a460140192b3466765ebc63797cea44000 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 28 Jul 2021 10:06:44 +0200 Subject: -fix json pack bugs --- src/json/json_pack.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/json/json_pack.c b/src/json/json_pack.c index e104ad602..20db47cd4 100644 --- a/src/json/json_pack.c +++ b/src/json/json_pack.c @@ -232,13 +232,13 @@ GNUNET_JSON_pack_data_varsize (const char *name, const void *blob, size_t blob_size) { - json_t *json; + struct GNUNET_JSON_PackSpec ps = { + .field_name = name, + .object = GNUNET_JSON_from_data (blob, + blob_size) + }; - json = GNUNET_JSON_from_data (blob, - blob_size); - GNUNET_assert (NULL != json); - return GNUNET_JSON_pack_object_steal (name, - json); + return ps; } @@ -290,12 +290,12 @@ struct GNUNET_JSON_PackSpec GNUNET_JSON_pack_rsa_public_key (const char *name, const struct GNUNET_CRYPTO_RsaPublicKey *pk) { - json_t *json; + struct GNUNET_JSON_PackSpec ps = { + .field_name = name, + .object = GNUNET_JSON_from_rsa_public_key (pk) + }; - json = GNUNET_JSON_from_rsa_public_key (pk); - GNUNET_assert (NULL != json); - return GNUNET_JSON_pack_object_steal (name, - json); + return ps; } @@ -303,12 +303,12 @@ struct GNUNET_JSON_PackSpec GNUNET_JSON_pack_rsa_signature (const char *name, const struct GNUNET_CRYPTO_RsaSignature *sig) { - json_t *json; + struct GNUNET_JSON_PackSpec ps = { + .field_name = name, + .object = GNUNET_JSON_from_rsa_signature (sig) + }; - json = GNUNET_JSON_from_rsa_signature (sig); - GNUNET_assert (NULL != json); - return GNUNET_JSON_pack_object_steal (name, - json); + return ps; } -- cgit v1.2.3 From 7615d46b09275383bd244a0ef1d94b3a77559b88 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 28 Jul 2021 14:31:38 +0200 Subject: implement config inline globbing --- src/include/gnunet_disk_lib.h | 16 +++ src/util/configuration.c | 259 ++++++++++++++++++++++++++++++++++-------- src/util/disk.c | 139 ++++++++++++++++++++++- 3 files changed, 363 insertions(+), 51 deletions(-) (limited to 'src') diff --git a/src/include/gnunet_disk_lib.h b/src/include/gnunet_disk_lib.h index 3805039fc..df5d3ba21 100644 --- a/src/include/gnunet_disk_lib.h +++ b/src/include/gnunet_disk_lib.h @@ -654,6 +654,22 @@ GNUNET_DISK_directory_scan (const char *dir_name, GNUNET_FileNameCallback callback, void *callback_cls); +/** + * Find all files matching a glob pattern. + * + * Currently, the glob_pattern only supports asterisks in the last + * path component. + * + * @param glob_patterb the glob pattern to search for + * @param callback the method to call for each file + * @param callback_cls closure for @a callback + * @return the number of files found, -1 on error + */ +int +GNUNET_DISK_glob (const char *glob_pattern, + GNUNET_FileNameCallback callback, + void *callback_cls); + /** * Create the directory structure for storing diff --git a/src/util/configuration.c b/src/util/configuration.c index 4a1af10d3..da9cdb924 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c @@ -230,6 +230,120 @@ GNUNET_CONFIGURATION_parse_and_run (const char *filename, return ret; } +struct InlineGlobClosure +{ + struct GNUNET_CONFIGURATION_Handle *cfg; +}; + +/** + * Function called with a filename. + * + * @param cls closure + * @param filename complete filename (absolute path) + * @return #GNUNET_OK to continue to iterate, + * #GNUNET_NO to stop iteration with no error, + * #GNUNET_SYSERR to abort iteration with error! + */ +static int +inline_glob_cb (void *cls, + const char *filename) +{ + struct InlineGlobClosure *igc = cls; + + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Reading globbed config file '%s'\n", + filename); + + if (GNUNET_OK != + GNUNET_CONFIGURATION_parse (igc->cfg, + filename)) + { + return GNUNET_SYSERR; + } + return GNUNET_OK; +} + +/** + * Handle an inline directive. + * + * @returns #GNUNET_SYSERR on error, #GNUNET_OK otherwise + */ +enum GNUNET_GenericReturnValue +handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg, + const char *path_or_glob, + bool path_is_glob, + const char *restrict_section, + const char *source_filename) +{ + char *inline_path; + + /* We support the section restriction only for non-globs */ + GNUNET_assert (! (path_is_glob && (NULL != restrict_section))); + + if (NULL == source_filename) + { + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Refusing to parse inline configurations, " + "not allowed without source filename!\n"); + return GNUNET_SYSERR; + } + if ('/' == *path_or_glob) + inline_path = GNUNET_strdup (path_or_glob); + else + { + /* We compute the canonical, absolute path first, + so that relative imports resolve properly with symlinked + config files. */ + char *source_realpath; + char *endsep; + + source_realpath = realpath (source_filename, + NULL); + if (NULL == source_realpath) + { + /* Couldn't even resolve path of base dir. */ + GNUNET_break (0); + /* failed to parse included config */ + return GNUNET_SYSERR; + } + endsep = strrchr (source_realpath, '/'); + GNUNET_assert (NULL != endsep); + *endsep = '\0'; + GNUNET_asprintf (&inline_path, + "%s/%s", + source_realpath, + path_or_glob); + free (source_realpath); + } + if (path_is_glob) + { + int nret; + struct InlineGlobClosure igc = { + .cfg = cfg, + }; + + LOG (GNUNET_ERROR_TYPE_DEBUG, + "processing config glob '%s'\n", + inline_path); + + nret = GNUNET_DISK_glob (inline_path, inline_glob_cb, &igc); + if (-1 == nret) + { + GNUNET_free (inline_path); + return GNUNET_SYSERR; + } + } + else if (GNUNET_OK != + GNUNET_CONFIGURATION_parse (cfg, + inline_path)) + { + GNUNET_free (inline_path); + return GNUNET_SYSERR; + } + GNUNET_free (inline_path); + return GNUNET_OK; +} + enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, @@ -237,28 +351,27 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, size_t size, const char *source_filename) { - char *line; - char *line_orig; size_t line_size; - char *pos; unsigned int nr; size_t r_bytes; size_t to_read; - size_t i; - int emptyline; enum GNUNET_GenericReturnValue ret; char *section; char *eq; char *tag; char *value; + char *line_orig = NULL; ret = GNUNET_OK; - section = GNUNET_strdup (""); + section = NULL; nr = 0; r_bytes = 0; - line_orig = NULL; while (r_bytes < size) { + char *pos; + char *line; + bool emptyline; + GNUNET_free (line_orig); /* fgets-like behaviour on buffer */ to_read = size - r_bytes; @@ -280,7 +393,7 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, nr++; /* tabs and '\r' are whitespace */ emptyline = GNUNET_YES; - for (i = 0; i < line_size; i++) + for (size_t i = 0; i < line_size; i++) { if (line[i] == '\t') line[i] = ' '; @@ -294,7 +407,7 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, continue; /* remove tailing whitespace */ - for (i = line_size - 1; + for (size_t i = line_size - 1; (i >= 1) && (isspace ((unsigned char) line[i])); i--) line[i] = '\0'; @@ -308,60 +421,103 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, ('%' == line[0]) ) continue; - /* handle special "@INLINE@" directive */ - if (0 == strncasecmp (line, - "@INLINE@ ", - strlen ("@INLINE@ "))) + /* Handle special directives. */ + if ('@' == line[0]) { - char *inline_path; + char *end = strchr (line + 1, '@'); + char *directive; + enum GNUNET_GenericReturnValue directive_ret; - if (NULL == source_filename) + if (NULL == end) { - LOG (GNUNET_ERROR_TYPE_DEBUG, - "Refusing to parse @INLINE@ configurations, " - "not allowed without source filename!\n"); + LOG (GNUNET_ERROR_TYPE_WARNING, + _ ("Bad directive in line %u\n"), + nr); ret = GNUNET_SYSERR; break; } - /* FIXME: also trim space and end of line comment? */ - value = &line[strlen ("@INLINE@ ")]; - if ('/' == *value) - inline_path = GNUNET_strdup (value); - else + *end = '\0'; + directive = line + 1; + + if (0 == strcasecmp (directive, "INLINE")) { - /* We compute the canonical, absolute path first, - so that relative imports resolve properly with symlinked - config files. */ - char *source_realpath; - char *endsep; - - source_realpath = realpath (source_filename, - NULL); - if (NULL == source_realpath) + const char *path = end + 1; + + /* Skip space before path */ + for (; isspace (*path); path++) + ; + + directive_ret = handle_inline (cfg, + path, + false, + NULL, + source_filename); + } + else if (0 == strcasecmp (directive, "INLINE-MATCHING")) + { + const char *path = end + 1; + + /* Skip space before path */ + for (; isspace (*path); path++) + ; + + directive_ret = handle_inline (cfg, + path, + true, + NULL, + source_filename); + } + else if (0 == strcasecmp (directive, "INLINE-SECRET")) + { + const char *secname = end + 1; + const char *path; + const char *secname_end; + + /* Skip space before secname */ + for (; isspace (*secname); secname++) + ; + + secname_end = strchr (secname, ' '); + + if (NULL == secname_end) { - /* Couldn't even resolve path of base dir. */ - GNUNET_break (0); - ret = GNUNET_SYSERR; /* failed to parse included config */ + LOG (GNUNET_ERROR_TYPE_WARNING, + _ ("Bad inline-secret directive in line %u\n"), + nr); + ret = GNUNET_SYSERR; break; } - endsep = strrchr (source_realpath, '/'); - GNUNET_assert (NULL != endsep); - *endsep = '\0'; - GNUNET_asprintf (&inline_path, - "%s/%s", - source_realpath, - value); - free (source_realpath); + secname_end = '\0'; + path = secname_end + 1; + + /* Skip space before path */ + for (; isspace (*path); path++) + ; + + directive_ret = handle_inline (cfg, + path, + false, + secname, + source_filename); + } + else + { + LOG (GNUNET_ERROR_TYPE_WARNING, + _ ("Unknown or malformed directive '%s' in line %u\n"), + directive, + nr); + ret = GNUNET_SYSERR; + break; } - if (GNUNET_OK != - GNUNET_CONFIGURATION_parse (cfg, - inline_path)) + if (GNUNET_OK != directive_ret) { - GNUNET_free (inline_path); - ret = GNUNET_SYSERR; /* failed to parse included config */ + LOG (GNUNET_ERROR_TYPE_WARNING, + _ ("Bad directive '%s' in line %u\n"), + directive, + nr); + ret = GNUNET_SYSERR; break; } - GNUNET_free (inline_path); continue; } if (('[' == line[0]) && (']' == line[line_size - 1])) @@ -375,10 +531,13 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, } if (NULL != (eq = strchr (line, '='))) { + size_t i; + /* tag = value */ tag = GNUNET_strndup (line, eq - line); /* remove tailing whitespace */ - for (i = strlen (tag) - 1; (i >= 1) && (isspace ((unsigned char) tag[i])); + for (i = strlen (tag) - 1; + (i >= 1) && (isspace ((unsigned char) tag[i])); i--) tag[i] = '\0'; diff --git a/src/util/disk.c b/src/util/disk.c index 3bafe311d..1b909f13e 100644 --- a/src/util/disk.c +++ b/src/util/disk.c @@ -882,6 +882,143 @@ GNUNET_DISK_directory_scan (const char *dir_name, return count; } +/** + * Check for a simple wildcard match. + * Only asterisks are allowed. + * Asterisks match everything, including slashes. + * + * @param pattern pattern with wildcards + * @param str string to match against + * @returns true on match, false otherwise + */ +static bool +glob_match (const char *pattern, const char *str) +{ + /* Position in the input string */ + const char *str_pos = str; + /* Position in the pattern */ + const char *pat_pos = pattern; + /* Backtrack position in string */ + const char *str_bt = NULL; + /* Backtrack position in pattern */ + const char *pat_bt = NULL; + + for (;;) + { + if (*pat_pos == '*') + { + str_bt = str_pos; + pat_bt = pat_pos++; + } + else if (*pat_pos == *str_pos) + { + if ('\0' == *pat_pos) + return true; + str_pos++; + pat_pos++; + } + else + { + if (NULL == str_bt) + return false; + /* Backtrack to match one more + character as part of the asterisk. */ + str_pos = str_bt + 1; + if ('\0' == *str_pos) + return false; + pat_pos = pat_bt; + } + } +} + +struct GlobClosure +{ + const char *glob; + GNUNET_FileNameCallback cb; + void *cls; +}; + +/** + * Function called with a filename. + * + * @param cls closure + * @param filename complete filename (absolute path) + * @return #GNUNET_OK to continue to iterate, + * #GNUNET_NO to stop iteration with no error, + * #GNUNET_SYSERR to abort iteration with error! + */ +static enum GNUNET_GenericReturnValue +glob_cb (void *cls, + const char *filename) +{ + struct GlobClosure *gc = cls; + const char *fn; + + fn = strrchr (filename, DIR_SEPARATOR); + fn = (NULL == fn) ? filename : (fn + 1); + + LOG (GNUNET_ERROR_TYPE_DEBUG, + "checking glob '%s' against '%s'\n", + gc->glob, + fn); + + if (glob_match (gc->glob, fn)) + { + LOG (GNUNET_ERROR_TYPE_DEBUG, + "found glob match '%s'\n", + filename); + gc->cb (gc->cls, filename); + } + return GNUNET_OK; +} + + +int +GNUNET_DISK_glob (const char *glob_pattern, + GNUNET_FileNameCallback callback, + void *callback_cls) +{ + char *mypat = GNUNET_strdup (glob_pattern); + char *sep; + int ret; + + sep = strrchr (mypat, DIR_SEPARATOR); + if (NULL == sep) + { + GNUNET_free (mypat); + return -1; + } + + *sep = '\0'; + + if (NULL != strchr (mypat, '*')) + { + GNUNET_free (mypat); + GNUNET_break (0); + LOG (GNUNET_ERROR_TYPE_ERROR, + "glob pattern may only contain '*' in the final path component\n"); + return -1; + } + + { + struct GlobClosure gc = { + .glob = sep + 1, + .cb = callback, + .cls = callback_cls, + }; + LOG (GNUNET_ERROR_TYPE_DEBUG, + "scanning directory '%s' for glob matches on '%s'\n", + mypat, + gc.glob); + ret = GNUNET_DISK_directory_scan (mypat, + glob_cb, + &gc + ); + } + GNUNET_free (mypat); + return ret; +} + /** * Function that removes the given directory by calling @@ -997,7 +1134,7 @@ GNUNET_DISK_file_copy (const char *src, GNUNET_DISK_file_close (in); GNUNET_DISK_file_close (out); return GNUNET_OK; -FAIL: + FAIL: GNUNET_free (buf); GNUNET_DISK_file_close (in); GNUNET_DISK_file_close (out); -- cgit v1.2.3 From 94ea7a1fab12d1ad81209f84087c04a5a5b790dc Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 28 Jul 2021 15:26:55 +0200 Subject: implement @inline-secret@ directive --- src/include/gnunet_disk_lib.h | 10 +++ src/util/configuration.c | 154 ++++++++++++++++++++++++++++++++++-------- src/util/disk.c | 28 ++++++-- 3 files changed, 161 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/include/gnunet_disk_lib.h b/src/include/gnunet_disk_lib.h index df5d3ba21..7dfd9ccf1 100644 --- a/src/include/gnunet_disk_lib.h +++ b/src/include/gnunet_disk_lib.h @@ -266,6 +266,16 @@ GNUNET_DISK_handle_invalid (const struct GNUNET_DISK_FileHandle *h); enum GNUNET_GenericReturnValue GNUNET_DISK_file_test (const char *fil); +/** + * Check that fil corresponds to a filename and the file has read permissions. + * + * @param fil filename to check + * @return #GNUNET_YES if yes, #GNUNET_NO if file doesn't exist or + * has no read permissions, #GNUNET_SYSERR if something else + * (will print an error message in that case, too). + */ +enum GNUNET_GenericReturnValue +GNUNET_DISK_file_test_read (const char *fil); /** * Move a file out of the way (create a backup) by renaming it to "orig.NUM~" diff --git a/src/util/configuration.c b/src/util/configuration.c index da9cdb924..3bb08e6c0 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c @@ -75,6 +75,14 @@ struct ConfigSection * name of the section */ char *name; + + /** + * Is the configuration section marked as inaccessible? + * + * This can happen if the section name is used in an @inline-secret@ + * directive, but the referenced file can't be found or accessed. + */ + bool inaccessible; }; @@ -263,6 +271,46 @@ inline_glob_cb (void *cls, return GNUNET_OK; } + +/** + * Find a section entry from a configuration. + * + * @param cfg configuration to search in + * @param section name of the section to look for + * @return matching entry, NULL if not found + */ +static struct ConfigSection * +find_section (const struct GNUNET_CONFIGURATION_Handle *cfg, + const char *section) +{ + struct ConfigSection *pos; + + pos = cfg->sections; + while ((pos != NULL) && (0 != strcasecmp (section, pos->name))) + pos = pos->next; + return pos; +} + +static void +set_section_inaccessible (struct GNUNET_CONFIGURATION_Handle *cfg, + const char *section) +{ + struct ConfigSection *sec; + + sec = find_section (cfg, section); + + if (NULL == sec) + { + sec = GNUNET_new (struct ConfigSection); + sec->name = GNUNET_strdup (section); + sec->next = cfg->sections; + cfg->sections = sec; + sec->entries = NULL; + } + + sec->inaccessible = true; +} + /** * Handle an inline directive. * @@ -333,6 +381,50 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg, return GNUNET_SYSERR; } } + else if (NULL != restrict_section) + { + struct GNUNET_CONFIGURATION_Handle *other_cfg; + enum GNUNET_GenericReturnValue fret; + struct ConfigSection *cs; + + fret = GNUNET_DISK_file_test_read (inline_path); + + if (GNUNET_OK != fret) + { + set_section_inaccessible (cfg, restrict_section); + GNUNET_free (inline_path); + return GNUNET_OK; + } + + other_cfg = GNUNET_CONFIGURATION_create (); + if (GNUNET_OK != GNUNET_CONFIGURATION_parse (other_cfg, + inline_path)) + { + GNUNET_free (inline_path); + GNUNET_CONFIGURATION_destroy (other_cfg); + return GNUNET_SYSERR; + } + + cs = find_section (other_cfg, restrict_section); + if (NULL == cs) + { + LOG (GNUNET_ERROR_TYPE_ERROR, + "inlined configuration '%s' does not contain section '%s'\n", + inline_path, + restrict_section); + GNUNET_free (inline_path); + GNUNET_free (other_cfg); + return GNUNET_SYSERR; + } + for (struct ConfigEntry *ce = cs->entries; + NULL != ce; + ce = ce->next) + GNUNET_CONFIGURATION_set_value_string (cfg, + restrict_section, + ce->key, + ce->val); + GNUNET_CONFIGURATION_destroy (other_cfg); + } else if (GNUNET_OK != GNUNET_CONFIGURATION_parse (cfg, inline_path)) @@ -346,10 +438,10 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg, enum GNUNET_GenericReturnValue -GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, - const char *mem, - size_t size, - const char *source_filename) +deserialize_internal (struct GNUNET_CONFIGURATION_Handle *cfg, + const char *mem, + size_t size, + const char *source_filename) { size_t line_size; unsigned int nr; @@ -469,9 +561,9 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, } else if (0 == strcasecmp (directive, "INLINE-SECRET")) { - const char *secname = end + 1; + char *secname = end + 1; + char *secname_end; const char *path; - const char *secname_end; /* Skip space before secname */ for (; isspace (*secname); secname++) @@ -487,7 +579,7 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, ret = GNUNET_SYSERR; break; } - secname_end = '\0'; + *secname_end = '\0'; path = secname_end + 1; /* Skip space before path */ @@ -576,6 +668,16 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, } +enum GNUNET_GenericReturnValue +GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, + const char *mem, + size_t size, + const char *source_filename) +{ + return deserialize_internal (cfg, mem, size, source_filename); +} + + enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg, const char *filename) @@ -870,6 +972,14 @@ GNUNET_CONFIGURATION_iterate_section_values ( spos = spos->next; if (NULL == spos) return; + if (spos->inaccessible) + { + LOG (GNUNET_ERROR_TYPE_WARNING, + "Section '%s' is marked as inaccessible, because the configuration " + " file that contains the section can't be read.\n", + section); + return; + } for (epos = spos->entries; NULL != epos; epos = epos->next) if (NULL != epos->val) iter (iter_cls, spos->name, epos->key, epos->val); @@ -963,26 +1073,6 @@ GNUNET_CONFIGURATION_dup (const struct GNUNET_CONFIGURATION_Handle *cfg) } -/** - * Find a section entry from a configuration. - * - * @param cfg configuration to search in - * @param section name of the section to look for - * @return matching entry, NULL if not found - */ -static struct ConfigSection * -find_section (const struct GNUNET_CONFIGURATION_Handle *cfg, - const char *section) -{ - struct ConfigSection *pos; - - pos = cfg->sections; - while ((pos != NULL) && (0 != strcasecmp (section, pos->name))) - pos = pos->next; - return pos; -} - - /** * Find an entry from a configuration. * @@ -1001,6 +1091,16 @@ find_entry (const struct GNUNET_CONFIGURATION_Handle *cfg, if (NULL == (sec = find_section (cfg, section))) return NULL; + if (sec->inaccessible) + { + LOG (GNUNET_ERROR_TYPE_WARNING, + "Section '%s' is marked as inaccessible, because the configuration " + " file that contains the section can't be read. Attempts to use " + "option '%s' will fail.\n", + section, + key); + return NULL; + } pos = sec->entries; while ((pos != NULL) && (0 != strcasecmp (key, pos->key))) pos = pos->next; diff --git a/src/util/disk.c b/src/util/disk.c index 1b909f13e..f68b32db5 100644 --- a/src/util/disk.c +++ b/src/util/disk.c @@ -432,9 +432,15 @@ GNUNET_DISK_directory_test (const char *fil, int is_readable) return GNUNET_YES; } - -enum GNUNET_GenericReturnValue -GNUNET_DISK_file_test (const char *fil) +/** + * Check if fil can be accessed using amode. + * + * @param fil file to check for + * @param amode access mode + * @returns GNUnet error code + */ +static enum GNUNET_GenericReturnValue +file_test_internal (const char *fil, int amode) { struct stat filestat; int ret; @@ -461,7 +467,7 @@ GNUNET_DISK_file_test (const char *fil) GNUNET_free (rdir); return GNUNET_NO; } - if (access (rdir, F_OK) < 0) + if (access (rdir, amode) < 0) { LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "access", rdir); GNUNET_free (rdir); @@ -472,6 +478,20 @@ GNUNET_DISK_file_test (const char *fil) } +enum GNUNET_GenericReturnValue +GNUNET_DISK_file_test (const char *fil) +{ + return file_test_internal (fil, F_OK); +} + + +enum GNUNET_GenericReturnValue +GNUNET_DISK_file_test_read (const char *fil) +{ + return file_test_internal (fil, R_OK); +} + + enum GNUNET_GenericReturnValue GNUNET_DISK_directory_create (const char *dir) { -- cgit v1.2.3 From 2cdd91d55b1ac965d4f4075cf3c094ee5ac53818 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 28 Jul 2021 15:47:39 +0200 Subject: fall back to /etc if user config can't be found --- src/util/configuration.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'src') diff --git a/src/util/configuration.c b/src/util/configuration.c index 3bb08e6c0..f091c4674 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c @@ -1918,12 +1918,45 @@ GNUNET_CONFIGURATION_default (void) char *cfgname = NULL; struct GNUNET_CONFIGURATION_Handle *cfg; + /* FIXME: Why are we doing this? Needs some commentary! */ GNUNET_OS_init (dpd); + cfg = GNUNET_CONFIGURATION_create (); + + /* First, try user configuration. */ if (NULL != xdg) GNUNET_asprintf (&cfgname, "%s/%s", xdg, pd->config_file); else cfgname = GNUNET_strdup (pd->user_config_file); + + /* If user config doesn't exist, try in + /etc// and /etc/ */ + if (GNUNET_OK != GNUNET_DISK_file_test (cfgname)) + { + GNUNET_free (cfgname); + GNUNET_asprintf (&cfgname, "/etc/%s", pd->config_file); + } + if (GNUNET_OK != GNUNET_DISK_file_test (cfgname)) + { + GNUNET_free (cfgname); + GNUNET_asprintf (&cfgname, "/etc/%s/%s", pd->project_dirname, + pd->config_file); + } + if (GNUNET_OK != GNUNET_DISK_file_test (cfgname)) + { + LOG (GNUNET_ERROR_TYPE_ERROR, + "Unable to top-level configuration file.\n"); + GNUNET_OS_init (pd); + GNUNET_CONFIGURATION_destroy (cfg); + GNUNET_free (cfgname); + return NULL; + } + + /* We found a configuration file that looks good, try to load it. */ + + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Loading top-level configuration from '%s'\n", + cfgname); if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, cfgname)) { -- cgit v1.2.3 From f550f04aa52852ca0d04552a5e103f51ff1023e6 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 28 Jul 2021 15:51:49 +0200 Subject: -formatting / comments --- src/util/configuration.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/util/configuration.c b/src/util/configuration.c index f091c4674..06938be67 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c @@ -238,11 +238,19 @@ GNUNET_CONFIGURATION_parse_and_run (const char *filename, return ret; } + +/** + * Closure to inline_glob_cb. + */ struct InlineGlobClosure { + /** + * Configuration to read inlined configuration into. + */ struct GNUNET_CONFIGURATION_Handle *cfg; }; + /** * Function called with a filename. * @@ -291,6 +299,7 @@ find_section (const struct GNUNET_CONFIGURATION_Handle *cfg, return pos; } + static void set_section_inaccessible (struct GNUNET_CONFIGURATION_Handle *cfg, const char *section) @@ -311,6 +320,7 @@ set_section_inaccessible (struct GNUNET_CONFIGURATION_Handle *cfg, sec->inaccessible = true; } + /** * Handle an inline directive. * @@ -438,10 +448,10 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg, enum GNUNET_GenericReturnValue -deserialize_internal (struct GNUNET_CONFIGURATION_Handle *cfg, - const char *mem, - size_t size, - const char *source_filename) +GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, + const char *mem, + size_t size, + const char *source_filename) { size_t line_size; unsigned int nr; @@ -668,16 +678,6 @@ deserialize_internal (struct GNUNET_CONFIGURATION_Handle *cfg, } -enum GNUNET_GenericReturnValue -GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, - const char *mem, - size_t size, - const char *source_filename) -{ - return deserialize_internal (cfg, mem, size, source_filename); -} - - enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg, const char *filename) -- cgit v1.2.3 From 1a542d67de29d6ed40706ca70988f79bfd00fb38 Mon Sep 17 00:00:00 2001 From: t3sserakt Date: Wed, 28 Jul 2021 15:52:48 +0200 Subject: - simple test without sending. peers setup working. --- po/POTFILES.in | 3 ++ src/testbed/Makefile.am | 2 + src/testbed/gnunet-cmds-helper.c | 2 +- src/testbed/testbed_api.h | 2 +- src/testbed/testbed_api_cmd_local_test_finished.c | 2 + .../testbed_api_cmd_netjail_start_testbed.c | 13 ++++-- src/transport/Makefile.am | 24 +++++----- src/transport/transport_api_cmd_connecting_peers.c | 3 ++ src/transport/transport_api_cmd_start_peer.c | 51 ++++++++++++++++++---- 9 files changed, 76 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/po/POTFILES.in b/po/POTFILES.in index 042a4b1df..b02a3fea4 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -206,6 +206,7 @@ src/json/json.c src/json/json_generator.c src/json/json_helper.c src/json/json_mhd.c +src/json/json_pack.c src/messenger/gnunet-messenger.c src/messenger/gnunet-service-messenger.c src/messenger/gnunet-service-messenger_basement.c @@ -294,6 +295,7 @@ src/peerstore/plugin_peerstore_sqlite.c src/pq/pq.c src/pq/pq_connect.c src/pq/pq_eval.c +src/pq/pq_event.c src/pq/pq_exec.c src/pq/pq_prepare.c src/pq/pq_query_helper.c @@ -595,5 +597,6 @@ src/vpn/vpn_api.c src/zonemaster/gnunet-service-zonemaster-monitor.c src/zonemaster/gnunet-service-zonemaster.c src/fs/fs_api.h +src/include/gnunet_json_lib.h src/testbed/testbed_api.h src/testbed/testbed_api_operations.h diff --git a/src/testbed/Makefile.am b/src/testbed/Makefile.am index c1d89607c..347d16007 100644 --- a/src/testbed/Makefile.am +++ b/src/testbed/Makefile.am @@ -102,6 +102,8 @@ gnunet_cmds_helper_SOURCES = \ gnunet_cmds_helper_LDADD = $(XLIB) \ $(top_builddir)/src/util/libgnunetutil.la \ $(top_builddir)/src/testing/libgnunettesting.la \ + $(top_builddir)/src/transport/libgnunettransporttesting2.la \ + libgnunettestbed.la \ $(LTLIBINTL) $(Z_LIBS) gnunet_daemon_testbed_blacklist_SOURCES = gnunet-daemon-testbed-blacklist.c diff --git a/src/testbed/gnunet-cmds-helper.c b/src/testbed/gnunet-cmds-helper.c index 113e3c386..c4a3e98d9 100644 --- a/src/testbed/gnunet-cmds-helper.c +++ b/src/testbed/gnunet-cmds-helper.c @@ -411,7 +411,7 @@ tokenizer_cb (void *cls, const struct GNUNET_MessageHeader *message) plugin = GNUNET_new (struct Plugin); plugin->api = GNUNET_PLUGIN_load (plugin_name, NULL); - plugin->library_name = GNUNET_strdup (plugin_name); + plugin->library_name = GNUNET_strdup (basename(plugin_name)); plugin->global_n = ni->global_n; plugin->local_m = ni->local_m; diff --git a/src/testbed/testbed_api.h b/src/testbed/testbed_api.h index 9a54ca36c..67aa6dc1c 100644 --- a/src/testbed/testbed_api.h +++ b/src/testbed/testbed_api.h @@ -40,7 +40,7 @@ /** * Cmds Helper binary name */ -#define HELPER_CMDS_BINARY "gnunet-cmds-helper" +#define HELPER_CMDS_BINARY "./../testbed/gnunet-cmds-helper" /** diff --git a/src/testbed/testbed_api_cmd_local_test_finished.c b/src/testbed/testbed_api_cmd_local_test_finished.c index 8829f1b9a..b5f4b8b31 100644 --- a/src/testbed/testbed_api_cmd_local_test_finished.c +++ b/src/testbed/testbed_api_cmd_local_test_finished.c @@ -93,6 +93,8 @@ local_test_finished_finish (void *cls, void *cont_cls) { // This will stop the local loop without shutting down the scheduler, because we do not call the continuation, which is the interpreter_next method. + LOG (GNUNET_ERROR_TYPE_ERROR, + "Stopping local loop\n"); return GNUNET_YES; } diff --git a/src/testbed/testbed_api_cmd_netjail_start_testbed.c b/src/testbed/testbed_api_cmd_netjail_start_testbed.c index 67f0ef55c..de3926696 100644 --- a/src/testbed/testbed_api_cmd_netjail_start_testbed.c +++ b/src/testbed/testbed_api_cmd_netjail_start_testbed.c @@ -328,8 +328,7 @@ start_testbed (struct NetJailState *ns, struct char *const script_argv[] = {NETJAIL_EXEC_SCRIPT, m_char, n_char, - GNUNET_OS_get_libexec_binary_path ( - HELPER_CMDS_BINARY), + HELPER_CMDS_BINARY, ns->global_n, ns->local_m, NULL}; @@ -373,6 +372,9 @@ start_testbed (struct NetJailState *ns, struct &exp_cb, tbc)); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "First using helper %d\n", + tbc->count - 1); struct GNUNET_HELPER_Handle *helper = ns->helper[tbc->count - 1]; msg = create_helper_init_msg_ (m_char, @@ -469,7 +471,12 @@ netjail_start_finish (void *cls, tbc = GNUNET_new (struct TestbedCount); tbc->ns = ns; // TODO This needs to be more generic. As we send more messages back and forth, we can not grow the arrays again and again, because this is to error prone. - tbc->count = (j - 1) * atoi (ns->local_m) + i + total_number; + tbc->count = (i - 1) * atoi (ns->local_m) + j + total_number; + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Second using helper %d %d %d\n", + tbc->count - 1 - total_number, + i, + j); helper = ns->helper[tbc->count - 1 - total_number]; msg_length = sizeof(struct GNUNET_CMDS_ALL_PEERS_STARTED); reply = GNUNET_new (struct GNUNET_CMDS_ALL_PEERS_STARTED); diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am index 3d8fa7774..2d3615e6a 100644 --- a/src/transport/Makefile.am +++ b/src/transport/Makefile.am @@ -397,18 +397,18 @@ plugin_LTLIBRARIES = \ $(HTTP_SERVER_PLUGIN_LA) \ $(HTTPS_SERVER_PLUGIN_LA) \ $(WLAN_PLUGIN_LA) \ - $(BT_PLUGIN_LA) -# libgnunet_plugin_cmd_simple_send.la - -#libgnunet_plugin_cmd_simple_send_la_SOURCES = \ -# plugin_cmd_simple_send.c -#libgnunet_plugin_cmd_simple_send_la_LIBADD = \ -# $(top_builddir)/src/util/libgnunetutil.la \ -# $(top_builddir)/src/testing/libgnunettesting.la \ -# $(top_builddir)/src/statistics/libgnunetstatistics.la \ -# $(top_builddir)/src/testbed/libgnunettestbed.la \ -# libgnunettransporttesting2.la \ -# $(LTLIBINTL) + $(BT_PLUGIN_LA) \ + libgnunet_plugin_cmd_simple_send.la + +libgnunet_plugin_cmd_simple_send_la_SOURCES = \ + plugin_cmd_simple_send.c +libgnunet_plugin_cmd_simple_send_la_LIBADD = \ + $(top_builddir)/src/util/libgnunetutil.la \ + $(top_builddir)/src/testing/libgnunettesting.la \ + $(top_builddir)/src/statistics/libgnunetstatistics.la \ + $(top_builddir)/src/testbed/libgnunettestbed.la \ + libgnunettransporttesting2.la \ + $(LTLIBINTL) #libgnunet_plugin_cmd_simple_send_la_LDFLAGS = \ # $(GN_PLUGIN_LDFLAGS) diff --git a/src/transport/transport_api_cmd_connecting_peers.c b/src/transport/transport_api_cmd_connecting_peers.c index 0f2154c46..d9253b6d4 100644 --- a/src/transport/transport_api_cmd_connecting_peers.c +++ b/src/transport/transport_api_cmd_connecting_peers.c @@ -124,6 +124,9 @@ connect_peers_finish (void *cls, } return ret;*/ + cont (cont_cls); + LOG (GNUNET_ERROR_TYPE_ERROR, + "connect peer finish\n"); return GNUNET_OK; } diff --git a/src/transport/transport_api_cmd_start_peer.c b/src/transport/transport_api_cmd_start_peer.c index c9af497ae..c2cc20a2a 100644 --- a/src/transport/transport_api_cmd_start_peer.c +++ b/src/transport/transport_api_cmd_start_peer.c @@ -54,7 +54,7 @@ struct StartPeerState /** * Peer identity */ - struct GNUNET_PeerIdentity *id; + struct GNUNET_PeerIdentity id; /** * Peer's transport service handle @@ -145,7 +145,7 @@ retrieve_hello (void *cls) sps->rh_task = NULL; sps->pic = GNUNET_PEERSTORE_iterate (sps->ph, "transport", - sps->id, + &sps->id, GNUNET_PEERSTORE_TRANSPORT_HELLO_KEY, hello_iter_cb, sps); @@ -179,7 +179,7 @@ notify_disconnect (void *cls, "Peer %s disconnected from peer %u (`%s')\n", GNUNET_i2s (peer), sps->no, - GNUNET_i2s (sps->id)); + GNUNET_i2s (&sps->id)); } @@ -199,7 +199,7 @@ notify_connect (void *cls, "Peer %s connected to peer %u (`%s')\n", GNUNET_i2s (peer), sps->no, - GNUNET_i2s (sps->id)); + GNUNET_i2s (&sps->id)); GNUNET_CONTAINER_multipeermap_put (sps->connected_peers_map, peer, @@ -222,6 +222,9 @@ start_peer_run (void *cls, const struct GNUNET_TESTING_Command *system_cmd; struct GNUNET_TESTING_System *tl_system; + LOG (GNUNET_ERROR_TYPE_ERROR, + "start peer 1\n"); + if (GNUNET_NO == GNUNET_DISK_file_test (sps->cfgname)) { LOG (GNUNET_ERROR_TYPE_ERROR, @@ -251,8 +254,11 @@ start_peer_run (void *cls, sps->cfgname); GNUNET_CONFIGURATION_destroy (sps->cfg); GNUNET_TESTING_interpreter_fail (); + return; } + LOG (GNUNET_ERROR_TYPE_ERROR, + "start peer 2\n"); sps->peer = GNUNET_TESTING_peer_configure (sps->tl_system, sps->cfg, sps->no, @@ -266,8 +272,11 @@ start_peer_run (void *cls, emsg); GNUNET_free (emsg); GNUNET_TESTING_interpreter_fail (); + return; } + LOG (GNUNET_ERROR_TYPE_ERROR, + "start peer 3\n"); if (GNUNET_OK != GNUNET_TESTING_peer_start (sps->peer)) { LOG (GNUNET_ERROR_TYPE_ERROR, @@ -275,13 +284,19 @@ start_peer_run (void *cls, sps->cfgname); GNUNET_free (emsg); GNUNET_TESTING_interpreter_fail (); + return; } - +LOG (GNUNET_ERROR_TYPE_ERROR, + "start peer 4\n"); memset (&dummy, '\0', sizeof(dummy)); + LOG (GNUNET_ERROR_TYPE_ERROR, + "start peer 4.1\n"); GNUNET_TESTING_peer_get_identity (sps->peer, - sps->id); + &sps->id); + LOG (GNUNET_ERROR_TYPE_ERROR, + "start peer 4.2\n"); if (0 == memcmp (&dummy, &sps->id, sizeof(struct GNUNET_PeerIdentity))) @@ -291,11 +306,14 @@ start_peer_run (void *cls, sps->no); GNUNET_free (emsg); GNUNET_TESTING_interpreter_fail (); + return; } LOG (GNUNET_ERROR_TYPE_DEBUG, "Peer %u configured with identity `%s'\n", sps->no, - GNUNET_i2s_full (sps->id)); + GNUNET_i2s_full (&sps->id)); + LOG (GNUNET_ERROR_TYPE_ERROR, + "start peer 4.3\n"); sps->th = GNUNET_TRANSPORT_core_connect (sps->cfg, NULL, sps->handlers, @@ -310,7 +328,10 @@ start_peer_run (void *cls, emsg); GNUNET_free (emsg); GNUNET_TESTING_interpreter_fail (); + return; } + LOG (GNUNET_ERROR_TYPE_ERROR, + "start peer 5\n"); sps->ph = GNUNET_PEERSTORE_connect (sps->cfg); if (NULL == sps->th) { @@ -320,7 +341,10 @@ start_peer_run (void *cls, emsg); GNUNET_free (emsg); GNUNET_TESTING_interpreter_fail (); + return; } + LOG (GNUNET_ERROR_TYPE_ERROR, + "start peer 6\n"); sps->ah = GNUNET_TRANSPORT_application_init (sps->cfg); if (NULL == sps->ah) { @@ -330,6 +354,7 @@ start_peer_run (void *cls, emsg); GNUNET_free (emsg); GNUNET_TESTING_interpreter_fail (); + return; } sps->rh_task = GNUNET_SCHEDULER_add_now (retrieve_hello, sps); } @@ -374,7 +399,7 @@ start_peer_cleanup (void *cls, LOG (GNUNET_ERROR_TYPE_DEBUG, "Testing lib failed to stop peer %u (`%s')\n", sps->no, - GNUNET_i2s (sps->id)); + GNUNET_i2s (&sps->id)); } GNUNET_TESTING_peer_destroy (sps->peer); sps->peer = NULL; @@ -402,7 +427,7 @@ start_peer_traits (void *cls, { struct StartPeerState *sps = cls; struct GNUNET_TRANSPORT_ApplicationHandle *ah = sps->ah; - struct GNUNET_PeerIdentity *id = sps->id; + struct GNUNET_PeerIdentity *id = &sps->id; struct GNUNET_CONTAINER_MultiPeerMap *connected_peers_map = sps->connected_peers_map; char *hello = sps->hello; @@ -528,6 +553,9 @@ GNUNET_TRANSPORT_cmd_start_peer (const char *label, GNUNET_CONTAINER_multipeermap_create (1,GNUNET_NO); unsigned int i; + LOG (GNUNET_ERROR_TYPE_ERROR, + "start peer 0.1\n"); + sps = GNUNET_new (struct StartPeerState); sps->m = m; sps->n = n; @@ -535,6 +563,9 @@ GNUNET_TRANSPORT_cmd_start_peer (const char *label, sps->connected_peers_map = connected_peers_map; sps->cfgname = cfgname; + LOG (GNUNET_ERROR_TYPE_ERROR, + "start peer 0.2\n"); + if (NULL != handlers) { for (i = 0; NULL != handlers[i].cb; i++) @@ -546,6 +577,8 @@ GNUNET_TRANSPORT_cmd_start_peer (const char *label, i * sizeof(struct GNUNET_MQ_MessageHandler)); } + LOG (GNUNET_ERROR_TYPE_ERROR, + "start peer 0.3\n"); struct GNUNET_TESTING_Command cmd = { .cls = sps, .label = label, -- cgit v1.2.3 From 8593b269709c6c328cad98e5f494e0339def8e62 Mon Sep 17 00:00:00 2001 From: t3sserakt Date: Wed, 28 Jul 2021 17:14:38 +0200 Subject: - commented rule for libgnunet_plugin_cmd_simple_send.la to fix build --- src/transport/Makefile.am | 24 ++++---- src/transport/transport-testing-cmds.h | 69 ++++++++++++++++++++++ src/transport/transport_api_cmd_connecting_peers.c | 1 + 3 files changed, 82 insertions(+), 12 deletions(-) create mode 100644 src/transport/transport-testing-cmds.h (limited to 'src') diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am index 2d3615e6a..3d8fa7774 100644 --- a/src/transport/Makefile.am +++ b/src/transport/Makefile.am @@ -397,18 +397,18 @@ plugin_LTLIBRARIES = \ $(HTTP_SERVER_PLUGIN_LA) \ $(HTTPS_SERVER_PLUGIN_LA) \ $(WLAN_PLUGIN_LA) \ - $(BT_PLUGIN_LA) \ - libgnunet_plugin_cmd_simple_send.la - -libgnunet_plugin_cmd_simple_send_la_SOURCES = \ - plugin_cmd_simple_send.c -libgnunet_plugin_cmd_simple_send_la_LIBADD = \ - $(top_builddir)/src/util/libgnunetutil.la \ - $(top_builddir)/src/testing/libgnunettesting.la \ - $(top_builddir)/src/statistics/libgnunetstatistics.la \ - $(top_builddir)/src/testbed/libgnunettestbed.la \ - libgnunettransporttesting2.la \ - $(LTLIBINTL) + $(BT_PLUGIN_LA) +# libgnunet_plugin_cmd_simple_send.la + +#libgnunet_plugin_cmd_simple_send_la_SOURCES = \ +# plugin_cmd_simple_send.c +#libgnunet_plugin_cmd_simple_send_la_LIBADD = \ +# $(top_builddir)/src/util/libgnunetutil.la \ +# $(top_builddir)/src/testing/libgnunettesting.la \ +# $(top_builddir)/src/statistics/libgnunetstatistics.la \ +# $(top_builddir)/src/testbed/libgnunettestbed.la \ +# libgnunettransporttesting2.la \ +# $(LTLIBINTL) #libgnunet_plugin_cmd_simple_send_la_LDFLAGS = \ # $(GN_PLUGIN_LDFLAGS) diff --git a/src/transport/transport-testing-cmds.h b/src/transport/transport-testing-cmds.h new file mode 100644 index 000000000..fed4e8d5a --- /dev/null +++ b/src/transport/transport-testing-cmds.h @@ -0,0 +1,69 @@ +/* + This file is part of GNUnet. + Copyright (C) 2006, 2009, 2015, 2016 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet 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 + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + + SPDX-License-Identifier: AGPL3.0-or-later + */ + +/** + * @file transport-testing.h + * @brief testing lib for transport service + * @author Matthias Wachs + * @author Christian Grothoff + */ +#ifndef TRANSPORT_TESTING_H +#define TRANSPORT_TESTING_H +#include "gnunet_testing_lib.h" + +struct GNUNET_TESTING_Command +GNUNET_TRANSPORT_cmd_start_peer (const char *label, + const char *system_label, + char *m, + char *n, + struct GNUNET_MQ_MessageHandler *handlers, + const char *cfgname); + +struct GNUNET_TESTING_Command +GNUNET_TRANSPORT_cmd_connect_peers (const char *label, + const char *peer1_label, + const char *peer2_label); + +int +GNUNET_TRANSPORT_get_trait_peer_id (const struct + GNUNET_TESTING_Command *cmd, + struct GNUNET_PeerIdentity **id); + +int +GNUNET_TRANSPORT_get_trait_connected_peers_map (const struct + GNUNET_TESTING_Command + *cmd, + struct + GNUNET_CONTAINER_MultiPeerMap ** + connected_peers_map); +int +GNUNET_TRANSPORT_get_trait_hello_size (const struct + GNUNET_TESTING_Command + *cmd, + size_t **hello_size); + +int +GNUNET_TRANSPORT_get_trait_hello (const struct + GNUNET_TESTING_Command + *cmd, + char **hello); + +#endif +/* end of transport_testing.h */ diff --git a/src/transport/transport_api_cmd_connecting_peers.c b/src/transport/transport_api_cmd_connecting_peers.c index d9253b6d4..69a4f385e 100644 --- a/src/transport/transport_api_cmd_connecting_peers.c +++ b/src/transport/transport_api_cmd_connecting_peers.c @@ -29,6 +29,7 @@ #include "gnunet_transport_application_service.h" #include "gnunet_hello_lib.h" #include "gnunet_transport_service.h" +#include "transport-testing-cmds.h" /** * Generic logging shortcut -- cgit v1.2.3 From 7a0caef7a7b1a3fe2949b6a0462125471905540b Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 28 Jul 2021 17:34:44 +0200 Subject: diagnostics mode for gnunet-config --- src/include/gnunet_configuration_lib.h | 23 +++ src/util/configuration.c | 271 +++++++++++++++++++++++++-------- src/util/gnunet-config.c | 49 ++++-- 3 files changed, 273 insertions(+), 70 deletions(-) (limited to 'src') diff --git a/src/include/gnunet_configuration_lib.h b/src/include/gnunet_configuration_lib.h index 68ed570a3..7a0dec792 100644 --- a/src/include/gnunet_configuration_lib.h +++ b/src/include/gnunet_configuration_lib.h @@ -138,6 +138,19 @@ GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg, size_t *size); +/** + * Serializes the given configuration with diagnostics information. + * Diagnostics information will only be available if diagnostics + * have been enabled before parsing. + * + * @param cfg configuration to serialize + * @return the memory block where the serialized configuration is + * present. This memory should be freed by the caller + */ +char * +GNUNET_CONFIGURATION_serialize_diagnostics (const struct + GNUNET_CONFIGURATION_Handle *cfg); + /** * De-serializes configuration * @@ -234,6 +247,16 @@ GNUNET_CONFIGURATION_parse_and_run (const char *filename, GNUNET_CONFIGURATION_Callback cb, void *cb_cls); +/** + * Enable extra diagnostics. Will produce more log output + * and allocate more memory. + * + * @param cfg configuration handle + */ +void +GNUNET_CONFIGURATION_enable_diagnostics (struct + GNUNET_CONFIGURATION_Handle *cfg); + /** * Function to iterate over options. diff --git a/src/util/configuration.c b/src/util/configuration.c index 06938be67..6178ab68e 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c @@ -28,6 +28,7 @@ #include "gnunet_os_lib.h" #include "gnunet_configuration_lib.h" #include "gnunet_disk_lib.h" +#include "gnunet_buffer_lib.h" #define LOG(kind, ...) GNUNET_log_from (kind, "util", __VA_ARGS__) @@ -53,6 +54,16 @@ struct ConfigEntry * current, committed value */ char *val; + + /** + * Diagnostics information for the filename. + */ + char *hint_filename; + + /** + * Diagnostics information for the line number. + */ + unsigned int hint_lineno; }; @@ -83,6 +94,21 @@ struct ConfigSection * directive, but the referenced file can't be found or accessed. */ bool inaccessible; + + /** + * Diagnostics hint for the inaccessible file. + */ + char *hint_secret_filename; + + /** + * For secret sections: Where was this inlined from? + */ + char *hint_inlined_from_filename; + + /** + * For secret sections: Where was this inlined from? + */ + unsigned int hint_inlined_from_line; }; @@ -96,6 +122,11 @@ struct GNUNET_CONFIGURATION_Handle */ struct ConfigSection *sections; + /** + * Enable diagnostics. + */ + bool diagnostics; + /** * Modification indication since last save * #GNUNET_NO if clean, #GNUNET_YES if dirty, @@ -122,6 +153,14 @@ struct DiffHandle }; +void +GNUNET_CONFIGURATION_enable_diagnostics (struct + GNUNET_CONFIGURATION_Handle *cfg) +{ + cfg->diagnostics = true; +} + + struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_create () { @@ -300,27 +339,6 @@ find_section (const struct GNUNET_CONFIGURATION_Handle *cfg, } -static void -set_section_inaccessible (struct GNUNET_CONFIGURATION_Handle *cfg, - const char *section) -{ - struct ConfigSection *sec; - - sec = find_section (cfg, section); - - if (NULL == sec) - { - sec = GNUNET_new (struct ConfigSection); - sec->name = GNUNET_strdup (section); - sec->next = cfg->sections; - cfg->sections = sec; - sec->entries = NULL; - } - - sec->inaccessible = true; -} - - /** * Handle an inline directive. * @@ -331,7 +349,8 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg, const char *path_or_glob, bool path_is_glob, const char *restrict_section, - const char *source_filename) + const char *source_filename, + unsigned int source_lineno) { char *inline_path; @@ -399,9 +418,30 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg, fret = GNUNET_DISK_file_test_read (inline_path); + cs = find_section (cfg, restrict_section); + + if (NULL == cs) + { + cs = GNUNET_new (struct ConfigSection); + cs->name = GNUNET_strdup (restrict_section); + cs->next = cfg->sections; + cfg->sections = cs; + cs->entries = NULL; + } + if (cfg->diagnostics) + { + if (NULL != inline_path) + cs->hint_secret_filename = GNUNET_strdup (inline_path); + if (source_filename) + { + cs->hint_inlined_from_filename = GNUNET_strdup (source_filename); + cs->hint_inlined_from_line = source_lineno; + } + } + if (GNUNET_OK != fret) { - set_section_inaccessible (cfg, restrict_section); + cs->inaccessible = true; GNUNET_free (inline_path); return GNUNET_OK; } @@ -447,6 +487,67 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg, } +/** + * Find an entry from a configuration. + * + * @param cfg handle to the configuration + * @param section section the option is in + * @param key the option + * @return matching entry, NULL if not found + */ +static struct ConfigEntry * +find_entry (const struct GNUNET_CONFIGURATION_Handle *cfg, + const char *section, + const char *key) +{ + struct ConfigSection *sec; + struct ConfigEntry *pos; + + if (NULL == (sec = find_section (cfg, section))) + return NULL; + if (sec->inaccessible) + { + LOG (GNUNET_ERROR_TYPE_WARNING, + "Section '%s' is marked as inaccessible, because the configuration " + " file that contains the section can't be read. Attempts to use " + "option '%s' will fail.\n", + section, + key); + return NULL; + } + pos = sec->entries; + while ((pos != NULL) && (0 != strcasecmp (key, pos->key))) + pos = pos->next; + return pos; +} + + +/** + * Set a configuration hint. + * + * @param cfg configuration handle + * @param section section + * @param option config option + * @param hint_filename + * @param hint_line + */ +static void +set_entry_hint (struct GNUNET_CONFIGURATION_Handle *cfg, + const char *section, + const char *option, + const char *hint_filename, + unsigned int hint_line) +{ + struct ConfigEntry *e = find_entry (cfg, section, option); + if (! cfg->diagnostics) + return; + if (! e) + return; + e->hint_filename = GNUNET_strdup (hint_filename); + e->hint_lineno = hint_line; +} + + enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, const char *mem, @@ -553,7 +654,8 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, path, false, NULL, - source_filename); + source_filename, + nr); } else if (0 == strcasecmp (directive, "INLINE-MATCHING")) { @@ -567,7 +669,8 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, path, true, NULL, - source_filename); + source_filename, + nr); } else if (0 == strcasecmp (directive, "INLINE-SECRET")) { @@ -600,7 +703,8 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, path, false, secname, - source_filename); + source_filename, + nr); } else { @@ -660,6 +764,14 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, value++; } GNUNET_CONFIGURATION_set_value_string (cfg, section, tag, &value[i]); + if (cfg->diagnostics) + { + set_entry_hint (cfg, + section, + tag, + source_filename ? source_filename : "", + nr); + } GNUNET_free (tag); continue; } @@ -799,6 +911,8 @@ GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg, NULL != sec; sec = sec->next) { + if (sec->inaccessible) + continue; /* For each section we need to add 3 characters: {'[',']','\n'} */ m_size += strlen (sec->name) + 3; for (struct ConfigEntry *ent = sec->entries; @@ -877,6 +991,73 @@ GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg, return mem; } +char * +GNUNET_CONFIGURATION_serialize_diagnostics (const struct + GNUNET_CONFIGURATION_Handle *cfg) +{ + struct GNUNET_Buffer buf = { 0 }; + + for (struct ConfigSection *sec = cfg->sections; + NULL != sec; + sec = sec->next) + { + if (sec->hint_secret_filename) + GNUNET_buffer_write_fstr (&buf, + "# secret section from %s\n", + sec->hint_secret_filename); + if (sec->hint_inlined_from_filename) + { + GNUNET_buffer_write_fstr (&buf, + "# inlined from %s:%u\n", + sec->hint_inlined_from_filename, + sec->hint_inlined_from_line); + } + GNUNET_buffer_write_fstr (&buf, + "[%s]\n", + sec->name); + if (sec->inaccessible) + { + GNUNET_buffer_write_fstr (&buf, + "#
\n\n"); + continue; + } + for (struct ConfigEntry *ent = sec->entries; + NULL != ent; + ent = ent->next) + { + if (do_skip (sec->name, + ent->key)) + continue; + if (NULL != ent->val) + { + char *pos; + char *val = GNUNET_malloc (strlen (ent->val) * 2 + 1); + strcpy (val, ent->val); + while (NULL != (pos = strstr (val, "\n"))) + { + memmove (&pos[2], &pos[1], strlen (&pos[1])); + pos[0] = '\\'; + pos[1] = 'n'; + } + if (NULL != ent->hint_filename) + { + GNUNET_buffer_write_fstr (&buf, + "# %s:%u\n", + ent->hint_filename, + ent->hint_lineno); + } + GNUNET_buffer_write_fstr (&buf, + "%s = %s\n", + ent->key, + val); + GNUNET_free (val); + } + GNUNET_buffer_write_str (&buf, "\n"); + } + GNUNET_buffer_write_str (&buf, "\n"); + } + return GNUNET_buffer_reap_str (&buf); +} enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg, @@ -1028,10 +1209,13 @@ GNUNET_CONFIGURATION_remove_section (struct GNUNET_CONFIGURATION_Handle *cfg, spos->entries = ent->next; GNUNET_free (ent->key); GNUNET_free (ent->val); + GNUNET_free (ent->hint_filename); GNUNET_free (ent); cfg->dirty = GNUNET_YES; } GNUNET_free (spos->name); + GNUNET_free (spos->hint_secret_filename); + GNUNET_free (spos->hint_inlined_from_filename); GNUNET_free (spos); return; } @@ -1073,41 +1257,6 @@ GNUNET_CONFIGURATION_dup (const struct GNUNET_CONFIGURATION_Handle *cfg) } -/** - * Find an entry from a configuration. - * - * @param cfg handle to the configuration - * @param section section the option is in - * @param key the option - * @return matching entry, NULL if not found - */ -static struct ConfigEntry * -find_entry (const struct GNUNET_CONFIGURATION_Handle *cfg, - const char *section, - const char *key) -{ - struct ConfigSection *sec; - struct ConfigEntry *pos; - - if (NULL == (sec = find_section (cfg, section))) - return NULL; - if (sec->inaccessible) - { - LOG (GNUNET_ERROR_TYPE_WARNING, - "Section '%s' is marked as inaccessible, because the configuration " - " file that contains the section can't be read. Attempts to use " - "option '%s' will fail.\n", - section, - key); - return NULL; - } - pos = sec->entries; - while ((pos != NULL) && (0 != strcasecmp (key, pos->key))) - pos = pos->next; - return pos; -} - - /** * A callback function, compares entries from two configurations * (default against a new configuration) and write the diffs in a diff --git a/src/util/gnunet-config.c b/src/util/gnunet-config.c index 3932ff1bf..20fd44c65 100644 --- a/src/util/gnunet-config.c +++ b/src/util/gnunet-config.c @@ -69,6 +69,12 @@ static int global_ret; */ static int rewrite; +/** + * Should we give extra diagnostics? + */ +static int diagnostics; + + /** * Should the generated configuration file contain the whole configuration? */ @@ -162,6 +168,18 @@ run (void *cls, GNUNET_free (name); return; } + + if (diagnostics) + { + struct GNUNET_CONFIGURATION_Handle *ncfg; + /* Re-parse the configuration with diagnostics enabled. */ + GNUNET_assert (NULL != cfgfile); + ncfg = GNUNET_CONFIGURATION_create (); + GNUNET_CONFIGURATION_enable_diagnostics (ncfg); + GNUNET_CONFIGURATION_load (ncfg, cfgfile); + cfg = ncfg; + } + if (full) rewrite = GNUNET_YES; if (list_sections) @@ -176,16 +194,23 @@ run (void *cls, if ( (! rewrite) && (NULL == section) ) { - fprintf (stderr, - _ ("%s or %s argument is required\n"), - "--section", - "--list-sections"); - global_ret = 1; - return; + char *ser; + if (! diagnostics) + { + fprintf (stderr, + _ ("%s, %s or %s argument is required\n"), + "--section", + "--list-sections", + "--diagnostics"); + global_ret = 1; + return; + } + ser = GNUNET_CONFIGURATION_serialize_diagnostics (cfg); + printf ("%s", ser); + GNUNET_free (ser); } - - if ( (NULL != section) && - (NULL == value) ) + else if ( (NULL != section) && + (NULL == value) ) { if (NULL == option) { @@ -348,6 +373,12 @@ main (int argc, char *const *argv) gettext_noop ( "rewrite the configuration file, even if nothing changed"), &rewrite), + GNUNET_GETOPT_option_flag ( + 'd', + "diagnostics", + gettext_noop ( + "output extra diagnostics"), + &diagnostics), GNUNET_GETOPT_option_flag ('S', "list-sections", gettext_noop ( -- cgit v1.2.3 From 1af9f6c1c6adcbb5e5d7af154cb0134e51613a03 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 28 Jul 2021 18:59:07 +0200 Subject: config: sort globbed files --- src/util/configuration.c | 97 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 68 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/util/configuration.c b/src/util/configuration.c index 6178ab68e..fffe08788 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c @@ -284,9 +284,14 @@ GNUNET_CONFIGURATION_parse_and_run (const char *filename, struct InlineGlobClosure { /** - * Configuration to read inlined configuration into. + * Collected files from globbing. */ - struct GNUNET_CONFIGURATION_Handle *cfg; + char **files; + + /** + * Size of the files array. + */ + unsigned int files_length; }; @@ -306,15 +311,12 @@ inline_glob_cb (void *cls, struct InlineGlobClosure *igc = cls; LOG (GNUNET_ERROR_TYPE_DEBUG, - "Reading globbed config file '%s'\n", + "Found globbed config file '%s'\n", filename); - if (GNUNET_OK != - GNUNET_CONFIGURATION_parse (igc->cfg, - filename)) - { - return GNUNET_SYSERR; - } + GNUNET_array_append (igc->files, + igc->files_length, + GNUNET_strdup (filename)); return GNUNET_OK; } @@ -339,6 +341,13 @@ find_section (const struct GNUNET_CONFIGURATION_Handle *cfg, } +static int +pstrcmp (const void *a, const void *b) +{ + return strcmp (*((const char **) a), *((const char **) b)); +} + + /** * Handle an inline directive. * @@ -353,6 +362,12 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg, unsigned int source_lineno) { char *inline_path; + struct GNUNET_CONFIGURATION_Handle *other_cfg = NULL; + struct InlineGlobClosure igc = { + .files = NULL, + .files_length = 0, + }; + enum GNUNET_GenericReturnValue fun_ret; /* We support the section restriction only for non-globs */ GNUNET_assert (! (path_is_glob && (NULL != restrict_section))); @@ -362,8 +377,10 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg, LOG (GNUNET_ERROR_TYPE_DEBUG, "Refusing to parse inline configurations, " "not allowed without source filename!\n"); - return GNUNET_SYSERR; + fun_ret = GNUNET_SYSERR; + goto cleanup; } + if ('/' == *path_or_glob) inline_path = GNUNET_strdup (path_or_glob); else @@ -381,7 +398,8 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg, /* Couldn't even resolve path of base dir. */ GNUNET_break (0); /* failed to parse included config */ - return GNUNET_SYSERR; + fun_ret = GNUNET_SYSERR; + goto cleanup; } endsep = strrchr (source_realpath, '/'); GNUNET_assert (NULL != endsep); @@ -392,12 +410,10 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg, path_or_glob); free (source_realpath); } + if (path_is_glob) { int nret; - struct InlineGlobClosure igc = { - .cfg = cfg, - }; LOG (GNUNET_ERROR_TYPE_DEBUG, "processing config glob '%s'\n", @@ -406,13 +422,25 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg, nret = GNUNET_DISK_glob (inline_path, inline_glob_cb, &igc); if (-1 == nret) { - GNUNET_free (inline_path); - return GNUNET_SYSERR; + fun_ret = GNUNET_SYSERR; + goto cleanup; + } + GNUNET_assert (nret == igc.files_length); + qsort (igc.files, igc.files_length, sizeof (char *), pstrcmp); + for (int i = 0; i < nret; i++) + { + if (GNUNET_OK != + GNUNET_CONFIGURATION_parse (cfg, + igc.files[i])) + { + fun_ret = GNUNET_SYSERR; + goto cleanup; + } } + fun_ret = GNUNET_OK; } else if (NULL != restrict_section) { - struct GNUNET_CONFIGURATION_Handle *other_cfg; enum GNUNET_GenericReturnValue fret; struct ConfigSection *cs; @@ -442,17 +470,16 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg, if (GNUNET_OK != fret) { cs->inaccessible = true; - GNUNET_free (inline_path); - return GNUNET_OK; + fun_ret = GNUNET_OK; + goto cleanup; } other_cfg = GNUNET_CONFIGURATION_create (); if (GNUNET_OK != GNUNET_CONFIGURATION_parse (other_cfg, inline_path)) { - GNUNET_free (inline_path); - GNUNET_CONFIGURATION_destroy (other_cfg); - return GNUNET_SYSERR; + fun_ret = GNUNET_SYSERR; + goto cleanup; } cs = find_section (other_cfg, restrict_section); @@ -462,9 +489,8 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg, "inlined configuration '%s' does not contain section '%s'\n", inline_path, restrict_section); - GNUNET_free (inline_path); - GNUNET_free (other_cfg); - return GNUNET_SYSERR; + fun_ret = GNUNET_SYSERR; + goto cleanup; } for (struct ConfigEntry *ce = cs->entries; NULL != ce; @@ -473,17 +499,30 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg, restrict_section, ce->key, ce->val); - GNUNET_CONFIGURATION_destroy (other_cfg); + fun_ret = GNUNET_OK; } else if (GNUNET_OK != GNUNET_CONFIGURATION_parse (cfg, inline_path)) { - GNUNET_free (inline_path); - return GNUNET_SYSERR; + fun_ret = GNUNET_SYSERR; + goto cleanup; + } + else + { + fun_ret = GNUNET_OK; } + cleanup: + if (NULL != other_cfg) + GNUNET_CONFIGURATION_destroy (other_cfg); GNUNET_free (inline_path); - return GNUNET_OK; + if (igc.files_length > 0) + { + for (size_t i = 0; i < igc.files_length; i++) + GNUNET_free (igc.files[i]); + GNUNET_array_grow (igc.files, igc.files_length, 0); + } + return fun_ret; } -- cgit v1.2.3 From 346706b1857dd9ec129cf40897468133f3c6bdd3 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 28 Jul 2021 20:19:38 +0200 Subject: config: extended diagnostics, import cycle detection, deterministic load order --- src/util/Makefile.am | 1 - src/util/configuration.c | 297 +++++++++++++++++++++++++++++++++------- src/util/configuration_loader.c | 91 ------------ src/util/disk.c | 13 +- 4 files changed, 257 insertions(+), 145 deletions(-) delete mode 100644 src/util/configuration_loader.c (limited to 'src') diff --git a/src/util/Makefile.am b/src/util/Makefile.am index e720112be..37eb0508b 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am @@ -49,7 +49,6 @@ libgnunetutil_la_SOURCES = \ common_endian.c \ common_logging.c \ configuration.c \ - configuration_loader.c \ consttime_memcmp.c \ container_bloomfilter.c \ container_heap.c \ diff --git a/src/util/configuration.c b/src/util/configuration.c index fffe08788..cc71a239d 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c @@ -29,6 +29,7 @@ #include "gnunet_configuration_lib.h" #include "gnunet_disk_lib.h" #include "gnunet_buffer_lib.h" +#include "gnunet_container_lib.h" #define LOG(kind, ...) GNUNET_log_from (kind, "util", __VA_ARGS__) @@ -111,6 +112,23 @@ struct ConfigSection unsigned int hint_inlined_from_line; }; +struct ConfigFile +{ + /** + * Source filename. + */ + char *source_filename; + + /** + * Level in the tree of loaded config files. + */ + unsigned int level; + + struct ConfigFile *prev; + + struct ConfigFile *next; +}; + /** * @brief configuration data @@ -122,6 +140,21 @@ struct GNUNET_CONFIGURATION_Handle */ struct ConfigSection *sections; + /** + * Linked list of loaded files. + */ + struct ConfigFile *loaded_files_head; + + /** + * Linked list of loaded files. + */ + struct ConfigFile *loaded_files_tail; + + /** + * Current nesting level of file loading. + */ + unsigned int current_nest_level; + /** * Enable diagnostics. */ @@ -134,6 +167,11 @@ struct GNUNET_CONFIGURATION_Handle */ enum GNUNET_GenericReturnValue dirty; + /** + * Was the configuration ever loaded via GNUNET_CONFIGURATION_load? + */ + bool load_called; + /** * Name of the entry point configuration file. */ @@ -250,9 +288,14 @@ void GNUNET_CONFIGURATION_destroy (struct GNUNET_CONFIGURATION_Handle *cfg) { struct ConfigSection *sec; + struct ConfigFile *cf; while (NULL != (sec = cfg->sections)) GNUNET_CONFIGURATION_remove_section (cfg, sec->name); + while (NULL != (cf = cfg->loaded_files_head)) + GNUNET_CONTAINER_DLL_remove (cfg->loaded_files_head, + cfg->loaded_files_tail, + cf); GNUNET_free (cfg); } @@ -279,9 +322,9 @@ GNUNET_CONFIGURATION_parse_and_run (const char *filename, /** - * Closure to inline_glob_cb. + * Closure to collect_files_cb. */ -struct InlineGlobClosure +struct CollectFilesContext { /** * Collected files from globbing. @@ -305,14 +348,10 @@ struct InlineGlobClosure * #GNUNET_SYSERR to abort iteration with error! */ static int -inline_glob_cb (void *cls, - const char *filename) +collect_files_cb (void *cls, + const char *filename) { - struct InlineGlobClosure *igc = cls; - - LOG (GNUNET_ERROR_TYPE_DEBUG, - "Found globbed config file '%s'\n", - filename); + struct CollectFilesContext *igc = cls; GNUNET_array_append (igc->files, igc->files_length, @@ -363,11 +402,12 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg, { char *inline_path; struct GNUNET_CONFIGURATION_Handle *other_cfg = NULL; - struct InlineGlobClosure igc = { + struct CollectFilesContext igc = { .files = NULL, .files_length = 0, }; enum GNUNET_GenericReturnValue fun_ret; + unsigned int old_nest_level = cfg->current_nest_level++; /* We support the section restriction only for non-globs */ GNUNET_assert (! (path_is_glob && (NULL != restrict_section))); @@ -419,7 +459,7 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg, "processing config glob '%s'\n", inline_path); - nret = GNUNET_DISK_glob (inline_path, inline_glob_cb, &igc); + nret = GNUNET_DISK_glob (inline_path, collect_files_cb, &igc); if (-1 == nret) { fun_ret = GNUNET_SYSERR; @@ -441,10 +481,10 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg, } else if (NULL != restrict_section) { - enum GNUNET_GenericReturnValue fret; + enum GNUNET_GenericReturnValue inner_ret; struct ConfigSection *cs; - fret = GNUNET_DISK_file_test_read (inline_path); + inner_ret = GNUNET_DISK_file_test_read (inline_path); cs = find_section (cfg, restrict_section); @@ -467,7 +507,7 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg, } } - if (GNUNET_OK != fret) + if (GNUNET_OK != inner_ret) { cs->inaccessible = true; fun_ret = GNUNET_OK; @@ -475,10 +515,11 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg, } other_cfg = GNUNET_CONFIGURATION_create (); - if (GNUNET_OK != GNUNET_CONFIGURATION_parse (other_cfg, - inline_path)) + inner_ret = GNUNET_CONFIGURATION_parse (other_cfg, + inline_path); + if (GNUNET_OK != inner_ret) { - fun_ret = GNUNET_SYSERR; + fun_ret = inner_ret; goto cleanup; } @@ -513,6 +554,7 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg, fun_ret = GNUNET_OK; } cleanup: + cfg->current_nest_level = old_nest_level; if (NULL != other_cfg) GNUNET_CONFIGURATION_destroy (other_cfg); GNUNET_free (inline_path); @@ -756,11 +798,7 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, } if (GNUNET_OK != directive_ret) { - LOG (GNUNET_ERROR_TYPE_WARNING, - _ ("Bad directive '%s' in line %u\n"), - directive, - nr); - ret = GNUNET_SYSERR; + ret = directive_ret; break; } continue; @@ -845,6 +883,55 @@ GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg, LOG (GNUNET_ERROR_TYPE_DEBUG, "Asked to parse config file `%s'\n", fn); if (NULL == fn) return GNUNET_SYSERR; + + + /* Check for cycles */ + { + unsigned int lvl = cfg->current_nest_level; + struct ConfigFile *cf = cfg->loaded_files_tail; + struct ConfigFile *parent = NULL; + + + for (; NULL != cf; parent = cf, cf = cf->prev) + { + /* Check parents based on level, skipping children of siblings. */ + if (cf->level >= lvl) + continue; + lvl = cf->level; + if ( (NULL == cf->source_filename) || (NULL == filename)) + continue; + if (0 == strcmp (cf->source_filename, filename)) + { + if (NULL == parent) + { + LOG (GNUNET_ERROR_TYPE_ERROR, + "Forbidden direct cyclic configuration import (%s -> %s)\n", + cf->source_filename, + filename); + } + else + LOG (GNUNET_ERROR_TYPE_ERROR, + "Forbidden indirect cyclic configuration import (%s -> ... -> %s -> %s)\n", + cf->source_filename, + parent->source_filename, + filename); + return GNUNET_SYSERR; + } + } + + } + + /* Keep track of loaded files.*/ + { + struct ConfigFile *cf = GNUNET_new (struct ConfigFile); + + cf->level = cfg->current_nest_level; + cf->source_filename = GNUNET_strdup (filename ? filename : ""); + GNUNET_CONTAINER_DLL_insert_tail (cfg->loaded_files_head, + cfg->loaded_files_tail, + cf); + } + dirty = cfg->dirty; /* back up value! */ if (GNUNET_SYSERR == GNUNET_DISK_file_size (fn, &fs64, GNUNET_YES, GNUNET_YES)) @@ -876,7 +963,7 @@ GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg, mem, fs, fn); - if (GNUNET_OK != ret) + if (GNUNET_SYSERR == ret) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _ ("Failed to parse configuration file `%s'\n"), @@ -1036,6 +1123,36 @@ GNUNET_CONFIGURATION_serialize_diagnostics (const struct { struct GNUNET_Buffer buf = { 0 }; + GNUNET_buffer_write_fstr (&buf, + "#\n# Configuration file diagnostics\n#\n"); + GNUNET_buffer_write_fstr (&buf, + "# Entry point: %s\n", + cfg->main_filename ? cfg->main_filename : + ""); + GNUNET_buffer_write_fstr (&buf, + "#\n# Files Loaded:\n"); + + for (struct ConfigFile *cfil = cfg->loaded_files_head; + NULL != cfil; + cfil = cfil->next) + { + GNUNET_buffer_write_fstr (&buf, + "# "); + for (unsigned int i = 0; i < cfil->level; i++) + GNUNET_buffer_write_fstr (&buf, + "+"); + if (0 != cfil->level) + GNUNET_buffer_write_fstr (&buf, + " "); + + GNUNET_buffer_write_fstr (&buf, + "%s\n", + cfil->source_filename); + } + + GNUNET_buffer_write_fstr (&buf, + "#\n\n"); + for (struct ConfigSection *sec = cfg->sections; NULL != sec; sec = sec->next) @@ -2059,41 +2176,51 @@ GNUNET_CONFIGURATION_remove_value_filename ( } -/** - * Wrapper around #GNUNET_CONFIGURATION_parse. Called on each - * file in a directory, we trigger parsing on those files that - * end with ".conf". - * - * @param cls the cfg - * @param filename file to parse - * @return #GNUNET_OK on success - */ -static enum GNUNET_GenericReturnValue -parse_configuration_file (void *cls, const char *filename) -{ - struct GNUNET_CONFIGURATION_Handle *cfg = cls; - char *ext; - - /* Examine file extension */ - ext = strrchr (filename, '.'); - if ((NULL == ext) || (0 != strcmp (ext, ".conf"))) - { - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Skipping file `%s'\n", filename); - return GNUNET_OK; - } - - return GNUNET_CONFIGURATION_parse (cfg, filename); -} - - enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_load_from (struct GNUNET_CONFIGURATION_Handle *cfg, const char *defaults_d) { + struct CollectFilesContext files_context = { + .files = NULL, + .files_length = 0, + }; + enum GNUNET_GenericReturnValue fun_ret; + if (GNUNET_SYSERR == - GNUNET_DISK_directory_scan (defaults_d, &parse_configuration_file, cfg)) + GNUNET_DISK_directory_scan (defaults_d, &collect_files_cb, + &files_context)) return GNUNET_SYSERR; /* no configuration at all found */ - return GNUNET_OK; + qsort (files_context.files, + files_context.files_length, + sizeof (char *), + pstrcmp); + for (unsigned int i = 0; i < files_context.files_length; i++) + { + char *ext; + const char *filename = files_context.files[i]; + + /* Examine file extension */ + ext = strrchr (filename, '.'); + if ((NULL == ext) || (0 != strcmp (ext, ".conf"))) + { + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Skipping file `%s'\n", filename); + fun_ret = GNUNET_OK; + goto cleanup; + } + fun_ret = GNUNET_CONFIGURATION_parse (cfg, filename); + if (fun_ret != GNUNET_OK) + break; + } + cleanup: + if (files_context.files_length > 0) + { + for (size_t i = 0; i < files_context.files_length; i++) + GNUNET_free (files_context.files[i]); + GNUNET_array_grow (files_context.files, + files_context.files_length, + 0); + } + return fun_ret; } @@ -2158,5 +2285,71 @@ GNUNET_CONFIGURATION_default (void) return cfg; } +/** + * Load configuration (starts with defaults, then loads + * system-specific configuration). + * + * @param cfg configuration to update + * @param filename name of the configuration file, NULL to load defaults + * @return #GNUNET_OK on success, #GNUNET_SYSERR on error + */ +int +GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg, + const char *filename) +{ + char *baseconfig; + const char *base_config_varname; + + if (cfg->load_called) + { + /* FIXME: Make this a GNUNET_assert later */ + GNUNET_break (0); + GNUNET_free (cfg->main_filename); + } + cfg->load_called = true; + if (NULL != filename) + cfg->main_filename = GNUNET_strdup (filename); + + base_config_varname = GNUNET_OS_project_data_get ()->base_config_varname; + + if ((NULL != base_config_varname) + && (NULL != (baseconfig = getenv (base_config_varname)))) + { + baseconfig = GNUNET_strdup (baseconfig); + } + else + { + char *ipath; + + ipath = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR); + if (NULL == ipath) + return GNUNET_SYSERR; + GNUNET_asprintf (&baseconfig, "%s%s", ipath, "config.d"); + GNUNET_free (ipath); + } + + char *dname = GNUNET_STRINGS_filename_expand (baseconfig); + GNUNET_free (baseconfig); + + if ((GNUNET_YES == GNUNET_DISK_directory_test (dname, GNUNET_YES))&& + (GNUNET_SYSERR == GNUNET_CONFIGURATION_load_from (cfg, dname))) + { + GNUNET_free (dname); + return GNUNET_SYSERR; /* no configuration at all found */ + } + GNUNET_free (dname); + if ((NULL != filename) && + (GNUNET_OK != GNUNET_CONFIGURATION_parse (cfg, filename))) + { + /* specified configuration not found */ + return GNUNET_SYSERR; + } + if (((GNUNET_YES != + GNUNET_CONFIGURATION_have_value (cfg, "PATHS", "DEFAULTCONFIG"))) && + (filename != NULL)) + GNUNET_CONFIGURATION_set_value_string (cfg, "PATHS", "DEFAULTCONFIG", + filename); + return GNUNET_OK; +} /* end of configuration.c */ diff --git a/src/util/configuration_loader.c b/src/util/configuration_loader.c deleted file mode 100644 index a59477b25..000000000 --- a/src/util/configuration_loader.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - This file is part of GNUnet. - Copyright (C) 2006, 2007, 2008, 2009, 2013 GNUnet e.V. - - GNUnet is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - GNUnet 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 - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - - SPDX-License-Identifier: AGPL3.0-or-later - */ - -/** - * @file src/util/configuration_loader.c - * @brief configuration loading - * @author Christian Grothoff - */ - -#include "platform.h" -#include "gnunet_util_lib.h" - -#define LOG(kind, ...) GNUNET_log_from (kind, "util-configuration", __VA_ARGS__) - - -/** - * Load configuration (starts with defaults, then loads - * system-specific configuration). - * - * @param cfg configuration to update - * @param filename name of the configuration file, NULL to load defaults - * @return #GNUNET_OK on success, #GNUNET_SYSERR on error - */ -int -GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg, - const char *filename) -{ - char *baseconfig; - const char *base_config_varname; - - base_config_varname = GNUNET_OS_project_data_get ()->base_config_varname; - - if (NULL != base_config_varname - && NULL != (baseconfig = getenv (base_config_varname))) - { - baseconfig = GNUNET_strdup (baseconfig); - } - else - { - char *ipath; - - ipath = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR); - if (NULL == ipath) - return GNUNET_SYSERR; - GNUNET_asprintf (&baseconfig, "%s%s", ipath, "config.d"); - GNUNET_free (ipath); - } - - char *dname = GNUNET_STRINGS_filename_expand (baseconfig); - GNUNET_free (baseconfig); - - if (GNUNET_YES == GNUNET_DISK_directory_test (dname, GNUNET_YES) && - GNUNET_SYSERR == GNUNET_CONFIGURATION_load_from (cfg, dname)) - { - GNUNET_free (dname); - return GNUNET_SYSERR; /* no configuration at all found */ - } - GNUNET_free (dname); - if ((NULL != filename) && - (GNUNET_OK != GNUNET_CONFIGURATION_parse (cfg, filename))) - { - /* specified configuration not found */ - return GNUNET_SYSERR; - } - if (((GNUNET_YES != - GNUNET_CONFIGURATION_have_value (cfg, "PATHS", "DEFAULTCONFIG"))) && - (filename != NULL)) - GNUNET_CONFIGURATION_set_value_string (cfg, "PATHS", "DEFAULTCONFIG", - filename); - return GNUNET_OK; -} - - -/* end of configuration_loader.c */ diff --git a/src/util/disk.c b/src/util/disk.c index f68b32db5..1b6934082 100644 --- a/src/util/disk.c +++ b/src/util/disk.c @@ -434,7 +434,7 @@ GNUNET_DISK_directory_test (const char *fil, int is_readable) /** * Check if fil can be accessed using amode. - * + * * @param fil file to check for * @param amode access mode * @returns GNUnet error code @@ -1002,6 +1002,17 @@ GNUNET_DISK_glob (const char *glob_pattern, char *sep; int ret; + if ( (NULL != strrchr (glob_pattern, '+')) || + (NULL != strrchr (glob_pattern, '[')) || + (NULL != strrchr (glob_pattern, '+')) || + (NULL != strrchr (glob_pattern, '~')) ) + { + LOG (GNUNET_ERROR_TYPE_ERROR, + "unsupported glob pattern: '%s'\n", + glob_pattern); + return -1; + } + sep = strrchr (mypat, DIR_SEPARATOR); if (NULL == sep) { -- cgit v1.2.3 From 3012383a1682c3bda9da12c15bfa7c0c384bc757 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 28 Jul 2021 21:00:30 +0200 Subject: config: report stats for secret sections --- src/util/configuration.c | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/util/configuration.c b/src/util/configuration.c index cc71a239d..016088eee 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c @@ -97,10 +97,15 @@ struct ConfigSection bool inaccessible; /** - * Diagnostics hint for the inaccessible file. + * Diagnostics hint for the secret file. */ char *hint_secret_filename; + /** + * Extra information regarding permissions of the secret file. + */ + char *hint_secret_stat; + /** * For secret sections: Where was this inlined from? */ @@ -498,8 +503,27 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg, } if (cfg->diagnostics) { - if (NULL != inline_path) - cs->hint_secret_filename = GNUNET_strdup (inline_path); + char *sfn = GNUNET_STRINGS_filename_expand (inline_path); + struct stat istat; + + cs->hint_secret_filename = sfn; + if (0 == stat (sfn, &istat)) + { + struct passwd *pw = getpwuid (istat.st_uid); + struct group *gr = getgrgid (istat.st_gid); + char *pwname = (NULL == pw) ? "" : pw->pw_name; + char *grname = (NULL == gr) ? "" : gr->gr_name; + + GNUNET_asprintf (&cs->hint_secret_stat, + "%s:%s %o", + pwname, + grname, + istat.st_mode); + } + else + { + cs->hint_secret_stat = GNUNET_strdup (""); + } if (source_filename) { cs->hint_inlined_from_filename = GNUNET_strdup (source_filename); @@ -1159,8 +1183,9 @@ GNUNET_CONFIGURATION_serialize_diagnostics (const struct { if (sec->hint_secret_filename) GNUNET_buffer_write_fstr (&buf, - "# secret section from %s\n", - sec->hint_secret_filename); + "# secret section from %s\n# secret file stat %s\n", + sec->hint_secret_filename, + sec->hint_secret_stat); if (sec->hint_inlined_from_filename) { GNUNET_buffer_write_fstr (&buf, @@ -1371,6 +1396,7 @@ GNUNET_CONFIGURATION_remove_section (struct GNUNET_CONFIGURATION_Handle *cfg, } GNUNET_free (spos->name); GNUNET_free (spos->hint_secret_filename); + GNUNET_free (spos->hint_secret_stat); GNUNET_free (spos->hint_inlined_from_filename); GNUNET_free (spos); return; -- cgit v1.2.3 From ff78b7b4003aa33e05c9f30125afdfff24c98eae Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 28 Jul 2021 21:03:14 +0200 Subject: -fix memleak --- src/util/configuration.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/util/configuration.c b/src/util/configuration.c index 016088eee..1ba9aab05 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c @@ -526,6 +526,8 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg, } if (source_filename) { + /* Possible that this secret section has been inlined before */ + GNUNET_free (cs->hint_inlined_from_filename); cs->hint_inlined_from_filename = GNUNET_strdup (source_filename); cs->hint_inlined_from_line = source_lineno; } -- cgit v1.2.3 From d4d9f8aae74ca9d88b168b6a4585453859fabf01 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 28 Jul 2021 21:20:41 +0200 Subject: -missing cosmetic newlines --- src/util/configuration.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/util/configuration.c b/src/util/configuration.c index 1ba9aab05..875a811b3 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c @@ -1143,6 +1143,7 @@ GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg, return mem; } + char * GNUNET_CONFIGURATION_serialize_diagnostics (const struct GNUNET_CONFIGURATION_Handle *cfg) @@ -1201,7 +1202,7 @@ GNUNET_CONFIGURATION_serialize_diagnostics (const struct if (sec->inaccessible) { GNUNET_buffer_write_fstr (&buf, - "#
\n\n"); + "#
\n\n\n"); continue; } for (struct ConfigEntry *ent = sec->entries; @@ -1242,6 +1243,7 @@ GNUNET_CONFIGURATION_serialize_diagnostics (const struct return GNUNET_buffer_reap_str (&buf); } + enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg, const char *filename) -- cgit v1.2.3 From b41bca63173d3c27fe3ba51612df20da9a795aea Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 29 Jul 2021 14:59:10 +0200 Subject: fall back to /etc for default configuration entry point --- src/include/gnunet_configuration_lib.h | 12 ++++++ src/util/configuration.c | 67 +++++++++++++++++++++++++++++++++- src/util/gnunet-config.c | 1 - src/util/program.c | 31 +++++++--------- 4 files changed, 91 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/include/gnunet_configuration_lib.h b/src/include/gnunet_configuration_lib.h index 7a0dec792..02e656196 100644 --- a/src/include/gnunet_configuration_lib.h +++ b/src/include/gnunet_configuration_lib.h @@ -112,6 +112,18 @@ struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_default (void); +/** + * Return the filename of the default configuration filename + * that is used when no explicit configuration entry point + * has been specified. + * + * @returns NULL if no default configuration file can be located, + * a newly allocated string otherwise + */ +char * +GNUNET_CONFIGURATION_default_filename (void); + + /** * Parse a configuration file, add all of the options in the * file to the configuration environment. diff --git a/src/util/configuration.c b/src/util/configuration.c index 875a811b3..776cfc7ea 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c @@ -1155,7 +1155,7 @@ GNUNET_CONFIGURATION_serialize_diagnostics (const struct GNUNET_buffer_write_fstr (&buf, "# Entry point: %s\n", cfg->main_filename ? cfg->main_filename : - ""); + ""); GNUNET_buffer_write_fstr (&buf, "#\n# Files Loaded:\n"); @@ -2253,6 +2253,58 @@ GNUNET_CONFIGURATION_load_from (struct GNUNET_CONFIGURATION_Handle *cfg, return fun_ret; } +char * +GNUNET_CONFIGURATION_default_filename (void) +{ + char *cfg_fn; + const struct GNUNET_OS_ProjectData *pd = GNUNET_OS_project_data_get (); + const char *xdg = getenv ("XDG_CONFIG_HOME"); + + if (NULL != xdg) + GNUNET_asprintf (&cfg_fn, + "%s%s%s", + xdg, + DIR_SEPARATOR_STR, + pd->config_file); + else + cfg_fn = GNUNET_strdup (pd->user_config_file); + + if (GNUNET_OK == GNUNET_DISK_file_test_read (cfg_fn)) + return cfg_fn; + + GNUNET_free (cfg_fn); + + /* Fall back to /etc/ for the default configuration. + Should be okay to use forward slashes here. */ + + GNUNET_asprintf (&cfg_fn, + "/etc/%s", + pd->config_file); + + if (GNUNET_OK == GNUNET_DISK_file_test_read (cfg_fn)) + return cfg_fn; + + GNUNET_free (cfg_fn); + + GNUNET_asprintf (&cfg_fn, + "/etc/%s", + pd->config_file); + + if (GNUNET_OK == GNUNET_DISK_file_test_read (cfg_fn)) + return cfg_fn; + + GNUNET_asprintf (&cfg_fn, + "/etc/%s/%s", + pd->project_dirname, + pd->config_file); + + if (GNUNET_OK == GNUNET_DISK_file_test_read (cfg_fn)) + return cfg_fn; + + GNUNET_free (cfg_fn); + return NULL; +} + struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_default (void) @@ -2284,7 +2336,9 @@ GNUNET_CONFIGURATION_default (void) if (GNUNET_OK != GNUNET_DISK_file_test (cfgname)) { GNUNET_free (cfgname); - GNUNET_asprintf (&cfgname, "/etc/%s/%s", pd->project_dirname, + GNUNET_asprintf (&cfgname, + "/etc/%s/%s", + pd->project_dirname, pd->config_file); } if (GNUNET_OK != GNUNET_DISK_file_test (cfgname)) @@ -2353,7 +2407,10 @@ GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg, ipath = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR); if (NULL == ipath) + { + GNUNET_break (0); return GNUNET_SYSERR; + } GNUNET_asprintf (&baseconfig, "%s%s", ipath, "config.d"); GNUNET_free (ipath); } @@ -2364,6 +2421,9 @@ GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg, if ((GNUNET_YES == GNUNET_DISK_directory_test (dname, GNUNET_YES))&& (GNUNET_SYSERR == GNUNET_CONFIGURATION_load_from (cfg, dname))) { + LOG (GNUNET_ERROR_TYPE_WARNING, + "Failed to load base configuration from '%s'\n", + filename); GNUNET_free (dname); return GNUNET_SYSERR; /* no configuration at all found */ } @@ -2372,6 +2432,9 @@ GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg, (GNUNET_OK != GNUNET_CONFIGURATION_parse (cfg, filename))) { /* specified configuration not found */ + LOG (GNUNET_ERROR_TYPE_WARNING, + "Failed to load configuration from file '%s'\n", + filename); return GNUNET_SYSERR; } if (((GNUNET_YES != diff --git a/src/util/gnunet-config.c b/src/util/gnunet-config.c index 20fd44c65..4f16332db 100644 --- a/src/util/gnunet-config.c +++ b/src/util/gnunet-config.c @@ -173,7 +173,6 @@ run (void *cls, { struct GNUNET_CONFIGURATION_Handle *ncfg; /* Re-parse the configuration with diagnostics enabled. */ - GNUNET_assert (NULL != cfgfile); ncfg = GNUNET_CONFIGURATION_create (); GNUNET_CONFIGURATION_enable_diagnostics (ncfg); GNUNET_CONFIGURATION_load (ncfg, cfgfile); diff --git a/src/util/program.c b/src/util/program.c index e34b37370..a79e07d19 100644 --- a/src/util/program.c +++ b/src/util/program.c @@ -140,7 +140,6 @@ GNUNET_PROGRAM_run2 (int argc, char *loglev; char *logfile; char *cfg_fn; - const char *xdg; enum GNUNET_GenericReturnValue ret; int iret; unsigned int cnt; @@ -149,12 +148,13 @@ GNUNET_PROGRAM_run2 (int argc, long long clock_offset; struct GNUNET_CONFIGURATION_Handle *cfg; const struct GNUNET_OS_ProjectData *pd = GNUNET_OS_project_data_get (); - struct GNUNET_GETOPT_CommandLineOption defoptions[] = - { GNUNET_GETOPT_option_cfgfile (&cc.cfgfile), + struct GNUNET_GETOPT_CommandLineOption defoptions[] = { + GNUNET_GETOPT_option_cfgfile (&cc.cfgfile), GNUNET_GETOPT_option_help (binaryHelp), GNUNET_GETOPT_option_loglevel (&loglev), GNUNET_GETOPT_option_logfile (&logfile), - GNUNET_GETOPT_option_version (pd->version) }; + GNUNET_GETOPT_option_version (pd->version) + }; struct GNUNET_GETOPT_CommandLineOption *allopts; const char *gargs; char *lpfx; @@ -219,17 +219,7 @@ GNUNET_PROGRAM_run2 (int argc, &cmd_sorter); loglev = NULL; if ((NULL != pd->config_file) && (NULL != pd->user_config_file)) - { - xdg = getenv ("XDG_CONFIG_HOME"); - if (NULL != xdg) - GNUNET_asprintf (&cfg_fn, - "%s%s%s", - xdg, - DIR_SEPARATOR_STR, - pd->config_file); - else - cfg_fn = GNUNET_strdup (pd->user_config_file); - } + cfg_fn = GNUNET_CONFIGURATION_default_filename (); else cfg_fn = NULL; lpfx = GNUNET_strdup (binaryName); @@ -251,6 +241,9 @@ GNUNET_PROGRAM_run2 (int argc, } if (NULL != cc.cfgfile) { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Loading configuration from entry point specified as option (%s)\n", + cc.cfgfile); if ((GNUNET_YES != GNUNET_DISK_file_test (cc.cfgfile)) || (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (cfg, cc.cfgfile))) { @@ -266,6 +259,9 @@ GNUNET_PROGRAM_run2 (int argc, } else { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Loading configuration default entry point (%s)\n", + cc.cfgfile); if ((NULL != cfg_fn) && (GNUNET_YES == GNUNET_DISK_file_test (cfg_fn))) { if (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (cfg, cfg_fn)) @@ -283,8 +279,9 @@ GNUNET_PROGRAM_run2 (int argc, } else if (NULL != cfg_fn) { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Loading configuration without entry point\n"); GNUNET_free (cfg_fn); - cfg_fn = NULL; if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, NULL)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -349,7 +346,7 @@ GNUNET_PROGRAM_run2 (int argc, cc.task (cc.task_cls, cc.args, cc.cfgfile, cc.cfg); } ret = GNUNET_OK; -cleanup: + cleanup: GNUNET_CONFIGURATION_destroy (cfg); GNUNET_free (cc.cfgfile); GNUNET_free (cfg_fn); -- cgit v1.2.3 From 73ae1f37958f206e34a420711c1d703198ee17fb Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 29 Jul 2021 15:40:36 +0200 Subject: config: prettier pretty printing --- src/util/configuration.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/util/configuration.c b/src/util/configuration.c index 776cfc7ea..47a410642 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c @@ -1197,7 +1197,7 @@ GNUNET_CONFIGURATION_serialize_diagnostics (const struct sec->hint_inlined_from_line); } GNUNET_buffer_write_fstr (&buf, - "[%s]\n", + "[%s]\n\n", sec->name); if (sec->inaccessible) { -- cgit v1.2.3 From b69774cba0ec55ad0c0000c183eee5d8c01d8363 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 29 Jul 2021 16:13:16 +0200 Subject: do not warn when GNUNET_DISK_file_test can't access file Callers already warn here. Warning if a file can't be found leads to output that's too verbose, as GNUNET_DISK_file_test isn't only called when we expect the file to exist. --- src/util/disk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/util/disk.c b/src/util/disk.c index 1b6934082..bc7be8960 100644 --- a/src/util/disk.c +++ b/src/util/disk.c @@ -455,7 +455,7 @@ file_test_internal (const char *fil, int amode) { if (errno != ENOENT) { - LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "stat", rdir); + LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_DEBUG, "stat", rdir); GNUNET_free (rdir); return GNUNET_SYSERR; } @@ -469,7 +469,7 @@ file_test_internal (const char *fil, int amode) } if (access (rdir, amode) < 0) { - LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "access", rdir); + LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_DEBUG, "access", rdir); GNUNET_free (rdir); return GNUNET_SYSERR; } -- cgit v1.2.3 From 12e29f00467cfc081d9500c47c048b5a79971f70 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Thu, 29 Jul 2021 10:42:18 -0400 Subject: add dependency lib to a couple targets * src/testbed/Makefile.am (gnunet_testbed_profiler_LDADD) (generate_underlay_topology_LDADD): Add dependency on '$(top_builddir)/src/testing/libgnunettesting.la'. --- src/testbed/Makefile.am | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/testbed/Makefile.am b/src/testbed/Makefile.am index 347d16007..b4b2cff97 100644 --- a/src/testbed/Makefile.am +++ b/src/testbed/Makefile.am @@ -76,6 +76,7 @@ gnunet_service_testbed_LDADD = $(XLIB) \ gnunet_testbed_profiler_SOURCES = \ gnunet-testbed-profiler.c gnunet_testbed_profiler_LDADD = $(XLIB) \ + $(top_builddir)/src/testing/libgnunettesting.la \ $(top_builddir)/src/util/libgnunetutil.la \ libgnunettestbed.la gnunet_testbed_profiler_LDFLAGS = \ @@ -169,6 +170,7 @@ libgnunettestbed_la_LDFLAGS = \ generate_underlay_topology_SOURCES = generate-underlay-topology.c generate_underlay_topology_LDADD = $(XLIB) \ + $(top_builddir)/src/testing/libgnunettesting.la \ $(top_builddir)/src/util/libgnunetutil.la \ libgnunettestbed.la \ $(LTLIBINTL) -lsqlite3 -- cgit v1.2.3 From 5277d5cb4288dbe25f72dc59a7a4449d5a83bdda Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Thu, 29 Jul 2021 10:55:10 -0400 Subject: add dependency lib * src/ats-tests/Makefile.am ( gnunet_ats_sim_LDADD): Add dependency on '$(top_builddir)/src/testing/libgnunettesting.la'. --- src/ats-tests/Makefile.am | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/ats-tests/Makefile.am b/src/ats-tests/Makefile.am index 543fed287..d515d3e17 100644 --- a/src/ats-tests/Makefile.am +++ b/src/ats-tests/Makefile.am @@ -61,6 +61,7 @@ gnunet_ats_sim_SOURCES = \ gnunet_ats_sim_LDADD = \ $(top_builddir)/src/util/libgnunetutil.la \ $(top_builddir)/src/ats-tests/libgnunetatstesting.la \ + $(top_builddir)/src/testing/libgnunettesting.la \ $(top_builddir)/src/testbed/libgnunettestbed.la \ $(top_builddir)/src/ats/libgnunetats.la \ $(top_builddir)/src/core/libgnunetcore.la \ -- cgit v1.2.3 From 281e8abbdd96ca5c56fefe98e19f993052fd2a02 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Thu, 29 Jul 2021 10:58:59 -0400 Subject: add dependency lib * src/nse/Makefile.am (gnunet_nse_profiler_LDADD): Add dependency on '$(top_builddir)/src/testing/libgnunettesting.la'. --- src/nse/Makefile.am | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/nse/Makefile.am b/src/nse/Makefile.am index 85ae4d3be..824aa10d4 100644 --- a/src/nse/Makefile.am +++ b/src/nse/Makefile.am @@ -47,6 +47,7 @@ gnunet_nse_profiler_LDADD = -lm \ libgnunetnse.la \ $(top_builddir)/src/util/libgnunetutil.la \ $(top_builddir)/src/statistics/libgnunetstatistics.la \ + $(top_builddir)/src/testing/libgnunettesting.la \ $(top_builddir)/src/testbed/libgnunettestbed.la \ $(GN_LIBINTL) -- cgit v1.2.3 From 3f0de2c2d3f51bb84748451167b16cba51049896 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Thu, 29 Jul 2021 11:08:10 -0400 Subject: add dependency lib * src/dht/Makefile.am (gnunet_dht_profiler_LDADD): Add dependency on '$(top_builddir)/src/testing/libgnunettesting.la'. --- src/dht/Makefile.am | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/dht/Makefile.am b/src/dht/Makefile.am index 2182d1c7f..919eca438 100644 --- a/src/dht/Makefile.am +++ b/src/dht/Makefile.am @@ -112,6 +112,7 @@ gnunet_dht_profiler_LDADD = \ libgnunetdht.la \ $(top_builddir)/src/core/libgnunetcore.la \ $(top_builddir)/src/util/libgnunetutil.la \ + $(top_builddir)/src/testing/libgnunettesting.la \ $(top_builddir)/src/testbed/libgnunettestbed.la gnunet_dht_profiler_LDFLAGS = \ $(GN_LIBINTL) -- cgit v1.2.3 From 6212bce41b6de631ff1d897ca57a892a9ba4abcc Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 29 Jul 2021 17:15:32 +0200 Subject: config: restrict directives in files loaded via @inline-secret@ --- src/util/configuration.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/util/configuration.c b/src/util/configuration.c index 47a410642..147f57a3c 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c @@ -132,6 +132,17 @@ struct ConfigFile struct ConfigFile *prev; struct ConfigFile *next; + + /** + * Was this configuration file parsed via + * @inline-secret@? + */ + char *hint_restrict_section; + + /** + * Was this configuration file inaccessible? + */ + bool hint_inaccessible; }; @@ -181,6 +192,13 @@ struct GNUNET_CONFIGURATION_Handle * Name of the entry point configuration file. */ char *main_filename; + + /** + * When parsing into this configuration, and this vaue + * is non-NULL, only parse sections of the same name, + * and ban import statements. + */ + const char *restrict_section; }; @@ -298,9 +316,13 @@ GNUNET_CONFIGURATION_destroy (struct GNUNET_CONFIGURATION_Handle *cfg) while (NULL != (sec = cfg->sections)) GNUNET_CONFIGURATION_remove_section (cfg, sec->name); while (NULL != (cf = cfg->loaded_files_head)) + { + GNUNET_free (cf->hint_restrict_section); + GNUNET_free (cf->source_filename); GNUNET_CONTAINER_DLL_remove (cfg->loaded_files_head, cfg->loaded_files_tail, cf); + } GNUNET_free (cfg); } @@ -488,6 +510,7 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg, { enum GNUNET_GenericReturnValue inner_ret; struct ConfigSection *cs; + struct ConfigFile *cf = GNUNET_new (struct ConfigFile); inner_ret = GNUNET_DISK_file_test_read (inline_path); @@ -533,18 +556,32 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg, } } + /* Put file in the load list for diagnostics, even if we can't access it. */ + { + cf->level = cfg->current_nest_level; + cf->source_filename = GNUNET_strdup (inline_path); + cf->hint_restrict_section = GNUNET_strdup (restrict_section); + GNUNET_CONTAINER_DLL_insert_tail (cfg->loaded_files_head, + cfg->loaded_files_tail, + cf); + } + if (GNUNET_OK != inner_ret) { cs->inaccessible = true; + cf->hint_inaccessible = true; + /* File can't be accessed, but that's okay. */ fun_ret = GNUNET_OK; goto cleanup; } other_cfg = GNUNET_CONFIGURATION_create (); + other_cfg->restrict_section = restrict_section; inner_ret = GNUNET_CONFIGURATION_parse (other_cfg, inline_path); if (GNUNET_OK != inner_ret) { + cf->hint_inaccessible = true; fun_ret = inner_ret; goto cleanup; } @@ -738,6 +775,17 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, char *directive; enum GNUNET_GenericReturnValue directive_ret; + if (NULL != cfg->restrict_section) + { + LOG (GNUNET_ERROR_TYPE_WARNING, + _ ( + "Illegal directive in line %u (parsing resticted section %s)\n"), + nr, + cfg->restrict_section); + ret = GNUNET_SYSERR; + break; + } + if (NULL == end) { LOG (GNUNET_ERROR_TYPE_WARNING, @@ -1173,8 +1221,19 @@ GNUNET_CONFIGURATION_serialize_diagnostics (const struct " "); GNUNET_buffer_write_fstr (&buf, - "%s\n", + "%s", cfil->source_filename); + + if (NULL != cfil->hint_restrict_section) + GNUNET_buffer_write_fstr (&buf, + " (%s secret section %s)", + cfil->hint_inaccessible + ? "inaccessible" + : "loaded", + cfil->hint_restrict_section); + + GNUNET_buffer_write_str (&buf, + "\n"); } GNUNET_buffer_write_fstr (&buf, -- cgit v1.2.3 From d64c03e31e42c83a38e25a633593c3179930385f Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Thu, 29 Jul 2021 11:14:01 -0400 Subject: add dependency lib * src/regex/Makefile.am (gnunet_regex_profiler_LDADD): Add dependency on '$(top_builddir)/src/testing/libgnunettesting.la'. --- src/regex/Makefile.am | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/regex/Makefile.am b/src/regex/Makefile.am index 13413f242..0b55d134f 100644 --- a/src/regex/Makefile.am +++ b/src/regex/Makefile.am @@ -126,6 +126,7 @@ gnunet_regex_profiler_SOURCES = \ gnunet-regex-profiler.c gnunet_regex_profiler_LDADD = -lm \ $(top_builddir)/src/arm/libgnunetarm.la \ + $(top_builddir)/src/testing/libgnunettesting.la \ $(top_builddir)/src/testbed/libgnunettestbed.la \ libgnunetregex_internal.a \ $(top_builddir)/src/dht/libgnunetdht.la \ -- cgit v1.2.3 From 4fcc8069d30a95624d0d5bd7d6fb8648df2de966 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Thu, 29 Jul 2021 11:16:48 -0400 Subject: add dependency lib * src/consensus/Makefile.am (gnunet_consensus_profiler_LDADD): Add dependency on '$(top_builddir)/src/testing/libgnunettesting.la'. --- src/consensus/Makefile.am | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/consensus/Makefile.am b/src/consensus/Makefile.am index 24e685fb9..cf1d32e74 100644 --- a/src/consensus/Makefile.am +++ b/src/consensus/Makefile.am @@ -40,6 +40,7 @@ gnunet_consensus_profiler_SOURCES = \ gnunet_consensus_profiler_LDADD = \ $(top_builddir)/src/util/libgnunetutil.la \ libgnunetconsensus.la \ + $(top_builddir)/src/testing/libgnunettesting.la \ $(top_builddir)/src/testbed/libgnunettestbed.la \ $(GN_LIBINTL) -- cgit v1.2.3 From d48374b558143b4027c6b7cc7366dbd3ae110156 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Thu, 29 Jul 2021 11:18:41 -0400 Subject: add dependency lib * src/fs/Makefile.am (gnunet_fs_profiler_LDADD): Add dependency on '$(top_builddir)/src/testing/libgnunettesting.la'. --- src/fs/Makefile.am | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/fs/Makefile.am b/src/fs/Makefile.am index 25590c6f7..2400d412e 100644 --- a/src/fs/Makefile.am +++ b/src/fs/Makefile.am @@ -105,6 +105,7 @@ endif gnunet_fs_profiler_SOURCES = \ gnunet-fs-profiler.c gnunet_fs_profiler_LDADD = \ + $(top_builddir)/src/testing/libgnunettesting.la \ $(top_builddir)/src/testbed/libgnunettestbed.la \ $(top_builddir)/src/util/libgnunetutil.la \ $(GN_LIBINTL) -- cgit v1.2.3 From afefba9c9a35dc3d9ae8c188062a16d5a25eaece Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Thu, 29 Jul 2021 11:20:08 -0400 Subject: add dependency lib * src/secretsharing/Makefile.am (gnunet_secretsharing_profiler_LDADD): Add dependency on '$(top_builddir)/src/testing/libgnunettesting.la'. --- src/secretsharing/Makefile.am | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/secretsharing/Makefile.am b/src/secretsharing/Makefile.am index 787cfa0c1..9ae6e7892 100644 --- a/src/secretsharing/Makefile.am +++ b/src/secretsharing/Makefile.am @@ -24,6 +24,7 @@ gnunet_secretsharing_profiler_SOURCES = \ gnunet-secretsharing-profiler.c gnunet_secretsharing_profiler_LDADD = \ libgnunetsecretsharing.la \ + $(top_builddir)/src/testing/libgnunettesting.la \ $(top_builddir)/src/testbed/libgnunettestbed.la \ $(top_builddir)/src/util/libgnunetutil.la \ $(GN_LIBINTL) -- cgit v1.2.3 From 1cf24fd82adebf83ac0b01fc3a4b7de2322e075a Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 29 Jul 2021 20:21:48 +0200 Subject: -fix return value of GNUNET_disk_glob --- src/util/disk.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/util/disk.c b/src/util/disk.c index bc7be8960..ada35249f 100644 --- a/src/util/disk.c +++ b/src/util/disk.c @@ -956,6 +956,11 @@ struct GlobClosure const char *glob; GNUNET_FileNameCallback cb; void *cls; + + /** + * Number of files that actually matched the glob pattern. + */ + int nres; }; /** @@ -984,10 +989,15 @@ glob_cb (void *cls, if (glob_match (gc->glob, fn)) { + enum GNUNET_GenericReturnValue cbret; + LOG (GNUNET_ERROR_TYPE_DEBUG, "found glob match '%s'\n", filename); - gc->cb (gc->cls, filename); + gc->nres++; + cbret = gc->cb (gc->cls, filename); + if (GNUNET_OK != cbret) + return cbret; } return GNUNET_OK; } @@ -1036,6 +1046,7 @@ GNUNET_DISK_glob (const char *glob_pattern, .glob = sep + 1, .cb = callback, .cls = callback_cls, + .nres = 0, }; LOG (GNUNET_ERROR_TYPE_DEBUG, "scanning directory '%s' for glob matches on '%s'\n", @@ -1045,9 +1056,9 @@ GNUNET_DISK_glob (const char *glob_pattern, glob_cb, &gc ); + GNUNET_free (mypat); + return (ret < 0) ? ret : gc.nres; } - GNUNET_free (mypat); - return ret; } -- cgit v1.2.3 From 72250781a26933bb676fa4ef377554f5fdaef21e Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Thu, 29 Jul 2021 14:26:22 -0400 Subject: use modern spelling for LLONG_{MAX,MIN} This fixes a FTBFS under Alpine Linux 3.13 (GNU GCC 10.2.1). See also: . --- src/json/json_pack.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/json/json_pack.c b/src/json/json_pack.c index 20db47cd4..d86baff41 100644 --- a/src/json/json_pack.c +++ b/src/json/json_pack.c @@ -109,7 +109,7 @@ GNUNET_JSON_pack_uint64 (const char *name, }; #if JSON_INTEGER_IS_LONG_LONG - GNUNET_assert (num <= LONG_LONG_MAX); + GNUNET_assert (num <= LLONG_MAX); #else GNUNET_assert (num <= LONG_MAX); #endif @@ -127,8 +127,8 @@ GNUNET_JSON_pack_int64 (const char *name, }; #if JSON_INTEGER_IS_LONG_LONG - GNUNET_assert (num <= LONG_LONG_MAX); - GNUNET_assert (num >= LONG_LONG_MIN); + GNUNET_assert (num <= LLONG_MAX); + GNUNET_assert (num >= LLONG_MIN); #else GNUNET_assert (num <= LONG_MAX); GNUNET_assert (num >= LONG_MIN); -- cgit v1.2.3 From 5d50fd641c798fab78267446fe527ffbc7c06949 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 29 Jul 2021 23:45:49 +0200 Subject: -remove unnecessary options from Makefile.am --- src/json/Makefile.am | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/json/Makefile.am b/src/json/Makefile.am index 3c19f96bf..2e97cecb9 100644 --- a/src/json/Makefile.am +++ b/src/json/Makefile.am @@ -13,7 +13,9 @@ libgnunetjson_la_LDFLAGS = \ $(GN_LIBINTL) \ -version-info 0:0:0 \ -no-undefined -libgnunetjson_la_CFLAGS = $(MHD_CFLAGS) $(AM_CFLAGS) +libgnunetjson_la_CFLAGS = \ + $(MHD_CFLAGS) \ + $(AM_CFLAGS) libgnunetjson_la_SOURCES = \ json.c \ json_generator.c \ @@ -26,9 +28,6 @@ libgnunetjson_la_LIBADD = \ $(MHD_LIBS) \ $(XLIB) \ $(Z_LIBS) -libgnunetjson_la_DEPENDENCIES = \ - $(top_builddir)/src/util/libgnunetutil.la - check_PROGRAMS = \ test_json \ -- cgit v1.2.3 From 7f3311b8755f144fea8ab56fa21816e7f92c5820 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 30 Jul 2021 09:45:55 +0200 Subject: -fix spelling --- src/util/configuration.c | 13 ++++++++----- src/util/gnunet-config.c | 11 +++++++---- 2 files changed, 15 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/util/configuration.c b/src/util/configuration.c index 147f57a3c..e515c7c46 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c @@ -194,7 +194,7 @@ struct GNUNET_CONFIGURATION_Handle char *main_filename; /** - * When parsing into this configuration, and this vaue + * When parsing into this configuration, and this value * is non-NULL, only parse sections of the same name, * and ban import statements. */ @@ -616,7 +616,7 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg, { fun_ret = GNUNET_OK; } - cleanup: +cleanup: cfg->current_nest_level = old_nest_level; if (NULL != other_cfg) GNUNET_CONFIGURATION_destroy (other_cfg); @@ -779,7 +779,7 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, { LOG (GNUNET_ERROR_TYPE_WARNING, _ ( - "Illegal directive in line %u (parsing resticted section %s)\n"), + "Illegal directive in line %u (parsing restricted section %s)\n"), nr, cfg->restrict_section); ret = GNUNET_SYSERR; @@ -2300,7 +2300,7 @@ GNUNET_CONFIGURATION_load_from (struct GNUNET_CONFIGURATION_Handle *cfg, if (fun_ret != GNUNET_OK) break; } - cleanup: +cleanup: if (files_context.files_length > 0) { for (size_t i = 0; i < files_context.files_length; i++) @@ -2312,6 +2312,7 @@ GNUNET_CONFIGURATION_load_from (struct GNUNET_CONFIGURATION_Handle *cfg, return fun_ret; } + char * GNUNET_CONFIGURATION_default_filename (void) { @@ -2428,6 +2429,7 @@ GNUNET_CONFIGURATION_default (void) return cfg; } + /** * Load configuration (starts with defaults, then loads * system-specific configuration). @@ -2477,7 +2479,7 @@ GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg, char *dname = GNUNET_STRINGS_filename_expand (baseconfig); GNUNET_free (baseconfig); - if ((GNUNET_YES == GNUNET_DISK_directory_test (dname, GNUNET_YES))&& + if ((GNUNET_YES == GNUNET_DISK_directory_test (dname, GNUNET_YES)) && (GNUNET_SYSERR == GNUNET_CONFIGURATION_load_from (cfg, dname))) { LOG (GNUNET_ERROR_TYPE_WARNING, @@ -2504,4 +2506,5 @@ GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg, return GNUNET_OK; } + /* end of configuration.c */ diff --git a/src/util/gnunet-config.c b/src/util/gnunet-config.c index 4f16332db..807df0d74 100644 --- a/src/util/gnunet-config.c +++ b/src/util/gnunet-config.c @@ -193,7 +193,8 @@ run (void *cls, if ( (! rewrite) && (NULL == section) ) { - char *ser; + char *serialization; + if (! diagnostics) { fprintf (stderr, @@ -204,9 +205,11 @@ run (void *cls, global_ret = 1; return; } - ser = GNUNET_CONFIGURATION_serialize_diagnostics (cfg); - printf ("%s", ser); - GNUNET_free (ser); + serialization = GNUNET_CONFIGURATION_serialize_diagnostics (cfg); + fprintf (stdout, + "%s", + serialization); + GNUNET_free (serialization); } else if ( (NULL != section) && (NULL == value) ) -- cgit v1.2.3 From e84ea6f9f1718298486a088832c87479bd6e9572 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 30 Jul 2021 12:25:07 +0200 Subject: -rename plugin, otherwise plugin_test fails due to conflicting other plugin with the same prefix name --- src/util/Makefile.am | 6 +++--- src/util/plugin.c | 6 +++++- src/util/test_plugin.c | 52 ++++++++++++++++++++++++++++++--------------- src/util/test_plugin_plug.c | 5 +++-- 4 files changed, 46 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/util/Makefile.am b/src/util/Makefile.am index 37eb0508b..89d040a0c 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am @@ -242,11 +242,11 @@ gnunet_qr_LDADD = \ gnunet_qr_LDFLAGS= -lzbar plugin_LTLIBRARIES = \ - libgnunet_plugin_test.la + libgnunet_plugin_utiltest.la -libgnunet_plugin_test_la_SOURCES = \ +libgnunet_plugin_utiltest_la_SOURCES = \ test_plugin_plug.c -libgnunet_plugin_test_la_LDFLAGS = \ +libgnunet_plugin_utiltest_la_LDFLAGS = \ $(GN_PLUGIN_LDFLAGS) if HAVE_BENCHMARKS diff --git a/src/util/plugin.c b/src/util/plugin.c index feb661f24..39874a588 100644 --- a/src/util/plugin.c +++ b/src/util/plugin.c @@ -447,8 +447,12 @@ GNUNET_PLUGIN_load_all_in_context (const struct GNUNET_OS_ProjectData *ctx, void *cb_cls) { const struct GNUNET_OS_ProjectData *cpd = GNUNET_OS_project_data_get (); + GNUNET_OS_init (ctx); - GNUNET_PLUGIN_load_all (basename, arg, cb, cb_cls); + GNUNET_PLUGIN_load_all (basename, + arg, + cb, + cb_cls); GNUNET_OS_init (cpd); } diff --git a/src/util/test_plugin.c b/src/util/test_plugin.c index c0eb717d6..e739d17c9 100644 --- a/src/util/test_plugin.c +++ b/src/util/test_plugin.c @@ -26,15 +26,22 @@ static void -test_cb (void *cls, const char *libname, void *lib_ret) +test_cb (void *cls, + const char *libname, + void *lib_ret) { - void *ret; + const char *test_cls = cls; + char *ret; - GNUNET_assert (0 == strcmp (cls, "test")); - GNUNET_assert (0 == strcmp (lib_ret, "Hello")); - ret = GNUNET_PLUGIN_unload (libname, "out"); + GNUNET_assert (0 == strcmp (test_cls, + "test-closure")); + GNUNET_assert (0 == strcmp (lib_ret, + "Hello")); + ret = GNUNET_PLUGIN_unload (libname, + "out"); GNUNET_assert (NULL != ret); - GNUNET_assert (0 == strcmp (ret, "World")); + GNUNET_assert (0 == strcmp (ret, + "World")); free (ret); } @@ -44,24 +51,35 @@ main (int argc, char *argv[]) { void *ret; - GNUNET_log_setup ("test-plugin", "WARNING", NULL); - GNUNET_log_skip (1, GNUNET_NO); - ret = GNUNET_PLUGIN_load ("libgnunet_plugin_missing", NULL); + GNUNET_log_setup ("test-plugin", + "WARNING", + NULL); + GNUNET_log_skip (1, + GNUNET_NO); + ret = GNUNET_PLUGIN_load ("libgnunet_plugin_missing", + NULL); GNUNET_log_skip (0, GNUNET_NO); - if (ret != NULL) + if (NULL != ret) return 1; - ret = GNUNET_PLUGIN_load ("libgnunet_plugin_test", "in"); - if (ret == NULL) + ret = GNUNET_PLUGIN_load ("libgnunet_plugin_utiltest", + "in"); + if (NULL == ret) return 1; - if (0 != strcmp (ret, "Hello")) + if (0 != strcmp (ret, + "Hello")) return 2; - ret = GNUNET_PLUGIN_unload ("libgnunet_plugin_test", "out"); - if (ret == NULL) + ret = GNUNET_PLUGIN_unload ("libgnunet_plugin_utiltest", + "out"); + if (NULL == ret) return 3; - if (0 != strcmp (ret, "World")) + if (0 != strcmp (ret, + "World")) return 4; free (ret); - GNUNET_PLUGIN_load_all ("libgnunet_plugin_tes", "in", &test_cb, "test"); + GNUNET_PLUGIN_load_all ("libgnunet_plugin_utiltes", + "in", + &test_cb, + "test-closure"); return 0; } diff --git a/src/util/test_plugin_plug.c b/src/util/test_plugin_plug.c index 39c8774b1..bfaad52e8 100644 --- a/src/util/test_plugin_plug.c +++ b/src/util/test_plugin_plug.c @@ -23,8 +23,9 @@ */ #include "platform.h" + void * -libgnunet_plugin_test_init (void *arg) +libgnunet_plugin_utiltest_init (void *arg) { if (0 == strcmp (arg, "in")) return "Hello"; @@ -33,7 +34,7 @@ libgnunet_plugin_test_init (void *arg) void * -libgnunet_plugin_test_done (void *arg) +libgnunet_plugin_utiltest_done (void *arg) { if (0 == strcmp (arg, "out")) return strdup ("World"); -- cgit v1.2.3 From 4748af6e8e04347ceaeec09ccdfc04d740fa65f0 Mon Sep 17 00:00:00 2001 From: t3sserakt Date: Fri, 30 Jul 2021 14:47:59 +0200 Subject: - there are two helper running, but only one is doing the work of both. Therefore connecting peers does not work atm. --- src/include/gnunet_testing_plugin.h | 3 +- src/testbed/gnunet-cmd.c | 2 +- src/testbed/gnunet-cmds-helper.c | 2 +- src/testbed/plugin_testcmd.c | 3 +- .../testbed_api_cmd_netjail_start_testbed.c | 11 ++- src/transport/Makefile.am | 5 +- src/transport/gnunet-communicator-tcp.c | 15 ++++- src/transport/plugin_cmd_simple_send.c | 23 ++++--- src/transport/transport-testing-cmds.h | 78 ++++++++++++++++++++++ src/transport/transport-testing2.h | 37 ---------- src/transport/transport_api_cmd_connecting_peers.c | 75 +++++++++++++++------ src/transport/transport_api_cmd_send_simple.c | 24 ++++--- src/transport/transport_api_cmd_start_peer.c | 34 +++++++--- 13 files changed, 220 insertions(+), 92 deletions(-) create mode 100644 src/transport/transport-testing-cmds.h (limited to 'src') diff --git a/src/include/gnunet_testing_plugin.h b/src/include/gnunet_testing_plugin.h index 8395e2a49..103eb23be 100644 --- a/src/include/gnunet_testing_plugin.h +++ b/src/include/gnunet_testing_plugin.h @@ -45,7 +45,8 @@ typedef void write_message, char *router_ip, char *node_ip, char *n, - char *m); + char *m, + char *local_m); typedef void (*GNUNET_TESTING_PLUGIN_ALL_PEERS_STARTED) (); diff --git a/src/testbed/gnunet-cmd.c b/src/testbed/gnunet-cmd.c index f232bd805..0ba94fdd9 100644 --- a/src/testbed/gnunet-cmd.c +++ b/src/testbed/gnunet-cmd.c @@ -90,7 +90,7 @@ run (void *cls) strcat (node_ip, NODE_BASE_IP); strcat (node_ip, plugin->n); - plugin->api->start_testcase (NULL, router_ip, node_ip, NULL, NULL); + plugin->api->start_testcase (NULL, router_ip, node_ip, NULL, NULL, NULL); } diff --git a/src/testbed/gnunet-cmds-helper.c b/src/testbed/gnunet-cmds-helper.c index c4a3e98d9..7cb753c23 100644 --- a/src/testbed/gnunet-cmds-helper.c +++ b/src/testbed/gnunet-cmds-helper.c @@ -428,7 +428,7 @@ tokenizer_cb (void *cls, const struct GNUNET_MessageHeader *message) strcat (node_ip, plugin->n); plugin->api->start_testcase (&write_message, router_ip, node_ip, plugin->m, - plugin->n); + plugin->n, plugin->local_m); LOG (GNUNET_ERROR_TYPE_ERROR, "We got here!\n"); diff --git a/src/testbed/plugin_testcmd.c b/src/testbed/plugin_testcmd.c index 797826781..e08ec067d 100644 --- a/src/testbed/plugin_testcmd.c +++ b/src/testbed/plugin_testcmd.c @@ -48,7 +48,8 @@ static void start_testcase (TESTBED_CMD_HELPER_write_cb write_message, char *router_ip, char *node_ip, char *n, - char *m) + char *m, + char *local_m) { struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); diff --git a/src/testbed/testbed_api_cmd_netjail_start_testbed.c b/src/testbed/testbed_api_cmd_netjail_start_testbed.c index de3926696..fa0084a0a 100644 --- a/src/testbed/testbed_api_cmd_netjail_start_testbed.c +++ b/src/testbed/testbed_api_cmd_netjail_start_testbed.c @@ -373,10 +373,17 @@ start_testbed (struct NetJailState *ns, struct tbc)); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "First using helper %d\n", - tbc->count - 1); + "First using helper %d %d\n", + tbc->count - 1, + ns->n_helper); struct GNUNET_HELPER_Handle *helper = ns->helper[tbc->count - 1]; + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "First using helper %d %d %p\n", + tbc->count - 1, + ns->n_helper, + helper); + msg = create_helper_init_msg_ (m_char, n_char, ns->plugin_name); diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am index 2d3615e6a..e19ebd8e9 100644 --- a/src/transport/Makefile.am +++ b/src/transport/Makefile.am @@ -171,6 +171,7 @@ libgnunettransporttesting2_la_SOURCES = \ transport_api_cmd_start_peer.c \ transport_api_cmd_send_simple.c \ transport-testing2.c transport-testing2.h \ + transport-testing-cmds.h \ transport-testing-filenames2.c \ transport-testing-loggers2.c \ transport-testing-main2.c \ @@ -409,8 +410,8 @@ libgnunet_plugin_cmd_simple_send_la_LIBADD = \ $(top_builddir)/src/testbed/libgnunettestbed.la \ libgnunettransporttesting2.la \ $(LTLIBINTL) -#libgnunet_plugin_cmd_simple_send_la_LDFLAGS = \ -# $(GN_PLUGIN_LDFLAGS) +libgnunet_plugin_cmd_simple_send_la_LDFLAGS = \ + $(GN_PLUGIN_LDFLAGS) if HAVE_EXPERIMENTAL plugin_LTLIBRARIES += libgnunet_plugin_transport_udp.la diff --git a/src/transport/gnunet-communicator-tcp.c b/src/transport/gnunet-communicator-tcp.c index 1b838bf9c..fde85923b 100644 --- a/src/transport/gnunet-communicator-tcp.c +++ b/src/transport/gnunet-communicator-tcp.c @@ -1900,6 +1900,9 @@ queue_read (void *cls) BUF_SIZE - queue->cread_off); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received %lu bytes from TCP queue\n", rcvd); + GNUNET_log_from_nocheck (GNUNET_ERROR_TYPE_DEBUG, + "transport", + "Received %lu bytes from TCP queue\n", rcvd); if (-1 == rcvd) { if ((EAGAIN != errno) && (EINTR != errno)) @@ -2675,6 +2678,9 @@ proto_read_kx (void *cls) sizeof(pq->ibuf) - pq->ibuf_off); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received %lu bytes for KX\n", rcvd); + GNUNET_log_from_nocheck (GNUNET_ERROR_TYPE_DEBUG, + "transport", + "Received %lu bytes for KX\n", rcvd); if (-1 == rcvd) { if ((EAGAIN != errno) && (EINTR != errno)) @@ -2824,6 +2830,10 @@ queue_read_kx (void *cls) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received %lu bytes for KX\n", rcvd); + GNUNET_log_from_nocheck (GNUNET_ERROR_TYPE_DEBUG, + "transport", + "Received %lu bytes for KX\n", + rcvd); if (-1 == rcvd) { if ((EAGAIN != errno) && (EINTR != errno)) @@ -2918,6 +2928,9 @@ mq_init (void *cls, const struct GNUNET_PeerIdentity *peer, const char *address) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting to %s\n", address); + GNUNET_log_from_nocheck (GNUNET_ERROR_TYPE_DEBUG, + "transport", + "Connecting to %s\n", address); if (0 != strncmp (address, COMMUNICATOR_ADDRESS_PREFIX "-", strlen (COMMUNICATOR_ADDRESS_PREFIX "-"))) @@ -3238,7 +3251,7 @@ init_socket (struct sockaddr *addr, return GNUNET_SYSERR; } - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "address %s\n", GNUNET_a2s (addr, in_len)); diff --git a/src/transport/plugin_cmd_simple_send.c b/src/transport/plugin_cmd_simple_send.c index 62bb7544b..e2407c8c0 100644 --- a/src/transport/plugin_cmd_simple_send.c +++ b/src/transport/plugin_cmd_simple_send.c @@ -30,6 +30,7 @@ // #include "gnunet_transport_service.h" #include "gnunet_testbed_ng_service.h" #include "transport-testing2.h" +#include "transport-testing-cmds.h" /** * Generic logging shortcut @@ -85,20 +86,25 @@ static void start_testcase (TESTBED_CMD_HELPER_write_cb write_message, char *router_ip, char *node_ip, char *m, - char *n) + char *n, + char *local_m) { char *testdir; char *cfgname; GNUNET_asprintf (&cfgname, "%s%s.conf", - "test_transport_api2_tcp_peer", + "test_transport_api2_tcp_node", n); LOG (GNUNET_ERROR_TYPE_ERROR, "cfgname: %s\n", cfgname); + LOG (GNUNET_ERROR_TYPE_ERROR, + "node ip: %s\n", + node_ip); + testdir = GNUNET_malloc (strlen (BASE_DIR) + strlen (m) + strlen (n) + 1); @@ -125,6 +131,7 @@ start_testcase (TESTBED_CMD_HELPER_write_cb write_message, char *router_ip, "system-create-1", m, n, + local_m, handlers, cfgname), GNUNET_TESTING_cmd_send_peer_ready ("send-peer-ready-1", @@ -134,12 +141,12 @@ start_testcase (TESTBED_CMD_HELPER_write_cb write_message, char *router_ip, GNUNET_TRANSPORT_cmd_connect_peers ("connect-peers-1", "start-peer-1", "this is useless"), - /*GNUNET_TESTING_cmd_send_simple ("send-simple-1", - char *m, - char *n, - uint32_t num, - const char *peer1_label, - const char *peer2_label),*/ + GNUNET_TRANSPORT_cmd_send_simple ("send-simple-1", + m, + n, + 0, + "start-peer-1", + "this is useless"), GNUNET_TESTING_cmd_local_test_finished ("local-test-finished-1", write_message) }; diff --git a/src/transport/transport-testing-cmds.h b/src/transport/transport-testing-cmds.h new file mode 100644 index 000000000..4edd334f0 --- /dev/null +++ b/src/transport/transport-testing-cmds.h @@ -0,0 +1,78 @@ +/* + This file is part of GNUnet. + Copyright (C) 2006, 2009, 2015, 2016 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet 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 + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + + SPDX-License-Identifier: AGPL3.0-or-later + */ + +/** + * @file transport-testing.h + * @brief testing lib for transport service + * @author Matthias Wachs + * @author Christian Grothoff + */ +#ifndef TRANSPORT_TESTING_CMDS_H +#define TRANSPORT_TESTING__CMDS_H +#include "gnunet_testing_lib.h" + +struct GNUNET_TESTING_Command +GNUNET_TRANSPORT_cmd_start_peer (const char *label, + const char *system_label, + char *m, + char *n, + char *local_m, + struct GNUNET_MQ_MessageHandler *handlers, + const char *cfgname); + +struct GNUNET_TESTING_Command +GNUNET_TRANSPORT_cmd_connect_peers (const char *label, + const char *peer1_label, + const char *peer2_label); + +struct GNUNET_TESTING_Command +GNUNET_TRANSPORT_cmd_send_simple (const char *label, + char *m, + char *n, + uint32_t num, + const char *peer1_label, + const char *peer2_label); + +int +GNUNET_TRANSPORT_get_trait_peer_id (const struct + GNUNET_TESTING_Command *cmd, + struct GNUNET_PeerIdentity **id); + +int +GNUNET_TRANSPORT_get_trait_connected_peers_map (const struct + GNUNET_TESTING_Command + *cmd, + struct + GNUNET_CONTAINER_MultiShortmap ** + connected_peers_map); +int +GNUNET_TRANSPORT_get_trait_hello_size (const struct + GNUNET_TESTING_Command + *cmd, + size_t **hello_size); + +int +GNUNET_TRANSPORT_get_trait_hello (const struct + GNUNET_TESTING_Command + *cmd, + char **hello); + +#endif +/* end of transport_testing.h */ diff --git a/src/transport/transport-testing2.h b/src/transport/transport-testing2.h index a6732e308..e2167ca7e 100644 --- a/src/transport/transport-testing2.h +++ b/src/transport/transport-testing2.h @@ -920,42 +920,5 @@ GNUNET_TRANSPORT_TESTING_get_test_plugin_name (const char *executable, char * GNUNET_TRANSPORT_TESTING_get_test_source_name (const char *file); -struct GNUNET_TESTING_Command -GNUNET_TRANSPORT_cmd_start_peer (const char *label, - const char *system_label, - char *m, - char *n, - struct GNUNET_MQ_MessageHandler *handlers, - const char *cfgname); - -struct GNUNET_TESTING_Command -GNUNET_TRANSPORT_cmd_connect_peers (const char *label, - const char *peer1_label, - const char *peer2_label); - -int -GNUNET_TRANSPORT_get_trait_peer_id (const struct - GNUNET_TESTING_Command *cmd, - struct GNUNET_PeerIdentity **id); - -int -GNUNET_TRANSPORT_get_trait_connected_peers_map (const struct - GNUNET_TESTING_Command - *cmd, - struct - GNUNET_CONTAINER_MultiPeerMap ** - connected_peers_map); -int -GNUNET_TRANSPORT_get_trait_hello_size (const struct - GNUNET_TESTING_Command - *cmd, - size_t **hello_size); - -int -GNUNET_TRANSPORT_get_trait_hello (const struct - GNUNET_TESTING_Command - *cmd, - char **hello); - #endif /* end of transport_testing.h */ diff --git a/src/transport/transport_api_cmd_connecting_peers.c b/src/transport/transport_api_cmd_connecting_peers.c index d9253b6d4..f4b2e935f 100644 --- a/src/transport/transport_api_cmd_connecting_peers.c +++ b/src/transport/transport_api_cmd_connecting_peers.c @@ -29,6 +29,7 @@ #include "gnunet_transport_application_service.h" #include "gnunet_hello_lib.h" #include "gnunet_transport_service.h" +#include "transport-testing-cmds.h" /** * Generic logging shortcut @@ -40,6 +41,8 @@ struct ConnectPeersState const char *peer1_label; const char *peer2_label; + + struct GNUNET_PeerIdentity *id; }; @@ -52,12 +55,13 @@ connect_peers_run (void *cls, const struct GNUNET_TESTING_Command *peer1_cmd; const struct GNUNET_TESTING_Command *peer2_cmd; struct GNUNET_TRANSPORT_ApplicationHandle *ah; - struct GNUNET_PeerIdentity *id; + struct GNUNET_PeerIdentity *peer = GNUNET_new (struct GNUNET_PeerIdentity); char *addr; struct GNUNET_TIME_Absolute t; char *hello; size_t *hello_size; enum GNUNET_NetworkType nt = 0; + char *peer_id; peer1_cmd = GNUNET_TESTING_interpreter_lookup_command (cps->peer1_label); GNUNET_TRANSPORT_get_trait_application_handle (peer1_cmd, @@ -70,6 +74,31 @@ connect_peers_run (void *cls, "hello: %s\n", hello); + /*GNUNET_TRANSPORT_get_trait_peer_id (peer1_cmd, + &id); + LOG (GNUNET_ERROR_TYPE_ERROR, + "pid %s\n", + GNUNET_i2s_full(id));*/ + + if(strstr(hello, "60002") != NULL) + { + addr = "tcp-192.168.15.2:60003"; + peer_id = "4TTC9WBSVP9RJT6DVEZ7E0TDW7TQXC11NR1EMR2F8ARS87WZ2730"; + } + else + { + addr = "tcp-192.168.15.1:60002"; + peer_id = "F2F3X9G1YNCTXKK7A4J6M4ZM4BBSKC9DEXZVHCWQ475M0C7PNWCG"; + } + + LOG (GNUNET_ERROR_TYPE_ERROR, + "get pub key\n"); + GNUNET_CRYPTO_eddsa_public_key_from_string (peer_id, + strlen (peer_id), + &peer->public_key); + + cps->id = peer; + // TODO This does not work, because the other peer is running in another local loop. We need to message between different local loops. For now we will create the hello manually with the known information about the other local peers. // --------------------------------------------- /*peer2_cmd = GNUNET_TESTING_interpreter_lookup_command (cps->peer2_label); @@ -84,14 +113,16 @@ connect_peers_run (void *cls, *hello_size, id, &nt, - &t); + &t);*/ //---------------------------------------------- + LOG (GNUNET_ERROR_TYPE_ERROR, + "application validate\n"); GNUNET_TRANSPORT_application_validate (ah, - id, + peer, nt, - addr);*/ + addr); } @@ -100,34 +131,38 @@ connect_peers_finish (void *cls, GNUNET_SCHEDULER_TaskCallback cont, void *cont_cls) { - /*struct ConnectPeersState *cps = cls; + struct ConnectPeersState *cps = cls; const struct GNUNET_TESTING_Command *peer1_cmd; - const struct GNUNET_TESTING_Command *peer2_cmd; - struct GNUNET_CONTAINER_MultiPeerMap *connected_peers_map; + struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map; unsigned int ret; - struct GNUNET_PeerIdentity *id; + struct GNUNET_ShortHashCode *key = GNUNET_new (struct GNUNET_ShortHashCode); + struct GNUNET_HashCode hc; + int node_number; peer1_cmd = GNUNET_TESTING_interpreter_lookup_command (cps->peer1_label); - GNUNET_TRANSPORT_get_trait_peer_id (peer1_cmd, - &id); - - peer2_cmd = GNUNET_TESTING_interpreter_lookup_command (cps->peer2_label); - GNUNET_TRANSPORT_get_trait_connected_peers_map (peer2_cmd, + GNUNET_TRANSPORT_get_trait_connected_peers_map (peer1_cmd, &connected_peers_map); - ret = GNUNET_CONTAINER_multipeermap_contains (connected_peers_map, - id); + node_number = 1; + GNUNET_CRYPTO_hash (&node_number, sizeof(node_number), &hc); + + // TODO we need to store with a key identifying the netns node in the future. For now we have only one connecting node. + memcpy (key, + &hc, + sizeof (*key)); + ret = GNUNET_CONTAINER_multishortmap_contains (connected_peers_map, + key); if (GNUNET_YES == ret) { cont (cont_cls); - } - - return ret;*/ - cont (cont_cls); LOG (GNUNET_ERROR_TYPE_ERROR, "connect peer finish\n"); - return GNUNET_OK; + } + + return ret; + /*cont (cont_cls); + return GNUNET_OK;*/ } diff --git a/src/transport/transport_api_cmd_send_simple.c b/src/transport/transport_api_cmd_send_simple.c index 4a60f1a12..6e7b89497 100644 --- a/src/transport/transport_api_cmd_send_simple.c +++ b/src/transport/transport_api_cmd_send_simple.c @@ -26,7 +26,8 @@ #include "platform.h" #include "gnunet_util_lib.h" #include "gnunet_testing_ng_lib.h" -#include "transport-testing.h" +#include "transport-testing2.h" +#include "transport-testing-cmds.h" struct SendSimpleState { @@ -70,21 +71,26 @@ send_simple_run (void *cls, struct GNUNET_MQ_Envelope *env; struct GNUNET_TRANSPORT_TESTING_TestMessage *test; struct GNUNET_MQ_Handle *mq; - struct GNUNET_CONTAINER_MultiPeerMap *connected_peers_map; + struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map; struct GNUNET_PeerIdentity *id; const struct GNUNET_TESTING_Command *peer1_cmd; const struct GNUNET_TESTING_Command *peer2_cmd; + struct GNUNET_ShortHashCode *key = GNUNET_new (struct GNUNET_ShortHashCode); + struct GNUNET_HashCode hc; + int node_number; peer1_cmd = GNUNET_TESTING_interpreter_lookup_command (sss->peer1_label); GNUNET_TRANSPORT_get_trait_connected_peers_map (peer1_cmd, &connected_peers_map); - peer2_cmd = GNUNET_TESTING_interpreter_lookup_command (sss->peer2_label); - GNUNET_TRANSPORT_get_trait_peer_id (peer2_cmd, - &id); - - mq = GNUNET_CONTAINER_multipeermap_get (connected_peers_map, - id); + node_number = 1; + GNUNET_CRYPTO_hash (&node_number, sizeof(node_number), &hc); + memcpy (key, + &hc, + sizeof (*key)); + + mq = GNUNET_CONTAINER_multishortmap_get (connected_peers_map, + key); env = GNUNET_MQ_msg_extra (test, 2600 - sizeof(*test), @@ -110,7 +116,7 @@ send_simple_run (void *cls, * @return command. */ struct GNUNET_TESTING_Command -GNUNET_TESTING_cmd_send_simple (const char *label, +GNUNET_TRANSPORT_cmd_send_simple (const char *label, char *m, char *n, uint32_t num, diff --git a/src/transport/transport_api_cmd_start_peer.c b/src/transport/transport_api_cmd_start_peer.c index c2cc20a2a..b2b26194a 100644 --- a/src/transport/transport_api_cmd_start_peer.c +++ b/src/transport/transport_api_cmd_start_peer.c @@ -95,6 +95,8 @@ struct StartPeerState char *n; + char *local_m; + unsigned int finished; const char *system_label; @@ -104,7 +106,7 @@ struct StartPeerState */ unsigned int no; - struct GNUNET_CONTAINER_MultiPeerMap *connected_peers_map; + struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map; struct GNUNET_TESTING_System *tl_system; @@ -190,7 +192,9 @@ notify_connect (void *cls, struct GNUNET_MQ_Handle *mq) { struct StartPeerState *sps = cls; - + struct GNUNET_ShortHashCode *key = GNUNET_new (struct GNUNET_ShortHashCode); + struct GNUNET_HashCode hc; + int node_number; void *ret; @@ -201,8 +205,16 @@ notify_connect (void *cls, sps->no, GNUNET_i2s (&sps->id)); - GNUNET_CONTAINER_multipeermap_put (sps->connected_peers_map, - peer, + // TODO we need to store with a key identifying the netns node in the future. For now we have only one connecting node. + node_number = 1; + GNUNET_CRYPTO_hash (&node_number, sizeof(node_number), &hc); + + + memcpy (key, + &hc, + sizeof (*key)); + GNUNET_CONTAINER_multishortmap_put (sps->connected_peers_map, + key, mq, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); @@ -428,7 +440,7 @@ start_peer_traits (void *cls, struct StartPeerState *sps = cls; struct GNUNET_TRANSPORT_ApplicationHandle *ah = sps->ah; struct GNUNET_PeerIdentity *id = &sps->id; - struct GNUNET_CONTAINER_MultiPeerMap *connected_peers_map = + struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map = sps->connected_peers_map; char *hello = sps->hello; size_t hello_size = sps->hello_size; @@ -498,7 +510,7 @@ GNUNET_TRANSPORT_get_trait_connected_peers_map (const struct GNUNET_TESTING_Command *cmd, struct - GNUNET_CONTAINER_MultiPeerMap ** + GNUNET_CONTAINER_MultiShortmap ** connected_peers_map) { return cmd->traits (cmd->cls, @@ -545,20 +557,24 @@ GNUNET_TRANSPORT_cmd_start_peer (const char *label, const char *system_label, char *m, char *n, + char *local_m, struct GNUNET_MQ_MessageHandler *handlers, const char *cfgname) { struct StartPeerState *sps; - struct GNUNET_CONTAINER_MultiPeerMap *connected_peers_map = - GNUNET_CONTAINER_multipeermap_create (1,GNUNET_NO); + struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map = + GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO); unsigned int i; LOG (GNUNET_ERROR_TYPE_ERROR, - "start peer 0.1\n"); + "start peer 0.1 with cfg: %s\n", + cfgname); sps = GNUNET_new (struct StartPeerState); sps->m = m; sps->n = n; + sps->local_m = local_m; + sps->no = (atoi (n) - 1) * atoi (sps->local_m) + atoi (m); sps->system_label = system_label; sps->connected_peers_map = connected_peers_map; sps->cfgname = cfgname; -- cgit v1.2.3 From e8eb1ecc006ffd3d7aa99fc9d3e8d19eedd9d343 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 30 Jul 2021 14:17:30 +0200 Subject: -improve logging if there is no HTTP response --- src/curl/curl.c | 21 ++++++++++++++++++--- src/include/gnunet_curl_lib.h | 2 +- 2 files changed, 19 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/curl/curl.c b/src/curl/curl.c index b6aef4f61..79aac74ce 100644 --- a/src/curl/curl.c +++ b/src/curl/curl.c @@ -784,6 +784,20 @@ GNUNET_CURL_download_get_result_ (struct GNUNET_CURL_DownloadBuffer *db, (const char *) db->buf); return NULL; } + if (0 == *response_code) + { + char *url; + + if (CURLE_OK != + curl_easy_getinfo (eh, + CURLINFO_EFFECTIVE_URL, + &url)) + url = ""; + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Failed to download response from `%s': \n", + url); + return NULL; + } if (MHD_HTTP_NO_CONTENT == *response_code) return NULL; json = NULL; @@ -825,8 +839,9 @@ GNUNET_CURL_download_get_result_ (struct GNUNET_CURL_DownloadBuffer *db, * @param header header string; will be given to the context AS IS. * @return #GNUNET_OK if no errors occurred, #GNUNET_SYSERR otherwise. */ -int -GNUNET_CURL_append_header (struct GNUNET_CURL_Context *ctx, const char *header) +enum GNUNET_GenericReturnValue +GNUNET_CURL_append_header (struct GNUNET_CURL_Context *ctx, + const char *header) { ctx->common_headers = curl_slist_append (ctx->common_headers, header); if (NULL == ctx->common_headers) @@ -892,7 +907,7 @@ do_benchmark (CURLMsg *cmsg) curl -w "foo%{size_request} -XPOST --data "ABC" $URL the CURLINFO_REQUEST_SIZE should be the whole size of the request including headers and body. - */// + */ GNUNET_break (size_curl <= size_long); urd = get_url_benchmark_data (url, (unsigned int) response_code); diff --git a/src/include/gnunet_curl_lib.h b/src/include/gnunet_curl_lib.h index f51e4b503..38acecc48 100644 --- a/src/include/gnunet_curl_lib.h +++ b/src/include/gnunet_curl_lib.h @@ -150,7 +150,7 @@ GNUNET_CURL_get_select_info (struct GNUNET_CURL_Context *ctx, * @param header header string; will be given to the context AS IS. * @return #GNUNET_OK if no errors occurred, #GNUNET_SYSERR otherwise. */ -int +enum GNUNET_GenericReturnValue GNUNET_CURL_append_header (struct GNUNET_CURL_Context *ctx, const char *header); -- cgit v1.2.3 From ebc70e1bccd6c2f784df8630f1105a91bc7bfeed Mon Sep 17 00:00:00 2001 From: Elias Summermatter Date: Fri, 2 Apr 2021 15:46:25 +0200 Subject: SETU: Implement LSD0003 --- src/include/gnunet_protocols.h | 7 + src/include/gnunet_setu_service.h | 26 +- src/set/ibf.c | 2 +- src/set/ibf.h | 1 + src/setu/Makefile.am | 11 +- src/setu/gnunet-service-setu.c | 2081 ++++++++++++++++++++--- src/setu/gnunet-service-setu_protocol.h | 77 +- src/setu/gnunet-service-setu_strata_estimator.c | 362 +++- src/setu/gnunet-service-setu_strata_estimator.h | 54 +- src/setu/ibf.c | 294 +++- src/setu/ibf.h | 65 +- src/setu/perf_setu_api.c | 571 ++++--- src/setu/setu.h | 49 + src/setu/setu_api.c | 40 + src/setu/test_setu_api.c | 60 +- 15 files changed, 2921 insertions(+), 779 deletions(-) (limited to 'src') diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h index 715e94c6a..6b61dfc72 100644 --- a/src/include/gnunet_protocols.h +++ b/src/include/gnunet_protocols.h @@ -1784,6 +1784,13 @@ extern "C" { */ #define GNUNET_MESSAGE_TYPE_SETU_P2P_OVER 572 +/** + * Signals other peer that all elements are sent. + */ + +#define GNUNET_MESSAGE_TYPE_SETU_P2P_SEND_FULL 710 + + /******************************************************************************* * SETI message types diff --git a/src/include/gnunet_setu_service.h b/src/include/gnunet_setu_service.h index bacec9408..1d7e48402 100644 --- a/src/include/gnunet_setu_service.h +++ b/src/include/gnunet_setu_service.h @@ -163,7 +163,31 @@ enum GNUNET_SETU_OptionType /** * Notify client also if we are sending a value to the other peer. */ - GNUNET_SETU_OPTION_SYMMETRIC = 8 + GNUNET_SETU_OPTION_SYMMETRIC = 8, + + /** + * Byzantine upper bound. Is the maximal plausible number of elements + * a peer can have default max uint64 + */ + GNUNET_SETU_OPTION_CUSTOM_BYZANTINE_UPPER_BOUND = 16, + + /** + * Bandwidth latency tradeoff determines how much bytes a single RTT is + * worth, which is a performance setting + */ + GNUNET_SETU_OPTION_CUSTOM_BANDWIDTH_LATENCY_TRADEOFF= 32, + + /** + * The factor determines the number of buckets an IBF has which is + * multiplied by the estimated setsize default: 2 + */ + GNUNET_SETU_OPTION_CUSTOM_IBF_BUCKET_NUMBER_FACTOR= 64, + + /** + * This setting determines to how many IBF buckets an single elements + * is mapped to. + */ + GNUNET_SETU_OPTION_CUSTOM_IBF_BUCKETS_PER_ELEMENT= 128 }; diff --git a/src/set/ibf.c b/src/set/ibf.c index 1532afceb..0f7eb6a9f 100644 --- a/src/set/ibf.c +++ b/src/set/ibf.c @@ -294,7 +294,7 @@ ibf_write_slice (const struct InvertibleBloomFilter *ibf, uint32_t start, struct IBF_KeyHash *key_hash_dst; struct IBF_Count *count_dst; - GNUNET_assert (start + count <= ibf->size); + GNUNET_assert (start + count <= ibf->size); /* copy keys */ key_dst = (struct IBF_Key *) buf; diff --git a/src/set/ibf.h b/src/set/ibf.h index 7c2ab33b1..334a797ef 100644 --- a/src/set/ibf.h +++ b/src/set/ibf.h @@ -245,6 +245,7 @@ void ibf_destroy (struct InvertibleBloomFilter *ibf); + #if 0 /* keep Emacsens' auto-indent happy */ { #endif diff --git a/src/setu/Makefile.am b/src/setu/Makefile.am index 77d048add..6e2865d8c 100644 --- a/src/setu/Makefile.am +++ b/src/setu/Makefile.am @@ -7,6 +7,8 @@ libexecdir= $(pkglibdir)/libexec/ plugindir = $(libdir)/gnunet +PTHREAD = -lpthread + pkgcfg_DATA = \ setu.conf @@ -63,7 +65,8 @@ libgnunetsetu_la_SOURCES = \ setu_api.c setu.h libgnunetsetu_la_LIBADD = \ $(top_builddir)/src/util/libgnunetutil.la \ - $(LTLIBINTL) + $(LTLIBINTL) \ + $(PTHREAD) libgnunetsetu_la_LDFLAGS = \ $(GN_LIB_LDFLAGS) @@ -91,7 +94,8 @@ perf_setu_api_SOURCES = \ perf_setu_api_LDADD = \ $(top_builddir)/src/util/libgnunetutil.la \ $(top_builddir)/src/testing/libgnunettesting.la \ - libgnunetsetu.la + libgnunetsetu.la \ + $(PTHREAD) plugin_LTLIBRARIES = \ @@ -103,7 +107,8 @@ libgnunet_plugin_block_setu_test_la_LIBADD = \ $(top_builddir)/src/block/libgnunetblock.la \ $(top_builddir)/src/block/libgnunetblockgroup.la \ $(top_builddir)/src/util/libgnunetutil.la \ - $(LTLIBINTL) + $(LTLIBINTL) \ + $(PTHREAD) libgnunet_plugin_block_setu_test_la_LDFLAGS = \ $(GN_PLUGIN_LDFLAGS) diff --git a/src/setu/gnunet-service-setu.c b/src/setu/gnunet-service-setu.c index bd1113f15..a51e92b71 100644 --- a/src/setu/gnunet-service-setu.c +++ b/src/setu/gnunet-service-setu.c @@ -22,6 +22,7 @@ * @brief set union operation * @author Florian Dold * @author Christian Grothoff + * @author Elias Summermatter */ #include "platform.h" #include "gnunet_util_lib.h" @@ -50,33 +51,61 @@ */ #define SE_STRATA_COUNT 32 + /** - * Size of the IBFs in the strata estimator. + * Primes for all 4 different strata estimators 61,67,71,73,79,83,89,97 348 + * Based on the bsc thesis of Elias Summermatter (2021) */ -#define SE_IBF_SIZE 80 +#define SE_IBFS_TOTAL_SIZE 632 /** * The hash num parameter for the difference digests and strata estimators. */ -#define SE_IBF_HASH_NUM 4 +#define SE_IBF_HASH_NUM 3 /** * Number of buckets that can be transmitted in one message. */ -#define MAX_BUCKETS_PER_MESSAGE ((1 << 15) / IBF_BUCKET_SIZE) +#define MAX_BUCKETS_PER_MESSAGE ((1 << 16) / IBF_BUCKET_SIZE) /** - * The maximum size of an ibf we use is 2^(MAX_IBF_ORDER). + * The maximum size of an ibf we use is MAX_IBF_SIZE=2^20. * Choose this value so that computing the IBF is still cheaper * than transmitting all values. */ -#define MAX_IBF_ORDER (20) +#define MAX_IBF_SIZE 1048576 + + +/** + * Minimal size of an ibf + * Based on the bsc thesis of Elias Summermatter (2021) + */ +#define IBF_MIN_SIZE 37 + +/** + * AVG RTT for differential sync when k=2 and Factor = 2 + * Based on the bsc thesis of Elias Summermatter (2021) + */ +#define DIFFERENTIAL_RTT_MEAN 3.65145 + +/** + * Security level used for byzantine checks (2^80) + */ + +#define SECURITY_LEVEL 80 + +/** + * Is the estimated probabily for a new round this values + * is based on the bsc thesis of Elias Summermatter (2021) + */ + +#define PROBABILITY_FOR_NEW_ROUND 0.15 /** - * Number of buckets used in the ibf per estimated - * difference. + * Measure the performance in a csv */ -#define IBF_ALPHA 4 + +#define MEASURE_PERFORMANCE 0 /** @@ -146,6 +175,28 @@ enum UnionOperationPhase PHASE_FULL_RECEIVING }; +/** + * Different modes of operations + */ + +enum MODE_OF_OPERATION +{ + /** + * Mode just synchronizes the difference between sets + */ + DIFFERENTIAL_SYNC, + + /** + * Mode send full set sending local set first + */ + FULL_SYNC_LOCAL_SENDING_FIRST, + + /** + * Mode request full set from remote peer + */ + FULL_SYNC_REMOTE_SENDING_FIRST +}; + /** * Information about an element element in the set. All elements are @@ -277,7 +328,7 @@ struct Operation * Copy of the set's strata estimator at the time of * creation of this operation. */ - struct StrataEstimator *se; + struct MultiStrataEstimator *se; /** * The IBF we currently receive. @@ -320,7 +371,7 @@ struct Operation /** * Number of ibf buckets already received into the @a remote_ibf. */ - unsigned int ibf_buckets_received; + uint64_t ibf_buckets_received; /** * Salt that we're using for sending IBFs @@ -386,7 +437,7 @@ struct Operation * Lower bound for the set size, used only when * byzantine mode is enabled. */ - int byzantine_lower_bound; + uint64_t byzantine_lower_bound; /** * Unique request id for the request from a remote peer, sent to the @@ -401,21 +452,83 @@ struct Operation */ unsigned int generation_created; + + /** + * User defined Bandwidth Round Trips Tradeoff + */ + uint64_t rtt_bandwidth_tradeoff; + + + /** + * Number of Element per bucket in IBF + */ + uint8_t ibf_number_buckets_per_element; + + /** - * User defined Bandwidth Round Trips Tradeoff + * Set difference is multiplied with this factor + * to gennerate large enought IBF */ - double rtt_bandwidth_tradeoff; + uint8_t ibf_bucket_number_factor; /** - * Number of Element per bucket in IBF + * Defines which site a client is + * 0 = Initiating peer + * 1 = Receiving peer */ - unsigned int ibf_number_buckets_per_element; + uint8_t peer_site; + /** - * Number of buckets in IBF + * Local peer element count */ - unsigned ibf_bucket_number; + uint64_t local_element_count; + /** + * Mode of operation that was chosen by the algorithm + */ + uint8_t mode_of_operation; + + /** + * Hashmap to keep track of the send/received messages + */ + struct GNUNET_CONTAINER_MultiHashMap *message_control_flow; + + /** + * Hashmap to keep track of the send/received inquiries (ibf keys) + */ + struct GNUNET_CONTAINER_MultiHashMap *inquiries_sent; + + + /** + * Total size of local set + */ + uint64_t total_elements_size_local; + + /** + * Limit of number of elements in set + */ + uint64_t byzantine_upper_bound; + + /** + * is the count of already passed differential sync iterations + */ + uint8_t differential_sync_iterations; + + /** + * Estimated or committed set difference at the start + */ + uint64_t remote_set_diff; + + /** + * Estimated or committed set difference at the start + */ + uint64_t local_set_diff; + + /** + * Boolean to enforce an active passive switch + */ + bool active_passive_switch_required; }; @@ -430,6 +543,16 @@ struct SetContent */ struct GNUNET_CONTAINER_MultiHashMap *elements; + /** + * Maps `struct GNUNET_HashCode *` to `struct ElementEntry *` randomized. + */ + struct GNUNET_CONTAINER_MultiHashMap *elements_randomized; + + /** + * Salt to construct the randomized element map + */ + uint64_t elements_randomized_salt; + /** * Number of references to the content. */ @@ -478,7 +601,7 @@ struct Set * The strata estimator is only generated once for each set. The IBF keys * are derived from the element hashes with salt=0. */ - struct StrataEstimator *se; + struct MultiStrataEstimator *se; /** * Evaluate operations are held in a linked list. @@ -635,96 +758,679 @@ static int in_shutdown; */ static uint32_t suggest_id; +#if MEASURE_PERFORMANCE +/** + * Handles configuration file for setu performance test + * + */ +static const struct GNUNET_CONFIGURATION_Handle *setu_cfg; + + +/** + * Stores the performance data for induvidual message + */ + + +struct perf_num_send_received_msg +{ + uint64_t sent; + uint64_t sent_var_bytes; + uint64_t received; + uint64_t received_var_bytes; +}; + +/** + * Main struct to messure perfomance (data/rtts) + */ +struct per_store_struct +{ + struct perf_num_send_received_msg operation_request; + struct perf_num_send_received_msg se; + struct perf_num_send_received_msg request_full; + struct perf_num_send_received_msg element_full; + struct perf_num_send_received_msg full_done; + struct perf_num_send_received_msg ibf; + struct perf_num_send_received_msg inquery; + struct perf_num_send_received_msg element; + struct perf_num_send_received_msg demand; + struct perf_num_send_received_msg offer; + struct perf_num_send_received_msg done; + struct perf_num_send_received_msg over; + uint64_t se_diff; + uint64_t se_diff_remote; + uint64_t se_diff_local; + uint64_t active_passive_switches; + uint8_t mode_of_operation; +}; + +struct per_store_struct perf_store; +#endif /** - * Added Roundtripscounter + * Different states to control the messages flow in differential mode */ +enum MESSAGE_CONTROL_FLOW_STATE +{ + /** + * Initial message state + */ + MSG_CFS_UNINITIALIZED, + + /** + * Track that a message has been sent + */ + MSG_CFS_SENT, + + /** + * Track that receiving this message is expected + */ + MSG_CFS_EXPECTED, -struct perf_num_send_resived_msg { - int sent; - int sent_var_bytes; - int received; - int received_var_bytes; + /** + * Track that message has been recieved + */ + MSG_CFS_RECEIVED, }; +/** + * Message types to track in message control flow + */ -struct perf_rtt_struct -{ - struct perf_num_send_resived_msg operation_request; - struct perf_num_send_resived_msg se; - struct perf_num_send_resived_msg request_full; - struct perf_num_send_resived_msg element_full; - struct perf_num_send_resived_msg full_done; - struct perf_num_send_resived_msg ibf; - struct perf_num_send_resived_msg inquery; - struct perf_num_send_resived_msg element; - struct perf_num_send_resived_msg demand; - struct perf_num_send_resived_msg offer; - struct perf_num_send_resived_msg done; - struct perf_num_send_resived_msg over; +enum MESSAGE_TYPE +{ + /** + * Offer message type + */ + OFFER_MESSAGE, + /** + * Demand message type + */ + DEMAND_MESSAGE, + /** + * Elemente message type + */ + ELEMENT_MESSAGE, +}; + +/** + * Struct to tracked messages in message controll flow + */ + +struct messageControlFlowElement +{ + /** + * Track the message control state of the offer message + */ + enum MESSAGE_CONTROL_FLOW_STATE offer; + /** + * Track the message control state of the demand message + */ + enum MESSAGE_CONTROL_FLOW_STATE demand; + /** + * Track the message control state of the element message + */ + enum MESSAGE_CONTROL_FLOW_STATE element; }; -struct perf_rtt_struct perf_rtt; +#if MEASURE_PERFORMANCE +/** + * Loads different configuration to do perform perfomance tests + * @param op + */ +static void +load_config (struct Operation *op) +{ + + setu_cfg = GNUNET_CONFIGURATION_create (); + GNUNET_CONFIGURATION_load (setu_cfg,"perf_setu.conf"); + + + long long number; + float fl; + GNUNET_CONFIGURATION_get_value_float (setu_cfg,"IBF", "BUCKET_NUMBER_FACTOR", + &fl); + op->ibf_bucket_number_factor = fl; + + GNUNET_CONFIGURATION_get_value_number (setu_cfg,"IBF", "NUMBER_PER_BUCKET", + &number); + op->ibf_number_buckets_per_element = number; + GNUNET_CONFIGURATION_get_value_number (setu_cfg,"PERFORMANCE", "TRADEOFF", + &number); + op->rtt_bandwidth_tradeoff = number; + + + GNUNET_CONFIGURATION_get_value_number (setu_cfg,"BOUNDARIES", "UPPER_ELEMENT", + &number); + op->byzantine_upper_bound = number; + + + op->peer_site = 0; +} + + +/** + * Function to calculate total bytes used for performance messurement + * @param size + * @param perf_num_send_received_msg + * @return bytes used + */ static int -sum_sent_received_bytes(int size, struct perf_num_send_resived_msg perf_rtt_struct) { - return (size * perf_rtt_struct.sent) + - (size * perf_rtt_struct.received) + - perf_rtt_struct.sent_var_bytes + - perf_rtt_struct.received_var_bytes; +sum_sent_received_bytes (uint64_t size, struct perf_num_send_received_msg + perf_num_send_received_msg) +{ + return (size * perf_num_send_received_msg.sent) + + (size * perf_num_send_received_msg.received) + + perf_num_send_received_msg.sent_var_bytes + + perf_num_send_received_msg.received_var_bytes; } -static float -calculate_perf_rtt() { - /** - * Calculate RTT of init phase normally always 1 - */ - float rtt = 1; - int bytes_transmitted = 0; - /** - * Calculate RGNUNET_SETU_AcceptMessageRT of Fullsync normally 1 or 1.5 depending - */ - if (( perf_rtt.element_full.received != 0 ) || - ( perf_rtt.element_full.sent != 0) - ) rtt += 1; +/** + * Function that calculates the perfmance values and writes them down + */ +static void +calculate_perf_store () +{ - if (( perf_rtt.request_full.received != 0 ) || - ( perf_rtt.request_full.sent != 0) - ) rtt += 0.5; + /** + * Calculate RTT of init phase normally always 1 + */ + float rtt = 1; + int bytes_transmitted = 0; - /** - * In case of a differential sync 3 rtt's are needed. - * for every active/passive switch additional 3.5 rtt's are used - */ + /** + * Calculate RGNUNET_SETU_AcceptMessageRT of Fullsync normaly 1 or 1.5 depending + */ + if ((perf_store.element_full.received != 0) || + (perf_store.element_full.sent != 0) + ) + rtt += 1; + + if ((perf_store.request_full.received != 0) || + (perf_store.request_full.sent != 0) + ) + rtt += 0.5; + + /** + * In case of a differential sync 3 rtt's are needed. + * for every active/passive switch additional 3.5 rtt's are used + */ + if ((perf_store.element.received != 0) || + (perf_store.element.sent != 0)) + { + int iterations = perf_store.active_passive_switches; + + if (iterations > 0) + rtt += iterations * 0.5; + rtt += 2.5; + } + + + /** + * Calculate data sended size + */ + bytes_transmitted += sum_sent_received_bytes (sizeof(struct + GNUNET_SETU_ResultMessage), + perf_store.request_full); + + bytes_transmitted += sum_sent_received_bytes (sizeof(struct + GNUNET_SETU_ElementMessage), + perf_store.element_full); + bytes_transmitted += sum_sent_received_bytes (sizeof(struct + GNUNET_SETU_ElementMessage), + perf_store.element); + // bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_OPERATION_REQUEST), perf_store.operation_request); + bytes_transmitted += sum_sent_received_bytes (sizeof(struct + StrataEstimatorMessage), + perf_store.se); + bytes_transmitted += sum_sent_received_bytes (4, perf_store.full_done); + bytes_transmitted += sum_sent_received_bytes (sizeof(struct IBFMessage), + perf_store.ibf); + bytes_transmitted += sum_sent_received_bytes (sizeof(struct InquiryMessage), + perf_store.inquery); + bytes_transmitted += sum_sent_received_bytes (sizeof(struct + GNUNET_MessageHeader), + perf_store.demand); + bytes_transmitted += sum_sent_received_bytes (sizeof(struct + GNUNET_MessageHeader), + perf_store.offer); + bytes_transmitted += sum_sent_received_bytes (4, perf_store.done); + + /** + * Write IBF failure rate for different BUCKET_NUMBER_FACTOR + */ + float factor; + GNUNET_CONFIGURATION_get_value_float (setu_cfg,"IBF", "BUCKET_NUMBER_FACTOR", + &factor); + long long num_per_bucket; + GNUNET_CONFIGURATION_get_value_number (setu_cfg,"IBF", "NUMBER_PER_BUCKET", + &num_per_bucket); + + + int decoded = 0; + if (perf_store.active_passive_switches == 0) + decoded = 1; + int ibf_bytes_transmitted = sum_sent_received_bytes (sizeof(struct + IBFMessage), + perf_store.ibf); + + FILE *out1 = fopen ("perf_data.csv", "a"); + fprintf (out1, "%d,%f,%d,%d,%f,%d,%d,%d,%d,%d\n",num_per_bucket,factor, + decoded,ibf_bytes_transmitted,rtt,perf_store.se_diff, + bytes_transmitted, + perf_store.se_diff_local,perf_store.se_diff_remote, + perf_store.mode_of_operation); + fclose (out1); + +} + + +#endif +/** + * Function that chooses the optimal mode of operation depending on + * operation parameters. + * @param avg_element_size + * @param local_set_size + * @param remote_set_size + * @param est_set_diff_remote + * @param est_set_diff_local + * @param bandwith_latency_tradeoff + * @param ibf_bucket_number_factor + * @return calcuated mode of operation + */ +static uint8_t +estimate_best_mode_of_operation (uint64_t avg_element_size, + uint64_t local_set_size, + uint64_t remote_set_size, + uint64_t est_set_diff_remote, + uint64_t est_set_diff_local, + uint64_t bandwith_latency_tradeoff, + uint64_t ibf_bucket_number_factor) +{ + + /* + * In case of initial sync fall to predefined states + */ + + if (0 == local_set_size) + return FULL_SYNC_REMOTE_SENDING_FIRST; + if (0 == remote_set_size) + return FULL_SYNC_LOCAL_SENDING_FIRST; + + /* + * Calculate bytes for full Sync + */ + + uint8_t sizeof_full_done_header = 4; + uint8_t sizeof_done_header = 4; + uint8_t rtt_min_full = 2; + uint8_t sizeof_request_full = 4; + uint64_t estimated_total_diff = (est_set_diff_remote + est_set_diff_local); + + /* Estimate byte required if we send first */ + uint64_t total_elements_to_send_local_send_first = est_set_diff_remote + + local_set_size; + + uint64_t total_bytes_full_local_send_first = (avg_element_size + * + total_elements_to_send_local_send_first) \ + + ( + total_elements_to_send_local_send_first * sizeof(struct + GNUNET_SETU_ElementMessage)) \ + + (sizeof_full_done_header * 2) \ + + rtt_min_full + * bandwith_latency_tradeoff; + + /* Estimate bytes required if we request from remote peer */ + uint64_t total_elements_to_send_remote_send_first = est_set_diff_local + + remote_set_size; + + uint64_t total_bytes_full_remote_send_first = (avg_element_size + * + total_elements_to_send_remote_send_first) \ + + ( + total_elements_to_send_remote_send_first * sizeof(struct + GNUNET_SETU_ElementMessage)) \ + + (sizeof_full_done_header * 2) \ + + (rtt_min_full + 0.5) + * bandwith_latency_tradeoff \ + + sizeof_request_full; + + /* + * Calculate bytes for differential Sync + */ + + /* Estimate bytes required by IBF transmission*/ + + long double ibf_bucket_count = estimated_total_diff + * ibf_bucket_number_factor; + + if (ibf_bucket_count <= IBF_MIN_SIZE) + { + ibf_bucket_count = IBF_MIN_SIZE; + } + uint64_t ibf_message_count = ceil ( ((float) ibf_bucket_count) + / MAX_BUCKETS_PER_MESSAGE); + + uint64_t estimated_counter_size = ceil ( + MIN (2 * log2l ((float) local_set_size / ibf_bucket_count), log2l ( + local_set_size))); + + long double counter_bytes = (float) estimated_counter_size / 8; + + uint64_t ibf_bytes = ceil ((sizeof(struct IBFMessage) * ibf_message_count) + * 1.2 \ + + (ibf_bucket_count * sizeof(struct IBF_Key)) * 1.2 \ + + (ibf_bucket_count * sizeof(struct IBF_KeyHash)) + * 1.2 \ + + (ibf_bucket_count * counter_bytes) * 1.2); + + /* Estimate full byte count for differential sync */ + uint64_t element_size = (avg_element_size + sizeof(struct + GNUNET_SETU_ElementMessage)) \ + * estimated_total_diff; + uint64_t done_size = sizeof_done_header; + uint64_t inquery_size = (sizeof(struct IBF_Key) + sizeof(struct + InquiryMessage)) + * estimated_total_diff; + uint64_t demand_size = + (sizeof(struct GNUNET_HashCode) + sizeof(struct GNUNET_MessageHeader)) + * estimated_total_diff; + uint64_t offer_size = (sizeof(struct GNUNET_HashCode) + sizeof(struct + GNUNET_MessageHeader)) + * estimated_total_diff; + + uint64_t total_bytes_diff = (element_size + done_size + inquery_size + + demand_size + offer_size + ibf_bytes) \ + + (DIFFERENTIAL_RTT_MEAN + * bandwith_latency_tradeoff); + + uint64_t full_min = MIN (total_bytes_full_local_send_first, + total_bytes_full_remote_send_first); + + /* Decide between full and differential sync */ + + if (full_min < total_bytes_diff) + { + /* Decide between sending all element first or receiving all elements */ + if (total_bytes_full_remote_send_first > total_bytes_full_local_send_first) + { + return FULL_SYNC_LOCAL_SENDING_FIRST; + } + else + { + return FULL_SYNC_REMOTE_SENDING_FIRST; + } + } + else + { + return DIFFERENTIAL_SYNC; + } +} + + +/** + * Validates the if a message is received in a correct phase + * @param allowed_phases + * @param size_phases + * @param op + * @return GNUNET_YES if message permitted in phase and GNUNET_NO if not permitted in given + * phase + */ +static int +check_valid_phase (const uint8_t allowed_phases[], size_t size_phases, struct + Operation *op) +{ + /** + * Iterate over allowed phases + */ + for (uint32_t phase_ctr = 0; phase_ctr < size_phases; phase_ctr++) + { + uint8_t phase = allowed_phases[phase_ctr]; + if (phase == op->phase) + { + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Message received in valid phase\n"); + return GNUNET_YES; + } + } + LOG (GNUNET_ERROR_TYPE_ERROR, + "Received message in invalid phase: %u\n", op->phase); + return GNUNET_NO; +} + + +/** + * Function to update, track and validate message received in differential + * sync. This function tracks states of messages and check it against different + * constraints as described in Summermatter's BSc Thesis (2021) + * @param hash_map: Hashmap to store message control flow + * @param new_mcfs: The new message control flow state an given message type should be set to + * @param hash_code: Hash code of the element + * @param mt: The message type for which the message control flow state should be set + * @return GNUNET_YES message is valid in message control flow GNUNET_NO when message is not valid + * at this point in message flow + */ +static int +update_message_control_flow (struct GNUNET_CONTAINER_MultiHashMap *hash_map, + enum MESSAGE_CONTROL_FLOW_STATE new_mcfs, + const struct GNUNET_HashCode *hash_code, + enum MESSAGE_TYPE mt) +{ + struct messageControlFlowElement *cfe = NULL; + enum MESSAGE_CONTROL_FLOW_STATE *mcfs; + + /** + * Check logic for forbidden messages + */ + + cfe = GNUNET_CONTAINER_multihashmap_get (hash_map, hash_code); + if ((ELEMENT_MESSAGE == mt) && (cfe != NULL)) + { + if ((new_mcfs != MSG_CFS_SENT) && (MSG_CFS_RECEIVED != cfe->offer)) + { + LOG (GNUNET_ERROR_TYPE_ERROR, + "Received an element without sent offer!\n"); + return GNUNET_NO; + } + /* Check that only requested elements are received! */ + if ((ELEMENT_MESSAGE == mt) && (new_mcfs != MSG_CFS_SENT) && (cfe->demand != + MSG_CFS_SENT)) + { + LOG (GNUNET_ERROR_TYPE_ERROR, + "Received an element that was not demanded\n"); + return GNUNET_NO; + } + } + + /** + * In case the element hash is not in the hashmap create a new entry + */ + + if (NULL == cfe) + { + cfe = GNUNET_new (struct messageControlFlowElement); + if (GNUNET_SYSERR == GNUNET_CONTAINER_multihashmap_put (hash_map, hash_code, + cfe, + GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)) + { + GNUNET_free (cfe); + return GNUNET_SYSERR; + } + } + + /** + * Set state of message + */ + + if (OFFER_MESSAGE == mt) + { + mcfs = &cfe->offer; + } + else if (DEMAND_MESSAGE == mt) + { + mcfs = &cfe->demand; + } + else if (ELEMENT_MESSAGE == mt) + { + mcfs = &cfe->element; + } + else + { + return GNUNET_SYSERR; + } + + /** + * Check if state is allowed + */ - int iterations = perf_rtt.ibf.received; - if(iterations > 1) - rtt += (iterations - 1 ) * 0.5; - rtt += 3 * iterations; + if (new_mcfs <= *mcfs) + { + return GNUNET_NO; + } + + *mcfs = new_mcfs; + return GNUNET_YES; +} + + +/** + * Validate if a message in differential sync si already received before. + * @param hash_map + * @param hash_code + * @param mt + * @return GNUNET_YES when message is already in store if message is not in store return GNUNET_NO + */ +static int +is_message_in_message_control_flow (struct + GNUNET_CONTAINER_MultiHashMap *hash_map, + struct GNUNET_HashCode *hash_code, + enum MESSAGE_TYPE mt) +{ + struct messageControlFlowElement *cfe = NULL; + enum MESSAGE_CONTROL_FLOW_STATE *mcfs; + + cfe = GNUNET_CONTAINER_multihashmap_get (hash_map, hash_code); + + /** + * Set state of message + */ + + if (cfe != NULL) + { + if (OFFER_MESSAGE == mt) + { + mcfs = &cfe->offer; + } + else if (DEMAND_MESSAGE == mt) + { + mcfs = &cfe->demand; + } + else if (ELEMENT_MESSAGE == mt) + { + mcfs = &cfe->element; + } + else + { + return GNUNET_SYSERR; + } /** - * Calculate data sended size + * Evaluate if set is in message */ - bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_REQUEST_FULL), perf_rtt.request_full); - bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_ELEMENT), perf_rtt.element_full); - bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_ELEMENTS), perf_rtt.element); - bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_OPERATION_REQUEST), perf_rtt.operation_request); - bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_SE), perf_rtt.se); - bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_DONE), perf_rtt.full_done); - bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_IBF), perf_rtt.ibf); - bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_INQUIRY), perf_rtt.inquery); - bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_DEMAND), perf_rtt.demand); - bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_OFFER), perf_rtt.offer); - bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_DONE), perf_rtt.done); + if (*mcfs != MSG_CFS_UNINITIALIZED) + { + return GNUNET_YES; + } + } + return GNUNET_NO; +} - LOG(GNUNET_ERROR_TYPE_ERROR,"Bytes Transmitted: %d\n", bytes_transmitted); - LOG(GNUNET_ERROR_TYPE_ERROR,"Reached tradeoff bandwidth/rtt: %f\n", (bytes_transmitted / rtt )); +/** + * Iterator for determining if all demands have been + * satisfied + * + * @param cls the union operation `struct Operation *` + * @param key unused + * @param value the `struct ElementEntry *` to insert + * into the key-to-element mapping + * @return #GNUNET_YES (to continue iterating) + */ +static int +determinate_done_message_iterator (void *cls, + const struct GNUNET_HashCode *key, + void *value) +{ + struct messageControlFlowElement *mcfe = value; + + if (((mcfe->element == MSG_CFS_SENT) || (mcfe->element == MSG_CFS_RECEIVED) )) + { + return GNUNET_YES; + } + return GNUNET_NO; +} + + +/** + * Iterator for determining average size + * + * @param cls the union operation `struct Operation *` + * @param key unused + * @param value the `struct ElementEntry *` to insert + * into the key-to-element mapping + * @return #GNUNET_YES (to continue iterating) + */ +static int +determinate_avg_element_size_iterator (void *cls, + const struct GNUNET_HashCode *key, + void *value) +{ + struct Operation *op = cls; + struct GNUNET_SETU_Element *element = value; + op->total_elements_size_local += element->size; + return GNUNET_YES; +} + + +/** + * Create randomized element hashmap for full sending + * + * @param cls the union operation `struct Operation *` + * @param key unused + * @param value the `struct ElementEntry *` to insert + * into the key-to-element mapping + * @return #GNUNET_YES (to continue iterating) + */ +static int +create_randomized_element_iterator (void *cls, + const struct GNUNET_HashCode *key, + void *value) +{ + struct Operation *op = cls; - return rtt; + struct GNUNET_HashContext *hashed_key_context = + GNUNET_CRYPTO_hash_context_start (); + struct GNUNET_HashCode new_key; + + /** + * Hash element with new salt to randomize hashmap + */ + GNUNET_CRYPTO_hash_context_read (hashed_key_context, + &key, + sizeof(struct IBF_Key)); + GNUNET_CRYPTO_hash_context_read (hashed_key_context, + &op->set->content->elements_randomized_salt, + sizeof(uint32_t)); + GNUNET_CRYPTO_hash_context_finish (hashed_key_context, + &new_key); + GNUNET_CONTAINER_multihashmap_put (op->set->content->elements_randomized, + &new_key,value, + GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE); + return GNUNET_YES; } @@ -808,6 +1514,36 @@ send_client_done (void *cls) } +/** + * Check if all given byzantine parameters are in given boundaries + * @param op + * @return indicator if all given byzantine parameters are in given boundaries + */ + +static int +check_byzantine_bounds (struct Operation *op) +{ + if (op->byzantine != GNUNET_YES) + return GNUNET_OK; + + /** + * Check upper byzantine bounds + */ + if (op->remote_element_count + op->remote_set_diff > + op->byzantine_upper_bound) + return GNUNET_SYSERR; + if (op->local_element_count + op->local_set_diff > op->byzantine_upper_bound) + return GNUNET_SYSERR; + + /** + * Check lower byzantine bounds + */ + if (op->remote_element_count < op->byzantine_lower_bound) + return GNUNET_SYSERR; + return GNUNET_OK; +} + + /* FIXME: the destroy logic is a mess and should be cleaned up! */ /** @@ -976,6 +1712,101 @@ fail_union_operation (struct Operation *op) } +/** + * Function that checks if full sync is plausible + * @param initial_local_elements_in_set + * @param estimated_set_difference + * @param repeated_elements + * @param fresh_elements + * @param op + * @return GNUNET_OK if + */ + +static void +full_sync_plausibility_check (struct Operation *op) +{ + if (GNUNET_YES != op->byzantine) + return; + + int security_level_lb = -1 * SECURITY_LEVEL; + uint64_t duplicates = op->received_fresh - op->received_total; + + /* + * Protect full sync from receiving double element when in FULL SENDING + */ + if (PHASE_FULL_SENDING == op->phase) + { + if (duplicates > 0) + { + LOG (GNUNET_ERROR_TYPE_ERROR, + "PROTOCOL VIOLATION: Received duplicate element in full receiving " + "mode of operation this is not allowed! Duplicates: %lu\n", + duplicates); + GNUNET_break_op (0); + fail_union_operation (op); + return; + } + + } + + /* + * Protect full sync with probabilistic algorithm + */ + if (PHASE_FULL_RECEIVING == op->phase) + { + if (0 == op->remote_set_diff) + op->remote_set_diff = 1; + + long double base = (1 - (long double) (op->remote_set_diff + / (long double) (op->initial_size + + op-> + remote_set_diff))); + long double exponent = (op->received_total - (op->received_fresh * ((long + double) + op-> + initial_size + / (long + double) + op-> + remote_set_diff))); + long double value = exponent * (log2l (base) / log2l (2)); + if ((value < security_level_lb) || (value > SECURITY_LEVEL) ) + { + LOG (GNUNET_ERROR_TYPE_ERROR, + "PROTOCOL VIOLATION: Other peer violated probabilistic rule for receiving " + "to many duplicated full element : %LF\n", + value); + GNUNET_break_op (0); + fail_union_operation (op); + return; + } + } +} + + +/** + * Limit active passive switches in differential sync to configured security level + * @param op + */ +static void +check_max_differential_rounds (struct Operation *op) +{ + double probability = op->differential_sync_iterations * (log2l ( + PROBABILITY_FOR_NEW_ROUND) + / log2l (2)); + if ((-1 * SECURITY_LEVEL) > probability) + { + LOG (GNUNET_ERROR_TYPE_ERROR, + "PROTOCOL VIOLATION: Other peer violated probabilistic rule for to many active passive " + "switches in differential sync: %u\n", + op->differential_sync_iterations); + GNUNET_break_op (0); + fail_union_operation (op); + return; + } +} + + /** * Derive the IBF key from a hash code and * a salt. @@ -1004,12 +1835,12 @@ get_ibf_key (const struct GNUNET_HashCode *src) struct GetElementContext { /** - * FIXME. + * Gnunet hash code in context */ struct GNUNET_HashCode hash; /** - * FIXME. + * Pointer to the key enty */ struct KeyEntry *k; }; @@ -1122,7 +1953,7 @@ salt_key (const struct IBF_Key *k_in, uint32_t salt, struct IBF_Key *k_out) { - int s = salt % 64; + int s = (salt * 7) % 64; uint64_t x = k_in->key_val; /* rotate ibf key */ @@ -1132,14 +1963,14 @@ salt_key (const struct IBF_Key *k_in, /** - * FIXME. + * Reverse modification done in the salt_key function */ static void unsalt_key (const struct IBF_Key *k_in, uint32_t salt, struct IBF_Key *k_out) { - int s = salt % 64; + int s = (salt * 7) % 64; uint64_t x = k_in->key_val; x = (x << s) | (x >> (64 - s)); @@ -1258,7 +2089,9 @@ prepare_ibf (struct Operation *op, if (NULL != op->local_ibf) ibf_destroy (op->local_ibf); - op->local_ibf = ibf_create (size, SE_IBF_HASH_NUM); + // op->local_ibf = ibf_create (size, SE_IBF_HASH_NUM); + op->local_ibf = ibf_create (size, + ((uint8_t) op->ibf_number_buckets_per_element)); if (NULL == op->local_ibf) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -1283,13 +2116,23 @@ prepare_ibf (struct Operation *op, */ static int send_ibf (struct Operation *op, - uint16_t ibf_order) + uint32_t ibf_size) { - unsigned int buckets_sent = 0; + uint64_t buckets_sent = 0; struct InvertibleBloomFilter *ibf; + op->differential_sync_iterations++; + + /** + * Enforce min size of IBF + */ + uint32_t ibf_min_size = IBF_MIN_SIZE; + if (ibf_size < ibf_min_size) + { + ibf_size = ibf_min_size; + } if (GNUNET_OK != - prepare_ibf (op, 1 << ibf_order)) + prepare_ibf (op, ibf_size)) { /* allocation failed */ return GNUNET_SYSERR; @@ -1297,45 +2140,48 @@ send_ibf (struct Operation *op, LOG (GNUNET_ERROR_TYPE_DEBUG, "sending ibf of size %u\n", - 1 << ibf_order); + 1 << ibf_size); { char name[64]; - GNUNET_snprintf (name, sizeof(name), "# sent IBF (order %u)", ibf_order); + GNUNET_snprintf (name, sizeof(name), "# sent IBF (order %u)", ibf_size); GNUNET_STATISTICS_update (_GSS_statistics, name, 1, GNUNET_NO); } ibf = op->local_ibf; - while (buckets_sent < (1 << ibf_order)) + while (buckets_sent < ibf_size) { unsigned int buckets_in_message; struct GNUNET_MQ_Envelope *ev; struct IBFMessage *msg; - buckets_in_message = (1 << ibf_order) - buckets_sent; + buckets_in_message = ibf_size - buckets_sent; /* limit to maximum */ if (buckets_in_message > MAX_BUCKETS_PER_MESSAGE) buckets_in_message = MAX_BUCKETS_PER_MESSAGE; - perf_rtt.ibf.sent += 1; - perf_rtt.ibf.sent_var_bytes += ( buckets_in_message * IBF_BUCKET_SIZE ); +#if MEASURE_PERFORMANCE + perf_store.ibf.sent += 1; + perf_store.ibf.sent_var_bytes += (buckets_in_message * IBF_BUCKET_SIZE); +#endif ev = GNUNET_MQ_msg_extra (msg, buckets_in_message * IBF_BUCKET_SIZE, GNUNET_MESSAGE_TYPE_SETU_P2P_IBF); - msg->reserved1 = 0; - msg->reserved2 = 0; - msg->order = ibf_order; + msg->ibf_size = ibf_size; msg->offset = htonl (buckets_sent); msg->salt = htonl (op->salt_send); + msg->ibf_counter_bit_length = ibf_get_max_counter (ibf); + + ibf_write_slice (ibf, buckets_sent, - buckets_in_message, &msg[1]); + buckets_in_message, &msg[1], msg->ibf_counter_bit_length); buckets_sent += buckets_in_message; LOG (GNUNET_ERROR_TYPE_DEBUG, - "ibf chunk size %u, %u/%u sent\n", + "ibf chunk size %u, %lu/%u sent\n", buckets_in_message, buckets_sent, - 1 << ibf_order); + ibf_size); GNUNET_MQ_send (op->mq, ev); } @@ -1354,17 +2200,26 @@ send_ibf (struct Operation *op, * @return the required size of the ibf */ static unsigned int -get_order_from_difference (unsigned int diff) +get_size_from_difference (unsigned int diff, int number_buckets_per_element, + float ibf_bucket_number_factor) { - unsigned int ibf_order; + /** Make ibf estimation size odd reasoning can be found in BSc Thesis of + * Elias Summermatter (2021) in section 3.11 **/ + return (((int) (diff * ibf_bucket_number_factor)) | 1); + +} - ibf_order = 2; - while (((1 << ibf_order) < (IBF_ALPHA * diff) || - ((1 << ibf_order) < SE_IBF_HASH_NUM)) && - (ibf_order < MAX_IBF_ORDER)) - ibf_order++; - // add one for correction - return ibf_order + 1; + +static unsigned int +get_next_ibf_size (float ibf_bucket_number_factor, unsigned int + decoded_elements, unsigned int last_ibf_size) +{ + unsigned int next_size = (unsigned int) ((last_ibf_size * 2) + - (ibf_bucket_number_factor + * decoded_elements)); + /** Make ibf estimation size odd reasoning can be found in BSc Thesis of + * Elias Summermatter (2021) in section 3.11 **/ + return next_size | 1; } @@ -1391,8 +2246,10 @@ send_full_element_iterator (void *cls, LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending element %s\n", GNUNET_h2s (key)); - perf_rtt.element_full.received += 1; - perf_rtt.element_full.received_var_bytes += el->size; +#if MEASURE_PERFORMANCE + perf_store.element_full.received += 1; + perf_store.element_full.received_var_bytes += el->size; +#endif ev = GNUNET_MQ_msg_extra (emsg, el->size, GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_ELEMENT); @@ -1421,10 +2278,25 @@ send_full_set (struct Operation *op) "Dedicing to transmit the full set\n"); /* FIXME: use a more memory-friendly way of doing this with an iterator, just as we do in the non-full case! */ + + // Randomize Elements to send + op->set->content->elements_randomized = GNUNET_CONTAINER_multihashmap_create ( + 32,GNUNET_NO); + op->set->content->elements_randomized_salt = GNUNET_CRYPTO_random_u64 ( + GNUNET_CRYPTO_QUALITY_NONCE, + UINT64_MAX); (void) GNUNET_CONTAINER_multihashmap_iterate (op->set->content->elements, - &send_full_element_iterator, + & + create_randomized_element_iterator, op); - perf_rtt.full_done.sent += 1; + + (void) GNUNET_CONTAINER_multihashmap_iterate ( + op->set->content->elements_randomized, + &send_full_element_iterator, + op); +#if MEASURE_PERFORMANCE + perf_store.full_done.sent += 1; +#endif ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_DONE); GNUNET_MQ_send (op->mq, ev); @@ -1454,7 +2326,7 @@ check_union_p2p_strata_estimator (void *cls, msg->header.type)); len = ntohs (msg->header.size) - sizeof(struct StrataEstimatorMessage); if ((GNUNET_NO == is_compressed) && - (len != SE_STRATA_COUNT * SE_IBF_SIZE * IBF_BUCKET_SIZE)) + (len != SE_STRATA_COUNT * SE_IBFS_TOTAL_SIZE * IBF_BUCKET_SIZE)) { GNUNET_break (0); return GNUNET_SYSERR; @@ -1473,14 +2345,44 @@ static void handle_union_p2p_strata_estimator (void *cls, const struct StrataEstimatorMessage *msg) { - perf_rtt.se.received += 1; - perf_rtt.se.received_var_bytes += ntohs (msg->header.size) - sizeof(struct StrataEstimatorMessage); +#if MEASURE_PERFORMANCE + perf_store.se.received += 1; + perf_store.se.received_var_bytes += ntohs (msg->header.size) - sizeof(struct + StrataEstimatorMessage); +#endif struct Operation *op = cls; - struct StrataEstimator *remote_se; + struct MultiStrataEstimator *remote_se; unsigned int diff; uint64_t other_size; size_t len; int is_compressed; + op->local_element_count = GNUNET_CONTAINER_multihashmap_size ( + op->set->content->elements); + // Setting peer site to receiving peer + op->peer_site = 1; + + /** + * Check that the message is received only in supported phase + */ + uint8_t allowed_phases[] = {PHASE_EXPECT_SE}; + if (GNUNET_OK != + check_valid_phase (allowed_phases,sizeof(allowed_phases),op)) + { + GNUNET_break (0); + fail_union_operation (op); + return; + } + + /** Only allow 1,2,4,8 SEs **/ + if ((msg->se_count > 8) || (__builtin_popcount ((int) msg->se_count) != 1)) + { + LOG (GNUNET_ERROR_TYPE_ERROR, + "PROTOCOL VIOLATION: Invalid number of se transmitted by other peer %u\n", + msg->se_count); + GNUNET_break_op (0); + fail_union_operation (op); + return; + } is_compressed = (GNUNET_MESSAGE_TYPE_SETU_P2P_SEC == htons ( msg->header.type)); @@ -1490,8 +2392,20 @@ handle_union_p2p_strata_estimator (void *cls, GNUNET_NO); len = ntohs (msg->header.size) - sizeof(struct StrataEstimatorMessage); other_size = GNUNET_ntohll (msg->set_size); + op->remote_element_count = other_size; + + if (op->byzantine_upper_bound < op->remote_element_count) + { + LOG (GNUNET_ERROR_TYPE_ERROR, + "Exceeded configured upper bound <%lu> of element: %u\n", + op->byzantine_upper_bound, + op->remote_element_count); + fail_union_operation (op); + return; + } + remote_se = strata_estimator_create (SE_STRATA_COUNT, - SE_IBF_SIZE, + SE_IBFS_TOTAL_SIZE, SE_IBF_HASH_NUM); if (NULL == remote_se) { @@ -1503,6 +2417,8 @@ handle_union_p2p_strata_estimator (void *cls, strata_estimator_read (&msg[1], len, is_compressed, + msg->se_count, + SE_IBFS_TOTAL_SIZE, remote_se)) { /* decompression failed */ @@ -1511,11 +2427,76 @@ handle_union_p2p_strata_estimator (void *cls, return; } GNUNET_assert (NULL != op->se); - diff = strata_estimator_difference (remote_se, - op->se); + strata_estimator_difference (remote_se, + op->se); + + /* Calculate remote local diff */ + long diff_remote = remote_se->stratas[0]->strata[0]->remote_decoded_count; + long diff_local = remote_se->stratas[0]->strata[0]->local_decoded_count; + + /* Prevent estimations from overshooting max element */ + if (diff_remote + op->remote_element_count > op->byzantine_upper_bound) + diff_remote = op->byzantine_upper_bound - op->remote_element_count; + if (diff_local + op->local_element_count > op->byzantine_upper_bound) + diff_local = op->byzantine_upper_bound - op->local_element_count; + if ((diff_remote < 0) || (diff_local < 0)) + { + strata_estimator_destroy (remote_se); + LOG (GNUNET_ERROR_TYPE_ERROR, + "PROTOCOL VIOLATION: More element is set as upper boundary or other peer is " + "malicious: remote diff %ld, local diff: %ld\n", + diff_remote, diff_local); + GNUNET_break_op (0); + fail_union_operation (op); + return; + } - if (diff > 200) - diff = diff * 3 / 2; + /* Make estimation more precise in initial sync cases */ + if (0 == op->remote_element_count) + { + diff_remote = 0; + diff_local = op->local_element_count; + } + if (0 == op->local_element_count) + { + diff_local = 0; + diff_remote = op->remote_element_count; + } + + diff = diff_remote + diff_local; + op->remote_set_diff = diff_remote; + + /** Calculate avg element size if not initial sync **/ + uint64_t avg_element_size = 0; + if (0 < op->local_element_count) + { + op->total_elements_size_local = 0; + GNUNET_CONTAINER_multihashmap_iterate (op->set->content->elements, + & + determinate_avg_element_size_iterator, + op); + avg_element_size = op->total_elements_size_local / op->local_element_count; + } + + op->mode_of_operation = estimate_best_mode_of_operation (avg_element_size, + GNUNET_CONTAINER_multihashmap_size ( + op->set->content-> + elements), + op-> + remote_element_count, + diff_remote, + diff_local, + op-> + rtt_bandwidth_tradeoff, + op-> + ibf_bucket_number_factor); + +#if MEASURE_PERFORMANCE + perf_store.se_diff_local = diff_local; + perf_store.se_diff_remote = diff_remote; + perf_store.se_diff = diff; + perf_store.mode_of_operation = op->mode_of_operation; +#endif strata_estimator_destroy (remote_se); strata_estimator_destroy (op->se); @@ -1523,7 +2504,8 @@ handle_union_p2p_strata_estimator (void *cls, LOG (GNUNET_ERROR_TYPE_DEBUG, "got se diff=%d, using ibf size %d\n", diff, - 1U << get_order_from_difference (diff)); + 1U << get_size_from_difference (diff, op->ibf_number_buckets_per_element, + op->ibf_bucket_number_factor)); { char *set_debug; @@ -1546,16 +2528,8 @@ handle_union_p2p_strata_estimator (void *cls, return; } - LOG (GNUNET_ERROR_TYPE_ERROR, - "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: %f\n", op->rtt_bandwidth_tradeoff); - - - /** - * Added rtt_bandwidth_tradeoff directly need future improvements - */ if ((GNUNET_YES == op->force_full) || - (diff > op->initial_size / 4) || - (0 == other_size)) + (op->mode_of_operation != DIFFERENTIAL_SYNC)) { LOG (GNUNET_ERROR_TYPE_DEBUG, "Deciding to go for full set transmission (diff=%d, own set=%llu)\n", @@ -1565,9 +2539,17 @@ handle_union_p2p_strata_estimator (void *cls, "# of full sends", 1, GNUNET_NO); - if ((op->initial_size <= other_size) || - (0 == other_size)) + if (FULL_SYNC_LOCAL_SENDING_FIRST == op->mode_of_operation) { + struct TransmitFullMessage *signal_msg; + struct GNUNET_MQ_Envelope *ev; + ev = GNUNET_MQ_msg_extra (signal_msg,sizeof(struct TransmitFullMessage), + GNUNET_MESSAGE_TYPE_SETU_P2P_SEND_FULL); + signal_msg->remote_set_difference = htonl (diff_local); + signal_msg->remote_set_size = htonl (op->local_element_count); + signal_msg->local_set_difference = htonl (diff_remote); + GNUNET_MQ_send (op->mq, + ev); send_full_set (op); } else @@ -1577,9 +2559,15 @@ handle_union_p2p_strata_estimator (void *cls, LOG (GNUNET_ERROR_TYPE_DEBUG, "Telling other peer that we expect its full set\n"); op->phase = PHASE_FULL_RECEIVING; - perf_rtt.request_full.sent += 1; - ev = GNUNET_MQ_msg_header ( - GNUNET_MESSAGE_TYPE_SETU_P2P_REQUEST_FULL); +#if MEASURE_PERFORMANCE + perf_store.request_full.sent += 1; +#endif + struct TransmitFullMessage *signal_msg; + ev = GNUNET_MQ_msg_extra (signal_msg,sizeof(struct TransmitFullMessage), + GNUNET_MESSAGE_TYPE_SETU_P2P_REQUEST_FULL); + signal_msg->remote_set_difference = htonl (diff_local); + signal_msg->remote_set_size = htonl (op->local_element_count); + signal_msg->local_set_difference = htonl (diff_remote); GNUNET_MQ_send (op->mq, ev); } @@ -1592,7 +2580,9 @@ handle_union_p2p_strata_estimator (void *cls, GNUNET_NO); if (GNUNET_OK != send_ibf (op, - get_order_from_difference (diff))) + get_size_from_difference (diff, + op->ibf_number_buckets_per_element, + op->ibf_bucket_number_factor))) { /* Internal error, best we can do is shut the connection */ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -1625,15 +2615,64 @@ send_offers_iterator (void *cls, /* Detect 32-bit key collision for the 64-bit IBF keys. */ if (ke->ibf_key.key_val != sec->ibf_key.key_val) + { + op->active_passive_switch_required = true; return GNUNET_YES; + } - perf_rtt.offer.sent += 1; - perf_rtt.offer.sent_var_bytes += sizeof(struct GNUNET_HashCode); + /* Prevent implementation from sending a offer multiple times in case of roll switch */ + if (GNUNET_YES == + is_message_in_message_control_flow ( + op->message_control_flow, + &ke->element->element_hash, + OFFER_MESSAGE) + ) + { + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Skipping already sent processed element offer!\n"); + return GNUNET_YES; + } + /* Save send offer message for message control */ + if (GNUNET_YES != + update_message_control_flow ( + op->message_control_flow, + MSG_CFS_SENT, + &ke->element->element_hash, + OFFER_MESSAGE) + ) + { + LOG (GNUNET_ERROR_TYPE_ERROR, + "Double offer message sent found!\n"); + GNUNET_break (0); + fail_union_operation (op); + return GNUNET_NO; + } + ; + + /* Mark element to be expected to received */ + if (GNUNET_YES != + update_message_control_flow ( + op->message_control_flow, + MSG_CFS_EXPECTED, + &ke->element->element_hash, + DEMAND_MESSAGE) + ) + { + LOG (GNUNET_ERROR_TYPE_ERROR, + "Double demand received found!\n"); + GNUNET_break (0); + fail_union_operation (op); + return GNUNET_NO; + } + ; +#if MEASURE_PERFORMANCE + perf_store.offer.sent += 1; + perf_store.offer.sent_var_bytes += sizeof(struct GNUNET_HashCode); +#endif ev = GNUNET_MQ_msg_header_extra (mh, sizeof(struct GNUNET_HashCode), GNUNET_MESSAGE_TYPE_SETU_P2P_OFFER); - GNUNET_assert (NULL != ev); *(struct GNUNET_HashCode *) &mh[1] = ke->element->element_hash; LOG (GNUNET_ERROR_TYPE_DEBUG, @@ -1651,7 +2690,7 @@ send_offers_iterator (void *cls, * @param op union operation * @param ibf_key IBF key of interest */ -static void +void send_offers_for_key (struct Operation *op, struct IBF_Key ibf_key) { @@ -1694,6 +2733,7 @@ decode_and_send (struct Operation *op) /* allocation failed */ return GNUNET_SYSERR; } + diff_ibf = ibf_dup (op->local_ibf); ibf_subtract (diff_ibf, op->remote_ibf); @@ -1706,7 +2746,7 @@ decode_and_send (struct Operation *op) diff_ibf->size); num_decoded = 0; - key.key_val = 0; /* just to avoid compiler thinking we use undef'ed variable */ + key.key_val = 0; /* just to avoid compiler thinking we use undef'ed variable */ while (1) { @@ -1738,23 +2778,36 @@ decode_and_send (struct Operation *op) if ((GNUNET_SYSERR == res) || (GNUNET_YES == cycle_detected)) { - int next_order; - next_order = 0; - while (1 << next_order < diff_ibf->size) - next_order++; - next_order++; - if (next_order <= MAX_IBF_ORDER) + uint32_t next_size; + /** Enforce odd ibf size **/ + + next_size = get_next_ibf_size (op->ibf_bucket_number_factor, num_decoded, + diff_ibf->size); + /** Make ibf estimation size odd reasoning can be found in BSc Thesis of + * Elias Summermatter (2021) in section 3.11 **/ + uint32_t ibf_min_size = IBF_MIN_SIZE | 1; + + if (next_sizesalt_send++; +#if MEASURE_PERFORMANCE + perf_store.active_passive_switches += 1; +#endif + + op->salt_send = op->salt_receive++; + if (GNUNET_OK != - send_ibf (op, next_order)) + send_ibf (op, next_size)) { /* Internal error, best we can do is shut the connection */ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -1786,7 +2839,9 @@ decode_and_send (struct Operation *op) LOG (GNUNET_ERROR_TYPE_DEBUG, "transmitted all values, sending DONE\n"); - perf_rtt.done.sent += 1; +#if MEASURE_PERFORMANCE + perf_store.done.sent += 1; +#endif ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_SETU_P2P_DONE); GNUNET_MQ_send (op->mq, ev); /* We now wait until we get a DONE message back @@ -1797,7 +2852,6 @@ decode_and_send (struct Operation *op) if (1 == side) { struct IBF_Key unsalted_key; - unsalt_key (&key, op->salt_receive, &unsalted_key); @@ -1809,8 +2863,29 @@ decode_and_send (struct Operation *op) struct GNUNET_MQ_Envelope *ev; struct InquiryMessage *msg; - perf_rtt.inquery.sent += 1; - perf_rtt.inquery.sent_var_bytes += sizeof(struct IBF_Key); +#if MEASURE_PERFORMANCE + perf_store.inquery.sent += 1; + perf_store.inquery.sent_var_bytes += sizeof(struct IBF_Key); +#endif + + /** Add sent inquiries to hashmap for flow control **/ + struct GNUNET_HashContext *hashed_key_context = + GNUNET_CRYPTO_hash_context_start (); + struct GNUNET_HashCode *hashed_key = (struct + GNUNET_HashCode*) GNUNET_malloc ( + sizeof(struct GNUNET_HashCode)); + enum MESSAGE_CONTROL_FLOW_STATE mcfs = MSG_CFS_SENT; + GNUNET_CRYPTO_hash_context_read (hashed_key_context, + &key, + sizeof(struct IBF_Key)); + GNUNET_CRYPTO_hash_context_finish (hashed_key_context, + hashed_key); + GNUNET_CONTAINER_multihashmap_put (op->inquiries_sent, + hashed_key, + &mcfs, + GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE + ); + /* It may be nice to merge multiple requests, but with CADET's corking it is not worth * the effort additional complexity. */ ev = GNUNET_MQ_msg_extra (msg, @@ -1835,6 +2910,100 @@ decode_and_send (struct Operation *op) } +/** + * Check send full message received from other peer + * @param cls + * @param msg + * @return + */ + +static int +check_union_p2p_send_full (void *cls, + const struct TransmitFullMessage *msg) +{ + return GNUNET_OK; +} + + +/** + * Handle send full message received from other peer + * + * @param cls + * @param msg + */ +static void +handle_union_p2p_send_full (void *cls, + const struct TransmitFullMessage *msg) +{ + struct Operation *op = cls; + + /** + * Check that the message is received only in supported phase + */ + uint8_t allowed_phases[] = {PHASE_EXPECT_IBF}; + if (GNUNET_OK != + check_valid_phase (allowed_phases,sizeof(allowed_phases),op)) + { + GNUNET_break (0); + fail_union_operation (op); + return; + } + + /** write received values to operator**/ + op->remote_element_count = ntohl (msg->remote_set_size); + op->remote_set_diff = ntohl (msg->remote_set_difference); + op->local_set_diff = ntohl (msg->local_set_difference); + + /** Check byzantine limits **/ + if (check_byzantine_bounds (op) != GNUNET_OK) + { + LOG (GNUNET_ERROR_TYPE_ERROR, + "PROTOCOL VIOLATION: Parameters transmitted from other peer do not satisfie byzantine " + "criteria\n"); + GNUNET_break_op (0); + fail_union_operation (op); + return; + } + + /** Calculate avg element size if not initial sync **/ + op->local_element_count = GNUNET_CONTAINER_multihashmap_size ( + op->set->content->elements); + uint64_t avg_element_size = 0; + if (0 < op->local_element_count) + { + op->total_elements_size_local = 0; + GNUNET_CONTAINER_multihashmap_iterate (op->set->content->elements, + & + determinate_avg_element_size_iterator, + op); + avg_element_size = op->total_elements_size_local / op->local_element_count; + } + + /** Validate mode of operation **/ + int mode_of_operation = estimate_best_mode_of_operation (avg_element_size, + op-> + remote_element_count, + op-> + local_element_count, + op->local_set_diff, + op->remote_set_diff, + op-> + rtt_bandwidth_tradeoff, + op-> + ibf_bucket_number_factor); + if (FULL_SYNC_LOCAL_SENDING_FIRST != mode_of_operation) + { + LOG (GNUNET_ERROR_TYPE_ERROR, + "PROTOCOL VIOLATION: Remote peer choose to send his full set first but correct mode would have been" + " : %d\n", mode_of_operation); + GNUNET_break_op (0); + fail_union_operation (op); + return; + } + op->phase = PHASE_FULL_RECEIVING; +} + + /** * Check an IBF message from a remote peer. * @@ -1872,7 +3041,8 @@ check_union_p2p_ibf (void *cls, GNUNET_break_op (0); return GNUNET_SYSERR; } - if (1 << msg->order != op->remote_ibf->size) + + if (msg->ibf_size != op->remote_ibf->size) { GNUNET_break_op (0); return GNUNET_SYSERR; @@ -1909,9 +3079,26 @@ handle_union_p2p_ibf (void *cls, { struct Operation *op = cls; unsigned int buckets_in_message; + /** + * Check that the message is received only in supported phase + */ + uint8_t allowed_phases[] = {PHASE_EXPECT_IBF, PHASE_EXPECT_IBF_LAST, + PHASE_PASSIVE_DECODING}; + if (GNUNET_OK != + check_valid_phase (allowed_phases,sizeof(allowed_phases),op)) + { + GNUNET_break (0); + fail_union_operation (op); + return; + } + op->differential_sync_iterations++; + check_max_differential_rounds (op); + op->active_passive_switch_required = false; - perf_rtt.ibf.received += 1; - perf_rtt.ibf.received_var_bytes += (ntohs (msg->header.size) - sizeof *msg); +#if MEASURE_PERFORMANCE + perf_store.ibf.received += 1; + perf_store.ibf.received_var_bytes += (ntohs (msg->header.size) - sizeof *msg); +#endif buckets_in_message = (ntohs (msg->header.size) - sizeof *msg) / IBF_BUCKET_SIZE; @@ -1922,8 +3109,10 @@ handle_union_p2p_ibf (void *cls, GNUNET_assert (NULL == op->remote_ibf); LOG (GNUNET_ERROR_TYPE_DEBUG, "Creating new ibf of size %u\n", - 1 << msg->order); - op->remote_ibf = ibf_create (1 << msg->order, SE_IBF_HASH_NUM); + ntohl (msg->ibf_size)); + // op->remote_ibf = ibf_create (1 << msg->order, SE_IBF_HASH_NUM); + op->remote_ibf = ibf_create (msg->ibf_size, + ((uint8_t) op->ibf_number_buckets_per_element)); op->salt_receive = ntohl (msg->salt); LOG (GNUNET_ERROR_TYPE_DEBUG, "Receiving new IBF with salt %u\n", @@ -1954,7 +3143,7 @@ handle_union_p2p_ibf (void *cls, ibf_read_slice (&msg[1], op->ibf_buckets_received, buckets_in_message, - op->remote_ibf); + op->remote_ibf, msg->ibf_counter_bit_length); op->ibf_buckets_received += buckets_in_message; if (op->ibf_buckets_received == op->remote_ibf->size) @@ -2030,18 +3219,24 @@ maybe_finish (struct Operation *op) num_demanded = GNUNET_CONTAINER_multihashmap_size ( op->demanded_hashes); - + int send_done = GNUNET_CONTAINER_multihashmap_iterate ( + op->message_control_flow, + & + determinate_done_message_iterator, + op); if (PHASE_FINISH_WAITING == op->phase) { LOG (GNUNET_ERROR_TYPE_DEBUG, - "In PHASE_FINISH_WAITING, pending %u demands\n", - num_demanded); - if (0 == num_demanded) + "In PHASE_FINISH_WAITING, pending %u demands -> %d\n", + num_demanded, op->peer_site); + if (-1 != send_done) { struct GNUNET_MQ_Envelope *ev; op->phase = PHASE_FINISHED; - perf_rtt.done.sent += 1; +#if MEASURE_PERFORMANCE + perf_store.done.sent += 1; +#endif ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_SETU_P2P_DONE); GNUNET_MQ_send (op->mq, ev); @@ -2052,9 +3247,9 @@ maybe_finish (struct Operation *op) if (PHASE_FINISH_CLOSING == op->phase) { LOG (GNUNET_ERROR_TYPE_DEBUG, - "In PHASE_FINISH_CLOSING, pending %u demands\n", - num_demanded); - if (0 == num_demanded) + "In PHASE_FINISH_CLOSING, pending %u demands %d\n", + num_demanded, op->peer_site); + if (-1 != send_done) { op->phase = PHASE_FINISHED; send_client_done (op); @@ -2102,11 +3297,25 @@ handle_union_p2p_elements (void *cls, struct KeyEntry *ke; uint16_t element_size; + /** + * Check that the message is received only in supported phase + */ + uint8_t allowed_phases[] = {PHASE_ACTIVE_DECODING, PHASE_PASSIVE_DECODING, + PHASE_FINISH_WAITING, PHASE_FINISH_CLOSING}; + if (GNUNET_OK != + check_valid_phase (allowed_phases,sizeof(allowed_phases),op)) + { + GNUNET_break (0); + fail_union_operation (op); + return; + } element_size = ntohs (emsg->header.size) - sizeof(struct GNUNET_SETU_ElementMessage); - perf_rtt.element.received += 1; - perf_rtt.element.received_var_bytes += element_size; +#if MEASURE_PERFORMANCE + perf_store.element.received += 1; + perf_store.element.received_var_bytes += element_size; +#endif ee = GNUNET_malloc (sizeof(struct ElementEntry) + element_size); GNUNET_memcpy (&ee[1], @@ -2129,6 +3338,21 @@ handle_union_p2p_elements (void *cls, return; } + if (GNUNET_OK != + update_message_control_flow ( + op->message_control_flow, + MSG_CFS_RECEIVED, + &ee->element_hash, + ELEMENT_MESSAGE) + ) + { + LOG (GNUNET_ERROR_TYPE_ERROR, + "An element has been received more than once!\n"); + GNUNET_break (0); + fail_union_operation (op); + return; + } + LOG (GNUNET_ERROR_TYPE_DEBUG, "Got element (size %u, hash %s) from peer\n", (unsigned int) element_size, @@ -2217,33 +3441,25 @@ handle_union_p2p_full_element (void *cls, struct KeyEntry *ke; uint16_t element_size; - - - if(PHASE_EXPECT_IBF == op->phase) { - op->phase = PHASE_FULL_RECEIVING; - } - - - - /* Allow only receiving of full element message if in expect IBF or in PHASE_FULL_RECEIVING state */ - if ((PHASE_FULL_RECEIVING != op->phase) && - (PHASE_FULL_SENDING != op->phase)) + /** + * Check that the message is received only in supported phase + */ + uint8_t allowed_phases[] = {PHASE_FULL_RECEIVING, PHASE_FULL_SENDING}; + if (GNUNET_OK != + check_valid_phase (allowed_phases,sizeof(allowed_phases),op)) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Handle full element phase is %u\n", - (unsigned) op->phase); - GNUNET_break_op (0); - fail_union_operation (op); - return; + GNUNET_break (0); + fail_union_operation (op); + return; } - - element_size = ntohs (emsg->header.size) - sizeof(struct GNUNET_SETU_ElementMessage); - perf_rtt.element_full.received += 1; - perf_rtt.element_full.received_var_bytes += element_size; +#if MEASURE_PERFORMANCE + perf_store.element_full.received += 1; + perf_store.element_full.received_var_bytes += element_size; +#endif ee = GNUNET_malloc (sizeof(struct ElementEntry) + element_size); GNUNET_memcpy (&ee[1], &emsg[1], element_size); @@ -2268,17 +3484,15 @@ handle_union_p2p_full_element (void *cls, GNUNET_NO); op->received_total++; - ke = op_get_element (op, &ee->element_hash); if (NULL != ke) { - /* Got repeated element. Should not happen since - * we track demands. */ GNUNET_STATISTICS_update (_GSS_statistics, "# repeated elements", 1, GNUNET_NO); + full_sync_plausibility_check (op); ke->received = GNUNET_YES; GNUNET_free (ee); } @@ -2294,15 +3508,15 @@ handle_union_p2p_full_element (void *cls, GNUNET_SETU_STATUS_ADD_LOCAL); } + if ((GNUNET_YES == op->byzantine) && - (op->received_total > 384 + op->received_fresh * 4) && - (op->received_fresh < op->received_total / 6)) + (op->received_total > op->remote_element_count) ) { /* The other peer gave us lots of old elements, there's something wrong. */ LOG (GNUNET_ERROR_TYPE_ERROR, - "Other peer sent only %llu/%llu fresh elements, failing operation\n", - (unsigned long long) op->received_fresh, - (unsigned long long) op->received_total); + "Other peer sent %llu elements while pretending to have %llu elements, failing operation\n", + (unsigned long long) op->received_total, + (unsigned long long) op->remote_element_count); GNUNET_break_op (0); fail_union_operation (op); return; @@ -2356,18 +3570,50 @@ handle_union_p2p_inquiry (void *cls, const struct IBF_Key *ibf_key; unsigned int num_keys; - perf_rtt.inquery.received += 1; - perf_rtt.inquery.received_var_bytes += (ntohs (msg->header.size) - sizeof(struct InquiryMessage)); + /** + * Check that the message is received only in supported phase + */ + uint8_t allowed_phases[] = {PHASE_ACTIVE_DECODING, PHASE_PASSIVE_DECODING}; + if (GNUNET_OK != + check_valid_phase (allowed_phases,sizeof(allowed_phases),op)) + { + GNUNET_break (0); + fail_union_operation (op); + return; + } + +#if MEASURE_PERFORMANCE + perf_store.inquery.received += 1; + perf_store.inquery.received_var_bytes += (ntohs (msg->header.size) + - sizeof(struct InquiryMessage)); +#endif LOG (GNUNET_ERROR_TYPE_DEBUG, "Received union inquiry\n"); num_keys = (ntohs (msg->header.size) - sizeof(struct InquiryMessage)) / sizeof(struct IBF_Key); ibf_key = (const struct IBF_Key *) &msg[1]; + + /** Add received inquiries to hashmap for flow control **/ + struct GNUNET_HashContext *hashed_key_context = + GNUNET_CRYPTO_hash_context_start (); + struct GNUNET_HashCode *hashed_key = (struct GNUNET_HashCode*) GNUNET_malloc ( + sizeof(struct GNUNET_HashCode));; + enum MESSAGE_CONTROL_FLOW_STATE mcfs = MSG_CFS_RECEIVED; + GNUNET_CRYPTO_hash_context_read (hashed_key_context, + &ibf_key, + sizeof(struct IBF_Key)); + GNUNET_CRYPTO_hash_context_finish (hashed_key_context, + hashed_key); + GNUNET_CONTAINER_multihashmap_put (op->inquiries_sent, + hashed_key, + &mcfs, + GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE + ); + while (0 != num_keys--) { struct IBF_Key unsalted_key; - unsalt_key (ibf_key, ntohl (msg->salt), &unsalted_key); @@ -2402,7 +3648,9 @@ send_missing_full_elements_iter (void *cls, if (GNUNET_YES == ke->received) return GNUNET_YES; - perf_rtt.element_full.received += 1; +#if MEASURE_PERFORMANCE + perf_store.element_full.received += 1; +#endif ev = GNUNET_MQ_msg_extra (emsg, ee->element.size, GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_ELEMENT); @@ -2422,18 +3670,84 @@ send_missing_full_elements_iter (void *cls, * @param cls closure, a set union operation * @param mh the demand message */ +static int +check_union_p2p_request_full (void *cls, + const struct TransmitFullMessage *mh) +{ + return GNUNET_OK; +} + + static void handle_union_p2p_request_full (void *cls, - const struct GNUNET_MessageHeader *mh) + const struct TransmitFullMessage *msg) { struct Operation *op = cls; - perf_rtt.request_full.received += 1; + /** + * Check that the message is received only in supported phase + */ + uint8_t allowed_phases[] = {PHASE_EXPECT_IBF}; + if (GNUNET_OK != + check_valid_phase (allowed_phases,sizeof(allowed_phases),op)) + { + GNUNET_break (0); + fail_union_operation (op); + return; + } + + op->remote_element_count = ntohl (msg->remote_set_size); + op->remote_set_diff = ntohl (msg->remote_set_difference); + op->local_set_diff = ntohl (msg->local_set_difference); - LOG (GNUNET_ERROR_TYPE_DEBUG, + + if (check_byzantine_bounds (op) != GNUNET_OK) + { + LOG (GNUNET_ERROR_TYPE_ERROR, + "PROTOCOL VIOLATION: Parameters transmitted from other peer do not satisfie byzantine " + "criteria\n"); + GNUNET_break_op (0); + fail_union_operation (op); + return; + } + +#if MEASURE_PERFORMANCE + perf_store.request_full.received += 1; +#endif + + LOG (GNUNET_ERROR_TYPE_DEBUG, "Received request for full set transmission\n"); - if (PHASE_EXPECT_IBF != op->phase) + + /** Calculate avg element size if not initial sync **/ + op->local_element_count = GNUNET_CONTAINER_multihashmap_size ( + op->set->content->elements); + uint64_t avg_element_size = 0; + if (0 < op->local_element_count) + { + op->total_elements_size_local = 0; + GNUNET_CONTAINER_multihashmap_iterate (op->set->content->elements, + & + determinate_avg_element_size_iterator, + op); + avg_element_size = op->total_elements_size_local / op->local_element_count; + } + + int mode_of_operation = estimate_best_mode_of_operation (avg_element_size, + op-> + remote_element_count, + op-> + local_element_count, + op->local_set_diff, + op->remote_set_diff, + op-> + rtt_bandwidth_tradeoff, + op-> + ibf_bucket_number_factor); + if (FULL_SYNC_REMOTE_SENDING_FIRST != mode_of_operation) { + LOG (GNUNET_ERROR_TYPE_ERROR, + "PROTOCOL VIOLATION: Remote peer choose to request the full set first but correct mode would have been" + " : %d\n", mode_of_operation); GNUNET_break_op (0); fail_union_operation (op); return; @@ -2458,7 +3772,21 @@ handle_union_p2p_full_done (void *cls, { struct Operation *op = cls; - perf_rtt.full_done.received += 1; + /** + * Check that the message is received only in supported phase + */ + uint8_t allowed_phases[] = {PHASE_FULL_SENDING, PHASE_FULL_RECEIVING}; + if (GNUNET_OK != + check_valid_phase (allowed_phases,sizeof(allowed_phases),op)) + { + GNUNET_break (0); + fail_union_operation (op); + return; + } + +#if MEASURE_PERFORMANCE + perf_store.full_done.received += 1; +#endif switch (op->phase) { @@ -2466,6 +3794,19 @@ handle_union_p2p_full_done (void *cls, { struct GNUNET_MQ_Envelope *ev; + if ((GNUNET_YES == op->byzantine) && + (op->received_total != op->remote_element_count) ) + { + /* The other peer gave not enough elements before sending full done, there's something wrong. */ + LOG (GNUNET_ERROR_TYPE_ERROR, + "Other peer sent only %llu/%llu fresh elements, failing operation\n", + (unsigned long long) op->received_total, + (unsigned long long) op->remote_element_count); + GNUNET_break_op (0); + fail_union_operation (op); + return; + } + LOG (GNUNET_ERROR_TYPE_DEBUG, "got FULL DONE, sending elements that other peer is missing\n"); @@ -2473,7 +3814,9 @@ handle_union_p2p_full_done (void *cls, GNUNET_CONTAINER_multihashmap32_iterate (op->key_to_element, &send_missing_full_elements_iter, op); - perf_rtt.full_done.sent += 1; +#if MEASURE_PERFORMANCE + perf_store.full_done.sent += 1; +#endif ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_DONE); GNUNET_MQ_send (op->mq, ev); @@ -2552,8 +3895,23 @@ handle_union_p2p_demand (void *cls, unsigned int num_hashes; struct GNUNET_MQ_Envelope *ev; - perf_rtt.demand.received += 1; - perf_rtt.demand.received_var_bytes += (ntohs (mh->size) - sizeof(struct GNUNET_MessageHeader)); + /** + * Check that the message is received only in supported phase + */ + uint8_t allowed_phases[] = {PHASE_ACTIVE_DECODING, PHASE_PASSIVE_DECODING, + PHASE_FINISH_WAITING}; + if (GNUNET_OK != + check_valid_phase (allowed_phases,sizeof(allowed_phases),op)) + { + GNUNET_break (0); + fail_union_operation (op); + return; + } +#if MEASURE_PERFORMANCE + perf_store.demand.received += 1; + perf_store.demand.received_var_bytes += (ntohs (mh->size) - sizeof(struct + GNUNET_MessageHeader)); +#endif num_hashes = (ntohs (mh->size) - sizeof(struct GNUNET_MessageHeader)) / sizeof(struct GNUNET_HashCode); @@ -2570,6 +3928,39 @@ handle_union_p2p_demand (void *cls, fail_union_operation (op); return; } + + /* Save send demand message for message control */ + if (GNUNET_YES != + update_message_control_flow ( + op->message_control_flow, + MSG_CFS_RECEIVED, + &ee->element_hash, + DEMAND_MESSAGE) + ) + { + LOG (GNUNET_ERROR_TYPE_ERROR, + "Double demand message received found!\n"); + GNUNET_break (0); + fail_union_operation (op); + return; + } + ; + + /* Mark element to be expected to received */ + if (GNUNET_YES != + update_message_control_flow ( + op->message_control_flow, + MSG_CFS_SENT, + &ee->element_hash, + ELEMENT_MESSAGE) + ) + { + LOG (GNUNET_ERROR_TYPE_ERROR, + "Double element message sent found!\n"); + GNUNET_break (0); + fail_union_operation (op); + return; + } if (GNUNET_NO == _GSS_is_element_of_operation (ee, op)) { /* Probably confused lazily copied sets. */ @@ -2577,8 +3968,10 @@ handle_union_p2p_demand (void *cls, fail_union_operation (op); return; } - perf_rtt.element.sent += 1; - perf_rtt.element.sent_var_bytes += ee->element.size; +#if MEASURE_PERFORMANCE + perf_store.element.sent += 1; + perf_store.element.sent_var_bytes += ee->element.size; +#endif ev = GNUNET_MQ_msg_extra (emsg, ee->element.size, GNUNET_MESSAGE_TYPE_SETU_P2P_ELEMENTS); @@ -2600,9 +3993,10 @@ handle_union_p2p_demand (void *cls, if (op->symmetric) send_client_element (op, &ee->element, - GNUNET_SET_STATUS_ADD_REMOTE); + GNUNET_SETU_STATUS_ADD_REMOTE); } GNUNET_CADET_receive_done (op->channel); + maybe_finish (op); } @@ -2653,9 +4047,23 @@ handle_union_p2p_offer (void *cls, struct Operation *op = cls; const struct GNUNET_HashCode *hash; unsigned int num_hashes; + /** + * Check that the message is received only in supported phase + */ + uint8_t allowed_phases[] = {PHASE_ACTIVE_DECODING, PHASE_PASSIVE_DECODING}; + if (GNUNET_OK != + check_valid_phase (allowed_phases,sizeof(allowed_phases),op)) + { + GNUNET_break (0); + fail_union_operation (op); + return; + } - perf_rtt.offer.received += 1; - perf_rtt.offer.received_var_bytes += (ntohs (mh->size) - sizeof(struct GNUNET_MessageHeader)); +#if MEASURE_PERFORMANCE + perf_store.offer.received += 1; + perf_store.offer.received_var_bytes += (ntohs (mh->size) - sizeof(struct + GNUNET_MessageHeader)); +#endif num_hashes = (ntohs (mh->size) - sizeof(struct GNUNET_MessageHeader)) / sizeof(struct GNUNET_HashCode); @@ -2693,11 +4101,68 @@ handle_union_p2p_offer (void *cls, "[OP %p] Requesting element (hash %s)\n", op, GNUNET_h2s (hash)); - perf_rtt.demand.sent += 1; - perf_rtt.demand.sent_var_bytes += sizeof(struct GNUNET_HashCode); +#if MEASURE_PERFORMANCE + perf_store.demand.sent += 1; + perf_store.demand.sent_var_bytes += sizeof(struct GNUNET_HashCode); +#endif ev = GNUNET_MQ_msg_header_extra (demands, sizeof(struct GNUNET_HashCode), GNUNET_MESSAGE_TYPE_SETU_P2P_DEMAND); + /* Save send demand message for message control */ + if (GNUNET_YES != + update_message_control_flow ( + op->message_control_flow, + MSG_CFS_SENT, + hash, + DEMAND_MESSAGE) + ) + { + // GNUNET_free (ev); + LOG (GNUNET_ERROR_TYPE_ERROR, + "Double demand message sent found!\n"); + GNUNET_break (0); + fail_union_operation (op); + return; + } + ; + + /* Mark offer as received received */ + if (GNUNET_YES != + update_message_control_flow ( + op->message_control_flow, + MSG_CFS_RECEIVED, + hash, + OFFER_MESSAGE) + ) + { + // GNUNET_free (ev); + LOG (GNUNET_ERROR_TYPE_ERROR, + "Double offer message received found!\n"); + GNUNET_break (0); + fail_union_operation (op); + return; + } + ; + + /* Mark element to be expected to received */ + if (GNUNET_YES != + update_message_control_flow ( + op->message_control_flow, + MSG_CFS_EXPECTED, + hash, + ELEMENT_MESSAGE) + ) + { + // GNUNET_free (ev); + LOG (GNUNET_ERROR_TYPE_ERROR, + "Element already expected!\n"); + GNUNET_break (0); + fail_union_operation (op); + return; + } + ; + + GNUNET_memcpy (&demands[1], hash, sizeof(struct GNUNET_HashCode)); @@ -2719,7 +4184,30 @@ handle_union_p2p_done (void *cls, { struct Operation *op = cls; - perf_rtt.done.received += 1; + /** + * Check that the message is received only in supported phase + */ + uint8_t allowed_phases[] = {PHASE_ACTIVE_DECODING, PHASE_PASSIVE_DECODING}; + if (GNUNET_OK != + check_valid_phase (allowed_phases,sizeof(allowed_phases),op)) + { + GNUNET_break (0); + fail_union_operation (op); + return; + } + + if (op->active_passive_switch_required) + { + LOG (GNUNET_ERROR_TYPE_ERROR, + "PROTOCOL VIOLATION: Received done but role change is necessary\n"); + GNUNET_break (0); + fail_union_operation (op); + return; + } + +#if MEASURE_PERFORMANCE + perf_store.done.received += 1; +#endif switch (op->phase) { case PHASE_PASSIVE_DECODING: @@ -2728,26 +4216,26 @@ handle_union_p2p_done (void *cls, LOG (GNUNET_ERROR_TYPE_DEBUG, "got DONE (as passive partner), waiting for our demands to be satisfied\n"); /* The active peer is done sending offers - * and inquiries. This means that all - * our responses to that (demands and offers) - * must be in flight (queued or in mesh). - * - * We should notify the active peer once - * all our demands are satisfied, so that the active - * peer can quit if we gave it everything. - */GNUNET_CADET_receive_done (op->channel); + * and inquiries. This means that all + * our responses to that (demands and offers) + * must be in flight (queued or in mesh). + * + * We should notify the active peer once + * all our demands are satisfied, so that the active + * peer can quit if we gave it everything. + */GNUNET_CADET_receive_done (op->channel); maybe_finish (op); return; case PHASE_ACTIVE_DECODING: LOG (GNUNET_ERROR_TYPE_DEBUG, "got DONE (as active partner), waiting to finish\n"); /* All demands of the other peer are satisfied, - * and we processed all offers, thus we know - * exactly what our demands must be. - * - * We'll close the channel - * to the other peer once our demands are met. - */op->phase = PHASE_FINISH_CLOSING; + * and we processed all offers, thus we know + * exactly what our demands must be. + * + * We'll close the channel + * to the other peer once our demands are met. + */op->phase = PHASE_FINISH_CLOSING; GNUNET_CADET_receive_done (op->channel); maybe_finish (op); return; @@ -2769,7 +4257,9 @@ static void handle_union_p2p_over (void *cls, const struct GNUNET_MessageHeader *mh) { - perf_rtt.over.received += 1; +#if MEASURE_PERFORMANCE + perf_store.over.received += 1; +#endif send_client_done (cls); } @@ -2943,7 +4433,7 @@ check_incoming_msg (void *cls, struct Listener *listener = op->listener; const struct GNUNET_MessageHeader *nested_context; - /* double operation request */ + /* double operation request */ if (0 != op->suggest_id) { GNUNET_break_op (0); @@ -3053,10 +4543,10 @@ handle_client_create_set (void *cls, } set = GNUNET_new (struct Set); { - struct StrataEstimator *se; + struct MultiStrataEstimator *se; se = strata_estimator_create (SE_STRATA_COUNT, - SE_IBF_SIZE, + SE_IBFS_TOTAL_SIZE, SE_IBF_HASH_NUM); if (NULL == se) { @@ -3198,6 +4688,7 @@ channel_window_cb (void *cls, * @param cls client that sent the message * @param msg message sent by the client */ + static void handle_client_listen (void *cls, const struct GNUNET_SETU_ListenMessage *msg) @@ -3240,10 +4731,10 @@ handle_client_listen (void *cls, GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_DONE, struct GNUNET_MessageHeader, NULL), - GNUNET_MQ_hd_fixed_size (union_p2p_request_full, - GNUNET_MESSAGE_TYPE_SETU_P2P_REQUEST_FULL, - struct GNUNET_MessageHeader, - NULL), + GNUNET_MQ_hd_var_size (union_p2p_request_full, + GNUNET_MESSAGE_TYPE_SETU_P2P_REQUEST_FULL, + struct TransmitFullMessage, + NULL), GNUNET_MQ_hd_var_size (union_p2p_strata_estimator, GNUNET_MESSAGE_TYPE_SETU_P2P_SE, struct StrataEstimatorMessage, @@ -3256,6 +4747,10 @@ handle_client_listen (void *cls, GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_ELEMENT, struct GNUNET_SETU_ElementMessage, NULL), + GNUNET_MQ_hd_var_size (union_p2p_send_full, + GNUNET_MESSAGE_TYPE_SETU_P2P_SEND_FULL, + struct TransmitFullMessage, + NULL), GNUNET_MQ_handler_end () }; struct Listener *listener; @@ -3451,6 +4946,7 @@ handle_client_evaluate (void *cls, { struct ClientState *cs = cls; struct Operation *op = GNUNET_new (struct Operation); + const struct GNUNET_MQ_MessageHandler cadet_handlers[] = { GNUNET_MQ_hd_var_size (incoming_msg, GNUNET_MESSAGE_TYPE_SETU_P2P_OPERATION_REQUEST, @@ -3488,10 +4984,10 @@ handle_client_evaluate (void *cls, GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_DONE, struct GNUNET_MessageHeader, op), - GNUNET_MQ_hd_fixed_size (union_p2p_request_full, - GNUNET_MESSAGE_TYPE_SETU_P2P_REQUEST_FULL, - struct GNUNET_MessageHeader, - op), + GNUNET_MQ_hd_var_size (union_p2p_request_full, + GNUNET_MESSAGE_TYPE_SETU_P2P_REQUEST_FULL, + struct TransmitFullMessage, + op), GNUNET_MQ_hd_var_size (union_p2p_strata_estimator, GNUNET_MESSAGE_TYPE_SETU_P2P_SE, struct StrataEstimatorMessage, @@ -3504,6 +5000,10 @@ handle_client_evaluate (void *cls, GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_ELEMENT, struct GNUNET_SETU_ElementMessage, op), + GNUNET_MQ_hd_var_size (union_p2p_send_full, + GNUNET_MESSAGE_TYPE_SETU_P2P_SEND_FULL, + struct TransmitFullMessage, + NULL), GNUNET_MQ_handler_end () }; struct Set *set; @@ -3525,8 +5025,23 @@ handle_client_evaluate (void *cls, op->force_full = msg->force_full; op->force_delta = msg->force_delta; op->symmetric = msg->symmetric; + op->rtt_bandwidth_tradeoff = msg->bandwidth_latency_tradeoff; + op->ibf_bucket_number_factor = msg->ibf_bucket_number_factor; + op->ibf_number_buckets_per_element = msg->ibf_number_of_buckets_per_element; + op->byzantine_upper_bound = msg->byzantine_upper_bond; + op->active_passive_switch_required = false; context = GNUNET_MQ_extract_nested_mh (msg); + /* create hashmap for message control */ + op->message_control_flow = GNUNET_CONTAINER_multihashmap_create (32, + GNUNET_NO); + op->inquiries_sent = GNUNET_CONTAINER_multihashmap_create (32,GNUNET_NO); + +#if MEASURE_PERFORMANCE + /* load config */ + load_config (op); +#endif + /* Advance generation values, so that mutations won't interfer with the running operation. */ op->set = set; @@ -3550,7 +5065,9 @@ handle_client_evaluate (void *cls, struct GNUNET_MQ_Envelope *ev; struct OperationRequestMessage *msg; - perf_rtt.operation_request.sent += 1; +#if MEASURE_PERFORMANCE + perf_store.operation_request.sent += 1; +#endif ev = GNUNET_MQ_msg_nested_mh (msg, GNUNET_MESSAGE_TYPE_SETU_P2P_OPERATION_REQUEST, context); @@ -3567,7 +5084,11 @@ handle_client_evaluate (void *cls, op->se = strata_estimator_dup (op->set->se); /* we started the operation, thus we have to send the operation request */ op->phase = PHASE_EXPECT_SE; - op->salt_receive = op->salt_send = 42; // FIXME????? + + op->salt_receive = (op->peer_site + 1) % 2; + op->salt_send = op->peer_site; // FIXME????? + + LOG (GNUNET_ERROR_TYPE_DEBUG, "Initiating union operation evaluation\n"); GNUNET_STATISTICS_update (_GSS_statistics, @@ -3711,6 +5232,20 @@ handle_client_accept (void *cls, op->force_full = msg->force_full; op->force_delta = msg->force_delta; op->symmetric = msg->symmetric; + op->rtt_bandwidth_tradeoff = msg->bandwidth_latency_tradeoff; + op->ibf_bucket_number_factor = msg->ibf_bucket_number_factor; + op->ibf_number_buckets_per_element = msg->ibf_number_of_buckets_per_element; + op->byzantine_upper_bound = msg->byzantine_upper_bond; + op->active_passive_switch_required = false; + /* create hashmap for message control */ + op->message_control_flow = GNUNET_CONTAINER_multihashmap_create (32, + GNUNET_NO); + op->inquiries_sent = GNUNET_CONTAINER_multihashmap_create (32,GNUNET_NO); + +#if MEASURE_PERFORMANCE + /* load config */ + load_config (op); +#endif /* Advance generation values, so that future mutations do not interfer with the running operation. */ @@ -3729,7 +5264,7 @@ handle_client_accept (void *cls, 1, GNUNET_NO); { - const struct StrataEstimator *se; + struct MultiStrataEstimator *se; struct GNUNET_MQ_Envelope *ev; struct StrataEstimatorMessage *strata_msg; char *buf; @@ -3739,20 +5274,40 @@ handle_client_accept (void *cls, op->se = strata_estimator_dup (op->set->se); op->demanded_hashes = GNUNET_CONTAINER_multihashmap_create (32, GNUNET_NO); - op->salt_receive = op->salt_send = 42; // FIXME????? + op->salt_receive = (op->peer_site + 1) % 2; + op->salt_send = op->peer_site; // FIXME????? initialize_key_to_element (op); op->initial_size = GNUNET_CONTAINER_multihashmap32_size ( op->key_to_element); /* kick off the operation */ se = op->se; - buf = GNUNET_malloc (se->strata_count * IBF_BUCKET_SIZE * se->ibf_size); + + uint8_t se_count = 1; + if (op->initial_size > 0) + { + op->total_elements_size_local = 0; + GNUNET_CONTAINER_multihashmap_iterate (op->set->content->elements, + & + determinate_avg_element_size_iterator, + op); + se_count = determine_strata_count ( + op->total_elements_size_local / op->initial_size, + op->initial_size); + } + buf = GNUNET_malloc (se->stratas[0]->strata_count * IBF_BUCKET_SIZE + * ((SE_IBFS_TOTAL_SIZE / 8) * se_count)); len = strata_estimator_write (se, + SE_IBFS_TOTAL_SIZE, + se_count, buf); - perf_rtt.se.sent += 1; - perf_rtt.se.sent_var_bytes += len; +#if MEASURE_PERFORMANCE + perf_store.se.sent += 1; + perf_store.se.sent_var_bytes += len; +#endif - if (len < se->strata_count * IBF_BUCKET_SIZE * se->ibf_size) + if (len < se->stratas[0]->strata_count * IBF_BUCKET_SIZE + * SE_IBFS_TOTAL_SIZE) type = GNUNET_MESSAGE_TYPE_SETU_P2P_SEC; else type = GNUNET_MESSAGE_TYPE_SETU_P2P_SE; @@ -3766,6 +5321,7 @@ handle_client_accept (void *cls, strata_msg->set_size = GNUNET_htonll (GNUNET_CONTAINER_multihashmap_size ( op->set->content->elements)); + strata_msg->se_count = se_count; GNUNET_MQ_send (op->mq, ev); op->phase = PHASE_EXPECT_IBF; @@ -3800,8 +5356,9 @@ shutdown_task (void *cls) GNUNET_YES); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "handled shutdown request\n"); - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "RTT:%f\n", calculate_perf_rtt()); +#if MEASURE_PERFORMANCE + calculate_perf_store (); +#endif } diff --git a/src/setu/gnunet-service-setu_protocol.h b/src/setu/gnunet-service-setu_protocol.h index a2803ee47..d8f34f69c 100644 --- a/src/setu/gnunet-service-setu_protocol.h +++ b/src/setu/gnunet-service-setu_protocol.h @@ -39,11 +39,6 @@ struct OperationRequestMessage */ struct GNUNET_MessageHeader header; - /** - * Operation to request, values from `enum GNUNET_SET_OperationType` - */ - uint32_t operation GNUNET_PACKED; - /** * For Intersection: my element count */ @@ -72,20 +67,9 @@ struct IBFMessage struct GNUNET_MessageHeader header; /** - * Order of the whole ibf, where - * num_buckets = 2^order - */ - uint8_t order; - - /** - * Padding, must be 0. + * Size of the whole ibf (number of buckets) */ - uint8_t reserved1; - - /** - * Padding, must be 0. - */ - uint16_t reserved2 GNUNET_PACKED; + uint32_t ibf_size; /** * Offset of the strata in the rest of the message @@ -95,10 +79,22 @@ struct IBFMessage /** * Salt used when hashing elements for this IBF. */ - uint32_t salt GNUNET_PACKED; + uint16_t salt GNUNET_PACKED; + /** + * The bit lenght of the counter + */ + uint16_t ibf_counter_bit_length; /* rest: buckets */ }; +/** +estimate_best_mode_of_operation (uint64_t avg_element_size, +uint64_t local_set_size, + uint64_t remote_set_size, +uint64_t est_set_diff_remote, + uint64_t est_set_diff_local,) + **/ + struct InquiryMessage @@ -113,11 +109,6 @@ struct InquiryMessage */ uint32_t salt GNUNET_PACKED; - /** - * Reserved, set to 0. - */ - uint32_t reserved GNUNET_PACKED; - /* rest: inquiry IBF keys */ }; @@ -218,9 +209,47 @@ struct StrataEstimatorMessage */ struct GNUNET_MessageHeader header; + /** + * The number of ses transmitted + */ + uint8_t se_count; + + /** + * Size of the local set + */ uint64_t set_size; }; + +/** + * Message which signals to other peer that we are sending full set + * + */ +struct TransmitFullMessage +{ + /** + * Type: #GNUNET_MESSAGE_TYPE_SETU_P2P_SEND_FULL + */ + struct GNUNET_MessageHeader header; + + /** + * Remote set difference calculated with strata estimator + */ + uint32_t remote_set_difference; + + /** + * Total remote set size + */ + uint32_t remote_set_size; + + /** + * Local set difference calculated with strata estimator + */ + uint32_t local_set_difference; + +}; + + GNUNET_NETWORK_STRUCT_END #endif diff --git a/src/setu/gnunet-service-setu_strata_estimator.c b/src/setu/gnunet-service-setu_strata_estimator.c index 7c9a4deb6..7981cc847 100644 --- a/src/setu/gnunet-service-setu_strata_estimator.c +++ b/src/setu/gnunet-service-setu_strata_estimator.c @@ -22,6 +22,7 @@ * @brief invertible bloom filter * @author Florian Dold * @author Christian Grothoff + * @author Elias Summermatter */ #include "platform.h" #include "gnunet_util_lib.h" @@ -29,6 +30,82 @@ #include "gnunet-service-setu_strata_estimator.h" +/** + * Should we try compressing the strata estimator? This will + * break compatibility with the 0.10.1-network. + */ +#define FAIL_10_1_COMPATIBILTIY 1 + +/** + * Number of strata estimators in memory NOT transmitted + */ + +#define MULTI_SE_BASE_COUNT 8 + +/** + * The avg size of 1 se + * Based on the bsc thesis of Elias Summermatter (2021) + */ + +#define AVG_BYTE_SIZE_SE 4221 + +/** + * Calculates the optimal number of strata Estimators to send + * @param avg_element_size + * @param element_count + * @return + */ +uint8_t +determine_strata_count (uint64_t avg_element_size, uint64_t element_count) +{ + uint64_t base_size = avg_element_size * element_count; + /* >67kb total size of elements in set */ + if (base_size < AVG_BYTE_SIZE_SE * 16) + return 1; + /* >270kb total size of elements in set */ + if (base_size < AVG_BYTE_SIZE_SE * 64) + return 2; + /* >1mb total size of elements in set */ + if (base_size < AVG_BYTE_SIZE_SE * 256) + return 4; + return 8; +} + + +/** + * Modify an IBF key @a k_in based on the @a salt, returning a + * salted key in @a k_out. + */ +static void +salt_key (const struct IBF_Key *k_in, + uint32_t salt, + struct IBF_Key *k_out) +{ + int s = (salt * 7) % 64; + uint64_t x = k_in->key_val; + + /* rotate ibf key */ + x = (x >> s) | (x << (64 - s)); + k_out->key_val = x; +} + + +/** + * Reverse modification done in the salt_key function + */ +static void +unsalt_key (const struct IBF_Key *k_in, + uint32_t salt, + struct IBF_Key *k_out) +{ + int s = (salt * 7) % 64; + uint64_t x = k_in->key_val; + + x = (x << s) | (x >> (64 - s)); + k_out->key_val = x; +} + + /** * Write the given strata estimator to the buffer. * @@ -37,21 +114,33 @@ * @return number of bytes written to @a buf */ size_t -strata_estimator_write (const struct StrataEstimator *se, +strata_estimator_write (struct MultiStrataEstimator *se, + uint16_t se_ibf_total_size, + uint8_t number_se_send, void *buf) { char *sbuf = buf; + unsigned int i; size_t osize; + uint64_t sbuf_offset = 0; + se->size = number_se_send; GNUNET_assert (NULL != se); - for (unsigned int i = 0; i < se->strata_count; i++) + for (uint8_t strata_ctr = 0; strata_ctr < number_se_send; strata_ctr++) { - ibf_write_slice (se->strata[i], - 0, - se->ibf_size, - &sbuf[se->ibf_size * IBF_BUCKET_SIZE * i]); + for (i = 0; i < se->stratas[strata_ctr]->strata_count; i++) + { + ibf_write_slice (se->stratas[strata_ctr]->strata[i], + 0, + se->stratas[strata_ctr]->ibf_size, + &sbuf[sbuf_offset], + 8); + sbuf_offset += se->stratas[strata_ctr]->ibf_size * IBF_BUCKET_SIZE; + } } - osize = se->ibf_size * IBF_BUCKET_SIZE * se->strata_count; + osize = ((se_ibf_total_size / 8) * number_se_send) * IBF_BUCKET_SIZE + * se->stratas[0]->strata_count; +#if FAIL_10_1_COMPATIBILTIY { char *cbuf; size_t nsize; @@ -62,13 +151,12 @@ strata_estimator_write (const struct StrataEstimator *se, &cbuf, &nsize)) { - GNUNET_memcpy (buf, - cbuf, - nsize); + GNUNET_memcpy (buf, cbuf, nsize); osize = nsize; GNUNET_free (cbuf); } } +#endif return osize; } @@ -87,15 +175,19 @@ int strata_estimator_read (const void *buf, size_t buf_len, int is_compressed, - struct StrataEstimator *se) + uint8_t number_se_received, + uint16_t se_ibf_total_size, + struct MultiStrataEstimator *se) { + unsigned int i; size_t osize; char *dbuf; dbuf = NULL; if (GNUNET_YES == is_compressed) { - osize = se->ibf_size * IBF_BUCKET_SIZE * se->strata_count; + osize = ((se_ibf_total_size / 8) * number_se_received) * IBF_BUCKET_SIZE + * se->stratas[0]->strata_count; dbuf = GNUNET_decompress (buf, buf_len, osize); @@ -108,18 +200,25 @@ strata_estimator_read (const void *buf, buf_len = osize; } - if (buf_len != se->strata_count * se->ibf_size * IBF_BUCKET_SIZE) + if (buf_len != se->stratas[0]->strata_count * ((se_ibf_total_size / 8) + * number_se_received) + * IBF_BUCKET_SIZE) { GNUNET_break (0); /* very odd error */ GNUNET_free (dbuf); return GNUNET_SYSERR; } - for (unsigned int i = 0; i < se->strata_count; i++) + for (uint8_t strata_ctr = 0; strata_ctr < number_se_received; strata_ctr++) { - ibf_read_slice (buf, 0, se->ibf_size, se->strata[i]); - buf += se->ibf_size * IBF_BUCKET_SIZE; + for (i = 0; i < se->stratas[strata_ctr]->strata_count; i++) + { + ibf_read_slice (buf, 0, se->stratas[strata_ctr]->ibf_size, + se->stratas[strata_ctr]->strata[i], 8); + buf += se->stratas[strata_ctr]->ibf_size * IBF_BUCKET_SIZE; + } } + se->size = number_se_received; GNUNET_free (dbuf); return GNUNET_OK; } @@ -132,38 +231,61 @@ strata_estimator_read (const void *buf, * @param key key to add */ void -strata_estimator_insert (struct StrataEstimator *se, +strata_estimator_insert (struct MultiStrataEstimator *se, struct IBF_Key key) { - uint64_t v; - unsigned int i; - v = key.key_val; + /* count trailing '1'-bits of v */ - for (i = 0; v & 1; v >>= 1, i++) - /* empty */; - ibf_insert (se->strata[i], key); + for (int strata_ctr = 0; strata_ctr < MULTI_SE_BASE_COUNT; strata_ctr++) + { + unsigned int i; + uint64_t v; + + struct IBF_Key salted_key; + salt_key (&key, + strata_ctr * (64 / MULTI_SE_BASE_COUNT), + &salted_key); + v = salted_key.key_val; + for (i = 0; v & 1; v >>= 1, i++) + { + ibf_insert (se->stratas[strata_ctr]->strata[i], salted_key); + } + } + /* empty */; + } /** - * Remove a key from the strata estimator. + * Remove a key from the strata estimator. (NOT USED) * * @param se strata estimator to remove the key from * @param key key to remove */ void -strata_estimator_remove (struct StrataEstimator *se, +strata_estimator_remove (struct MultiStrataEstimator *se, struct IBF_Key key) { - uint64_t v; - unsigned int i; - v = key.key_val; /* count trailing '1'-bits of v */ - for (i = 0; v & 1; v >>= 1, i++) - /* empty */; - ibf_remove (se->strata[i], key); + for (int strata_ctr = 0; strata_ctr < se->size; strata_ctr++) + { + uint64_t v; + unsigned int i; + + struct IBF_Key unsalted_key; + unsalt_key (&key, + strata_ctr * (64 / MULTI_SE_BASE_COUNT), + &unsalted_key); + + v = unsalted_key.key_val; + for (i = 0; v & 1; v >>= 1, i++) + { + /* empty */; + ibf_remove (se->stratas[strata_ctr]->strata[i], unsalted_key); + } + } } @@ -175,29 +297,42 @@ strata_estimator_remove (struct StrataEstimator *se, * @param ibf_hashnum hashnum parameter of each ibf * @return a freshly allocated, empty strata estimator, NULL on error */ -struct StrataEstimator * +struct MultiStrataEstimator * strata_estimator_create (unsigned int strata_count, uint32_t ibf_size, uint8_t ibf_hashnum) { - struct StrataEstimator *se; - - se = GNUNET_new (struct StrataEstimator); - se->strata_count = strata_count; - se->ibf_size = ibf_size; - se->strata = GNUNET_new_array (strata_count, - struct InvertibleBloomFilter *); - for (unsigned int i = 0; i < strata_count; i++) + struct MultiStrataEstimator *se; + unsigned int i; + unsigned int j; + se = GNUNET_new (struct MultiStrataEstimator); + + se->size = MULTI_SE_BASE_COUNT; + se->stratas = GNUNET_new_array (MULTI_SE_BASE_COUNT,struct StrataEstimator *); + + uint8_t ibf_prime_sizes[] = {79,79,79,79,79,79,79,79}; + + for (uint8_t strata_ctr = 0; strata_ctr < MULTI_SE_BASE_COUNT; strata_ctr++) { - se->strata[i] = ibf_create (ibf_size, ibf_hashnum); - if (NULL == se->strata[i]) + se->stratas[strata_ctr] = GNUNET_new (struct StrataEstimator); + se->stratas[strata_ctr]->strata_count = strata_count; + se->stratas[strata_ctr]->ibf_size = ibf_prime_sizes[strata_ctr]; + se->stratas[strata_ctr]->strata = GNUNET_new_array (strata_count * 4, + struct + InvertibleBloomFilter *); + for (i = 0; i < strata_count; i++) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Failed to allocate memory for strata estimator\n"); - for (unsigned int j = 0; j < i; j++) - ibf_destroy (se->strata[i]); - GNUNET_free (se); - return NULL; + se->stratas[strata_ctr]->strata[i] = ibf_create ( + ibf_prime_sizes[strata_ctr], ibf_hashnum); + if (NULL == se->stratas[strata_ctr]->strata[i]) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Failed to allocate memory for strata estimator\n"); + for (j = 0; j < i; j++) + ibf_destroy (se->stratas[strata_ctr]->strata[i]); + GNUNET_free (se); + return NULL; + } } } return se; @@ -213,46 +348,71 @@ strata_estimator_create (unsigned int strata_count, * @param se2 second strata estimator * @return the estimated difference */ -unsigned int -strata_estimator_difference (const struct StrataEstimator *se1, - const struct StrataEstimator *se2) +void +strata_estimator_difference (const struct MultiStrataEstimator *se1, + const struct MultiStrataEstimator *se2) { - unsigned int count; + int avg_local_diff = 0; + int avg_remote_diff = 0; + uint8_t number_of_estimators = se1->size; - GNUNET_assert (se1->strata_count == se2->strata_count); - count = 0; - for (int i = se1->strata_count - 1; i >= 0; i--) + for (uint8_t strata_ctr = 0; strata_ctr < number_of_estimators; strata_ctr++) { - struct InvertibleBloomFilter *diff; - /* number of keys decoded from the ibf */ - - /* FIXME: implement this without always allocating new IBFs */ - diff = ibf_dup (se1->strata[i]); - ibf_subtract (diff, - se2->strata[i]); - for (int ibf_count = 0; GNUNET_YES; ibf_count++) + GNUNET_assert (se1->stratas[strata_ctr]->strata_count == + se2->stratas[strata_ctr]->strata_count); + + + for (int i = se1->stratas[strata_ctr]->strata_count - 1; i >= 0; i--) { - int more; + struct InvertibleBloomFilter *diff; + /* number of keys decoded from the ibf */ - more = ibf_decode (diff, - NULL, - NULL); - if (GNUNET_NO == more) - { - count += ibf_count; - break; - } - /* Estimate if decoding fails or would not terminate */ - if ( (GNUNET_SYSERR == more) || - (ibf_count > diff->size) ) + /* FIXME: implement this without always allocating new IBFs */ + diff = ibf_dup (se1->stratas[strata_ctr]->strata[i]); + diff->local_decoded_count = 0; + diff->remote_decoded_count = 0; + + ibf_subtract (diff, se2->stratas[strata_ctr]->strata[i]); + + for (int ibf_count = 0; GNUNET_YES; ibf_count++) { - ibf_destroy (diff); - return count * (1 << (i + 1)); + int more; + + more = ibf_decode (diff, NULL, NULL); + if (GNUNET_NO == more) + { + se1->stratas[strata_ctr]->strata[0]->local_decoded_count += + diff->local_decoded_count; + se1->stratas[strata_ctr]->strata[0]->remote_decoded_count += + diff->remote_decoded_count; + break; + } + /* Estimate if decoding fails or would not terminate */ + if ((GNUNET_SYSERR == more) || (ibf_count > diff->size)) + { + se1->stratas[strata_ctr]->strata[0]->local_decoded_count = + se1->stratas[strata_ctr]->strata[0]->local_decoded_count * (1 << (i + + + 1)); + se1->stratas[strata_ctr]->strata[0]->remote_decoded_count = + se1->stratas[strata_ctr]->strata[0]->remote_decoded_count * (1 << (i + + + 1)); + ibf_destroy (diff); + goto break_all_counting_loops; + } } + ibf_destroy (diff); } - ibf_destroy (diff); +break_all_counting_loops:; + avg_local_diff += se1->stratas[strata_ctr]->strata[0]->local_decoded_count; + avg_remote_diff += + se1->stratas[strata_ctr]->strata[0]->remote_decoded_count; } - return count; + se1->stratas[0]->strata[0]->local_decoded_count = avg_local_diff + / number_of_estimators; + se1->stratas[0]->strata[0]->remote_decoded_count = avg_remote_diff + / number_of_estimators; } @@ -262,18 +422,28 @@ strata_estimator_difference (const struct StrataEstimator *se1, * @param se the strata estimator to copy * @return the copy */ -struct StrataEstimator * -strata_estimator_dup (struct StrataEstimator *se) +struct MultiStrataEstimator * +strata_estimator_dup (struct MultiStrataEstimator *se) { - struct StrataEstimator *c; - - c = GNUNET_new (struct StrataEstimator); - c->strata_count = se->strata_count; - c->ibf_size = se->ibf_size; - c->strata = GNUNET_new_array (se->strata_count, - struct InvertibleBloomFilter *); - for (unsigned int i = 0; i < se->strata_count; i++) - c->strata[i] = ibf_dup (se->strata[i]); + struct MultiStrataEstimator *c; + unsigned int i; + + c = GNUNET_new (struct MultiStrataEstimator); + c->stratas = GNUNET_new_array (MULTI_SE_BASE_COUNT,struct StrataEstimator *); + for (uint8_t strata_ctr = 0; strata_ctr < MULTI_SE_BASE_COUNT; strata_ctr++) + { + c->stratas[strata_ctr] = GNUNET_new (struct StrataEstimator); + c->stratas[strata_ctr]->strata_count = + se->stratas[strata_ctr]->strata_count; + c->stratas[strata_ctr]->ibf_size = se->stratas[strata_ctr]->ibf_size; + c->stratas[strata_ctr]->strata = GNUNET_new_array ( + se->stratas[strata_ctr]->strata_count, + struct + InvertibleBloomFilter *); + for (i = 0; i < se->stratas[strata_ctr]->strata_count; i++) + c->stratas[strata_ctr]->strata[i] = ibf_dup ( + se->stratas[strata_ctr]->strata[i]); + } return c; } @@ -284,10 +454,14 @@ strata_estimator_dup (struct StrataEstimator *se) * @param se strata estimator to destroy. */ void -strata_estimator_destroy (struct StrataEstimator *se) +strata_estimator_destroy (struct MultiStrataEstimator *se) { - for (unsigned int i = 0; i < se->strata_count; i++) - ibf_destroy (se->strata[i]); - GNUNET_free (se->strata); + unsigned int i; + for (uint8_t strata_ctr = 0; strata_ctr < MULTI_SE_BASE_COUNT; strata_ctr++) + { + for (i = 0; i < se->stratas[strata_ctr]->strata_count; i++) + ibf_destroy (se->stratas[strata_ctr]->strata[i]); + GNUNET_free (se->stratas[strata_ctr]->strata); + } GNUNET_free (se); } diff --git a/src/setu/gnunet-service-setu_strata_estimator.h b/src/setu/gnunet-service-setu_strata_estimator.h index afdbcdbbf..4871a7fcd 100644 --- a/src/setu/gnunet-service-setu_strata_estimator.h +++ b/src/setu/gnunet-service-setu_strata_estimator.h @@ -22,6 +22,7 @@ * @file set/gnunet-service-setu_strata_estimator.h * @brief estimator of set difference * @author Florian Dold + * @author Elias Summermatter */ #ifndef GNUNET_SERVICE_SETU_STRATA_ESTIMATOR_H @@ -61,6 +62,31 @@ struct StrataEstimator unsigned int ibf_size; }; +struct MultiStrataEstimator +{ + /** + * Array of strata estimators + */ + struct StrataEstimator **stratas; + + /** + * Number of strata estimators in struct + */ + uint8_t size; + +}; + +/** + * Deteminate how many strata estimators in the message are necessary + * @param avg_element_size + * @param element_count + * @return number of strata's + */ + +uint8_t +determine_strata_count (uint64_t avg_element_size, + uint64_t element_count); + /** * Write the given strata estimator to the buffer. @@ -70,7 +96,9 @@ struct StrataEstimator * @return number of bytes written to @a buf */ size_t -strata_estimator_write (const struct StrataEstimator *se, +strata_estimator_write (struct MultiStrataEstimator *se, + uint16_t se_ibf_total_size, + uint8_t number_se_send, void *buf); @@ -88,7 +116,9 @@ int strata_estimator_read (const void *buf, size_t buf_len, int is_compressed, - struct StrataEstimator *se); + uint8_t number_se_received, + uint16_t se_ibf_total_size, + struct MultiStrataEstimator *se); /** @@ -99,7 +129,7 @@ strata_estimator_read (const void *buf, * @param ibf_hashnum hashnum parameter of each ibf * @return a freshly allocated, empty strata estimator, NULL on error */ -struct StrataEstimator * +struct MultiStrataEstimator * strata_estimator_create (unsigned int strata_count, uint32_t ibf_size, uint8_t ibf_hashnum); @@ -111,11 +141,11 @@ strata_estimator_create (unsigned int strata_count, * * @param se1 first strata estimator * @param se2 second strata estimator - * @return abs(|se1| - |se2|) + * @return nothing */ -unsigned int -strata_estimator_difference (const struct StrataEstimator *se1, - const struct StrataEstimator *se2); +void +strata_estimator_difference (const struct MultiStrataEstimator *se1, + const struct MultiStrataEstimator *se2); /** @@ -125,7 +155,7 @@ strata_estimator_difference (const struct StrataEstimator *se1, * @param key key to add */ void -strata_estimator_insert (struct StrataEstimator *se, +strata_estimator_insert (struct MultiStrataEstimator *se, struct IBF_Key key); @@ -136,7 +166,7 @@ strata_estimator_insert (struct StrataEstimator *se, * @param key key to remove */ void -strata_estimator_remove (struct StrataEstimator *se, +strata_estimator_remove (struct MultiStrataEstimator *se, struct IBF_Key key); @@ -146,7 +176,7 @@ strata_estimator_remove (struct StrataEstimator *se, * @param se strata estimator to destroy. */ void -strata_estimator_destroy (struct StrataEstimator *se); +strata_estimator_destroy (struct MultiStrataEstimator *se); /** @@ -155,8 +185,8 @@ strata_estimator_destroy (struct StrataEstimator *se); * @param se the strata estimator to copy * @return the copy */ -struct StrataEstimator * -strata_estimator_dup (struct StrataEstimator *se); +struct MultiStrataEstimator * +strata_estimator_dup (struct MultiStrataEstimator *se); #if 0 /* keep Emacsens' auto-indent happy */ diff --git a/src/setu/ibf.c b/src/setu/ibf.c index 1beba9065..8f29adb62 100644 --- a/src/setu/ibf.c +++ b/src/setu/ibf.c @@ -20,11 +20,15 @@ /** * @file set/ibf.c - * @brief implementation of the invertible Bloom filter + * @brief implementation of the invertible bloom filter * @author Florian Dold + * @author Elias Summermatter */ #include "ibf.h" +#include "gnunet_util_lib.h" +#define LOG(kind, ...) GNUNET_log_from (kind, "setu", __VA_ARGS__) + /** * Compute the key's hash from the key. @@ -58,11 +62,12 @@ ibf_hashcode_from_key (struct IBF_Key key, struct GNUNET_HashCode *dst) { struct IBF_Key *p; + unsigned int i; const unsigned int keys_per_hashcode = sizeof(struct GNUNET_HashCode) / sizeof(struct IBF_Key); p = (struct IBF_Key *) dst; - for (unsigned int i = 0; i < keys_per_hashcode; i++) + for (i = 0; i < keys_per_hashcode; i++) *p++ = key; } @@ -75,14 +80,14 @@ ibf_hashcode_from_key (struct IBF_Key key, * @return the newly created invertible bloom filter, NULL on error */ struct InvertibleBloomFilter * -ibf_create (uint32_t size, - uint8_t hash_num) +ibf_create (uint32_t size, uint8_t hash_num) { struct InvertibleBloomFilter *ibf; GNUNET_assert (0 != size); + ibf = GNUNET_new (struct InvertibleBloomFilter); - ibf->count = GNUNET_malloc_large (size * sizeof(uint8_t)); + ibf->count = GNUNET_malloc_large (size * sizeof(uint64_t)); if (NULL == ibf->count) { GNUNET_free (ibf); @@ -105,6 +110,7 @@ ibf_create (uint32_t size, } ibf->size = size; ibf->hash_num = hash_num; + return ibf; } @@ -121,8 +127,7 @@ ibf_get_indices (const struct InvertibleBloomFilter *ibf, uint32_t i; uint32_t bucket; - bucket = GNUNET_CRYPTO_crc32_n (&key, - sizeof (key)); + bucket = GNUNET_CRYPTO_crc32_n (&key, sizeof key); for (i = 0, filled = 0; filled < ibf->hash_num; i++) { uint64_t x; @@ -133,8 +138,7 @@ ibf_get_indices (const struct InvertibleBloomFilter *ibf, dst[filled++] = bucket % ibf->size; try_next: x = ((uint64_t) bucket << 32) | i; - bucket = GNUNET_CRYPTO_crc32_n (&x, - sizeof (x)); + bucket = GNUNET_CRYPTO_crc32_n (&x, sizeof x); } } @@ -170,13 +174,8 @@ ibf_insert (struct InvertibleBloomFilter *ibf, int buckets[ibf->hash_num]; GNUNET_assert (ibf->hash_num <= ibf->size); - ibf_get_indices (ibf, - key, - buckets); - ibf_insert_into (ibf, - key, - buckets, - 1); + ibf_get_indices (ibf, key, buckets); + ibf_insert_into (ibf, key, buckets, 1); } @@ -193,13 +192,8 @@ ibf_remove (struct InvertibleBloomFilter *ibf, int buckets[ibf->hash_num]; GNUNET_assert (ibf->hash_num <= ibf->size); - ibf_get_indices (ibf, - key, - buckets); - ibf_insert_into (ibf, - key, - buckets, - -1); + ibf_get_indices (ibf, key, buckets); + ibf_insert_into (ibf, key, buckets, -1); } @@ -244,6 +238,8 @@ ibf_decode (struct InvertibleBloomFilter *ibf, for (uint32_t i = 0; i < ibf->size; i++) { + int hit; + /* we can only decode from pure buckets */ if ( (1 != ibf->count[i].count_val) && (-1 != ibf->count[i].count_val) ) @@ -257,30 +253,33 @@ ibf_decode (struct InvertibleBloomFilter *ibf, /* test if key in bucket hits its own location, * if not, the key hash was subject to collision */ - { - bool hit = false; + hit = GNUNET_NO; + ibf_get_indices (ibf, ibf->key_sum[i], buckets); + for (int j = 0; j < ibf->hash_num; j++) + if (buckets[j] == i) + hit = GNUNET_YES; - ibf_get_indices (ibf, - ibf->key_sum[i], - buckets); - for (int j = 0; j < ibf->hash_num; j++) - if (buckets[j] == i) - { - hit = true; - break; - } - if (! hit) - continue; + if (GNUNET_NO == hit) + continue; + + if (1 == ibf->count[i].count_val) + { + ibf->remote_decoded_count++; } + else + { + ibf->local_decoded_count++; + } + + if (NULL != ret_side) *ret_side = ibf->count[i].count_val; if (NULL != ret_id) *ret_id = ibf->key_sum[i]; /* insert on the opposite side, effectively removing the element */ - ibf_insert_into (ibf, - ibf->key_sum[i], buckets, - -ibf->count[i].count_val); + ibf_insert_into (ibf, ibf->key_sum[i], buckets, -ibf->count[i].count_val); + return GNUNET_YES; } @@ -290,6 +289,26 @@ ibf_decode (struct InvertibleBloomFilter *ibf, } +/** + * Returns the minimal bytes needed to store the counter of the IBF + * + * @param ibf the IBF + */ +uint8_t +ibf_get_max_counter (struct InvertibleBloomFilter *ibf) +{ + long long max_counter = 0; + for (uint64_t i = 0; i < ibf->size; i++) + { + if (ibf->count[i].count_val > max_counter) + { + max_counter = ibf->count[i].count_val; + } + } + return 64 - __builtin_clzll (max_counter); +} + + /** * Write buckets from an ibf to a buffer. * Exactly (IBF_BUCKET_SIZE*ibf->size) bytes are written to buf. @@ -298,16 +317,17 @@ ibf_decode (struct InvertibleBloomFilter *ibf, * @param start with which bucket to start * @param count how many buckets to write * @param buf buffer to write the data to + * @param max bit length of a counter for unpacking */ void ibf_write_slice (const struct InvertibleBloomFilter *ibf, uint32_t start, - uint32_t count, - void *buf) + uint64_t count, + void *buf, + uint8_t counter_max_length) { struct IBF_Key *key_dst; struct IBF_KeyHash *key_hash_dst; - struct IBF_Count *count_dst; GNUNET_assert (start + count <= ibf->size); @@ -315,19 +335,182 @@ ibf_write_slice (const struct InvertibleBloomFilter *ibf, key_dst = (struct IBF_Key *) buf; GNUNET_memcpy (key_dst, ibf->key_sum + start, - count * sizeof *key_dst); + count * sizeof(*key_dst)); key_dst += count; /* copy key hashes */ key_hash_dst = (struct IBF_KeyHash *) key_dst; GNUNET_memcpy (key_hash_dst, ibf->key_hash_sum + start, - count * sizeof *key_hash_dst); + count * sizeof(*key_hash_dst)); key_hash_dst += count; - /* copy counts */ - count_dst = (struct IBF_Count *) key_hash_dst; - GNUNET_memcpy (count_dst, - ibf->count + start, - count * sizeof *count_dst); + + /* pack and copy counter */ + pack_counter (ibf, + start, + count, + (uint8_t *) key_hash_dst, + counter_max_length); + + +} + + +/** + * Packs the counter to transmit only the smallest possible amount of bytes and + * preventing overflow of the counter + * @param ibf the ibf to write + * @param start with which bucket to start + * @param count how many buckets to write + * @param buf buffer to write the data to + * @param max bit length of a counter for unpacking + */ + +void +pack_counter (const struct InvertibleBloomFilter *ibf, + uint32_t start, + uint64_t count, + uint8_t *buf, + uint8_t counter_max_length) +{ + uint8_t store_size = 0; + uint8_t store = 0; + uint16_t byte_ctr = 0; + + /** + * Iterate over IBF bucket + */ + for (uint64_t i = start; i< (count + start);) + { + uint64_t count_val_to_write = ibf->count[i].count_val; + uint8_t count_len_to_write = counter_max_length; + + /** + * Pack and compose counters to byte values + */ + while ((count_len_to_write + store_size) >= 8) + { + uint8_t bit_shift = 0; + + /** + * Shift bits if more than a byte has to be written + * or the store size is not empty + */ + if ((store_size > 0) || (count_len_to_write > 8)) + { + uint8_t bit_unused = 8 - store_size; + bit_shift = count_len_to_write - bit_unused; + store = store << bit_unused; + } + + buf[byte_ctr] = ((count_val_to_write >> bit_shift) | store) & 0xFF; + byte_ctr++; + count_len_to_write -= (8 - store_size); + count_val_to_write = count_val_to_write & ((1ULL << + count_len_to_write) - 1); + store = 0; + store_size = 0; + } + store = (store << count_len_to_write) | count_val_to_write; + store_size = store_size + count_len_to_write; + count_len_to_write = 0; + i++; + } + + /** + * Pack data left in story before finishing + */ + if (store_size > 0) + { + buf[byte_ctr] = store << (8 - store_size); + byte_ctr++; + } + +} + + +/** + * Unpacks the counter to transmit only the smallest possible amount of bytes and + * preventing overflow of the counter + * @param ibf the ibf to write + * @param start with which bucket to start + * @param count how many buckets to write + * @param buf buffer to write the data to + * @param max bit length of a counter for unpacking + */ + +void +unpack_counter (const struct InvertibleBloomFilter *ibf, + uint32_t start, + uint64_t count, + uint8_t *buf, + uint8_t counter_max_length) +{ + uint64_t ibf_counter_ctr = 0; + uint64_t store = 0; + uint64_t store_bit_ctr = 0; + uint64_t byte_ctr = 0; + + /** + * Iterate over received bytes + */ + while (true) + { + uint8_t byte_read = buf[byte_ctr]; + uint8_t bit_to_read_left = 8; + byte_ctr++; + + /** + * Pack data left in story before finishing + */ + while (bit_to_read_left >= 0) + { + /** + * Stop decoding when end is reached + */ + if (ibf_counter_ctr > (count - 1)) + return; + + /* + * Unpack the counter + */ + if ((store_bit_ctr + bit_to_read_left) >= counter_max_length) + { + uint8_t bytes_used = counter_max_length - store_bit_ctr; + if (store_bit_ctr > 0) + { + store = store << bytes_used; + } + + uint8_t bytes_to_shift = bit_to_read_left - bytes_used; + uint64_t counter_part = byte_read >> bytes_to_shift; + store = store | counter_part; + ibf->count[ibf_counter_ctr + start].count_val = store; + byte_read = byte_read & ((1 << bytes_to_shift) - 1); + bit_to_read_left -= bytes_used; + ibf_counter_ctr++; + store = 0; + store_bit_ctr = 0; + } + else + { + store_bit_ctr += bit_to_read_left; + if (0 == store) + { + store = byte_read; + } + else + { + store = store << bit_to_read_left; + store = store | byte_read; + } + break; + + } + + } + + } + } @@ -338,12 +521,14 @@ ibf_write_slice (const struct InvertibleBloomFilter *ibf, * @param start which bucket to start at * @param count how many buckets to read * @param ibf the ibf to read from + * @param max bit length of a counter for unpacking */ void ibf_read_slice (const void *buf, uint32_t start, - uint32_t count, - struct InvertibleBloomFilter *ibf) + uint64_t count, + struct InvertibleBloomFilter *ibf, + uint8_t counter_max_length) { struct IBF_Key *key_src; struct IBF_KeyHash *key_hash_src; @@ -364,11 +549,10 @@ ibf_read_slice (const void *buf, key_hash_src, count * sizeof *key_hash_src); key_hash_src += count; - /* copy counts */ + + /* copy and unpack counts */ count_src = (struct IBF_Count *) key_hash_src; - GNUNET_memcpy (ibf->count + start, - count_src, - count * sizeof *count_src); + unpack_counter (ibf,start,count,(uint8_t *) count_src,counter_max_length); } diff --git a/src/setu/ibf.h b/src/setu/ibf.h index 7c2ab33b1..5628405dc 100644 --- a/src/setu/ibf.h +++ b/src/setu/ibf.h @@ -22,6 +22,7 @@ * @file set/ibf.h * @brief invertible bloom filter * @author Florian Dold + * @author Elias Summermatter */ #ifndef GNUNET_CONSENSUS_IBF_H @@ -62,7 +63,7 @@ struct IBF_KeyHash */ struct IBF_Count { - int8_t count_val; + int64_t count_val; }; @@ -92,6 +93,20 @@ struct InvertibleBloomFilter */ uint8_t hash_num; + /** + * If an IBF is decoded this count stores how many + * elements are on the local site. This is used + * to estimate the set difference on a site + */ + int local_decoded_count; + + /** + * If an IBF is decoded this count stores how many + * elements are on the remote site. This is used + * to estimate the set difference on a site + */ + int remote_decoded_count; + /** * Xor sums of the elements' keys, used to identify the elements. * Array of 'size' elements. @@ -125,8 +140,9 @@ struct InvertibleBloomFilter void ibf_write_slice (const struct InvertibleBloomFilter *ibf, uint32_t start, - uint32_t count, - void *buf); + uint64_t count, + void *buf, + uint8_t counter_max_length); /** @@ -140,8 +156,9 @@ ibf_write_slice (const struct InvertibleBloomFilter *ibf, void ibf_read_slice (const void *buf, uint32_t start, - uint32_t count, - struct InvertibleBloomFilter *ibf); + uint64_t count, + struct InvertibleBloomFilter *ibf, + uint8_t counter_max_length); /** @@ -244,6 +261,44 @@ ibf_dup (const struct InvertibleBloomFilter *ibf); void ibf_destroy (struct InvertibleBloomFilter *ibf); +uint8_t +ibf_get_max_counter (struct InvertibleBloomFilter *ibf); + + +/** + * Packs the counter to transmit only the smallest possible amount of bytes and + * preventing overflow of the counter + * @param ibf the ibf to write + * @param start with which bucket to start + * @param count how many buckets to write + * @param buf buffer to write the data to + * @param max bit length of a counter for unpacking + */ + +void +pack_counter (const struct InvertibleBloomFilter *ibf, + uint32_t start, + uint64_t count, + uint8_t *buf, + uint8_t counter_max_length); + +/** + * Unpacks the counter to transmit only the smallest possible amount of bytes and + * preventing overflow of the counter + * @param ibf the ibf to write + * @param start with which bucket to start + * @param count how many buckets to write + * @param buf buffer to write the data to + * @param max bit length of a counter for unpacking + */ + +void +unpack_counter (const struct InvertibleBloomFilter *ibf, + uint32_t start, + uint64_t count, + uint8_t *buf, + uint8_t counter_max_length); + #if 0 /* keep Emacsens' auto-indent happy */ { diff --git a/src/setu/perf_setu_api.c b/src/setu/perf_setu_api.c index b273f9c71..af84994f8 100644 --- a/src/setu/perf_setu_api.c +++ b/src/setu/perf_setu_api.c @@ -22,11 +22,14 @@ * @file set/test_setu_api.c * @brief testcase for setu_api.c * @author Florian Dold + * @author Elias Summermatter */ #include "platform.h" #include "gnunet_util_lib.h" #include "gnunet_testing_lib.h" #include "gnunet_setu_service.h" +#include +#include static struct GNUNET_PeerIdentity local_id; @@ -50,6 +53,12 @@ static int ret; static struct GNUNET_SCHEDULER_Task *tt; +/** + * Handles configuration file for setu performance test + * + */ +static struct GNUNET_CONFIGURATION_Handle *setu_cfg; + static void result_cb_set1 (void *cls, @@ -57,44 +66,44 @@ result_cb_set1 (void *cls, uint64_t size, enum GNUNET_SETU_Status status) { - switch (status) + switch (status) + { + case GNUNET_SETU_STATUS_ADD_LOCAL: + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "set 1: got element\n"); + break; + + case GNUNET_SETU_STATUS_FAILURE: + GNUNET_break (0); + oh1 = NULL; + fprintf (stderr, "set 1: received failure status!\n"); + ret = 1; + if (NULL != tt) + { + GNUNET_SCHEDULER_cancel (tt); + tt = NULL; + } + GNUNET_SCHEDULER_shutdown (); + break; + + case GNUNET_SETU_STATUS_DONE: + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "set 1: done\n"); + oh1 = NULL; + if (NULL != set1) { - case GNUNET_SETU_STATUS_ADD_LOCAL: - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "set 1: got element\n"); - break; - - case GNUNET_SETU_STATUS_FAILURE: - GNUNET_break (0); - oh1 = NULL; - fprintf (stderr, "set 1: received failure status!\n"); - ret = 1; - if (NULL != tt) - { - GNUNET_SCHEDULER_cancel (tt); - tt = NULL; - } - GNUNET_SCHEDULER_shutdown (); - break; - - case GNUNET_SETU_STATUS_DONE: - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "set 1: done\n"); - oh1 = NULL; - if (NULL != set1) - { - GNUNET_SETU_destroy (set1); - set1 = NULL; - } - if (NULL == set2) - { - GNUNET_SCHEDULER_cancel (tt); - tt = NULL; - GNUNET_SCHEDULER_shutdown (); - } - break; - - default: - GNUNET_assert (0); + GNUNET_SETU_destroy (set1); + set1 = NULL; } + if (NULL == set2) + { + GNUNET_SCHEDULER_cancel (tt); + tt = NULL; + GNUNET_SCHEDULER_shutdown (); + } + break; + + default: + GNUNET_assert (0); + } } @@ -104,36 +113,36 @@ result_cb_set2 (void *cls, uint64_t size, enum GNUNET_SETU_Status status) { - switch (status) + switch (status) + { + case GNUNET_SETU_STATUS_ADD_LOCAL: + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "set 2: got element\n"); + break; + + case GNUNET_SETU_STATUS_FAILURE: + GNUNET_break (0); + oh2 = NULL; + fprintf (stderr, "set 2: received failure status\n"); + GNUNET_SCHEDULER_shutdown (); + ret = 1; + break; + + case GNUNET_SETU_STATUS_DONE: + oh2 = NULL; + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "set 2: done\n"); + GNUNET_SETU_destroy (set2); + set2 = NULL; + if (NULL == set1) { - case GNUNET_SETU_STATUS_ADD_LOCAL: - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "set 2: got element\n"); - break; - - case GNUNET_SETU_STATUS_FAILURE: - GNUNET_break (0); - oh2 = NULL; - fprintf (stderr, "set 2: received failure status\n"); - GNUNET_SCHEDULER_shutdown (); - ret = 1; - break; - - case GNUNET_SETU_STATUS_DONE: - oh2 = NULL; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "set 2: done\n"); - GNUNET_SETU_destroy (set2); - set2 = NULL; - if (NULL == set1) - { - GNUNET_SCHEDULER_cancel (tt); - tt = NULL; - GNUNET_SCHEDULER_shutdown (); - } - break; - - default: - GNUNET_assert (0); + GNUNET_SCHEDULER_cancel (tt); + tt = NULL; + GNUNET_SCHEDULER_shutdown (); } + break; + + default: + GNUNET_assert (0); + } } @@ -143,14 +152,14 @@ listen_cb (void *cls, const struct GNUNET_MessageHeader *context_msg, struct GNUNET_SETU_Request *request) { - GNUNET_assert (NULL != context_msg); - GNUNET_assert (ntohs (context_msg->type) == GNUNET_MESSAGE_TYPE_DUMMY); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "listen cb called\n"); - oh2 = GNUNET_SETU_accept (request, - (struct GNUNET_SETU_Option[]){ 0 }, - &result_cb_set2, - NULL); - GNUNET_SETU_commit (oh2, set2); + GNUNET_assert (NULL != context_msg); + GNUNET_assert (ntohs (context_msg->type) == GNUNET_MESSAGE_TYPE_DUMMY); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "listen cb called\n"); + oh2 = GNUNET_SETU_accept (request, + (struct GNUNET_SETU_Option[]){ 0 }, + &result_cb_set2, + NULL); + GNUNET_SETU_commit (oh2, set2); } @@ -162,122 +171,89 @@ listen_cb (void *cls, static void start (void *cls) { - struct GNUNET_MessageHeader context_msg; - - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting reconciliation\n"); - context_msg.size = htons (sizeof context_msg); - context_msg.type = htons (GNUNET_MESSAGE_TYPE_DUMMY); - listen_handle = GNUNET_SETU_listen (config, - &app_id, - &listen_cb, - NULL); - oh1 = GNUNET_SETU_prepare (&local_id, - &app_id, - &context_msg, - (struct GNUNET_SETU_Option[]){ 0 }, - &result_cb_set1, - NULL); - GNUNET_SETU_commit (oh1, set1); + struct GNUNET_MessageHeader context_msg; + + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting reconciliation\n"); + context_msg.size = htons (sizeof context_msg); + context_msg.type = htons (GNUNET_MESSAGE_TYPE_DUMMY); + listen_handle = GNUNET_SETU_listen (config, + &app_id, + &listen_cb, + NULL); + oh1 = GNUNET_SETU_prepare (&local_id, + &app_id, + &context_msg, + (struct GNUNET_SETU_Option[]){ 0 }, + &result_cb_set1, + NULL); + GNUNET_SETU_commit (oh1, set1); } -/** - * Initialize the second set, continue - * - * @param cls closure, unused - */ -static void -init_set2 (void *cls) -{ - struct GNUNET_SETU_Element element; - - GNUNET_log (GNUNET_ERROR_TYPE_INFO, "initializing set 2\n"); - - element.element_type = 0; - element.data = "hello1"; - element.size = strlen (element.data); - GNUNET_SETU_add_element (set2, &element, NULL, NULL); - element.data = "quux"; - element.size = strlen (element.data); - GNUNET_SETU_add_element (set2, &element, NULL, NULL); - element.data = "baz"; - element.size = strlen (element.data); - GNUNET_SETU_add_element (set2, &element, &start, NULL); -} - /** * Generate random byte stream */ -unsigned char *gen_rdm_bytestream (size_t num_bytes) +unsigned char * +gen_rdm_bytestream (size_t num_bytes) { - unsigned char *stream = GNUNET_malloc (num_bytes); - GNUNET_CRYPTO_random_block(GNUNET_CRYPTO_QUALITY_WEAK, stream, num_bytes); - return stream; + unsigned char *stream = GNUNET_malloc (num_bytes); + GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, stream, num_bytes); + return stream; } + /** * Generate random sets */ static void -initRandomSets(int overlap, int set1_size, int set2_size, int element_size_in_bytes) +initRandomSets (int overlap, int set1_size, int set2_size, int + element_size_in_bytes) { - struct GNUNET_SETU_Element element; - element.element_type = 0; - - // Add elements to both sets - for (int i = 0; i < overlap; i++) { - element.data = gen_rdm_bytestream(element_size_in_bytes); - element.size = element_size_in_bytes; - GNUNET_SETU_add_element (set1, &element, NULL, NULL); - GNUNET_SETU_add_element (set2, &element, NULL, NULL); - set1_size--; - set2_size--; - } - GNUNET_log (GNUNET_ERROR_TYPE_INFO, "initialized elements in both sets\n"); - - // Add other elements to set 1 - while(set1_size>0) { - element.data = gen_rdm_bytestream(element_size_in_bytes); - element.size = element_size_in_bytes; - GNUNET_SETU_add_element (set1, &element, NULL, NULL); - set1_size--; - } - GNUNET_log (GNUNET_ERROR_TYPE_INFO, "initialized elements in set1\n"); - - // Add other elements to set 2 - while(set2_size > 0) { - element.data = gen_rdm_bytestream(element_size_in_bytes); - element.size = element_size_in_bytes; + struct GNUNET_SETU_Element element; + element.element_type = 0; + + // Add elements to both sets + for (int i = 0; i < overlap; i++) + { + element.data = gen_rdm_bytestream (element_size_in_bytes); + element.size = element_size_in_bytes; + GNUNET_SETU_add_element (set1, &element, NULL, NULL); + GNUNET_SETU_add_element (set2, &element, NULL, NULL); + set1_size--; + set2_size--; + } + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "initialized elements in both sets\n"); + + // Add other elements to set 1 + while (set1_size>0) + { + element.data = gen_rdm_bytestream (element_size_in_bytes); + element.size = element_size_in_bytes; + GNUNET_SETU_add_element (set1, &element, NULL, NULL); + set1_size--; + } + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "initialized elements in set1\n"); - if(set2_size != 1) { - GNUNET_SETU_add_element (set2, &element,NULL, NULL); - } else { - GNUNET_SETU_add_element (set2, &element,&start, NULL); - } + // Add other elements to set 2 + while (set2_size > 0) + { + element.data = gen_rdm_bytestream (element_size_in_bytes); + element.size = element_size_in_bytes; - set2_size--; + if (set2_size != 1) + { + GNUNET_SETU_add_element (set2, &element,NULL, NULL); + } + else + { + GNUNET_SETU_add_element (set2, &element,&start, NULL); } - GNUNET_log (GNUNET_ERROR_TYPE_INFO, "initialized elements in set2\n"); -} - -/** - * Initialize the first set, continue. - */ -static void -init_set1 (void) -{ - struct GNUNET_SETU_Element element; - element.element_type = 0; - element.data = "hello"; - element.size = strlen (element.data); - GNUNET_SETU_add_element (set1, &element, NULL, NULL); - element.data = "bar"; - element.size = strlen (element.data); - GNUNET_SETU_add_element (set1, &element, &init_set2, NULL); - GNUNET_log (GNUNET_ERROR_TYPE_INFO, "initialized set 1\n"); + set2_size--; + } + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "initialized elements in set2\n"); } @@ -289,10 +265,10 @@ init_set1 (void) static void timeout_fail (void *cls) { - tt = NULL; - GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, "Testcase failed with timeout\n"); - GNUNET_SCHEDULER_shutdown (); - ret = 1; + tt = NULL; + GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, "Testcase failed with timeout\n"); + GNUNET_SCHEDULER_shutdown (); + ret = 1; } @@ -304,36 +280,36 @@ timeout_fail (void *cls) static void do_shutdown (void *cls) { - if (NULL != tt) - { - GNUNET_SCHEDULER_cancel (tt); - tt = NULL; - } - if (NULL != oh1) - { - GNUNET_SETU_operation_cancel (oh1); - oh1 = NULL; - } - if (NULL != oh2) - { - GNUNET_SETU_operation_cancel (oh2); - oh2 = NULL; - } - if (NULL != set1) - { - GNUNET_SETU_destroy (set1); - set1 = NULL; - } - if (NULL != set2) - { - GNUNET_SETU_destroy (set2); - set2 = NULL; - } - if (NULL != listen_handle) - { - GNUNET_SETU_listen_cancel (listen_handle); - listen_handle = NULL; - } + if (NULL != tt) + { + GNUNET_SCHEDULER_cancel (tt); + tt = NULL; + } + if (NULL != oh1) + { + GNUNET_SETU_operation_cancel (oh1); + oh1 = NULL; + } + if (NULL != oh2) + { + GNUNET_SETU_operation_cancel (oh2); + oh2 = NULL; + } + if (NULL != set1) + { + GNUNET_SETU_destroy (set1); + set1 = NULL; + } + if (NULL != set2) + { + GNUNET_SETU_destroy (set2); + set2 = NULL; + } + if (NULL != listen_handle) + { + GNUNET_SETU_listen_cancel (listen_handle); + listen_handle = NULL; + } } @@ -350,79 +326,148 @@ run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { - struct GNUNET_SETU_OperationHandle *my_oh; - - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Running preparatory tests\n"); - tt = GNUNET_SCHEDULER_add_delayed ( - GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5), - &timeout_fail, - NULL); - GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); - - config = cfg; - GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_get_peer_identity (cfg, - &local_id)); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "my id (from CRYPTO): %s\n", - GNUNET_i2s (&local_id)); - GNUNET_TESTING_peer_get_identity (peer, - &local_id); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "my id (from TESTING): %s\n", - GNUNET_i2s (&local_id)); - set1 = GNUNET_SETU_create (cfg); - set2 = GNUNET_SETU_create (cfg); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Created sets %p and %p for union operation\n", - set1, - set2); - GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &app_id); - - /* test if canceling an uncommitted request works! */ - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Launching and instantly stopping set operation\n"); - my_oh = GNUNET_SETU_prepare (&local_id, - &app_id, - NULL, - (struct GNUNET_SETU_Option[]){ 0 }, - NULL, - NULL); - GNUNET_SETU_operation_cancel (my_oh); - - /* test the real set reconciliation */ - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Running real set-reconciliation\n"); - //init_set1 (); - // limit ~23800 element total - initRandomSets(50,100,100,128); + struct GNUNET_SETU_OperationHandle *my_oh; + + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Running preparatory tests\n"); + tt = GNUNET_SCHEDULER_add_delayed ( + GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5), + &timeout_fail, + NULL); + GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); + + config = cfg; + GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_get_peer_identity (cfg, + &local_id)); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "my id (from CRYPTO): %s\n", + GNUNET_i2s (&local_id)); + GNUNET_TESTING_peer_get_identity (peer, + &local_id); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "my id (from TESTING): %s\n", + GNUNET_i2s (&local_id)); + set1 = GNUNET_SETU_create (cfg); + set2 = GNUNET_SETU_create (cfg); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Created sets %p and %p for union operation\n", + set1, + set2); + GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &app_id); + + /* test if canceling an uncommited request works! */ + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Launching and instantly stopping set operation\n"); + my_oh = GNUNET_SETU_prepare (&local_id, + &app_id, + NULL, + (struct GNUNET_SETU_Option[]){ 0 }, + NULL, + NULL); + GNUNET_SETU_operation_cancel (my_oh); + + /* test the real set reconciliation */ + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Running real set-reconciliation\n"); + // init_set1 (); + // limit ~23800 element total + initRandomSets (490, 500,500,32); } -static void execute_perf() + +void +perf_thread () { - for( int repeat_ctr = 0; repeat_ctr<1; repeat_ctr++ ) { + GNUNET_TESTING_service_run ("perf_setu_api", + "arm", + "test_setu.conf", + &run, + NULL); + +} - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Executing perf round %d\n", repeat_ctr); - GNUNET_TESTING_service_run ("perf_setu_api", - "arm", - "test_setu.conf", - &run, - NULL); +static void +run_petf_thread (int total_runs) +{ + int core_count = get_nprocs_conf (); + pid_t child_pid, wpid; + int status = 0; + +// Father code (before child processes start) + for (int processed = 0; processed < total_runs;) + { + for (int id = 0; id < core_count; id++) + { + if (processed >= total_runs) + break; + + if ((child_pid = fork ()) == 0) + { + perf_thread (); + exit (0); + } + processed += 1; } - return 0; + while ((wpid = wait (&status)) > 0) + ; + + } } +static void +execute_perf () +{ + + /** + * Erase statfile + */ + remove ("perf_stats.csv"); + remove ("perf_failure_bucket_number_factor.csv"); + for (int out_out_ctr = 3; out_out_ctr <= 3; out_out_ctr++) + { + + for (int out_ctr = 20; out_ctr <= 20; out_ctr++) + { + float base = 0.1; + float x = out_ctr * base; + char factor[10]; + char *buffer = gcvt (x, 4, factor); + setu_cfg = GNUNET_CONFIGURATION_create (); + GNUNET_CONFIGURATION_set_value_string (setu_cfg, "IBF", + "BUCKET_NUMBER_FACTOR", + buffer); // Factor default=4 + GNUNET_CONFIGURATION_set_value_number (setu_cfg, "IBF", + "NUMBER_PER_BUCKET", 3); // K default=4 + GNUNET_CONFIGURATION_set_value_string (setu_cfg, "PERFORMANCE", + "TRADEOFF", "2"); // default=0.25 + GNUNET_CONFIGURATION_set_value_string (setu_cfg, "PERFORMANCE", + "MAX_SET_DIFF_FACTOR_DIFFERENTIAL", + "20000"); // default=0.25 + GNUNET_CONFIGURATION_set_value_number (setu_cfg, "BOUNDARIES", + "UPPER_ELEMENT", 5000); + + + if (GNUNET_OK != GNUNET_CONFIGURATION_write (setu_cfg, "perf_setu.conf")) + GNUNET_log ( + GNUNET_ERROR_TYPE_ERROR, + _ ("Failed to write subsystem default identifier map'.\n")); + run_petf_thread (100); + } + + } + return; +} + int main (int argc, char **argv) { - GNUNET_log_setup ("perf_setu_api", - "WARNING", - NULL); - execute_perf(); - return 0; + GNUNET_log_setup ("perf_setu_api", + "WARNING", + NULL); + execute_perf (); + return 0; } diff --git a/src/setu/setu.h b/src/setu/setu.h index 7c2a98a02..7b606f12c 100644 --- a/src/setu/setu.h +++ b/src/setu/setu.h @@ -122,6 +122,31 @@ struct GNUNET_SETU_AcceptMessage */ uint32_t byzantine_lower_bound; + + /** + * Upper bound for the set size, used only when + * byzantine mode is enabled. + */ + uint64_t byzantine_upper_bond; + + /** + * Bandwidth latency tradeoff determines how much bytes a single RTT is + * worth, which is a performance setting + */ + uint64_t bandwidth_latency_tradeoff; + + /** + * The factor determines the number of buckets an IBF has which is + * multiplied by the estimated setsize default: 2 + */ + uint64_t ibf_bucket_number_factor; + + /** + * This setting determines to how many IBF buckets an single elements + * is mapped to. + */ + uint64_t ibf_number_of_buckets_per_element; + }; @@ -226,6 +251,30 @@ struct GNUNET_SETU_EvaluateMessage */ uint32_t byzantine_lower_bound; + /** + * Upper bound for the set size, used only when + * byzantine mode is enabled. + */ + uint64_t byzantine_upper_bond; + + /** + * Bandwidth latency tradeoff determines how much bytes a single RTT is + * worth, which is a performance setting + */ + uint64_t bandwidth_latency_tradeoff; + + /** + * The factor determines the number of buckets an IBF has which is + * multiplied by the estimated setsize default: 2 + */ + uint64_t ibf_bucket_number_factor; + + /** + * This setting determines to how many IBF buckets an single elements + * is mapped to. + */ + uint64_t ibf_number_of_buckets_per_element; + /* rest: context message, that is, application-specific message to convince listener to pick up */ }; diff --git a/src/setu/setu_api.c b/src/setu/setu_api.c index 0a09b18b2..faa57aaba 100644 --- a/src/setu/setu_api.c +++ b/src/setu/setu_api.c @@ -22,6 +22,7 @@ * @brief api for the set union service * @author Florian Dold * @author Christian Grothoff + * @author Elias Summermatter */ #include "platform.h" #include "gnunet_util_lib.h" @@ -526,6 +527,14 @@ GNUNET_SETU_prepare (const struct GNUNET_PeerIdentity *other_peer, context_msg); msg->app_id = *app_id; msg->target_peer = *other_peer; + + /* Set default values */ + msg->byzantine_upper_bond = UINT64_MAX; + msg->bandwidth_latency_tradeoff = 0; + msg->ibf_bucket_number_factor = 2; + msg->ibf_number_of_buckets_per_element = 3; + + for (const struct GNUNET_SETU_Option *opt = options; opt->type != 0; opt++) { switch (opt->type) @@ -534,6 +543,18 @@ GNUNET_SETU_prepare (const struct GNUNET_PeerIdentity *other_peer, msg->byzantine = GNUNET_YES; msg->byzantine_lower_bound = htonl (opt->v.num); break; + case GNUNET_SETU_OPTION_CUSTOM_BYZANTINE_UPPER_BOUND: + msg->byzantine_upper_bond = htonl (opt->v.num); + break; + case GNUNET_SETU_OPTION_CUSTOM_BANDWIDTH_LATENCY_TRADEOFF: + msg->bandwidth_latency_tradeoff = htonl (opt->v.num); + break; + case GNUNET_SETU_OPTION_CUSTOM_IBF_BUCKET_NUMBER_FACTOR: + msg->ibf_bucket_number_factor = htonl (opt->v.num); + break; + case GNUNET_SETU_OPTION_CUSTOM_IBF_BUCKETS_PER_ELEMENT: + msg->ibf_number_of_buckets_per_element = htonl (opt->v.num); + break; case GNUNET_SETU_OPTION_FORCE_FULL: msg->force_full = GNUNET_YES; break; @@ -788,6 +809,13 @@ GNUNET_SETU_accept (struct GNUNET_SETU_Request *request, mqm = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_SETU_ACCEPT); msg->accept_reject_id = htonl (request->accept_id); + + /* Set default values */ + msg->byzantine_upper_bond = UINT64_MAX; + msg->bandwidth_latency_tradeoff = 0; + msg->ibf_bucket_number_factor = 2; + msg->ibf_number_of_buckets_per_element = 3; + for (const struct GNUNET_SETU_Option *opt = options; opt->type != 0; opt++) { switch (opt->type) @@ -796,6 +824,18 @@ GNUNET_SETU_accept (struct GNUNET_SETU_Request *request, msg->byzantine = GNUNET_YES; msg->byzantine_lower_bound = htonl (opt->v.num); break; + case GNUNET_SETU_OPTION_CUSTOM_BYZANTINE_UPPER_BOUND: + msg->byzantine_upper_bond = htonl (opt->v.num); + break; + case GNUNET_SETU_OPTION_CUSTOM_BANDWIDTH_LATENCY_TRADEOFF: + msg->bandwidth_latency_tradeoff = htonl (opt->v.num); + break; + case GNUNET_SETU_OPTION_CUSTOM_IBF_BUCKET_NUMBER_FACTOR: + msg->ibf_bucket_number_factor = htonl (opt->v.num); + break; + case GNUNET_SETU_OPTION_CUSTOM_IBF_BUCKETS_PER_ELEMENT: + msg->ibf_number_of_buckets_per_element = htonl (opt->v.num); + break; case GNUNET_SETU_OPTION_FORCE_FULL: msg->force_full = GNUNET_YES; break; diff --git a/src/setu/test_setu_api.c b/src/setu/test_setu_api.c index 2fb7d015e..5a0c9d70d 100644 --- a/src/setu/test_setu_api.c +++ b/src/setu/test_setu_api.c @@ -204,62 +204,6 @@ init_set2 (void *cls) GNUNET_SETU_add_element (set2, &element, &start, NULL); } -/** - * Generate random byte stream - */ - -unsigned char *gen_rdm_bytestream (size_t num_bytes) -{ - unsigned char *stream = GNUNET_malloc (num_bytes); - GNUNET_CRYPTO_random_block(GNUNET_CRYPTO_QUALITY_WEAK, stream, num_bytes); - return stream; -} - -/** - * Generate random sets - */ - -static void -initRandomSets(int overlap, int set1_size, int set2_size, int element_size_in_bytes) -{ - struct GNUNET_SETU_Element element; - element.element_type = 0; - - // Add elements to both sets - for (int i = 0; i < overlap; i++) { - element.data = gen_rdm_bytestream(element_size_in_bytes); - element.size = element_size_in_bytes; - GNUNET_SETU_add_element (set1, &element, NULL, NULL); - GNUNET_SETU_add_element (set2, &element, NULL, NULL); - set1_size--; - set2_size--; - } - GNUNET_log (GNUNET_ERROR_TYPE_INFO, "initialized elements in both sets\n"); - - // Add other elements to set 1 - while(set1_size>0) { - element.data = gen_rdm_bytestream(element_size_in_bytes); - element.size = element_size_in_bytes; - GNUNET_SETU_add_element (set1, &element, NULL, NULL); - set1_size--; - } - GNUNET_log (GNUNET_ERROR_TYPE_INFO, "initialized elements in set1\n"); - - // Add other elements to set 2 - while(set2_size > 0) { - element.data = gen_rdm_bytestream(element_size_in_bytes); - element.size = element_size_in_bytes; - - if(set2_size != 1) { - GNUNET_SETU_add_element (set2, &element,NULL, NULL); - } else { - GNUNET_SETU_add_element (set2, &element,&start, NULL); - } - - set2_size--; - } - GNUNET_log (GNUNET_ERROR_TYPE_INFO, "initialized elements in set2\n"); -} /** * Initialize the first set, continue. @@ -392,9 +336,7 @@ run (void *cls, /* test the real set reconciliation */ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Running real set-reconciliation\n"); - //init_set1 (); - initRandomSets(19500,20000,20000,4096); - //initRandomSets(19500,20000,20000,32); + init_set1 (); } -- cgit v1.2.3 From fd277f253027f03f3a7b0dc8acc935e799d645f5 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 30 Jul 2021 15:57:10 +0200 Subject: -fetch response code first before testing on it --- src/curl/curl.c | 34 +++++++++++----------------------- 1 file changed, 11 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/curl/curl.c b/src/curl/curl.c index 79aac74ce..71672c780 100644 --- a/src/curl/curl.c +++ b/src/curl/curl.c @@ -759,6 +759,15 @@ GNUNET_CURL_download_get_result_ (struct GNUNET_CURL_DownloadBuffer *db, "Downloaded body: %.*s\n", (int) db->buf_size, (char *) db->buf); + if (CURLE_OK != + curl_easy_getinfo (eh, + CURLINFO_RESPONSE_CODE, + response_code)) + { + /* unexpected error... */ + GNUNET_break (0); + *response_code = 0; + } if ((CURLE_OK != curl_easy_getinfo (eh, CURLINFO_CONTENT_TYPE, @@ -768,15 +777,6 @@ GNUNET_CURL_download_get_result_ (struct GNUNET_CURL_DownloadBuffer *db, { /* No content type or explicitly not JSON, refuse to parse (but keep response code) */ - if (CURLE_OK != - curl_easy_getinfo (eh, - CURLINFO_RESPONSE_CODE, - response_code)) - { - /* unexpected error... */ - GNUNET_break (0); - *response_code = 0; - } if (0 != db->buf_size) GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Did NOT detect response `%.*s' as JSON\n", @@ -784,6 +784,8 @@ GNUNET_CURL_download_get_result_ (struct GNUNET_CURL_DownloadBuffer *db, (const char *) db->buf); return NULL; } + if (MHD_HTTP_NO_CONTENT == *response_code) + return NULL; if (0 == *response_code) { char *url; @@ -798,8 +800,6 @@ GNUNET_CURL_download_get_result_ (struct GNUNET_CURL_DownloadBuffer *db, url); return NULL; } - if (MHD_HTTP_NO_CONTENT == *response_code) - return NULL; json = NULL; if (0 == db->eno) { @@ -816,18 +816,6 @@ GNUNET_CURL_download_get_result_ (struct GNUNET_CURL_DownloadBuffer *db, GNUNET_free (db->buf); db->buf = NULL; db->buf_size = 0; - if (NULL != json) - { - if (CURLE_OK != - curl_easy_getinfo (eh, - CURLINFO_RESPONSE_CODE, - response_code)) - { - /* unexpected error... */ - GNUNET_break (0); - *response_code = 0; - } - } return json; } -- cgit v1.2.3 From dccf60f8919c0ba5d97b9c8ffa774987bf46c5fe Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Fri, 30 Jul 2021 22:20:05 +0200 Subject: config: handle syntax error instead of dereferencing NULL pointer --- src/util/configuration.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/util/configuration.c b/src/util/configuration.c index e515c7c46..8553d2b61 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c @@ -616,7 +616,7 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg, { fun_ret = GNUNET_OK; } -cleanup: + cleanup: cfg->current_nest_level = old_nest_level; if (NULL != other_cfg) GNUNET_CONFIGURATION_destroy (other_cfg); @@ -890,6 +890,16 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, { size_t i; + if (NULL == section) + { + LOG (GNUNET_ERROR_TYPE_WARNING, + _ ( + "Syntax error while deserializing in line %u (option without section)\n"), + nr); + ret = GNUNET_SYSERR; + break; + } + /* tag = value */ tag = GNUNET_strndup (line, eq - line); /* remove tailing whitespace */ @@ -2300,7 +2310,7 @@ GNUNET_CONFIGURATION_load_from (struct GNUNET_CONFIGURATION_Handle *cfg, if (fun_ret != GNUNET_OK) break; } -cleanup: + cleanup: if (files_context.files_length > 0) { for (size_t i = 0; i < files_context.files_length; i++) -- cgit v1.2.3 From 832253e6eb9ad4e7327217dac560002e397d6288 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Sat, 31 Jul 2021 12:45:34 +0200 Subject: -config: initialize variable --- src/util/configuration.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/util/configuration.c b/src/util/configuration.c index 8553d2b61..f7277b3cb 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c @@ -427,7 +427,7 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg, const char *source_filename, unsigned int source_lineno) { - char *inline_path; + char *inline_path = NULL; struct GNUNET_CONFIGURATION_Handle *other_cfg = NULL; struct CollectFilesContext igc = { .files = NULL, -- cgit v1.2.3 From 285f958a5190d185ecee70248473e63af5759ad8 Mon Sep 17 00:00:00 2001 From: t3sserakt Date: Sat, 31 Jul 2021 16:20:23 +0200 Subject: - removed warnings --- src/testbed/gnunet-cmds-helper.c | 10 +++++----- src/transport/transport_api_cmd_connecting_peers.c | 6 +++--- src/transport/transport_api_cmd_send_simple.c | 4 ++-- src/transport/transport_api_cmd_start_peer.c | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/testbed/gnunet-cmds-helper.c b/src/testbed/gnunet-cmds-helper.c index 7cb753c23..4bc0656de 100644 --- a/src/testbed/gnunet-cmds-helper.c +++ b/src/testbed/gnunet-cmds-helper.c @@ -124,8 +124,8 @@ struct Plugin *plugin; /** * The process handle to the testbed service - */ -static struct GNUNET_OS_Process *cmd_binary_process; + +static struct GNUNET_OS_Process *cmd_binary_process;*/ /** * Handle to the testing system @@ -276,7 +276,7 @@ write_task (void *cls) * * @param cls closure, NULL if we need to self-restart */ -static void +/*static void child_death_task (void *cls) { const struct GNUNET_DISK_FileHandle *pr; @@ -284,7 +284,7 @@ child_death_task (void *cls) pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ); child_death_task_id = NULL; - /* consume the signal */ + // consume the signal GNUNET_break (0 < GNUNET_DISK_file_read (pr, &c, sizeof(c))); LOG_DEBUG ("Got SIGCHLD\n"); @@ -294,7 +294,7 @@ child_death_task (void *cls) pr, &child_death_task, NULL); -} +}*/ static void diff --git a/src/transport/transport_api_cmd_connecting_peers.c b/src/transport/transport_api_cmd_connecting_peers.c index f4b2e935f..3148806c7 100644 --- a/src/transport/transport_api_cmd_connecting_peers.c +++ b/src/transport/transport_api_cmd_connecting_peers.c @@ -53,13 +53,13 @@ connect_peers_run (void *cls, { struct ConnectPeersState *cps = cls; const struct GNUNET_TESTING_Command *peer1_cmd; - const struct GNUNET_TESTING_Command *peer2_cmd; + //const struct GNUNET_TESTING_Command *peer2_cmd; struct GNUNET_TRANSPORT_ApplicationHandle *ah; struct GNUNET_PeerIdentity *peer = GNUNET_new (struct GNUNET_PeerIdentity); char *addr; - struct GNUNET_TIME_Absolute t; + //struct GNUNET_TIME_Absolute t; char *hello; - size_t *hello_size; + //size_t *hello_size; enum GNUNET_NetworkType nt = 0; char *peer_id; diff --git a/src/transport/transport_api_cmd_send_simple.c b/src/transport/transport_api_cmd_send_simple.c index 6e7b89497..8d652563f 100644 --- a/src/transport/transport_api_cmd_send_simple.c +++ b/src/transport/transport_api_cmd_send_simple.c @@ -72,9 +72,9 @@ send_simple_run (void *cls, struct GNUNET_TRANSPORT_TESTING_TestMessage *test; struct GNUNET_MQ_Handle *mq; struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map; - struct GNUNET_PeerIdentity *id; + //struct GNUNET_PeerIdentity *id; const struct GNUNET_TESTING_Command *peer1_cmd; - const struct GNUNET_TESTING_Command *peer2_cmd; + //const struct GNUNET_TESTING_Command *peer2_cmd; struct GNUNET_ShortHashCode *key = GNUNET_new (struct GNUNET_ShortHashCode); struct GNUNET_HashCode hc; int node_number; diff --git a/src/transport/transport_api_cmd_start_peer.c b/src/transport/transport_api_cmd_start_peer.c index b2b26194a..8696a99dc 100644 --- a/src/transport/transport_api_cmd_start_peer.c +++ b/src/transport/transport_api_cmd_start_peer.c @@ -196,7 +196,7 @@ notify_connect (void *cls, struct GNUNET_HashCode hc; int node_number; - void *ret; + void *ret = NULL; LOG (GNUNET_ERROR_TYPE_DEBUG, -- cgit v1.2.3 From 0ba0680c89ecfaf065187bde52733b3672a5ce9e Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Sat, 31 Jul 2021 20:03:44 +0200 Subject: -config: allow empty config for @inline-secret@ --- src/util/configuration.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/util/configuration.c b/src/util/configuration.c index f7277b3cb..93bc03189 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c @@ -589,11 +589,15 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg, cs = find_section (other_cfg, restrict_section); if (NULL == cs) { - LOG (GNUNET_ERROR_TYPE_ERROR, - "inlined configuration '%s' does not contain section '%s'\n", + LOG (GNUNET_ERROR_TYPE_INFO, + "Configuration file '%s' loaded with @inline-secret@ " + "does not contain section '%s'.\n", inline_path, restrict_section); - fun_ret = GNUNET_SYSERR; + /* Inlined onfiguration is accessible but doesn't contain any values. + We treat this as if the inlined section was empty, and do not + consider it an error. */ + fun_ret = GNUNET_OK; goto cleanup; } for (struct ConfigEntry *ce = cs->entries; @@ -616,7 +620,7 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg, { fun_ret = GNUNET_OK; } - cleanup: + cleanup: cfg->current_nest_level = old_nest_level; if (NULL != other_cfg) GNUNET_CONFIGURATION_destroy (other_cfg); @@ -2310,7 +2314,7 @@ GNUNET_CONFIGURATION_load_from (struct GNUNET_CONFIGURATION_Handle *cfg, if (fun_ret != GNUNET_OK) break; } - cleanup: + cleanup: if (files_context.files_length > 0) { for (size_t i = 0; i < files_context.files_length; i++) -- cgit v1.2.3 From d02ea47f57e9cc4e95382cc4571bad497039dfed Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 31 Jul 2021 22:42:45 +0200 Subject: JSON: allow NULL-passing to GNUNET_JSON_pack_data_varsize --- src/json/json_pack.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/json/json_pack.c b/src/json/json_pack.c index d86baff41..c61d3331f 100644 --- a/src/json/json_pack.c +++ b/src/json/json_pack.c @@ -33,7 +33,7 @@ GNUNET_JSON_pack_ (struct GNUNET_JSON_PackSpec spec[]) ret = json_object (); GNUNET_assert (NULL != ret); - for (unsigned int i=0; + for (unsigned int i = 0; NULL != spec[i].field_name; i++) { @@ -55,7 +55,7 @@ GNUNET_JSON_pack_ (struct GNUNET_JSON_PackSpec spec[]) struct GNUNET_JSON_PackSpec -GNUNET_JSON_pack_end_(void) +GNUNET_JSON_pack_end_ (void) { struct GNUNET_JSON_PackSpec ps = { .field_name = NULL @@ -81,7 +81,7 @@ GNUNET_JSON_pack_bool (const char *name, .field_name = name, .object = json_boolean (b) }; - + return ps; } @@ -94,8 +94,8 @@ GNUNET_JSON_pack_string (const char *name, .field_name = name, .object = json_string (s) }; - - return ps; + + return ps; } @@ -107,25 +107,25 @@ GNUNET_JSON_pack_uint64 (const char *name, .field_name = name, .object = json_integer ((json_int_t) num) }; - + #if JSON_INTEGER_IS_LONG_LONG GNUNET_assert (num <= LLONG_MAX); #else GNUNET_assert (num <= LONG_MAX); #endif - return ps; + return ps; } struct GNUNET_JSON_PackSpec GNUNET_JSON_pack_int64 (const char *name, - int64_t num) + int64_t num) { struct GNUNET_JSON_PackSpec ps = { .field_name = name, .object = json_integer ((json_int_t) num) }; - + #if JSON_INTEGER_IS_LONG_LONG GNUNET_assert (num <= LLONG_MAX); GNUNET_assert (num >= LLONG_MIN); @@ -234,8 +234,10 @@ GNUNET_JSON_pack_data_varsize (const char *name, { struct GNUNET_JSON_PackSpec ps = { .field_name = name, - .object = GNUNET_JSON_from_data (blob, - blob_size) + .object = (NULL != blob) + ? GNUNET_JSON_from_data (blob, + blob_size) + : NULL }; return ps; -- cgit v1.2.3 From 06f45b04aaa8a9832599035cafee142f09700b9b Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 1 Aug 2021 13:20:49 +0200 Subject: -move DB-agnostic types to GNUNET_DB --- src/include/gnunet_db_lib.h | 43 +++++++++++++++++++++++++++++ src/include/gnunet_pq_lib.h | 67 +++++++-------------------------------------- src/pq/pq_event.c | 64 +++++++++++++++++++++---------------------- 3 files changed, 84 insertions(+), 90 deletions(-) (limited to 'src') diff --git a/src/include/gnunet_db_lib.h b/src/include/gnunet_db_lib.h index 85ad13e31..63c45112d 100644 --- a/src/include/gnunet_db_lib.h +++ b/src/include/gnunet_db_lib.h @@ -61,4 +61,47 @@ enum GNUNET_DB_QueryStatus that returned more than one result. */ }; + +/** + * Handle for an active LISTENer to a database. + */ +struct GNUNET_DB_EventHandler; + +/** + * Function called on events received from Postgres. + * + * @param cls closure + * @param extra additional event data provided + * @param extra_size number of bytes in @a extra + */ +typedef void +(*GNUNET_DB_EventCallback)(void *cls, + const void *extra, + size_t extra_size); + +GNUNET_NETWORK_STRUCT_BEGIN + + +/** + * Header of a structure that describes an + * event channel we may subscribe to or notify on. + */ +struct GNUNET_DB_EventHeaderP +{ + /** + * The length of the struct (in bytes, including the length field itself), + * in big-endian format. + */ + uint16_t size GNUNET_PACKED; + + /** + * The type of the message (GNUNET_DB_EVENT_TYPE_XXXX), in big-endian format. + */ + uint16_t type GNUNET_PACKED; + +}; + +GNUNET_NETWORK_STRUCT_END + + #endif diff --git a/src/include/gnunet_pq_lib.h b/src/include/gnunet_pq_lib.h index 1f2915165..ecc2b9719 100644 --- a/src/include/gnunet_pq_lib.h +++ b/src/include/gnunet_pq_lib.h @@ -853,7 +853,7 @@ GNUNET_PQ_reconnect (struct GNUNET_PQ_Context *db); /** - * Function called whenever the socket needed for + * Function called whenever the socket needed for * notifications from postgres changes. * * @param cls closure @@ -868,7 +868,7 @@ typedef void * Obtain the file descriptor to poll on for notifications. * Useful if the GNUnet scheduler is NOT to be used for * such notifications. - * + * * @param db database handle * @param sc function to call with the socket * @param sc_cls closure for @a sc @@ -910,56 +910,9 @@ void GNUNET_PQ_event_scheduler_stop (struct GNUNET_PQ_Context *db); -/** - * Handle for an active LISTENer to the database. - */ -struct GNUNET_PQ_EventHandler; - -/** - * Function called on events received from Postgres. - * - * @param cls closure - * @param extra additional event data provided - * @param extra_size number of bytes in @a extra - */ -typedef void -(*GNUNET_PQ_EventCallback)(void *cls, - const void *extra, - size_t extra_size); - -GNUNET_NETWORK_STRUCT_BEGIN - - -/** - * Header of a structure that describes an - * event channel we may subscribe to or notify on. - */ -struct GNUNET_PQ_EventHeaderP -{ - /** - * The length of the struct (in bytes, including the length field itself), - * in big-endian format. - */ - uint16_t size GNUNET_PACKED; - - /** - * The type of the message (GNUNET_PQ_EVENT_TYPE_XXXX), in big-endian format. - */ - uint16_t type GNUNET_PACKED; - -}; - -GNUNET_NETWORK_STRUCT_END - - -/** - * Handle for an active LISTENer to the database. - */ -struct GNUNET_PQ_EventHandler; - /** * Register callback to be invoked on events of type @a es. - * + * * Unlike many other calls, this function is thread-safe * and may be called from threads that are different * from the one that setup @a db. However, the @a cb @@ -973,16 +926,16 @@ struct GNUNET_PQ_EventHandler; * @param cb_cls closure for @a cb * @return handle useful to cancel the listener */ -struct GNUNET_PQ_EventHandler * +struct GNUNET_DB_EventHandler * GNUNET_PQ_event_listen (struct GNUNET_PQ_Context *db, - const struct GNUNET_PQ_EventHeaderP *es, - GNUNET_PQ_EventCallback cb, + const struct GNUNET_DB_EventHeaderP *es, + GNUNET_DB_EventCallback cb, void *cb_cls); /** * Stop notifications. - * + * * Unlike many other calls, this function is thread-safe * and may be called from threads that are different * from the one that setup @a db. However, the @a cb @@ -992,12 +945,12 @@ GNUNET_PQ_event_listen (struct GNUNET_PQ_Context *db, * @param eh handle to unregister. */ void -GNUNET_PQ_event_listen_cancel (struct GNUNET_PQ_EventHandler *eh); +GNUNET_PQ_event_listen_cancel (struct GNUNET_DB_EventHandler *eh); /** * Notify all that listen on @a es of an event. - * + * * Unlike many other calls, this function is thread-safe * and may be called from threads that are different * from the one that setup @a db. However, the @a cb @@ -1011,7 +964,7 @@ GNUNET_PQ_event_listen_cancel (struct GNUNET_PQ_EventHandler *eh); */ void GNUNET_PQ_event_notify (struct GNUNET_PQ_Context *db, - const struct GNUNET_PQ_EventHeaderP *es, + const struct GNUNET_DB_EventHeaderP *es, const void *extra, size_t extra_size); diff --git a/src/pq/pq_event.c b/src/pq/pq_event.c index 74b8b3653..e1134a5fa 100644 --- a/src/pq/pq_event.c +++ b/src/pq/pq_event.c @@ -29,8 +29,8 @@ /** * Handle for an active LISTENer to the database. - */ -struct GNUNET_PQ_EventHandler + */ +struct GNUNET_DB_EventHandler { /** * Channel name. @@ -40,7 +40,7 @@ struct GNUNET_PQ_EventHandler /** * Function to call on events. */ - GNUNET_PQ_EventCallback cb; + GNUNET_DB_EventCallback cb; /** * Closure for @e cb. @@ -54,8 +54,6 @@ struct GNUNET_PQ_EventHandler }; - - /** * Convert @a es to a short hash. * @@ -63,7 +61,7 @@ struct GNUNET_PQ_EventHandler * @param[out] sh short hash to set */ static void -es_to_sh (const struct GNUNET_PQ_EventHeaderP *es, +es_to_sh (const struct GNUNET_DB_EventHeaderP *es, struct GNUNET_ShortHashCode *sh) { struct GNUNET_HashCode h_channel; @@ -111,7 +109,7 @@ sh_to_channel (struct GNUNET_ShortHashCode *sh, * @return end position of the identifier */ static char * -es_to_channel (const struct GNUNET_PQ_EventHeaderP *es, +es_to_channel (const struct GNUNET_DB_EventHeaderP *es, char identifier[64]) { struct GNUNET_ShortHashCode sh; @@ -141,12 +139,12 @@ struct NotifyContext /** - * Function called on every event handler that + * Function called on every event handler that * needs to be triggered. * * @param cls a `struct NotifyContext` * @param sh channel name - * @param value a `struct GNUNET_PQ_EventHandler` + * @param value a `struct GNUNET_DB_EventHandler` * @return #GNUNET_OK continue to iterate */ static int @@ -155,13 +153,13 @@ do_notify (void *cls, void *value) { struct NotifyContext *ctx = cls; - struct GNUNET_PQ_EventHandler *eh = value; + struct GNUNET_DB_EventHandler *eh = value; eh->cb (eh->cb_cls, ctx->extra, ctx->extra_size); return GNUNET_OK; -} +} void @@ -265,7 +263,7 @@ do_scheduler_notify (void *cls) = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_ZERO, db->rfd, &do_scheduler_notify, - db); + db); } @@ -281,7 +279,7 @@ scheduler_fd_cb (void *cls, int fd) { struct GNUNET_PQ_Context *db = cls; - + if (NULL != db->event_task) { GNUNET_SCHEDULER_cancel (db->event_task); @@ -305,7 +303,7 @@ void GNUNET_PQ_event_scheduler_start (struct GNUNET_PQ_Context *db) { int fd; - + GNUNET_assert (! db->scheduler_on); GNUNET_assert (NULL == db->sc); db->scheduler_on = true; @@ -335,7 +333,7 @@ GNUNET_PQ_event_scheduler_stop (struct GNUNET_PQ_Context *db) static void manage_subscribe (struct GNUNET_PQ_Context *db, const char *cmd, - struct GNUNET_PQ_EventHandler *eh) + struct GNUNET_DB_EventHandler *eh) { char sql[16 + 64]; char *end; @@ -379,13 +377,13 @@ register_notify (void *cls, void *value) { struct GNUNET_PQ_Context *db = cls; - struct GNUNET_PQ_EventHandler *eh = value; - + struct GNUNET_DB_EventHandler *eh = value; + manage_subscribe (db, "LISTEN ", eh); return GNUNET_OK; -} +} void @@ -401,16 +399,16 @@ GNUNET_PQ_event_reconnect_ (struct GNUNET_PQ_Context *db) } -struct GNUNET_PQ_EventHandler * +struct GNUNET_DB_EventHandler * GNUNET_PQ_event_listen (struct GNUNET_PQ_Context *db, - const struct GNUNET_PQ_EventHeaderP *es, - GNUNET_PQ_EventCallback cb, + const struct GNUNET_DB_EventHeaderP *es, + GNUNET_DB_EventCallback cb, void *cb_cls) { - struct GNUNET_PQ_EventHandler *eh; + struct GNUNET_DB_EventHandler *eh; bool was_zero; - eh = GNUNET_new (struct GNUNET_PQ_EventHandler); + eh = GNUNET_new (struct GNUNET_DB_EventHandler); eh->db = db; es_to_sh (es, &eh->sh); @@ -421,14 +419,14 @@ GNUNET_PQ_event_listen (struct GNUNET_PQ_Context *db, was_zero = (0 == GNUNET_CONTAINER_multishortmap_size (db->channel_map)); GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multishortmap_put (db->channel_map, - &eh->sh, - eh, - GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); + &eh->sh, + eh, + GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); if ( (NULL != db->sc) && was_zero) { int fd = PQsocket (db->conn); - + if (-1 != fd) db->sc (db->sc_cls, fd); @@ -443,7 +441,7 @@ GNUNET_PQ_event_listen (struct GNUNET_PQ_Context *db, void -GNUNET_PQ_event_listen_cancel (struct GNUNET_PQ_EventHandler *eh) +GNUNET_PQ_event_listen_cancel (struct GNUNET_DB_EventHandler *eh) { struct GNUNET_PQ_Context *db = eh->db; @@ -451,9 +449,9 @@ GNUNET_PQ_event_listen_cancel (struct GNUNET_PQ_EventHandler *eh) pthread_mutex_lock (&db->notify_lock)); GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multishortmap_remove (db->channel_map, - &eh->sh, - eh)); - + &eh->sh, + eh)); + manage_subscribe (db, "UNLISTEN ", eh); @@ -471,7 +469,7 @@ GNUNET_PQ_event_listen_cancel (struct GNUNET_PQ_EventHandler *eh) void GNUNET_PQ_event_notify (struct GNUNET_PQ_Context *db, - const struct GNUNET_PQ_EventHeaderP *es, + const struct GNUNET_DB_EventHeaderP *es, const void *extra, size_t extra_size) { @@ -512,5 +510,5 @@ GNUNET_PQ_event_notify (struct GNUNET_PQ_Context *db, PQclear (result); } -/* end of pq_event.c */ +/* end of pq_event.c */ -- cgit v1.2.3 From c98bf47a8fc54e1dc9e413c0cb4506789a9ddeee Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 1 Aug 2021 14:53:14 +0200 Subject: PQ: fix notification API bugs --- src/pq/pq_event.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/pq/pq_event.c b/src/pq/pq_event.c index e1134a5fa..bf845db18 100644 --- a/src/pq/pq_event.c +++ b/src/pq/pq_event.c @@ -192,6 +192,7 @@ GNUNET_PQ_event_do_poll (struct GNUNET_PQ_Context *db) GNUNET_assert (0 == pthread_mutex_lock (&db->notify_lock)); + PQconsumeInput (db->conn); while (NULL != (n = PQnotifies (db->conn))) { struct GNUNET_ShortHashCode sh; @@ -208,6 +209,7 @@ GNUNET_PQ_event_do_poll (struct GNUNET_PQ_Context *db) GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Ignoring notification for unsupported channel identifier `%s'\n", n->relname); + PQfreemem (n); continue; } if ( (NULL != n->extra) && @@ -221,12 +223,14 @@ GNUNET_PQ_event_do_poll (struct GNUNET_PQ_Context *db) "Ignoring notification for unsupported extra data `%s' on channel `%s'\n", n->extra, n->relname); + PQfreemem (n); continue; } GNUNET_CONTAINER_multishortmap_iterate (db->channel_map, &do_notify, &ctx); GNUNET_free (ctx.extra); + PQfreemem (n); } GNUNET_assert (0 == pthread_mutex_unlock (&db->notify_lock)); -- cgit v1.2.3 From 61375320041b2c11ef9c10c21239fd2e24692a9a Mon Sep 17 00:00:00 2001 From: t3sserakt Date: Sun, 1 Aug 2021 14:59:33 +0200 Subject: - added config files for netjail testing. removed unshare from netjail script --- src/testbed/netjail_core.sh | 4 ++-- src/transport/test_transport_api2_tcp_node1.conf | 23 +++++++++++++++++++++++ src/transport/test_transport_api2_tcp_node2.conf | 22 ++++++++++++++++++++++ 3 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 src/transport/test_transport_api2_tcp_node1.conf create mode 100644 src/transport/test_transport_api2_tcp_node2.conf (limited to 'src') diff --git a/src/testbed/netjail_core.sh b/src/testbed/netjail_core.sh index 792b1df24..f49d4b312 100755 --- a/src/testbed/netjail_core.sh +++ b/src/testbed/netjail_core.sh @@ -95,13 +95,13 @@ netjail_node_exec() { FD_OUT=$3 shift 3 - unshare -fp --kill-child -- ip netns exec $NODE sudo -u $JAILOR -- $@ 1>& $FD_OUT 0<& $FD_IN + ip netns exec $NODE sudo -u $JAILOR -- $@ 1>& $FD_OUT 0<& $FD_IN } netjail_node_exec_without_fds() { NODE=$1 shift 1 - unshare -fp --kill-child -- ip netns exec $NODE sudo -u $JAILOR -- $@ + ip netns exec $NODE sudo -u $JAILOR -- $@ } diff --git a/src/transport/test_transport_api2_tcp_node1.conf b/src/transport/test_transport_api2_tcp_node1.conf new file mode 100644 index 000000000..a867ea81a --- /dev/null +++ b/src/transport/test_transport_api2_tcp_node1.conf @@ -0,0 +1,23 @@ +@INLINE@ template_cfg_peer1.conf +[PATHS] +GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/ + +[transport] +BINARY = gnunet-service-tng +PLUGINS = tcp +#PREFIX = valgrind --log-file=/tmp/vg_peer1-%p +UNIXPATH = $GNUNET_RUNTIME_DIR/tng-p1.sock + +[communicator-tcp] +BINARY = gnunet-communicator-tcp +BINDTO = 192.168.15.1:60002 +DISABLE_V6 = YES +IMMEDIATE_START = YES +UNIXPATH = $GNUNET_RUNTIME_DIR/tcp-comm-p1.sock +#PREFIX = valgrind --log-file=/tmp/vg_cpeer1-%p + +[peerstore] +IMMEDIATE_START = YES + +#[transport] +#PREFIX = valgrind diff --git a/src/transport/test_transport_api2_tcp_node2.conf b/src/transport/test_transport_api2_tcp_node2.conf new file mode 100644 index 000000000..f94368b3f --- /dev/null +++ b/src/transport/test_transport_api2_tcp_node2.conf @@ -0,0 +1,22 @@ +@INLINE@ template_cfg_peer2.conf +[PATHS] +GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/ + +[transport] +BINARY = gnunet-service-tng +#PREFIX = valgrind --log-file=/tmp/vg_peer2-%p +UNIXPATH = $GNUNET_RUNTIME_DIR/tng-p2.sock + +[communicator-tcp] +BINARY = gnunet-communicator-tcp +BINDTO = 192.168.15.2:60003 +DISABLE_V6 = YES +IMMEDIATE_START = YES +#PREFIX = valgrind --log-file=/tmp/vg_comm2-%p +UNIXPATH = $GNUNET_RUNTIME_DIR/tcp-comm-p2.sock + +[peerstore] +IMMEDIATE_START = YES + +#[transport] +#PREFIX = valgrind -- cgit v1.2.3 From 372516f77ac66e86663a61604bcdb776bcb6de9d Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 1 Aug 2021 16:23:32 +0200 Subject: 0 for absolute time is special, and should be treated as such in JSON generation --- src/include/gnunet_json_lib.h | 43 +++++++++++++++++++++++-------------------- src/json/json_pack.c | 18 +++++++++++++----- 2 files changed, 36 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/include/gnunet_json_lib.h b/src/include/gnunet_json_lib.h index 144ddb64a..92f696e08 100644 --- a/src/include/gnunet_json_lib.h +++ b/src/include/gnunet_json_lib.h @@ -556,7 +556,7 @@ struct GNUNET_JSON_PackSpec * Object to pack. */ json_t *object; - + /** * True if a NULL (or 0) argument is allowed. In this * case, if the argument is NULL the @e packer should @@ -586,7 +586,8 @@ GNUNET_JSON_pack_ (struct GNUNET_JSON_PackSpec spec[]); * @return JSON object */ #define GNUNET_JSON_PACK(...) \ - GNUNET_JSON_pack_ ((struct GNUNET_JSON_PackSpec[]) {__VA_ARGS__, GNUNET_JSON_pack_end_ ()}) + GNUNET_JSON_pack_ ((struct GNUNET_JSON_PackSpec[]) {__VA_ARGS__, \ + GNUNET_JSON_pack_end_ ()}) /** @@ -595,12 +596,12 @@ GNUNET_JSON_pack_ (struct GNUNET_JSON_PackSpec spec[]); * @return array terminator */ struct GNUNET_JSON_PackSpec -GNUNET_JSON_pack_end_(void); +GNUNET_JSON_pack_end_ (void); /** * Modify packer instruction to allow NULL as a value. - * + * * @param in json pack specification to modify * @return json pack specification */ @@ -611,7 +612,7 @@ GNUNET_JSON_pack_allow_null (struct GNUNET_JSON_PackSpec in); /** * Generate packer instruction for a JSON field of type * bool. - * + * * @param name name of the field to add to the object * @param b boolean value * @return json pack specification @@ -624,7 +625,7 @@ GNUNET_JSON_pack_bool (const char *name, /** * Generate packer instruction for a JSON field of type * string. - * + * * @param name name of the field to add to the object * @param s string value * @return json pack specification @@ -636,9 +637,9 @@ GNUNET_JSON_pack_string (const char *name, /** * Generate packer instruction for a JSON field of type - * unsigned integer. Note that the maximum allowed + * unsigned integer. Note that the maximum allowed * value is still limited by JSON and not UINT64_MAX. - * + * * @param name name of the field to add to the object * @param num numeric value * @return json pack specification @@ -651,21 +652,21 @@ GNUNET_JSON_pack_uint64 (const char *name, /** * Generate packer instruction for a JSON field of type * signed integer. - * + * * @param name name of the field to add to the object * @param num numeric value * @return json pack specification */ struct GNUNET_JSON_PackSpec GNUNET_JSON_pack_int64 (const char *name, - int64_t num); + int64_t num); /** * Generate packer instruction for a JSON field of type * JSON object where the reference is taken over by * the packer. - * + * * @param name name of the field to add to the object * @param o object to steal * @return json pack specification @@ -679,7 +680,7 @@ GNUNET_JSON_pack_object_steal (const char *name, * Generate packer instruction for a JSON field of type JSON object where the * reference counter is incremented by the packer. Note that a deep copy is * not performed. - * + * * @param name name of the field to add to the object * @param o object to increment reference counter of * @return json pack specification @@ -693,7 +694,7 @@ GNUNET_JSON_pack_object_incref (const char *name, * Generate packer instruction for a JSON field of type * JSON array where the reference is taken over by * the packer. - * + * * @param name name of the field to add to the object * @param a array to steal * @return json pack specification @@ -707,7 +708,7 @@ GNUNET_JSON_pack_array_steal (const char *name, * Generate packer instruction for a JSON field of type JSON array where the * reference counter is incremented by the packer. Note that a deep copy is * not performed. - * + * * @param name name of the field to add to the object * @param a array to increment reference counter of * @return json pack specification @@ -720,7 +721,7 @@ GNUNET_JSON_pack_array_incref (const char *name, /** * Generate packer instruction for a JSON field of type * variable size binary blob. - * + * * @param name name of the field to add to the object * @param blob binary data to pack * @param blob_size number of bytes in @a blob @@ -735,7 +736,7 @@ GNUNET_JSON_pack_data_varsize (const char *name, /** * Generate packer instruction for a JSON field where the * size is automatically determined from the argument. - * + * * @param name name of the field to add to the object * @param blob data to pack, must not be an array * @return json pack specification @@ -749,7 +750,8 @@ GNUNET_JSON_pack_data_varsize (const char *name, * absolute time. * * @param name name of the field to add to the object - * @param at absolute time to pack + * @param at absolute time to pack, a value of 0 is only + * allowed with #GNUNET_JSON_pack_allow_null()! * @return json pack specification */ struct GNUNET_JSON_PackSpec @@ -762,7 +764,8 @@ GNUNET_JSON_pack_time_abs (const char *name, * absolute time in network byte order. * * @param name name of the field to add to the object - * @param at absolute time to pack + * @param at absolute time to pack, a value of 0 is only + * allowed with #GNUNET_JSON_pack_allow_null()! * @return json pack specification */ struct GNUNET_JSON_PackSpec @@ -799,7 +802,7 @@ GNUNET_JSON_pack_time_rel_nbo (const char *name, /** * Generate packer instruction for a JSON field of type * RSA public key. - * + * * @param name name of the field to add to the object * @param pk RSA public key * @return json pack specification @@ -812,7 +815,7 @@ GNUNET_JSON_pack_rsa_public_key (const char *name, /** * Generate packer instruction for a JSON field of type * RSA signature. - * + * * @param name name of the field to add to the object * @param sig RSA signature * @return json pack specification diff --git a/src/json/json_pack.c b/src/json/json_pack.c index c61d3331f..92f8b4535 100644 --- a/src/json/json_pack.c +++ b/src/json/json_pack.c @@ -248,12 +248,20 @@ struct GNUNET_JSON_PackSpec GNUNET_JSON_pack_time_abs (const char *name, struct GNUNET_TIME_Absolute at) { - json_t *json; + struct GNUNET_JSON_PackSpec ps = { + .field_name = name + }; - json = GNUNET_JSON_from_time_abs (at); - GNUNET_assert (NULL != json); - return GNUNET_JSON_pack_object_steal (name, - json); + if (0 != at.abs_value_us) + { + ps.object = GNUNET_JSON_from_time_abs (at); + GNUNET_assert (NULL != ps.object); + } + else + { + ps.object = NULL; + } + return ps; } -- cgit v1.2.3 From 3b186f5a8a7c6974a1dc6629f32de20a12e9093f Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 1 Aug 2021 16:28:46 +0200 Subject: -fix ftbfs" --- src/include/gnunet_db_lib.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/include/gnunet_db_lib.h b/src/include/gnunet_db_lib.h index 63c45112d..e88e836f6 100644 --- a/src/include/gnunet_db_lib.h +++ b/src/include/gnunet_db_lib.h @@ -25,6 +25,7 @@ #ifndef GNUNET_DB_LIB_H #define GNUNET_DB_LIB_H +#include "gnunet_common.h" /** * Status code returned from functions running database commands. -- cgit v1.2.3 From 39b19b0ca9d004b4cbe67d2f09c2a1e9eab03c19 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 1 Aug 2021 22:08:18 +0200 Subject: -fix busy loop --- src/pq/pq_event.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/pq/pq_event.c b/src/pq/pq_event.c index bf845db18..e6c2d07fd 100644 --- a/src/pq/pq_event.c +++ b/src/pq/pq_event.c @@ -192,7 +192,11 @@ GNUNET_PQ_event_do_poll (struct GNUNET_PQ_Context *db) GNUNET_assert (0 == pthread_mutex_lock (&db->notify_lock)); - PQconsumeInput (db->conn); + if (1 != + PQconsumeInput (db->conn)) + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Failed to read from Postgres: %s\n", + PQerrorMessage (db->conn)); while (NULL != (n = PQnotifies (db->conn))) { struct GNUNET_ShortHashCode sh; @@ -264,7 +268,7 @@ do_scheduler_notify (void *cls) GNUNET_assert (NULL != db->rfd); GNUNET_PQ_event_do_poll (db); db->event_task - = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_ZERO, + = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL, db->rfd, &do_scheduler_notify, db); -- cgit v1.2.3 From 9ba7218399841d1eafe962d82b66302fc6aa05b0 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 1 Aug 2021 22:57:00 +0200 Subject: -fix typos --- src/setu/gnunet-service-setu.c | 22 ++++++++++++---------- src/setu/gnunet-service-setu_protocol.h | 5 +++-- src/setu/perf_setu_api.c | 2 +- 3 files changed, 16 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/setu/gnunet-service-setu.c b/src/setu/gnunet-service-setu.c index a51e92b71..9a61af67d 100644 --- a/src/setu/gnunet-service-setu.c +++ b/src/setu/gnunet-service-setu.c @@ -95,7 +95,7 @@ #define SECURITY_LEVEL 80 /** - * Is the estimated probabily for a new round this values + * Is the estimated probability for a new round this values * is based on the bsc thesis of Elias Summermatter (2021) */ @@ -467,7 +467,7 @@ struct Operation /** * Set difference is multiplied with this factor - * to gennerate large enought IBF + * to gennerate large enough IBF */ uint8_t ibf_bucket_number_factor; @@ -780,7 +780,7 @@ struct perf_num_send_received_msg }; /** - * Main struct to messure perfomance (data/rtts) + * Main struct to measure performance (data/rtts) */ struct per_store_struct { @@ -828,7 +828,7 @@ enum MESSAGE_CONTROL_FLOW_STATE MSG_CFS_EXPECTED, /** - * Track that message has been recieved + * Track that message has been received */ MSG_CFS_RECEIVED, }; @@ -843,20 +843,22 @@ enum MESSAGE_TYPE * Offer message type */ OFFER_MESSAGE, + /** * Demand message type */ DEMAND_MESSAGE, + /** - * Elemente message type + * Element message type */ ELEMENT_MESSAGE, }; + /** - * Struct to tracked messages in message controll flow + * Struct to tracked messages in message control flow */ - struct messageControlFlowElement { /** @@ -912,7 +914,7 @@ load_config (struct Operation *op) /** - * Function to calculate total bytes used for performance messurement + * Function to calculate total bytes used for performance measurement * @param size * @param perf_num_send_received_msg * @return bytes used @@ -942,7 +944,7 @@ calculate_perf_store () int bytes_transmitted = 0; /** - * Calculate RGNUNET_SETU_AcceptMessageRT of Fullsync normaly 1 or 1.5 depending + * Calculate RGNUNET_SETU_AcceptMessageRT of Fullsync normally 1 or 1.5 depending */ if ((perf_store.element_full.received != 0) || (perf_store.element_full.sent != 0) @@ -1840,7 +1842,7 @@ struct GetElementContext struct GNUNET_HashCode hash; /** - * Pointer to the key enty + * Pointer to the key entry */ struct KeyEntry *k; }; diff --git a/src/setu/gnunet-service-setu_protocol.h b/src/setu/gnunet-service-setu_protocol.h index d8f34f69c..c2a166e60 100644 --- a/src/setu/gnunet-service-setu_protocol.h +++ b/src/setu/gnunet-service-setu_protocol.h @@ -82,11 +82,13 @@ struct IBFMessage uint16_t salt GNUNET_PACKED; /** - * The bit lenght of the counter + * The bit length of the counter */ uint16_t ibf_counter_bit_length; /* rest: buckets */ }; + + /** estimate_best_mode_of_operation (uint64_t avg_element_size, uint64_t local_set_size, @@ -96,7 +98,6 @@ uint64_t est_set_diff_remote, **/ - struct InquiryMessage { /** diff --git a/src/setu/perf_setu_api.c b/src/setu/perf_setu_api.c index af84994f8..7f4d64f74 100644 --- a/src/setu/perf_setu_api.c +++ b/src/setu/perf_setu_api.c @@ -355,7 +355,7 @@ run (void *cls, set2); GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &app_id); - /* test if canceling an uncommited request works! */ + /* test if canceling an uncommitted request works! */ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Launching and instantly stopping set operation\n"); my_oh = GNUNET_SETU_prepare (&local_id, -- cgit v1.2.3 From 0e002624e8458491a8ea5cd901a6c2cce86ee424 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 1 Aug 2021 23:10:31 +0200 Subject: -fix another typo --- src/setu/gnunet-service-setu.c | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/setu/gnunet-service-setu.c b/src/setu/gnunet-service-setu.c index 9a61af67d..2d258bfc5 100644 --- a/src/setu/gnunet-service-setu.c +++ b/src/setu/gnunet-service-setu.c @@ -877,38 +877,41 @@ struct messageControlFlowElement #if MEASURE_PERFORMANCE + /** - * Loads different configuration to do perform perfomance tests - * @param op + * Loads different configuration to perform performance tests + * + * @param op operation handle */ static void load_config (struct Operation *op) { - - setu_cfg = GNUNET_CONFIGURATION_create (); - GNUNET_CONFIGURATION_load (setu_cfg,"perf_setu.conf"); - - long long number; float fl; - GNUNET_CONFIGURATION_get_value_float (setu_cfg,"IBF", "BUCKET_NUMBER_FACTOR", + + setu_cfg = GNUNET_CONFIGURATION_create (); + GNUNET_CONFIGURATION_load (setu_cfg, + "perf_setu.conf"); + GNUNET_CONFIGURATION_get_value_float (setu_cfg, + "IBF", + "BUCKET_NUMBER_FACTOR", &fl); op->ibf_bucket_number_factor = fl; - - GNUNET_CONFIGURATION_get_value_number (setu_cfg,"IBF", "NUMBER_PER_BUCKET", + GNUNET_CONFIGURATION_get_value_number (setu_cfg, + "IBF", + "NUMBER_PER_BUCKET", &number); op->ibf_number_buckets_per_element = number; - - GNUNET_CONFIGURATION_get_value_number (setu_cfg,"PERFORMANCE", "TRADEOFF", + GNUNET_CONFIGURATION_get_value_number (setu_cfg, + "PERFORMANCE", + "TRADEOFF", &number); op->rtt_bandwidth_tradeoff = number; - - - GNUNET_CONFIGURATION_get_value_number (setu_cfg,"BOUNDARIES", "UPPER_ELEMENT", + GNUNET_CONFIGURATION_get_value_number (setu_cfg, + "BOUNDARIES", + "UPPER_ELEMENT", &number); op->byzantine_upper_bound = number; - - op->peer_site = 0; } @@ -920,7 +923,8 @@ load_config (struct Operation *op) * @return bytes used */ static int -sum_sent_received_bytes (uint64_t size, struct perf_num_send_received_msg +sum_sent_received_bytes (uint64_t size, + struct perf_num_send_received_msg perf_num_send_received_msg) { return (size * perf_num_send_received_msg.sent) -- cgit v1.2.3 From 703b21859b69ba2200974afe713f02b0c5574804 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 2 Aug 2021 09:21:12 +0200 Subject: -fix DHT loop --- src/dht/gnunet-service-dht_neighbours.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c index 2c30f0b68..ca255310c 100644 --- a/src/dht/gnunet-service-dht_neighbours.c +++ b/src/dht/gnunet-service-dht_neighbours.c @@ -894,7 +894,7 @@ get_distance (const struct GNUNET_HashCode *target, unsigned int bucket) { uint64_t lsb = 0; - + for (unsigned int i = bucket + 1; (i < sizeof(struct GNUNET_HashCode) * 8) && (i < bucket + 1 + 64); @@ -997,14 +997,15 @@ select_peer (const struct GNUNET_HashCode *key, chosen = NULL; for (bc = 0; bc <= closest_bucket; bc++) { - pos = k_buckets[bc].head; count = 0; - while ( (pos != NULL) && - (count < bucket_size) ) + for (pos = k_buckets[bc].head; + (pos != NULL) && + (count < bucket_size); + pos = pos->next) { unsigned int bucket; uint64_t dist; - + bucket = GNUNET_CRYPTO_hash_matching_bits (key, &pos->phash); dist = get_distance (key, @@ -1037,7 +1038,6 @@ select_peer (const struct GNUNET_HashCode *key, chosen = NULL; } count++; - pos = pos->next; } } if (NULL == chosen) -- cgit v1.2.3 From b339d6eb97d834837ce058a46a489a958f556d37 Mon Sep 17 00:00:00 2001 From: t3sserakt Date: Mon, 2 Aug 2021 10:02:13 +0200 Subject: - fixed typo --- src/transport/transport-testing-cmds.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/transport/transport-testing-cmds.h b/src/transport/transport-testing-cmds.h index 4edd334f0..f171f833f 100644 --- a/src/transport/transport-testing-cmds.h +++ b/src/transport/transport-testing-cmds.h @@ -25,7 +25,7 @@ * @author Christian Grothoff */ #ifndef TRANSPORT_TESTING_CMDS_H -#define TRANSPORT_TESTING__CMDS_H +#define TRANSPORT_TESTING_CMDS_H #include "gnunet_testing_lib.h" struct GNUNET_TESTING_Command -- cgit v1.2.3 From a56b36e0450571d05fa8e97c9990d9bca66f43cc Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 2 Aug 2021 10:11:00 +0200 Subject: -fix warnings --- src/dhtu/plugin_dhtu_ip.c | 67 ++++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/dhtu/plugin_dhtu_ip.c b/src/dhtu/plugin_dhtu_ip.c index f80325cbc..8593a69ef 100644 --- a/src/dhtu/plugin_dhtu_ip.c +++ b/src/dhtu/plugin_dhtu_ip.c @@ -64,12 +64,12 @@ struct GNUNET_DHTU_Source * Address in URL form ("ip+udp://$IP:$PORT") */ char *address; - + /** * Hash of the IP address. */ struct GNUNET_DHTU_Hash id; - + /** * My actual address. */ @@ -79,12 +79,12 @@ struct GNUNET_DHTU_Source * Number of bytes in @a addr. */ socklen_t addrlen; - + /** * Last generation this address was observed. */ unsigned int scan_generation; - + }; @@ -104,12 +104,12 @@ struct GNUNET_DHTU_Target * Kept in a DLL. */ struct GNUNET_DHTU_Target *prev; - + /** * Application context for this target. */ void *app_ctx; - + /** * Hash of the IP address. */ @@ -124,7 +124,7 @@ struct GNUNET_DHTU_Target * Tail of preferences expressed for this target. */ struct GNUNET_DHTU_PreferenceHandle *ph_tail; - + /** * Target IP address. */ @@ -134,7 +134,7 @@ struct GNUNET_DHTU_Target * Number of bytes in @a addr. */ socklen_t addrlen; - + /** * Preference counter, length of the @a ph_head DLL. */ @@ -170,7 +170,7 @@ struct GNUNET_DHTU_PreferenceHandle */ struct Plugin { - /** + /** * Callbacks into the DHT. */ struct GNUNET_DHTU_PluginEnvironment *env; @@ -200,7 +200,7 @@ struct Plugin * Map from hashes of sockaddrs to targets. */ struct GNUNET_CONTAINER_MultiHashMap *dsts; - + /** * Task that scans for IP address changes. */ @@ -212,7 +212,7 @@ struct Plugin struct GNUNET_SCHEDULER_Task *read_task; /** - * Port we bind to. + * Port we bind to. */ char *port; @@ -290,7 +290,7 @@ create_target (struct Plugin *plugin, GNUNET_CONTAINER_multihashmap_size (plugin->dsts)) { struct GNUNET_HashCode key; - + dst = NULL; for (struct GNUNET_DHTU_Target *pos = plugin->dst_head; NULL != pos; @@ -316,7 +316,7 @@ create_target (struct Plugin *plugin, GNUNET_assert (NULL == dst->ph_head); GNUNET_free (dst); } - pk.size = htons (sizeof (pk)); + pk.size = htons (sizeof (pk)); dst = GNUNET_new (struct GNUNET_DHTU_Target); dst->addrlen = addrlen; memcpy (&dst->addr, @@ -391,10 +391,10 @@ find_target (struct Plugin *plugin, addrlen); GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multihashmap_put ( - plugin->dsts, - &key, - dst, - GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); + plugin->dsts, + &key, + dst, + GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); } else { @@ -429,7 +429,7 @@ ip_try_connect (void *cls, .ai_flags = AI_NUMERICHOST | AI_NUMERICSERV }; struct addrinfo *result = NULL; - + if (0 != strncmp (address, "ip+", @@ -481,7 +481,7 @@ ip_try_connect (void *cls, * Request underlay to keep the connection to @a target alive if possible. * Hold may be called multiple times to express a strong preference to * keep a connection, say because a @a target is in multiple tables. - * + * * @param cls closure * @param target connection to keep alive */ @@ -503,7 +503,7 @@ ip_hold (void *cls, /** * Do no long request underlay to keep the connection alive. - * + * * @param cls closure * @param target connection to keep alive */ @@ -511,7 +511,7 @@ static void ip_drop (struct GNUNET_DHTU_PreferenceHandle *ph) { struct GNUNET_DHTU_Target *target = ph->target; - + GNUNET_CONTAINER_DLL_remove (target->ph_head, target->ph_tail, ph); @@ -532,7 +532,7 @@ ip_drop (struct GNUNET_DHTU_PreferenceHandle *ph) * @param msg_size number of bytes in @a msg * @param finished_cb function called once transmission is done * (not called if @a target disconnects, then only the - * disconnect_cb is called). + * disconnect_cb is called). * @param finished_cb_cls closure for @a finished_cb */ static void @@ -568,7 +568,7 @@ create_source (struct Plugin *plugin, socklen_t addrlen) { struct GNUNET_DHTU_Source *src; - + src = GNUNET_new (struct GNUNET_DHTU_Source); src->addrlen = addrlen; memcpy (&src->addr, @@ -731,7 +731,7 @@ find_source (struct Plugin *plugin, (0 == memcmp (addr, &src->addr, addrlen)) ) - return src; + return src; } return create_source (plugin, @@ -788,7 +788,7 @@ read_cb (void *cls) cmsg->cmsg_len) { struct in_pktinfo pi; - + memcpy (&pi, CMSG_DATA (cmsg), sizeof (pi)); @@ -797,7 +797,7 @@ read_cb (void *cls) .sin_family = AF_INET, .sin_addr = pi.ipi_addr }; - + src = find_source (plugin, &sa, sizeof (sa)); @@ -814,7 +814,7 @@ read_cb (void *cls) cmsg->cmsg_len) { struct in6_pktinfo pi; - + memcpy (&pi, CMSG_DATA (cmsg), sizeof (pi)); @@ -824,7 +824,7 @@ read_cb (void *cls) .sin6_addr = pi.ipi6_addr, .sin6_scope_id = pi.ipi6_ifindex }; - + src = find_source (plugin, &sa, sizeof (sa)); @@ -833,7 +833,7 @@ read_cb (void *cls) } else GNUNET_break (0); - } + } } dst = find_target (plugin, &sa, @@ -932,7 +932,8 @@ libgnunet_plugin_dhtu_ip_init (void *cls) GNUNET_free (plugin); return NULL; } - switch (af) { + switch (af) + { case AF_INET: { int on = 1; @@ -956,7 +957,7 @@ libgnunet_plugin_dhtu_ip_init (void *cls) if (0 != bind (sock, - &sa, + (const struct sockaddr *) &sa, sizeof (sa))) { GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, @@ -989,10 +990,10 @@ libgnunet_plugin_dhtu_ip_init (void *cls) .sin6_family = AF_INET6, .sin6_port = htons ((uint16_t) nport) }; - + if (0 != bind (sock, - &sa, + (const struct sockaddr *) &sa, sizeof (sa))) { GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, -- cgit v1.2.3 From 6d911cbe95c747369bb7c8dc724a07c307f553fa Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 2 Aug 2021 10:12:18 +0200 Subject: -fix warnings --- src/setu/gnunet-service-setu.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/setu/gnunet-service-setu.c b/src/setu/gnunet-service-setu.c index 2d258bfc5..b01b897d8 100644 --- a/src/setu/gnunet-service-setu.c +++ b/src/setu/gnunet-service-setu.c @@ -1746,8 +1746,8 @@ full_sync_plausibility_check (struct Operation *op) { LOG (GNUNET_ERROR_TYPE_ERROR, "PROTOCOL VIOLATION: Received duplicate element in full receiving " - "mode of operation this is not allowed! Duplicates: %lu\n", - duplicates); + "mode of operation this is not allowed! Duplicates: %llu\n", + (unsigned long long) duplicates); GNUNET_break_op (0); fail_union_operation (op); return; @@ -2184,10 +2184,10 @@ send_ibf (struct Operation *op, buckets_in_message, &msg[1], msg->ibf_counter_bit_length); buckets_sent += buckets_in_message; LOG (GNUNET_ERROR_TYPE_DEBUG, - "ibf chunk size %u, %lu/%u sent\n", - buckets_in_message, - buckets_sent, - ibf_size); + "ibf chunk size %u, %llu/%u sent\n", + (unsigned int) buckets_in_message, + (unsigned long long) buckets_sent, + (unsigned int) ibf_size); GNUNET_MQ_send (op->mq, ev); } -- cgit v1.2.3 From cbe3743f496b383947644a2bc6c5c1bf03612dce Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 2 Aug 2021 10:29:51 +0200 Subject: -fix test logic --- src/pq/test_pq.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/pq/test_pq.c b/src/pq/test_pq.c index 1df1cd126..ffbb4d129 100644 --- a/src/pq/test_pq.c +++ b/src/pq/test_pq.c @@ -38,7 +38,7 @@ static int ret; /** * An event handler. */ -static struct GNUNET_PQ_EventHandler *eh; +static struct GNUNET_DB_EventHandler *eh; /** * Timeout task. @@ -129,7 +129,7 @@ run_queries (struct GNUNET_PQ_Context *db) uint64_t u64; uint64_t u642; uint64_t uzzz = 42; - + priv = GNUNET_CRYPTO_rsa_private_key_create (1024); pub = GNUNET_CRYPTO_rsa_private_key_get_public (priv); memset (&hmsg, 42, sizeof(hmsg)); @@ -264,16 +264,16 @@ event_cb (void *cls, static int test_notify (struct GNUNET_PQ_Context *db) { - struct GNUNET_PQ_EventHeaderP e1 = { + struct GNUNET_DB_EventHeaderP e1 = { .size = htons (sizeof (e1)), .type = htons (1) }; - struct GNUNET_PQ_EventHeaderP e2 = { + struct GNUNET_DB_EventHeaderP e2 = { .size = htons (sizeof (e2)), .type = htons (2) }; unsigned int called = 0; - struct GNUNET_PQ_EventHandler *eh; + struct GNUNET_DB_EventHandler *eh; eh = GNUNET_PQ_event_listen (db, &e1, @@ -359,7 +359,7 @@ event_sched_cb (void *cls, static void sched_tests (void *cls) { - struct GNUNET_PQ_EventHeaderP es = { + struct GNUNET_DB_EventHeaderP es = { .size = htons (sizeof (es)), .type = htons (42) }; @@ -382,7 +382,7 @@ sched_tests (void *cls) 5); } - + int main (int argc, const char *const argv[]) -- cgit v1.2.3 From 5d1e2bed2cd01c4d14a6044c811fea539d39300b Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 2 Aug 2021 13:31:02 +0200 Subject: -allow NULL --- src/pq/pq_connect.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/pq/pq_connect.c b/src/pq/pq_connect.c index 4e614526b..b06a591cf 100644 --- a/src/pq/pq_connect.c +++ b/src/pq/pq_connect.c @@ -294,7 +294,7 @@ GNUNET_PQ_reconnect_if_down (struct GNUNET_PQ_Context *db) void GNUNET_PQ_reconnect (struct GNUNET_PQ_Context *db) { - if (NULL != db->sc) + if (NULL != db->sc) db->sc (db->sc_cls, -1); if (NULL != db->conn) @@ -468,6 +468,8 @@ GNUNET_PQ_connect_with_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg, void GNUNET_PQ_disconnect (struct GNUNET_PQ_Context *db) { + if (NULL == db) + return; GNUNET_assert (0 == GNUNET_CONTAINER_multishortmap_size (db->channel_map)); GNUNET_CONTAINER_multishortmap_destroy (db->channel_map); -- cgit v1.2.3 From fb80c773d04c339ce8b59c8f496d8af110e28988 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 2 Aug 2021 16:03:52 +0200 Subject: -doxygen fix --- src/include/platform.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/include/platform.h b/src/include/platform.h index e641b38eb..dfa30aeee 100644 --- a/src/include/platform.h +++ b/src/include/platform.h @@ -22,7 +22,7 @@ * @author Nils Durner * @author Christian Grothoff * - * @file + * @file gnunet/src/include/platform.h * Platform specific includes and defines. * * This file should never be included by installed -- cgit v1.2.3 From 9fecb9ed0ea6ae70d636412dead00e56cb3f474c Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 3 Aug 2021 14:32:48 +0200 Subject: -fix memory leaks --- src/util/configuration.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/util/configuration.c b/src/util/configuration.c index 93bc03189..dff3c2e99 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c @@ -322,7 +322,9 @@ GNUNET_CONFIGURATION_destroy (struct GNUNET_CONFIGURATION_Handle *cfg) GNUNET_CONTAINER_DLL_remove (cfg->loaded_files_head, cfg->loaded_files_tail, cf); + GNUNET_free (cf); } + GNUNET_free (cfg->main_filename); GNUNET_free (cfg); } @@ -336,7 +338,9 @@ GNUNET_CONFIGURATION_parse_and_run (const char *filename, enum GNUNET_GenericReturnValue ret; cfg = GNUNET_CONFIGURATION_create (); - if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, filename)) + if (GNUNET_OK != + GNUNET_CONFIGURATION_load (cfg, + filename)) { GNUNET_break (0); GNUNET_CONFIGURATION_destroy (cfg); @@ -620,7 +624,7 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg, { fun_ret = GNUNET_OK; } - cleanup: +cleanup: cfg->current_nest_level = old_nest_level; if (NULL != other_cfg) GNUNET_CONFIGURATION_destroy (other_cfg); @@ -2314,7 +2318,7 @@ GNUNET_CONFIGURATION_load_from (struct GNUNET_CONFIGURATION_Handle *cfg, if (fun_ret != GNUNET_OK) break; } - cleanup: +cleanup: if (files_context.files_length > 0) { for (size_t i = 0; i < files_context.files_length; i++) @@ -2467,7 +2471,10 @@ GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg, } cfg->load_called = true; if (NULL != filename) + { + GNUNET_free (cfg->main_filename); cfg->main_filename = GNUNET_strdup (filename); + } base_config_varname = GNUNET_OS_project_data_get ()->base_config_varname; -- cgit v1.2.3 From 873381c653bbd96f376f8fa028fc49b5ec4fc721 Mon Sep 17 00:00:00 2001 From: t3sserakt Date: Wed, 4 Aug 2021 15:09:17 +0200 Subject: first cmd for a simple tng test running. part of cleanup and sanity check when starting missing --- src/testbed/testbed_api.h | 2 +- src/testbed/testbed_api_cmd_netjail_start_testbed.c | 2 +- src/transport/gnunet-communicator-tcp.c | 2 +- src/transport/transport_api_cmd_connecting_peers.c | 12 ++++++++---- src/transport/transport_api_cmd_send_simple.c | 1 + 5 files changed, 12 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/testbed/testbed_api.h b/src/testbed/testbed_api.h index 67aa6dc1c..9a54ca36c 100644 --- a/src/testbed/testbed_api.h +++ b/src/testbed/testbed_api.h @@ -40,7 +40,7 @@ /** * Cmds Helper binary name */ -#define HELPER_CMDS_BINARY "./../testbed/gnunet-cmds-helper" +#define HELPER_CMDS_BINARY "gnunet-cmds-helper" /** diff --git a/src/testbed/testbed_api_cmd_netjail_start_testbed.c b/src/testbed/testbed_api_cmd_netjail_start_testbed.c index fa0084a0a..2b81c05d1 100644 --- a/src/testbed/testbed_api_cmd_netjail_start_testbed.c +++ b/src/testbed/testbed_api_cmd_netjail_start_testbed.c @@ -328,7 +328,7 @@ start_testbed (struct NetJailState *ns, struct char *const script_argv[] = {NETJAIL_EXEC_SCRIPT, m_char, n_char, - HELPER_CMDS_BINARY, + GNUNET_OS_get_libexec_binary_path(HELPER_CMDS_BINARY), ns->global_n, ns->local_m, NULL}; diff --git a/src/transport/gnunet-communicator-tcp.c b/src/transport/gnunet-communicator-tcp.c index fde85923b..10e2f7d40 100644 --- a/src/transport/gnunet-communicator-tcp.c +++ b/src/transport/gnunet-communicator-tcp.c @@ -2710,7 +2710,7 @@ proto_read_kx (void *cls) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Invalid TCP KX received from %s\n", - GNUNET_a2s (queue->address, queue->address_len)); + GNUNET_a2s (pq->address, pq->address_len)); gcry_cipher_close (queue->in_cipher); GNUNET_free (queue); free_proto_queue (pq); diff --git a/src/transport/transport_api_cmd_connecting_peers.c b/src/transport/transport_api_cmd_connecting_peers.c index 3148806c7..d5c4a5d48 100644 --- a/src/transport/transport_api_cmd_connecting_peers.c +++ b/src/transport/transport_api_cmd_connecting_peers.c @@ -62,6 +62,7 @@ connect_peers_run (void *cls, //size_t *hello_size; enum GNUNET_NetworkType nt = 0; char *peer_id; + struct GNUNET_PeerIdentity *id; peer1_cmd = GNUNET_TESTING_interpreter_lookup_command (cps->peer1_label); GNUNET_TRANSPORT_get_trait_application_handle (peer1_cmd, @@ -74,21 +75,21 @@ connect_peers_run (void *cls, "hello: %s\n", hello); - /*GNUNET_TRANSPORT_get_trait_peer_id (peer1_cmd, + GNUNET_TRANSPORT_get_trait_peer_id (peer1_cmd, &id); LOG (GNUNET_ERROR_TYPE_ERROR, "pid %s\n", - GNUNET_i2s_full(id));*/ + GNUNET_i2s_full(id)); if(strstr(hello, "60002") != NULL) { addr = "tcp-192.168.15.2:60003"; - peer_id = "4TTC9WBSVP9RJT6DVEZ7E0TDW7TQXC11NR1EMR2F8ARS87WZ2730"; + peer_id = "F2F3X9G1YNCTXKK7A4J6M4ZM4BBSKC9DEXZVHCWQ475M0C7PNWCG"; } else { addr = "tcp-192.168.15.1:60002"; - peer_id = "F2F3X9G1YNCTXKK7A4J6M4ZM4BBSKC9DEXZVHCWQ475M0C7PNWCG"; + peer_id = "4TTC9WBSVP9RJT6DVEZ7E0TDW7TQXC11NR1EMR2F8ARS87WZ2730"; } LOG (GNUNET_ERROR_TYPE_ERROR, @@ -139,6 +140,9 @@ connect_peers_finish (void *cls, struct GNUNET_HashCode hc; int node_number; + LOG (GNUNET_ERROR_TYPE_ERROR, + "Connect finished?\n"); + peer1_cmd = GNUNET_TESTING_interpreter_lookup_command (cps->peer1_label); GNUNET_TRANSPORT_get_trait_connected_peers_map (peer1_cmd, &connected_peers_map); diff --git a/src/transport/transport_api_cmd_send_simple.c b/src/transport/transport_api_cmd_send_simple.c index 8d652563f..6c4b76f48 100644 --- a/src/transport/transport_api_cmd_send_simple.c +++ b/src/transport/transport_api_cmd_send_simple.c @@ -129,6 +129,7 @@ GNUNET_TRANSPORT_cmd_send_simple (const char *label, sss->m = m; sss->n = n; sss->num = num; + sss->peer1_label = peer1_label; struct GNUNET_TESTING_Command cmd = { .cls = sss, -- cgit v1.2.3 From ff5075e7f149ffeb9934cb4a505660fc80a9c655 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 4 Aug 2021 20:41:25 +0200 Subject: do not generate tautological comparisson warnings for assertions (if gcc/clang version supports them) --- src/include/gnunet_common.h | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index df1ccff26..8cfeab1cc 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - Copyright (C) 2006-2020 GNUnet e.V. + Copyright (C) 2006-2021 GNUnet e.V. GNUnet is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published @@ -875,10 +875,14 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind); * @ingroup logging * Use this for fatal errors that cannot be handled */ +#if __GNUC__ >= 6 || __clang_major__ >= 6 #define GNUNET_assert(cond) \ do \ { \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wtautological-compare\"") \ if (! (cond)) \ + _Pragma("GCC diagnostic pop") \ { \ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \ _ ("Assertion failed at %s:%d. Aborting.\n"), \ @@ -887,7 +891,21 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind); GNUNET_abort_ (); \ } \ } while (0) - +#else +/* older GCC/clangs do not support -Wtautological-compare */ +#define GNUNET_assert(cond) \ + do \ + { \ + if (! (cond)) \ + { \ + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \ + _ ("Assertion failed at %s:%d. Aborting.\n"), \ + __FILE__, \ + __LINE__); \ + GNUNET_abort_ (); \ + } \ + } while (0) +#endif /** * @ingroup logging -- cgit v1.2.3 From 466ee1f75c837f6c6d3585cc7f91db201521cb9c Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 5 Aug 2021 19:26:58 +0200 Subject: -move pop to not break gcc --- src/include/gnunet_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index 8cfeab1cc..35389e63e 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h @@ -882,7 +882,6 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind); _Pragma("GCC diagnostic push") \ _Pragma("GCC diagnostic ignored \"-Wtautological-compare\"") \ if (! (cond)) \ - _Pragma("GCC diagnostic pop") \ { \ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \ _ ("Assertion failed at %s:%d. Aborting.\n"), \ @@ -890,6 +889,7 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind); __LINE__); \ GNUNET_abort_ (); \ } \ + _Pragma("GCC diagnostic pop") \ } while (0) #else /* older GCC/clangs do not support -Wtautological-compare */ -- cgit v1.2.3 From 781b6f9ab0528fff399b1a3844a6a1f88ca80ca5 Mon Sep 17 00:00:00 2001 From: TheJackiMonster Date: Thu, 5 Aug 2021 22:51:54 +0200 Subject: -corrected doxygen documentation of the message callback Signed-off-by: TheJackiMonster --- src/include/gnunet_messenger_service.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/include/gnunet_messenger_service.h b/src/include/gnunet_messenger_service.h index ff5a91409..5d7155a3d 100644 --- a/src/include/gnunet_messenger_service.h +++ b/src/include/gnunet_messenger_service.h @@ -532,8 +532,8 @@ typedef void /** * Method called whenever a message is sent or received from a room. * - * The flag private_message will be #GNUNET_YES if a message was - * received privately, otherwise #GNUNET_NO. + * The flags will indicate with a bitmask if a message was + * received privately or if the message was sent by the client. * * @param[in/out] cls Closure from #GNUNET_MESSENGER_connect * @param[in] room Room handle -- cgit v1.2.3 From 411da700dd0ff36573f581650ae457fdcc692f31 Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Sun, 8 Aug 2021 13:22:52 +0200 Subject: -make new cmd tests experimental (segfalting); fix warnings --- src/identity/identity_api.c | 4 ---- src/transport/Makefile.am | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) (limited to 'src') diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c index 3bbe0b957..22371f91a 100644 --- a/src/identity/identity_api.c +++ b/src/identity/identity_api.c @@ -1236,14 +1236,12 @@ GNUNET_IDENTITY_public_key_from_string (const char *str, struct GNUNET_IDENTITY_PublicKey *key) { enum GNUNET_GenericReturnValue ret; - enum GNUNET_IDENTITY_KeyType ktype; ret = GNUNET_STRINGS_string_to_data (str, strlen (str), key, sizeof (*key)); if (GNUNET_OK != ret) return GNUNET_SYSERR; - ktype = ntohl (key->type); return GNUNET_OK; } @@ -1254,14 +1252,12 @@ GNUNET_IDENTITY_private_key_from_string (const char *str, struct GNUNET_IDENTITY_PrivateKey *key) { enum GNUNET_GenericReturnValue ret; - enum GNUNET_IDENTITY_KeyType ktype; ret = GNUNET_STRINGS_string_to_data (str, strlen (str), key, sizeof (*key)); if (GNUNET_OK != ret) return GNUNET_SYSERR; - ktype = ntohl (key->type); return GNUNET_OK; } diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am index 55a338729..0782a631b 100644 --- a/src/transport/Makefile.am +++ b/src/transport/Makefile.am @@ -647,7 +647,6 @@ endif if ENABLE_TEST_RUN AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; TESTS = \ - test_transport_api_cmd_simple_send \ test_transport_address_switch_tcp \ $(HTTP_SWITCH) \ $(HTTPS_SWITCH) \ @@ -707,6 +706,7 @@ test_transport_api_slow_ats endif if HAVE_EXPERIMENTAL TESTS += \ + test_transport_api_cmd_simple_send \ test_transport_address_switch_udp \ test_plugin_udp \ test_transport_api_udp \ -- cgit v1.2.3 From 9b0697c03ccba29f5130509b2affe7ee5bbea2b3 Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Sun, 8 Aug 2021 13:24:00 +0200 Subject: -silence compiler warnings --- src/datastore/plugin_datastore_mysql.c | 2 +- src/datastore/plugin_datastore_postgres.c | 2 +- src/datastore/plugin_datastore_sqlite.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/datastore/plugin_datastore_mysql.c b/src/datastore/plugin_datastore_mysql.c index 4f0e0838e..216a6faa4 100644 --- a/src/datastore/plugin_datastore_mysql.c +++ b/src/datastore/plugin_datastore_mysql.c @@ -994,7 +994,7 @@ mysql_plugin_get_expiration (void *cls, void *proc_cls) { struct Plugin *plugin = cls; - struct GNUNET_TIME_Absolute now; + struct GNUNET_TIME_Absolute now = { 0 }; struct GNUNET_MY_QueryParam params_select[] = { GNUNET_MY_query_param_absolute_time (&now), GNUNET_MY_query_param_end diff --git a/src/datastore/plugin_datastore_postgres.c b/src/datastore/plugin_datastore_postgres.c index 66929f91a..8fb0bf6ee 100644 --- a/src/datastore/plugin_datastore_postgres.c +++ b/src/datastore/plugin_datastore_postgres.c @@ -729,7 +729,7 @@ postgres_plugin_get_expiration (void *cls, void *proc_cls) { struct Plugin *plugin = cls; - struct GNUNET_TIME_Absolute now; + struct GNUNET_TIME_Absolute now = { 0 }; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_absolute_time (&now), GNUNET_PQ_query_param_end diff --git a/src/datastore/plugin_datastore_sqlite.c b/src/datastore/plugin_datastore_sqlite.c index f58955b7b..3c2d7f2d4 100644 --- a/src/datastore/plugin_datastore_sqlite.c +++ b/src/datastore/plugin_datastore_sqlite.c @@ -1029,7 +1029,7 @@ sqlite_plugin_get_replication (void *cls, { struct Plugin *plugin = cls; struct ReplCtx rc; - uint64_t rvalue; + uint64_t rvalue = 0; uint32_t repl; struct GNUNET_SQ_QueryParam params_sel_repl[] = { GNUNET_SQ_query_param_uint64 (&rvalue), @@ -1096,7 +1096,7 @@ sqlite_plugin_get_expiration (void *cls, { struct Plugin *plugin = cls; sqlite3_stmt *stmt; - struct GNUNET_TIME_Absolute now; + struct GNUNET_TIME_Absolute now = { 0 }; struct GNUNET_SQ_QueryParam params[] = { GNUNET_SQ_query_param_absolute_time ( &now), GNUNET_SQ_query_param_end }; -- cgit v1.2.3 From 615487401fd79c62ea42ad15ad3740995030ec5c Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Sun, 8 Aug 2021 16:44:48 +0200 Subject: -fix nptr issues --- src/datastore/datastore_api.c | 4 ++-- src/namestore/gnunet-namestore-fcfsd.c | 12 ++++++------ src/namestore/plugin_rest_namestore.c | 6 ++++++ 3 files changed, 14 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/datastore/datastore_api.c b/src/datastore/datastore_api.c index d658b9c85..a49bc8586 100644 --- a/src/datastore/datastore_api.c +++ b/src/datastore/datastore_api.c @@ -1400,7 +1400,7 @@ GNUNET_DATASTORE_get_key (struct GNUNET_DATASTORE_Handle *h, LOG (GNUNET_ERROR_TYPE_DEBUG, "Asked to look for data of type %u under key `%s'\n", (unsigned int) type, - GNUNET_h2s (key)); + (NULL != key) ? GNUNET_h2s (key) : "NULL"); if (NULL == key) { env = GNUNET_MQ_msg (gm, @@ -1430,7 +1430,7 @@ GNUNET_DATASTORE_get_key (struct GNUNET_DATASTORE_Handle *h, { LOG (GNUNET_ERROR_TYPE_DEBUG, "Could not queue request for `%s'\n", - GNUNET_h2s (key)); + (NULL != key) ? GNUNET_h2s (key): "NULL"); return NULL; } #if INSANE_STATISTICS diff --git a/src/namestore/gnunet-namestore-fcfsd.c b/src/namestore/gnunet-namestore-fcfsd.c index 847f7cb64..95d4c5878 100644 --- a/src/namestore/gnunet-namestore-fcfsd.c +++ b/src/namestore/gnunet-namestore-fcfsd.c @@ -185,15 +185,15 @@ do_shutdown (void *cls) } if (NULL != notfound_page) { - MHD_destroy_response (main_page->response); - GNUNET_free (main_page->handle); - GNUNET_free (main_page); + MHD_destroy_response (notfound_page->response); + GNUNET_free (notfound_page->handle); + GNUNET_free (notfound_page); } if (NULL != forbidden_page) { - MHD_destroy_response (main_page->response); - GNUNET_free (main_page->handle); - GNUNET_free (main_page); + MHD_destroy_response (forbidden_page->response); + GNUNET_free (forbidden_page->handle); + GNUNET_free (forbidden_page); } if (NULL != namestore) diff --git a/src/namestore/plugin_rest_namestore.c b/src/namestore/plugin_rest_namestore.c index ae93e5eff..ff5494dc7 100644 --- a/src/namestore/plugin_rest_namestore.c +++ b/src/namestore/plugin_rest_namestore.c @@ -955,6 +955,12 @@ list_ego (void *cls, state = ID_REST_STATE_POST_INIT; return; } + if (NULL == ego) + { + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Called with NULL ego\n"); + return; + } if (ID_REST_STATE_INIT == state) { ego_entry = GNUNET_new (struct EgoEntry); -- cgit v1.2.3 From 8eaf6eafbf7f1bab5f40ade995161ee27a05a84f Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Sun, 8 Aug 2021 17:03:15 +0200 Subject: -various coverity fixes --- src/messenger/gnunet-service-messenger_member.c | 1 + src/messenger/gnunet-service-messenger_room.c | 1 + src/rest/plugin_rest_config.c | 1 + src/revocation/gnunet-service-revocation.c | 1 + src/util/client.c | 2 ++ src/util/configuration.c | 1 + src/util/disk.c | 1 + 7 files changed, 8 insertions(+) (limited to 'src') diff --git a/src/messenger/gnunet-service-messenger_member.c b/src/messenger/gnunet-service-messenger_member.c index 7f00e8438..b0a735dbe 100644 --- a/src/messenger/gnunet-service-messenger_member.c +++ b/src/messenger/gnunet-service-messenger_member.c @@ -88,6 +88,7 @@ callback_scan_for_sessions (void *cls, const char *filename) GNUNET_asprintf (&directory, "%s%c", filename, DIR_SEPARATOR); load_member_session(member, directory); + GNUNET_free (directory); } return GNUNET_OK; diff --git a/src/messenger/gnunet-service-messenger_room.c b/src/messenger/gnunet-service-messenger_room.c index c3a5e3a4b..73e94908f 100644 --- a/src/messenger/gnunet-service-messenger_room.c +++ b/src/messenger/gnunet-service-messenger_room.c @@ -1144,6 +1144,7 @@ load_room (struct GNUNET_MESSENGER_SrvRoom *room) GNUNET_asprintf (&last_messages_file, "%s%s", room_dir, "last_messages.list"); load_message_state(&(room->state), room_dir); + GNUNET_free (last_messages_file); } GNUNET_free(room_dir); diff --git a/src/rest/plugin_rest_config.c b/src/rest/plugin_rest_config.c index af833efff..8269a4662 100644 --- a/src/rest/plugin_rest_config.c +++ b/src/rest/plugin_rest_config.c @@ -334,6 +334,7 @@ set_cont (struct GNUNET_REST_RequestHandle *con_handle, handle->proc (handle->proc_cls, GNUNET_REST_create_response (NULL), MHD_HTTP_OK); + GNUNET_free (cfg_fn); cleanup_handle (handle); } diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c index 2d8111adb..5fe0ade98 100644 --- a/src/revocation/gnunet-service-revocation.c +++ b/src/revocation/gnunet-service-revocation.c @@ -949,6 +949,7 @@ run (void *cls, if (0 > ksize) { GNUNET_break_op (0); + GNUNET_free (rm); GNUNET_free (fn); return; } diff --git a/src/util/client.c b/src/util/client.c index afd2fe900..febc36508 100644 --- a/src/util/client.c +++ b/src/util/client.c @@ -745,6 +745,8 @@ test_service_configuration (const char *service_name, service_name, "UNIXPATH", _ ("not a valid filename")); + if (NULL != unixpath) + GNUNET_free (unixpath); return GNUNET_SYSERR; /* UNIXPATH specified but invalid! */ } GNUNET_free (unixpath); diff --git a/src/util/configuration.c b/src/util/configuration.c index dff3c2e99..1aa52ad76 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c @@ -1007,6 +1007,7 @@ GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg, cf->source_filename, parent->source_filename, filename); + GNUNET_free (fn); return GNUNET_SYSERR; } } diff --git a/src/util/disk.c b/src/util/disk.c index ada35249f..2efb52d46 100644 --- a/src/util/disk.c +++ b/src/util/disk.c @@ -1020,6 +1020,7 @@ GNUNET_DISK_glob (const char *glob_pattern, LOG (GNUNET_ERROR_TYPE_ERROR, "unsupported glob pattern: '%s'\n", glob_pattern); + GNUNET_free (mypat); return -1; } -- cgit v1.2.3 From 5d482d89536a7523d999aeb45d11db12dcd4d764 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 8 Aug 2021 17:17:09 +0200 Subject: -if check is redundant --- src/util/client.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/util/client.c b/src/util/client.c index febc36508..4e5eca32a 100644 --- a/src/util/client.c +++ b/src/util/client.c @@ -745,8 +745,7 @@ test_service_configuration (const char *service_name, service_name, "UNIXPATH", _ ("not a valid filename")); - if (NULL != unixpath) - GNUNET_free (unixpath); + GNUNET_free (unixpath); return GNUNET_SYSERR; /* UNIXPATH specified but invalid! */ } GNUNET_free (unixpath); -- cgit v1.2.3 From 7f0c3bfadc259f3caaf65bb7668058a81526bd28 Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Sun, 8 Aug 2021 18:30:35 +0200 Subject: -bump hostlist location --- src/hostlist/hostlist.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/hostlist/hostlist.conf b/src/hostlist/hostlist.conf index 0a31a23ad..d994ce9fb 100644 --- a/src/hostlist/hostlist.conf +++ b/src/hostlist/hostlist.conf @@ -20,7 +20,7 @@ HOSTLISTFILE = $GNUNET_CONFIG_HOME/hostlist/learned.txt OPTIONS = -b # Default list of hostlist servers for bootstrapping -SERVERS = http://v14.gnunet.org/hostlist https://gnunet.io/hostlist +SERVERS = http://v15.gnunet.org/hostlist https://gnunet.io/hostlist # http://silent.0xdeadc0de.eu:8080/ # bind hostlist http server to a specific IPv4 -- cgit v1.2.3 From b21d106cc36aea6e87aebd9c77a30f33286249e1 Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Sun, 8 Aug 2021 18:48:54 +0200 Subject: -fix make dist; fix warnings --- po/POTFILES.in | 118 +++--- po/de.po | 535 ++++++++++++++++----------- po/es.po | 587 ++++++++++++++++++------------ po/fr.po | 513 +++++++++++++++----------- po/it.po | 507 +++++++++++++++----------- po/sr.po | 580 +++++++++++++++++------------ po/sv.po | 545 +++++++++++++++------------ po/vi.po | 550 ++++++++++++++++------------ po/zh_CN.po | 545 +++++++++++++++------------ src/datacache/plugin_datacache_postgres.c | 4 +- src/datacache/plugin_datacache_sqlite.c | 2 +- src/include/Makefile.am | 1 + src/testing/Makefile.am | 2 +- 13 files changed, 2645 insertions(+), 1844 deletions(-) (limited to 'src') diff --git a/po/POTFILES.in b/po/POTFILES.in index a274c8e9e..edd56bf95 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -10,21 +10,13 @@ src/arm/arm_monitor_api.c src/arm/gnunet-arm.c src/arm/gnunet-service-arm.c src/arm/mockup-service.c -src/ats-tests/ats-testing-experiment.c -src/ats-tests/ats-testing-log.c -src/ats-tests/ats-testing-preferences.c -src/ats-tests/ats-testing-traffic.c -src/ats-tests/ats-testing.c -src/ats-tests/gnunet-ats-sim.c -src/ats-tests/gnunet-solver-eval.c -src/ats-tool/gnunet-ats.c src/ats/ats_api_connectivity.c src/ats/ats_api_performance.c src/ats/ats_api_scanner.c src/ats/ats_api_scheduling.c src/ats/gnunet-ats-solver-eval.c -src/ats/gnunet-service-ats.c src/ats/gnunet-service-ats_addresses.c +src/ats/gnunet-service-ats.c src/ats/gnunet-service-ats_connectivity.c src/ats/gnunet-service-ats_normalization.c src/ats/gnunet-service-ats_performance.c @@ -33,6 +25,14 @@ src/ats/gnunet-service-ats_preferences.c src/ats/gnunet-service-ats_reservations.c src/ats/gnunet-service-ats_scheduling.c src/ats/plugin_ats_proportional.c +src/ats-tests/ats-testing.c +src/ats-tests/ats-testing-experiment.c +src/ats-tests/ats-testing-log.c +src/ats-tests/ats-testing-preferences.c +src/ats-tests/ats-testing-traffic.c +src/ats-tests/gnunet-ats-sim.c +src/ats-tests/gnunet-solver-eval.c +src/ats-tool/gnunet-ats.c src/auction/gnunet-auction-create.c src/auction/gnunet-auction-info.c src/auction/gnunet-auction-join.c @@ -50,8 +50,8 @@ src/cadet/cadet_api_list_peers.c src/cadet/cadet_api_list_tunnels.c src/cadet/cadet_test_lib.c src/cadet/desirability_table.c -src/cadet/gnunet-cadet-profiler.c src/cadet/gnunet-cadet.c +src/cadet/gnunet-cadet-profiler.c src/cadet/gnunet-service-cadet.c src/cadet/gnunet-service-cadet_channel.c src/cadet/gnunet-service-cadet_connection.c @@ -67,15 +67,15 @@ src/consensus/gnunet-service-consensus.c src/consensus/plugin_block_consensus.c src/conversation/conversation_api.c src/conversation/conversation_api_call.c -src/conversation/gnunet-conversation-test.c src/conversation/gnunet-conversation.c -src/conversation/gnunet-helper-audio-playback-gst.c +src/conversation/gnunet-conversation-test.c +src/conversation/gnunet_gst.c +src/conversation/gnunet_gst_test.c src/conversation/gnunet-helper-audio-playback.c -src/conversation/gnunet-helper-audio-record-gst.c +src/conversation/gnunet-helper-audio-playback-gst.c src/conversation/gnunet-helper-audio-record.c +src/conversation/gnunet-helper-audio-record-gst.c src/conversation/gnunet-service-conversation.c -src/conversation/gnunet_gst.c -src/conversation/gnunet_gst_test.c src/conversation/microphone.c src/conversation/plugin_gnsrecord_conversation.c src/conversation/speaker.c @@ -105,6 +105,7 @@ src/dht/dht_api.c src/dht/dht_test_lib.c src/dht/gnunet-dht-get.c src/dht/gnunet-dht-monitor.c +src/dht/gnunet_dht_profiler.c src/dht/gnunet-dht-put.c src/dht/gnunet-service-dht.c src/dht/gnunet-service-dht_clients.c @@ -113,7 +114,6 @@ src/dht/gnunet-service-dht_hello.c src/dht/gnunet-service-dht_neighbours.c src/dht/gnunet-service-dht_nse.c src/dht/gnunet-service-dht_routing.c -src/dht/gnunet_dht_profiler.c src/dht/plugin_block_dht.c src/dhtu/plugin_dhtu_gnunet.c src/dhtu/plugin_dhtu_ip.c @@ -150,8 +150,8 @@ src/fs/gnunet-auto-share.c src/fs/gnunet-daemon-fsprofiler.c src/fs/gnunet-directory.c src/fs/gnunet-download.c -src/fs/gnunet-fs-profiler.c src/fs/gnunet-fs.c +src/fs/gnunet-fs-profiler.c src/fs/gnunet-helper-fs-publish.c src/fs/gnunet-publish.c src/fs/gnunet-search.c @@ -171,9 +171,9 @@ src/gns/gns_tld_api.c src/gns/gnunet-bcd.c src/gns/gnunet-dns2gns.c src/gns/gnunet-gns-benchmark.c +src/gns/gnunet-gns.c src/gns/gnunet-gns-import.c src/gns/gnunet-gns-proxy.c -src/gns/gnunet-gns.c src/gns/gnunet-service-gns.c src/gns/gnunet-service-gns_interceptor.c src/gns/gnunet-service-gns_resolver.c @@ -191,8 +191,8 @@ src/gnsrecord/json_gnsrecord.c src/gnsrecord/plugin_gnsrecord_dns.c src/hello/address.c src/hello/gnunet-hello.c -src/hello/hello-ng.c src/hello/hello.c +src/hello/hello-ng.c src/hostlist/gnunet-daemon-hostlist.c src/hostlist/gnunet-daemon-hostlist_client.c src/hostlist/gnunet-daemon-hostlist_server.c @@ -208,8 +208,8 @@ src/json/json_helper.c src/json/json_mhd.c src/json/json_pack.c src/messenger/gnunet-messenger.c -src/messenger/gnunet-service-messenger.c src/messenger/gnunet-service-messenger_basement.c +src/messenger/gnunet-service-messenger.c src/messenger/gnunet-service-messenger_ego_store.c src/messenger/gnunet-service-messenger_handle.c src/messenger/gnunet-service-messenger_list_handles.c @@ -248,8 +248,8 @@ src/namecache/namecache_api.c src/namecache/plugin_namecache_flat.c src/namecache/plugin_namecache_postgres.c src/namecache/plugin_namecache_sqlite.c -src/namestore/gnunet-namestore-fcfsd.c src/namestore/gnunet-namestore.c +src/namestore/gnunet-namestore-fcfsd.c src/namestore/gnunet-service-namestore.c src/namestore/gnunet-zoneimport.c src/namestore/namestore_api.c @@ -275,17 +275,17 @@ src/nat/gnunet-service-nat_mini.c src/nat/gnunet-service-nat_stun.c src/nat/nat_api.c src/nat/nat_api_stun.c -src/nse/gnunet-nse-profiler.c src/nse/gnunet-nse.c +src/nse/gnunet-nse-profiler.c src/nse/gnunet-service-nse.c src/nse/nse_api.c src/nt/nt.c -src/peerinfo-tool/gnunet-peerinfo.c -src/peerinfo-tool/gnunet-peerinfo_plugins.c -src/peerinfo-tool/plugin_rest_peerinfo.c src/peerinfo/gnunet-service-peerinfo.c src/peerinfo/peerinfo_api.c src/peerinfo/peerinfo_api_notify.c +src/peerinfo-tool/gnunet-peerinfo.c +src/peerinfo-tool/gnunet-peerinfo_plugins.c +src/peerinfo-tool/plugin_rest_peerinfo.c src/peerstore/gnunet-peerstore.c src/peerstore/gnunet-service-peerstore.c src/peerstore/peerstore_api.c @@ -335,27 +335,27 @@ src/rest/gnunet-rest-server.c src/rest/plugin_rest_config.c src/rest/plugin_rest_copying.c src/rest/rest.c -src/revocation/gnunet-revocation-tvg.c src/revocation/gnunet-revocation.c +src/revocation/gnunet-revocation-tvg.c src/revocation/gnunet-service-revocation.c src/revocation/plugin_block_revocation.c src/revocation/revocation_api.c -src/rps/gnunet-rps-profiler.c src/rps/gnunet-rps.c +src/rps/gnunet-rps-profiler.c src/rps/gnunet-service-rps.c src/rps/gnunet-service-rps_custommap.c src/rps/gnunet-service-rps_sampler.c src/rps/gnunet-service-rps_sampler_elem.c src/rps/gnunet-service-rps_view.c +src/rps/rps_api.c src/rps/rps-sampler_client.c src/rps/rps-sampler_common.c src/rps/rps-test_util.c -src/rps/rps_api.c src/scalarproduct/gnunet-scalarproduct.c -src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c -src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c src/scalarproduct/gnunet-service-scalarproduct_alice.c src/scalarproduct/gnunet-service-scalarproduct_bob.c +src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c +src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c src/scalarproduct/scalarproduct_api.c src/secretsharing/gnunet-secretsharing-profiler.c src/secretsharing/gnunet-service-secretsharing.c @@ -369,12 +369,12 @@ src/set/gnunet-set-ibf-profiler.c src/set/gnunet-set-profiler.c src/set/ibf.c src/set/ibf_sim.c -src/set/plugin_block_set_test.c -src/set/set_api.c src/seti/gnunet-service-seti.c src/seti/gnunet-seti-profiler.c src/seti/plugin_block_seti_test.c src/seti/seti_api.c +src/set/plugin_block_set_test.c +src/set/set_api.c src/setu/gnunet-service-setu.c src/setu/gnunet-service-setu_strata_estimator.c src/setu/gnunet-setu-ibf-profiler.c @@ -393,8 +393,6 @@ src/statistics/gnunet-statistics.c src/statistics/statistics_api.c src/template/gnunet-service-template.c src/template/gnunet-template.c -src/testbed-logger/gnunet-service-testbed-logger.c -src/testbed-logger/testbed_logger_api.c src/testbed/generate-underlay-topology.c src/testbed/gnunet-cmd.c src/testbed/gnunet-cmds-helper.c @@ -402,9 +400,10 @@ src/testbed/gnunet-daemon-latency-logger.c src/testbed/gnunet-daemon-testbed-blacklist.c src/testbed/gnunet-daemon-testbed-underlay.c src/testbed/gnunet-helper-testbed.c +src/testbed/gnunet_mpi_test.c src/testbed/gnunet-service-test-barriers.c -src/testbed/gnunet-service-testbed.c src/testbed/gnunet-service-testbed_barriers.c +src/testbed/gnunet-service-testbed.c src/testbed/gnunet-service-testbed_cache.c src/testbed/gnunet-service-testbed_connectionpool.c src/testbed/gnunet-service-testbed_cpustatus.c @@ -412,12 +411,13 @@ src/testbed/gnunet-service-testbed_links.c src/testbed/gnunet-service-testbed_meminfo.c src/testbed/gnunet-service-testbed_oc.c src/testbed/gnunet-service-testbed_peers.c -src/testbed/gnunet-testbed-profiler.c -src/testbed/gnunet_mpi_test.c src/testbed/gnunet_testbed_mpi_spawn.c +src/testbed/gnunet-testbed-profiler.c +src/testbed-logger/gnunet-service-testbed-logger.c +src/testbed-logger/testbed_logger_api.c src/testbed/plugin_testcmd.c -src/testbed/testbed_api.c src/testbed/testbed_api_barriers.c +src/testbed/testbed_api.c src/testbed/testbed_api_cmd_block_until_all_peers_started.c src/testbed/testbed_api_cmd_controller.c src/testbed/testbed_api_cmd_local_test_finished.c @@ -436,42 +436,42 @@ src/testbed/testbed_api_peers.c src/testbed/testbed_api_sd.c src/testbed/testbed_api_services.c src/testbed/testbed_api_statistics.c -src/testbed/testbed_api_test.c src/testbed/testbed_api_testbed.c +src/testbed/testbed_api_test.c src/testbed/testbed_api_topology.c src/testbed/testbed_api_underlay.c src/testing/gnunet-testing.c src/testing/list-keys.c -src/testing/testing.c src/testing/testing_api_cmd_batch.c -src/testing/testing_api_cmd_hello_world.c src/testing/testing_api_cmd_hello_world_birth.c +src/testing/testing_api_cmd_hello_world.c src/testing/testing_api_cmd_send_peer_ready.c src/testing/testing_api_cmd_system_create.c src/testing/testing_api_loop.c src/testing/testing_api_trait_cmd.c src/testing/testing_api_trait_process.c src/testing/testing_api_traits.c +src/testing/testing.c src/topology/friends.c src/topology/gnunet-daemon-topology.c src/transport/gnunet-communicator-tcp.c src/transport/gnunet-communicator-udp.c src/transport/gnunet-communicator-unix.c src/transport/gnunet-helper-transport-bluetooth.c -src/transport/gnunet-helper-transport-wlan-dummy.c src/transport/gnunet-helper-transport-wlan.c +src/transport/gnunet-helper-transport-wlan-dummy.c src/transport/gnunet-service-tng.c -src/transport/gnunet-service-transport.c src/transport/gnunet-service-transport_ats.c +src/transport/gnunet-service-transport.c src/transport/gnunet-service-transport_hello.c src/transport/gnunet-service-transport_manipulation.c src/transport/gnunet-service-transport_neighbours.c src/transport/gnunet-service-transport_plugins.c src/transport/gnunet-service-transport_validation.c +src/transport/gnunet-transport.c src/transport/gnunet-transport-profiler.c src/transport/gnunet-transport-wlan-receiver.c src/transport/gnunet-transport-wlan-sender.c -src/transport/gnunet-transport.c src/transport/plugin_cmd_simple_send.c src/transport/plugin_transport_http_client.c src/transport/plugin_transport_http_common.c @@ -479,25 +479,14 @@ src/transport/plugin_transport_http_server.c src/transport/plugin_transport_smtp.c src/transport/plugin_transport_tcp.c src/transport/plugin_transport_template.c -src/transport/plugin_transport_udp.c src/transport/plugin_transport_udp_broadcasting.c +src/transport/plugin_transport_udp.c src/transport/plugin_transport_unix.c src/transport/plugin_transport_wlan.c src/transport/tcp_connection_legacy.c src/transport/tcp_server_legacy.c src/transport/tcp_server_mst_legacy.c src/transport/tcp_service_legacy.c -src/transport/transport-testing-communicator.c -src/transport/transport-testing-filenames.c -src/transport/transport-testing-filenames2.c -src/transport/transport-testing-loggers.c -src/transport/transport-testing-loggers2.c -src/transport/transport-testing-main.c -src/transport/transport-testing-main2.c -src/transport/transport-testing-send.c -src/transport/transport-testing-send2.c -src/transport/transport-testing.c -src/transport/transport-testing2.c src/transport/transport_api2_application.c src/transport/transport_api2_communication.c src/transport/transport_api2_core.c @@ -513,6 +502,17 @@ src/transport/transport_api_manipulation.c src/transport/transport_api_monitor_peers.c src/transport/transport_api_monitor_plugins.c src/transport/transport_api_offer_hello.c +src/transport/transport-testing2.c +src/transport/transport-testing.c +src/transport/transport-testing-communicator.c +src/transport/transport-testing-filenames2.c +src/transport/transport-testing-filenames.c +src/transport/transport-testing-loggers2.c +src/transport/transport-testing-loggers.c +src/transport/transport-testing-main2.c +src/transport/transport-testing-main.c +src/transport/transport-testing-send2.c +src/transport/transport-testing-send.c src/util/bandwidth.c src/util/benchmark.c src/util/bio.c @@ -527,8 +527,8 @@ src/util/consttime_memcmp.c src/util/container_bloomfilter.c src/util/container_heap.c src/util/container_meta_data.c -src/util/container_multihashmap.c src/util/container_multihashmap32.c +src/util/container_multihashmap.c src/util/container_multipeermap.c src/util/container_multishortmap.c src/util/container_multiuuidmap.c @@ -554,8 +554,8 @@ src/util/dnsstub.c src/util/getopt.c src/util/getopt_helpers.c src/util/gnunet-base32.c -src/util/gnunet-config-diff.c src/util/gnunet-config.c +src/util/gnunet-config-diff.c src/util/gnunet-crypto-tvg.c src/util/gnunet-ecc.c src/util/gnunet-qr.c @@ -593,8 +593,8 @@ src/vpn/gnunet-helper-vpn.c src/vpn/gnunet-service-vpn.c src/vpn/gnunet-vpn.c src/vpn/vpn_api.c -src/zonemaster/gnunet-service-zonemaster-monitor.c src/zonemaster/gnunet-service-zonemaster.c +src/zonemaster/gnunet-service-zonemaster-monitor.c src/fs/fs_api.h src/include/gnunet_json_lib.h src/testbed/testbed_api.h diff --git a/po/de.po b/po/de.po index 997019807..a89ade04c 100644 --- a/po/de.po +++ b/po/de.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: gnunet 0.10.1\n" "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" -"POT-Creation-Date: 2021-04-04 19:19+0200\n" +"POT-Creation-Date: 2021-08-08 18:36+0200\n" "PO-Revision-Date: 2015-03-08 16:16+0100\n" "Last-Translator: Mario Blättermann \n" "Language-Team: German \n" @@ -33,7 +33,7 @@ msgstr "" #: src/abd/gnunet-abd.c:560 src/abd/gnunet-service-abd.c:1747 #: src/namestore/gnunet-namestore.c:1001 -#: src/namestore/gnunet-namestore-fcfsd.c:1164 +#: src/namestore/gnunet-namestore-fcfsd.c:1067 #, fuzzy, c-format msgid "Failed to connect to namestore\n" msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" @@ -755,7 +755,7 @@ msgstr "" #: src/auction/gnunet-auction-info.c:77 src/auction/gnunet-auction-join.c:77 #: src/conversation/gnunet-conversation-test.c:256 -#: src/revocation/gnunet-revocation.c:564 src/template/gnunet-template.c:75 +#: src/revocation/gnunet-revocation.c:570 src/template/gnunet-template.c:75 msgid "help text" msgstr "Hilfetext" @@ -1124,7 +1124,7 @@ msgstr "" #, c-format msgid "" "\n" -"We are now playing your recording back. If you can hear it, your audio " +"ew are now playing your recording back. If you can hear it, your audio " "settings are working..." msgstr "" @@ -1565,39 +1565,39 @@ msgstr "# Bytes empfangen über TCP" msgid "# updates to my type map" msgstr "" -#: src/datacache/datacache.c:115 src/datacache/datacache.c:287 +#: src/datacache/datacache.c:115 src/datacache/datacache.c:299 #: src/datastore/gnunet-service-datastore.c:742 msgid "# bytes stored" msgstr "# gespeicherte Bytes" -#: src/datacache/datacache.c:119 src/datacache/datacache.c:291 +#: src/datacache/datacache.c:119 src/datacache/datacache.c:303 msgid "# items stored" msgstr "# gespeicherte Objekte" -#: src/datacache/datacache.c:189 +#: src/datacache/datacache.c:190 #, c-format msgid "Loading `%s' datacache plugin\n" msgstr "" -#: src/datacache/datacache.c:197 +#: src/datacache/datacache.c:208 #, fuzzy, c-format msgid "Failed to load datacache plugin for `%s'\n" msgstr "Fehler beim Aktualisieren der Daten des Moduls `%s'\n" -#: src/datacache/datacache.c:320 +#: src/datacache/datacache.c:332 msgid "# requests received" msgstr "# Anfragen empfangen" -#: src/datacache/datacache.c:331 +#: src/datacache/datacache.c:343 msgid "# requests filtered by bloom filter" msgstr "" -#: src/datacache/datacache.c:358 +#: src/datacache/datacache.c:370 #, fuzzy msgid "# requests for random value received" msgstr "# Anfragen empfangen" -#: src/datacache/datacache.c:388 +#: src/datacache/datacache.c:400 #, fuzzy msgid "# proximity search requests received" msgstr "# Klartext PONG Nachrichten empfangen" @@ -1944,7 +1944,7 @@ msgstr "MySQL-Datenbank läuft\n" #: src/datastore/plugin_datastore_postgres.c:284 #: src/datastore/plugin_datastore_postgres.c:897 -msgid "Postgress exec failure" +msgid "Postgresql exec failure" msgstr "" #: src/datastore/plugin_datastore_postgres.c:858 @@ -1980,14 +1980,25 @@ msgstr "" msgid "sqlite version to old to determine size, assuming zero\n" msgstr "" -#: src/datastore/plugin_datastore_sqlite.c:1274 +#: src/datastore/plugin_datastore_sqlite.c:1266 +#: src/datastore/plugin_datastore_sqlite.c:1279 +#, fuzzy +msgid "error preparing statement\n" +msgstr "Fehler beim Anlegen des Tunnels\n" + +#: src/datastore/plugin_datastore_sqlite.c:1287 +#, fuzzy +msgid "error stepping\n" +msgstr "%s wird gestoppt" + +#: src/datastore/plugin_datastore_sqlite.c:1295 #, c-format msgid "" "Using sqlite page utilization to estimate payload (%llu pages of size %llu " "bytes)\n" msgstr "" -#: src/datastore/plugin_datastore_sqlite.c:1316 +#: src/datastore/plugin_datastore_sqlite.c:1337 #: src/namecache/plugin_namecache_sqlite.c:564 #: src/namestore/plugin_namestore_sqlite.c:765 msgid "Sqlite database running\n" @@ -2237,97 +2248,97 @@ msgstr "# PING Nachrichten erstellt" msgid "# requests TTL-dropped" msgstr "# dht Anfragen weitergeleitet" -#: src/dht/gnunet-service-dht_neighbours.c:1052 -#: src/dht/gnunet-service-dht_neighbours.c:1096 +#: src/dht/gnunet-service-dht_neighbours.c:1035 +#: src/dht/gnunet-service-dht_neighbours.c:1072 msgid "# Peers excluded from routing due to Bloomfilter" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1069 -#: src/dht/gnunet-service-dht_neighbours.c:1112 +#: src/dht/gnunet-service-dht_neighbours.c:1045 +#: src/dht/gnunet-service-dht_neighbours.c:1088 #, fuzzy msgid "# Peer selection failed" msgstr " Verbindung fehlgeschlagen\n" -#: src/dht/gnunet-service-dht_neighbours.c:1270 +#: src/dht/gnunet-service-dht_neighbours.c:1246 #, fuzzy msgid "# PUT requests routed" msgstr "# dht Anfragen weitergeleitet" -#: src/dht/gnunet-service-dht_neighbours.c:1304 +#: src/dht/gnunet-service-dht_neighbours.c:1280 msgid "# PUT messages queued for transmission" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1316 -#: src/dht/gnunet-service-dht_neighbours.c:1458 -#: src/dht/gnunet-service-dht_neighbours.c:1562 +#: src/dht/gnunet-service-dht_neighbours.c:1292 +#: src/dht/gnunet-service-dht_neighbours.c:1434 +#: src/dht/gnunet-service-dht_neighbours.c:1538 msgid "# P2P messages dropped due to full queue" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1401 +#: src/dht/gnunet-service-dht_neighbours.c:1377 #, fuzzy msgid "# GET requests routed" msgstr "# dht Anfragen weitergeleitet" -#: src/dht/gnunet-service-dht_neighbours.c:1445 +#: src/dht/gnunet-service-dht_neighbours.c:1421 msgid "# GET messages queued for transmission" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1577 +#: src/dht/gnunet-service-dht_neighbours.c:1553 msgid "# RESULT messages queued for transmission" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1680 +#: src/dht/gnunet-service-dht_neighbours.c:1656 #, fuzzy msgid "# Expired PUTs discarded" msgstr "# verworfener Nachrichten" -#: src/dht/gnunet-service-dht_neighbours.c:1688 +#: src/dht/gnunet-service-dht_neighbours.c:1664 #, fuzzy msgid "# P2P PUT requests received" msgstr "# Client Trace-Anfragen empfangen" -#: src/dht/gnunet-service-dht_neighbours.c:1692 +#: src/dht/gnunet-service-dht_neighbours.c:1668 #, fuzzy msgid "# P2P PUT bytes received" msgstr "# Bytes empfangen über TCP" -#: src/dht/gnunet-service-dht_neighbours.c:1924 +#: src/dht/gnunet-service-dht_neighbours.c:1900 msgid "# FIND PEER requests ignored due to Bloomfilter" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1933 +#: src/dht/gnunet-service-dht_neighbours.c:1909 msgid "# FIND PEER requests ignored due to lack of HELLO" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:2096 +#: src/dht/gnunet-service-dht_neighbours.c:2072 #, fuzzy msgid "# P2P GET requests received" msgstr "# Client Trace-Anfragen empfangen" -#: src/dht/gnunet-service-dht_neighbours.c:2100 +#: src/dht/gnunet-service-dht_neighbours.c:2076 #, fuzzy msgid "# P2P GET bytes received" msgstr "# Bytes empfangen über TCP" -#: src/dht/gnunet-service-dht_neighbours.c:2166 +#: src/dht/gnunet-service-dht_neighbours.c:2142 msgid "# P2P FIND PEER requests processed" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:2187 +#: src/dht/gnunet-service-dht_neighbours.c:2163 #, fuzzy msgid "# P2P GET requests ONLY routed" msgstr "# dht Anfragen weitergeleitet" -#: src/dht/gnunet-service-dht_neighbours.c:2365 +#: src/dht/gnunet-service-dht_neighbours.c:2341 #, fuzzy msgid "# Expired results discarded" msgstr "# verworfener Nachrichten" -#: src/dht/gnunet-service-dht_neighbours.c:2382 +#: src/dht/gnunet-service-dht_neighbours.c:2358 msgid "# P2P RESULTS received" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:2386 +#: src/dht/gnunet-service-dht_neighbours.c:2362 #, fuzzy msgid "# P2P RESULT bytes received" msgstr "# Bytes empfangen über TCP" @@ -2810,7 +2821,7 @@ msgstr "" #: src/fs/fs_download.c:346 #, fuzzy, c-format msgid "" -"Failed to access full directroy contents of `%s' for recursive download\n" +"Failed to access full directory contents of `%s' for recursive download\n" msgstr "Fehler beim Aktualisieren der Daten des Moduls `%s'\n" #: src/fs/fs_download.c:528 src/fs/fs_download.c:541 @@ -4094,7 +4105,7 @@ msgstr "" msgid "GNUnet GNS resolver tool" msgstr "GNUnet Netzwerk Topologie tracen." -#: src/gns/gnunet-gns-import.c:491 +#: src/gns/gnunet-gns-import.c:490 msgid "This program will import some GNS authorities into your GNS namestore." msgstr "" @@ -4785,52 +4796,52 @@ msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" msgid "Failed to set default ego: %s\n" msgstr "Fehler beim Parsen der Gerätedaten von `%s' bei %s:%d.\n" -#: src/identity/gnunet-identity.c:462 +#: src/identity/gnunet-identity.c:461 msgid "create ego NAME" msgstr "" -#: src/identity/gnunet-identity.c:467 +#: src/identity/gnunet-identity.c:466 msgid "delete ego NAME " msgstr "" -#: src/identity/gnunet-identity.c:473 +#: src/identity/gnunet-identity.c:472 msgid "" "set the private key for the identity to PRIVATE_KEY (use together with -C)" msgstr "" -#: src/identity/gnunet-identity.c:478 +#: src/identity/gnunet-identity.c:477 msgid "generate an EdDSA identity. (use together with -C) EXPERIMENTAL" msgstr "" -#: src/identity/gnunet-identity.c:482 +#: src/identity/gnunet-identity.c:481 msgid "display all egos" msgstr "" -#: src/identity/gnunet-identity.c:486 +#: src/identity/gnunet-identity.c:485 #, fuzzy msgid "reduce output" msgstr "Ausführliche Ausgabe" -#: src/identity/gnunet-identity.c:493 +#: src/identity/gnunet-identity.c:492 msgid "" "set default identity to NAME for a subsystem SUBSYSTEM (use together with -" "s) or restrict results to NAME (use together with -d)" msgstr "" -#: src/identity/gnunet-identity.c:497 +#: src/identity/gnunet-identity.c:496 msgid "run in monitor mode egos" msgstr "" -#: src/identity/gnunet-identity.c:501 +#: src/identity/gnunet-identity.c:500 msgid "display private keys as well" msgstr "" -#: src/identity/gnunet-identity.c:508 +#: src/identity/gnunet-identity.c:507 msgid "" "set default identity to EGO for a subsystem SUBSYSTEM (use together with -e)" msgstr "" -#: src/identity/gnunet-identity.c:523 +#: src/identity/gnunet-identity.c:522 msgid "Maintain egos" msgstr "" @@ -4885,7 +4896,7 @@ msgstr "Dateiformat fehlerhaft (kein GNUnet Verzeichnis?)\n" msgid "Identity REST API initialized\n" msgstr "" -#: src/json/json.c:139 +#: src/json/json.c:119 #, fuzzy, c-format msgid "Failed to parse JSON in option `%s': %s (%s)\n" msgstr "Datei wurde als `%s' gespeichert.\n" @@ -5226,73 +5237,112 @@ msgstr "" msgid "name of the ego controlling the zone" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:552 -#, fuzzy, c-format -msgid "Unsupported form value `%s'\n" -msgstr "Kommando `%s' wird nicht unterstützt. Vorgang wird abgebrochen.\n" +#: src/namestore/gnunet-namestore-fcfsd.c:359 +#, fuzzy +msgid "can not search the namestore" +msgstr "GNUnet testbed Controller starten." -#: src/namestore/gnunet-namestore-fcfsd.c:579 +#: src/namestore/gnunet-namestore-fcfsd.c:413 +#: src/namestore/gnunet-namestore-fcfsd.c:554 +#, fuzzy +msgid "unable to scan namestore" +msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:441 #, fuzzy, c-format -msgid "Failed to create record for domain `%s': %s\n" +msgid "Failed to create record for `%s': %s\n" msgstr "Fehler beim Lesen der Freunde-Liste von `%s'\n" -#: src/namestore/gnunet-namestore-fcfsd.c:600 -msgid "Error when mapping zone to name\n" -msgstr "" +#: src/namestore/gnunet-namestore-fcfsd.c:453 +#, fuzzy +msgid "no errors" +msgstr "Unbekannter Fehler" -#: src/namestore/gnunet-namestore-fcfsd.c:633 +#: src/namestore/gnunet-namestore-fcfsd.c:489 #, c-format -msgid "Found existing name `%s' for the given key\n" +msgid "The requested key `%s' exists as `%s'\n" +msgstr "" + +#: src/namestore/gnunet-namestore-fcfsd.c:496 +msgid "key exists" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:646 +#: src/namestore/gnunet-namestore-fcfsd.c:513 #, fuzzy -msgid "Error creating record data.\n" +msgid "Error creating record data\n" msgstr "=\tFehler beim Lesen des Verzeichnisses.\n" -#: src/namestore/gnunet-namestore-fcfsd.c:707 +#: src/namestore/gnunet-namestore-fcfsd.c:517 +#, fuzzy +msgid "unable to store record" +msgstr "Zustellung der Nachricht `%s' fehlgeschlagen.\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:588 #, c-format -msgid "Found %u existing records for domain `%s'\n" +msgid "Requested name `%s' exists with `%u' records\n" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:796 -#, fuzzy, c-format -msgid "Failed to create page for `%s'\n" -msgstr "Fehler beim Aktualisieren der Daten des Moduls `%s'\n" - -#: src/namestore/gnunet-namestore-fcfsd.c:815 -#, fuzzy, c-format -msgid "Failed to setup post processor for `%s'\n" -msgstr "Fehler beim Aktualisieren der Daten des Moduls `%s'\n" +#: src/namestore/gnunet-namestore-fcfsd.c:594 +msgid "name exists\n" +msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:850 -msgid "Domain name must not contain `.'\n" +#: src/namestore/gnunet-namestore-fcfsd.c:780 +msgid "unable to process submitted data" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:859 -msgid "Domain name must not contain `+'\n" +#: src/namestore/gnunet-namestore-fcfsd.c:787 +msgid "the submitted data is invalid" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:1094 +#: src/namestore/gnunet-namestore-fcfsd.c:806 +#, fuzzy +msgid "invalid parameters" +msgstr "Ungültiges Argument »%s«\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:823 +#, fuzzy +msgid "invalid name" +msgstr "Ungültiges Argument »%s«\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:834 +#, fuzzy, c-format +msgid "Unable to parse key %s\n" +msgstr "Dateiformat fehlerhaft (kein GNUnet Verzeichnis?)\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:838 +#, fuzzy +msgid "unable to parse key" +msgstr "Dateiformat fehlerhaft (kein GNUnet Verzeichnis?)\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:949 msgid "No ego configured for `fcfsd` subsystem\n" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:1125 +#: src/namestore/gnunet-namestore-fcfsd.c:974 #, fuzzy msgid "Failed to start HTTP server\n" msgstr "Fehler beim Senden einer `%s' Anfrage an den SMTP Server.\n" -#: src/namestore/gnunet-namestore-fcfsd.c:1173 +#: src/namestore/gnunet-namestore-fcfsd.c:1058 +msgid "No port specified, using default value\n" +msgstr "" + +#: src/namestore/gnunet-namestore-fcfsd.c:1076 #, fuzzy msgid "Failed to connect to identity\n" msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" -#: src/namestore/gnunet-namestore-fcfsd.c:1200 -msgid "name of the zone that is to be managed by FCFSD" +#: src/namestore/gnunet-namestore-fcfsd.c:1100 +#, fuzzy +msgid "Unable to set up the daemon\n" +msgstr "Zustellung der Nachricht `%s' fehlgeschlagen.\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:1123 +msgid "name of the zone managed by FCFSD" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:1220 -msgid "GNU Name System First Come First Serve name registration service" +#: src/namestore/gnunet-namestore-fcfsd.c:1132 +msgid "GNU Name System First-Come-First-Served name registration service" msgstr "" #: src/namestore/gnunet-service-namestore.c:871 @@ -5300,11 +5350,11 @@ msgstr "" msgid "Failed to replicate block in namecache: %s\n" msgstr "" -#: src/namestore/gnunet-zoneimport.c:1848 +#: src/namestore/gnunet-zoneimport.c:1847 msgid "size to use for the main hash map" msgstr "" -#: src/namestore/gnunet-zoneimport.c:1854 +#: src/namestore/gnunet-zoneimport.c:1853 msgid "minimum expiration time we assume for imported records" msgstr "" @@ -5327,7 +5377,7 @@ msgstr "" msgid "Flat file database running\n" msgstr "Sqlite-Datenbank läuft\n" -#: src/namestore/plugin_rest_namestore.c:1105 +#: src/namestore/plugin_rest_namestore.c:1111 #, fuzzy msgid "Namestore REST API initialized\n" msgstr " Verbindung fehlgeschlagen\n" @@ -5995,12 +6045,12 @@ msgstr "" msgid "re:claimID command line tool" msgstr "" -#: src/reclaim/plugin_rest_openid_connect.c:2788 +#: src/reclaim/plugin_rest_openid_connect.c:2793 #, fuzzy msgid "OpenID Connect REST API initialized\n" msgstr " Verbindung fehlgeschlagen\n" -#: src/reclaim/plugin_rest_reclaim.c:1521 +#: src/reclaim/plugin_rest_pabc.c:637 src/reclaim/plugin_rest_reclaim.c:1520 #, fuzzy msgid "Identity Provider REST API initialized\n" msgstr " Verbindung fehlgeschlagen\n" @@ -6019,56 +6069,56 @@ msgstr "" msgid "Daemon to announce regular expressions for the peer using cadet." msgstr "" -#: src/regex/gnunet-regex-profiler.c:1390 +#: src/regex/gnunet-regex-profiler.c:1392 msgid "No configuration file given. Exiting\n" msgstr "Keine Konfigurationsdatei angegeben. Abbruch\n" -#: src/regex/gnunet-regex-profiler.c:1432 +#: src/regex/gnunet-regex-profiler.c:1434 #: src/regex/gnunet-regex-simulation-profiler.c:631 #, c-format msgid "No policy directory specified on command line. Exiting.\n" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1438 +#: src/regex/gnunet-regex-profiler.c:1440 #: src/regex/gnunet-regex-simulation-profiler.c:639 #, c-format msgid "Specified policies directory does not exist. Exiting.\n" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1446 +#: src/regex/gnunet-regex-profiler.c:1448 #, c-format msgid "No files found in `%s'\n" msgstr "Keine Dateien in »%s« gefunden\n" -#: src/regex/gnunet-regex-profiler.c:1455 +#: src/regex/gnunet-regex-profiler.c:1457 msgid "No search strings file given. Exiting.\n" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1475 +#: src/regex/gnunet-regex-profiler.c:1477 msgid "Error loading search strings. Exiting.\n" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1563 +#: src/regex/gnunet-regex-profiler.c:1565 msgid "name of the file for writing statistics" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1570 +#: src/regex/gnunet-regex-profiler.c:1572 msgid "wait TIMEOUT before ending the experiment" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1576 +#: src/regex/gnunet-regex-profiler.c:1578 msgid "directory with policy files" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1584 +#: src/regex/gnunet-regex-profiler.c:1586 msgid "name of file with input strings" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1591 +#: src/regex/gnunet-regex-profiler.c:1593 msgid "name of file with hosts' names" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1604 +#: src/regex/gnunet-regex-profiler.c:1606 msgid "Profiler for regex" msgstr "" @@ -6094,12 +6144,12 @@ msgstr "" msgid "Search string `%s' is too long!\n" msgstr "Dienst »%s« läuft nicht\n" -#: src/rest/gnunet-rest-server.c:1266 +#: src/rest/gnunet-rest-server.c:1267 #, fuzzy msgid "GNUnet REST server" msgstr "GNUnet Netzwerk Topologie tracen." -#: src/rest/plugin_rest_config.c:427 +#: src/rest/plugin_rest_config.c:428 #, fuzzy msgid "CONFIG REST API initialized\n" msgstr " Verbindung fehlgeschlagen\n" @@ -6164,71 +6214,76 @@ msgstr "" msgid "Ego `%s' not found.\n" msgstr "Kommando `%s' wurde nicht gefunden!\n" -#: src/revocation/gnunet-revocation.c:351 +#: src/revocation/gnunet-revocation.c:350 +#, fuzzy, c-format +msgid "Error: Key is invalid\n" +msgstr "Schlüssel »%s« ist gültig\n" + +#: src/revocation/gnunet-revocation.c:357 #, c-format msgid "Error: revocation certificate in `%s' is not for `%s'\n" msgstr "" -#: src/revocation/gnunet-revocation.c:361 +#: src/revocation/gnunet-revocation.c:367 msgid "Revocation certificate ready\n" msgstr "" -#: src/revocation/gnunet-revocation.c:373 +#: src/revocation/gnunet-revocation.c:379 msgid "Continuing calculation where left off...\n" msgstr "" -#: src/revocation/gnunet-revocation.c:380 +#: src/revocation/gnunet-revocation.c:386 msgid "Revocation certificate not ready, calculating proof of work\n" msgstr "" -#: src/revocation/gnunet-revocation.c:418 +#: src/revocation/gnunet-revocation.c:424 #, c-format msgid "Public key `%s' malformed\n" msgstr "" -#: src/revocation/gnunet-revocation.c:428 +#: src/revocation/gnunet-revocation.c:434 msgid "" "Testing and revoking at the same time is not allowed, only executing test.\n" msgstr "" -#: src/revocation/gnunet-revocation.c:458 +#: src/revocation/gnunet-revocation.c:464 msgid "No filename to store revocation certificate given.\n" msgstr "" -#: src/revocation/gnunet-revocation.c:475 +#: src/revocation/gnunet-revocation.c:481 #, fuzzy, c-format msgid "Failed to read revocation certificate from `%s'\n" msgstr "Fehler beim Lesen der Freunde-Liste von `%s'\n" -#: src/revocation/gnunet-revocation.c:483 +#: src/revocation/gnunet-revocation.c:489 #, fuzzy, c-format msgid "Revocation certificate corrupted in `%s'\n" msgstr "Fehler beim Lesen der Freunde-Liste von `%s'\n" -#: src/revocation/gnunet-revocation.c:505 +#: src/revocation/gnunet-revocation.c:511 #, fuzzy msgid "No action specified. Nothing to do.\n" msgstr "Keine Kommandos angegeben.\n" -#: src/revocation/gnunet-revocation.c:524 +#: src/revocation/gnunet-revocation.c:530 msgid "use NAME for the name of the revocation file" msgstr "" -#: src/revocation/gnunet-revocation.c:532 +#: src/revocation/gnunet-revocation.c:538 msgid "" "revoke the private key associated for the the private key associated with " "the ego NAME " msgstr "" -#: src/revocation/gnunet-revocation.c:539 +#: src/revocation/gnunet-revocation.c:545 msgid "actually perform revocation, otherwise we just do the precomputation" msgstr "" -#: src/revocation/gnunet-revocation.c:546 +#: src/revocation/gnunet-revocation.c:552 msgid "test if the public key KEY has been revoked" msgstr "" -#: src/revocation/gnunet-revocation.c:552 +#: src/revocation/gnunet-revocation.c:558 #, fuzzy msgid "number of epochs to calculate for" msgstr "Anzahl an Durchläufen" @@ -6353,12 +6408,12 @@ msgstr "" #: src/scalarproduct/gnunet-service-scalarproduct_alice.c:1358 #: src/scalarproduct/gnunet-service-scalarproduct_bob.c:1355 #: src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c:1118 -#: src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c:1063 +#: src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c:1034 #, fuzzy msgid "Connect to CADET failed\n" msgstr " Verbindung fehlgeschlagen\n" -#: src/scalarproduct/scalarproduct_api.c:189 +#: src/scalarproduct/scalarproduct_api.c:184 msgid "Keys given to SCALARPRODUCT not unique!\n" msgstr "" @@ -6379,7 +6434,7 @@ msgid "also profile decryption" msgstr "" #: src/set/gnunet-service-set.c:1916 src/seti/gnunet-service-seti.c:2467 -#: src/setu/gnunet-service-setu.c:3832 +#: src/setu/gnunet-service-setu.c:5395 #, fuzzy msgid "Could not connect to CADET service\n" msgstr "Verbindung zum %s-Dienst ist fehlgeschlagen!\n" @@ -6623,7 +6678,7 @@ msgid "" "\t cap: the maximum number of links a node can have\n" "\t m: the number of links a node should have while joining the network\n" "\t filename: the path of the file which contains topology information\n" -"NOTE: the format of the above file is descibed here: https://www.gnunet.org/" +"NOTE: the format of the above file is described here: https://www.gnunet.org/" "content/topology-file-format\n" msgstr "" @@ -6721,7 +6776,7 @@ msgid "Spawning process `%s'\n" msgstr "Ungültige Antwort auf `%s'.\n" #: src/testbed/gnunet-testbed-profiler.c:290 -msgid "tolerate COUNT number of continious timeout failures" +msgid "tolerate COUNT number of continuous timeout failures" msgstr "" #: src/testbed/gnunet-testbed-profiler.c:295 @@ -7023,14 +7078,14 @@ msgstr "# HELLO-Meldungen empfangen" msgid "GNUnet topology control" msgstr "" -#: src/transport/gnunet-communicator-tcp.c:3331 +#: src/transport/gnunet-communicator-tcp.c:3314 #: src/transport/gnunet-communicator-udp.c:3790 -#: src/transport/gnunet-service-tng.c:10220 +#: src/transport/gnunet-service-tng.c:10223 #: src/transport/gnunet-service-transport.c:2627 msgid "Transport service is lacking key configuration settings. Exiting.\n" msgstr "" -#: src/transport/gnunet-communicator-tcp.c:3668 +#: src/transport/gnunet-communicator-tcp.c:3652 msgid "GNUnet TCP communicator" msgstr "" @@ -8100,7 +8155,7 @@ msgstr "" msgid "Service process failed to report status\n" msgstr "" -#: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1040 +#: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1220 #: src/util/service.c:1637 #, fuzzy, c-format msgid "Cannot obtain information about user `%s': %s\n" @@ -8219,47 +8274,47 @@ msgstr "Ungültiger Parameter: `%s'\n" msgid "Failed to serialize metadata `%s'" msgstr "Fehler beim Lesen der Freunde-Liste von `%s'\n" -#: src/util/client.c:747 src/util/client.c:937 +#: src/util/client.c:747 src/util/client.c:938 msgid "not a valid filename" msgstr "" -#: src/util/client.c:1103 +#: src/util/client.c:1104 #, c-format msgid "Need a non-empty hostname for service `%s'.\n" msgstr "" -#: src/util/common_logging.c:259 src/util/common_logging.c:1114 -msgid "DEBUG" -msgstr "DEBUG" - -#: src/util/common_logging.c:261 src/util/common_logging.c:1112 -msgid "INFO" -msgstr "INFO" - -#: src/util/common_logging.c:263 src/util/common_logging.c:1110 -msgid "MESSAGE" +#: src/util/common_logging.c:626 src/util/common_logging.c:665 +#, c-format +msgid "ERROR: Unable to parse log definition: Syntax error at `%s'.\n" msgstr "" -#: src/util/common_logging.c:265 src/util/common_logging.c:1108 -msgid "WARNING" -msgstr "WARNUNG" +#: src/util/common_logging.c:904 +#, c-format +msgid "Message `%.*s' repeated %u times in the last %s\n" +msgstr "" -#: src/util/common_logging.c:267 src/util/common_logging.c:1106 +#: src/util/common_logging.c:1106 msgid "ERROR" msgstr "FEHLER" -#: src/util/common_logging.c:269 src/util/common_logging.c:1116 -msgid "NONE" -msgstr "" +#: src/util/common_logging.c:1108 +msgid "WARNING" +msgstr "WARNUNG" -#: src/util/common_logging.c:626 src/util/common_logging.c:665 -#, c-format -msgid "ERROR: Unable to parse log definition: Syntax error at `%s'.\n" +#: src/util/common_logging.c:1110 +msgid "MESSAGE" msgstr "" -#: src/util/common_logging.c:904 -#, c-format -msgid "Message `%.*s' repeated %u times in the last %s\n" +#: src/util/common_logging.c:1112 +msgid "INFO" +msgstr "INFO" + +#: src/util/common_logging.c:1114 +msgid "DEBUG" +msgstr "DEBUG" + +#: src/util/common_logging.c:1116 +msgid "NONE" msgstr "" #: src/util/common_logging.c:1117 @@ -8289,38 +8344,68 @@ msgstr "" "Die Konfigurationsdatei muss in der Sektion `%s' unter `%s' ein Verzeichnis " "angeben, in dem FS Daten gespeichert werden.\n" -#: src/util/configuration.c:370 +#: src/util/configuration.c:790 +#, c-format +msgid "Illegal directive in line %u (parsing restricted section %s)\n" +msgstr "" + +#: src/util/configuration.c:800 +#, c-format +msgid "Bad directive in line %u\n" +msgstr "" + +#: src/util/configuration.c:853 +#, c-format +msgid "Bad inline-secret directive in line %u\n" +msgstr "" + +#: src/util/configuration.c:875 +#, c-format +msgid "Unknown or malformed directive '%s' in line %u\n" +msgstr "" + +#: src/util/configuration.c:905 +#, fuzzy, c-format +msgid "Syntax error while deserializing in line %u (option without section)\n" +msgstr "Syntaxfehler in Konfigurationsdatei `%s' in Zeile %d.\n" + +#: src/util/configuration.c:949 #, fuzzy, c-format msgid "Syntax error while deserializing in line %u\n" msgstr "Syntaxfehler in Konfigurationsdatei `%s' in Zeile %d.\n" -#: src/util/configuration.c:420 +#: src/util/configuration.c:1049 #, fuzzy, c-format msgid "Error while reading file `%s'\n" msgstr "Konfigurationsdatei `%s' konnte nicht geöffnet werden.\n" -#: src/util/configuration.c:980 +#: src/util/configuration.c:1062 +#, fuzzy, c-format +msgid "Failed to parse configuration file `%s'\n" +msgstr "Fehler beim Speichern der Konfigurationsdatei `%s':" + +#: src/util/configuration.c:1695 msgid "Not a valid relative time specification" msgstr "" -#: src/util/configuration.c:1050 +#: src/util/configuration.c:1765 #, c-format msgid "" "Configuration value '%s' for '%s' in section '%s' is not in set of legal " "choices\n" msgstr "" -#: src/util/configuration.c:1145 +#: src/util/configuration.c:1860 #, c-format msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n" msgstr "" -#: src/util/configuration.c:1177 +#: src/util/configuration.c:1892 #, c-format msgid "Missing closing `%s' in option `%s'\n" msgstr "" -#: src/util/configuration.c:1243 +#: src/util/configuration.c:1958 #, c-format msgid "" "Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined " @@ -8365,7 +8450,7 @@ msgstr "`%s' schlug fehl bei %s:%d mit dem Fehler: `%s'.\n" msgid "RSA signature verification failed at %s:%d: %s\n" msgstr "RSA Signaturüberprüfung fehlgeschlagen bei %s:%d: %s\n" -#: src/util/disk.c:823 +#: src/util/disk.c:843 #, fuzzy, c-format msgid "Expected `%s' to be a directory!\n" msgstr "`%s' erwartet, dass `%s' ein Verzeichnis ist!\n" @@ -8549,60 +8634,70 @@ msgstr "Sie müssen für die Option »%s« zusätzlich eine Zahl angeben.\n" msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" msgstr "" -#: src/util/gnunet-base32.c:45 +#: src/util/gnunet-base32.c:46 msgid "run decoder modus, otherwise runs as encoder" msgstr "" -#: src/util/gnunet-config.c:167 -#, fuzzy, c-format -msgid "failed to load configuration defaults" -msgstr "Konfiguration konnte nicht aus %s geladen werden\n" - -#: src/util/gnunet-config.c:179 -#, fuzzy, c-format -msgid "%s or %s argument is required\n" -msgstr "Option `%s' macht keinen Sinn ohne die Option `%s'.\n" - -#: src/util/gnunet-config.c:186 +#: src/util/gnunet-config.c:187 #, c-format msgid "The following sections are available:\n" msgstr "" -#: src/util/gnunet-config.c:234 +#: src/util/gnunet-config.c:201 +#, fuzzy, c-format +msgid "%s, %s or %s argument is required\n" +msgstr "Option `%s' macht keinen Sinn ohne die Option `%s'.\n" + +#: src/util/gnunet-config.c:266 #, c-format msgid "--option argument required to set value\n" msgstr "" -#: src/util/gnunet-config.c:284 -msgid "interpret option value as a filename (with $-expansion)" -msgstr "" +#: src/util/gnunet-config.c:309 +#, fuzzy, c-format +msgid "failed to load configuration defaults" +msgstr "Konfiguration konnte nicht aus %s geladen werden\n" -#: src/util/gnunet-config.c:291 +#: src/util/gnunet-config.c:354 msgid "test if the current installation supports the specified BACKEND" msgstr "" -#: src/util/gnunet-config.c:297 -msgid "name of the section to access" +#: src/util/gnunet-config.c:360 +#, fuzzy +msgid "write the full configuration file, including default values" +msgstr "Konfiguration konnte nicht aus %s geladen werden\n" + +#: src/util/gnunet-config.c:365 +msgid "interpret option value as a filename (with $-expansion)" msgstr "" -#: src/util/gnunet-config.c:302 +#: src/util/gnunet-config.c:370 msgid "name of the option to access" msgstr "" -#: src/util/gnunet-config.c:307 -msgid "value to set" +#: src/util/gnunet-config.c:376 +#, fuzzy +msgid "rewrite the configuration file, even if nothing changed" +msgstr "Keine Konfigurationsdatei angegeben. Abbruch\n" + +#: src/util/gnunet-config.c:382 +msgid "output extra diagnostics" msgstr "" -#: src/util/gnunet-config.c:312 +#: src/util/gnunet-config.c:387 #, fuzzy msgid "print available configuration sections" msgstr "GNUnet Konfiguration" -#: src/util/gnunet-config.c:318 -msgid "write configuration file that only contains delta to defaults" +#: src/util/gnunet-config.c:393 +msgid "name of the section to access" +msgstr "" + +#: src/util/gnunet-config.c:398 +msgid "value to set" msgstr "" -#: src/util/gnunet-config.c:330 +#: src/util/gnunet-config.c:413 msgid "Manipulate GNUnet configuration files" msgstr "GNUnet-Konfigurationsdateien bearbeiten" @@ -8833,22 +8928,22 @@ msgstr "" msgid "`%s' failed for library `%s' with error: %s\n" msgstr "`%s' fehlgeschlagen für die Bibliothek `%s'. Ort: %s:%d. Fehler: %s\n" -#: src/util/plugin.c:409 +#: src/util/plugin.c:414 #, fuzzy msgid "Could not determine plugin installation path.\n" msgstr "Öffentliche IP-Adresse konnte nicht ermittelt werden.\n" -#: src/util/program.c:259 +#: src/util/program.c:252 #, fuzzy, c-format msgid "Unreadable or malformed configuration file `%s', exit ...\n" msgstr "Konfigurationsdatei `%s' wurde erzeugt.\n" -#: src/util/program.c:276 +#: src/util/program.c:272 #, fuzzy, c-format msgid "Unreadable or malformed default configuration file `%s', exit ...\n" msgstr "Konfigurationsdatei `%s' wurde erzeugt.\n" -#: src/util/program.c:291 +#: src/util/program.c:288 #, fuzzy msgid "Unreadable or malformed configuration, exit ...\n" msgstr "GNUnet Konfiguration" @@ -8916,82 +9011,82 @@ msgstr "" msgid "Attempting to proxy service `%s' to invalid port %d or hostname.\n" msgstr "" -#: src/util/strings.c:503 +#: src/util/strings.c:409 #, c-format msgid "Character sets requested were `%s'->`%s'\n" msgstr "" -#: src/util/strings.c:637 +#: src/util/strings.c:501 msgid "Failed to expand `$HOME': environment variable `HOME' not set" msgstr "" -#: src/util/strings.c:1241 +#: src/util/strings.c:1036 msgid "IPv6 address did not start with `['\n" msgstr "IPv6-Adresse beginnt nicht mit »[«\n" -#: src/util/strings.c:1249 +#: src/util/strings.c:1044 msgid "IPv6 address did contain ':' to separate port number\n" msgstr "IPv6-Adresse enthält kein »:« zur Abtrennung der Portnummer\n" -#: src/util/strings.c:1256 +#: src/util/strings.c:1051 msgid "IPv6 address did contain ']' before ':' to separate port number\n" msgstr "IPv6-Adresse enthält kein »]« vor »:« zur Abtrennung der Portnummer\n" -#: src/util/strings.c:1264 +#: src/util/strings.c:1059 msgid "IPv6 address did contain a valid port number after the last ':'\n" msgstr "IPv6-Adresse enthält keine gültige Portnummer nach dem letzten »:«\n" -#: src/util/strings.c:1273 +#: src/util/strings.c:1068 #, fuzzy, c-format msgid "Invalid IPv6 address `%s': %s\n" msgstr "Ungültige Antwort auf `%s' von `%s'\n" -#: src/util/strings.c:1500 src/util/strings.c:1511 +#: src/util/strings.c:1250 src/util/strings.c:1261 msgid "Port not in range\n" msgstr "Port außerhalb des Bereichs\n" -#: src/util/strings.c:1520 +#: src/util/strings.c:1270 #, c-format msgid "Malformed port policy `%s'\n" msgstr "" -#: src/util/strings.c:1603 src/util/strings.c:1632 src/util/strings.c:1679 -#: src/util/strings.c:1699 +#: src/util/strings.c:1341 src/util/strings.c:1370 src/util/strings.c:1417 +#: src/util/strings.c:1437 #, c-format msgid "Invalid format for IP: `%s'\n" msgstr "Ungültiges Format für IP: »%s«\n" -#: src/util/strings.c:1657 +#: src/util/strings.c:1395 #, c-format msgid "Invalid network notation ('/%d' is not legal in IPv4 CIDR)." msgstr "Ungültige Netzwerk-Notation ('/%d ist nicht gültig in IPv4 CIDR)." -#: src/util/strings.c:1708 +#: src/util/strings.c:1446 #, fuzzy, c-format msgid "Invalid format: `%s'\n" msgstr "Ungültiges Format für IP: `%s'\n" -#: src/util/strings.c:1761 +#: src/util/strings.c:1488 #, c-format msgid "Invalid network notation (does not end with ';': `%s')\n" msgstr "Ungültige Netzwerk-Notation (endet nicht mit »;«: »%s«)\n" -#: src/util/strings.c:1811 +#: src/util/strings.c:1538 #, fuzzy, c-format msgid "Wrong format `%s' for netmask\n" msgstr "Falsches Format `%s' für Netzmaske: %s\n" -#: src/util/strings.c:1842 +#: src/util/strings.c:1569 #, fuzzy, c-format msgid "Wrong format `%s' for network\n" msgstr "Falsches Format `%s' für Netzwerk: %s\n" -#: src/util/time.c:878 src/util/time.c:906 +#: src/util/time.c:699 src/util/time.c:727 #, c-format msgid "Failed to map `%s', cannot assure monotonic time!\n" msgstr "" -#: src/util/time.c:914 +#: src/util/time.c:735 #, c-format msgid "" "Failed to setup monotonic time file `%s', cannot assure monotonic time!\n" @@ -9177,6 +9272,18 @@ msgstr "Tunnel über VPN einrichten." msgid "Failed to connect to the namestore!\n" msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" +#, fuzzy, c-format +#~ msgid "Unsupported form value `%s'\n" +#~ msgstr "Kommando `%s' wird nicht unterstützt. Vorgang wird abgebrochen.\n" + +#, fuzzy, c-format +#~ msgid "Failed to create page for `%s'\n" +#~ msgstr "Fehler beim Aktualisieren der Daten des Moduls `%s'\n" + +#, fuzzy, c-format +#~ msgid "Failed to setup post processor for `%s'\n" +#~ msgstr "Fehler beim Aktualisieren der Daten des Moduls `%s'\n" + #~ msgid "b" #~ msgstr "b" @@ -9593,10 +9700,6 @@ msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" #~ msgstr "" #~ "Fehler beim Empfangen der Antwort von gnunetd auf die `%s' Nachricht\n" -#, fuzzy -#~ msgid "unknown error" -#~ msgstr "Unbekannter Fehler" - #, fuzzy #~ msgid "Invalid response from `fs' service." #~ msgstr "Ungültige Antwort auf `%s'.\n" diff --git a/po/es.po b/po/es.po index 81b3c36fc..8cf8298a5 100644 --- a/po/es.po +++ b/po/es.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: gnunet 0.9.5a\n" "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" -"POT-Creation-Date: 2021-04-04 19:19+0200\n" +"POT-Creation-Date: 2021-08-08 18:36+0200\n" "PO-Revision-Date: 2013-02-23 17:50+0100\n" "Last-Translator: Miguel Ángel Arruga Vivas \n" "Language-Team: Spanish \n" @@ -30,7 +30,7 @@ msgstr "El bloque del tipo %u está mal formado\n" #: src/abd/gnunet-abd.c:560 src/abd/gnunet-service-abd.c:1747 #: src/namestore/gnunet-namestore.c:1001 -#: src/namestore/gnunet-namestore-fcfsd.c:1164 +#: src/namestore/gnunet-namestore-fcfsd.c:1067 #, c-format msgid "Failed to connect to namestore\n" msgstr "Se produjo un fallo al conectar con el almacén de nombres\n" @@ -812,7 +812,7 @@ msgstr "" #: src/auction/gnunet-auction-info.c:77 src/auction/gnunet-auction-join.c:77 #: src/conversation/gnunet-conversation-test.c:256 -#: src/revocation/gnunet-revocation.c:564 src/template/gnunet-template.c:75 +#: src/revocation/gnunet-revocation.c:570 src/template/gnunet-template.c:75 msgid "help text" msgstr "texto de ayuda" @@ -1187,7 +1187,7 @@ msgstr "" #, c-format msgid "" "\n" -"We are now playing your recording back. If you can hear it, your audio " +"ew are now playing your recording back. If you can hear it, your audio " "settings are working..." msgstr "" @@ -1633,40 +1633,40 @@ msgstr "# mapas de tipos recibidos" msgid "# updates to my type map" msgstr "# actualizaciones de mi mapa de tipos" -#: src/datacache/datacache.c:115 src/datacache/datacache.c:287 +#: src/datacache/datacache.c:115 src/datacache/datacache.c:299 #: src/datastore/gnunet-service-datastore.c:742 msgid "# bytes stored" msgstr "# bytes almacenados" -#: src/datacache/datacache.c:119 src/datacache/datacache.c:291 +#: src/datacache/datacache.c:119 src/datacache/datacache.c:303 msgid "# items stored" msgstr "# elementos almacenados" -#: src/datacache/datacache.c:189 +#: src/datacache/datacache.c:190 #, c-format msgid "Loading `%s' datacache plugin\n" msgstr "Cargando el módulo de la cache de datos «%s»\n" -#: src/datacache/datacache.c:197 +#: src/datacache/datacache.c:208 #, c-format msgid "Failed to load datacache plugin for `%s'\n" msgstr "" "Se produjo un fallo al cargar el módulo de la cache de datos para «%s»\n" -#: src/datacache/datacache.c:320 +#: src/datacache/datacache.c:332 msgid "# requests received" msgstr "# peticiones recibidas" -#: src/datacache/datacache.c:331 +#: src/datacache/datacache.c:343 msgid "# requests filtered by bloom filter" msgstr "# peticiones filtradas por el «bloomfilter»" -#: src/datacache/datacache.c:358 +#: src/datacache/datacache.c:370 #, fuzzy msgid "# requests for random value received" msgstr "# peticiones recibidas" -#: src/datacache/datacache.c:388 +#: src/datacache/datacache.c:400 #, fuzzy msgid "# proximity search requests received" msgstr "# búsquedas de clientes recibidas" @@ -2021,7 +2021,7 @@ msgstr "Base de datos Mysql ejecutándose\n" #: src/datastore/plugin_datastore_postgres.c:284 #: src/datastore/plugin_datastore_postgres.c:897 -msgid "Postgress exec failure" +msgid "Postgresql exec failure" msgstr "" #: src/datastore/plugin_datastore_postgres.c:858 @@ -2059,7 +2059,18 @@ msgstr "" "la versión de sqlite es muy antigua para determinar el tamaño, se asume " "cero\n" -#: src/datastore/plugin_datastore_sqlite.c:1274 +#: src/datastore/plugin_datastore_sqlite.c:1266 +#: src/datastore/plugin_datastore_sqlite.c:1279 +#, fuzzy +msgid "error preparing statement\n" +msgstr "Error creando el túnel\n" + +#: src/datastore/plugin_datastore_sqlite.c:1287 +#, fuzzy +msgid "error stepping\n" +msgstr "# elementos almacenados" + +#: src/datastore/plugin_datastore_sqlite.c:1295 #, c-format msgid "" "Using sqlite page utilization to estimate payload (%llu pages of size %llu " @@ -2068,7 +2079,7 @@ msgstr "" "Usando la utilización de páginas de sqlite para estimar el «payload» (%llu " "páginas de %llu bytes de tamaño)\n" -#: src/datastore/plugin_datastore_sqlite.c:1316 +#: src/datastore/plugin_datastore_sqlite.c:1337 #: src/namecache/plugin_namecache_sqlite.c:564 #: src/namestore/plugin_namestore_sqlite.c:765 msgid "Sqlite database running\n" @@ -2328,91 +2339,91 @@ msgstr "# mensajes «FIND PEER» iniciados" msgid "# requests TTL-dropped" msgstr "# peticiones unidas" -#: src/dht/gnunet-service-dht_neighbours.c:1052 -#: src/dht/gnunet-service-dht_neighbours.c:1096 +#: src/dht/gnunet-service-dht_neighbours.c:1035 +#: src/dht/gnunet-service-dht_neighbours.c:1072 msgid "# Peers excluded from routing due to Bloomfilter" msgstr "# Pares excluidos del encaminado debido a «Bloomfilter»" -#: src/dht/gnunet-service-dht_neighbours.c:1069 -#: src/dht/gnunet-service-dht_neighbours.c:1112 +#: src/dht/gnunet-service-dht_neighbours.c:1045 +#: src/dht/gnunet-service-dht_neighbours.c:1088 msgid "# Peer selection failed" msgstr "# Selecciones de pares fallidas" -#: src/dht/gnunet-service-dht_neighbours.c:1270 +#: src/dht/gnunet-service-dht_neighbours.c:1246 msgid "# PUT requests routed" msgstr "# Peticiones «PUT» encaminadas" -#: src/dht/gnunet-service-dht_neighbours.c:1304 +#: src/dht/gnunet-service-dht_neighbours.c:1280 msgid "# PUT messages queued for transmission" msgstr "# mensajes «PUT» encolados para transmisión" -#: src/dht/gnunet-service-dht_neighbours.c:1316 -#: src/dht/gnunet-service-dht_neighbours.c:1458 -#: src/dht/gnunet-service-dht_neighbours.c:1562 +#: src/dht/gnunet-service-dht_neighbours.c:1292 +#: src/dht/gnunet-service-dht_neighbours.c:1434 +#: src/dht/gnunet-service-dht_neighbours.c:1538 msgid "# P2P messages dropped due to full queue" msgstr "# Mensajes P2P omitidos debido a saturación de la cola" -#: src/dht/gnunet-service-dht_neighbours.c:1401 +#: src/dht/gnunet-service-dht_neighbours.c:1377 msgid "# GET requests routed" msgstr "# Peticiones «GET» encaminadas" -#: src/dht/gnunet-service-dht_neighbours.c:1445 +#: src/dht/gnunet-service-dht_neighbours.c:1421 msgid "# GET messages queued for transmission" msgstr "# Mensajes «GET» encolados para transmisión" -#: src/dht/gnunet-service-dht_neighbours.c:1577 +#: src/dht/gnunet-service-dht_neighbours.c:1553 msgid "# RESULT messages queued for transmission" msgstr "# Mensajes «RESULT» encolados para transmisión" -#: src/dht/gnunet-service-dht_neighbours.c:1680 +#: src/dht/gnunet-service-dht_neighbours.c:1656 #, fuzzy msgid "# Expired PUTs discarded" msgstr "# respuestas irrelevantes descartadas" -#: src/dht/gnunet-service-dht_neighbours.c:1688 +#: src/dht/gnunet-service-dht_neighbours.c:1664 msgid "# P2P PUT requests received" msgstr "# Peticiones «PUT» P2P recibidas" -#: src/dht/gnunet-service-dht_neighbours.c:1692 +#: src/dht/gnunet-service-dht_neighbours.c:1668 #, fuzzy msgid "# P2P PUT bytes received" msgstr "# Peticiones «PUT» P2P recibidas" -#: src/dht/gnunet-service-dht_neighbours.c:1924 +#: src/dht/gnunet-service-dht_neighbours.c:1900 msgid "# FIND PEER requests ignored due to Bloomfilter" msgstr "# Peticiones «FIND PEER» ignoradas debido a «Bloomfilter»" -#: src/dht/gnunet-service-dht_neighbours.c:1933 +#: src/dht/gnunet-service-dht_neighbours.c:1909 msgid "# FIND PEER requests ignored due to lack of HELLO" msgstr "# Peticiones «FIND PEER» ignoradas debido a falta de «HELLO»" -#: src/dht/gnunet-service-dht_neighbours.c:2096 +#: src/dht/gnunet-service-dht_neighbours.c:2072 msgid "# P2P GET requests received" msgstr "# Peticiones «GET» P2P recibidas" -#: src/dht/gnunet-service-dht_neighbours.c:2100 +#: src/dht/gnunet-service-dht_neighbours.c:2076 #, fuzzy msgid "# P2P GET bytes received" msgstr "# Peticiones «GET» P2P recibidas" -#: src/dht/gnunet-service-dht_neighbours.c:2166 +#: src/dht/gnunet-service-dht_neighbours.c:2142 msgid "# P2P FIND PEER requests processed" msgstr "# Peticiones «FIND PEER» P2P procesadas" -#: src/dht/gnunet-service-dht_neighbours.c:2187 +#: src/dht/gnunet-service-dht_neighbours.c:2163 msgid "# P2P GET requests ONLY routed" msgstr "# Peticiones «GET» P2P SOLAMENTE encaminadas" -#: src/dht/gnunet-service-dht_neighbours.c:2365 +#: src/dht/gnunet-service-dht_neighbours.c:2341 #, fuzzy msgid "# Expired results discarded" msgstr "# respuestas irrelevantes descartadas" -#: src/dht/gnunet-service-dht_neighbours.c:2382 +#: src/dht/gnunet-service-dht_neighbours.c:2358 msgid "# P2P RESULTS received" msgstr "# Resultados (RESULTS) P2P recibidos" -#: src/dht/gnunet-service-dht_neighbours.c:2386 +#: src/dht/gnunet-service-dht_neighbours.c:2362 #, fuzzy msgid "# P2P RESULT bytes received" msgstr "# Resultados (RESULTS) P2P recibidos" @@ -2911,7 +2922,7 @@ msgstr "" #: src/fs/fs_download.c:346 #, fuzzy, c-format msgid "" -"Failed to access full directroy contents of `%s' for recursive download\n" +"Failed to access full directory contents of `%s' for recursive download\n" msgstr "" "Se produjo un fallo al crear el directorio para la descarga recursiva de " "«%s»\n" @@ -4221,7 +4232,7 @@ msgstr "" msgid "GNUnet GNS resolver tool" msgstr "Herramienta de acceso GNUnet GNS" -#: src/gns/gnunet-gns-import.c:491 +#: src/gns/gnunet-gns-import.c:490 msgid "This program will import some GNS authorities into your GNS namestore." msgstr "" @@ -4944,35 +4955,35 @@ msgstr "Se produjo un fallo al crear la página para «%s»\n" msgid "Failed to set default ego: %s\n" msgstr "Se produjo un fallo al crear la página para «%s»\n" -#: src/identity/gnunet-identity.c:462 +#: src/identity/gnunet-identity.c:461 msgid "create ego NAME" msgstr "" -#: src/identity/gnunet-identity.c:467 +#: src/identity/gnunet-identity.c:466 #, fuzzy msgid "delete ego NAME " msgstr "borrar un nombre de espacio de nombres (NAME)" -#: src/identity/gnunet-identity.c:473 +#: src/identity/gnunet-identity.c:472 msgid "" "set the private key for the identity to PRIVATE_KEY (use together with -C)" msgstr "" -#: src/identity/gnunet-identity.c:478 +#: src/identity/gnunet-identity.c:477 msgid "generate an EdDSA identity. (use together with -C) EXPERIMENTAL" msgstr "" -#: src/identity/gnunet-identity.c:482 +#: src/identity/gnunet-identity.c:481 #, fuzzy msgid "display all egos" msgstr "mostrar registros" -#: src/identity/gnunet-identity.c:486 +#: src/identity/gnunet-identity.c:485 #, fuzzy msgid "reduce output" msgstr "Sin salida innecesaria" -#: src/identity/gnunet-identity.c:493 +#: src/identity/gnunet-identity.c:492 msgid "" "set default identity to NAME for a subsystem SUBSYSTEM (use together with -" "s) or restrict results to NAME (use together with -d)" @@ -4980,21 +4991,21 @@ msgstr "" # Miguel: Aquí he dejado monitorización porque esto es # del servicio de traducción de direcciones. -#: src/identity/gnunet-identity.c:497 +#: src/identity/gnunet-identity.c:496 #, fuzzy msgid "run in monitor mode egos" msgstr "modo de monitorización" -#: src/identity/gnunet-identity.c:501 +#: src/identity/gnunet-identity.c:500 msgid "display private keys as well" msgstr "" -#: src/identity/gnunet-identity.c:508 +#: src/identity/gnunet-identity.c:507 msgid "" "set default identity to EGO for a subsystem SUBSYSTEM (use together with -e)" msgstr "" -#: src/identity/gnunet-identity.c:523 +#: src/identity/gnunet-identity.c:522 msgid "Maintain egos" msgstr "" @@ -5052,7 +5063,7 @@ msgstr "Se produjo un fallo al leer el directorio «%s»\n" msgid "Identity REST API initialized\n" msgstr "Conexión fallida\n" -#: src/json/json.c:139 +#: src/json/json.c:119 #, fuzzy, c-format msgid "Failed to parse JSON in option `%s': %s (%s)\n" msgstr "Se produjo un fallo al procesar «HELLO» en el fichero «%s»\n" @@ -5400,74 +5411,114 @@ msgstr "" msgid "name of the ego controlling the zone" msgstr "nombre de la sección a la que acceder" -# form?? -#: src/namestore/gnunet-namestore-fcfsd.c:552 -#, c-format -msgid "Unsupported form value `%s'\n" -msgstr "Forma de valor no soportada «%s»\n" +#: src/namestore/gnunet-namestore-fcfsd.c:359 +#, fuzzy +msgid "can not search the namestore" +msgstr "No se puede iniciar el controlador maestro" -#: src/namestore/gnunet-namestore-fcfsd.c:579 -#, c-format -msgid "Failed to create record for domain `%s': %s\n" +#: src/namestore/gnunet-namestore-fcfsd.c:413 +#: src/namestore/gnunet-namestore-fcfsd.c:554 +#, fuzzy +msgid "unable to scan namestore" +msgstr "Se produjo un fallo al conectar con el almacén de nombres\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:441 +#, fuzzy, c-format +msgid "Failed to create record for `%s': %s\n" msgstr "Se produjo un fallo al crear un registro para el dominio «%s»: %s\n" -#: src/namestore/gnunet-namestore-fcfsd.c:600 -msgid "Error when mapping zone to name\n" -msgstr "" +#: src/namestore/gnunet-namestore-fcfsd.c:453 +#, fuzzy +msgid "no errors" +msgstr "error desconocido" -#: src/namestore/gnunet-namestore-fcfsd.c:633 -#, c-format -msgid "Found existing name `%s' for the given key\n" -msgstr "Encontrado nombre «%s» para la clave dada\n" +#: src/namestore/gnunet-namestore-fcfsd.c:489 +#, fuzzy, c-format +msgid "The requested key `%s' exists as `%s'\n" +msgstr "Creada la entrada '%s' en el espacio '%s'\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:496 +msgid "key exists" +msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:646 +#: src/namestore/gnunet-namestore-fcfsd.c:513 #, fuzzy -msgid "Error creating record data.\n" +msgid "Error creating record data\n" msgstr "Error interno escaneando directorio.\n" -#: src/namestore/gnunet-namestore-fcfsd.c:707 -#, c-format -msgid "Found %u existing records for domain `%s'\n" -msgstr "Encontrados %u registros para el dominio «%s»\n" +#: src/namestore/gnunet-namestore-fcfsd.c:517 +#, fuzzy +msgid "unable to store record" +msgstr "El almacén de nombres no pudo añadir el registro\n" -#: src/namestore/gnunet-namestore-fcfsd.c:796 +#: src/namestore/gnunet-namestore-fcfsd.c:588 #, c-format -msgid "Failed to create page for `%s'\n" -msgstr "Se produjo un fallo al crear la página para «%s»\n" +msgid "Requested name `%s' exists with `%u' records\n" +msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:815 -#, c-format -msgid "Failed to setup post processor for `%s'\n" -msgstr "Se produjo un fallo al configurar el post-procesador para «%s»\n" +#: src/namestore/gnunet-namestore-fcfsd.c:594 +msgid "name exists\n" +msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:850 -msgid "Domain name must not contain `.'\n" -msgstr "El nombre de dominio no puede contener «.»\n" +#: src/namestore/gnunet-namestore-fcfsd.c:780 +msgid "unable to process submitted data" +msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:859 -msgid "Domain name must not contain `+'\n" -msgstr "El nombre de dominio no puede contener «+»\n" +#: src/namestore/gnunet-namestore-fcfsd.c:787 +msgid "the submitted data is invalid" +msgstr "" + +#: src/namestore/gnunet-namestore-fcfsd.c:806 +#, fuzzy +msgid "invalid parameters" +msgstr "Parámetro no válido «%s»\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:823 +#, fuzzy +msgid "invalid name" +msgstr "Parámetro no válido «%s»\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:834 +#, fuzzy, c-format +msgid "Unable to parse key %s\n" +msgstr "No se pudo procesar el registro MX «%s»\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:838 +#, fuzzy +msgid "unable to parse key" +msgstr "No se pudo procesar el registro MX «%s»\n" -#: src/namestore/gnunet-namestore-fcfsd.c:1094 +#: src/namestore/gnunet-namestore-fcfsd.c:949 msgid "No ego configured for `fcfsd` subsystem\n" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:1125 +#: src/namestore/gnunet-namestore-fcfsd.c:974 msgid "Failed to start HTTP server\n" msgstr "Se produjo un fallo al iniciar el servidor HTTP\n" -#: src/namestore/gnunet-namestore-fcfsd.c:1173 +#: src/namestore/gnunet-namestore-fcfsd.c:1058 +#, fuzzy +msgid "No port specified, using default value\n" +msgstr "" +"La configuración no especifica «%s», asumiendo el valor predeterminado." + +#: src/namestore/gnunet-namestore-fcfsd.c:1076 #, fuzzy msgid "Failed to connect to identity\n" msgstr "Se produjo un fallo al conectar con GNS\n" -#: src/namestore/gnunet-namestore-fcfsd.c:1200 -msgid "name of the zone that is to be managed by FCFSD" +#: src/namestore/gnunet-namestore-fcfsd.c:1100 +#, fuzzy +msgid "Unable to set up the daemon\n" +msgstr "Imposible crear la cuenta de usuario:" + +#: src/namestore/gnunet-namestore-fcfsd.c:1123 +msgid "name of the zone managed by FCFSD" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:1220 +#: src/namestore/gnunet-namestore-fcfsd.c:1132 #, fuzzy -msgid "GNU Name System First Come First Serve name registration service" +msgid "GNU Name System First-Come-First-Served name registration service" msgstr "Servicio de registro GNUnet GNS primero en llegar, primero en servirse" #: src/namestore/gnunet-service-namestore.c:871 @@ -5475,11 +5526,11 @@ msgstr "Servicio de registro GNUnet GNS primero en llegar, primero en servirse" msgid "Failed to replicate block in namecache: %s\n" msgstr "Se produjo un fallo al crear el espacio de nombres «%s»\n" -#: src/namestore/gnunet-zoneimport.c:1848 +#: src/namestore/gnunet-zoneimport.c:1847 msgid "size to use for the main hash map" msgstr "" -#: src/namestore/gnunet-zoneimport.c:1854 +#: src/namestore/gnunet-zoneimport.c:1853 msgid "minimum expiration time we assume for imported records" msgstr "" @@ -5503,7 +5554,7 @@ msgstr "" msgid "Flat file database running\n" msgstr "Base de datos de plantilla ejecutándose\n" -#: src/namestore/plugin_rest_namestore.c:1105 +#: src/namestore/plugin_rest_namestore.c:1111 #, fuzzy msgid "Namestore REST API initialized\n" msgstr "Conexión fallida\n" @@ -6180,12 +6231,12 @@ msgstr "" msgid "re:claimID command line tool" msgstr "" -#: src/reclaim/plugin_rest_openid_connect.c:2788 +#: src/reclaim/plugin_rest_openid_connect.c:2793 #, fuzzy msgid "OpenID Connect REST API initialized\n" msgstr "Conexión fallida\n" -#: src/reclaim/plugin_rest_reclaim.c:1521 +#: src/reclaim/plugin_rest_pabc.c:637 src/reclaim/plugin_rest_reclaim.c:1520 #, fuzzy msgid "Identity Provider REST API initialized\n" msgstr "Conexión fallida\n" @@ -6207,11 +6258,11 @@ msgstr "" msgid "Daemon to announce regular expressions for the peer using cadet." msgstr "Demonio para anunciar expresiones regulares para el par usando mesh." -#: src/regex/gnunet-regex-profiler.c:1390 +#: src/regex/gnunet-regex-profiler.c:1392 msgid "No configuration file given. Exiting\n" msgstr "No se ha introducido ningún fichero de configuración. Saliendo\n" -#: src/regex/gnunet-regex-profiler.c:1432 +#: src/regex/gnunet-regex-profiler.c:1434 #: src/regex/gnunet-regex-simulation-profiler.c:631 #, c-format msgid "No policy directory specified on command line. Exiting.\n" @@ -6219,51 +6270,51 @@ msgstr "" "No se ha especificado una política de directorios en la línea de comandos. " "Saliendo.\n" -#: src/regex/gnunet-regex-profiler.c:1438 +#: src/regex/gnunet-regex-profiler.c:1440 #: src/regex/gnunet-regex-simulation-profiler.c:639 #, c-format msgid "Specified policies directory does not exist. Exiting.\n" msgstr "Las políticas de directorio especificadas no existen. Saliendo.\n" -#: src/regex/gnunet-regex-profiler.c:1446 +#: src/regex/gnunet-regex-profiler.c:1448 #, c-format msgid "No files found in `%s'\n" msgstr "No se han encontrado ficheros en «%s»\n" -#: src/regex/gnunet-regex-profiler.c:1455 +#: src/regex/gnunet-regex-profiler.c:1457 msgid "No search strings file given. Exiting.\n" msgstr "No se ha proporcionado un fichero de cadenas de búsqueda. Saliendo.\n" -#: src/regex/gnunet-regex-profiler.c:1475 +#: src/regex/gnunet-regex-profiler.c:1477 msgid "Error loading search strings. Exiting.\n" msgstr "Error cargando cadenas de búsqueda. Saliendo.\n" -#: src/regex/gnunet-regex-profiler.c:1563 +#: src/regex/gnunet-regex-profiler.c:1565 msgid "name of the file for writing statistics" msgstr "nombre del fichero para escribir las estadísticas" -#: src/regex/gnunet-regex-profiler.c:1570 +#: src/regex/gnunet-regex-profiler.c:1572 #, fuzzy msgid "wait TIMEOUT before ending the experiment" msgstr "" "esperar «TIMEOUT» antes de considerar que una coincidencia de cadenas como " "fallida" -#: src/regex/gnunet-regex-profiler.c:1576 +#: src/regex/gnunet-regex-profiler.c:1578 msgid "directory with policy files" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1584 +#: src/regex/gnunet-regex-profiler.c:1586 #, fuzzy msgid "name of file with input strings" msgstr "nombre del fichero para escribir las estadísticas" -#: src/regex/gnunet-regex-profiler.c:1591 +#: src/regex/gnunet-regex-profiler.c:1593 #, fuzzy msgid "name of file with hosts' names" msgstr "nombre del fichero para escribir las estadísticas" -#: src/regex/gnunet-regex-profiler.c:1604 +#: src/regex/gnunet-regex-profiler.c:1606 msgid "Profiler for regex" msgstr "Perfilador para expresiones regulares." @@ -6290,12 +6341,12 @@ msgstr "El servicio «%s» no está ejecutandose\n" msgid "Search string `%s' is too long!\n" msgstr "El servicio «%s» no está ejecutandose\n" -#: src/rest/gnunet-rest-server.c:1266 +#: src/rest/gnunet-rest-server.c:1267 #, fuzzy msgid "GNUnet REST server" msgstr "Herramienta de acceso GNUnet GNS" -#: src/rest/plugin_rest_config.c:427 +#: src/rest/plugin_rest_config.c:428 #, fuzzy msgid "CONFIG REST API initialized\n" msgstr "Conexión fallida\n" @@ -6364,72 +6415,77 @@ msgstr "" msgid "Ego `%s' not found.\n" msgstr "Módulo «%s» no encontrado\n" -#: src/revocation/gnunet-revocation.c:351 +#: src/revocation/gnunet-revocation.c:350 +#, fuzzy, c-format +msgid "Error: Key is invalid\n" +msgstr "Formato del pseudónimo '%s' no es válido.\n" + +#: src/revocation/gnunet-revocation.c:357 #, c-format msgid "Error: revocation certificate in `%s' is not for `%s'\n" msgstr "" -#: src/revocation/gnunet-revocation.c:361 +#: src/revocation/gnunet-revocation.c:367 msgid "Revocation certificate ready\n" msgstr "" -#: src/revocation/gnunet-revocation.c:373 +#: src/revocation/gnunet-revocation.c:379 msgid "Continuing calculation where left off...\n" msgstr "" -#: src/revocation/gnunet-revocation.c:380 +#: src/revocation/gnunet-revocation.c:386 msgid "Revocation certificate not ready, calculating proof of work\n" msgstr "" -#: src/revocation/gnunet-revocation.c:418 +#: src/revocation/gnunet-revocation.c:424 #, fuzzy, c-format msgid "Public key `%s' malformed\n" msgstr "El bloque del tipo %u está mal formado\n" -#: src/revocation/gnunet-revocation.c:428 +#: src/revocation/gnunet-revocation.c:434 msgid "" "Testing and revoking at the same time is not allowed, only executing test.\n" msgstr "" -#: src/revocation/gnunet-revocation.c:458 +#: src/revocation/gnunet-revocation.c:464 #, fuzzy msgid "No filename to store revocation certificate given.\n" msgstr "Se produjo un fallo al leer la lista de amigos de «%s»\n" -#: src/revocation/gnunet-revocation.c:475 +#: src/revocation/gnunet-revocation.c:481 #, fuzzy, c-format msgid "Failed to read revocation certificate from `%s'\n" msgstr "Se produjo un fallo al leer la lista de amigos de «%s»\n" -#: src/revocation/gnunet-revocation.c:483 +#: src/revocation/gnunet-revocation.c:489 #, fuzzy, c-format msgid "Revocation certificate corrupted in `%s'\n" msgstr "Se produjo un fallo al leer la lista de amigos de «%s»\n" -#: src/revocation/gnunet-revocation.c:505 +#: src/revocation/gnunet-revocation.c:511 #, fuzzy msgid "No action specified. Nothing to do.\n" msgstr "Ninguna interfaz especificada, usando la marcada por defecto\n" -#: src/revocation/gnunet-revocation.c:524 +#: src/revocation/gnunet-revocation.c:530 msgid "use NAME for the name of the revocation file" msgstr "" -#: src/revocation/gnunet-revocation.c:532 +#: src/revocation/gnunet-revocation.c:538 msgid "" "revoke the private key associated for the the private key associated with " "the ego NAME " msgstr "" -#: src/revocation/gnunet-revocation.c:539 +#: src/revocation/gnunet-revocation.c:545 msgid "actually perform revocation, otherwise we just do the precomputation" msgstr "" -#: src/revocation/gnunet-revocation.c:546 +#: src/revocation/gnunet-revocation.c:552 msgid "test if the public key KEY has been revoked" msgstr "" -#: src/revocation/gnunet-revocation.c:552 +#: src/revocation/gnunet-revocation.c:558 #, fuzzy msgid "number of epochs to calculate for" msgstr "número de pares para empezar" @@ -6559,12 +6615,12 @@ msgstr "" #: src/scalarproduct/gnunet-service-scalarproduct_alice.c:1358 #: src/scalarproduct/gnunet-service-scalarproduct_bob.c:1355 #: src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c:1118 -#: src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c:1063 +#: src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c:1034 #, fuzzy msgid "Connect to CADET failed\n" msgstr "Conexión fallida (¿bug?)\n" -#: src/scalarproduct/scalarproduct_api.c:189 +#: src/scalarproduct/scalarproduct_api.c:184 msgid "Keys given to SCALARPRODUCT not unique!\n" msgstr "" @@ -6585,7 +6641,7 @@ msgid "also profile decryption" msgstr "" #: src/set/gnunet-service-set.c:1916 src/seti/gnunet-service-seti.c:2467 -#: src/setu/gnunet-service-setu.c:3832 +#: src/setu/gnunet-service-setu.c:5395 #, fuzzy msgid "Could not connect to CADET service\n" msgstr "¡No se pudo conectar al servicio %s!\n" @@ -6830,7 +6886,7 @@ msgid "" "\t cap: the maximum number of links a node can have\n" "\t m: the number of links a node should have while joining the network\n" "\t filename: the path of the file which contains topology information\n" -"NOTE: the format of the above file is descibed here: https://www.gnunet.org/" +"NOTE: the format of the above file is described here: https://www.gnunet.org/" "content/topology-file-format\n" msgstr "" @@ -6930,7 +6986,8 @@ msgid "Spawning process `%s'\n" msgstr "Iniciando el proceso auxiliar (HELPER) «%s»\n" #: src/testbed/gnunet-testbed-profiler.c:290 -msgid "tolerate COUNT number of continious timeout failures" +#, fuzzy +msgid "tolerate COUNT number of continuous timeout failures" msgstr "tolerar un número «COUNT» de continuas expiraciones de plazo" #: src/testbed/gnunet-testbed-profiler.c:295 @@ -7260,9 +7317,9 @@ msgstr "# mensajes «HELLO» recibidos" msgid "GNUnet topology control" msgstr "" -#: src/transport/gnunet-communicator-tcp.c:3331 +#: src/transport/gnunet-communicator-tcp.c:3314 #: src/transport/gnunet-communicator-udp.c:3790 -#: src/transport/gnunet-service-tng.c:10220 +#: src/transport/gnunet-service-tng.c:10223 #: src/transport/gnunet-service-transport.c:2627 #, fuzzy msgid "Transport service is lacking key configuration settings. Exiting.\n" @@ -7270,7 +7327,7 @@ msgstr "" "El servicio de transporte carece de opciones de configuración de clave. " "Saliendo.\n" -#: src/transport/gnunet-communicator-tcp.c:3668 +#: src/transport/gnunet-communicator-tcp.c:3652 #, fuzzy msgid "GNUnet TCP communicator" msgstr "Configurador Gtk de GNUnet" @@ -8405,7 +8462,7 @@ msgstr "" msgid "Service process failed to report status\n" msgstr "El proceso del servicio no devolvió un estado\n" -#: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1040 +#: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1220 #: src/util/service.c:1637 #, c-format msgid "Cannot obtain information about user `%s': %s\n" @@ -8524,39 +8581,15 @@ msgstr "Formato de tiempo no válido «%s»\n" msgid "Failed to serialize metadata `%s'" msgstr "Se produjo un fallo al serializar metadatos" -#: src/util/client.c:747 src/util/client.c:937 +#: src/util/client.c:747 src/util/client.c:938 msgid "not a valid filename" msgstr "" -#: src/util/client.c:1103 +#: src/util/client.c:1104 #, c-format msgid "Need a non-empty hostname for service `%s'.\n" msgstr "Se necesita un nombre de máquina no vacío para el servicio «%s».\n" -#: src/util/common_logging.c:259 src/util/common_logging.c:1114 -msgid "DEBUG" -msgstr "DEPURACIÓN" - -#: src/util/common_logging.c:261 src/util/common_logging.c:1112 -msgid "INFO" -msgstr "INFORMACIÓN" - -#: src/util/common_logging.c:263 src/util/common_logging.c:1110 -msgid "MESSAGE" -msgstr "MENSAJE" - -#: src/util/common_logging.c:265 src/util/common_logging.c:1108 -msgid "WARNING" -msgstr "PELIGRO" - -#: src/util/common_logging.c:267 src/util/common_logging.c:1106 -msgid "ERROR" -msgstr "ERROR" - -#: src/util/common_logging.c:269 src/util/common_logging.c:1116 -msgid "NONE" -msgstr "NINGUNO" - #: src/util/common_logging.c:626 src/util/common_logging.c:665 #, c-format msgid "ERROR: Unable to parse log definition: Syntax error at `%s'.\n" @@ -8567,6 +8600,30 @@ msgstr "" msgid "Message `%.*s' repeated %u times in the last %s\n" msgstr "Mensaje `%.*s» repetido %u veces en el último %s\n" +#: src/util/common_logging.c:1106 +msgid "ERROR" +msgstr "ERROR" + +#: src/util/common_logging.c:1108 +msgid "WARNING" +msgstr "PELIGRO" + +#: src/util/common_logging.c:1110 +msgid "MESSAGE" +msgstr "MENSAJE" + +#: src/util/common_logging.c:1112 +msgid "INFO" +msgstr "INFORMACIÓN" + +#: src/util/common_logging.c:1114 +msgid "DEBUG" +msgstr "DEPURACIÓN" + +#: src/util/common_logging.c:1116 +msgid "NONE" +msgstr "NINGUNO" + #: src/util/common_logging.c:1117 msgid "INVALID" msgstr "NO VÁLIDO" @@ -8592,22 +8649,52 @@ msgstr "" "La configuración especifica un valor no válido en la opción «%s» de la " "sección «%s»: %s\n" -#: src/util/configuration.c:370 +#: src/util/configuration.c:790 +#, c-format +msgid "Illegal directive in line %u (parsing restricted section %s)\n" +msgstr "" + +#: src/util/configuration.c:800 +#, c-format +msgid "Bad directive in line %u\n" +msgstr "" + +#: src/util/configuration.c:853 +#, c-format +msgid "Bad inline-secret directive in line %u\n" +msgstr "" + +#: src/util/configuration.c:875 +#, c-format +msgid "Unknown or malformed directive '%s' in line %u\n" +msgstr "" + +#: src/util/configuration.c:905 +#, fuzzy, c-format +msgid "Syntax error while deserializing in line %u (option without section)\n" +msgstr "Error de sintaxis en la línea %u mientras se deserializaba\n" + +#: src/util/configuration.c:949 #, c-format msgid "Syntax error while deserializing in line %u\n" msgstr "Error de sintaxis en la línea %u mientras se deserializaba\n" -#: src/util/configuration.c:420 +#: src/util/configuration.c:1049 #, fuzzy, c-format msgid "Error while reading file `%s'\n" msgstr "Error decodificando clave %u\n" -#: src/util/configuration.c:980 +#: src/util/configuration.c:1062 +#, fuzzy, c-format +msgid "Failed to parse configuration file `%s'\n" +msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n" + +#: src/util/configuration.c:1695 #, fuzzy msgid "Not a valid relative time specification" msgstr "Tiempo de expiración no válido para la operación «%s»\n" -#: src/util/configuration.c:1050 +#: src/util/configuration.c:1765 #, c-format msgid "" "Configuration value '%s' for '%s' in section '%s' is not in set of legal " @@ -8616,17 +8703,17 @@ msgstr "" "El valor de configuración «%s» para «%s» de la sección «%s» no está dentro " "de las opciones legales\n" -#: src/util/configuration.c:1145 +#: src/util/configuration.c:1860 #, c-format msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n" msgstr "" -#: src/util/configuration.c:1177 +#: src/util/configuration.c:1892 #, fuzzy, c-format msgid "Missing closing `%s' in option `%s'\n" msgstr "Falta la opción «%s» para la operación «%s»\n" -#: src/util/configuration.c:1243 +#: src/util/configuration.c:1958 #, c-format msgid "" "Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined " @@ -8672,7 +8759,7 @@ msgstr "El firmado ECC falló en %s:%d: %s\n" msgid "RSA signature verification failed at %s:%d: %s\n" msgstr "La verificación de la firma RSA fallo en %s:%d: %s\n" -#: src/util/disk.c:823 +#: src/util/disk.c:843 #, c-format msgid "Expected `%s' to be a directory!\n" msgstr "¡Se esperaba que «%s» fuera un directorio!\n" @@ -8857,62 +8944,73 @@ msgstr "Tienes que introducir un número en la opción «%s».\n" msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" msgstr "" -#: src/util/gnunet-base32.c:45 +#: src/util/gnunet-base32.c:46 msgid "run decoder modus, otherwise runs as encoder" msgstr "" -#: src/util/gnunet-config.c:167 -#, fuzzy, c-format -msgid "failed to load configuration defaults" -msgstr "Se produjo un fallo al cargar la configuración de %s\n" - -#: src/util/gnunet-config.c:179 -#, fuzzy, c-format -msgid "%s or %s argument is required\n" -msgstr "el parámetro --section es necesario\n" - -#: src/util/gnunet-config.c:186 +#: src/util/gnunet-config.c:187 #, c-format msgid "The following sections are available:\n" msgstr "" -#: src/util/gnunet-config.c:234 +#: src/util/gnunet-config.c:201 +#, fuzzy, c-format +msgid "%s, %s or %s argument is required\n" +msgstr "el parámetro --section es necesario\n" + +#: src/util/gnunet-config.c:266 #, c-format msgid "--option argument required to set value\n" msgstr "el parámetro --option es necesario para establecer un valor\n" -#: src/util/gnunet-config.c:284 -#, fuzzy -msgid "interpret option value as a filename (with $-expansion)" -msgstr "" -"obtener la opción del valor como un nombre de fichero (con expansión del $)" +#: src/util/gnunet-config.c:309 +#, fuzzy, c-format +msgid "failed to load configuration defaults" +msgstr "Se produjo un fallo al cargar la configuración de %s\n" -#: src/util/gnunet-config.c:291 +#: src/util/gnunet-config.c:354 msgid "test if the current installation supports the specified BACKEND" msgstr "" -#: src/util/gnunet-config.c:297 -msgid "name of the section to access" -msgstr "nombre de la sección a la que acceder" +#: src/util/gnunet-config.c:360 +#, fuzzy +msgid "write the full configuration file, including default values" +msgstr "" +"La configuración no especifica «%s», asumiendo el valor predeterminado." -#: src/util/gnunet-config.c:302 +#: src/util/gnunet-config.c:365 +#, fuzzy +msgid "interpret option value as a filename (with $-expansion)" +msgstr "" +"obtener la opción del valor como un nombre de fichero (con expansión del $)" + +#: src/util/gnunet-config.c:370 msgid "name of the option to access" msgstr "nombre de la opción a la que acceder" -#: src/util/gnunet-config.c:307 -msgid "value to set" -msgstr "valor a establecer" +#: src/util/gnunet-config.c:376 +#, fuzzy +msgid "rewrite the configuration file, even if nothing changed" +msgstr "No se ha introducido ningún fichero de configuración. Saliendo\n" -#: src/util/gnunet-config.c:312 +#: src/util/gnunet-config.c:382 +msgid "output extra diagnostics" +msgstr "" + +#: src/util/gnunet-config.c:387 #, fuzzy msgid "print available configuration sections" msgstr "Falta configuración sobre las opciones de claves.\n" -#: src/util/gnunet-config.c:318 -msgid "write configuration file that only contains delta to defaults" -msgstr "" +#: src/util/gnunet-config.c:393 +msgid "name of the section to access" +msgstr "nombre de la sección a la que acceder" + +#: src/util/gnunet-config.c:398 +msgid "value to set" +msgstr "valor a establecer" -#: src/util/gnunet-config.c:330 +#: src/util/gnunet-config.c:413 msgid "Manipulate GNUnet configuration files" msgstr "Manipular ficheros de configuración de GNUnet" @@ -9150,21 +9248,21 @@ msgstr "«%s» falló al resolver el método «%s» con error: %s\n" msgid "`%s' failed for library `%s' with error: %s\n" msgstr "Falló «%s» para la biblioteca «%s» con error: %s\n" -#: src/util/plugin.c:409 +#: src/util/plugin.c:414 msgid "Could not determine plugin installation path.\n" msgstr "No se pudo determinar la ruta de instalación de los módulos.\n" -#: src/util/program.c:259 +#: src/util/program.c:252 #, fuzzy, c-format msgid "Unreadable or malformed configuration file `%s', exit ...\n" msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n" -#: src/util/program.c:276 +#: src/util/program.c:272 #, fuzzy, c-format msgid "Unreadable or malformed default configuration file `%s', exit ...\n" msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n" -#: src/util/program.c:291 +#: src/util/program.c:288 #, fuzzy msgid "Unreadable or malformed configuration, exit ...\n" msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n" @@ -9238,90 +9336,90 @@ msgstr "" msgid "Attempting to proxy service `%s' to invalid port %d or hostname.\n" msgstr "" -#: src/util/strings.c:503 +#: src/util/strings.c:409 #, c-format msgid "Character sets requested were `%s'->`%s'\n" msgstr "Los conjuntos de caracteres pedidos fueron «%s»->«%s»\n" -#: src/util/strings.c:637 +#: src/util/strings.c:501 msgid "Failed to expand `$HOME': environment variable `HOME' not set" msgstr "" "Se produjo un fallo al expandir «$HOME»: variable de entorno «HOME» no " "establecida" -#: src/util/strings.c:1241 +#: src/util/strings.c:1036 msgid "IPv6 address did not start with `['\n" msgstr "La dirección IPv6 no empezaba con «[»\n" -#: src/util/strings.c:1249 +#: src/util/strings.c:1044 msgid "IPv6 address did contain ':' to separate port number\n" msgstr "La dirección IPv6 contenía «:» para separar el número de puerto\n" -#: src/util/strings.c:1256 +#: src/util/strings.c:1051 msgid "IPv6 address did contain ']' before ':' to separate port number\n" msgstr "" "La dirección IPv6 contenía «]» antes de «:» para separar el número de " "puerto\n" -#: src/util/strings.c:1264 +#: src/util/strings.c:1059 msgid "IPv6 address did contain a valid port number after the last ':'\n" msgstr "" "La dirección IPv6 contenía un número de puerto válido después del último " "«:»\n" -#: src/util/strings.c:1273 +#: src/util/strings.c:1068 #, c-format msgid "Invalid IPv6 address `%s': %s\n" msgstr "Dirección IPv6 «%s» no válida: %s\n" -#: src/util/strings.c:1500 src/util/strings.c:1511 +#: src/util/strings.c:1250 src/util/strings.c:1261 msgid "Port not in range\n" msgstr "" -#: src/util/strings.c:1520 +#: src/util/strings.c:1270 #, fuzzy, c-format msgid "Malformed port policy `%s'\n" msgstr "Se produjo un fallo al iniciar el servicio «%s»\n" -#: src/util/strings.c:1603 src/util/strings.c:1632 src/util/strings.c:1679 -#: src/util/strings.c:1699 +#: src/util/strings.c:1341 src/util/strings.c:1370 src/util/strings.c:1417 +#: src/util/strings.c:1437 #, c-format msgid "Invalid format for IP: `%s'\n" msgstr "Formato no válido para la IP: «%s»\n" -#: src/util/strings.c:1657 +#: src/util/strings.c:1395 #, c-format msgid "Invalid network notation ('/%d' is not legal in IPv4 CIDR)." msgstr "Notación de red no válida («/%d» no es válido en IPv4 CIDR)." -#: src/util/strings.c:1708 +#: src/util/strings.c:1446 #, fuzzy, c-format msgid "Invalid format: `%s'\n" msgstr "Formato de tiempo no válido «%s»\n" -#: src/util/strings.c:1761 +#: src/util/strings.c:1488 #, c-format msgid "Invalid network notation (does not end with ';': `%s')\n" msgstr "Notación de red no válida (no termina con «;»: «%s»)\n" -#: src/util/strings.c:1811 +#: src/util/strings.c:1538 #, c-format msgid "Wrong format `%s' for netmask\n" msgstr "Formato «%s» erroneo para máscara de red\n" -#: src/util/strings.c:1842 +#: src/util/strings.c:1569 #, c-format msgid "Wrong format `%s' for network\n" msgstr "Formato «%s» erroneo para red\n" -#: src/util/time.c:878 src/util/time.c:906 +#: src/util/time.c:699 src/util/time.c:727 #, fuzzy, c-format msgid "Failed to map `%s', cannot assure monotonic time!\n" msgstr "" "Se produjo un fallo al recuperar el espacio de nombres «%s», no se pudo " "retomar la operación de publicación.\n" -#: src/util/time.c:914 +#: src/util/time.c:735 #, c-format msgid "" "Failed to setup monotonic time file `%s', cannot assure monotonic time!\n" @@ -9508,6 +9606,33 @@ msgstr "Configurar túneles vía VPN." msgid "Failed to connect to the namestore!\n" msgstr "¡Se produjo un fallo al conectar con el almacén de nombres!\n" +# form?? +#, c-format +#~ msgid "Unsupported form value `%s'\n" +#~ msgstr "Forma de valor no soportada «%s»\n" + +#, c-format +#~ msgid "Found existing name `%s' for the given key\n" +#~ msgstr "Encontrado nombre «%s» para la clave dada\n" + +#, c-format +#~ msgid "Found %u existing records for domain `%s'\n" +#~ msgstr "Encontrados %u registros para el dominio «%s»\n" + +#, c-format +#~ msgid "Failed to create page for `%s'\n" +#~ msgstr "Se produjo un fallo al crear la página para «%s»\n" + +#, c-format +#~ msgid "Failed to setup post processor for `%s'\n" +#~ msgstr "Se produjo un fallo al configurar el post-procesador para «%s»\n" + +#~ msgid "Domain name must not contain `.'\n" +#~ msgstr "El nombre de dominio no puede contener «.»\n" + +#~ msgid "Domain name must not contain `+'\n" +#~ msgstr "El nombre de dominio no puede contener «+»\n" + #, c-format #~ msgid "Unable to parse PKEY record `%s'\n" #~ msgstr "No se pudo procesar el registro PKEY «%s»\n" @@ -10171,9 +10296,6 @@ msgstr "¡Se produjo un fallo al conectar con el almacén de nombres!\n" #~ "No se ha recibido una respuesta válida para la petición «%s» del servicio " #~ "«%s».\n" -#~ msgid "unknown error" -#~ msgstr "error desconocido" - #~ msgid "Unexpected time for a response from `fs' service." #~ msgstr "Tiempo inesperado para una respuesta del servicio «fs»." @@ -11859,10 +11981,6 @@ msgstr "¡Se produjo un fallo al conectar con el almacén de nombres!\n" #~ msgid "Configuration option `%s' in section `%s' missing.\n" #~ msgstr "Falta la opción «%s» en la sección «%s» de la configuración\n" -#~ msgid "Configuration fails to specify `%s', assuming default value." -#~ msgstr "" -#~ "La configuración no especifica «%s», asumiendo el valor predeterminado." - #~ msgid "" #~ "Invalid value specified for option `%s' in section `%s', content pushing " #~ "disabled\n" @@ -12829,10 +12947,6 @@ msgstr "¡Se produjo un fallo al conectar con el almacén de nombres!\n" #~ "automáticamente arrancado cuando enciendas tu ordenador. Si dices \"no\" " #~ "aquí, tendrás que ejecutar GNUnet tu mismo cada vez que quieras usarlo." -#, fuzzy -#~ msgid "Unable to create user account for daemon." -#~ msgstr "Imposible crear la cuenta de usuario:" - #, fuzzy #~ msgid "Save configuration?" #~ msgstr "Configuración de GNUnet" @@ -13435,9 +13549,6 @@ msgstr "¡Se produjo un fallo al conectar con el almacén de nombres!\n" #~ "usa libextractor para añadir referencias directas adicionales a las " #~ "entradas del directorio" -#~ msgid "Created entry `%s' in namespace `%s'\n" -#~ msgstr "Creada la entrada '%s' en el espacio '%s'\n" - #, fuzzy #~ msgid "" #~ "%16llu of %16llu bytes inserted (estimating %6s to completion) - %s\n" diff --git a/po/fr.po b/po/fr.po index 6aba5bc6c..cfdd738eb 100644 --- a/po/fr.po +++ b/po/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: gnunet 0.10.1\n" "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" -"POT-Creation-Date: 2021-04-04 19:19+0200\n" +"POT-Creation-Date: 2021-08-08 18:36+0200\n" "PO-Revision-Date: 2015-12-24 01:20+0100\n" "Last-Translator: Stéphane Aulery \n" "Language-Team: French \n" @@ -28,7 +28,7 @@ msgstr "" #: src/abd/gnunet-abd.c:560 src/abd/gnunet-service-abd.c:1747 #: src/namestore/gnunet-namestore.c:1001 -#: src/namestore/gnunet-namestore-fcfsd.c:1164 +#: src/namestore/gnunet-namestore-fcfsd.c:1067 #, c-format msgid "Failed to connect to namestore\n" msgstr "" @@ -745,7 +745,7 @@ msgstr "" #: src/auction/gnunet-auction-info.c:77 src/auction/gnunet-auction-join.c:77 #: src/conversation/gnunet-conversation-test.c:256 -#: src/revocation/gnunet-revocation.c:564 src/template/gnunet-template.c:75 +#: src/revocation/gnunet-revocation.c:570 src/template/gnunet-template.c:75 msgid "help text" msgstr "" @@ -1105,7 +1105,7 @@ msgstr "" #, c-format msgid "" "\n" -"We are now playing your recording back. If you can hear it, your audio " +"ew are now playing your recording back. If you can hear it, your audio " "settings are working..." msgstr "" @@ -1517,38 +1517,38 @@ msgstr "" msgid "# updates to my type map" msgstr "" -#: src/datacache/datacache.c:115 src/datacache/datacache.c:287 +#: src/datacache/datacache.c:115 src/datacache/datacache.c:299 #: src/datastore/gnunet-service-datastore.c:742 msgid "# bytes stored" msgstr "" -#: src/datacache/datacache.c:119 src/datacache/datacache.c:291 +#: src/datacache/datacache.c:119 src/datacache/datacache.c:303 msgid "# items stored" msgstr "" -#: src/datacache/datacache.c:189 +#: src/datacache/datacache.c:190 #, c-format msgid "Loading `%s' datacache plugin\n" msgstr "" -#: src/datacache/datacache.c:197 +#: src/datacache/datacache.c:208 #, c-format msgid "Failed to load datacache plugin for `%s'\n" msgstr "" -#: src/datacache/datacache.c:320 +#: src/datacache/datacache.c:332 msgid "# requests received" msgstr "" -#: src/datacache/datacache.c:331 +#: src/datacache/datacache.c:343 msgid "# requests filtered by bloom filter" msgstr "" -#: src/datacache/datacache.c:358 +#: src/datacache/datacache.c:370 msgid "# requests for random value received" msgstr "" -#: src/datacache/datacache.c:388 +#: src/datacache/datacache.c:400 msgid "# proximity search requests received" msgstr "" @@ -1882,7 +1882,7 @@ msgstr "" #: src/datastore/plugin_datastore_postgres.c:284 #: src/datastore/plugin_datastore_postgres.c:897 -msgid "Postgress exec failure" +msgid "Postgresql exec failure" msgstr "" #: src/datastore/plugin_datastore_postgres.c:858 @@ -1917,14 +1917,25 @@ msgstr "" msgid "sqlite version to old to determine size, assuming zero\n" msgstr "" -#: src/datastore/plugin_datastore_sqlite.c:1274 +#: src/datastore/plugin_datastore_sqlite.c:1266 +#: src/datastore/plugin_datastore_sqlite.c:1279 +#, fuzzy +msgid "error preparing statement\n" +msgstr "Erreur de création du tunnel\n" + +#: src/datastore/plugin_datastore_sqlite.c:1287 +#, fuzzy +msgid "error stepping\n" +msgstr "%s est en cours d'arrêt" + +#: src/datastore/plugin_datastore_sqlite.c:1295 #, c-format msgid "" "Using sqlite page utilization to estimate payload (%llu pages of size %llu " "bytes)\n" msgstr "" -#: src/datastore/plugin_datastore_sqlite.c:1316 +#: src/datastore/plugin_datastore_sqlite.c:1337 #: src/namecache/plugin_namecache_sqlite.c:564 #: src/namestore/plugin_namestore_sqlite.c:765 msgid "Sqlite database running\n" @@ -2172,87 +2183,87 @@ msgstr "" msgid "# requests TTL-dropped" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1052 -#: src/dht/gnunet-service-dht_neighbours.c:1096 +#: src/dht/gnunet-service-dht_neighbours.c:1035 +#: src/dht/gnunet-service-dht_neighbours.c:1072 msgid "# Peers excluded from routing due to Bloomfilter" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1069 -#: src/dht/gnunet-service-dht_neighbours.c:1112 +#: src/dht/gnunet-service-dht_neighbours.c:1045 +#: src/dht/gnunet-service-dht_neighbours.c:1088 msgid "# Peer selection failed" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1270 +#: src/dht/gnunet-service-dht_neighbours.c:1246 msgid "# PUT requests routed" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1304 +#: src/dht/gnunet-service-dht_neighbours.c:1280 msgid "# PUT messages queued for transmission" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1316 -#: src/dht/gnunet-service-dht_neighbours.c:1458 -#: src/dht/gnunet-service-dht_neighbours.c:1562 +#: src/dht/gnunet-service-dht_neighbours.c:1292 +#: src/dht/gnunet-service-dht_neighbours.c:1434 +#: src/dht/gnunet-service-dht_neighbours.c:1538 msgid "# P2P messages dropped due to full queue" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1401 +#: src/dht/gnunet-service-dht_neighbours.c:1377 msgid "# GET requests routed" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1445 +#: src/dht/gnunet-service-dht_neighbours.c:1421 msgid "# GET messages queued for transmission" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1577 +#: src/dht/gnunet-service-dht_neighbours.c:1553 msgid "# RESULT messages queued for transmission" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1680 +#: src/dht/gnunet-service-dht_neighbours.c:1656 msgid "# Expired PUTs discarded" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1688 +#: src/dht/gnunet-service-dht_neighbours.c:1664 msgid "# P2P PUT requests received" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1692 +#: src/dht/gnunet-service-dht_neighbours.c:1668 msgid "# P2P PUT bytes received" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1924 +#: src/dht/gnunet-service-dht_neighbours.c:1900 msgid "# FIND PEER requests ignored due to Bloomfilter" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1933 +#: src/dht/gnunet-service-dht_neighbours.c:1909 msgid "# FIND PEER requests ignored due to lack of HELLO" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:2096 +#: src/dht/gnunet-service-dht_neighbours.c:2072 msgid "# P2P GET requests received" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:2100 +#: src/dht/gnunet-service-dht_neighbours.c:2076 msgid "# P2P GET bytes received" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:2166 +#: src/dht/gnunet-service-dht_neighbours.c:2142 msgid "# P2P FIND PEER requests processed" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:2187 +#: src/dht/gnunet-service-dht_neighbours.c:2163 msgid "# P2P GET requests ONLY routed" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:2365 +#: src/dht/gnunet-service-dht_neighbours.c:2341 msgid "# Expired results discarded" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:2382 +#: src/dht/gnunet-service-dht_neighbours.c:2358 msgid "# P2P RESULTS received" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:2386 +#: src/dht/gnunet-service-dht_neighbours.c:2362 msgid "# P2P RESULT bytes received" msgstr "" @@ -2707,7 +2718,7 @@ msgstr "" #: src/fs/fs_download.c:346 #, c-format msgid "" -"Failed to access full directroy contents of `%s' for recursive download\n" +"Failed to access full directory contents of `%s' for recursive download\n" msgstr "" #: src/fs/fs_download.c:528 src/fs/fs_download.c:541 @@ -3909,7 +3920,7 @@ msgstr "" msgid "GNUnet GNS resolver tool" msgstr "" -#: src/gns/gnunet-gns-import.c:491 +#: src/gns/gnunet-gns-import.c:490 msgid "This program will import some GNS authorities into your GNS namestore." msgstr "" @@ -4580,52 +4591,52 @@ msgstr "" msgid "Failed to set default ego: %s\n" msgstr "" -#: src/identity/gnunet-identity.c:462 +#: src/identity/gnunet-identity.c:461 msgid "create ego NAME" msgstr "" -#: src/identity/gnunet-identity.c:467 +#: src/identity/gnunet-identity.c:466 msgid "delete ego NAME " msgstr "" -#: src/identity/gnunet-identity.c:473 +#: src/identity/gnunet-identity.c:472 msgid "" "set the private key for the identity to PRIVATE_KEY (use together with -C)" msgstr "" -#: src/identity/gnunet-identity.c:478 +#: src/identity/gnunet-identity.c:477 msgid "generate an EdDSA identity. (use together with -C) EXPERIMENTAL" msgstr "" -#: src/identity/gnunet-identity.c:482 +#: src/identity/gnunet-identity.c:481 msgid "display all egos" msgstr "" -#: src/identity/gnunet-identity.c:486 +#: src/identity/gnunet-identity.c:485 #, fuzzy msgid "reduce output" msgstr "sortie verbeuse" -#: src/identity/gnunet-identity.c:493 +#: src/identity/gnunet-identity.c:492 msgid "" "set default identity to NAME for a subsystem SUBSYSTEM (use together with -" "s) or restrict results to NAME (use together with -d)" msgstr "" -#: src/identity/gnunet-identity.c:497 +#: src/identity/gnunet-identity.c:496 msgid "run in monitor mode egos" msgstr "" -#: src/identity/gnunet-identity.c:501 +#: src/identity/gnunet-identity.c:500 msgid "display private keys as well" msgstr "" -#: src/identity/gnunet-identity.c:508 +#: src/identity/gnunet-identity.c:507 msgid "" "set default identity to EGO for a subsystem SUBSYSTEM (use together with -e)" msgstr "" -#: src/identity/gnunet-identity.c:523 +#: src/identity/gnunet-identity.c:522 msgid "Maintain egos" msgstr "" @@ -4680,7 +4691,7 @@ msgstr "" msgid "Identity REST API initialized\n" msgstr "" -#: src/json/json.c:139 +#: src/json/json.c:119 #, fuzzy, c-format msgid "Failed to parse JSON in option `%s': %s (%s)\n" msgstr "Résolution de « %s » échouée : %s\n" @@ -5017,71 +5028,108 @@ msgstr "" msgid "name of the ego controlling the zone" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:552 -#, c-format -msgid "Unsupported form value `%s'\n" +#: src/namestore/gnunet-namestore-fcfsd.c:359 +msgid "can not search the namestore" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:579 -#, c-format -msgid "Failed to create record for domain `%s': %s\n" +#: src/namestore/gnunet-namestore-fcfsd.c:413 +#: src/namestore/gnunet-namestore-fcfsd.c:554 +msgid "unable to scan namestore" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:600 -msgid "Error when mapping zone to name\n" -msgstr "" +#: src/namestore/gnunet-namestore-fcfsd.c:441 +#, fuzzy, c-format +msgid "Failed to create record for `%s': %s\n" +msgstr "Résolution de « %s » échouée : %s\n" -#: src/namestore/gnunet-namestore-fcfsd.c:633 +#: src/namestore/gnunet-namestore-fcfsd.c:453 +#, fuzzy +msgid "no errors" +msgstr "erreur unconnue." + +#: src/namestore/gnunet-namestore-fcfsd.c:489 #, c-format -msgid "Found existing name `%s' for the given key\n" +msgid "The requested key `%s' exists as `%s'\n" +msgstr "" + +#: src/namestore/gnunet-namestore-fcfsd.c:496 +msgid "key exists" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:646 +#: src/namestore/gnunet-namestore-fcfsd.c:513 #, fuzzy -msgid "Error creating record data.\n" +msgid "Error creating record data\n" msgstr "Erreur de création du tunnel\n" -#: src/namestore/gnunet-namestore-fcfsd.c:707 -#, c-format -msgid "Found %u existing records for domain `%s'\n" -msgstr "" +#: src/namestore/gnunet-namestore-fcfsd.c:517 +#, fuzzy +msgid "unable to store record" +msgstr "Échec du démarrage de %s\n" -#: src/namestore/gnunet-namestore-fcfsd.c:796 +#: src/namestore/gnunet-namestore-fcfsd.c:588 #, c-format -msgid "Failed to create page for `%s'\n" +msgid "Requested name `%s' exists with `%u' records\n" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:815 -#, c-format -msgid "Failed to setup post processor for `%s'\n" +#: src/namestore/gnunet-namestore-fcfsd.c:594 +msgid "name exists\n" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:850 -msgid "Domain name must not contain `.'\n" +#: src/namestore/gnunet-namestore-fcfsd.c:780 +msgid "unable to process submitted data" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:859 -msgid "Domain name must not contain `+'\n" +#: src/namestore/gnunet-namestore-fcfsd.c:787 +msgid "the submitted data is invalid" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:1094 +#: src/namestore/gnunet-namestore-fcfsd.c:806 +#, fuzzy +msgid "invalid parameters" +msgstr "Argument invalide « %s »\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:823 +#, fuzzy +msgid "invalid name" +msgstr "Argument invalide « %s »\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:834 +#, fuzzy, c-format +msgid "Unable to parse key %s\n" +msgstr "Résolution de « %s » échouée\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:838 +#, fuzzy +msgid "unable to parse key" +msgstr "Résolution de « %s » échouée\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:949 msgid "No ego configured for `fcfsd` subsystem\n" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:1125 +#: src/namestore/gnunet-namestore-fcfsd.c:974 msgid "Failed to start HTTP server\n" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:1173 +#: src/namestore/gnunet-namestore-fcfsd.c:1058 +msgid "No port specified, using default value\n" +msgstr "" + +#: src/namestore/gnunet-namestore-fcfsd.c:1076 msgid "Failed to connect to identity\n" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:1200 -msgid "name of the zone that is to be managed by FCFSD" +#: src/namestore/gnunet-namestore-fcfsd.c:1100 +#, fuzzy +msgid "Unable to set up the daemon\n" +msgstr "Résolution de « %s » échouée\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:1123 +msgid "name of the zone managed by FCFSD" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:1220 -msgid "GNU Name System First Come First Serve name registration service" +#: src/namestore/gnunet-namestore-fcfsd.c:1132 +msgid "GNU Name System First-Come-First-Served name registration service" msgstr "" #: src/namestore/gnunet-service-namestore.c:871 @@ -5089,11 +5137,11 @@ msgstr "" msgid "Failed to replicate block in namecache: %s\n" msgstr "" -#: src/namestore/gnunet-zoneimport.c:1848 +#: src/namestore/gnunet-zoneimport.c:1847 msgid "size to use for the main hash map" msgstr "" -#: src/namestore/gnunet-zoneimport.c:1854 +#: src/namestore/gnunet-zoneimport.c:1853 msgid "minimum expiration time we assume for imported records" msgstr "" @@ -5115,7 +5163,7 @@ msgstr "" msgid "Flat file database running\n" msgstr "" -#: src/namestore/plugin_rest_namestore.c:1105 +#: src/namestore/plugin_rest_namestore.c:1111 msgid "Namestore REST API initialized\n" msgstr "" @@ -5754,11 +5802,11 @@ msgstr "" msgid "re:claimID command line tool" msgstr "" -#: src/reclaim/plugin_rest_openid_connect.c:2788 +#: src/reclaim/plugin_rest_openid_connect.c:2793 msgid "OpenID Connect REST API initialized\n" msgstr "" -#: src/reclaim/plugin_rest_reclaim.c:1521 +#: src/reclaim/plugin_rest_pabc.c:637 src/reclaim/plugin_rest_reclaim.c:1520 msgid "Identity Provider REST API initialized\n" msgstr "" @@ -5776,56 +5824,56 @@ msgstr "" msgid "Daemon to announce regular expressions for the peer using cadet." msgstr "" -#: src/regex/gnunet-regex-profiler.c:1390 +#: src/regex/gnunet-regex-profiler.c:1392 msgid "No configuration file given. Exiting\n" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1432 +#: src/regex/gnunet-regex-profiler.c:1434 #: src/regex/gnunet-regex-simulation-profiler.c:631 #, c-format msgid "No policy directory specified on command line. Exiting.\n" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1438 +#: src/regex/gnunet-regex-profiler.c:1440 #: src/regex/gnunet-regex-simulation-profiler.c:639 #, c-format msgid "Specified policies directory does not exist. Exiting.\n" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1446 +#: src/regex/gnunet-regex-profiler.c:1448 #, c-format msgid "No files found in `%s'\n" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1455 +#: src/regex/gnunet-regex-profiler.c:1457 msgid "No search strings file given. Exiting.\n" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1475 +#: src/regex/gnunet-regex-profiler.c:1477 msgid "Error loading search strings. Exiting.\n" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1563 +#: src/regex/gnunet-regex-profiler.c:1565 msgid "name of the file for writing statistics" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1570 +#: src/regex/gnunet-regex-profiler.c:1572 msgid "wait TIMEOUT before ending the experiment" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1576 +#: src/regex/gnunet-regex-profiler.c:1578 msgid "directory with policy files" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1584 +#: src/regex/gnunet-regex-profiler.c:1586 msgid "name of file with input strings" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1591 +#: src/regex/gnunet-regex-profiler.c:1593 msgid "name of file with hosts' names" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1604 +#: src/regex/gnunet-regex-profiler.c:1606 msgid "Profiler for regex" msgstr "" @@ -5851,11 +5899,11 @@ msgstr "" msgid "Search string `%s' is too long!\n" msgstr "" -#: src/rest/gnunet-rest-server.c:1266 +#: src/rest/gnunet-rest-server.c:1267 msgid "GNUnet REST server" msgstr "" -#: src/rest/plugin_rest_config.c:427 +#: src/rest/plugin_rest_config.c:428 msgid "CONFIG REST API initialized\n" msgstr "" @@ -5918,70 +5966,75 @@ msgstr "" msgid "Ego `%s' not found.\n" msgstr "" -#: src/revocation/gnunet-revocation.c:351 +#: src/revocation/gnunet-revocation.c:350 +#, c-format +msgid "Error: Key is invalid\n" +msgstr "" + +#: src/revocation/gnunet-revocation.c:357 #, c-format msgid "Error: revocation certificate in `%s' is not for `%s'\n" msgstr "" -#: src/revocation/gnunet-revocation.c:361 +#: src/revocation/gnunet-revocation.c:367 msgid "Revocation certificate ready\n" msgstr "" -#: src/revocation/gnunet-revocation.c:373 +#: src/revocation/gnunet-revocation.c:379 msgid "Continuing calculation where left off...\n" msgstr "" -#: src/revocation/gnunet-revocation.c:380 +#: src/revocation/gnunet-revocation.c:386 msgid "Revocation certificate not ready, calculating proof of work\n" msgstr "" -#: src/revocation/gnunet-revocation.c:418 +#: src/revocation/gnunet-revocation.c:424 #, c-format msgid "Public key `%s' malformed\n" msgstr "" -#: src/revocation/gnunet-revocation.c:428 +#: src/revocation/gnunet-revocation.c:434 msgid "" "Testing and revoking at the same time is not allowed, only executing test.\n" msgstr "" -#: src/revocation/gnunet-revocation.c:458 +#: src/revocation/gnunet-revocation.c:464 msgid "No filename to store revocation certificate given.\n" msgstr "" -#: src/revocation/gnunet-revocation.c:475 +#: src/revocation/gnunet-revocation.c:481 #, c-format msgid "Failed to read revocation certificate from `%s'\n" msgstr "" -#: src/revocation/gnunet-revocation.c:483 +#: src/revocation/gnunet-revocation.c:489 #, c-format msgid "Revocation certificate corrupted in `%s'\n" msgstr "" -#: src/revocation/gnunet-revocation.c:505 +#: src/revocation/gnunet-revocation.c:511 msgid "No action specified. Nothing to do.\n" msgstr "" -#: src/revocation/gnunet-revocation.c:524 +#: src/revocation/gnunet-revocation.c:530 msgid "use NAME for the name of the revocation file" msgstr "" -#: src/revocation/gnunet-revocation.c:532 +#: src/revocation/gnunet-revocation.c:538 msgid "" "revoke the private key associated for the the private key associated with " "the ego NAME " msgstr "" -#: src/revocation/gnunet-revocation.c:539 +#: src/revocation/gnunet-revocation.c:545 msgid "actually perform revocation, otherwise we just do the precomputation" msgstr "" -#: src/revocation/gnunet-revocation.c:546 +#: src/revocation/gnunet-revocation.c:552 msgid "test if the public key KEY has been revoked" msgstr "" -#: src/revocation/gnunet-revocation.c:552 +#: src/revocation/gnunet-revocation.c:558 #, fuzzy msgid "number of epochs to calculate for" msgstr "nombre de valeurs" @@ -6101,11 +6154,11 @@ msgstr "" #: src/scalarproduct/gnunet-service-scalarproduct_alice.c:1358 #: src/scalarproduct/gnunet-service-scalarproduct_bob.c:1355 #: src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c:1118 -#: src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c:1063 +#: src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c:1034 msgid "Connect to CADET failed\n" msgstr "" -#: src/scalarproduct/scalarproduct_api.c:189 +#: src/scalarproduct/scalarproduct_api.c:184 msgid "Keys given to SCALARPRODUCT not unique!\n" msgstr "" @@ -6126,7 +6179,7 @@ msgid "also profile decryption" msgstr "" #: src/set/gnunet-service-set.c:1916 src/seti/gnunet-service-seti.c:2467 -#: src/setu/gnunet-service-setu.c:3832 +#: src/setu/gnunet-service-setu.c:5395 #, fuzzy msgid "Could not connect to CADET service\n" msgstr "Impossible d’ouvrir « %s ».\n" @@ -6365,7 +6418,7 @@ msgid "" "\t cap: the maximum number of links a node can have\n" "\t m: the number of links a node should have while joining the network\n" "\t filename: the path of the file which contains topology information\n" -"NOTE: the format of the above file is descibed here: https://www.gnunet.org/" +"NOTE: the format of the above file is described here: https://www.gnunet.org/" "content/topology-file-format\n" msgstr "" @@ -6460,7 +6513,7 @@ msgid "Spawning process `%s'\n" msgstr "" #: src/testbed/gnunet-testbed-profiler.c:290 -msgid "tolerate COUNT number of continious timeout failures" +msgid "tolerate COUNT number of continuous timeout failures" msgstr "" #: src/testbed/gnunet-testbed-profiler.c:295 @@ -6757,14 +6810,14 @@ msgstr "" msgid "GNUnet topology control" msgstr "" -#: src/transport/gnunet-communicator-tcp.c:3331 +#: src/transport/gnunet-communicator-tcp.c:3314 #: src/transport/gnunet-communicator-udp.c:3790 -#: src/transport/gnunet-service-tng.c:10220 +#: src/transport/gnunet-service-tng.c:10223 #: src/transport/gnunet-service-transport.c:2627 msgid "Transport service is lacking key configuration settings. Exiting.\n" msgstr "" -#: src/transport/gnunet-communicator-tcp.c:3668 +#: src/transport/gnunet-communicator-tcp.c:3652 msgid "GNUnet TCP communicator" msgstr "" @@ -7790,7 +7843,7 @@ msgstr "" msgid "Service process failed to report status\n" msgstr "" -#: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1040 +#: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1220 #: src/util/service.c:1637 #, c-format msgid "Cannot obtain information about user `%s': %s\n" @@ -7908,39 +7961,15 @@ msgstr "" msgid "Failed to serialize metadata `%s'" msgstr "Échec du démarrage de %s\n" -#: src/util/client.c:747 src/util/client.c:937 +#: src/util/client.c:747 src/util/client.c:938 msgid "not a valid filename" msgstr "" -#: src/util/client.c:1103 +#: src/util/client.c:1104 #, c-format msgid "Need a non-empty hostname for service `%s'.\n" msgstr "" -#: src/util/common_logging.c:259 src/util/common_logging.c:1114 -msgid "DEBUG" -msgstr "DEBUG" - -#: src/util/common_logging.c:261 src/util/common_logging.c:1112 -msgid "INFO" -msgstr "INFO" - -#: src/util/common_logging.c:263 src/util/common_logging.c:1110 -msgid "MESSAGE" -msgstr "" - -#: src/util/common_logging.c:265 src/util/common_logging.c:1108 -msgid "WARNING" -msgstr "AVERTISSEMENT" - -#: src/util/common_logging.c:267 src/util/common_logging.c:1106 -msgid "ERROR" -msgstr "ERREUR" - -#: src/util/common_logging.c:269 src/util/common_logging.c:1116 -msgid "NONE" -msgstr "AUCUN" - #: src/util/common_logging.c:626 src/util/common_logging.c:665 #, c-format msgid "ERROR: Unable to parse log definition: Syntax error at `%s'.\n" @@ -7951,6 +7980,30 @@ msgstr "" msgid "Message `%.*s' repeated %u times in the last %s\n" msgstr "" +#: src/util/common_logging.c:1106 +msgid "ERROR" +msgstr "ERREUR" + +#: src/util/common_logging.c:1108 +msgid "WARNING" +msgstr "AVERTISSEMENT" + +#: src/util/common_logging.c:1110 +msgid "MESSAGE" +msgstr "" + +#: src/util/common_logging.c:1112 +msgid "INFO" +msgstr "INFO" + +#: src/util/common_logging.c:1114 +msgid "DEBUG" +msgstr "DEBUG" + +#: src/util/common_logging.c:1116 +msgid "NONE" +msgstr "AUCUN" + #: src/util/common_logging.c:1117 msgid "INVALID" msgstr "INVALIDE" @@ -7974,38 +8027,68 @@ msgid "" "Configuration specifies invalid value for option `%s' in section `%s': %s\n" msgstr "" -#: src/util/configuration.c:370 +#: src/util/configuration.c:790 +#, c-format +msgid "Illegal directive in line %u (parsing restricted section %s)\n" +msgstr "" + +#: src/util/configuration.c:800 +#, c-format +msgid "Bad directive in line %u\n" +msgstr "" + +#: src/util/configuration.c:853 +#, c-format +msgid "Bad inline-secret directive in line %u\n" +msgstr "" + +#: src/util/configuration.c:875 +#, c-format +msgid "Unknown or malformed directive '%s' in line %u\n" +msgstr "" + +#: src/util/configuration.c:905 +#, c-format +msgid "Syntax error while deserializing in line %u (option without section)\n" +msgstr "" + +#: src/util/configuration.c:949 #, c-format msgid "Syntax error while deserializing in line %u\n" msgstr "" -#: src/util/configuration.c:420 +#: src/util/configuration.c:1049 #, fuzzy, c-format msgid "Error while reading file `%s'\n" msgstr "Erreur de lecture : « %s » : %s" -#: src/util/configuration.c:980 +#: src/util/configuration.c:1062 +#, fuzzy, c-format +msgid "Failed to parse configuration file `%s'\n" +msgstr "fornat invalide : « %s »\n" + +#: src/util/configuration.c:1695 msgid "Not a valid relative time specification" msgstr "" -#: src/util/configuration.c:1050 +#: src/util/configuration.c:1765 #, c-format msgid "" "Configuration value '%s' for '%s' in section '%s' is not in set of legal " "choices\n" msgstr "" -#: src/util/configuration.c:1145 +#: src/util/configuration.c:1860 #, c-format msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n" msgstr "" -#: src/util/configuration.c:1177 +#: src/util/configuration.c:1892 #, c-format msgid "Missing closing `%s' in option `%s'\n" msgstr "" -#: src/util/configuration.c:1243 +#: src/util/configuration.c:1958 #, c-format msgid "" "Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined " @@ -8048,7 +8131,7 @@ msgstr "" msgid "RSA signature verification failed at %s:%d: %s\n" msgstr "" -#: src/util/disk.c:823 +#: src/util/disk.c:843 #, c-format msgid "Expected `%s' to be a directory!\n" msgstr "" @@ -8229,59 +8312,68 @@ msgstr "" msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" msgstr "" -#: src/util/gnunet-base32.c:45 +#: src/util/gnunet-base32.c:46 msgid "run decoder modus, otherwise runs as encoder" msgstr "" -#: src/util/gnunet-config.c:167 -#, fuzzy, c-format -msgid "failed to load configuration defaults" -msgstr "fornat invalide : « %s »\n" - -#: src/util/gnunet-config.c:179 +#: src/util/gnunet-config.c:187 #, c-format -msgid "%s or %s argument is required\n" +msgid "The following sections are available:\n" msgstr "" -#: src/util/gnunet-config.c:186 +#: src/util/gnunet-config.c:201 #, c-format -msgid "The following sections are available:\n" +msgid "%s, %s or %s argument is required\n" msgstr "" -#: src/util/gnunet-config.c:234 +#: src/util/gnunet-config.c:266 #, c-format msgid "--option argument required to set value\n" msgstr "" -#: src/util/gnunet-config.c:284 -msgid "interpret option value as a filename (with $-expansion)" -msgstr "" +#: src/util/gnunet-config.c:309 +#, fuzzy, c-format +msgid "failed to load configuration defaults" +msgstr "fornat invalide : « %s »\n" -#: src/util/gnunet-config.c:291 +#: src/util/gnunet-config.c:354 msgid "test if the current installation supports the specified BACKEND" msgstr "" -#: src/util/gnunet-config.c:297 -msgid "name of the section to access" +#: src/util/gnunet-config.c:360 +#, fuzzy +msgid "write the full configuration file, including default values" +msgstr "fornat invalide : « %s »\n" + +#: src/util/gnunet-config.c:365 +msgid "interpret option value as a filename (with $-expansion)" msgstr "" -#: src/util/gnunet-config.c:302 +#: src/util/gnunet-config.c:370 msgid "name of the option to access" msgstr "" -#: src/util/gnunet-config.c:307 -msgid "value to set" +#: src/util/gnunet-config.c:376 +msgid "rewrite the configuration file, even if nothing changed" msgstr "" -#: src/util/gnunet-config.c:312 +#: src/util/gnunet-config.c:382 +msgid "output extra diagnostics" +msgstr "" + +#: src/util/gnunet-config.c:387 msgid "print available configuration sections" msgstr "" -#: src/util/gnunet-config.c:318 -msgid "write configuration file that only contains delta to defaults" +#: src/util/gnunet-config.c:393 +msgid "name of the section to access" msgstr "" -#: src/util/gnunet-config.c:330 +#: src/util/gnunet-config.c:398 +msgid "value to set" +msgstr "" + +#: src/util/gnunet-config.c:413 msgid "Manipulate GNUnet configuration files" msgstr "" @@ -8509,21 +8601,21 @@ msgstr "" msgid "`%s' failed for library `%s' with error: %s\n" msgstr "" -#: src/util/plugin.c:409 +#: src/util/plugin.c:414 msgid "Could not determine plugin installation path.\n" msgstr "" -#: src/util/program.c:259 +#: src/util/program.c:252 #, fuzzy, c-format msgid "Unreadable or malformed configuration file `%s', exit ...\n" msgstr "fornat invalide : « %s »\n" -#: src/util/program.c:276 +#: src/util/program.c:272 #, c-format msgid "Unreadable or malformed default configuration file `%s', exit ...\n" msgstr "" -#: src/util/program.c:291 +#: src/util/program.c:288 #, fuzzy msgid "Unreadable or malformed configuration, exit ...\n" msgstr "fornat invalide : « %s »\n" @@ -8588,82 +8680,82 @@ msgstr "" msgid "Attempting to proxy service `%s' to invalid port %d or hostname.\n" msgstr "" -#: src/util/strings.c:503 +#: src/util/strings.c:409 #, c-format msgid "Character sets requested were `%s'->`%s'\n" msgstr "" -#: src/util/strings.c:637 +#: src/util/strings.c:501 msgid "Failed to expand `$HOME': environment variable `HOME' not set" msgstr "" -#: src/util/strings.c:1241 +#: src/util/strings.c:1036 msgid "IPv6 address did not start with `['\n" msgstr "" -#: src/util/strings.c:1249 +#: src/util/strings.c:1044 msgid "IPv6 address did contain ':' to separate port number\n" msgstr "" -#: src/util/strings.c:1256 +#: src/util/strings.c:1051 msgid "IPv6 address did contain ']' before ':' to separate port number\n" msgstr "" -#: src/util/strings.c:1264 +#: src/util/strings.c:1059 msgid "IPv6 address did contain a valid port number after the last ':'\n" msgstr "" -#: src/util/strings.c:1273 +#: src/util/strings.c:1068 #, c-format msgid "Invalid IPv6 address `%s': %s\n" msgstr "" -#: src/util/strings.c:1500 src/util/strings.c:1511 +#: src/util/strings.c:1250 src/util/strings.c:1261 msgid "Port not in range\n" msgstr "" -#: src/util/strings.c:1520 +#: src/util/strings.c:1270 #, c-format msgid "Malformed port policy `%s'\n" msgstr "" -#: src/util/strings.c:1603 src/util/strings.c:1632 src/util/strings.c:1679 -#: src/util/strings.c:1699 +#: src/util/strings.c:1341 src/util/strings.c:1370 src/util/strings.c:1417 +#: src/util/strings.c:1437 #, c-format msgid "Invalid format for IP: `%s'\n" msgstr "" -#: src/util/strings.c:1657 +#: src/util/strings.c:1395 #, c-format msgid "Invalid network notation ('/%d' is not legal in IPv4 CIDR)." msgstr "" -#: src/util/strings.c:1708 +#: src/util/strings.c:1446 #, c-format msgid "Invalid format: `%s'\n" msgstr "fornat invalide : « %s »\n" -#: src/util/strings.c:1761 +#: src/util/strings.c:1488 #, c-format msgid "Invalid network notation (does not end with ';': `%s')\n" msgstr "" -#: src/util/strings.c:1811 +#: src/util/strings.c:1538 #, c-format msgid "Wrong format `%s' for netmask\n" msgstr "" -#: src/util/strings.c:1842 +#: src/util/strings.c:1569 #, c-format msgid "Wrong format `%s' for network\n" msgstr "" -#: src/util/time.c:878 src/util/time.c:906 +#: src/util/time.c:699 src/util/time.c:727 #, c-format msgid "Failed to map `%s', cannot assure monotonic time!\n" msgstr "" -#: src/util/time.c:914 +#: src/util/time.c:735 #, c-format msgid "" "Failed to setup monotonic time file `%s', cannot assure monotonic time!\n" @@ -9000,9 +9092,6 @@ msgstr "" #~ msgid "number too large" #~ msgstr "nombre de valeurs" -#~ msgid "unknown error" -#~ msgstr "erreur unconnue." - #, fuzzy #~ msgid "Failed to setup cadet channel!\n" #~ msgstr "Échec du démarrage de %s\n" diff --git a/po/it.po b/po/it.po index 38bc3f84d..8d4942bde 100644 --- a/po/it.po +++ b/po/it.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: gnunet 0.10.1\n" "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" -"POT-Creation-Date: 2021-04-04 19:19+0200\n" +"POT-Creation-Date: 2021-08-08 18:36+0200\n" "PO-Revision-Date: 2019-10-16 11:00+0200\n" "Last-Translator: Sebastiano Pistore \n" "Language-Team: Italian \n" @@ -32,7 +32,7 @@ msgstr "" #: src/abd/gnunet-abd.c:560 src/abd/gnunet-service-abd.c:1747 #: src/namestore/gnunet-namestore.c:1001 -#: src/namestore/gnunet-namestore-fcfsd.c:1164 +#: src/namestore/gnunet-namestore-fcfsd.c:1067 #, c-format msgid "Failed to connect to namestore\n" msgstr "" @@ -747,7 +747,7 @@ msgstr "" #: src/auction/gnunet-auction-info.c:77 src/auction/gnunet-auction-join.c:77 #: src/conversation/gnunet-conversation-test.c:256 -#: src/revocation/gnunet-revocation.c:564 src/template/gnunet-template.c:75 +#: src/revocation/gnunet-revocation.c:570 src/template/gnunet-template.c:75 msgid "help text" msgstr "" @@ -1107,7 +1107,7 @@ msgstr "" #, c-format msgid "" "\n" -"We are now playing your recording back. If you can hear it, your audio " +"ew are now playing your recording back. If you can hear it, your audio " "settings are working..." msgstr "" @@ -1524,39 +1524,39 @@ msgstr "" msgid "# updates to my type map" msgstr "" -#: src/datacache/datacache.c:115 src/datacache/datacache.c:287 +#: src/datacache/datacache.c:115 src/datacache/datacache.c:299 #: src/datastore/gnunet-service-datastore.c:742 msgid "# bytes stored" msgstr "" -#: src/datacache/datacache.c:119 src/datacache/datacache.c:291 +#: src/datacache/datacache.c:119 src/datacache/datacache.c:303 msgid "# items stored" msgstr "# elementi memorizzati" -#: src/datacache/datacache.c:189 +#: src/datacache/datacache.c:190 #, c-format msgid "Loading `%s' datacache plugin\n" msgstr "" -#: src/datacache/datacache.c:197 +#: src/datacache/datacache.c:208 #, c-format msgid "Failed to load datacache plugin for `%s'\n" msgstr "" -#: src/datacache/datacache.c:320 +#: src/datacache/datacache.c:332 msgid "# requests received" msgstr "" -#: src/datacache/datacache.c:331 +#: src/datacache/datacache.c:343 msgid "# requests filtered by bloom filter" msgstr "" -#: src/datacache/datacache.c:358 +#: src/datacache/datacache.c:370 #, fuzzy msgid "# requests for random value received" msgstr "# richieste GET ricevute" -#: src/datacache/datacache.c:388 +#: src/datacache/datacache.c:400 #, fuzzy msgid "# proximity search requests received" msgstr "# richieste GET ricevute" @@ -1893,7 +1893,7 @@ msgstr "" #: src/datastore/plugin_datastore_postgres.c:284 #: src/datastore/plugin_datastore_postgres.c:897 -msgid "Postgress exec failure" +msgid "Postgresql exec failure" msgstr "" #: src/datastore/plugin_datastore_postgres.c:858 @@ -1928,14 +1928,24 @@ msgstr "" msgid "sqlite version to old to determine size, assuming zero\n" msgstr "" -#: src/datastore/plugin_datastore_sqlite.c:1274 +#: src/datastore/plugin_datastore_sqlite.c:1266 +#: src/datastore/plugin_datastore_sqlite.c:1279 +msgid "error preparing statement\n" +msgstr "" + +#: src/datastore/plugin_datastore_sqlite.c:1287 +#, fuzzy +msgid "error stepping\n" +msgstr "# elementi memorizzati" + +#: src/datastore/plugin_datastore_sqlite.c:1295 #, c-format msgid "" "Using sqlite page utilization to estimate payload (%llu pages of size %llu " "bytes)\n" msgstr "" -#: src/datastore/plugin_datastore_sqlite.c:1316 +#: src/datastore/plugin_datastore_sqlite.c:1337 #: src/namecache/plugin_namecache_sqlite.c:564 #: src/namestore/plugin_namestore_sqlite.c:765 msgid "Sqlite database running\n" @@ -2178,87 +2188,87 @@ msgstr "" msgid "# requests TTL-dropped" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1052 -#: src/dht/gnunet-service-dht_neighbours.c:1096 +#: src/dht/gnunet-service-dht_neighbours.c:1035 +#: src/dht/gnunet-service-dht_neighbours.c:1072 msgid "# Peers excluded from routing due to Bloomfilter" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1069 -#: src/dht/gnunet-service-dht_neighbours.c:1112 +#: src/dht/gnunet-service-dht_neighbours.c:1045 +#: src/dht/gnunet-service-dht_neighbours.c:1088 msgid "# Peer selection failed" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1270 +#: src/dht/gnunet-service-dht_neighbours.c:1246 msgid "# PUT requests routed" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1304 +#: src/dht/gnunet-service-dht_neighbours.c:1280 msgid "# PUT messages queued for transmission" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1316 -#: src/dht/gnunet-service-dht_neighbours.c:1458 -#: src/dht/gnunet-service-dht_neighbours.c:1562 +#: src/dht/gnunet-service-dht_neighbours.c:1292 +#: src/dht/gnunet-service-dht_neighbours.c:1434 +#: src/dht/gnunet-service-dht_neighbours.c:1538 msgid "# P2P messages dropped due to full queue" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1401 +#: src/dht/gnunet-service-dht_neighbours.c:1377 msgid "# GET requests routed" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1445 +#: src/dht/gnunet-service-dht_neighbours.c:1421 msgid "# GET messages queued for transmission" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1577 +#: src/dht/gnunet-service-dht_neighbours.c:1553 msgid "# RESULT messages queued for transmission" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1680 +#: src/dht/gnunet-service-dht_neighbours.c:1656 msgid "# Expired PUTs discarded" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1688 +#: src/dht/gnunet-service-dht_neighbours.c:1664 msgid "# P2P PUT requests received" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1692 +#: src/dht/gnunet-service-dht_neighbours.c:1668 msgid "# P2P PUT bytes received" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1924 +#: src/dht/gnunet-service-dht_neighbours.c:1900 msgid "# FIND PEER requests ignored due to Bloomfilter" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1933 +#: src/dht/gnunet-service-dht_neighbours.c:1909 msgid "# FIND PEER requests ignored due to lack of HELLO" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:2096 +#: src/dht/gnunet-service-dht_neighbours.c:2072 msgid "# P2P GET requests received" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:2100 +#: src/dht/gnunet-service-dht_neighbours.c:2076 msgid "# P2P GET bytes received" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:2166 +#: src/dht/gnunet-service-dht_neighbours.c:2142 msgid "# P2P FIND PEER requests processed" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:2187 +#: src/dht/gnunet-service-dht_neighbours.c:2163 msgid "# P2P GET requests ONLY routed" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:2365 +#: src/dht/gnunet-service-dht_neighbours.c:2341 msgid "# Expired results discarded" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:2382 +#: src/dht/gnunet-service-dht_neighbours.c:2358 msgid "# P2P RESULTS received" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:2386 +#: src/dht/gnunet-service-dht_neighbours.c:2362 msgid "# P2P RESULT bytes received" msgstr "" @@ -2723,7 +2733,7 @@ msgstr "" #: src/fs/fs_download.c:346 #, c-format msgid "" -"Failed to access full directroy contents of `%s' for recursive download\n" +"Failed to access full directory contents of `%s' for recursive download\n" msgstr "" #: src/fs/fs_download.c:528 src/fs/fs_download.c:541 @@ -3934,7 +3944,7 @@ msgstr "" msgid "GNUnet GNS resolver tool" msgstr "" -#: src/gns/gnunet-gns-import.c:491 +#: src/gns/gnunet-gns-import.c:490 msgid "This program will import some GNS authorities into your GNS namestore." msgstr "" @@ -4608,51 +4618,51 @@ msgstr "" msgid "Failed to set default ego: %s\n" msgstr "" -#: src/identity/gnunet-identity.c:462 +#: src/identity/gnunet-identity.c:461 msgid "create ego NAME" msgstr "" -#: src/identity/gnunet-identity.c:467 +#: src/identity/gnunet-identity.c:466 msgid "delete ego NAME " msgstr "" -#: src/identity/gnunet-identity.c:473 +#: src/identity/gnunet-identity.c:472 msgid "" "set the private key for the identity to PRIVATE_KEY (use together with -C)" msgstr "" -#: src/identity/gnunet-identity.c:478 +#: src/identity/gnunet-identity.c:477 msgid "generate an EdDSA identity. (use together with -C) EXPERIMENTAL" msgstr "" -#: src/identity/gnunet-identity.c:482 +#: src/identity/gnunet-identity.c:481 msgid "display all egos" msgstr "" -#: src/identity/gnunet-identity.c:486 +#: src/identity/gnunet-identity.c:485 msgid "reduce output" msgstr "" -#: src/identity/gnunet-identity.c:493 +#: src/identity/gnunet-identity.c:492 msgid "" "set default identity to NAME for a subsystem SUBSYSTEM (use together with -" "s) or restrict results to NAME (use together with -d)" msgstr "" -#: src/identity/gnunet-identity.c:497 +#: src/identity/gnunet-identity.c:496 msgid "run in monitor mode egos" msgstr "" -#: src/identity/gnunet-identity.c:501 +#: src/identity/gnunet-identity.c:500 msgid "display private keys as well" msgstr "" -#: src/identity/gnunet-identity.c:508 +#: src/identity/gnunet-identity.c:507 msgid "" "set default identity to EGO for a subsystem SUBSYSTEM (use together with -e)" msgstr "" -#: src/identity/gnunet-identity.c:523 +#: src/identity/gnunet-identity.c:522 msgid "Maintain egos" msgstr "" @@ -4707,7 +4717,7 @@ msgstr "" msgid "Identity REST API initialized\n" msgstr "" -#: src/json/json.c:139 +#: src/json/json.c:119 #, fuzzy, c-format msgid "Failed to parse JSON in option `%s': %s (%s)\n" msgstr "Impossibile avviare il servizio ' %s'\n" @@ -5044,71 +5054,108 @@ msgstr "" msgid "name of the ego controlling the zone" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:552 -#, c-format -msgid "Unsupported form value `%s'\n" +#: src/namestore/gnunet-namestore-fcfsd.c:359 +msgid "can not search the namestore" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:579 -#, c-format -msgid "Failed to create record for domain `%s': %s\n" +#: src/namestore/gnunet-namestore-fcfsd.c:413 +#: src/namestore/gnunet-namestore-fcfsd.c:554 +msgid "unable to scan namestore" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:600 -msgid "Error when mapping zone to name\n" -msgstr "" +#: src/namestore/gnunet-namestore-fcfsd.c:441 +#, fuzzy, c-format +msgid "Failed to create record for `%s': %s\n" +msgstr "Impossibile avviare il servizio ' %s'\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:453 +#, fuzzy +msgid "no errors" +msgstr "errore sconosciuto" -#: src/namestore/gnunet-namestore-fcfsd.c:633 +#: src/namestore/gnunet-namestore-fcfsd.c:489 #, c-format -msgid "Found existing name `%s' for the given key\n" +msgid "The requested key `%s' exists as `%s'\n" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:646 +#: src/namestore/gnunet-namestore-fcfsd.c:496 +msgid "key exists" +msgstr "" + +#: src/namestore/gnunet-namestore-fcfsd.c:513 #, fuzzy -msgid "Error creating record data.\n" +msgid "Error creating record data\n" msgstr "Errore interno." -#: src/namestore/gnunet-namestore-fcfsd.c:707 -#, c-format -msgid "Found %u existing records for domain `%s'\n" -msgstr "" +#: src/namestore/gnunet-namestore-fcfsd.c:517 +#, fuzzy +msgid "unable to store record" +msgstr "Impossibile avviare il servizio.\n" -#: src/namestore/gnunet-namestore-fcfsd.c:796 +#: src/namestore/gnunet-namestore-fcfsd.c:588 #, c-format -msgid "Failed to create page for `%s'\n" +msgid "Requested name `%s' exists with `%u' records\n" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:815 -#, c-format -msgid "Failed to setup post processor for `%s'\n" +#: src/namestore/gnunet-namestore-fcfsd.c:594 +msgid "name exists\n" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:850 -msgid "Domain name must not contain `.'\n" +#: src/namestore/gnunet-namestore-fcfsd.c:780 +msgid "unable to process submitted data" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:859 -msgid "Domain name must not contain `+'\n" +#: src/namestore/gnunet-namestore-fcfsd.c:787 +msgid "the submitted data is invalid" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:1094 +#: src/namestore/gnunet-namestore-fcfsd.c:806 +#, fuzzy +msgid "invalid parameters" +msgstr "argomento non valido" + +#: src/namestore/gnunet-namestore-fcfsd.c:823 +#, fuzzy +msgid "invalid name" +msgstr "argomento non valido" + +#: src/namestore/gnunet-namestore-fcfsd.c:834 +#, fuzzy, c-format +msgid "Unable to parse key %s\n" +msgstr "Impossibile avviare il servizio ' %s'\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:838 +#, fuzzy +msgid "unable to parse key" +msgstr "Impossibile avviare il servizio ' %s'\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:949 msgid "No ego configured for `fcfsd` subsystem\n" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:1125 +#: src/namestore/gnunet-namestore-fcfsd.c:974 msgid "Failed to start HTTP server\n" msgstr "Impossibile avviare il server HTTP\n" -#: src/namestore/gnunet-namestore-fcfsd.c:1173 +#: src/namestore/gnunet-namestore-fcfsd.c:1058 +msgid "No port specified, using default value\n" +msgstr "" + +#: src/namestore/gnunet-namestore-fcfsd.c:1076 msgid "Failed to connect to identity\n" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:1200 -msgid "name of the zone that is to be managed by FCFSD" +#: src/namestore/gnunet-namestore-fcfsd.c:1100 +#, fuzzy +msgid "Unable to set up the daemon\n" +msgstr "Generazione statistiche fallita\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:1123 +msgid "name of the zone managed by FCFSD" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:1220 -msgid "GNU Name System First Come First Serve name registration service" +#: src/namestore/gnunet-namestore-fcfsd.c:1132 +msgid "GNU Name System First-Come-First-Served name registration service" msgstr "" #: src/namestore/gnunet-service-namestore.c:871 @@ -5116,11 +5163,11 @@ msgstr "" msgid "Failed to replicate block in namecache: %s\n" msgstr "" -#: src/namestore/gnunet-zoneimport.c:1848 +#: src/namestore/gnunet-zoneimport.c:1847 msgid "size to use for the main hash map" msgstr "" -#: src/namestore/gnunet-zoneimport.c:1854 +#: src/namestore/gnunet-zoneimport.c:1853 msgid "minimum expiration time we assume for imported records" msgstr "" @@ -5142,7 +5189,7 @@ msgstr "" msgid "Flat file database running\n" msgstr "" -#: src/namestore/plugin_rest_namestore.c:1105 +#: src/namestore/plugin_rest_namestore.c:1111 msgid "Namestore REST API initialized\n" msgstr "" @@ -5781,11 +5828,11 @@ msgstr "" msgid "re:claimID command line tool" msgstr "" -#: src/reclaim/plugin_rest_openid_connect.c:2788 +#: src/reclaim/plugin_rest_openid_connect.c:2793 msgid "OpenID Connect REST API initialized\n" msgstr "" -#: src/reclaim/plugin_rest_reclaim.c:1521 +#: src/reclaim/plugin_rest_pabc.c:637 src/reclaim/plugin_rest_reclaim.c:1520 msgid "Identity Provider REST API initialized\n" msgstr "" @@ -5803,56 +5850,56 @@ msgstr "" msgid "Daemon to announce regular expressions for the peer using cadet." msgstr "" -#: src/regex/gnunet-regex-profiler.c:1390 +#: src/regex/gnunet-regex-profiler.c:1392 msgid "No configuration file given. Exiting\n" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1432 +#: src/regex/gnunet-regex-profiler.c:1434 #: src/regex/gnunet-regex-simulation-profiler.c:631 #, c-format msgid "No policy directory specified on command line. Exiting.\n" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1438 +#: src/regex/gnunet-regex-profiler.c:1440 #: src/regex/gnunet-regex-simulation-profiler.c:639 #, c-format msgid "Specified policies directory does not exist. Exiting.\n" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1446 +#: src/regex/gnunet-regex-profiler.c:1448 #, c-format msgid "No files found in `%s'\n" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1455 +#: src/regex/gnunet-regex-profiler.c:1457 msgid "No search strings file given. Exiting.\n" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1475 +#: src/regex/gnunet-regex-profiler.c:1477 msgid "Error loading search strings. Exiting.\n" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1563 +#: src/regex/gnunet-regex-profiler.c:1565 msgid "name of the file for writing statistics" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1570 +#: src/regex/gnunet-regex-profiler.c:1572 msgid "wait TIMEOUT before ending the experiment" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1576 +#: src/regex/gnunet-regex-profiler.c:1578 msgid "directory with policy files" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1584 +#: src/regex/gnunet-regex-profiler.c:1586 msgid "name of file with input strings" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1591 +#: src/regex/gnunet-regex-profiler.c:1593 msgid "name of file with hosts' names" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1604 +#: src/regex/gnunet-regex-profiler.c:1606 msgid "Profiler for regex" msgstr "" @@ -5878,11 +5925,11 @@ msgstr "" msgid "Search string `%s' is too long!\n" msgstr "" -#: src/rest/gnunet-rest-server.c:1266 +#: src/rest/gnunet-rest-server.c:1267 msgid "GNUnet REST server" msgstr "" -#: src/rest/plugin_rest_config.c:427 +#: src/rest/plugin_rest_config.c:428 msgid "CONFIG REST API initialized\n" msgstr "" @@ -5945,70 +5992,75 @@ msgstr "" msgid "Ego `%s' not found.\n" msgstr "" -#: src/revocation/gnunet-revocation.c:351 +#: src/revocation/gnunet-revocation.c:350 +#, c-format +msgid "Error: Key is invalid\n" +msgstr "" + +#: src/revocation/gnunet-revocation.c:357 #, c-format msgid "Error: revocation certificate in `%s' is not for `%s'\n" msgstr "" -#: src/revocation/gnunet-revocation.c:361 +#: src/revocation/gnunet-revocation.c:367 msgid "Revocation certificate ready\n" msgstr "" -#: src/revocation/gnunet-revocation.c:373 +#: src/revocation/gnunet-revocation.c:379 msgid "Continuing calculation where left off...\n" msgstr "" -#: src/revocation/gnunet-revocation.c:380 +#: src/revocation/gnunet-revocation.c:386 msgid "Revocation certificate not ready, calculating proof of work\n" msgstr "" -#: src/revocation/gnunet-revocation.c:418 +#: src/revocation/gnunet-revocation.c:424 #, c-format msgid "Public key `%s' malformed\n" msgstr "" -#: src/revocation/gnunet-revocation.c:428 +#: src/revocation/gnunet-revocation.c:434 msgid "" "Testing and revoking at the same time is not allowed, only executing test.\n" msgstr "" -#: src/revocation/gnunet-revocation.c:458 +#: src/revocation/gnunet-revocation.c:464 msgid "No filename to store revocation certificate given.\n" msgstr "" -#: src/revocation/gnunet-revocation.c:475 +#: src/revocation/gnunet-revocation.c:481 #, c-format msgid "Failed to read revocation certificate from `%s'\n" msgstr "" -#: src/revocation/gnunet-revocation.c:483 +#: src/revocation/gnunet-revocation.c:489 #, fuzzy, c-format msgid "Revocation certificate corrupted in `%s'\n" msgstr "Generazione statistiche fallita\n" -#: src/revocation/gnunet-revocation.c:505 +#: src/revocation/gnunet-revocation.c:511 msgid "No action specified. Nothing to do.\n" msgstr "" -#: src/revocation/gnunet-revocation.c:524 +#: src/revocation/gnunet-revocation.c:530 msgid "use NAME for the name of the revocation file" msgstr "" -#: src/revocation/gnunet-revocation.c:532 +#: src/revocation/gnunet-revocation.c:538 msgid "" "revoke the private key associated for the the private key associated with " "the ego NAME " msgstr "" -#: src/revocation/gnunet-revocation.c:539 +#: src/revocation/gnunet-revocation.c:545 msgid "actually perform revocation, otherwise we just do the precomputation" msgstr "" -#: src/revocation/gnunet-revocation.c:546 +#: src/revocation/gnunet-revocation.c:552 msgid "test if the public key KEY has been revoked" msgstr "" -#: src/revocation/gnunet-revocation.c:552 +#: src/revocation/gnunet-revocation.c:558 msgid "number of epochs to calculate for" msgstr "" @@ -6127,11 +6179,11 @@ msgstr "" #: src/scalarproduct/gnunet-service-scalarproduct_alice.c:1358 #: src/scalarproduct/gnunet-service-scalarproduct_bob.c:1355 #: src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c:1118 -#: src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c:1063 +#: src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c:1034 msgid "Connect to CADET failed\n" msgstr "" -#: src/scalarproduct/scalarproduct_api.c:189 +#: src/scalarproduct/scalarproduct_api.c:184 msgid "Keys given to SCALARPRODUCT not unique!\n" msgstr "" @@ -6152,7 +6204,7 @@ msgid "also profile decryption" msgstr "" #: src/set/gnunet-service-set.c:1916 src/seti/gnunet-service-seti.c:2467 -#: src/setu/gnunet-service-setu.c:3832 +#: src/setu/gnunet-service-setu.c:5395 #, fuzzy msgid "Could not connect to CADET service\n" msgstr "Impossibile avviare il servizio.\n" @@ -6392,7 +6444,7 @@ msgid "" "\t cap: the maximum number of links a node can have\n" "\t m: the number of links a node should have while joining the network\n" "\t filename: the path of the file which contains topology information\n" -"NOTE: the format of the above file is descibed here: https://www.gnunet.org/" +"NOTE: the format of the above file is described here: https://www.gnunet.org/" "content/topology-file-format\n" msgstr "" @@ -6487,7 +6539,7 @@ msgid "Spawning process `%s'\n" msgstr "" #: src/testbed/gnunet-testbed-profiler.c:290 -msgid "tolerate COUNT number of continious timeout failures" +msgid "tolerate COUNT number of continuous timeout failures" msgstr "" #: src/testbed/gnunet-testbed-profiler.c:295 @@ -6784,14 +6836,14 @@ msgstr "" msgid "GNUnet topology control" msgstr "" -#: src/transport/gnunet-communicator-tcp.c:3331 +#: src/transport/gnunet-communicator-tcp.c:3314 #: src/transport/gnunet-communicator-udp.c:3790 -#: src/transport/gnunet-service-tng.c:10220 +#: src/transport/gnunet-service-tng.c:10223 #: src/transport/gnunet-service-transport.c:2627 msgid "Transport service is lacking key configuration settings. Exiting.\n" msgstr "" -#: src/transport/gnunet-communicator-tcp.c:3668 +#: src/transport/gnunet-communicator-tcp.c:3652 msgid "GNUnet TCP communicator" msgstr "" @@ -7839,7 +7891,7 @@ msgstr "" msgid "Service process failed to report status\n" msgstr "" -#: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1040 +#: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1220 #: src/util/service.c:1637 #, c-format msgid "Cannot obtain information about user `%s': %s\n" @@ -7957,39 +8009,15 @@ msgstr "" msgid "Failed to serialize metadata `%s'" msgstr "Impossibile avviare il servizio ' %s'\n" -#: src/util/client.c:747 src/util/client.c:937 +#: src/util/client.c:747 src/util/client.c:938 msgid "not a valid filename" msgstr "" -#: src/util/client.c:1103 +#: src/util/client.c:1104 #, c-format msgid "Need a non-empty hostname for service `%s'.\n" msgstr "" -#: src/util/common_logging.c:259 src/util/common_logging.c:1114 -msgid "DEBUG" -msgstr "DEBUG" - -#: src/util/common_logging.c:261 src/util/common_logging.c:1112 -msgid "INFO" -msgstr "INFO" - -#: src/util/common_logging.c:263 src/util/common_logging.c:1110 -msgid "MESSAGE" -msgstr "" - -#: src/util/common_logging.c:265 src/util/common_logging.c:1108 -msgid "WARNING" -msgstr "ATTENZIONE" - -#: src/util/common_logging.c:267 src/util/common_logging.c:1106 -msgid "ERROR" -msgstr "ERRORE" - -#: src/util/common_logging.c:269 src/util/common_logging.c:1116 -msgid "NONE" -msgstr "NESSUNA" - #: src/util/common_logging.c:626 src/util/common_logging.c:665 #, c-format msgid "ERROR: Unable to parse log definition: Syntax error at `%s'.\n" @@ -8000,6 +8028,30 @@ msgstr "" msgid "Message `%.*s' repeated %u times in the last %s\n" msgstr "" +#: src/util/common_logging.c:1106 +msgid "ERROR" +msgstr "ERRORE" + +#: src/util/common_logging.c:1108 +msgid "WARNING" +msgstr "ATTENZIONE" + +#: src/util/common_logging.c:1110 +msgid "MESSAGE" +msgstr "" + +#: src/util/common_logging.c:1112 +msgid "INFO" +msgstr "INFO" + +#: src/util/common_logging.c:1114 +msgid "DEBUG" +msgstr "DEBUG" + +#: src/util/common_logging.c:1116 +msgid "NONE" +msgstr "NESSUNA" + #: src/util/common_logging.c:1117 msgid "INVALID" msgstr "NON VALIDO" @@ -8023,38 +8075,68 @@ msgid "" "Configuration specifies invalid value for option `%s' in section `%s': %s\n" msgstr "" -#: src/util/configuration.c:370 +#: src/util/configuration.c:790 +#, c-format +msgid "Illegal directive in line %u (parsing restricted section %s)\n" +msgstr "" + +#: src/util/configuration.c:800 +#, c-format +msgid "Bad directive in line %u\n" +msgstr "" + +#: src/util/configuration.c:853 +#, c-format +msgid "Bad inline-secret directive in line %u\n" +msgstr "" + +#: src/util/configuration.c:875 +#, c-format +msgid "Unknown or malformed directive '%s' in line %u\n" +msgstr "" + +#: src/util/configuration.c:905 +#, c-format +msgid "Syntax error while deserializing in line %u (option without section)\n" +msgstr "" + +#: src/util/configuration.c:949 #, c-format msgid "Syntax error while deserializing in line %u\n" msgstr "" -#: src/util/configuration.c:420 +#: src/util/configuration.c:1049 #, c-format msgid "Error while reading file `%s'\n" msgstr "Errore di lettura del file `%s'\n" -#: src/util/configuration.c:980 +#: src/util/configuration.c:1062 +#, fuzzy, c-format +msgid "Failed to parse configuration file `%s'\n" +msgstr "Impossibile avviare il servizio ' %s'\n" + +#: src/util/configuration.c:1695 msgid "Not a valid relative time specification" msgstr "" -#: src/util/configuration.c:1050 +#: src/util/configuration.c:1765 #, c-format msgid "" "Configuration value '%s' for '%s' in section '%s' is not in set of legal " "choices\n" msgstr "" -#: src/util/configuration.c:1145 +#: src/util/configuration.c:1860 #, c-format msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n" msgstr "" -#: src/util/configuration.c:1177 +#: src/util/configuration.c:1892 #, c-format msgid "Missing closing `%s' in option `%s'\n" msgstr "" -#: src/util/configuration.c:1243 +#: src/util/configuration.c:1958 #, c-format msgid "" "Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined " @@ -8097,7 +8179,7 @@ msgstr "" msgid "RSA signature verification failed at %s:%d: %s\n" msgstr "" -#: src/util/disk.c:823 +#: src/util/disk.c:843 #, c-format msgid "Expected `%s' to be a directory!\n" msgstr "" @@ -8277,59 +8359,67 @@ msgstr "" msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" msgstr "" -#: src/util/gnunet-base32.c:45 +#: src/util/gnunet-base32.c:46 msgid "run decoder modus, otherwise runs as encoder" msgstr "" -#: src/util/gnunet-config.c:167 +#: src/util/gnunet-config.c:187 #, c-format -msgid "failed to load configuration defaults" +msgid "The following sections are available:\n" msgstr "" -#: src/util/gnunet-config.c:179 +#: src/util/gnunet-config.c:201 #, c-format -msgid "%s or %s argument is required\n" +msgid "%s, %s or %s argument is required\n" msgstr "" -#: src/util/gnunet-config.c:186 +#: src/util/gnunet-config.c:266 #, c-format -msgid "The following sections are available:\n" +msgid "--option argument required to set value\n" msgstr "" -#: src/util/gnunet-config.c:234 +#: src/util/gnunet-config.c:309 #, c-format -msgid "--option argument required to set value\n" +msgid "failed to load configuration defaults" msgstr "" -#: src/util/gnunet-config.c:284 -msgid "interpret option value as a filename (with $-expansion)" +#: src/util/gnunet-config.c:354 +msgid "test if the current installation supports the specified BACKEND" msgstr "" -#: src/util/gnunet-config.c:291 -msgid "test if the current installation supports the specified BACKEND" +#: src/util/gnunet-config.c:360 +msgid "write the full configuration file, including default values" msgstr "" -#: src/util/gnunet-config.c:297 -msgid "name of the section to access" +#: src/util/gnunet-config.c:365 +msgid "interpret option value as a filename (with $-expansion)" msgstr "" -#: src/util/gnunet-config.c:302 +#: src/util/gnunet-config.c:370 msgid "name of the option to access" msgstr "" -#: src/util/gnunet-config.c:307 -msgid "value to set" +#: src/util/gnunet-config.c:376 +msgid "rewrite the configuration file, even if nothing changed" msgstr "" -#: src/util/gnunet-config.c:312 +#: src/util/gnunet-config.c:382 +msgid "output extra diagnostics" +msgstr "" + +#: src/util/gnunet-config.c:387 msgid "print available configuration sections" msgstr "" -#: src/util/gnunet-config.c:318 -msgid "write configuration file that only contains delta to defaults" +#: src/util/gnunet-config.c:393 +msgid "name of the section to access" msgstr "" -#: src/util/gnunet-config.c:330 +#: src/util/gnunet-config.c:398 +msgid "value to set" +msgstr "" + +#: src/util/gnunet-config.c:413 msgid "Manipulate GNUnet configuration files" msgstr "" @@ -8557,21 +8647,21 @@ msgstr "" msgid "`%s' failed for library `%s' with error: %s\n" msgstr "" -#: src/util/plugin.c:409 +#: src/util/plugin.c:414 msgid "Could not determine plugin installation path.\n" msgstr "" -#: src/util/program.c:259 +#: src/util/program.c:252 #, c-format msgid "Unreadable or malformed configuration file `%s', exit ...\n" msgstr "" -#: src/util/program.c:276 +#: src/util/program.c:272 #, c-format msgid "Unreadable or malformed default configuration file `%s', exit ...\n" msgstr "" -#: src/util/program.c:291 +#: src/util/program.c:288 msgid "Unreadable or malformed configuration, exit ...\n" msgstr "" @@ -8635,82 +8725,82 @@ msgstr "" msgid "Attempting to proxy service `%s' to invalid port %d or hostname.\n" msgstr "" -#: src/util/strings.c:503 +#: src/util/strings.c:409 #, c-format msgid "Character sets requested were `%s'->`%s'\n" msgstr "" -#: src/util/strings.c:637 +#: src/util/strings.c:501 msgid "Failed to expand `$HOME': environment variable `HOME' not set" msgstr "" -#: src/util/strings.c:1241 +#: src/util/strings.c:1036 msgid "IPv6 address did not start with `['\n" msgstr "" -#: src/util/strings.c:1249 +#: src/util/strings.c:1044 msgid "IPv6 address did contain ':' to separate port number\n" msgstr "" -#: src/util/strings.c:1256 +#: src/util/strings.c:1051 msgid "IPv6 address did contain ']' before ':' to separate port number\n" msgstr "" -#: src/util/strings.c:1264 +#: src/util/strings.c:1059 msgid "IPv6 address did contain a valid port number after the last ':'\n" msgstr "" -#: src/util/strings.c:1273 +#: src/util/strings.c:1068 #, c-format msgid "Invalid IPv6 address `%s': %s\n" msgstr "" -#: src/util/strings.c:1500 src/util/strings.c:1511 +#: src/util/strings.c:1250 src/util/strings.c:1261 msgid "Port not in range\n" msgstr "" -#: src/util/strings.c:1520 +#: src/util/strings.c:1270 #, c-format msgid "Malformed port policy `%s'\n" msgstr "" -#: src/util/strings.c:1603 src/util/strings.c:1632 src/util/strings.c:1679 -#: src/util/strings.c:1699 +#: src/util/strings.c:1341 src/util/strings.c:1370 src/util/strings.c:1417 +#: src/util/strings.c:1437 #, c-format msgid "Invalid format for IP: `%s'\n" msgstr "" -#: src/util/strings.c:1657 +#: src/util/strings.c:1395 #, c-format msgid "Invalid network notation ('/%d' is not legal in IPv4 CIDR)." msgstr "" -#: src/util/strings.c:1708 +#: src/util/strings.c:1446 #, c-format msgid "Invalid format: `%s'\n" msgstr "" -#: src/util/strings.c:1761 +#: src/util/strings.c:1488 #, c-format msgid "Invalid network notation (does not end with ';': `%s')\n" msgstr "" -#: src/util/strings.c:1811 +#: src/util/strings.c:1538 #, c-format msgid "Wrong format `%s' for netmask\n" msgstr "" -#: src/util/strings.c:1842 +#: src/util/strings.c:1569 #, c-format msgid "Wrong format `%s' for network\n" msgstr "" -#: src/util/time.c:878 src/util/time.c:906 +#: src/util/time.c:699 src/util/time.c:727 #, c-format msgid "Failed to map `%s', cannot assure monotonic time!\n" msgstr "" -#: src/util/time.c:914 +#: src/util/time.c:735 #, c-format msgid "" "Failed to setup monotonic time file `%s', cannot assure monotonic time!\n" @@ -8963,9 +9053,6 @@ msgstr "" #~ msgid "Connected to peer %s\n" #~ msgstr "Connessione stabilita con `%s'\n" -#~ msgid "unknown error" -#~ msgstr "errore sconosciuto" - #, fuzzy #~| msgid "`%s' is not a valid IP address.\n" #~ msgid "`%s' is not a valid IP address! Ignoring BINDTOIP.\n" diff --git a/po/sr.po b/po/sr.po index 8faa07402..78a7fd1d1 100644 --- a/po/sr.po +++ b/po/sr.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: gnunet-0.10.1\n" "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" -"POT-Creation-Date: 2021-04-04 19:19+0200\n" +"POT-Creation-Date: 2021-08-08 18:36+0200\n" "PO-Revision-Date: 2020-10-23 18:39+0200\n" "Last-Translator: Мирослав Николић \n" "Language-Team: Serbian <(nothing)>\n" @@ -30,7 +30,7 @@ msgstr "Јавни кључ „%s“ није добро оформљен\n" #: src/abd/gnunet-abd.c:560 src/abd/gnunet-service-abd.c:1747 #: src/namestore/gnunet-namestore.c:1001 -#: src/namestore/gnunet-namestore-fcfsd.c:1164 +#: src/namestore/gnunet-namestore-fcfsd.c:1067 #, c-format msgid "Failed to connect to namestore\n" msgstr "Нисам успео да се повежем са смештајем назива\n" @@ -775,7 +775,7 @@ msgstr "" #: src/auction/gnunet-auction-info.c:77 src/auction/gnunet-auction-join.c:77 #: src/conversation/gnunet-conversation-test.c:256 -#: src/revocation/gnunet-revocation.c:564 src/template/gnunet-template.c:75 +#: src/revocation/gnunet-revocation.c:570 src/template/gnunet-template.c:75 msgid "help text" msgstr "текст помоћи" @@ -1152,10 +1152,10 @@ msgstr "" "Крај преноса. Нека вам је ГНУ дан.\n" #: src/conversation/gnunet-conversation-test.c:146 -#, c-format +#, fuzzy, c-format msgid "" "\n" -"We are now playing your recording back. If you can hear it, your audio " +"ew are now playing your recording back. If you can hear it, your audio " "settings are working..." msgstr "" "\n" @@ -1587,39 +1587,39 @@ msgstr "# мапе врсте су примљене" msgid "# updates to my type map" msgstr "# ажурирања за моју мапу врсте" -#: src/datacache/datacache.c:115 src/datacache/datacache.c:287 +#: src/datacache/datacache.c:115 src/datacache/datacache.c:299 #: src/datastore/gnunet-service-datastore.c:742 msgid "# bytes stored" msgstr "# бајтови су смештени" -#: src/datacache/datacache.c:119 src/datacache/datacache.c:291 +#: src/datacache/datacache.c:119 src/datacache/datacache.c:303 msgid "# items stored" msgstr "# ставке су смештене" -#: src/datacache/datacache.c:189 +#: src/datacache/datacache.c:190 #, c-format msgid "Loading `%s' datacache plugin\n" msgstr "Учитавам прикључак „%s“ оставе података\n" -#: src/datacache/datacache.c:197 +#: src/datacache/datacache.c:208 #, c-format msgid "Failed to load datacache plugin for `%s'\n" msgstr "Нисам успео да учитам прикључак оставе података за „%s“\n" -#: src/datacache/datacache.c:320 +#: src/datacache/datacache.c:332 msgid "# requests received" msgstr "# захтеви су примљени" -#: src/datacache/datacache.c:331 +#: src/datacache/datacache.c:343 msgid "# requests filtered by bloom filter" msgstr "# захтеви су филтрирани блум филтером" -#: src/datacache/datacache.c:358 +#: src/datacache/datacache.c:370 #, fuzzy msgid "# requests for random value received" msgstr "# захтеви су примљени" -#: src/datacache/datacache.c:388 +#: src/datacache/datacache.c:400 #, fuzzy msgid "# proximity search requests received" msgstr "# претраге клијента су примљене" @@ -1965,7 +1965,7 @@ msgstr "База података Мајскула ради\n" #: src/datastore/plugin_datastore_postgres.c:284 #: src/datastore/plugin_datastore_postgres.c:897 -msgid "Postgress exec failure" +msgid "Postgresql exec failure" msgstr "" #: src/datastore/plugin_datastore_postgres.c:858 @@ -2000,7 +2000,18 @@ msgstr "" msgid "sqlite version to old to determine size, assuming zero\n" msgstr "скулајт издање је престаро за одређивање величине, подразумевам нулу\n" -#: src/datastore/plugin_datastore_sqlite.c:1274 +#: src/datastore/plugin_datastore_sqlite.c:1266 +#: src/datastore/plugin_datastore_sqlite.c:1279 +#, fuzzy +msgid "error preparing statement\n" +msgstr "Нисам успео да припремим стање „%s“\n" + +#: src/datastore/plugin_datastore_sqlite.c:1287 +#, fuzzy +msgid "error stepping\n" +msgstr "„%s“ се зауставља" + +#: src/datastore/plugin_datastore_sqlite.c:1295 #, c-format msgid "" "Using sqlite page utilization to estimate payload (%llu pages of size %llu " @@ -2009,7 +2020,7 @@ msgstr "" "Користим страницу коришћења скулајта да проценим утовар (%llu странице " "величине %llu бајта)\n" -#: src/datastore/plugin_datastore_sqlite.c:1316 +#: src/datastore/plugin_datastore_sqlite.c:1337 #: src/namecache/plugin_namecache_sqlite.c:564 #: src/namestore/plugin_namestore_sqlite.c:765 msgid "Sqlite database running\n" @@ -2261,89 +2272,89 @@ msgstr "# НАЂИ ПАРЊАКА поруке су покренуте" msgid "# requests TTL-dropped" msgstr "# захтеви ТТЛ су одбачени" -#: src/dht/gnunet-service-dht_neighbours.c:1052 -#: src/dht/gnunet-service-dht_neighbours.c:1096 +#: src/dht/gnunet-service-dht_neighbours.c:1035 +#: src/dht/gnunet-service-dht_neighbours.c:1072 msgid "# Peers excluded from routing due to Bloomfilter" msgstr "# Парњаци су изузети из рутирања због Блумфилтера" -#: src/dht/gnunet-service-dht_neighbours.c:1069 -#: src/dht/gnunet-service-dht_neighbours.c:1112 +#: src/dht/gnunet-service-dht_neighbours.c:1045 +#: src/dht/gnunet-service-dht_neighbours.c:1088 msgid "# Peer selection failed" msgstr "# Бирање парњака није успело" -#: src/dht/gnunet-service-dht_neighbours.c:1270 +#: src/dht/gnunet-service-dht_neighbours.c:1246 msgid "# PUT requests routed" msgstr "# захтеви СТАВИ су рутирани" -#: src/dht/gnunet-service-dht_neighbours.c:1304 +#: src/dht/gnunet-service-dht_neighbours.c:1280 msgid "# PUT messages queued for transmission" msgstr "# СТАВИ поруке су у реду за пренос" -#: src/dht/gnunet-service-dht_neighbours.c:1316 -#: src/dht/gnunet-service-dht_neighbours.c:1458 -#: src/dht/gnunet-service-dht_neighbours.c:1562 +#: src/dht/gnunet-service-dht_neighbours.c:1292 +#: src/dht/gnunet-service-dht_neighbours.c:1434 +#: src/dht/gnunet-service-dht_neighbours.c:1538 msgid "# P2P messages dropped due to full queue" msgstr "# П2П поруке су одбачене због пуног реда" -#: src/dht/gnunet-service-dht_neighbours.c:1401 +#: src/dht/gnunet-service-dht_neighbours.c:1377 msgid "# GET requests routed" msgstr "# захтеви ДОБАВИ су рутирани" -#: src/dht/gnunet-service-dht_neighbours.c:1445 +#: src/dht/gnunet-service-dht_neighbours.c:1421 msgid "# GET messages queued for transmission" msgstr "# ДОБАВИ поруке су у реду за пренос" -#: src/dht/gnunet-service-dht_neighbours.c:1577 +#: src/dht/gnunet-service-dht_neighbours.c:1553 msgid "# RESULT messages queued for transmission" msgstr "# РЕЗУЛТАТ поруке су у реду за пренос" -#: src/dht/gnunet-service-dht_neighbours.c:1680 +#: src/dht/gnunet-service-dht_neighbours.c:1656 #, fuzzy msgid "# Expired PUTs discarded" msgstr "# небитни одговори су одбачени" -#: src/dht/gnunet-service-dht_neighbours.c:1688 +#: src/dht/gnunet-service-dht_neighbours.c:1664 msgid "# P2P PUT requests received" msgstr "# захтеви П2П СТАВИ су примљени" -#: src/dht/gnunet-service-dht_neighbours.c:1692 +#: src/dht/gnunet-service-dht_neighbours.c:1668 msgid "# P2P PUT bytes received" msgstr "# бајтови П2П СТАВИ су примљени" -#: src/dht/gnunet-service-dht_neighbours.c:1924 +#: src/dht/gnunet-service-dht_neighbours.c:1900 msgid "# FIND PEER requests ignored due to Bloomfilter" msgstr "# захтеви НАЂИ ПАРЊАКА су занемарени због Блумфилтера" -#: src/dht/gnunet-service-dht_neighbours.c:1933 +#: src/dht/gnunet-service-dht_neighbours.c:1909 msgid "# FIND PEER requests ignored due to lack of HELLO" msgstr "# захтеви НАЂИ ПАРЊАКА су занемарени због недостатка „HELLO“-а" -#: src/dht/gnunet-service-dht_neighbours.c:2096 +#: src/dht/gnunet-service-dht_neighbours.c:2072 msgid "# P2P GET requests received" msgstr "# захтеви П2П ДОБАВИ су примљени" -#: src/dht/gnunet-service-dht_neighbours.c:2100 +#: src/dht/gnunet-service-dht_neighbours.c:2076 msgid "# P2P GET bytes received" msgstr "# бајтови П2П ДОБАВИ су примљени" -#: src/dht/gnunet-service-dht_neighbours.c:2166 +#: src/dht/gnunet-service-dht_neighbours.c:2142 msgid "# P2P FIND PEER requests processed" msgstr "# захтеви П2П НАЂИ ПАРЊАКА су обрађени" -#: src/dht/gnunet-service-dht_neighbours.c:2187 +#: src/dht/gnunet-service-dht_neighbours.c:2163 msgid "# P2P GET requests ONLY routed" msgstr "# захтеви П2П ДОБАВИ су САМО рутирани" -#: src/dht/gnunet-service-dht_neighbours.c:2365 +#: src/dht/gnunet-service-dht_neighbours.c:2341 #, fuzzy msgid "# Expired results discarded" msgstr "# небитни одговори су одбачени" -#: src/dht/gnunet-service-dht_neighbours.c:2382 +#: src/dht/gnunet-service-dht_neighbours.c:2358 msgid "# P2P RESULTS received" msgstr "# П2П РЕЗУЛТАТИ су примљени" -#: src/dht/gnunet-service-dht_neighbours.c:2386 +#: src/dht/gnunet-service-dht_neighbours.c:2362 msgid "# P2P RESULT bytes received" msgstr "# бајтови П2П РЕЗУЛТАТ су примљени" @@ -2825,7 +2836,7 @@ msgstr "Директоријум је превелик за простор ад #: src/fs/fs_download.c:346 #, fuzzy, c-format msgid "" -"Failed to access full directroy contents of `%s' for recursive download\n" +"Failed to access full directory contents of `%s' for recursive download\n" msgstr "Нисам успео да направим директоријум за дубинско преузимање „%s“\n" #: src/fs/fs_download.c:528 src/fs/fs_download.c:541 @@ -4098,7 +4109,7 @@ msgstr "" msgid "GNUnet GNS resolver tool" msgstr "Алат ГНУнет ГНС решавача" -#: src/gns/gnunet-gns-import.c:491 +#: src/gns/gnunet-gns-import.c:490 msgid "This program will import some GNS authorities into your GNS namestore." msgstr "Овај програм ће увести неке ГНС ауторитете у ваш ГНС смештај назива." @@ -4786,35 +4797,35 @@ msgstr "Нисам успео да направим его: %s\n" msgid "Failed to set default ego: %s\n" msgstr "Нисам успео да поставим основни его: %s\n" -#: src/identity/gnunet-identity.c:462 +#: src/identity/gnunet-identity.c:461 msgid "create ego NAME" msgstr "ствара НАЗИВ ега" -#: src/identity/gnunet-identity.c:467 +#: src/identity/gnunet-identity.c:466 msgid "delete ego NAME " msgstr "брише НАЗИВ ега " -#: src/identity/gnunet-identity.c:473 +#: src/identity/gnunet-identity.c:472 msgid "" "set the private key for the identity to PRIVATE_KEY (use together with -C)" msgstr "" -#: src/identity/gnunet-identity.c:478 +#: src/identity/gnunet-identity.c:477 msgid "generate an EdDSA identity. (use together with -C) EXPERIMENTAL" msgstr "" # # File: util/dialtest.c++, line: 134 -#: src/identity/gnunet-identity.c:482 +#: src/identity/gnunet-identity.c:481 msgid "display all egos" msgstr "приказује све егое" -#: src/identity/gnunet-identity.c:486 +#: src/identity/gnunet-identity.c:485 #, fuzzy msgid "reduce output" msgstr "опширан излаз" -#: src/identity/gnunet-identity.c:493 +#: src/identity/gnunet-identity.c:492 #, fuzzy msgid "" "set default identity to NAME for a subsystem SUBSYSTEM (use together with -" @@ -4823,22 +4834,22 @@ msgstr "" "поставља основни идентитет на ЕГО за подсистем ПОДСИСТЕМ (користите заједно " "са -s)" -#: src/identity/gnunet-identity.c:497 +#: src/identity/gnunet-identity.c:496 msgid "run in monitor mode egos" msgstr "ради у режиму праћења егоа" -#: src/identity/gnunet-identity.c:501 +#: src/identity/gnunet-identity.c:500 msgid "display private keys as well" msgstr "" -#: src/identity/gnunet-identity.c:508 +#: src/identity/gnunet-identity.c:507 msgid "" "set default identity to EGO for a subsystem SUBSYSTEM (use together with -e)" msgstr "" "поставља основни идентитет на ЕГО за подсистем ПОДСИСТЕМ (користите заједно " "са -e)" -#: src/identity/gnunet-identity.c:523 +#: src/identity/gnunet-identity.c:522 msgid "Maintain egos" msgstr "Одржава егое" @@ -4894,7 +4905,7 @@ msgstr "Нисам успео да направим директоријум „ msgid "Identity REST API initialized\n" msgstr "" -#: src/json/json.c:139 +#: src/json/json.c:119 #, fuzzy, c-format msgid "Failed to parse JSON in option `%s': %s (%s)\n" msgstr "Нисам успео да обрадим „HELLO“ у датотеци „%s“: %s\n" @@ -5234,71 +5245,111 @@ msgstr "" msgid "name of the ego controlling the zone" msgstr "назив егоа који контролише зону" -#: src/namestore/gnunet-namestore-fcfsd.c:552 -#, c-format -msgid "Unsupported form value `%s'\n" -msgstr "Неподржана вредност облика „%s“\n" +#: src/namestore/gnunet-namestore-fcfsd.c:359 +#, fuzzy +msgid "can not search the namestore" +msgstr "Не могу да покренем главног контролора" -#: src/namestore/gnunet-namestore-fcfsd.c:579 -#, c-format -msgid "Failed to create record for domain `%s': %s\n" +#: src/namestore/gnunet-namestore-fcfsd.c:413 +#: src/namestore/gnunet-namestore-fcfsd.c:554 +#, fuzzy +msgid "unable to scan namestore" +msgstr "Нисам успео да се повежем са смештајем назива\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:441 +#, fuzzy, c-format +msgid "Failed to create record for `%s': %s\n" msgstr "Нисам успео да направим запис за домен „%s“: %s\n" -#: src/namestore/gnunet-namestore-fcfsd.c:600 -msgid "Error when mapping zone to name\n" -msgstr "Грешка приликом мапирања зоне у назив\n" +#: src/namestore/gnunet-namestore-fcfsd.c:453 +#, fuzzy +msgid "no errors" +msgstr "непозната грешка" -#: src/namestore/gnunet-namestore-fcfsd.c:633 -#, c-format -msgid "Found existing name `%s' for the given key\n" -msgstr "Нађох постојећи назив „%s“ за дати кључ\n" +#: src/namestore/gnunet-namestore-fcfsd.c:489 +#, fuzzy, c-format +msgid "The requested key `%s' exists as `%s'\n" +msgstr "Скупови знакова се захтевају где је „%s“–>„%s“\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:496 +msgid "key exists" +msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:646 +#: src/namestore/gnunet-namestore-fcfsd.c:513 #, fuzzy -msgid "Error creating record data.\n" +msgid "Error creating record data\n" msgstr "Грешка стварања тунела\n" -#: src/namestore/gnunet-namestore-fcfsd.c:707 -#, c-format -msgid "Found %u existing records for domain `%s'\n" -msgstr "Нађох %u постојећа записа за домен „%s“\n" +#: src/namestore/gnunet-namestore-fcfsd.c:517 +#, fuzzy +msgid "unable to store record" +msgstr "Смештај назива није успео да смести запис\n" -#: src/namestore/gnunet-namestore-fcfsd.c:796 +#: src/namestore/gnunet-namestore-fcfsd.c:588 #, c-format -msgid "Failed to create page for `%s'\n" -msgstr "Нисам успео да направим страницу за „%s“\n" +msgid "Requested name `%s' exists with `%u' records\n" +msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:815 -#, c-format -msgid "Failed to setup post processor for `%s'\n" -msgstr "Нисам успео да поставим постпроцесор за „%s“\n" +#: src/namestore/gnunet-namestore-fcfsd.c:594 +msgid "name exists\n" +msgstr "" + +#: src/namestore/gnunet-namestore-fcfsd.c:780 +msgid "unable to process submitted data" +msgstr "" + +#: src/namestore/gnunet-namestore-fcfsd.c:787 +msgid "the submitted data is invalid" +msgstr "" + +#: src/namestore/gnunet-namestore-fcfsd.c:806 +#, fuzzy +msgid "invalid parameters" +msgstr "Неисправан аргумент „%s“\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:823 +#, fuzzy +msgid "invalid name" +msgstr "Неисправан аргумент „%s“\n" -#: src/namestore/gnunet-namestore-fcfsd.c:850 -msgid "Domain name must not contain `.'\n" -msgstr "Назив домена не сме да садржи „.“\n" +#: src/namestore/gnunet-namestore-fcfsd.c:834 +#, fuzzy, c-format +msgid "Unable to parse key %s\n" +msgstr "Не могу да обрадим „MX“ запис „%s“\n" -#: src/namestore/gnunet-namestore-fcfsd.c:859 -msgid "Domain name must not contain `+'\n" -msgstr "Назив домена не сме да садржи „+“\n" +#: src/namestore/gnunet-namestore-fcfsd.c:838 +#, fuzzy +msgid "unable to parse key" +msgstr "Не могу да обрадим „MX“ запис „%s“\n" -#: src/namestore/gnunet-namestore-fcfsd.c:1094 +#: src/namestore/gnunet-namestore-fcfsd.c:949 msgid "No ego configured for `fcfsd` subsystem\n" msgstr "Није подешен его за „fcfsd“ подсистем\n" -#: src/namestore/gnunet-namestore-fcfsd.c:1125 +#: src/namestore/gnunet-namestore-fcfsd.c:974 msgid "Failed to start HTTP server\n" msgstr "Нисам успео да покренем ХТТП сервер\n" -#: src/namestore/gnunet-namestore-fcfsd.c:1173 +#: src/namestore/gnunet-namestore-fcfsd.c:1058 +msgid "No port specified, using default value\n" +msgstr "" + +#: src/namestore/gnunet-namestore-fcfsd.c:1076 msgid "Failed to connect to identity\n" msgstr "Нисам успео да се повежем са идентитетом\n" -#: src/namestore/gnunet-namestore-fcfsd.c:1200 -msgid "name of the zone that is to be managed by FCFSD" +#: src/namestore/gnunet-namestore-fcfsd.c:1100 +#, fuzzy +msgid "Unable to set up the daemon\n" +msgstr "Не могу да увезем приватни кључ из датотеке „%s“\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:1123 +msgid "name of the zone managed by FCFSD" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:1220 -msgid "GNU Name System First Come First Serve name registration service" +#: src/namestore/gnunet-namestore-fcfsd.c:1132 +#, fuzzy +msgid "GNU Name System First-Come-First-Served name registration service" msgstr "Услуга регистрације назива Први Стиже Први Служи ГНУ Система Назива" #: src/namestore/gnunet-service-namestore.c:871 @@ -5306,11 +5357,11 @@ msgstr "Услуга регистрације назива Први Стиже msgid "Failed to replicate block in namecache: %s\n" msgstr "Нисам успео да реплицирам блок у остави назива: %s\n" -#: src/namestore/gnunet-zoneimport.c:1848 +#: src/namestore/gnunet-zoneimport.c:1847 msgid "size to use for the main hash map" msgstr "" -#: src/namestore/gnunet-zoneimport.c:1854 +#: src/namestore/gnunet-zoneimport.c:1853 msgid "minimum expiration time we assume for imported records" msgstr "" @@ -5333,7 +5384,7 @@ msgstr "" msgid "Flat file database running\n" msgstr "База података шаблона ради\n" -#: src/namestore/plugin_rest_namestore.c:1105 +#: src/namestore/plugin_rest_namestore.c:1111 #, fuzzy msgid "Namestore REST API initialized\n" msgstr "Меш је покренут\n" @@ -5997,11 +6048,11 @@ msgstr "" msgid "re:claimID command line tool" msgstr "" -#: src/reclaim/plugin_rest_openid_connect.c:2788 +#: src/reclaim/plugin_rest_openid_connect.c:2793 msgid "OpenID Connect REST API initialized\n" msgstr "" -#: src/reclaim/plugin_rest_reclaim.c:1521 +#: src/reclaim/plugin_rest_pabc.c:637 src/reclaim/plugin_rest_reclaim.c:1520 msgid "Identity Provider REST API initialized\n" msgstr "" @@ -6020,56 +6071,56 @@ msgstr "„%s“ услузи недостају поставке подешав msgid "Daemon to announce regular expressions for the peer using cadet." msgstr "Демон за најаву регуларних израза за парњака који користи меш." -#: src/regex/gnunet-regex-profiler.c:1390 +#: src/regex/gnunet-regex-profiler.c:1392 msgid "No configuration file given. Exiting\n" msgstr "Није дата датотека подешавања. Излазим\n" -#: src/regex/gnunet-regex-profiler.c:1432 +#: src/regex/gnunet-regex-profiler.c:1434 #: src/regex/gnunet-regex-simulation-profiler.c:631 #, c-format msgid "No policy directory specified on command line. Exiting.\n" msgstr "На линији наредби није наведен директоријум политике. Излазим.\n" -#: src/regex/gnunet-regex-profiler.c:1438 +#: src/regex/gnunet-regex-profiler.c:1440 #: src/regex/gnunet-regex-simulation-profiler.c:639 #, c-format msgid "Specified policies directory does not exist. Exiting.\n" msgstr "Наведени директоријум политике не постоји. Излазим.\n" -#: src/regex/gnunet-regex-profiler.c:1446 +#: src/regex/gnunet-regex-profiler.c:1448 #, c-format msgid "No files found in `%s'\n" msgstr "Нисам нашао датотеке у „%s“\n" -#: src/regex/gnunet-regex-profiler.c:1455 +#: src/regex/gnunet-regex-profiler.c:1457 msgid "No search strings file given. Exiting.\n" msgstr "Није дата датотека ниски претраге. Излазим.\n" -#: src/regex/gnunet-regex-profiler.c:1475 +#: src/regex/gnunet-regex-profiler.c:1477 msgid "Error loading search strings. Exiting.\n" msgstr "Грешка учитавања ниски претраге. Излазим.\n" -#: src/regex/gnunet-regex-profiler.c:1563 +#: src/regex/gnunet-regex-profiler.c:1565 msgid "name of the file for writing statistics" msgstr "назив датотеке за записивање статистике" -#: src/regex/gnunet-regex-profiler.c:1570 +#: src/regex/gnunet-regex-profiler.c:1572 msgid "wait TIMEOUT before ending the experiment" msgstr "чека ВРЕМЕ_ИСТЕКА пре завршавања експеримента" -#: src/regex/gnunet-regex-profiler.c:1576 +#: src/regex/gnunet-regex-profiler.c:1578 msgid "directory with policy files" msgstr "директоријум са датотекама политике" -#: src/regex/gnunet-regex-profiler.c:1584 +#: src/regex/gnunet-regex-profiler.c:1586 msgid "name of file with input strings" msgstr "назив датотеке са улазним нискама" -#: src/regex/gnunet-regex-profiler.c:1591 +#: src/regex/gnunet-regex-profiler.c:1593 msgid "name of file with hosts' names" msgstr "назив датотеке са називима домаћина" -#: src/regex/gnunet-regex-profiler.c:1604 +#: src/regex/gnunet-regex-profiler.c:1606 msgid "Profiler for regex" msgstr "Профилатор за регуларни израз" @@ -6095,12 +6146,12 @@ msgstr "Регуларни израз „%s“ је превелик!\n" msgid "Search string `%s' is too long!\n" msgstr "Регуларни израз „%s“ је превелик!\n" -#: src/rest/gnunet-rest-server.c:1266 +#: src/rest/gnunet-rest-server.c:1267 #, fuzzy msgid "GNUnet REST server" msgstr "Алат ГНУнет ГНС решавача" -#: src/rest/plugin_rest_config.c:427 +#: src/rest/plugin_rest_config.c:428 msgid "CONFIG REST API initialized\n" msgstr "" @@ -6163,72 +6214,77 @@ msgstr "Уверење опозива за „%s“ је смештено у „ msgid "Ego `%s' not found.\n" msgstr "Нисам нашао его „%s“.\n" -#: src/revocation/gnunet-revocation.c:351 +#: src/revocation/gnunet-revocation.c:350 +#, fuzzy, c-format +msgid "Error: Key is invalid\n" +msgstr "Кључ „%s“ је исправан\n" + +#: src/revocation/gnunet-revocation.c:357 #, c-format msgid "Error: revocation certificate in `%s' is not for `%s'\n" msgstr "Грешка: уверење опозива у „%s“ није за „%s“\n" -#: src/revocation/gnunet-revocation.c:361 +#: src/revocation/gnunet-revocation.c:367 msgid "Revocation certificate ready\n" msgstr "Уверење опозива је спремно\n" -#: src/revocation/gnunet-revocation.c:373 +#: src/revocation/gnunet-revocation.c:379 msgid "Continuing calculation where left off...\n" msgstr "" -#: src/revocation/gnunet-revocation.c:380 +#: src/revocation/gnunet-revocation.c:386 msgid "Revocation certificate not ready, calculating proof of work\n" msgstr "Уверење опозива није спремно, израчунавам доказ о раду\n" -#: src/revocation/gnunet-revocation.c:418 +#: src/revocation/gnunet-revocation.c:424 #, c-format msgid "Public key `%s' malformed\n" msgstr "Јавни кључ „%s“ је лош\n" -#: src/revocation/gnunet-revocation.c:428 +#: src/revocation/gnunet-revocation.c:434 msgid "" "Testing and revoking at the same time is not allowed, only executing test.\n" msgstr "" "Тестирање и опозивање у исто време није дозвољено, само тестирање " "извршавам.\n" -#: src/revocation/gnunet-revocation.c:458 +#: src/revocation/gnunet-revocation.c:464 msgid "No filename to store revocation certificate given.\n" msgstr "Није дат назив датотеке за смештање уверења опозива.\n" -#: src/revocation/gnunet-revocation.c:475 +#: src/revocation/gnunet-revocation.c:481 #, c-format msgid "Failed to read revocation certificate from `%s'\n" msgstr "Нисам успео да прочитам уверење опозива из „%s“\n" -#: src/revocation/gnunet-revocation.c:483 +#: src/revocation/gnunet-revocation.c:489 #, fuzzy, c-format msgid "Revocation certificate corrupted in `%s'\n" msgstr "Уверење опозива за „%s“ је смештено у „%s“\n" -#: src/revocation/gnunet-revocation.c:505 +#: src/revocation/gnunet-revocation.c:511 msgid "No action specified. Nothing to do.\n" msgstr "Није наведена ниједна радња. Немам шта да радим.\n" -#: src/revocation/gnunet-revocation.c:524 +#: src/revocation/gnunet-revocation.c:530 msgid "use NAME for the name of the revocation file" msgstr "користи НАЗИВ за назив датотеке опозивања" -#: src/revocation/gnunet-revocation.c:532 +#: src/revocation/gnunet-revocation.c:538 msgid "" "revoke the private key associated for the the private key associated with " "the ego NAME " msgstr "опозива лични кључ придружен личном кључу са его НАЗИВОМ " -#: src/revocation/gnunet-revocation.c:539 +#: src/revocation/gnunet-revocation.c:545 msgid "actually perform revocation, otherwise we just do the precomputation" msgstr "заправо обавља опозив, у супротном само радимо предизрачунавање" -#: src/revocation/gnunet-revocation.c:546 +#: src/revocation/gnunet-revocation.c:552 msgid "test if the public key KEY has been revoked" msgstr "тестира да ли је јавни кључ КЉУЧ опозван" -#: src/revocation/gnunet-revocation.c:552 +#: src/revocation/gnunet-revocation.c:558 msgid "number of epochs to calculate for" msgstr "" @@ -6362,12 +6418,12 @@ msgstr "Израчунава Производ вектора са ГНУнет #: src/scalarproduct/gnunet-service-scalarproduct_alice.c:1358 #: src/scalarproduct/gnunet-service-scalarproduct_bob.c:1355 #: src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c:1118 -#: src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c:1063 +#: src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c:1034 #, fuzzy msgid "Connect to CADET failed\n" msgstr "Повезивање са МЕШОМ није успело\n" -#: src/scalarproduct/scalarproduct_api.c:189 +#: src/scalarproduct/scalarproduct_api.c:184 msgid "Keys given to SCALARPRODUCT not unique!\n" msgstr "" @@ -6388,7 +6444,7 @@ msgid "also profile decryption" msgstr "такође опис профила" #: src/set/gnunet-service-set.c:1916 src/seti/gnunet-service-seti.c:2467 -#: src/setu/gnunet-service-setu.c:3832 +#: src/setu/gnunet-service-setu.c:5395 #, fuzzy msgid "Could not connect to CADET service\n" msgstr "Не могу да се повежем са „%s“ услугом!\n" @@ -6612,6 +6668,7 @@ msgid "create COUNT number of peers" msgstr "ствара УКУПНОСТ број парњака" #: src/testbed/generate-underlay-topology.c:379 +#, fuzzy msgid "" "Generates SQLite3 database representing a given underlay topology.\n" "Usage: gnunet-underlay-topology [OPTIONS] db-filename TOPO [TOPOOPTS]\n" @@ -6631,7 +6688,7 @@ msgid "" "\t cap: the maximum number of links a node can have\n" "\t m: the number of links a node should have while joining the network\n" "\t filename: the path of the file which contains topology information\n" -"NOTE: the format of the above file is descibed here: https://www.gnunet.org/" +"NOTE: the format of the above file is described here: https://www.gnunet.org/" "content/topology-file-format\n" msgstr "" "Ствара СКуЛајт3 базу података која представља дати основни размештај.\n" @@ -6750,7 +6807,8 @@ msgid "Spawning process `%s'\n" msgstr "Умножавам процес „%s“\n" #: src/testbed/gnunet-testbed-profiler.c:290 -msgid "tolerate COUNT number of continious timeout failures" +#, fuzzy +msgid "tolerate COUNT number of continuous timeout failures" msgstr "толерише УКУПНО број непрекидних неуспеха истека времена" #: src/testbed/gnunet-testbed-profiler.c:295 @@ -7073,14 +7131,14 @@ msgstr "# „HELLO“ поруке су примљене" msgid "GNUnet topology control" msgstr "" -#: src/transport/gnunet-communicator-tcp.c:3331 +#: src/transport/gnunet-communicator-tcp.c:3314 #: src/transport/gnunet-communicator-udp.c:3790 -#: src/transport/gnunet-service-tng.c:10220 +#: src/transport/gnunet-service-tng.c:10223 #: src/transport/gnunet-service-transport.c:2627 msgid "Transport service is lacking key configuration settings. Exiting.\n" msgstr "Услузи преноса недостају поставке подешавања кључа. Излазим.\n" -#: src/transport/gnunet-communicator-tcp.c:3668 +#: src/transport/gnunet-communicator-tcp.c:3652 msgid "GNUnet TCP communicator" msgstr "" @@ -8186,7 +8244,7 @@ msgstr "Процес услуге не може да покрене функци msgid "Service process failed to report status\n" msgstr "Процес услуге није успео да извести о стању\n" -#: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1040 +#: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1220 #: src/util/service.c:1637 #, c-format msgid "Cannot obtain information about user `%s': %s\n" @@ -8304,39 +8362,15 @@ msgstr "Неисправан формат времена „%s“\n" msgid "Failed to serialize metadata `%s'" msgstr "Нисам успео да серијализујем НС запис са вредношћу „%s“\n" -#: src/util/client.c:747 src/util/client.c:937 +#: src/util/client.c:747 src/util/client.c:938 msgid "not a valid filename" msgstr "" -#: src/util/client.c:1103 +#: src/util/client.c:1104 #, c-format msgid "Need a non-empty hostname for service `%s'.\n" msgstr "Потребан је не-празан назив домаћина за услугу „%s“.\n" -#: src/util/common_logging.c:259 src/util/common_logging.c:1114 -msgid "DEBUG" -msgstr "ПРОЧИШЋАВАЊЕ" - -#: src/util/common_logging.c:261 src/util/common_logging.c:1112 -msgid "INFO" -msgstr "ПОДАЦИ" - -#: src/util/common_logging.c:263 src/util/common_logging.c:1110 -msgid "MESSAGE" -msgstr "" - -#: src/util/common_logging.c:265 src/util/common_logging.c:1108 -msgid "WARNING" -msgstr "УПОЗОРЕЊЕ" - -#: src/util/common_logging.c:267 src/util/common_logging.c:1106 -msgid "ERROR" -msgstr "ГРЕШКА" - -#: src/util/common_logging.c:269 src/util/common_logging.c:1116 -msgid "NONE" -msgstr "НИШТА" - #: src/util/common_logging.c:626 src/util/common_logging.c:665 #, c-format msgid "ERROR: Unable to parse log definition: Syntax error at `%s'.\n" @@ -8347,6 +8381,30 @@ msgstr "" msgid "Message `%.*s' repeated %u times in the last %s\n" msgstr "Порука „%.*s“ је поновљена %u пута у прошлости %s\n" +#: src/util/common_logging.c:1106 +msgid "ERROR" +msgstr "ГРЕШКА" + +#: src/util/common_logging.c:1108 +msgid "WARNING" +msgstr "УПОЗОРЕЊЕ" + +#: src/util/common_logging.c:1110 +msgid "MESSAGE" +msgstr "" + +#: src/util/common_logging.c:1112 +msgid "INFO" +msgstr "ПОДАЦИ" + +#: src/util/common_logging.c:1114 +msgid "DEBUG" +msgstr "ПРОЧИШЋАВАЊЕ" + +#: src/util/common_logging.c:1116 +msgid "NONE" +msgstr "НИШТА" + #: src/util/common_logging.c:1117 msgid "INVALID" msgstr "НЕИСПРАВНО" @@ -8371,21 +8429,51 @@ msgid "" msgstr "" "Подешавање наводи неисправну вредност за опцију „%s“ у одељку „%s“: %s\n" -#: src/util/configuration.c:370 +#: src/util/configuration.c:790 +#, c-format +msgid "Illegal directive in line %u (parsing restricted section %s)\n" +msgstr "" + +#: src/util/configuration.c:800 +#, c-format +msgid "Bad directive in line %u\n" +msgstr "" + +#: src/util/configuration.c:853 +#, c-format +msgid "Bad inline-secret directive in line %u\n" +msgstr "" + +#: src/util/configuration.c:875 +#, c-format +msgid "Unknown or malformed directive '%s' in line %u\n" +msgstr "" + +#: src/util/configuration.c:905 +#, fuzzy, c-format +msgid "Syntax error while deserializing in line %u (option without section)\n" +msgstr "Грешка синтаксе приликом десеријализације у реду %u\n" + +#: src/util/configuration.c:949 #, c-format msgid "Syntax error while deserializing in line %u\n" msgstr "Грешка синтаксе приликом десеријализације у реду %u\n" -#: src/util/configuration.c:420 +#: src/util/configuration.c:1049 #, fuzzy, c-format msgid "Error while reading file `%s'\n" msgstr "Грешка отварања датотеке „%s“: %s\n" -#: src/util/configuration.c:980 +#: src/util/configuration.c:1062 +#, fuzzy, c-format +msgid "Failed to parse configuration file `%s'\n" +msgstr "Нисам успео да уклоним датотеку подешавања „%s“\n" + +#: src/util/configuration.c:1695 msgid "Not a valid relative time specification" msgstr "" -#: src/util/configuration.c:1050 +#: src/util/configuration.c:1765 #, c-format msgid "" "Configuration value '%s' for '%s' in section '%s' is not in set of legal " @@ -8394,17 +8482,17 @@ msgstr "" "Вредност подешавања '%s' за '%s' у одељку '%s' није ус купу исправних " "избора\n" -#: src/util/configuration.c:1145 +#: src/util/configuration.c:1860 #, c-format msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n" msgstr "Сумња се на дубинско ширење, прекидам $-ширење за термин „%s“\n" -#: src/util/configuration.c:1177 +#: src/util/configuration.c:1892 #, c-format msgid "Missing closing `%s' in option `%s'\n" msgstr "Недостаје затварење „%s“ у опцији „%s“\n" -#: src/util/configuration.c:1243 +#: src/util/configuration.c:1958 #, c-format msgid "" "Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined " @@ -8451,7 +8539,7 @@ msgstr "„EdDSA“ потписивање није успело на %s:%d: %s\ msgid "RSA signature verification failed at %s:%d: %s\n" msgstr "Провера „ECDSA“ потписа није успела на %s:%d: %s\n" -#: src/util/disk.c:823 +#: src/util/disk.c:843 #, c-format msgid "Expected `%s' to be a directory!\n" msgstr "Очекивах да „%s“ буде директоријум!\n" @@ -8633,61 +8721,71 @@ msgstr "Морате да проследите број опцији „%s“.\n msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" msgstr "" -#: src/util/gnunet-base32.c:45 +#: src/util/gnunet-base32.c:46 msgid "run decoder modus, otherwise runs as encoder" msgstr "" -#: src/util/gnunet-config.c:167 -#, fuzzy, c-format -msgid "failed to load configuration defaults" -msgstr "Нисам успео да учитам подешавање за „%s“\n" - -#: src/util/gnunet-config.c:179 -#, fuzzy, c-format -msgid "%s or %s argument is required\n" -msgstr "аргумент „--section“ је потребан\n" - -#: src/util/gnunet-config.c:186 +#: src/util/gnunet-config.c:187 #, c-format msgid "The following sections are available:\n" msgstr "" -#: src/util/gnunet-config.c:234 +#: src/util/gnunet-config.c:201 +#, fuzzy, c-format +msgid "%s, %s or %s argument is required\n" +msgstr "аргумент „--section“ је потребан\n" + +#: src/util/gnunet-config.c:266 #, c-format msgid "--option argument required to set value\n" msgstr "аргумент „--option“ је потребан за постављање вредности\n" -#: src/util/gnunet-config.c:284 -#, fuzzy -msgid "interpret option value as a filename (with $-expansion)" -msgstr "добија опцију вредности као назив датотеке (са $-ширењем)" +#: src/util/gnunet-config.c:309 +#, fuzzy, c-format +msgid "failed to load configuration defaults" +msgstr "Нисам успео да учитам подешавање за „%s“\n" -#: src/util/gnunet-config.c:291 +#: src/util/gnunet-config.c:354 msgid "test if the current installation supports the specified BACKEND" msgstr "" -#: src/util/gnunet-config.c:297 -msgid "name of the section to access" -msgstr "назив одељка за приступање" +#: src/util/gnunet-config.c:360 +#, fuzzy +msgid "write the full configuration file, including default values" +msgstr "Нисам успео да учитам подешавање за „%s“\n" + +#: src/util/gnunet-config.c:365 +#, fuzzy +msgid "interpret option value as a filename (with $-expansion)" +msgstr "добија опцију вредности као назив датотеке (са $-ширењем)" -#: src/util/gnunet-config.c:302 +#: src/util/gnunet-config.c:370 msgid "name of the option to access" msgstr "назив опције за приступање" -#: src/util/gnunet-config.c:307 -msgid "value to set" -msgstr "вредност за постављање" +#: src/util/gnunet-config.c:376 +#, fuzzy +msgid "rewrite the configuration file, even if nothing changed" +msgstr "Није дата датотека подешавања. Излазим\n" + +#: src/util/gnunet-config.c:382 +msgid "output extra diagnostics" +msgstr "" -#: src/util/gnunet-config.c:312 +#: src/util/gnunet-config.c:387 #, fuzzy msgid "print available configuration sections" msgstr "Недостају поставке подешавања кључа.\n" -#: src/util/gnunet-config.c:318 -msgid "write configuration file that only contains delta to defaults" -msgstr "" +#: src/util/gnunet-config.c:393 +msgid "name of the section to access" +msgstr "назив одељка за приступање" -#: src/util/gnunet-config.c:330 +#: src/util/gnunet-config.c:398 +msgid "value to set" +msgstr "вредност за постављање" + +#: src/util/gnunet-config.c:413 msgid "Manipulate GNUnet configuration files" msgstr "Управља ГНУнет датотекама подешавања" @@ -8927,21 +9025,21 @@ msgstr "„%s“ није успело да реши метод '%s' са гре msgid "`%s' failed for library `%s' with error: %s\n" msgstr "„%s“ није успело за библиотеку '%s' са грешком: %s\n" -#: src/util/plugin.c:409 +#: src/util/plugin.c:414 msgid "Could not determine plugin installation path.\n" msgstr "Не могу да одредим путању инсталирања прикључка.\n" -#: src/util/program.c:259 +#: src/util/program.c:252 #, fuzzy, c-format msgid "Unreadable or malformed configuration file `%s', exit ...\n" msgstr "Лоша датотека подешавања „%s“, излазим ...\n" -#: src/util/program.c:276 +#: src/util/program.c:272 #, fuzzy, c-format msgid "Unreadable or malformed default configuration file `%s', exit ...\n" msgstr "Лоша датотека подешавања „%s“, излазим ...\n" -#: src/util/program.c:291 +#: src/util/program.c:288 #, fuzzy msgid "Unreadable or malformed configuration, exit ...\n" msgstr "Лоше подешавање, излазим ...\n" @@ -9010,83 +9108,83 @@ msgstr "" msgid "Attempting to proxy service `%s' to invalid port %d or hostname.\n" msgstr "" -#: src/util/strings.c:503 +#: src/util/strings.c:409 #, c-format msgid "Character sets requested were `%s'->`%s'\n" msgstr "Скупови знакова се захтевају где је „%s“–>„%s“\n" -#: src/util/strings.c:637 +#: src/util/strings.c:501 msgid "Failed to expand `$HOME': environment variable `HOME' not set" msgstr "" "Нисам успео да раширим „$HOME“: променљива окружења „HOME“ није постављена" -#: src/util/strings.c:1241 +#: src/util/strings.c:1036 msgid "IPv6 address did not start with `['\n" msgstr "ИПв6 адреса не почиње са [\n" -#: src/util/strings.c:1249 +#: src/util/strings.c:1044 msgid "IPv6 address did contain ':' to separate port number\n" msgstr "ИПв6 адреса садржи : за раздвајање броја прикључника\n" -#: src/util/strings.c:1256 +#: src/util/strings.c:1051 msgid "IPv6 address did contain ']' before ':' to separate port number\n" msgstr "ИПв6 адреса садржи ] пре : за раздвајање броја прикључника\n" -#: src/util/strings.c:1264 +#: src/util/strings.c:1059 msgid "IPv6 address did contain a valid port number after the last ':'\n" msgstr "ИПв6 адреса садржи исправан број прикључника након последње „:“\n" -#: src/util/strings.c:1273 +#: src/util/strings.c:1068 #, c-format msgid "Invalid IPv6 address `%s': %s\n" msgstr "Неисправна ИПв6 адреса „%s“: %s\n" -#: src/util/strings.c:1500 src/util/strings.c:1511 +#: src/util/strings.c:1250 src/util/strings.c:1261 msgid "Port not in range\n" msgstr "Прикључник није у опсегу\n" -#: src/util/strings.c:1520 +#: src/util/strings.c:1270 #, c-format msgid "Malformed port policy `%s'\n" msgstr "Лоша политика прикључника „%s“\n" -#: src/util/strings.c:1603 src/util/strings.c:1632 src/util/strings.c:1679 -#: src/util/strings.c:1699 +#: src/util/strings.c:1341 src/util/strings.c:1370 src/util/strings.c:1417 +#: src/util/strings.c:1437 #, c-format msgid "Invalid format for IP: `%s'\n" msgstr "Неисправан формат за ИП: „%s“\n" -#: src/util/strings.c:1657 +#: src/util/strings.c:1395 #, c-format msgid "Invalid network notation ('/%d' is not legal in IPv4 CIDR)." msgstr "Неисправна напомена мреже („/%d“ није исправно у ИПв4 ЦИДР-у)." -#: src/util/strings.c:1708 +#: src/util/strings.c:1446 #, c-format msgid "Invalid format: `%s'\n" msgstr "Неисправан формат: „%s“\n" -#: src/util/strings.c:1761 +#: src/util/strings.c:1488 #, c-format msgid "Invalid network notation (does not end with ';': `%s')\n" msgstr "Неисправна напомена мреже (не завршава се са „;“: „%s“)\n" -#: src/util/strings.c:1811 +#: src/util/strings.c:1538 #, c-format msgid "Wrong format `%s' for netmask\n" msgstr "Погрешан формат „%s“ за мрежну маску\n" -#: src/util/strings.c:1842 +#: src/util/strings.c:1569 #, c-format msgid "Wrong format `%s' for network\n" msgstr "Погрешан формат „%s“ за мрежу\n" -#: src/util/time.c:878 src/util/time.c:906 +#: src/util/time.c:699 src/util/time.c:727 #, c-format msgid "Failed to map `%s', cannot assure monotonic time!\n" msgstr "" -#: src/util/time.c:914 +#: src/util/time.c:735 #, c-format msgid "" "Failed to setup monotonic time file `%s', cannot assure monotonic time!\n" @@ -9267,6 +9365,35 @@ msgstr "Поставља тунеле путем ВПН-а." msgid "Failed to connect to the namestore!\n" msgstr "Нисам успео да се повежем са смештајем назива!\n" +#, c-format +#~ msgid "Unsupported form value `%s'\n" +#~ msgstr "Неподржана вредност облика „%s“\n" + +#~ msgid "Error when mapping zone to name\n" +#~ msgstr "Грешка приликом мапирања зоне у назив\n" + +#, c-format +#~ msgid "Found existing name `%s' for the given key\n" +#~ msgstr "Нађох постојећи назив „%s“ за дати кључ\n" + +#, c-format +#~ msgid "Found %u existing records for domain `%s'\n" +#~ msgstr "Нађох %u постојећа записа за домен „%s“\n" + +#, c-format +#~ msgid "Failed to create page for `%s'\n" +#~ msgstr "Нисам успео да направим страницу за „%s“\n" + +#, c-format +#~ msgid "Failed to setup post processor for `%s'\n" +#~ msgstr "Нисам успео да поставим постпроцесор за „%s“\n" + +#~ msgid "Domain name must not contain `.'\n" +#~ msgstr "Назив домена не сме да садржи „.“\n" + +#~ msgid "Domain name must not contain `+'\n" +#~ msgstr "Назив домена не сме да садржи „+“\n" + #~ msgid "Client was disconnected from arm service, trying to reconnect.\n" #~ msgstr "" #~ "Клијент је ископчан са аур услуге, покушавам поново да се повежем.\n" @@ -9512,10 +9639,6 @@ msgstr "Нисам успео да се повежем са смештајем #~ msgid "# UPDATE requests received" #~ msgstr "# захтеви ОСВЕЖИ су примљени" -#, c-format -#~ msgid "Failed to prepare statement `%s'\n" -#~ msgstr "Нисам успео да припремим стање „%s“\n" - #~ msgid "Invalid data in database. Trying to fix (by deletion).\n" #~ msgstr "" #~ "Неисправан податак у бази података. Покушавам да поправим (брисањем).\n" @@ -9705,9 +9828,6 @@ msgstr "Нисам успео да се повежем са смештајем #~ msgstr "" #~ "Нисам успео да примим исправан одговор за „%s“ захтев од „%s“ услуге.\n" -#~ msgid "unknown error" -#~ msgstr "непозната грешка" - #, c-format #~ msgid "Insufficient space for publishing: %s" #~ msgstr "Недовољно простора за објављивање: %s" diff --git a/po/sv.po b/po/sv.po index f409b56ec..20e41b870 100644 --- a/po/sv.po +++ b/po/sv.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: GNUnet 0.7.0b\n" "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" -"POT-Creation-Date: 2021-04-04 19:19+0200\n" +"POT-Creation-Date: 2021-08-08 18:36+0200\n" "PO-Revision-Date: 2006-01-21 17:16+0100\n" "Last-Translator: Daniel Nylander \n" "Language-Team: Swedish \n" @@ -28,7 +28,7 @@ msgstr "Ogiltigt argument: \"%s\"\n" #: src/abd/gnunet-abd.c:560 src/abd/gnunet-service-abd.c:1747 #: src/namestore/gnunet-namestore.c:1001 -#: src/namestore/gnunet-namestore-fcfsd.c:1164 +#: src/namestore/gnunet-namestore-fcfsd.c:1067 #, fuzzy, c-format msgid "Failed to connect to namestore\n" msgstr "Misslyckades att ansluta till gnunetd.\n" @@ -763,7 +763,7 @@ msgstr "" #: src/auction/gnunet-auction-info.c:77 src/auction/gnunet-auction-join.c:77 #: src/conversation/gnunet-conversation-test.c:256 -#: src/revocation/gnunet-revocation.c:564 src/template/gnunet-template.c:75 +#: src/revocation/gnunet-revocation.c:570 src/template/gnunet-template.c:75 #, fuzzy msgid "help text" msgstr "hjälptext för -t" @@ -1135,7 +1135,7 @@ msgstr "" #, c-format msgid "" "\n" -"We are now playing your recording back. If you can hear it, your audio " +"ew are now playing your recording back. If you can hear it, your audio " "settings are working..." msgstr "" @@ -1593,42 +1593,42 @@ msgstr "# krypterade PONG-meddelanden mottagna" msgid "# updates to my type map" msgstr "" -#: src/datacache/datacache.c:115 src/datacache/datacache.c:287 +#: src/datacache/datacache.c:115 src/datacache/datacache.c:299 #: src/datastore/gnunet-service-datastore.c:742 #, fuzzy msgid "# bytes stored" msgstr "# byte krypterade" -#: src/datacache/datacache.c:119 src/datacache/datacache.c:291 +#: src/datacache/datacache.c:119 src/datacache/datacache.c:303 #, fuzzy msgid "# items stored" msgstr "# byte krypterade" -#: src/datacache/datacache.c:189 +#: src/datacache/datacache.c:190 #, c-format msgid "Loading `%s' datacache plugin\n" msgstr "" -#: src/datacache/datacache.c:197 +#: src/datacache/datacache.c:208 #, fuzzy, c-format msgid "Failed to load datacache plugin for `%s'\n" msgstr "Misslyckades att läsa kompislista från \"%s\"\n" -#: src/datacache/datacache.c:320 +#: src/datacache/datacache.c:332 #, fuzzy msgid "# requests received" msgstr "# byte mottogs via TCP" -#: src/datacache/datacache.c:331 +#: src/datacache/datacache.c:343 msgid "# requests filtered by bloom filter" msgstr "" -#: src/datacache/datacache.c:358 +#: src/datacache/datacache.c:370 #, fuzzy msgid "# requests for random value received" msgstr "# byte mottogs via TCP" -#: src/datacache/datacache.c:388 +#: src/datacache/datacache.c:400 #, fuzzy msgid "# proximity search requests received" msgstr "# klartext PONG-meddelanden mottagna" @@ -1977,7 +1977,7 @@ msgstr "" #: src/datastore/plugin_datastore_postgres.c:284 #: src/datastore/plugin_datastore_postgres.c:897 -msgid "Postgress exec failure" +msgid "Postgresql exec failure" msgstr "" #: src/datastore/plugin_datastore_postgres.c:858 @@ -2013,14 +2013,25 @@ msgstr "" msgid "sqlite version to old to determine size, assuming zero\n" msgstr "" -#: src/datastore/plugin_datastore_sqlite.c:1274 +#: src/datastore/plugin_datastore_sqlite.c:1266 +#: src/datastore/plugin_datastore_sqlite.c:1279 +#, fuzzy +msgid "error preparing statement\n" +msgstr "Klar med skapandet av värdnyckel.\n" + +#: src/datastore/plugin_datastore_sqlite.c:1287 +#, fuzzy +msgid "error stepping\n" +msgstr "# byte krypterade" + +#: src/datastore/plugin_datastore_sqlite.c:1295 #, c-format msgid "" "Using sqlite page utilization to estimate payload (%llu pages of size %llu " "bytes)\n" msgstr "" -#: src/datastore/plugin_datastore_sqlite.c:1316 +#: src/datastore/plugin_datastore_sqlite.c:1337 #: src/namecache/plugin_namecache_sqlite.c:564 #: src/namestore/plugin_namestore_sqlite.c:765 msgid "Sqlite database running\n" @@ -2275,100 +2286,100 @@ msgstr "# PING-meddelanden skapade" msgid "# requests TTL-dropped" msgstr "# byte mottogs via TCP" -#: src/dht/gnunet-service-dht_neighbours.c:1052 -#: src/dht/gnunet-service-dht_neighbours.c:1096 +#: src/dht/gnunet-service-dht_neighbours.c:1035 +#: src/dht/gnunet-service-dht_neighbours.c:1072 msgid "# Peers excluded from routing due to Bloomfilter" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1069 -#: src/dht/gnunet-service-dht_neighbours.c:1112 +#: src/dht/gnunet-service-dht_neighbours.c:1045 +#: src/dht/gnunet-service-dht_neighbours.c:1088 msgid "# Peer selection failed" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1270 +#: src/dht/gnunet-service-dht_neighbours.c:1246 #, fuzzy msgid "# PUT requests routed" msgstr "# byte mottogs via TCP" -#: src/dht/gnunet-service-dht_neighbours.c:1304 +#: src/dht/gnunet-service-dht_neighbours.c:1280 #, fuzzy msgid "# PUT messages queued for transmission" msgstr "# PING-meddelanden skapade" -#: src/dht/gnunet-service-dht_neighbours.c:1316 -#: src/dht/gnunet-service-dht_neighbours.c:1458 -#: src/dht/gnunet-service-dht_neighbours.c:1562 +#: src/dht/gnunet-service-dht_neighbours.c:1292 +#: src/dht/gnunet-service-dht_neighbours.c:1434 +#: src/dht/gnunet-service-dht_neighbours.c:1538 #, fuzzy msgid "# P2P messages dropped due to full queue" msgstr "Nätverksannonsering avstängd i konfigurationen!\n" -#: src/dht/gnunet-service-dht_neighbours.c:1401 +#: src/dht/gnunet-service-dht_neighbours.c:1377 #, fuzzy msgid "# GET requests routed" msgstr "# byte mottogs via TCP" -#: src/dht/gnunet-service-dht_neighbours.c:1445 +#: src/dht/gnunet-service-dht_neighbours.c:1421 #, fuzzy msgid "# GET messages queued for transmission" msgstr "# PING-meddelanden skapade" -#: src/dht/gnunet-service-dht_neighbours.c:1577 +#: src/dht/gnunet-service-dht_neighbours.c:1553 #, fuzzy msgid "# RESULT messages queued for transmission" msgstr "# PING-meddelanden skapade" -#: src/dht/gnunet-service-dht_neighbours.c:1680 +#: src/dht/gnunet-service-dht_neighbours.c:1656 msgid "# Expired PUTs discarded" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1688 +#: src/dht/gnunet-service-dht_neighbours.c:1664 #, fuzzy msgid "# P2P PUT requests received" msgstr "# byte mottogs via TCP" -#: src/dht/gnunet-service-dht_neighbours.c:1692 +#: src/dht/gnunet-service-dht_neighbours.c:1668 #, fuzzy msgid "# P2P PUT bytes received" msgstr "# byte mottogs via TCP" -#: src/dht/gnunet-service-dht_neighbours.c:1924 +#: src/dht/gnunet-service-dht_neighbours.c:1900 msgid "# FIND PEER requests ignored due to Bloomfilter" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1933 +#: src/dht/gnunet-service-dht_neighbours.c:1909 msgid "# FIND PEER requests ignored due to lack of HELLO" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:2096 +#: src/dht/gnunet-service-dht_neighbours.c:2072 #, fuzzy msgid "# P2P GET requests received" msgstr "# byte mottogs via TCP" -#: src/dht/gnunet-service-dht_neighbours.c:2100 +#: src/dht/gnunet-service-dht_neighbours.c:2076 #, fuzzy msgid "# P2P GET bytes received" msgstr "# byte mottogs via TCP" -#: src/dht/gnunet-service-dht_neighbours.c:2166 +#: src/dht/gnunet-service-dht_neighbours.c:2142 #, fuzzy msgid "# P2P FIND PEER requests processed" msgstr "# byte mottogs via TCP" -#: src/dht/gnunet-service-dht_neighbours.c:2187 +#: src/dht/gnunet-service-dht_neighbours.c:2163 #, fuzzy msgid "# P2P GET requests ONLY routed" msgstr "# byte mottogs via TCP" -#: src/dht/gnunet-service-dht_neighbours.c:2365 +#: src/dht/gnunet-service-dht_neighbours.c:2341 msgid "# Expired results discarded" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:2382 +#: src/dht/gnunet-service-dht_neighbours.c:2358 #, fuzzy msgid "# P2P RESULTS received" msgstr "# krypterade PONG-meddelanden mottagna" -#: src/dht/gnunet-service-dht_neighbours.c:2386 +#: src/dht/gnunet-service-dht_neighbours.c:2362 #, fuzzy msgid "# P2P RESULT bytes received" msgstr "# krypterade PONG-meddelanden mottagna" @@ -2851,7 +2862,7 @@ msgstr "" #: src/fs/fs_download.c:346 #, fuzzy, c-format msgid "" -"Failed to access full directroy contents of `%s' for recursive download\n" +"Failed to access full directory contents of `%s' for recursive download\n" msgstr "Misslyckades att läsa kompislista från \"%s\"\n" #: src/fs/fs_download.c:528 src/fs/fs_download.c:541 @@ -4125,7 +4136,7 @@ msgstr "" msgid "GNUnet GNS resolver tool" msgstr "Spåra GNUnets nätverkstopologi." -#: src/gns/gnunet-gns-import.c:491 +#: src/gns/gnunet-gns-import.c:490 msgid "This program will import some GNS authorities into your GNS namestore." msgstr "" @@ -4814,51 +4825,51 @@ msgstr "Kunde inte skapa namnrymd \"%s\" (existerar?).\n" msgid "Failed to set default ego: %s\n" msgstr "Kunde inte skapa namnrymd \"%s\" (existerar?).\n" -#: src/identity/gnunet-identity.c:462 +#: src/identity/gnunet-identity.c:461 msgid "create ego NAME" msgstr "" -#: src/identity/gnunet-identity.c:467 +#: src/identity/gnunet-identity.c:466 msgid "delete ego NAME " msgstr "" -#: src/identity/gnunet-identity.c:473 +#: src/identity/gnunet-identity.c:472 msgid "" "set the private key for the identity to PRIVATE_KEY (use together with -C)" msgstr "" -#: src/identity/gnunet-identity.c:478 +#: src/identity/gnunet-identity.c:477 msgid "generate an EdDSA identity. (use together with -C) EXPERIMENTAL" msgstr "" -#: src/identity/gnunet-identity.c:482 +#: src/identity/gnunet-identity.c:481 msgid "display all egos" msgstr "" -#: src/identity/gnunet-identity.c:486 +#: src/identity/gnunet-identity.c:485 msgid "reduce output" msgstr "" -#: src/identity/gnunet-identity.c:493 +#: src/identity/gnunet-identity.c:492 msgid "" "set default identity to NAME for a subsystem SUBSYSTEM (use together with -" "s) or restrict results to NAME (use together with -d)" msgstr "" -#: src/identity/gnunet-identity.c:497 +#: src/identity/gnunet-identity.c:496 msgid "run in monitor mode egos" msgstr "" -#: src/identity/gnunet-identity.c:501 +#: src/identity/gnunet-identity.c:500 msgid "display private keys as well" msgstr "" -#: src/identity/gnunet-identity.c:508 +#: src/identity/gnunet-identity.c:507 msgid "" "set default identity to EGO for a subsystem SUBSYSTEM (use together with -e)" msgstr "" -#: src/identity/gnunet-identity.c:523 +#: src/identity/gnunet-identity.c:522 msgid "Maintain egos" msgstr "" @@ -4914,7 +4925,7 @@ msgstr "Misslyckades att läsa kompislista från \"%s\"\n" msgid "Identity REST API initialized\n" msgstr " Anslutning misslyckades\n" -#: src/json/json.c:139 +#: src/json/json.c:119 #, fuzzy, c-format msgid "Failed to parse JSON in option `%s': %s (%s)\n" msgstr "Misslyckades att läsa kompislista från \"%s\"\n" @@ -5264,73 +5275,113 @@ msgstr "" msgid "name of the ego controlling the zone" msgstr "Visa värde av alternativet" -#: src/namestore/gnunet-namestore-fcfsd.c:552 -#, fuzzy, c-format -msgid "Unsupported form value `%s'\n" -msgstr "Kommando \"%s\" stöds ej. Avbryter.\n" +#: src/namestore/gnunet-namestore-fcfsd.c:359 +#, fuzzy +msgid "can not search the namestore" +msgstr "Misslyckades att ansluta till gnunetd.\n" -#: src/namestore/gnunet-namestore-fcfsd.c:579 +#: src/namestore/gnunet-namestore-fcfsd.c:413 +#: src/namestore/gnunet-namestore-fcfsd.c:554 +#, fuzzy +msgid "unable to scan namestore" +msgstr "Misslyckades att ansluta till gnunetd.\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:441 #, fuzzy, c-format -msgid "Failed to create record for domain `%s': %s\n" +msgid "Failed to create record for `%s': %s\n" msgstr "Kunde inte tolka konfigurationsfil \"%s\".\n" -#: src/namestore/gnunet-namestore-fcfsd.c:600 -msgid "Error when mapping zone to name\n" -msgstr "" +#: src/namestore/gnunet-namestore-fcfsd.c:453 +#, fuzzy +msgid "no errors" +msgstr "Okänt fel" -#: src/namestore/gnunet-namestore-fcfsd.c:633 -#, c-format -msgid "Found existing name `%s' for the given key\n" +#: src/namestore/gnunet-namestore-fcfsd.c:489 +#, fuzzy, c-format +msgid "The requested key `%s' exists as `%s'\n" +msgstr "Skapade post \"%s\" i namnrymd \"%s\"\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:496 +msgid "key exists" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:646 +#: src/namestore/gnunet-namestore-fcfsd.c:513 #, fuzzy -msgid "Error creating record data.\n" +msgid "Error creating record data\n" msgstr "=\tFel vid läsning av katalog.\n" -#: src/namestore/gnunet-namestore-fcfsd.c:707 +#: src/namestore/gnunet-namestore-fcfsd.c:517 +#, fuzzy +msgid "unable to store record" +msgstr "Misslyckades att starta samling.\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:588 #, c-format -msgid "Found %u existing records for domain `%s'\n" +msgid "Requested name `%s' exists with `%u' records\n" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:796 -#, fuzzy, c-format -msgid "Failed to create page for `%s'\n" -msgstr "Kunde inte skapa namnrymd \"%s\" (existerar?).\n" - -#: src/namestore/gnunet-namestore-fcfsd.c:815 -#, fuzzy, c-format -msgid "Failed to setup post processor for `%s'\n" -msgstr "Misslyckades att läsa kompislista från \"%s\"\n" +#: src/namestore/gnunet-namestore-fcfsd.c:594 +msgid "name exists\n" +msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:850 -msgid "Domain name must not contain `.'\n" +#: src/namestore/gnunet-namestore-fcfsd.c:780 +msgid "unable to process submitted data" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:859 -msgid "Domain name must not contain `+'\n" +#: src/namestore/gnunet-namestore-fcfsd.c:787 +msgid "the submitted data is invalid" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:1094 +#: src/namestore/gnunet-namestore-fcfsd.c:806 +#, fuzzy +msgid "invalid parameters" +msgstr "Ogiltigt argument: \"%s\"\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:823 +#, fuzzy +msgid "invalid name" +msgstr "Ogiltigt argument: \"%s\"\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:834 +#, fuzzy, c-format +msgid "Unable to parse key %s\n" +msgstr "Misslyckades att läsa kompislista från \"%s\"\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:838 +#, fuzzy +msgid "unable to parse key" +msgstr "Misslyckades att läsa kompislista från \"%s\"\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:949 msgid "No ego configured for `fcfsd` subsystem\n" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:1125 +#: src/namestore/gnunet-namestore-fcfsd.c:974 #, fuzzy msgid "Failed to start HTTP server\n" msgstr "Misslyckades att starta samling.\n" -#: src/namestore/gnunet-namestore-fcfsd.c:1173 +#: src/namestore/gnunet-namestore-fcfsd.c:1058 +#, fuzzy +msgid "No port specified, using default value\n" +msgstr "Konfigurationsfil \"%s\" skapad.\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:1076 #, fuzzy msgid "Failed to connect to identity\n" msgstr "Misslyckades att ansluta till gnunetd.\n" -#: src/namestore/gnunet-namestore-fcfsd.c:1200 -msgid "name of the zone that is to be managed by FCFSD" +#: src/namestore/gnunet-namestore-fcfsd.c:1100 +#, fuzzy +msgid "Unable to set up the daemon\n" +msgstr "Kunde inte skapa namnrymd \"%s\" (existerar?).\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:1123 +msgid "name of the zone managed by FCFSD" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:1220 -msgid "GNU Name System First Come First Serve name registration service" +#: src/namestore/gnunet-namestore-fcfsd.c:1132 +msgid "GNU Name System First-Come-First-Served name registration service" msgstr "" #: src/namestore/gnunet-service-namestore.c:871 @@ -5338,11 +5389,11 @@ msgstr "" msgid "Failed to replicate block in namecache: %s\n" msgstr "Misslyckades att läsa kompislista från \"%s\"\n" -#: src/namestore/gnunet-zoneimport.c:1848 +#: src/namestore/gnunet-zoneimport.c:1847 msgid "size to use for the main hash map" msgstr "" -#: src/namestore/gnunet-zoneimport.c:1854 +#: src/namestore/gnunet-zoneimport.c:1853 msgid "minimum expiration time we assume for imported records" msgstr "" @@ -5364,7 +5415,7 @@ msgstr "" msgid "Flat file database running\n" msgstr "" -#: src/namestore/plugin_rest_namestore.c:1105 +#: src/namestore/plugin_rest_namestore.c:1111 #, fuzzy msgid "Namestore REST API initialized\n" msgstr " Anslutning misslyckades\n" @@ -6037,12 +6088,12 @@ msgstr "" msgid "re:claimID command line tool" msgstr "" -#: src/reclaim/plugin_rest_openid_connect.c:2788 +#: src/reclaim/plugin_rest_openid_connect.c:2793 #, fuzzy msgid "OpenID Connect REST API initialized\n" msgstr " Anslutning misslyckades\n" -#: src/reclaim/plugin_rest_reclaim.c:1521 +#: src/reclaim/plugin_rest_pabc.c:637 src/reclaim/plugin_rest_reclaim.c:1520 #, fuzzy msgid "Identity Provider REST API initialized\n" msgstr " Anslutning misslyckades\n" @@ -6061,61 +6112,61 @@ msgstr "GNUnet-konfiguration" msgid "Daemon to announce regular expressions for the peer using cadet." msgstr "" -#: src/regex/gnunet-regex-profiler.c:1390 +#: src/regex/gnunet-regex-profiler.c:1392 #, fuzzy msgid "No configuration file given. Exiting\n" msgstr "använd konfigurationsfil FILNAMN" -#: src/regex/gnunet-regex-profiler.c:1432 +#: src/regex/gnunet-regex-profiler.c:1434 #: src/regex/gnunet-regex-simulation-profiler.c:631 #, c-format msgid "No policy directory specified on command line. Exiting.\n" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1438 +#: src/regex/gnunet-regex-profiler.c:1440 #: src/regex/gnunet-regex-simulation-profiler.c:639 #, c-format msgid "Specified policies directory does not exist. Exiting.\n" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1446 +#: src/regex/gnunet-regex-profiler.c:1448 #, fuzzy, c-format msgid "No files found in `%s'\n" msgstr "%d filer hittades i katalog.\n" -#: src/regex/gnunet-regex-profiler.c:1455 +#: src/regex/gnunet-regex-profiler.c:1457 msgid "No search strings file given. Exiting.\n" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1475 +#: src/regex/gnunet-regex-profiler.c:1477 #, fuzzy msgid "Error loading search strings. Exiting.\n" msgstr "Fel vid lämning av DHT.\n" -#: src/regex/gnunet-regex-profiler.c:1563 +#: src/regex/gnunet-regex-profiler.c:1565 #, fuzzy msgid "name of the file for writing statistics" msgstr "Visa värde av alternativet" -#: src/regex/gnunet-regex-profiler.c:1570 +#: src/regex/gnunet-regex-profiler.c:1572 msgid "wait TIMEOUT before ending the experiment" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1576 +#: src/regex/gnunet-regex-profiler.c:1578 msgid "directory with policy files" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1584 +#: src/regex/gnunet-regex-profiler.c:1586 #, fuzzy msgid "name of file with input strings" msgstr "Visa värde av alternativet" -#: src/regex/gnunet-regex-profiler.c:1591 +#: src/regex/gnunet-regex-profiler.c:1593 #, fuzzy msgid "name of file with hosts' names" msgstr "Visa värde av alternativet" -#: src/regex/gnunet-regex-profiler.c:1604 +#: src/regex/gnunet-regex-profiler.c:1606 msgid "Profiler for regex" msgstr "" @@ -6142,12 +6193,12 @@ msgstr "\"%s\" är inte en fil.\n" msgid "Search string `%s' is too long!\n" msgstr "\"%s\" är inte en fil.\n" -#: src/rest/gnunet-rest-server.c:1266 +#: src/rest/gnunet-rest-server.c:1267 #, fuzzy msgid "GNUnet REST server" msgstr "Spåra GNUnets nätverkstopologi." -#: src/rest/plugin_rest_config.c:427 +#: src/rest/plugin_rest_config.c:428 #, fuzzy msgid "CONFIG REST API initialized\n" msgstr " Anslutning misslyckades\n" @@ -6214,72 +6265,77 @@ msgstr "" msgid "Ego `%s' not found.\n" msgstr "\"%s\" misslyckades: tabell hittades inte!\n" -#: src/revocation/gnunet-revocation.c:351 +#: src/revocation/gnunet-revocation.c:350 +#, fuzzy, c-format +msgid "Error: Key is invalid\n" +msgstr "Formatet på pseudonym \"%s\" är ogiltig.\n" + +#: src/revocation/gnunet-revocation.c:357 #, c-format msgid "Error: revocation certificate in `%s' is not for `%s'\n" msgstr "" -#: src/revocation/gnunet-revocation.c:361 +#: src/revocation/gnunet-revocation.c:367 msgid "Revocation certificate ready\n" msgstr "" -#: src/revocation/gnunet-revocation.c:373 +#: src/revocation/gnunet-revocation.c:379 msgid "Continuing calculation where left off...\n" msgstr "" -#: src/revocation/gnunet-revocation.c:380 +#: src/revocation/gnunet-revocation.c:386 msgid "Revocation certificate not ready, calculating proof of work\n" msgstr "" -#: src/revocation/gnunet-revocation.c:418 +#: src/revocation/gnunet-revocation.c:424 #, fuzzy, c-format msgid "Public key `%s' malformed\n" msgstr "Ogiltigt argument: \"%s\"\n" -#: src/revocation/gnunet-revocation.c:428 +#: src/revocation/gnunet-revocation.c:434 msgid "" "Testing and revoking at the same time is not allowed, only executing test.\n" msgstr "" -#: src/revocation/gnunet-revocation.c:458 +#: src/revocation/gnunet-revocation.c:464 #, fuzzy msgid "No filename to store revocation certificate given.\n" msgstr "Misslyckades att läsa kompislista från \"%s\"\n" -#: src/revocation/gnunet-revocation.c:475 +#: src/revocation/gnunet-revocation.c:481 #, fuzzy, c-format msgid "Failed to read revocation certificate from `%s'\n" msgstr "Misslyckades att läsa kompislista från \"%s\"\n" -#: src/revocation/gnunet-revocation.c:483 +#: src/revocation/gnunet-revocation.c:489 #, fuzzy, c-format msgid "Revocation certificate corrupted in `%s'\n" msgstr "Misslyckades att läsa kompislista från \"%s\"\n" -#: src/revocation/gnunet-revocation.c:505 +#: src/revocation/gnunet-revocation.c:511 #, fuzzy msgid "No action specified. Nothing to do.\n" msgstr "Inget tabellnamn angivet, använder \"%s\".\n" -#: src/revocation/gnunet-revocation.c:524 +#: src/revocation/gnunet-revocation.c:530 msgid "use NAME for the name of the revocation file" msgstr "" -#: src/revocation/gnunet-revocation.c:532 +#: src/revocation/gnunet-revocation.c:538 msgid "" "revoke the private key associated for the the private key associated with " "the ego NAME " msgstr "" -#: src/revocation/gnunet-revocation.c:539 +#: src/revocation/gnunet-revocation.c:545 msgid "actually perform revocation, otherwise we just do the precomputation" msgstr "" -#: src/revocation/gnunet-revocation.c:546 +#: src/revocation/gnunet-revocation.c:552 msgid "test if the public key KEY has been revoked" msgstr "" -#: src/revocation/gnunet-revocation.c:552 +#: src/revocation/gnunet-revocation.c:558 #, fuzzy msgid "number of epochs to calculate for" msgstr "antal iterationer" @@ -6407,12 +6463,12 @@ msgstr "" #: src/scalarproduct/gnunet-service-scalarproduct_alice.c:1358 #: src/scalarproduct/gnunet-service-scalarproduct_bob.c:1355 #: src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c:1118 -#: src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c:1063 +#: src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c:1034 #, fuzzy msgid "Connect to CADET failed\n" msgstr " Anslutning misslyckades (fel?)\n" -#: src/scalarproduct/scalarproduct_api.c:189 +#: src/scalarproduct/scalarproduct_api.c:184 msgid "Keys given to SCALARPRODUCT not unique!\n" msgstr "" @@ -6433,7 +6489,7 @@ msgid "also profile decryption" msgstr "" #: src/set/gnunet-service-set.c:1916 src/seti/gnunet-service-seti.c:2467 -#: src/setu/gnunet-service-setu.c:3832 +#: src/setu/gnunet-service-setu.c:5395 #, fuzzy msgid "Could not connect to CADET service\n" msgstr "Kunde inte ansluta till gnunetd.\n" @@ -6677,7 +6733,7 @@ msgid "" "\t cap: the maximum number of links a node can have\n" "\t m: the number of links a node should have while joining the network\n" "\t filename: the path of the file which contains topology information\n" -"NOTE: the format of the above file is descibed here: https://www.gnunet.org/" +"NOTE: the format of the above file is described here: https://www.gnunet.org/" "content/topology-file-format\n" msgstr "" @@ -6773,7 +6829,7 @@ msgid "Spawning process `%s'\n" msgstr "Startade samling \"%s\".\n" #: src/testbed/gnunet-testbed-profiler.c:290 -msgid "tolerate COUNT number of continious timeout failures" +msgid "tolerate COUNT number of continuous timeout failures" msgstr "" #: src/testbed/gnunet-testbed-profiler.c:295 @@ -7079,15 +7135,15 @@ msgstr "# krypterade PONG-meddelanden mottagna" msgid "GNUnet topology control" msgstr "" -#: src/transport/gnunet-communicator-tcp.c:3331 +#: src/transport/gnunet-communicator-tcp.c:3314 #: src/transport/gnunet-communicator-udp.c:3790 -#: src/transport/gnunet-service-tng.c:10220 +#: src/transport/gnunet-service-tng.c:10223 #: src/transport/gnunet-service-transport.c:2627 #, fuzzy msgid "Transport service is lacking key configuration settings. Exiting.\n" msgstr "GNUnet-konfiguration" -#: src/transport/gnunet-communicator-tcp.c:3668 +#: src/transport/gnunet-communicator-tcp.c:3652 msgid "GNUnet TCP communicator" msgstr "" @@ -8199,7 +8255,7 @@ msgstr "" msgid "Service process failed to report status\n" msgstr "" -#: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1040 +#: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1220 #: src/util/service.c:1637 #, fuzzy, c-format msgid "Cannot obtain information about user `%s': %s\n" @@ -8319,47 +8375,47 @@ msgstr "Ogiltigt format för IP: \"%s\"\n" msgid "Failed to serialize metadata `%s'" msgstr "Misslyckades att leverera \"%s\" meddelande.\n" -#: src/util/client.c:747 src/util/client.c:937 +#: src/util/client.c:747 src/util/client.c:938 msgid "not a valid filename" msgstr "" -#: src/util/client.c:1103 +#: src/util/client.c:1104 #, c-format msgid "Need a non-empty hostname for service `%s'.\n" msgstr "" -#: src/util/common_logging.c:259 src/util/common_logging.c:1114 -msgid "DEBUG" -msgstr "FELSÖKNING" +#: src/util/common_logging.c:626 src/util/common_logging.c:665 +#, c-format +msgid "ERROR: Unable to parse log definition: Syntax error at `%s'.\n" +msgstr "" -#: src/util/common_logging.c:261 src/util/common_logging.c:1112 -msgid "INFO" -msgstr "INFO" +#: src/util/common_logging.c:904 +#, c-format +msgid "Message `%.*s' repeated %u times in the last %s\n" +msgstr "" -#: src/util/common_logging.c:263 src/util/common_logging.c:1110 -msgid "MESSAGE" -msgstr "MEDDELANDE" +#: src/util/common_logging.c:1106 +msgid "ERROR" +msgstr "FEL" -#: src/util/common_logging.c:265 src/util/common_logging.c:1108 +#: src/util/common_logging.c:1108 msgid "WARNING" msgstr "VARNING" -#: src/util/common_logging.c:267 src/util/common_logging.c:1106 -msgid "ERROR" -msgstr "FEL" +#: src/util/common_logging.c:1110 +msgid "MESSAGE" +msgstr "MEDDELANDE" -#: src/util/common_logging.c:269 src/util/common_logging.c:1116 -msgid "NONE" -msgstr "" +#: src/util/common_logging.c:1112 +msgid "INFO" +msgstr "INFO" -#: src/util/common_logging.c:626 src/util/common_logging.c:665 -#, c-format -msgid "ERROR: Unable to parse log definition: Syntax error at `%s'.\n" -msgstr "" +#: src/util/common_logging.c:1114 +msgid "DEBUG" +msgstr "FELSÖKNING" -#: src/util/common_logging.c:904 -#, c-format -msgid "Message `%.*s' repeated %u times in the last %s\n" +#: src/util/common_logging.c:1116 +msgid "NONE" msgstr "" #: src/util/common_logging.c:1117 @@ -8385,39 +8441,69 @@ msgid "" "Configuration specifies invalid value for option `%s' in section `%s': %s\n" msgstr "Konfigurationsfil \"%s\" hittades inte. Kör \"gnunet-setup -d\"!\n" -#: src/util/configuration.c:370 +#: src/util/configuration.c:790 +#, c-format +msgid "Illegal directive in line %u (parsing restricted section %s)\n" +msgstr "" + +#: src/util/configuration.c:800 +#, c-format +msgid "Bad directive in line %u\n" +msgstr "" + +#: src/util/configuration.c:853 +#, c-format +msgid "Bad inline-secret directive in line %u\n" +msgstr "" + +#: src/util/configuration.c:875 +#, c-format +msgid "Unknown or malformed directive '%s' in line %u\n" +msgstr "" + +#: src/util/configuration.c:905 +#, fuzzy, c-format +msgid "Syntax error while deserializing in line %u (option without section)\n" +msgstr "Syntaxfel i konfigurationsfil \"%s\" på rad %d.\n" + +#: src/util/configuration.c:949 #, fuzzy, c-format msgid "Syntax error while deserializing in line %u\n" msgstr "Syntaxfel i konfigurationsfil \"%s\" på rad %d.\n" -#: src/util/configuration.c:420 +#: src/util/configuration.c:1049 #, fuzzy, c-format msgid "Error while reading file `%s'\n" msgstr "Fel vid nedladdning: %s\n" -#: src/util/configuration.c:980 +#: src/util/configuration.c:1062 +#, fuzzy, c-format +msgid "Failed to parse configuration file `%s'\n" +msgstr "Kunde inte spara konfigurationsfil \"%s\":" + +#: src/util/configuration.c:1695 #, fuzzy msgid "Not a valid relative time specification" msgstr "Konfigurationsfil \"%s\" skapad.\n" -#: src/util/configuration.c:1050 +#: src/util/configuration.c:1765 #, c-format msgid "" "Configuration value '%s' for '%s' in section '%s' is not in set of legal " "choices\n" msgstr "" -#: src/util/configuration.c:1145 +#: src/util/configuration.c:1860 #, c-format msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n" msgstr "" -#: src/util/configuration.c:1177 +#: src/util/configuration.c:1892 #, fuzzy, c-format msgid "Missing closing `%s' in option `%s'\n" msgstr "Konfigurationsfil \"%s\" skapad.\n" -#: src/util/configuration.c:1243 +#: src/util/configuration.c:1958 #, c-format msgid "" "Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined " @@ -8461,7 +8547,7 @@ msgstr "\"%s\" misslyckades vid %s:%d med fel: \"%s\".\n" msgid "RSA signature verification failed at %s:%d: %s\n" msgstr "\"%s\" misslyckades vid %s:%d med fel: \"%s\".\n" -#: src/util/disk.c:823 +#: src/util/disk.c:843 #, fuzzy, c-format msgid "Expected `%s' to be a directory!\n" msgstr "\"%s\" förväntade att \"%s\" skulle vara en katalog!\n" @@ -8644,61 +8730,71 @@ msgstr "Du måste skicka med ett nummer till flaggan \"%s\".\n" msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" msgstr "" -#: src/util/gnunet-base32.c:45 +#: src/util/gnunet-base32.c:46 msgid "run decoder modus, otherwise runs as encoder" msgstr "" -#: src/util/gnunet-config.c:167 -#, fuzzy, c-format -msgid "failed to load configuration defaults" -msgstr "Kunde inte spara konfigurationsfil \"%s\":" - -#: src/util/gnunet-config.c:179 -#, fuzzy, c-format -msgid "%s or %s argument is required\n" -msgstr "%s: flagga \"%s\" är tvetydig\n" - -#: src/util/gnunet-config.c:186 +#: src/util/gnunet-config.c:187 #, c-format msgid "The following sections are available:\n" msgstr "" -#: src/util/gnunet-config.c:234 +#: src/util/gnunet-config.c:201 +#, fuzzy, c-format +msgid "%s, %s or %s argument is required\n" +msgstr "%s: flagga \"%s\" är tvetydig\n" + +#: src/util/gnunet-config.c:266 #, c-format msgid "--option argument required to set value\n" msgstr "" -#: src/util/gnunet-config.c:284 -msgid "interpret option value as a filename (with $-expansion)" -msgstr "" +#: src/util/gnunet-config.c:309 +#, fuzzy, c-format +msgid "failed to load configuration defaults" +msgstr "Kunde inte spara konfigurationsfil \"%s\":" -#: src/util/gnunet-config.c:291 +#: src/util/gnunet-config.c:354 msgid "test if the current installation supports the specified BACKEND" msgstr "" -#: src/util/gnunet-config.c:297 -msgid "name of the section to access" +#: src/util/gnunet-config.c:360 +#, fuzzy +msgid "write the full configuration file, including default values" +msgstr "Konfigurationsfil \"%s\" skapad.\n" + +#: src/util/gnunet-config.c:365 +msgid "interpret option value as a filename (with $-expansion)" msgstr "" -#: src/util/gnunet-config.c:302 +#: src/util/gnunet-config.c:370 #, fuzzy msgid "name of the option to access" msgstr "Visa värde av alternativet" -#: src/util/gnunet-config.c:307 -msgid "value to set" +#: src/util/gnunet-config.c:376 +#, fuzzy +msgid "rewrite the configuration file, even if nothing changed" +msgstr "använd konfigurationsfil FILNAMN" + +#: src/util/gnunet-config.c:382 +msgid "output extra diagnostics" msgstr "" -#: src/util/gnunet-config.c:312 +#: src/util/gnunet-config.c:387 #, fuzzy msgid "print available configuration sections" msgstr "GNUnet-konfiguration" -#: src/util/gnunet-config.c:318 -msgid "write configuration file that only contains delta to defaults" +#: src/util/gnunet-config.c:393 +msgid "name of the section to access" +msgstr "" + +#: src/util/gnunet-config.c:398 +msgid "value to set" msgstr "" -#: src/util/gnunet-config.c:330 +#: src/util/gnunet-config.c:413 #, fuzzy msgid "Manipulate GNUnet configuration files" msgstr "skriv ut ett värde från konfigurationsfilen till standard ut" @@ -8927,22 +9023,22 @@ msgstr "\"%s\" misslyckades för fil \"%s\" vid %s:%d med fel: %s\n" msgid "`%s' failed for library `%s' with error: %s\n" msgstr "\"%s\" misslyckades vid %s:%d med fel: %s\n" -#: src/util/plugin.c:409 +#: src/util/plugin.c:414 #, fuzzy msgid "Could not determine plugin installation path.\n" msgstr "Kunde inte fastställa min publika IPv6-adress.\n" -#: src/util/program.c:259 +#: src/util/program.c:252 #, fuzzy, c-format msgid "Unreadable or malformed configuration file `%s', exit ...\n" msgstr "Kunde inte spara konfigurationsfil \"%s\":" -#: src/util/program.c:276 +#: src/util/program.c:272 #, fuzzy, c-format msgid "Unreadable or malformed default configuration file `%s', exit ...\n" msgstr "Kunde inte spara konfigurationsfil \"%s\":" -#: src/util/program.c:291 +#: src/util/program.c:288 #, fuzzy msgid "Unreadable or malformed configuration, exit ...\n" msgstr "Kunde inte spara konfigurationsfil \"%s\":" @@ -9009,82 +9105,82 @@ msgstr "" msgid "Attempting to proxy service `%s' to invalid port %d or hostname.\n" msgstr "" -#: src/util/strings.c:503 +#: src/util/strings.c:409 #, c-format msgid "Character sets requested were `%s'->`%s'\n" msgstr "" -#: src/util/strings.c:637 +#: src/util/strings.c:501 msgid "Failed to expand `$HOME': environment variable `HOME' not set" msgstr "" -#: src/util/strings.c:1241 +#: src/util/strings.c:1036 msgid "IPv6 address did not start with `['\n" msgstr "" -#: src/util/strings.c:1249 +#: src/util/strings.c:1044 msgid "IPv6 address did contain ':' to separate port number\n" msgstr "" -#: src/util/strings.c:1256 +#: src/util/strings.c:1051 msgid "IPv6 address did contain ']' before ':' to separate port number\n" msgstr "" -#: src/util/strings.c:1264 +#: src/util/strings.c:1059 msgid "IPv6 address did contain a valid port number after the last ':'\n" msgstr "" -#: src/util/strings.c:1273 +#: src/util/strings.c:1068 #, fuzzy, c-format msgid "Invalid IPv6 address `%s': %s\n" msgstr "Ogiltigt svar på \"%s\".\n" -#: src/util/strings.c:1500 src/util/strings.c:1511 +#: src/util/strings.c:1250 src/util/strings.c:1261 msgid "Port not in range\n" msgstr "" -#: src/util/strings.c:1520 +#: src/util/strings.c:1270 #, fuzzy, c-format msgid "Malformed port policy `%s'\n" msgstr "Misslyckades att starta samling.\n" -#: src/util/strings.c:1603 src/util/strings.c:1632 src/util/strings.c:1679 -#: src/util/strings.c:1699 +#: src/util/strings.c:1341 src/util/strings.c:1370 src/util/strings.c:1417 +#: src/util/strings.c:1437 #, c-format msgid "Invalid format for IP: `%s'\n" msgstr "Ogiltigt format för IP: \"%s\"\n" -#: src/util/strings.c:1657 +#: src/util/strings.c:1395 #, c-format msgid "Invalid network notation ('/%d' is not legal in IPv4 CIDR)." msgstr "Ogiltig nätverksnotation (\"/%d\" är inte giltig i IPv4 CIDR)." -#: src/util/strings.c:1708 +#: src/util/strings.c:1446 #, fuzzy, c-format msgid "Invalid format: `%s'\n" msgstr "Ogiltigt format för IP: \"%s\"\n" -#: src/util/strings.c:1761 +#: src/util/strings.c:1488 #, c-format msgid "Invalid network notation (does not end with ';': `%s')\n" msgstr "Ogiltig nätverksnotation (slutar inte med \";\": \"%s\")\n" -#: src/util/strings.c:1811 +#: src/util/strings.c:1538 #, fuzzy, c-format msgid "Wrong format `%s' for netmask\n" msgstr "Fel format \"%s\" för nätmask: %s\n" -#: src/util/strings.c:1842 +#: src/util/strings.c:1569 #, fuzzy, c-format msgid "Wrong format `%s' for network\n" msgstr "Fel format \"%s\" för nätverk: %s\n" -#: src/util/time.c:878 src/util/time.c:906 +#: src/util/time.c:699 src/util/time.c:727 #, c-format msgid "Failed to map `%s', cannot assure monotonic time!\n" msgstr "" -#: src/util/time.c:914 +#: src/util/time.c:735 #, c-format msgid "" "Failed to setup monotonic time file `%s', cannot assure monotonic time!\n" @@ -9274,6 +9370,18 @@ msgstr "" msgid "Failed to connect to the namestore!\n" msgstr "Misslyckades att ansluta till gnunetd.\n" +#, fuzzy, c-format +#~ msgid "Unsupported form value `%s'\n" +#~ msgstr "Kommando \"%s\" stöds ej. Avbryter.\n" + +#, fuzzy, c-format +#~ msgid "Failed to create page for `%s'\n" +#~ msgstr "Kunde inte skapa namnrymd \"%s\" (existerar?).\n" + +#, fuzzy, c-format +#~ msgid "Failed to setup post processor for `%s'\n" +#~ msgstr "Misslyckades att läsa kompislista från \"%s\"\n" + #, fuzzy, c-format #~ msgid "Unable to parse PKEY record `%s'\n" #~ msgstr "Misslyckades att läsa kompislista från \"%s\"\n" @@ -9698,10 +9806,6 @@ msgstr "Misslyckades att ansluta till gnunetd.\n" #~ "Failed to receive valid response for `%s' request from `%s' service.\n" #~ msgstr "Misslyckades att ta emot svar till \"%s\" meddelande från gnunetd\n" -#, fuzzy -#~ msgid "unknown error" -#~ msgstr "Okänt fel" - #, fuzzy #~ msgid "Invalid response from `fs' service." #~ msgstr "Ogiltigt svar till \"%s\" från \"%s\"\n" @@ -10730,10 +10834,6 @@ msgstr "Misslyckades att ansluta till gnunetd.\n" #~ msgid "Connected to %s service!\n" #~ msgstr "\"%s\" ansluten till \"%s\".\n" -#, fuzzy -#~ msgid "Configuration fails to specify `%s', assuming default value." -#~ msgstr "Konfigurationsfil \"%s\" skapad.\n" - #, fuzzy #~ msgid "Option `%s' not specified in configuration section `%s'\n" #~ msgstr "Inga applikationer definierade i konfiguration!\n" @@ -11442,9 +11542,6 @@ msgstr "Misslyckades att ansluta till gnunetd.\n" #~ "använd libextractor för att lägga till ytterligare direktreferenser till " #~ "katalogposter" -#~ msgid "Created entry `%s' in namespace `%s'\n" -#~ msgstr "Skapade post \"%s\" i namnrymd \"%s\"\n" - #, fuzzy #~ msgid "" #~ "%16llu of %16llu bytes inserted (estimating %6s to completion) - %s\n" diff --git a/po/vi.po b/po/vi.po index f4c284355..a8463597c 100644 --- a/po/vi.po +++ b/po/vi.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: gnunet 0.8.0a\n" "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" -"POT-Creation-Date: 2021-04-04 19:19+0200\n" +"POT-Creation-Date: 2021-08-08 18:36+0200\n" "PO-Revision-Date: 2008-09-10 22:05+0930\n" "Last-Translator: Clytie Siddall \n" "Language-Team: Vietnamese \n" @@ -31,7 +31,7 @@ msgstr "Đối số không hợp lệ cho « %s ».\n" #: src/abd/gnunet-abd.c:560 src/abd/gnunet-service-abd.c:1747 #: src/namestore/gnunet-namestore.c:1001 -#: src/namestore/gnunet-namestore-fcfsd.c:1164 +#: src/namestore/gnunet-namestore-fcfsd.c:1067 #, fuzzy, c-format msgid "Failed to connect to namestore\n" msgstr "Không kết nối được đến trình nền gnunetd." @@ -773,7 +773,7 @@ msgstr "" #: src/auction/gnunet-auction-info.c:77 src/auction/gnunet-auction-join.c:77 #: src/conversation/gnunet-conversation-test.c:256 -#: src/revocation/gnunet-revocation.c:564 src/template/gnunet-template.c:75 +#: src/revocation/gnunet-revocation.c:570 src/template/gnunet-template.c:75 msgid "help text" msgstr "" @@ -1144,7 +1144,7 @@ msgstr "" #, c-format msgid "" "\n" -"We are now playing your recording back. If you can hear it, your audio " +"ew are now playing your recording back. If you can hear it, your audio " "settings are working..." msgstr "" @@ -1602,42 +1602,42 @@ msgstr "# các thông báo phát hiện dht được nhận" msgid "# updates to my type map" msgstr "" -#: src/datacache/datacache.c:115 src/datacache/datacache.c:287 +#: src/datacache/datacache.c:115 src/datacache/datacache.c:299 #: src/datastore/gnunet-service-datastore.c:742 #, fuzzy msgid "# bytes stored" msgstr "# các byte trong kho dữ liệu" -#: src/datacache/datacache.c:119 src/datacache/datacache.c:291 +#: src/datacache/datacache.c:119 src/datacache/datacache.c:303 #, fuzzy msgid "# items stored" msgstr "# các byte trong kho dữ liệu" -#: src/datacache/datacache.c:189 +#: src/datacache/datacache.c:190 #, c-format msgid "Loading `%s' datacache plugin\n" msgstr "" -#: src/datacache/datacache.c:197 +#: src/datacache/datacache.c:208 #, fuzzy, c-format msgid "Failed to load datacache plugin for `%s'\n" msgstr "Lỗi cập nhật dữ liệu cho mô-đun « %s »\n" -#: src/datacache/datacache.c:320 +#: src/datacache/datacache.c:332 #, fuzzy msgid "# requests received" msgstr "# các yêu cầu get (lấy) dht được nhận" -#: src/datacache/datacache.c:331 +#: src/datacache/datacache.c:343 msgid "# requests filtered by bloom filter" msgstr "# các yêu cầu được lọc theo bộ lọc bloom" -#: src/datacache/datacache.c:358 +#: src/datacache/datacache.c:370 #, fuzzy msgid "# requests for random value received" msgstr "# tổng số yêu cầu lỗ hổng được nhận" -#: src/datacache/datacache.c:388 +#: src/datacache/datacache.c:400 #, fuzzy msgid "# proximity search requests received" msgstr "# các yêu cầu khách lỗ hổng được nhận" @@ -1996,7 +1996,7 @@ msgstr "" #: src/datastore/plugin_datastore_postgres.c:284 #: src/datastore/plugin_datastore_postgres.c:897 -msgid "Postgress exec failure" +msgid "Postgresql exec failure" msgstr "" #: src/datastore/plugin_datastore_postgres.c:858 @@ -2034,14 +2034,25 @@ msgstr "" msgid "sqlite version to old to determine size, assuming zero\n" msgstr "" -#: src/datastore/plugin_datastore_sqlite.c:1274 +#: src/datastore/plugin_datastore_sqlite.c:1266 +#: src/datastore/plugin_datastore_sqlite.c:1279 +#, fuzzy +msgid "error preparing statement\n" +msgstr "Hoàn thành tạo khoá.\n" + +#: src/datastore/plugin_datastore_sqlite.c:1287 +#, fuzzy +msgid "error stepping\n" +msgstr "# các byte trong kho dữ liệu" + +#: src/datastore/plugin_datastore_sqlite.c:1295 #, c-format msgid "" "Using sqlite page utilization to estimate payload (%llu pages of size %llu " "bytes)\n" msgstr "" -#: src/datastore/plugin_datastore_sqlite.c:1316 +#: src/datastore/plugin_datastore_sqlite.c:1337 #: src/namecache/plugin_namecache_sqlite.c:564 #: src/namestore/plugin_namestore_sqlite.c:765 #, fuzzy @@ -2296,102 +2307,102 @@ msgstr "# các thông báo PING được tạo" msgid "# requests TTL-dropped" msgstr "# các yêu cầu get (lấy) dht được nhận" -#: src/dht/gnunet-service-dht_neighbours.c:1052 -#: src/dht/gnunet-service-dht_neighbours.c:1096 +#: src/dht/gnunet-service-dht_neighbours.c:1035 +#: src/dht/gnunet-service-dht_neighbours.c:1072 msgid "# Peers excluded from routing due to Bloomfilter" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1069 -#: src/dht/gnunet-service-dht_neighbours.c:1112 +#: src/dht/gnunet-service-dht_neighbours.c:1045 +#: src/dht/gnunet-service-dht_neighbours.c:1088 #, fuzzy msgid "# Peer selection failed" msgstr "# các cuộc gọi HTTP select (lựa chọn)" -#: src/dht/gnunet-service-dht_neighbours.c:1270 +#: src/dht/gnunet-service-dht_neighbours.c:1246 #, fuzzy msgid "# PUT requests routed" msgstr "# các yêu cầu dht được định tuyến" -#: src/dht/gnunet-service-dht_neighbours.c:1304 +#: src/dht/gnunet-service-dht_neighbours.c:1280 #, fuzzy msgid "# PUT messages queued for transmission" msgstr "# các thông báo PING được tạo" -#: src/dht/gnunet-service-dht_neighbours.c:1316 -#: src/dht/gnunet-service-dht_neighbours.c:1458 -#: src/dht/gnunet-service-dht_neighbours.c:1562 +#: src/dht/gnunet-service-dht_neighbours.c:1292 +#: src/dht/gnunet-service-dht_neighbours.c:1434 +#: src/dht/gnunet-service-dht_neighbours.c:1538 #, fuzzy msgid "# P2P messages dropped due to full queue" msgstr "# các yêu cầu lỗ hổng bị bỏ do trọng tải" -#: src/dht/gnunet-service-dht_neighbours.c:1401 +#: src/dht/gnunet-service-dht_neighbours.c:1377 #, fuzzy msgid "# GET requests routed" msgstr "# các yêu cầu dht được định tuyến" -#: src/dht/gnunet-service-dht_neighbours.c:1445 +#: src/dht/gnunet-service-dht_neighbours.c:1421 #, fuzzy msgid "# GET messages queued for transmission" msgstr "# các thông báo PING được tạo" -#: src/dht/gnunet-service-dht_neighbours.c:1577 +#: src/dht/gnunet-service-dht_neighbours.c:1553 #, fuzzy msgid "# RESULT messages queued for transmission" msgstr "# các thông báo PING được tạo" -#: src/dht/gnunet-service-dht_neighbours.c:1680 +#: src/dht/gnunet-service-dht_neighbours.c:1656 msgid "# Expired PUTs discarded" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1688 +#: src/dht/gnunet-service-dht_neighbours.c:1664 #, fuzzy msgid "# P2P PUT requests received" msgstr "# các yêu cầu get (lấy) dht được nhận" -#: src/dht/gnunet-service-dht_neighbours.c:1692 +#: src/dht/gnunet-service-dht_neighbours.c:1668 #, fuzzy msgid "# P2P PUT bytes received" msgstr "# các yêu cầu get (lấy) dht được nhận" -#: src/dht/gnunet-service-dht_neighbours.c:1924 +#: src/dht/gnunet-service-dht_neighbours.c:1900 #, fuzzy msgid "# FIND PEER requests ignored due to Bloomfilter" msgstr "# các yêu cầu được lọc theo bộ lọc bloom" -#: src/dht/gnunet-service-dht_neighbours.c:1933 +#: src/dht/gnunet-service-dht_neighbours.c:1909 msgid "# FIND PEER requests ignored due to lack of HELLO" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:2096 +#: src/dht/gnunet-service-dht_neighbours.c:2072 #, fuzzy msgid "# P2P GET requests received" msgstr "# các yêu cầu get (lấy) dht được nhận" -#: src/dht/gnunet-service-dht_neighbours.c:2100 +#: src/dht/gnunet-service-dht_neighbours.c:2076 #, fuzzy msgid "# P2P GET bytes received" msgstr "# các yêu cầu get (lấy) dht được nhận" -#: src/dht/gnunet-service-dht_neighbours.c:2166 +#: src/dht/gnunet-service-dht_neighbours.c:2142 #, fuzzy msgid "# P2P FIND PEER requests processed" msgstr "# các yêu cầu get (lấy) dht được nhận" -#: src/dht/gnunet-service-dht_neighbours.c:2187 +#: src/dht/gnunet-service-dht_neighbours.c:2163 #, fuzzy msgid "# P2P GET requests ONLY routed" msgstr "# các yêu cầu dht được định tuyến" -#: src/dht/gnunet-service-dht_neighbours.c:2365 +#: src/dht/gnunet-service-dht_neighbours.c:2341 msgid "# Expired results discarded" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:2382 +#: src/dht/gnunet-service-dht_neighbours.c:2358 #, fuzzy msgid "# P2P RESULTS received" msgstr "# Tín hiệu HTTP PUT được nhận" -#: src/dht/gnunet-service-dht_neighbours.c:2386 +#: src/dht/gnunet-service-dht_neighbours.c:2362 #, fuzzy msgid "# P2P RESULT bytes received" msgstr "# Tín hiệu HTTP PUT được nhận" @@ -2875,7 +2886,7 @@ msgstr "" #: src/fs/fs_download.c:346 #, fuzzy, c-format msgid "" -"Failed to access full directroy contents of `%s' for recursive download\n" +"Failed to access full directory contents of `%s' for recursive download\n" msgstr "Lỗi cập nhật dữ liệu cho mô-đun « %s »\n" #: src/fs/fs_download.c:528 src/fs/fs_download.c:541 @@ -4172,7 +4183,7 @@ msgstr "" msgid "GNUnet GNS resolver tool" msgstr "Bản ghi lỗi GNUnet" -#: src/gns/gnunet-gns-import.c:491 +#: src/gns/gnunet-gns-import.c:490 msgid "This program will import some GNS authorities into your GNS namestore." msgstr "" @@ -4874,52 +4885,52 @@ msgstr "Không thể tạo miền tên.\n" msgid "Failed to set default ego: %s\n" msgstr "Không thể tạo miền tên.\n" -#: src/identity/gnunet-identity.c:462 +#: src/identity/gnunet-identity.c:461 msgid "create ego NAME" msgstr "" -#: src/identity/gnunet-identity.c:467 +#: src/identity/gnunet-identity.c:466 msgid "delete ego NAME " msgstr "" -#: src/identity/gnunet-identity.c:473 +#: src/identity/gnunet-identity.c:472 msgid "" "set the private key for the identity to PRIVATE_KEY (use together with -C)" msgstr "" -#: src/identity/gnunet-identity.c:478 +#: src/identity/gnunet-identity.c:477 msgid "generate an EdDSA identity. (use together with -C) EXPERIMENTAL" msgstr "" -#: src/identity/gnunet-identity.c:482 +#: src/identity/gnunet-identity.c:481 msgid "display all egos" msgstr "" -#: src/identity/gnunet-identity.c:486 +#: src/identity/gnunet-identity.c:485 msgid "reduce output" msgstr "" -#: src/identity/gnunet-identity.c:493 +#: src/identity/gnunet-identity.c:492 msgid "" "set default identity to NAME for a subsystem SUBSYSTEM (use together with -" "s) or restrict results to NAME (use together with -d)" msgstr "" -#: src/identity/gnunet-identity.c:497 +#: src/identity/gnunet-identity.c:496 msgid "run in monitor mode egos" msgstr "" -#: src/identity/gnunet-identity.c:501 +#: src/identity/gnunet-identity.c:500 #, fuzzy msgid "display private keys as well" msgstr "hiển thị giá trị tổng kiểm của tập tin" -#: src/identity/gnunet-identity.c:508 +#: src/identity/gnunet-identity.c:507 msgid "" "set default identity to EGO for a subsystem SUBSYSTEM (use together with -e)" msgstr "" -#: src/identity/gnunet-identity.c:523 +#: src/identity/gnunet-identity.c:522 msgid "Maintain egos" msgstr "" @@ -4975,7 +4986,7 @@ msgstr "Lỗi đọc danh sách bạn bè từ « %s »\n" msgid "Identity REST API initialized\n" msgstr "Lỗi sơ khởi lõi.\n" -#: src/json/json.c:139 +#: src/json/json.c:119 #, fuzzy, c-format msgid "Failed to parse JSON in option `%s': %s (%s)\n" msgstr "Lỗi đọc danh sách bạn bè từ « %s »\n" @@ -5319,73 +5330,113 @@ msgstr "" msgid "name of the ego controlling the zone" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:552 -#, fuzzy, c-format -msgid "Unsupported form value `%s'\n" -msgstr "Lệnh không được hỗ trợ « %s ». Đang hủy bỏ.\n" +#: src/namestore/gnunet-namestore-fcfsd.c:359 +#, fuzzy +msgid "can not search the namestore" +msgstr "Không kết nối được đến trình nền gnunetd." -#: src/namestore/gnunet-namestore-fcfsd.c:579 +#: src/namestore/gnunet-namestore-fcfsd.c:413 +#: src/namestore/gnunet-namestore-fcfsd.c:554 +#, fuzzy +msgid "unable to scan namestore" +msgstr "Không kết nối được đến trình nền gnunetd." + +#: src/namestore/gnunet-namestore-fcfsd.c:441 #, fuzzy, c-format -msgid "Failed to create record for domain `%s': %s\n" +msgid "Failed to create record for `%s': %s\n" msgstr "Không thể truy cập đến tập tin gnunet-directory « %s »\n" -#: src/namestore/gnunet-namestore-fcfsd.c:600 -msgid "Error when mapping zone to name\n" -msgstr "" +#: src/namestore/gnunet-namestore-fcfsd.c:453 +#, fuzzy +msgid "no errors" +msgstr "Lỗi không rõ" -#: src/namestore/gnunet-namestore-fcfsd.c:633 -#, c-format -msgid "Found existing name `%s' for the given key\n" +#: src/namestore/gnunet-namestore-fcfsd.c:489 +#, fuzzy, c-format +msgid "The requested key `%s' exists as `%s'\n" +msgstr "Đã tạo mục nhập « %s » trong không gian tên « %s »\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:496 +msgid "key exists" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:646 +#: src/namestore/gnunet-namestore-fcfsd.c:513 #, fuzzy -msgid "Error creating record data.\n" +msgid "Error creating record data\n" msgstr "=\tLỗi đọc thư mục.\n" -#: src/namestore/gnunet-namestore-fcfsd.c:707 +#: src/namestore/gnunet-namestore-fcfsd.c:517 +#, fuzzy +msgid "unable to store record" +msgstr "Lỗi bắt đầu thu thập.\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:588 #, c-format -msgid "Found %u existing records for domain `%s'\n" +msgid "Requested name `%s' exists with `%u' records\n" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:796 -#, fuzzy, c-format -msgid "Failed to create page for `%s'\n" -msgstr "Không thể tạo miền tên.\n" - -#: src/namestore/gnunet-namestore-fcfsd.c:815 -#, fuzzy, c-format -msgid "Failed to setup post processor for `%s'\n" -msgstr "Lỗi cập nhật dữ liệu cho mô-đun « %s »\n" +#: src/namestore/gnunet-namestore-fcfsd.c:594 +msgid "name exists\n" +msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:850 -msgid "Domain name must not contain `.'\n" +#: src/namestore/gnunet-namestore-fcfsd.c:780 +msgid "unable to process submitted data" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:859 -msgid "Domain name must not contain `+'\n" +#: src/namestore/gnunet-namestore-fcfsd.c:787 +msgid "the submitted data is invalid" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:1094 +#: src/namestore/gnunet-namestore-fcfsd.c:806 +#, fuzzy +msgid "invalid parameters" +msgstr "Đối số không hợp lệ cho « %s ».\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:823 +#, fuzzy +msgid "invalid name" +msgstr "Đối số không hợp lệ cho « %s ».\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:834 +#, fuzzy, c-format +msgid "Unable to parse key %s\n" +msgstr "Lỗi đọc danh sách bạn bè từ « %s »\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:838 +#, fuzzy +msgid "unable to parse key" +msgstr "Lỗi đọc danh sách bạn bè từ « %s »\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:949 msgid "No ego configured for `fcfsd` subsystem\n" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:1125 +#: src/namestore/gnunet-namestore-fcfsd.c:974 #, fuzzy msgid "Failed to start HTTP server\n" msgstr "Lỗi bắt đầu thu thập.\n" -#: src/namestore/gnunet-namestore-fcfsd.c:1173 +#: src/namestore/gnunet-namestore-fcfsd.c:1058 +#, fuzzy +msgid "No port specified, using default value\n" +msgstr "Tập tin cấu hình « %s » đã được ghi.\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:1076 #, fuzzy msgid "Failed to connect to identity\n" msgstr "Lỗi kết nối đến gnunetd.\n" -#: src/namestore/gnunet-namestore-fcfsd.c:1200 -msgid "name of the zone that is to be managed by FCFSD" +#: src/namestore/gnunet-namestore-fcfsd.c:1100 +#, fuzzy +msgid "Unable to set up the daemon\n" +msgstr "Không thể tạo tài khoản người dùng cho trình nền." + +#: src/namestore/gnunet-namestore-fcfsd.c:1123 +msgid "name of the zone managed by FCFSD" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:1220 -msgid "GNU Name System First Come First Serve name registration service" +#: src/namestore/gnunet-namestore-fcfsd.c:1132 +msgid "GNU Name System First-Come-First-Served name registration service" msgstr "" #: src/namestore/gnunet-service-namestore.c:871 @@ -5393,11 +5444,11 @@ msgstr "" msgid "Failed to replicate block in namecache: %s\n" msgstr "Lỗi cập nhật dữ liệu cho mô-đun « %s »\n" -#: src/namestore/gnunet-zoneimport.c:1848 +#: src/namestore/gnunet-zoneimport.c:1847 msgid "size to use for the main hash map" msgstr "" -#: src/namestore/gnunet-zoneimport.c:1854 +#: src/namestore/gnunet-zoneimport.c:1853 msgid "minimum expiration time we assume for imported records" msgstr "" @@ -5420,7 +5471,7 @@ msgstr "" msgid "Flat file database running\n" msgstr "kho dữ liệu sqlite" -#: src/namestore/plugin_rest_namestore.c:1105 +#: src/namestore/plugin_rest_namestore.c:1111 #, fuzzy msgid "Namestore REST API initialized\n" msgstr "Lỗi sơ khởi lõi.\n" @@ -6094,12 +6145,12 @@ msgstr "" msgid "re:claimID command line tool" msgstr "" -#: src/reclaim/plugin_rest_openid_connect.c:2788 +#: src/reclaim/plugin_rest_openid_connect.c:2793 #, fuzzy msgid "OpenID Connect REST API initialized\n" msgstr "Lỗi sơ khởi lõi.\n" -#: src/reclaim/plugin_rest_reclaim.c:1521 +#: src/reclaim/plugin_rest_pabc.c:637 src/reclaim/plugin_rest_reclaim.c:1520 #, fuzzy msgid "Identity Provider REST API initialized\n" msgstr "Lỗi sơ khởi lõi.\n" @@ -6118,61 +6169,61 @@ msgstr "Lưu cấu hình ngay bây giờ không?" msgid "Daemon to announce regular expressions for the peer using cadet." msgstr "" -#: src/regex/gnunet-regex-profiler.c:1390 +#: src/regex/gnunet-regex-profiler.c:1392 #, fuzzy msgid "No configuration file given. Exiting\n" msgstr "dùng tập tin cấu hình TÊN_TẬP_TIN" -#: src/regex/gnunet-regex-profiler.c:1432 +#: src/regex/gnunet-regex-profiler.c:1434 #: src/regex/gnunet-regex-simulation-profiler.c:631 #, c-format msgid "No policy directory specified on command line. Exiting.\n" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1438 +#: src/regex/gnunet-regex-profiler.c:1440 #: src/regex/gnunet-regex-simulation-profiler.c:639 #, c-format msgid "Specified policies directory does not exist. Exiting.\n" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1446 +#: src/regex/gnunet-regex-profiler.c:1448 #, fuzzy, c-format msgid "No files found in `%s'\n" msgstr "Vẫn còn không tìm thấy đồng đẳng trong « %s ».\n" -#: src/regex/gnunet-regex-profiler.c:1455 +#: src/regex/gnunet-regex-profiler.c:1457 msgid "No search strings file given. Exiting.\n" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1475 +#: src/regex/gnunet-regex-profiler.c:1477 #, fuzzy msgid "Error loading search strings. Exiting.\n" msgstr "Gặp lỗi khi tải xuống: %s\n" -#: src/regex/gnunet-regex-profiler.c:1563 +#: src/regex/gnunet-regex-profiler.c:1565 #, fuzzy msgid "name of the file for writing statistics" msgstr "Lỗi lấy thông kê về truyền tải.\n" -#: src/regex/gnunet-regex-profiler.c:1570 +#: src/regex/gnunet-regex-profiler.c:1572 msgid "wait TIMEOUT before ending the experiment" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1576 +#: src/regex/gnunet-regex-profiler.c:1578 msgid "directory with policy files" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1584 +#: src/regex/gnunet-regex-profiler.c:1586 #, fuzzy msgid "name of file with input strings" msgstr "Lỗi lấy thông kê về truyền tải.\n" -#: src/regex/gnunet-regex-profiler.c:1591 +#: src/regex/gnunet-regex-profiler.c:1593 #, fuzzy msgid "name of file with hosts' names" msgstr "Lỗi lấy thông kê về truyền tải.\n" -#: src/regex/gnunet-regex-profiler.c:1604 +#: src/regex/gnunet-regex-profiler.c:1606 msgid "Profiler for regex" msgstr "" @@ -6198,12 +6249,12 @@ msgstr "« %s » không phải là một tập tin.\n" msgid "Search string `%s' is too long!\n" msgstr "« %s » không phải là một tập tin.\n" -#: src/rest/gnunet-rest-server.c:1266 +#: src/rest/gnunet-rest-server.c:1267 #, fuzzy msgid "GNUnet REST server" msgstr "Bản ghi lỗi GNUnet" -#: src/rest/plugin_rest_config.c:427 +#: src/rest/plugin_rest_config.c:428 #, fuzzy msgid "CONFIG REST API initialized\n" msgstr "Lỗi sơ khởi lõi.\n" @@ -6270,72 +6321,77 @@ msgstr "" msgid "Ego `%s' not found.\n" msgstr "Khoá phiên chạy từ đồng đẳng « %s » không thể được thẩm tra.\n" -#: src/revocation/gnunet-revocation.c:351 +#: src/revocation/gnunet-revocation.c:350 +#, fuzzy, c-format +msgid "Error: Key is invalid\n" +msgstr "Định dạng của biệt hiệu « %s » là không hợp lệ.\n" + +#: src/revocation/gnunet-revocation.c:357 #, c-format msgid "Error: revocation certificate in `%s' is not for `%s'\n" msgstr "" -#: src/revocation/gnunet-revocation.c:361 +#: src/revocation/gnunet-revocation.c:367 msgid "Revocation certificate ready\n" msgstr "" -#: src/revocation/gnunet-revocation.c:373 +#: src/revocation/gnunet-revocation.c:379 msgid "Continuing calculation where left off...\n" msgstr "" -#: src/revocation/gnunet-revocation.c:380 +#: src/revocation/gnunet-revocation.c:386 msgid "Revocation certificate not ready, calculating proof of work\n" msgstr "" -#: src/revocation/gnunet-revocation.c:418 +#: src/revocation/gnunet-revocation.c:424 #, fuzzy, c-format msgid "Public key `%s' malformed\n" msgstr "Đối số không hợp lệ cho « %s ».\n" -#: src/revocation/gnunet-revocation.c:428 +#: src/revocation/gnunet-revocation.c:434 msgid "" "Testing and revoking at the same time is not allowed, only executing test.\n" msgstr "" -#: src/revocation/gnunet-revocation.c:458 +#: src/revocation/gnunet-revocation.c:464 #, fuzzy msgid "No filename to store revocation certificate given.\n" msgstr "Lỗi đọc danh sách bạn bè từ « %s »\n" -#: src/revocation/gnunet-revocation.c:475 +#: src/revocation/gnunet-revocation.c:481 #, fuzzy, c-format msgid "Failed to read revocation certificate from `%s'\n" msgstr "Lỗi đọc danh sách bạn bè từ « %s »\n" -#: src/revocation/gnunet-revocation.c:483 +#: src/revocation/gnunet-revocation.c:489 #, fuzzy, c-format msgid "Revocation certificate corrupted in `%s'\n" msgstr "Lỗi đọc danh sách bạn bè từ « %s »\n" -#: src/revocation/gnunet-revocation.c:505 +#: src/revocation/gnunet-revocation.c:511 #, fuzzy msgid "No action specified. Nothing to do.\n" msgstr "Chưa xác định giao diện nên dùng mặc định.\n" -#: src/revocation/gnunet-revocation.c:524 +#: src/revocation/gnunet-revocation.c:530 msgid "use NAME for the name of the revocation file" msgstr "" -#: src/revocation/gnunet-revocation.c:532 +#: src/revocation/gnunet-revocation.c:538 msgid "" "revoke the private key associated for the the private key associated with " "the ego NAME " msgstr "" -#: src/revocation/gnunet-revocation.c:539 +#: src/revocation/gnunet-revocation.c:545 msgid "actually perform revocation, otherwise we just do the precomputation" msgstr "" -#: src/revocation/gnunet-revocation.c:546 +#: src/revocation/gnunet-revocation.c:552 msgid "test if the public key KEY has been revoked" msgstr "" -#: src/revocation/gnunet-revocation.c:552 +#: src/revocation/gnunet-revocation.c:558 #, fuzzy msgid "number of epochs to calculate for" msgstr "số lần lặp lại" @@ -6463,12 +6519,12 @@ msgstr "" #: src/scalarproduct/gnunet-service-scalarproduct_alice.c:1358 #: src/scalarproduct/gnunet-service-scalarproduct_bob.c:1355 #: src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c:1118 -#: src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c:1063 +#: src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c:1034 #, fuzzy msgid "Connect to CADET failed\n" msgstr " Không kết nối được (lỗi ?)\n" -#: src/scalarproduct/scalarproduct_api.c:189 +#: src/scalarproduct/scalarproduct_api.c:184 msgid "Keys given to SCALARPRODUCT not unique!\n" msgstr "" @@ -6489,7 +6545,7 @@ msgid "also profile decryption" msgstr "" #: src/set/gnunet-service-set.c:1916 src/seti/gnunet-service-seti.c:2467 -#: src/setu/gnunet-service-setu.c:3832 +#: src/setu/gnunet-service-setu.c:5395 #, fuzzy msgid "Could not connect to CADET service\n" msgstr "Không thể kết nối tới %s:%u: %s\n" @@ -6733,7 +6789,7 @@ msgid "" "\t cap: the maximum number of links a node can have\n" "\t m: the number of links a node should have while joining the network\n" "\t filename: the path of the file which contains topology information\n" -"NOTE: the format of the above file is descibed here: https://www.gnunet.org/" +"NOTE: the format of the above file is described here: https://www.gnunet.org/" "content/topology-file-format\n" msgstr "" @@ -6829,7 +6885,7 @@ msgid "Spawning process `%s'\n" msgstr "Đang bắt đầu tài về « %s »\n" #: src/testbed/gnunet-testbed-profiler.c:290 -msgid "tolerate COUNT number of continious timeout failures" +msgid "tolerate COUNT number of continuous timeout failures" msgstr "" #: src/testbed/gnunet-testbed-profiler.c:295 @@ -7141,15 +7197,15 @@ msgstr "# các thông báo PONG đã mật mã được nhận" msgid "GNUnet topology control" msgstr "" -#: src/transport/gnunet-communicator-tcp.c:3331 +#: src/transport/gnunet-communicator-tcp.c:3314 #: src/transport/gnunet-communicator-udp.c:3790 -#: src/transport/gnunet-service-tng.c:10220 +#: src/transport/gnunet-service-tng.c:10223 #: src/transport/gnunet-service-transport.c:2627 #, fuzzy msgid "Transport service is lacking key configuration settings. Exiting.\n" msgstr "Lưu cấu hình ngay bây giờ không?" -#: src/transport/gnunet-communicator-tcp.c:3668 +#: src/transport/gnunet-communicator-tcp.c:3652 msgid "GNUnet TCP communicator" msgstr "" @@ -8255,7 +8311,7 @@ msgstr "" msgid "Service process failed to report status\n" msgstr "" -#: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1040 +#: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1220 #: src/util/service.c:1637 #, c-format msgid "Cannot obtain information about user `%s': %s\n" @@ -8374,39 +8430,15 @@ msgstr "Địa chỉ IP định dạng sai: %s\n" msgid "Failed to serialize metadata `%s'" msgstr "Lỗi lấy thông kê về truyền tải.\n" -#: src/util/client.c:747 src/util/client.c:937 +#: src/util/client.c:747 src/util/client.c:938 msgid "not a valid filename" msgstr "" -#: src/util/client.c:1103 +#: src/util/client.c:1104 #, c-format msgid "Need a non-empty hostname for service `%s'.\n" msgstr "" -#: src/util/common_logging.c:259 src/util/common_logging.c:1114 -msgid "DEBUG" -msgstr "GỠ LỖI" - -#: src/util/common_logging.c:261 src/util/common_logging.c:1112 -msgid "INFO" -msgstr "TIN" - -#: src/util/common_logging.c:263 src/util/common_logging.c:1110 -msgid "MESSAGE" -msgstr "" - -#: src/util/common_logging.c:265 src/util/common_logging.c:1108 -msgid "WARNING" -msgstr "CẢNH BÁO" - -#: src/util/common_logging.c:267 src/util/common_logging.c:1106 -msgid "ERROR" -msgstr "LỖI" - -#: src/util/common_logging.c:269 src/util/common_logging.c:1116 -msgid "NONE" -msgstr "" - #: src/util/common_logging.c:626 src/util/common_logging.c:665 #, c-format msgid "ERROR: Unable to parse log definition: Syntax error at `%s'.\n" @@ -8417,6 +8449,30 @@ msgstr "" msgid "Message `%.*s' repeated %u times in the last %s\n" msgstr "Thông điệp « %.*s » đã lặp lại %u lần trong %llu giây trước\n" +#: src/util/common_logging.c:1106 +msgid "ERROR" +msgstr "LỖI" + +#: src/util/common_logging.c:1108 +msgid "WARNING" +msgstr "CẢNH BÁO" + +#: src/util/common_logging.c:1110 +msgid "MESSAGE" +msgstr "" + +#: src/util/common_logging.c:1112 +msgid "INFO" +msgstr "TIN" + +#: src/util/common_logging.c:1114 +msgid "DEBUG" +msgstr "GỠ LỖI" + +#: src/util/common_logging.c:1116 +msgid "NONE" +msgstr "" + #: src/util/common_logging.c:1117 msgid "INVALID" msgstr "" @@ -8442,22 +8498,52 @@ msgid "" msgstr "" "Cấu hình không thỏa mãn các ràng buộc của tập tin đặc tả cấu hình « %s ».\n" -#: src/util/configuration.c:370 +#: src/util/configuration.c:790 +#, c-format +msgid "Illegal directive in line %u (parsing restricted section %s)\n" +msgstr "" + +#: src/util/configuration.c:800 +#, c-format +msgid "Bad directive in line %u\n" +msgstr "" + +#: src/util/configuration.c:853 +#, c-format +msgid "Bad inline-secret directive in line %u\n" +msgstr "" + +#: src/util/configuration.c:875 +#, c-format +msgid "Unknown or malformed directive '%s' in line %u\n" +msgstr "" + +#: src/util/configuration.c:905 +#, fuzzy, c-format +msgid "Syntax error while deserializing in line %u (option without section)\n" +msgstr "Gặp lỗi cú pháp trong tập tin cấu hình « %s » tại dòng %d.\n" + +#: src/util/configuration.c:949 #, fuzzy, c-format msgid "Syntax error while deserializing in line %u\n" msgstr "Gặp lỗi cú pháp trong tập tin cấu hình « %s » tại dòng %d.\n" -#: src/util/configuration.c:420 +#: src/util/configuration.c:1049 #, fuzzy, c-format msgid "Error while reading file `%s'\n" msgstr "Gặp lỗi khi tải xuống: %s\n" -#: src/util/configuration.c:980 +#: src/util/configuration.c:1062 +#, fuzzy, c-format +msgid "Failed to parse configuration file `%s'\n" +msgstr "Không thể lưu tập tin cấu hình « %s »:" + +#: src/util/configuration.c:1695 #, fuzzy msgid "Not a valid relative time specification" msgstr "Giá trị cấu hình « %s » cho « %s » trong phần « %s » nên là con số\n" -#: src/util/configuration.c:1050 +#: src/util/configuration.c:1765 #, c-format msgid "" "Configuration value '%s' for '%s' in section '%s' is not in set of legal " @@ -8466,17 +8552,17 @@ msgstr "" "Giá trị cấu hình « %s » cho « %s » trong phần « %s » không phải nằm trong " "tập hợp các sự chọn được phép\n" -#: src/util/configuration.c:1145 +#: src/util/configuration.c:1860 #, c-format msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n" msgstr "" -#: src/util/configuration.c:1177 +#: src/util/configuration.c:1892 #, fuzzy, c-format msgid "Missing closing `%s' in option `%s'\n" msgstr "Giá trị cấu hình « %s » cho « %s » trong phần « %s » nên là con số\n" -#: src/util/configuration.c:1243 +#: src/util/configuration.c:1958 #, c-format msgid "" "Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined " @@ -8520,7 +8606,7 @@ msgstr "%s bị lỗi tại %s:%d: « %s »\n" msgid "RSA signature verification failed at %s:%d: %s\n" msgstr "Lỗi thẩm tra chữ ký RSA tại %s:%d: %s\n" -#: src/util/disk.c:823 +#: src/util/disk.c:843 #, c-format msgid "Expected `%s' to be a directory!\n" msgstr "Mong đợi « %s » là một thư mục.\n" @@ -8705,60 +8791,70 @@ msgstr "Phải gửi một con số cho tùy chọn « %s ».\n" msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" msgstr "" -#: src/util/gnunet-base32.c:45 +#: src/util/gnunet-base32.c:46 msgid "run decoder modus, otherwise runs as encoder" msgstr "" -#: src/util/gnunet-config.c:167 -#, fuzzy, c-format -msgid "failed to load configuration defaults" -msgstr "Không thể lưu tập tin cấu hình « %s »:" - -#: src/util/gnunet-config.c:179 -#, fuzzy, c-format -msgid "%s or %s argument is required\n" -msgstr "đặt tên hiệu cần dùng (cần thiết)" - -#: src/util/gnunet-config.c:186 +#: src/util/gnunet-config.c:187 #, c-format msgid "The following sections are available:\n" msgstr "" -#: src/util/gnunet-config.c:234 +#: src/util/gnunet-config.c:201 +#, fuzzy, c-format +msgid "%s, %s or %s argument is required\n" +msgstr "đặt tên hiệu cần dùng (cần thiết)" + +#: src/util/gnunet-config.c:266 #, c-format msgid "--option argument required to set value\n" msgstr "" -#: src/util/gnunet-config.c:284 -msgid "interpret option value as a filename (with $-expansion)" -msgstr "" +#: src/util/gnunet-config.c:309 +#, fuzzy, c-format +msgid "failed to load configuration defaults" +msgstr "Không thể lưu tập tin cấu hình « %s »:" -#: src/util/gnunet-config.c:291 +#: src/util/gnunet-config.c:354 msgid "test if the current installation supports the specified BACKEND" msgstr "" -#: src/util/gnunet-config.c:297 -msgid "name of the section to access" +#: src/util/gnunet-config.c:360 +#, fuzzy +msgid "write the full configuration file, including default values" +msgstr "Tập tin cấu hình « %s » đã được ghi.\n" + +#: src/util/gnunet-config.c:365 +msgid "interpret option value as a filename (with $-expansion)" msgstr "" -#: src/util/gnunet-config.c:302 +#: src/util/gnunet-config.c:370 msgid "name of the option to access" msgstr "" -#: src/util/gnunet-config.c:307 -msgid "value to set" +#: src/util/gnunet-config.c:376 +#, fuzzy +msgid "rewrite the configuration file, even if nothing changed" +msgstr "dùng tập tin cấu hình TÊN_TẬP_TIN" + +#: src/util/gnunet-config.c:382 +msgid "output extra diagnostics" msgstr "" -#: src/util/gnunet-config.c:312 +#: src/util/gnunet-config.c:387 #, fuzzy msgid "print available configuration sections" msgstr "Lưu cấu hình ngay bây giờ không?" -#: src/util/gnunet-config.c:318 -msgid "write configuration file that only contains delta to defaults" +#: src/util/gnunet-config.c:393 +msgid "name of the section to access" +msgstr "" + +#: src/util/gnunet-config.c:398 +msgid "value to set" msgstr "" -#: src/util/gnunet-config.c:330 +#: src/util/gnunet-config.c:413 #, fuzzy msgid "Manipulate GNUnet configuration files" msgstr "cập nhật một giá trị trong tập tin cấu hình" @@ -8987,22 +9083,22 @@ msgstr "« %s » không giải quyết được phương pháp « %s », với l msgid "`%s' failed for library `%s' with error: %s\n" msgstr "« %s » thất bại cho thư viện « %s » với lỗi: %s\n" -#: src/util/plugin.c:409 +#: src/util/plugin.c:414 #, fuzzy msgid "Could not determine plugin installation path.\n" msgstr "Không thể truy cập đến thông tin về không gian tên.\n" -#: src/util/program.c:259 +#: src/util/program.c:252 #, fuzzy, c-format msgid "Unreadable or malformed configuration file `%s', exit ...\n" msgstr "Không thể lưu tập tin cấu hình « %s »:" -#: src/util/program.c:276 +#: src/util/program.c:272 #, fuzzy, c-format msgid "Unreadable or malformed default configuration file `%s', exit ...\n" msgstr "Không thể lưu tập tin cấu hình « %s »:" -#: src/util/program.c:291 +#: src/util/program.c:288 #, fuzzy msgid "Unreadable or malformed configuration, exit ...\n" msgstr "Không thể lưu tập tin cấu hình « %s »:" @@ -9067,83 +9163,83 @@ msgstr "" msgid "Attempting to proxy service `%s' to invalid port %d or hostname.\n" msgstr "" -#: src/util/strings.c:503 +#: src/util/strings.c:409 #, c-format msgid "Character sets requested were `%s'->`%s'\n" msgstr "" -#: src/util/strings.c:637 +#: src/util/strings.c:501 msgid "Failed to expand `$HOME': environment variable `HOME' not set" msgstr "" "Lỗi mở rộng biến môi trường « $HOME »: chưa đặt biến môi trường « HOME »" -#: src/util/strings.c:1241 +#: src/util/strings.c:1036 msgid "IPv6 address did not start with `['\n" msgstr "" -#: src/util/strings.c:1249 +#: src/util/strings.c:1044 msgid "IPv6 address did contain ':' to separate port number\n" msgstr "" -#: src/util/strings.c:1256 +#: src/util/strings.c:1051 msgid "IPv6 address did contain ']' before ':' to separate port number\n" msgstr "" -#: src/util/strings.c:1264 +#: src/util/strings.c:1059 msgid "IPv6 address did contain a valid port number after the last ':'\n" msgstr "" -#: src/util/strings.c:1273 +#: src/util/strings.c:1068 #, fuzzy, c-format msgid "Invalid IPv6 address `%s': %s\n" msgstr "Mức ưu tiên tiến trình không hợp lê « %s ».\n" -#: src/util/strings.c:1500 src/util/strings.c:1511 +#: src/util/strings.c:1250 src/util/strings.c:1261 msgid "Port not in range\n" msgstr "" -#: src/util/strings.c:1520 +#: src/util/strings.c:1270 #, fuzzy, c-format msgid "Malformed port policy `%s'\n" msgstr "Lỗi bắt đầu thu thập.\n" -#: src/util/strings.c:1603 src/util/strings.c:1632 src/util/strings.c:1679 -#: src/util/strings.c:1699 +#: src/util/strings.c:1341 src/util/strings.c:1370 src/util/strings.c:1417 +#: src/util/strings.c:1437 #, c-format msgid "Invalid format for IP: `%s'\n" msgstr "Địa chỉ IP định dạng sai: %s\n" -#: src/util/strings.c:1657 +#: src/util/strings.c:1395 #, c-format msgid "Invalid network notation ('/%d' is not legal in IPv4 CIDR)." msgstr "Ký hiệu mạng sai (« /%d » không hợp lệ trong CIDR IPv4)." -#: src/util/strings.c:1708 +#: src/util/strings.c:1446 #, fuzzy, c-format msgid "Invalid format: `%s'\n" msgstr "Địa chỉ IP định dạng sai: %s\n" -#: src/util/strings.c:1761 +#: src/util/strings.c:1488 #, c-format msgid "Invalid network notation (does not end with ';': `%s')\n" msgstr "Ký hiệu mạng sai (không kết thúc với « ; »: « %s »)\n" -#: src/util/strings.c:1811 +#: src/util/strings.c:1538 #, fuzzy, c-format msgid "Wrong format `%s' for netmask\n" msgstr "Mặt nạ mạng có định dạng sai « %s »: %s\n" -#: src/util/strings.c:1842 +#: src/util/strings.c:1569 #, fuzzy, c-format msgid "Wrong format `%s' for network\n" msgstr "Mạng có định dạng sai « %s »: %s\n" -#: src/util/time.c:878 src/util/time.c:906 +#: src/util/time.c:699 src/util/time.c:727 #, c-format msgid "Failed to map `%s', cannot assure monotonic time!\n" msgstr "" -#: src/util/time.c:914 +#: src/util/time.c:735 #, c-format msgid "" "Failed to setup monotonic time file `%s', cannot assure monotonic time!\n" @@ -9333,6 +9429,18 @@ msgstr "" msgid "Failed to connect to the namestore!\n" msgstr "Không kết nối được đến trình nền gnunetd." +#, fuzzy, c-format +#~ msgid "Unsupported form value `%s'\n" +#~ msgstr "Lệnh không được hỗ trợ « %s ». Đang hủy bỏ.\n" + +#, fuzzy, c-format +#~ msgid "Failed to create page for `%s'\n" +#~ msgstr "Không thể tạo miền tên.\n" + +#, fuzzy, c-format +#~ msgid "Failed to setup post processor for `%s'\n" +#~ msgstr "Lỗi cập nhật dữ liệu cho mô-đun « %s »\n" + #, fuzzy, c-format #~ msgid "Unable to parse PKEY record `%s'\n" #~ msgstr "Lỗi đọc danh sách bạn bè từ « %s »\n" @@ -9752,10 +9860,6 @@ msgstr "Không kết nối được đến trình nền gnunetd." #~ "Failed to receive valid response for `%s' request from `%s' service.\n" #~ msgstr "Lỗi đọc danh sách bạn bè từ « %s »\n" -#, fuzzy -#~ msgid "unknown error" -#~ msgstr "Lỗi không rõ" - #, fuzzy #~ msgid "Invalid response from `fs' service." #~ msgstr "Đối số không hợp lệ cho « %s ».\n" @@ -10954,10 +11058,6 @@ msgstr "Không kết nối được đến trình nền gnunetd." #~ msgid "Connected to %s service!\n" #~ msgstr "« %s » được kết nối tới « %s ».\n" -#, fuzzy -#~ msgid "Configuration fails to specify `%s', assuming default value." -#~ msgstr "Tập tin cấu hình « %s » đã được ghi.\n" - #, fuzzy #~ msgid "Key file `%s' for private zone does not exist!\n" #~ msgstr "đặt số trình nền cần khởi chạy" @@ -11536,9 +11636,6 @@ msgstr "Không kết nối được đến trình nền gnunetd." #~ "mở máy tính. Không thì bạn cần phải tự khởi chạy GNUnet mỗi lần để sử " #~ "dụng nó." -#~ msgid "Unable to create user account for daemon." -#~ msgstr "Không thể tạo tài khoản người dùng cho trình nền." - #~ msgid "Save configuration?" #~ msgstr "Lưu cấu hình không?" @@ -12371,9 +12468,6 @@ msgstr "Không kết nối được đến trình nền gnunetd." #~ msgstr "" #~ "Những thư mục đưa ra đã được thêm vào danh sách các thư mục dùng chung.\n" -#~ msgid "Created entry `%s' in namespace `%s'\n" -#~ msgstr "Đã tạo mục nhập « %s » trong không gian tên « %s »\n" - #~ msgid "mimetype" #~ msgstr "kiểu MIME" diff --git a/po/zh_CN.po b/po/zh_CN.po index 3346968de..09729e9c0 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: gnunet-0.8.1\n" "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" -"POT-Creation-Date: 2021-04-04 19:19+0200\n" +"POT-Creation-Date: 2021-08-08 18:36+0200\n" "PO-Revision-Date: 2011-07-09 12:12+0800\n" "Last-Translator: Wylmer Wang \n" "Language-Team: Chinese (simplified) \n" @@ -28,7 +28,7 @@ msgstr "“%s”的参数无效。\n" #: src/abd/gnunet-abd.c:560 src/abd/gnunet-service-abd.c:1747 #: src/namestore/gnunet-namestore.c:1001 -#: src/namestore/gnunet-namestore-fcfsd.c:1164 +#: src/namestore/gnunet-namestore-fcfsd.c:1067 #, fuzzy, c-format msgid "Failed to connect to namestore\n" msgstr "初始化“%s”服务失败。\n" @@ -755,7 +755,7 @@ msgstr "" #: src/auction/gnunet-auction-info.c:77 src/auction/gnunet-auction-join.c:77 #: src/conversation/gnunet-conversation-test.c:256 -#: src/revocation/gnunet-revocation.c:564 src/template/gnunet-template.c:75 +#: src/revocation/gnunet-revocation.c:570 src/template/gnunet-template.c:75 msgid "help text" msgstr "" @@ -1123,7 +1123,7 @@ msgstr "" #, c-format msgid "" "\n" -"We are now playing your recording back. If you can hear it, your audio " +"ew are now playing your recording back. If you can hear it, your audio " "settings are working..." msgstr "" @@ -1548,38 +1548,38 @@ msgstr "" msgid "# updates to my type map" msgstr "" -#: src/datacache/datacache.c:115 src/datacache/datacache.c:287 +#: src/datacache/datacache.c:115 src/datacache/datacache.c:299 #: src/datastore/gnunet-service-datastore.c:742 msgid "# bytes stored" msgstr "" -#: src/datacache/datacache.c:119 src/datacache/datacache.c:291 +#: src/datacache/datacache.c:119 src/datacache/datacache.c:303 msgid "# items stored" msgstr "" -#: src/datacache/datacache.c:189 +#: src/datacache/datacache.c:190 #, c-format msgid "Loading `%s' datacache plugin\n" msgstr "" -#: src/datacache/datacache.c:197 +#: src/datacache/datacache.c:208 #, c-format msgid "Failed to load datacache plugin for `%s'\n" msgstr "" -#: src/datacache/datacache.c:320 +#: src/datacache/datacache.c:332 msgid "# requests received" msgstr "" -#: src/datacache/datacache.c:331 +#: src/datacache/datacache.c:343 msgid "# requests filtered by bloom filter" msgstr "" -#: src/datacache/datacache.c:358 +#: src/datacache/datacache.c:370 msgid "# requests for random value received" msgstr "" -#: src/datacache/datacache.c:388 +#: src/datacache/datacache.c:400 msgid "# proximity search requests received" msgstr "" @@ -1919,7 +1919,7 @@ msgstr "" #: src/datastore/plugin_datastore_postgres.c:284 #: src/datastore/plugin_datastore_postgres.c:897 -msgid "Postgress exec failure" +msgid "Postgresql exec failure" msgstr "" #: src/datastore/plugin_datastore_postgres.c:858 @@ -1955,14 +1955,25 @@ msgstr "" msgid "sqlite version to old to determine size, assuming zero\n" msgstr "" -#: src/datastore/plugin_datastore_sqlite.c:1274 +#: src/datastore/plugin_datastore_sqlite.c:1266 +#: src/datastore/plugin_datastore_sqlite.c:1279 +#, fuzzy +msgid "error preparing statement\n" +msgstr "创建用户出错" + +#: src/datastore/plugin_datastore_sqlite.c:1287 +#, fuzzy +msgid "error stepping\n" +msgstr "创建用户出错" + +#: src/datastore/plugin_datastore_sqlite.c:1295 #, c-format msgid "" "Using sqlite page utilization to estimate payload (%llu pages of size %llu " "bytes)\n" msgstr "" -#: src/datastore/plugin_datastore_sqlite.c:1316 +#: src/datastore/plugin_datastore_sqlite.c:1337 #: src/namecache/plugin_namecache_sqlite.c:564 #: src/namestore/plugin_namestore_sqlite.c:765 #, fuzzy @@ -2209,87 +2220,87 @@ msgstr "" msgid "# requests TTL-dropped" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1052 -#: src/dht/gnunet-service-dht_neighbours.c:1096 +#: src/dht/gnunet-service-dht_neighbours.c:1035 +#: src/dht/gnunet-service-dht_neighbours.c:1072 msgid "# Peers excluded from routing due to Bloomfilter" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1069 -#: src/dht/gnunet-service-dht_neighbours.c:1112 +#: src/dht/gnunet-service-dht_neighbours.c:1045 +#: src/dht/gnunet-service-dht_neighbours.c:1088 msgid "# Peer selection failed" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1270 +#: src/dht/gnunet-service-dht_neighbours.c:1246 msgid "# PUT requests routed" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1304 +#: src/dht/gnunet-service-dht_neighbours.c:1280 msgid "# PUT messages queued for transmission" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1316 -#: src/dht/gnunet-service-dht_neighbours.c:1458 -#: src/dht/gnunet-service-dht_neighbours.c:1562 +#: src/dht/gnunet-service-dht_neighbours.c:1292 +#: src/dht/gnunet-service-dht_neighbours.c:1434 +#: src/dht/gnunet-service-dht_neighbours.c:1538 msgid "# P2P messages dropped due to full queue" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1401 +#: src/dht/gnunet-service-dht_neighbours.c:1377 msgid "# GET requests routed" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1445 +#: src/dht/gnunet-service-dht_neighbours.c:1421 msgid "# GET messages queued for transmission" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1577 +#: src/dht/gnunet-service-dht_neighbours.c:1553 msgid "# RESULT messages queued for transmission" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1680 +#: src/dht/gnunet-service-dht_neighbours.c:1656 msgid "# Expired PUTs discarded" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1688 +#: src/dht/gnunet-service-dht_neighbours.c:1664 msgid "# P2P PUT requests received" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1692 +#: src/dht/gnunet-service-dht_neighbours.c:1668 msgid "# P2P PUT bytes received" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1924 +#: src/dht/gnunet-service-dht_neighbours.c:1900 msgid "# FIND PEER requests ignored due to Bloomfilter" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:1933 +#: src/dht/gnunet-service-dht_neighbours.c:1909 msgid "# FIND PEER requests ignored due to lack of HELLO" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:2096 +#: src/dht/gnunet-service-dht_neighbours.c:2072 msgid "# P2P GET requests received" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:2100 +#: src/dht/gnunet-service-dht_neighbours.c:2076 msgid "# P2P GET bytes received" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:2166 +#: src/dht/gnunet-service-dht_neighbours.c:2142 msgid "# P2P FIND PEER requests processed" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:2187 +#: src/dht/gnunet-service-dht_neighbours.c:2163 msgid "# P2P GET requests ONLY routed" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:2365 +#: src/dht/gnunet-service-dht_neighbours.c:2341 msgid "# Expired results discarded" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:2382 +#: src/dht/gnunet-service-dht_neighbours.c:2358 msgid "# P2P RESULTS received" msgstr "" -#: src/dht/gnunet-service-dht_neighbours.c:2386 +#: src/dht/gnunet-service-dht_neighbours.c:2362 msgid "# P2P RESULT bytes received" msgstr "" @@ -2749,10 +2760,10 @@ msgid "Directory too large for system address space\n" msgstr "" #: src/fs/fs_download.c:346 -#, c-format +#, fuzzy, c-format msgid "" -"Failed to access full directroy contents of `%s' for recursive download\n" -msgstr "" +"Failed to access full directory contents of `%s' for recursive download\n" +msgstr "解析配置文件“%s”失败\n" #: src/fs/fs_download.c:528 src/fs/fs_download.c:541 #, fuzzy, c-format @@ -3976,7 +3987,7 @@ msgstr "" msgid "GNUnet GNS resolver tool" msgstr "GNUnet 错误日志" -#: src/gns/gnunet-gns-import.c:491 +#: src/gns/gnunet-gns-import.c:490 msgid "This program will import some GNS authorities into your GNS namestore." msgstr "" @@ -4658,52 +4669,52 @@ msgstr "发送消息失败。\n" msgid "Failed to set default ego: %s\n" msgstr "发送消息失败。\n" -#: src/identity/gnunet-identity.c:462 +#: src/identity/gnunet-identity.c:461 msgid "create ego NAME" msgstr "" -#: src/identity/gnunet-identity.c:467 +#: src/identity/gnunet-identity.c:466 msgid "delete ego NAME " msgstr "" -#: src/identity/gnunet-identity.c:473 +#: src/identity/gnunet-identity.c:472 msgid "" "set the private key for the identity to PRIVATE_KEY (use together with -C)" msgstr "" -#: src/identity/gnunet-identity.c:478 +#: src/identity/gnunet-identity.c:477 msgid "generate an EdDSA identity. (use together with -C) EXPERIMENTAL" msgstr "" -#: src/identity/gnunet-identity.c:482 +#: src/identity/gnunet-identity.c:481 msgid "display all egos" msgstr "" -#: src/identity/gnunet-identity.c:486 +#: src/identity/gnunet-identity.c:485 msgid "reduce output" msgstr "" -#: src/identity/gnunet-identity.c:493 +#: src/identity/gnunet-identity.c:492 msgid "" "set default identity to NAME for a subsystem SUBSYSTEM (use together with -" "s) or restrict results to NAME (use together with -d)" msgstr "" -#: src/identity/gnunet-identity.c:497 +#: src/identity/gnunet-identity.c:496 msgid "run in monitor mode egos" msgstr "" -#: src/identity/gnunet-identity.c:501 +#: src/identity/gnunet-identity.c:500 #, fuzzy msgid "display private keys as well" msgstr "显示一个文件的散列值" -#: src/identity/gnunet-identity.c:508 +#: src/identity/gnunet-identity.c:507 msgid "" "set default identity to EGO for a subsystem SUBSYSTEM (use together with -e)" msgstr "" -#: src/identity/gnunet-identity.c:523 +#: src/identity/gnunet-identity.c:522 msgid "Maintain egos" msgstr "" @@ -4758,7 +4769,7 @@ msgstr "解析配置文件“%s”失败\n" msgid "Identity REST API initialized\n" msgstr "" -#: src/json/json.c:139 +#: src/json/json.c:119 #, fuzzy, c-format msgid "Failed to parse JSON in option `%s': %s (%s)\n" msgstr "解析配置文件“%s”失败\n" @@ -5101,73 +5112,113 @@ msgstr "" msgid "name of the ego controlling the zone" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:552 -#, fuzzy, c-format -msgid "Unsupported form value `%s'\n" -msgstr "未知的命令“%s”。\n" +#: src/namestore/gnunet-namestore-fcfsd.c:359 +#, fuzzy +msgid "can not search the namestore" +msgstr "初始化“%s”服务失败。\n" -#: src/namestore/gnunet-namestore-fcfsd.c:579 +#: src/namestore/gnunet-namestore-fcfsd.c:413 +#: src/namestore/gnunet-namestore-fcfsd.c:554 +#, fuzzy +msgid "unable to scan namestore" +msgstr "初始化“%s”服务失败。\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:441 #, fuzzy, c-format -msgid "Failed to create record for domain `%s': %s\n" +msgid "Failed to create record for `%s': %s\n" msgstr "解析配置文件“%s”失败\n" -#: src/namestore/gnunet-namestore-fcfsd.c:600 -msgid "Error when mapping zone to name\n" -msgstr "" +#: src/namestore/gnunet-namestore-fcfsd.c:453 +#, fuzzy +msgid "no errors" +msgstr "未知错误" -#: src/namestore/gnunet-namestore-fcfsd.c:633 +#: src/namestore/gnunet-namestore-fcfsd.c:489 #, c-format -msgid "Found existing name `%s' for the given key\n" +msgid "The requested key `%s' exists as `%s'\n" +msgstr "" + +#: src/namestore/gnunet-namestore-fcfsd.c:496 +msgid "key exists" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:646 +#: src/namestore/gnunet-namestore-fcfsd.c:513 #, fuzzy -msgid "Error creating record data.\n" +msgid "Error creating record data\n" msgstr "未知错误。\n" -#: src/namestore/gnunet-namestore-fcfsd.c:707 +#: src/namestore/gnunet-namestore-fcfsd.c:517 +#, fuzzy +msgid "unable to store record" +msgstr "运行 %s失败:%s %d\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:588 #, c-format -msgid "Found %u existing records for domain `%s'\n" +msgid "Requested name `%s' exists with `%u' records\n" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:796 -#, fuzzy, c-format -msgid "Failed to create page for `%s'\n" -msgstr "发送消息失败。\n" - -#: src/namestore/gnunet-namestore-fcfsd.c:815 -#, fuzzy, c-format -msgid "Failed to setup post processor for `%s'\n" -msgstr "解析配置文件“%s”失败\n" +#: src/namestore/gnunet-namestore-fcfsd.c:594 +msgid "name exists\n" +msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:850 -msgid "Domain name must not contain `.'\n" +#: src/namestore/gnunet-namestore-fcfsd.c:780 +msgid "unable to process submitted data" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:859 -msgid "Domain name must not contain `+'\n" +#: src/namestore/gnunet-namestore-fcfsd.c:787 +msgid "the submitted data is invalid" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:1094 +#: src/namestore/gnunet-namestore-fcfsd.c:806 +#, fuzzy +msgid "invalid parameters" +msgstr "“%s”的参数无效。\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:823 +#, fuzzy +msgid "invalid name" +msgstr "“%s”的参数无效。\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:834 +#, fuzzy, c-format +msgid "Unable to parse key %s\n" +msgstr "解析配置文件“%s”失败\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:838 +#, fuzzy +msgid "unable to parse key" +msgstr "解析配置文件“%s”失败\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:949 msgid "No ego configured for `fcfsd` subsystem\n" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:1125 +#: src/namestore/gnunet-namestore-fcfsd.c:974 #, fuzzy msgid "Failed to start HTTP server\n" msgstr "初始化“%s”服务失败。\n" -#: src/namestore/gnunet-namestore-fcfsd.c:1173 +#: src/namestore/gnunet-namestore-fcfsd.c:1058 +#, fuzzy +msgid "No port specified, using default value\n" +msgstr "配置文件“%s”已写入。\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:1076 #, fuzzy msgid "Failed to connect to identity\n" msgstr "初始化“%s”服务失败。\n" -#: src/namestore/gnunet-namestore-fcfsd.c:1200 -msgid "name of the zone that is to be managed by FCFSD" +#: src/namestore/gnunet-namestore-fcfsd.c:1100 +#, fuzzy +msgid "Unable to set up the daemon\n" +msgstr "发送消息失败。\n" + +#: src/namestore/gnunet-namestore-fcfsd.c:1123 +msgid "name of the zone managed by FCFSD" msgstr "" -#: src/namestore/gnunet-namestore-fcfsd.c:1220 -msgid "GNU Name System First Come First Serve name registration service" +#: src/namestore/gnunet-namestore-fcfsd.c:1132 +msgid "GNU Name System First-Come-First-Served name registration service" msgstr "" #: src/namestore/gnunet-service-namestore.c:871 @@ -5175,11 +5226,11 @@ msgstr "" msgid "Failed to replicate block in namecache: %s\n" msgstr "发送消息失败。\n" -#: src/namestore/gnunet-zoneimport.c:1848 +#: src/namestore/gnunet-zoneimport.c:1847 msgid "size to use for the main hash map" msgstr "" -#: src/namestore/gnunet-zoneimport.c:1854 +#: src/namestore/gnunet-zoneimport.c:1853 msgid "minimum expiration time we assume for imported records" msgstr "" @@ -5202,7 +5253,7 @@ msgstr "" msgid "Flat file database running\n" msgstr "sqlite 数据仓库" -#: src/namestore/plugin_rest_namestore.c:1105 +#: src/namestore/plugin_rest_namestore.c:1111 msgid "Namestore REST API initialized\n" msgstr "" @@ -5856,11 +5907,11 @@ msgstr "" msgid "re:claimID command line tool" msgstr "" -#: src/reclaim/plugin_rest_openid_connect.c:2788 +#: src/reclaim/plugin_rest_openid_connect.c:2793 msgid "OpenID Connect REST API initialized\n" msgstr "" -#: src/reclaim/plugin_rest_reclaim.c:1521 +#: src/reclaim/plugin_rest_pabc.c:637 src/reclaim/plugin_rest_reclaim.c:1520 msgid "Identity Provider REST API initialized\n" msgstr "" @@ -5878,60 +5929,60 @@ msgstr "立即保存配置?" msgid "Daemon to announce regular expressions for the peer using cadet." msgstr "" -#: src/regex/gnunet-regex-profiler.c:1390 +#: src/regex/gnunet-regex-profiler.c:1392 msgid "No configuration file given. Exiting\n" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1432 +#: src/regex/gnunet-regex-profiler.c:1434 #: src/regex/gnunet-regex-simulation-profiler.c:631 #, c-format msgid "No policy directory specified on command line. Exiting.\n" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1438 +#: src/regex/gnunet-regex-profiler.c:1440 #: src/regex/gnunet-regex-simulation-profiler.c:639 #, c-format msgid "Specified policies directory does not exist. Exiting.\n" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1446 +#: src/regex/gnunet-regex-profiler.c:1448 #, fuzzy, c-format msgid "No files found in `%s'\n" msgstr "运行 %s失败:%s %d\n" -#: src/regex/gnunet-regex-profiler.c:1455 +#: src/regex/gnunet-regex-profiler.c:1457 msgid "No search strings file given. Exiting.\n" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1475 +#: src/regex/gnunet-regex-profiler.c:1477 #, fuzzy msgid "Error loading search strings. Exiting.\n" msgstr "创建用户出错" -#: src/regex/gnunet-regex-profiler.c:1563 +#: src/regex/gnunet-regex-profiler.c:1565 #, fuzzy msgid "name of the file for writing statistics" msgstr "初始化“%s”服务失败。\n" -#: src/regex/gnunet-regex-profiler.c:1570 +#: src/regex/gnunet-regex-profiler.c:1572 msgid "wait TIMEOUT before ending the experiment" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1576 +#: src/regex/gnunet-regex-profiler.c:1578 msgid "directory with policy files" msgstr "" -#: src/regex/gnunet-regex-profiler.c:1584 +#: src/regex/gnunet-regex-profiler.c:1586 #, fuzzy msgid "name of file with input strings" msgstr "初始化“%s”服务失败。\n" -#: src/regex/gnunet-regex-profiler.c:1591 +#: src/regex/gnunet-regex-profiler.c:1593 #, fuzzy msgid "name of file with hosts' names" msgstr "初始化“%s”服务失败。\n" -#: src/regex/gnunet-regex-profiler.c:1604 +#: src/regex/gnunet-regex-profiler.c:1606 msgid "Profiler for regex" msgstr "" @@ -5957,12 +6008,12 @@ msgstr "服务已删除。\n" msgid "Search string `%s' is too long!\n" msgstr "服务已删除。\n" -#: src/rest/gnunet-rest-server.c:1266 +#: src/rest/gnunet-rest-server.c:1267 #, fuzzy msgid "GNUnet REST server" msgstr "GNUnet 错误日志" -#: src/rest/plugin_rest_config.c:427 +#: src/rest/plugin_rest_config.c:428 msgid "CONFIG REST API initialized\n" msgstr "" @@ -6026,72 +6077,77 @@ msgstr "" msgid "Ego `%s' not found.\n" msgstr "" -#: src/revocation/gnunet-revocation.c:351 +#: src/revocation/gnunet-revocation.c:350 +#, c-format +msgid "Error: Key is invalid\n" +msgstr "" + +#: src/revocation/gnunet-revocation.c:357 #, c-format msgid "Error: revocation certificate in `%s' is not for `%s'\n" msgstr "" -#: src/revocation/gnunet-revocation.c:361 +#: src/revocation/gnunet-revocation.c:367 msgid "Revocation certificate ready\n" msgstr "" -#: src/revocation/gnunet-revocation.c:373 +#: src/revocation/gnunet-revocation.c:379 msgid "Continuing calculation where left off...\n" msgstr "" -#: src/revocation/gnunet-revocation.c:380 +#: src/revocation/gnunet-revocation.c:386 msgid "Revocation certificate not ready, calculating proof of work\n" msgstr "" -#: src/revocation/gnunet-revocation.c:418 +#: src/revocation/gnunet-revocation.c:424 #, fuzzy, c-format msgid "Public key `%s' malformed\n" msgstr "“%s”的参数无效。\n" -#: src/revocation/gnunet-revocation.c:428 +#: src/revocation/gnunet-revocation.c:434 msgid "" "Testing and revoking at the same time is not allowed, only executing test.\n" msgstr "" -#: src/revocation/gnunet-revocation.c:458 +#: src/revocation/gnunet-revocation.c:464 #, fuzzy msgid "No filename to store revocation certificate given.\n" msgstr "解析配置文件“%s”失败\n" -#: src/revocation/gnunet-revocation.c:475 +#: src/revocation/gnunet-revocation.c:481 #, fuzzy, c-format msgid "Failed to read revocation certificate from `%s'\n" msgstr "解析配置文件“%s”失败\n" -#: src/revocation/gnunet-revocation.c:483 +#: src/revocation/gnunet-revocation.c:489 #, fuzzy, c-format msgid "Revocation certificate corrupted in `%s'\n" msgstr "解析配置文件“%s”失败\n" -#: src/revocation/gnunet-revocation.c:505 +#: src/revocation/gnunet-revocation.c:511 #, fuzzy msgid "No action specified. Nothing to do.\n" msgstr "没有指定接口,将使用默认。\n" -#: src/revocation/gnunet-revocation.c:524 +#: src/revocation/gnunet-revocation.c:530 msgid "use NAME for the name of the revocation file" msgstr "" -#: src/revocation/gnunet-revocation.c:532 +#: src/revocation/gnunet-revocation.c:538 msgid "" "revoke the private key associated for the the private key associated with " "the ego NAME " msgstr "" -#: src/revocation/gnunet-revocation.c:539 +#: src/revocation/gnunet-revocation.c:545 msgid "actually perform revocation, otherwise we just do the precomputation" msgstr "" -#: src/revocation/gnunet-revocation.c:546 +#: src/revocation/gnunet-revocation.c:552 msgid "test if the public key KEY has been revoked" msgstr "" -#: src/revocation/gnunet-revocation.c:552 +#: src/revocation/gnunet-revocation.c:558 #, fuzzy msgid "number of epochs to calculate for" msgstr "迭代次数" @@ -6217,12 +6273,12 @@ msgstr "" #: src/scalarproduct/gnunet-service-scalarproduct_alice.c:1358 #: src/scalarproduct/gnunet-service-scalarproduct_bob.c:1355 #: src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c:1118 -#: src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c:1063 +#: src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c:1034 #, fuzzy msgid "Connect to CADET failed\n" msgstr "“%s”已连接到“%s”。\n" -#: src/scalarproduct/scalarproduct_api.c:189 +#: src/scalarproduct/scalarproduct_api.c:184 msgid "Keys given to SCALARPRODUCT not unique!\n" msgstr "" @@ -6243,7 +6299,7 @@ msgid "also profile decryption" msgstr "" #: src/set/gnunet-service-set.c:1916 src/seti/gnunet-service-seti.c:2467 -#: src/setu/gnunet-service-setu.c:3832 +#: src/setu/gnunet-service-setu.c:5395 #, fuzzy msgid "Could not connect to CADET service\n" msgstr "无法连接到 %s:%u:%s\n" @@ -6487,7 +6543,7 @@ msgid "" "\t cap: the maximum number of links a node can have\n" "\t m: the number of links a node should have while joining the network\n" "\t filename: the path of the file which contains topology information\n" -"NOTE: the format of the above file is descibed here: https://www.gnunet.org/" +"NOTE: the format of the above file is described here: https://www.gnunet.org/" "content/topology-file-format\n" msgstr "" @@ -6582,7 +6638,7 @@ msgid "Spawning process `%s'\n" msgstr "卸载 GNUnet 服务" #: src/testbed/gnunet-testbed-profiler.c:290 -msgid "tolerate COUNT number of continious timeout failures" +msgid "tolerate COUNT number of continuous timeout failures" msgstr "" #: src/testbed/gnunet-testbed-profiler.c:295 @@ -6888,15 +6944,15 @@ msgstr "" msgid "GNUnet topology control" msgstr "" -#: src/transport/gnunet-communicator-tcp.c:3331 +#: src/transport/gnunet-communicator-tcp.c:3314 #: src/transport/gnunet-communicator-udp.c:3790 -#: src/transport/gnunet-service-tng.c:10220 +#: src/transport/gnunet-service-tng.c:10223 #: src/transport/gnunet-service-transport.c:2627 #, fuzzy msgid "Transport service is lacking key configuration settings. Exiting.\n" msgstr "立即保存配置?" -#: src/transport/gnunet-communicator-tcp.c:3668 +#: src/transport/gnunet-communicator-tcp.c:3652 msgid "GNUnet TCP communicator" msgstr "" @@ -7949,7 +8005,7 @@ msgstr "" msgid "Service process failed to report status\n" msgstr "" -#: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1040 +#: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1220 #: src/util/service.c:1637 #, c-format msgid "Cannot obtain information about user `%s': %s\n" @@ -8068,39 +8124,15 @@ msgstr "IP 格式无效:“%s”\n" msgid "Failed to serialize metadata `%s'" msgstr "发送消息失败。\n" -#: src/util/client.c:747 src/util/client.c:937 +#: src/util/client.c:747 src/util/client.c:938 msgid "not a valid filename" msgstr "" -#: src/util/client.c:1103 +#: src/util/client.c:1104 #, c-format msgid "Need a non-empty hostname for service `%s'.\n" msgstr "" -#: src/util/common_logging.c:259 src/util/common_logging.c:1114 -msgid "DEBUG" -msgstr "调试" - -#: src/util/common_logging.c:261 src/util/common_logging.c:1112 -msgid "INFO" -msgstr "信息" - -#: src/util/common_logging.c:263 src/util/common_logging.c:1110 -msgid "MESSAGE" -msgstr "" - -#: src/util/common_logging.c:265 src/util/common_logging.c:1108 -msgid "WARNING" -msgstr "警告" - -#: src/util/common_logging.c:267 src/util/common_logging.c:1106 -msgid "ERROR" -msgstr "错误" - -#: src/util/common_logging.c:269 src/util/common_logging.c:1116 -msgid "NONE" -msgstr "" - #: src/util/common_logging.c:626 src/util/common_logging.c:665 #, c-format msgid "ERROR: Unable to parse log definition: Syntax error at `%s'.\n" @@ -8111,6 +8143,30 @@ msgstr "" msgid "Message `%.*s' repeated %u times in the last %s\n" msgstr "消息“%.*s”重复了 %u 次,在最近 %llu 秒内\n" +#: src/util/common_logging.c:1106 +msgid "ERROR" +msgstr "错误" + +#: src/util/common_logging.c:1108 +msgid "WARNING" +msgstr "警告" + +#: src/util/common_logging.c:1110 +msgid "MESSAGE" +msgstr "" + +#: src/util/common_logging.c:1112 +msgid "INFO" +msgstr "信息" + +#: src/util/common_logging.c:1114 +msgid "DEBUG" +msgstr "调试" + +#: src/util/common_logging.c:1116 +msgid "NONE" +msgstr "" + #: src/util/common_logging.c:1117 msgid "INVALID" msgstr "" @@ -8134,39 +8190,69 @@ msgid "" "Configuration specifies invalid value for option `%s' in section `%s': %s\n" msgstr "配置不满足配置规范文件“%s”的约束!\n" -#: src/util/configuration.c:370 +#: src/util/configuration.c:790 +#, c-format +msgid "Illegal directive in line %u (parsing restricted section %s)\n" +msgstr "" + +#: src/util/configuration.c:800 +#, c-format +msgid "Bad directive in line %u\n" +msgstr "" + +#: src/util/configuration.c:853 +#, c-format +msgid "Bad inline-secret directive in line %u\n" +msgstr "" + +#: src/util/configuration.c:875 +#, c-format +msgid "Unknown or malformed directive '%s' in line %u\n" +msgstr "" + +#: src/util/configuration.c:905 +#, fuzzy, c-format +msgid "Syntax error while deserializing in line %u (option without section)\n" +msgstr "配置文件“%s”第 %d 行有语法错误。\n" + +#: src/util/configuration.c:949 #, fuzzy, c-format msgid "Syntax error while deserializing in line %u\n" msgstr "配置文件“%s”第 %d 行有语法错误。\n" -#: src/util/configuration.c:420 +#: src/util/configuration.c:1049 #, fuzzy, c-format msgid "Error while reading file `%s'\n" msgstr "解析 dscl 输出时出错。\n" -#: src/util/configuration.c:980 +#: src/util/configuration.c:1062 +#, fuzzy, c-format +msgid "Failed to parse configuration file `%s'\n" +msgstr "解析配置文件“%s”失败\n" + +#: src/util/configuration.c:1695 #, fuzzy msgid "Not a valid relative time specification" msgstr "配置文件“%s”已写入。\n" -#: src/util/configuration.c:1050 +#: src/util/configuration.c:1765 #, c-format msgid "" "Configuration value '%s' for '%s' in section '%s' is not in set of legal " "choices\n" msgstr "" -#: src/util/configuration.c:1145 +#: src/util/configuration.c:1860 #, c-format msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n" msgstr "" -#: src/util/configuration.c:1177 +#: src/util/configuration.c:1892 #, fuzzy, c-format msgid "Missing closing `%s' in option `%s'\n" msgstr "配置文件“%s”已写入。\n" -#: src/util/configuration.c:1243 +#: src/util/configuration.c:1958 #, c-format msgid "" "Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined " @@ -8210,7 +8296,7 @@ msgstr "对驱动器“%2$s”的“%1$s”操作失败:%3$u\n" msgid "RSA signature verification failed at %s:%d: %s\n" msgstr "对驱动器“%2$s”的“%1$s”操作失败:%3$u\n" -#: src/util/disk.c:823 +#: src/util/disk.c:843 #, c-format msgid "Expected `%s' to be a directory!\n" msgstr "“%s”应为目录!\n" @@ -8391,60 +8477,69 @@ msgstr "您必须向“%s”选项传递一个数字。\n" msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" msgstr "" -#: src/util/gnunet-base32.c:45 +#: src/util/gnunet-base32.c:46 msgid "run decoder modus, otherwise runs as encoder" msgstr "" -#: src/util/gnunet-config.c:167 -#, fuzzy, c-format -msgid "failed to load configuration defaults" -msgstr "解析配置文件“%s”失败\n" - -#: src/util/gnunet-config.c:179 -#, fuzzy, c-format -msgid "%s or %s argument is required\n" -msgstr "设置要使用的昵称(必须)" - -#: src/util/gnunet-config.c:186 +#: src/util/gnunet-config.c:187 #, c-format msgid "The following sections are available:\n" msgstr "" -#: src/util/gnunet-config.c:234 +#: src/util/gnunet-config.c:201 +#, fuzzy, c-format +msgid "%s, %s or %s argument is required\n" +msgstr "设置要使用的昵称(必须)" + +#: src/util/gnunet-config.c:266 #, c-format msgid "--option argument required to set value\n" msgstr "" -#: src/util/gnunet-config.c:284 -msgid "interpret option value as a filename (with $-expansion)" -msgstr "" +#: src/util/gnunet-config.c:309 +#, fuzzy, c-format +msgid "failed to load configuration defaults" +msgstr "解析配置文件“%s”失败\n" -#: src/util/gnunet-config.c:291 +#: src/util/gnunet-config.c:354 msgid "test if the current installation supports the specified BACKEND" msgstr "" -#: src/util/gnunet-config.c:297 -msgid "name of the section to access" +#: src/util/gnunet-config.c:360 +#, fuzzy +msgid "write the full configuration file, including default values" +msgstr "配置文件“%s”已写入。\n" + +#: src/util/gnunet-config.c:365 +msgid "interpret option value as a filename (with $-expansion)" msgstr "" -#: src/util/gnunet-config.c:302 +#: src/util/gnunet-config.c:370 msgid "name of the option to access" msgstr "" -#: src/util/gnunet-config.c:307 -msgid "value to set" +#: src/util/gnunet-config.c:376 +msgid "rewrite the configuration file, even if nothing changed" +msgstr "" + +#: src/util/gnunet-config.c:382 +msgid "output extra diagnostics" msgstr "" -#: src/util/gnunet-config.c:312 +#: src/util/gnunet-config.c:387 #, fuzzy msgid "print available configuration sections" msgstr "立即保存配置?" -#: src/util/gnunet-config.c:318 -msgid "write configuration file that only contains delta to defaults" +#: src/util/gnunet-config.c:393 +msgid "name of the section to access" msgstr "" -#: src/util/gnunet-config.c:330 +#: src/util/gnunet-config.c:398 +msgid "value to set" +msgstr "" + +#: src/util/gnunet-config.c:413 #, fuzzy msgid "Manipulate GNUnet configuration files" msgstr "更改配置文件中的一个值" @@ -8673,22 +8768,22 @@ msgstr "" msgid "`%s' failed for library `%s' with error: %s\n" msgstr "" -#: src/util/plugin.c:409 +#: src/util/plugin.c:414 #, fuzzy msgid "Could not determine plugin installation path.\n" msgstr "无法确定用户界面定义文件。" -#: src/util/program.c:259 +#: src/util/program.c:252 #, fuzzy, c-format msgid "Unreadable or malformed configuration file `%s', exit ...\n" msgstr "解析配置文件“%s”失败\n" -#: src/util/program.c:276 +#: src/util/program.c:272 #, fuzzy, c-format msgid "Unreadable or malformed default configuration file `%s', exit ...\n" msgstr "解析配置文件“%s”失败\n" -#: src/util/program.c:291 +#: src/util/program.c:288 #, fuzzy msgid "Unreadable or malformed configuration, exit ...\n" msgstr "解析配置文件“%s”失败\n" @@ -8753,82 +8848,82 @@ msgstr "" msgid "Attempting to proxy service `%s' to invalid port %d or hostname.\n" msgstr "" -#: src/util/strings.c:503 +#: src/util/strings.c:409 #, c-format msgid "Character sets requested were `%s'->`%s'\n" msgstr "" -#: src/util/strings.c:637 +#: src/util/strings.c:501 msgid "Failed to expand `$HOME': environment variable `HOME' not set" msgstr "扩展“$HOME”失败:没有设置环境变量“HOME”" -#: src/util/strings.c:1241 +#: src/util/strings.c:1036 msgid "IPv6 address did not start with `['\n" msgstr "" -#: src/util/strings.c:1249 +#: src/util/strings.c:1044 msgid "IPv6 address did contain ':' to separate port number\n" msgstr "" -#: src/util/strings.c:1256 +#: src/util/strings.c:1051 msgid "IPv6 address did contain ']' before ':' to separate port number\n" msgstr "" -#: src/util/strings.c:1264 +#: src/util/strings.c:1059 msgid "IPv6 address did contain a valid port number after the last ':'\n" msgstr "" -#: src/util/strings.c:1273 +#: src/util/strings.c:1068 #, fuzzy, c-format msgid "Invalid IPv6 address `%s': %s\n" msgstr "无效的进程优先级“%s”\n" -#: src/util/strings.c:1500 src/util/strings.c:1511 +#: src/util/strings.c:1250 src/util/strings.c:1261 msgid "Port not in range\n" msgstr "" -#: src/util/strings.c:1520 +#: src/util/strings.c:1270 #, fuzzy, c-format msgid "Malformed port policy `%s'\n" msgstr "解析配置文件“%s”失败\n" -#: src/util/strings.c:1603 src/util/strings.c:1632 src/util/strings.c:1679 -#: src/util/strings.c:1699 +#: src/util/strings.c:1341 src/util/strings.c:1370 src/util/strings.c:1417 +#: src/util/strings.c:1437 #, c-format msgid "Invalid format for IP: `%s'\n" msgstr "IP 格式无效:“%s”\n" -#: src/util/strings.c:1657 +#: src/util/strings.c:1395 #, c-format msgid "Invalid network notation ('/%d' is not legal in IPv4 CIDR)." msgstr "网络表示法无效(“/%d” 在 IPv4 CIDR 中是非法的)。" -#: src/util/strings.c:1708 +#: src/util/strings.c:1446 #, fuzzy, c-format msgid "Invalid format: `%s'\n" msgstr "IP 格式无效:“%s”\n" -#: src/util/strings.c:1761 +#: src/util/strings.c:1488 #, c-format msgid "Invalid network notation (does not end with ';': `%s')\n" msgstr "无效的网络表示法(没有以“;”结尾:“%s”)\n" -#: src/util/strings.c:1811 +#: src/util/strings.c:1538 #, c-format msgid "Wrong format `%s' for netmask\n" msgstr "网络掩码的格式“%s”错误\n" -#: src/util/strings.c:1842 +#: src/util/strings.c:1569 #, c-format msgid "Wrong format `%s' for network\n" msgstr "网络的格式“%s”错误\n" -#: src/util/time.c:878 src/util/time.c:906 +#: src/util/time.c:699 src/util/time.c:727 #, c-format msgid "Failed to map `%s', cannot assure monotonic time!\n" msgstr "" -#: src/util/time.c:914 +#: src/util/time.c:735 #, c-format msgid "" "Failed to setup monotonic time file `%s', cannot assure monotonic time!\n" @@ -9010,6 +9105,18 @@ msgstr "" msgid "Failed to connect to the namestore!\n" msgstr "初始化“%s”服务失败。\n" +#, fuzzy, c-format +#~ msgid "Unsupported form value `%s'\n" +#~ msgstr "未知的命令“%s”。\n" + +#, fuzzy, c-format +#~ msgid "Failed to create page for `%s'\n" +#~ msgstr "发送消息失败。\n" + +#, fuzzy, c-format +#~ msgid "Failed to setup post processor for `%s'\n" +#~ msgstr "解析配置文件“%s”失败\n" + #, fuzzy, c-format #~ msgid "Unable to parse PKEY record `%s'\n" #~ msgstr "解析配置文件“%s”失败\n" @@ -9305,10 +9412,6 @@ msgstr "初始化“%s”服务失败。\n" #~ msgid "Failed to connect to transport service!\n" #~ msgstr "初始化“%s”服务失败。\n" -#, fuzzy -#~ msgid "unknown error" -#~ msgstr "未知错误" - #, fuzzy #~ msgid "Invalid response from `fs' service." #~ msgstr "“%s”的参数无效。\n" @@ -10002,10 +10105,6 @@ msgstr "初始化“%s”服务失败。\n" #~ msgid "Failed to queue a leave notification\n" #~ msgstr "保存配置失败。" -#, fuzzy -#~ msgid "Configuration fails to specify `%s', assuming default value." -#~ msgstr "配置文件“%s”已写入。\n" - #, fuzzy #~ msgid "Option `%s' not specified in configuration section `%s'\n" #~ msgstr "配置文件“%s”已写入。\n" diff --git a/src/datacache/plugin_datacache_postgres.c b/src/datacache/plugin_datacache_postgres.c index 724324ca4..6613ae928 100644 --- a/src/datacache/plugin_datacache_postgres.c +++ b/src/datacache/plugin_datacache_postgres.c @@ -306,7 +306,7 @@ postgres_plugin_get (void *cls, { struct Plugin *plugin = cls; uint32_t type32 = (uint32_t) type; - struct GNUNET_TIME_Absolute now; + struct GNUNET_TIME_Absolute now = { 0 }; struct GNUNET_PQ_QueryParam paramk[] = { GNUNET_PQ_query_param_auto_from_type (key), GNUNET_PQ_query_param_absolute_time (&now), @@ -424,7 +424,7 @@ postgres_plugin_get_random (void *cls, { struct Plugin *plugin = cls; uint32_t off; - struct GNUNET_TIME_Absolute now; + struct GNUNET_TIME_Absolute now = { 0 }; struct GNUNET_TIME_Absolute expiration_time; size_t data_size; void *data; diff --git a/src/datacache/plugin_datacache_sqlite.c b/src/datacache/plugin_datacache_sqlite.c index a7da6b068..66ff9e82c 100644 --- a/src/datacache/plugin_datacache_sqlite.c +++ b/src/datacache/plugin_datacache_sqlite.c @@ -468,7 +468,7 @@ sqlite_plugin_get_random (void *cls, struct GNUNET_TIME_Absolute exp; size_t size; void *dat; - uint32_t off; + uint32_t off = 0; size_t psize; uint32_t type; struct GNUNET_PeerIdentity *path; diff --git a/src/include/Makefile.am b/src/include/Makefile.am index d15186342..16ff25350 100644 --- a/src/include/Makefile.am +++ b/src/include/Makefile.am @@ -117,6 +117,7 @@ gnunetinclude_HEADERS = \ gnunet_testbed_logger_service.h \ gnunet_testbed_ng_service.h \ gnunet_testing_lib.h \ + gnunet_testing_plugin.h \ gnunet_testing_ng_lib.h \ gnunet_time_lib.h \ gnunet_transport_service.h \ diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am index 868e3fcec..8b28e6e23 100644 --- a/src/testing/Makefile.am +++ b/src/testing/Makefile.am @@ -15,7 +15,7 @@ lib_LTLIBRARIES = \ libgnunettesting.la libgnunettesting_la_SOURCES = \ - testing.c \ + testing.c testing.h \ testing_api_cmd_system_create.c \ testing_api_cmd_batch.c \ testing_api_cmd_hello_world.c \ -- cgit v1.2.3 From 21eb6700d55be00750dbc2e43ca7bcc752f3ccef Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 8 Aug 2021 21:37:43 +0200 Subject: -fix debian package issues reported by Florian --- contrib/Makefile.inc | 3 +-- doc/handbook/Makefile.am | 40 ++++++++++++++++++++-------------------- src/arm/arm_api.c | 7 +++++-- 3 files changed, 26 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/contrib/Makefile.inc b/contrib/Makefile.inc index a563ef4a1..c737a07f8 100644 --- a/contrib/Makefile.inc +++ b/contrib/Makefile.inc @@ -8,8 +8,7 @@ BUILDCOMMON_SHLIB_FILES = \ build-common/sh/lib.sh/existence_python.sh \ build-common/sh/lib.sh/msg.sh \ build-common/sh/lib.sh/progname.sh \ - build-common/sh/lib.sh/version_gnunet.sh \ - build-common/LICENSE + build-common/sh/lib.sh/version_gnunet.sh BUILDCOMMON_CONF_FILES = \ build-common/conf/.dir-locals.el \ diff --git a/doc/handbook/Makefile.am b/doc/handbook/Makefile.am index 5bb374717..acf781b0e 100644 --- a/doc/handbook/Makefile.am +++ b/doc/handbook/Makefile.am @@ -38,16 +38,9 @@ dist_infoimage_DATA = \ images/gnunet-gtk-0-10-fs-search.png \ images/gnunet-tutorial-service.png \ images/gnunet-tutorial-system.png \ - images/daemon_lego_block.svg \ - images/lego_stack.svg \ - images/service_lego_block.svg \ - images/structure.dot \ - images/gns.dot \ images/gns.jpg \ - images/tng.dot \ images/tng.png - info_TEXINFOS = \ gnunet.texi @@ -88,24 +81,31 @@ gnunet_TEXINFOS = \ EXTRA_DIST = \ $(gnunet_TEXINFOS) \ htmlxref.cnf \ - version.texi \ + version.texi \ run-gendocs.sh \ - docstyle.css \ - manual.css \ - reset.css \ - style.css + docstyle.css \ + manual.css \ + reset.css \ + style.css \ + images/daemon_lego_block.svg \ + images/lego_stack.svg \ + images/service_lego_block.svg \ + images/gns.dot \ + images/structure.dot \ + images/tng.dot + DISTCLEANFILES = \ - gnunet.cps \ - chapters/developer.cps \ - chapters/installation.cps \ - chapter/philosophy.cps \ + gnunet.cps \ + chapters/developer.cps \ + chapters/installation.cps \ + chapter/philosophy.cps \ chapters/user.cps \ - chapters/configuration.cps \ - chapters/terminology.cps \ - chapters/vocabulary.cps \ - fdl-1.3.cps \ + chapters/configuration.cps \ + chapters/terminology.cps \ + chapters/vocabulary.cps \ + fdl-1.3.cps \ agpl-3.0.cps \ gpl-3.0.cps diff --git a/src/arm/arm_api.c b/src/arm/arm_api.c index afc32fc3a..5fcbfb0a9 100644 --- a/src/arm/arm_api.c +++ b/src/arm/arm_api.c @@ -977,9 +977,12 @@ GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h, { GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "pipe"); - } else { + ret = GNUNET_ARM_RESULT_START_FAILED; + } + else + { wsig = GNUNET_DISK_pipe_detach_end (sig, - GNUNET_DISK_PIPE_END_WRITE); + GNUNET_DISK_PIPE_END_WRITE); ret = start_arm_service (h, std_inheritance, wsig); -- cgit v1.2.3 From 576fce82f4275975e03ab6a114a1f5b86cdf8b9c Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Mon, 9 Aug 2021 12:49:56 +0200 Subject: -coverity --- src/identity/plugin_rest_identity.c | 26 +++++++++++++++++++++----- src/rest/plugin_rest_config.c | 13 +++++++------ src/util/crypto_hkdf.c | 6 +++++- 3 files changed, 33 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/identity/plugin_rest_identity.c b/src/identity/plugin_rest_identity.c index dba1d478d..d7cd0e826 100644 --- a/src/identity/plugin_rest_identity.c +++ b/src/identity/plugin_rest_identity.c @@ -322,7 +322,9 @@ do_error (void *cls) handle->response_code = MHD_HTTP_OK; response = json_dumps (json_error, 0); resp = GNUNET_REST_create_response (response); - MHD_add_response_header (resp, "Content-Type", "application/json"); + GNUNET_assert (MHD_NO != MHD_add_response_header (resp, + "Content-Type", + "application/json")); handle->proc (handle->proc_cls, resp, handle->response_code); json_decref (json_error); GNUNET_free (response); @@ -412,7 +414,9 @@ ego_get_for_subsystem (void *cls, result_str = json_dumps (json_root, 0); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str); resp = GNUNET_REST_create_response (result_str); - MHD_add_response_header (resp, "Content-Type", "application/json"); + GNUNET_assert (MHD_NO != MHD_add_response_header (resp, + "Content-Type", + "application/json")); json_decref (json_root); handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); GNUNET_free (result_str); @@ -514,7 +518,9 @@ ego_get_all (struct GNUNET_REST_RequestHandle *con_handle, result_str = json_dumps (json_root, 0); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str); resp = GNUNET_REST_create_response (result_str); - MHD_add_response_header (resp, "Content-Type", "application/json"); + GNUNET_assert (MHD_NO != MHD_add_response_header (resp, + "Content-Type", + "application/json")); json_decref (json_root); handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); GNUNET_free (result_str); @@ -561,7 +567,9 @@ ego_get_response (struct RequestHandle *handle, struct EgoEntry *ego_entry) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str); resp = GNUNET_REST_create_response (result_str); handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); - MHD_add_response_header (resp, "Content-Type", "application/json"); + GNUNET_assert (MHD_NO != MHD_add_response_header (resp, + "Content-Type", + "application/json")); json_decref (json_ego); GNUNET_free (result_str); GNUNET_SCHEDULER_add_now (&cleanup_handle, handle); @@ -1195,7 +1203,9 @@ options_cont (struct GNUNET_REST_RequestHandle *con_handle, // For now, independent of path return all options resp = GNUNET_REST_create_response (NULL); - MHD_add_response_header (resp, "Access-Control-Allow-Methods", allow_methods); + GNUNET_assert (MHD_NO != MHD_add_response_header (resp, + "Access-Control-Allow-Methods", + allow_methods)); handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); GNUNET_SCHEDULER_add_now (&cleanup_handle, handle); return; @@ -1216,6 +1226,12 @@ list_ego (void *cls, state = ID_REST_STATE_POST_INIT; return; } + if (NULL == ego) + { + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Called with NULL ego\n"); + return; + } if (ID_REST_STATE_INIT == state) { ego_entry = GNUNET_new (struct EgoEntry); diff --git a/src/rest/plugin_rest_config.c b/src/rest/plugin_rest_config.c index 8269a4662..b0f18754c 100644 --- a/src/rest/plugin_rest_config.c +++ b/src/rest/plugin_rest_config.c @@ -91,7 +91,6 @@ static struct RequestHandle *requests_head; static struct RequestHandle *requests_tail; - /** * Cleanup request handle. * @@ -199,7 +198,9 @@ get_cont (struct GNUNET_REST_RequestHandle *con_handle, } response = json_dumps (result, 0); resp = GNUNET_REST_create_response (response); - MHD_add_response_header (resp, "Content-Type", "application/json"); + GNUNET_assert (MHD_NO != MHD_add_response_header (resp, + "Content-Type", + "application/json")); handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); cleanup_handle (handle); GNUNET_free (response); @@ -353,9 +354,9 @@ options_cont (struct GNUNET_REST_RequestHandle *con_handle, struct RequestHandle *handle = cls; resp = GNUNET_REST_create_response (NULL); - MHD_add_response_header (resp, - "Access-Control-Allow-Methods", - MHD_HTTP_METHOD_GET); + GNUNET_assert (MHD_NO != MHD_add_response_header (resp, + "Access-Control-Allow-Methods", + MHD_HTTP_METHOD_GET)); handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); cleanup_handle (handle); } @@ -425,7 +426,7 @@ libgnunet_plugin_rest_config_init (void *cls) api->cls = &plugin; api->name = GNUNET_REST_API_NS_CONFIG; api->process_request = &rest_config_process_request; - GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("CONFIG REST API initialized\n")); + GNUNET_log (GNUNET_ERROR_TYPE_INFO, _ ("CONFIG REST API initialized\n")); return api; } diff --git a/src/util/crypto_hkdf.c b/src/util/crypto_hkdf.c index 86a814b12..7270b87b6 100644 --- a/src/util/crypto_hkdf.c +++ b/src/util/crypto_hkdf.c @@ -77,7 +77,11 @@ static const void * doHMAC (gcry_md_hd_t mac, const void *key, size_t key_len, const void *buf, size_t buf_len) { - gcry_md_setkey (mac, key, key_len); + if (GPG_ERR_NO_ERROR != gcry_md_setkey (mac, key, key_len)) + { + GNUNET_break (0); + return NULL; + } gcry_md_write (mac, buf, buf_len); return (const void *) gcry_md_read (mac, 0); -- cgit v1.2.3 From b7cd1917589e6a607f5eb01b5f85f570f9ce2afb Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Mon, 9 Aug 2021 12:53:53 +0200 Subject: -more coverity --- src/gns/gnunet-gns-proxy.c | 2 +- src/namecache/namecache_api.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gns/gnunet-gns-proxy.c b/src/gns/gnunet-gns-proxy.c index 5e3f9d6df..ec9fb12ae 100644 --- a/src/gns/gnunet-gns-proxy.c +++ b/src/gns/gnunet-gns-proxy.c @@ -1264,7 +1264,7 @@ curl_check_hdr (void *buffer, } GNUNET_free (leho_host); } - if (0 == strcasecmp (MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, + else if (0 == strcasecmp (MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, hdr_type)) { char *leho_host; diff --git a/src/namecache/namecache_api.c b/src/namecache/namecache_api.c index fdbf142a7..70c848037 100644 --- a/src/namecache/namecache_api.c +++ b/src/namecache/namecache_api.c @@ -228,6 +228,7 @@ handle_lookup_block_response (void *cls, char buf[size] GNUNET_ALIGN; struct GNUNET_GNSRECORD_Block *block; + memset (buf, 0, size); block = (struct GNUNET_GNSRECORD_Block *) buf; GNUNET_memcpy (block, &msg[1], -- cgit v1.2.3 From f2de541f3a44913c69a1bd222587d0643ee33e49 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 9 Aug 2021 15:09:56 +0200 Subject: -fix bit shift op --- src/setu/gnunet-service-setu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/setu/gnunet-service-setu.c b/src/setu/gnunet-service-setu.c index b01b897d8..38027983a 100644 --- a/src/setu/gnunet-service-setu.c +++ b/src/setu/gnunet-service-setu.c @@ -2146,11 +2146,15 @@ send_ibf (struct Operation *op, LOG (GNUNET_ERROR_TYPE_DEBUG, "sending ibf of size %u\n", - 1 << ibf_size); + (unsigned int) ibf_size); { char name[64]; - GNUNET_snprintf (name, sizeof(name), "# sent IBF (order %u)", ibf_size); + + GNUNET_snprintf (name, + sizeof(name), + "# sent IBF (order %u)", + ibf_size); GNUNET_STATISTICS_update (_GSS_statistics, name, 1, GNUNET_NO); } -- cgit v1.2.3 From e2f5f39f0d1cecf6a8f528a758cdf9615c9ba6ce Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 9 Aug 2021 15:14:19 +0200 Subject: -fix assertion --- src/util/strings.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/util/strings.c b/src/util/strings.c index 24335e444..673915888 100644 --- a/src/util/strings.c +++ b/src/util/strings.c @@ -1600,7 +1600,7 @@ GNUNET_STRINGS_base64_encode (const void *in, char *opt; ret = 0; - GNUNET_assert (len / 4 < SIZE_MAX); + GNUNET_assert (len < SIZE_MAX / 4 * 3 ); opt = GNUNET_malloc (2 + (len * 4 / 3) + 8); for (size_t i = 0; i < len; ++i) { -- cgit v1.2.3 From 13c49e31c55e26d3d353c39f45822266202341d8 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 9 Aug 2021 15:15:43 +0200 Subject: -fix loop --- src/setu/ibf.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/setu/ibf.c b/src/setu/ibf.c index 8f29adb62..dbd23c320 100644 --- a/src/setu/ibf.c +++ b/src/setu/ibf.c @@ -462,11 +462,11 @@ unpack_counter (const struct InvertibleBloomFilter *ibf, /** * Pack data left in story before finishing */ - while (bit_to_read_left >= 0) + while (true) { /** - * Stop decoding when end is reached - */ + * Stop decoding when end is reached + */ if (ibf_counter_ctr > (count - 1)) return; @@ -504,13 +504,9 @@ unpack_counter (const struct InvertibleBloomFilter *ibf, store = store | byte_read; } break; - } - } - } - } -- cgit v1.2.3 From 7bb8e4004058320917bdae1d6c45de2d3d18d8b0 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 9 Aug 2021 15:18:23 +0200 Subject: -fix memory leak --- src/setu/gnunet-service-setu.c | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/setu/gnunet-service-setu.c b/src/setu/gnunet-service-setu.c index 38027983a..a65db418a 100644 --- a/src/setu/gnunet-service-setu.c +++ b/src/setu/gnunet-service-setu.c @@ -4115,26 +4115,20 @@ handle_union_p2p_offer (void *cls, perf_store.demand.sent += 1; perf_store.demand.sent_var_bytes += sizeof(struct GNUNET_HashCode); #endif - ev = GNUNET_MQ_msg_header_extra (demands, - sizeof(struct GNUNET_HashCode), - GNUNET_MESSAGE_TYPE_SETU_P2P_DEMAND); /* Save send demand message for message control */ if (GNUNET_YES != update_message_control_flow ( op->message_control_flow, MSG_CFS_SENT, hash, - DEMAND_MESSAGE) - ) + DEMAND_MESSAGE)) { - // GNUNET_free (ev); LOG (GNUNET_ERROR_TYPE_ERROR, "Double demand message sent found!\n"); GNUNET_break (0); fail_union_operation (op); return; } - ; /* Mark offer as received received */ if (GNUNET_YES != @@ -4142,37 +4136,31 @@ handle_union_p2p_offer (void *cls, op->message_control_flow, MSG_CFS_RECEIVED, hash, - OFFER_MESSAGE) - ) + OFFER_MESSAGE)) { - // GNUNET_free (ev); LOG (GNUNET_ERROR_TYPE_ERROR, "Double offer message received found!\n"); GNUNET_break (0); fail_union_operation (op); return; } - ; - /* Mark element to be expected to received */ if (GNUNET_YES != update_message_control_flow ( op->message_control_flow, MSG_CFS_EXPECTED, hash, - ELEMENT_MESSAGE) - ) + ELEMENT_MESSAGE)) { - // GNUNET_free (ev); LOG (GNUNET_ERROR_TYPE_ERROR, "Element already expected!\n"); GNUNET_break (0); fail_union_operation (op); return; } - ; - - + ev = GNUNET_MQ_msg_header_extra (demands, + sizeof(struct GNUNET_HashCode), + GNUNET_MESSAGE_TYPE_SETU_P2P_DEMAND); GNUNET_memcpy (&demands[1], hash, sizeof(struct GNUNET_HashCode)); -- cgit v1.2.3 From 7e7ddf0fef3fc28f44b558bdaf73b992133c8635 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 9 Aug 2021 15:19:29 +0200 Subject: -fix memory leak --- src/conversation/conversation_api.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/conversation/conversation_api.c b/src/conversation/conversation_api.c index 88fe8f11c..1984abdd6 100644 --- a/src/conversation/conversation_api.c +++ b/src/conversation/conversation_api.c @@ -645,6 +645,7 @@ GNUNET_CONVERSATION_phone_create (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_CRYPTO_hash (line, strlen (line), &line_port); + GNUNET_free (line); phone = GNUNET_new (struct GNUNET_CONVERSATION_Phone); if (GNUNET_OK != GNUNET_CRYPTO_get_peer_identity (cfg, -- cgit v1.2.3 From 6db56797ae56332504477ef4185ea3a53cc59c80 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 9 Aug 2021 15:22:32 +0200 Subject: -fix floating point logic --- src/setu/gnunet-service-setu.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/setu/gnunet-service-setu.c b/src/setu/gnunet-service-setu.c index a65db418a..339d347f8 100644 --- a/src/setu/gnunet-service-setu.c +++ b/src/setu/gnunet-service-setu.c @@ -1119,15 +1119,16 @@ estimate_best_mode_of_operation (uint64_t avg_element_size, ibf_bucket_count = IBF_MIN_SIZE; } uint64_t ibf_message_count = ceil ( ((float) ibf_bucket_count) - / MAX_BUCKETS_PER_MESSAGE); + / ((float) MAX_BUCKETS_PER_MESSAGE)); uint64_t estimated_counter_size = ceil ( - MIN (2 * log2l ((float) local_set_size / ibf_bucket_count), log2l ( - local_set_size))); + MIN (2 * log2l (((float) local_set_size) + / ((float) ibf_bucket_count)), + log2l (local_set_size))); long double counter_bytes = (float) estimated_counter_size / 8; - uint64_t ibf_bytes = ceil ((sizeof(struct IBFMessage) * ibf_message_count) + uint64_t ibf_bytes = ceil ((sizeof (struct IBFMessage) * ibf_message_count) * 1.2 \ + (ibf_bucket_count * sizeof(struct IBF_Key)) * 1.2 \ + (ibf_bucket_count * sizeof(struct IBF_KeyHash)) @@ -1135,18 +1136,18 @@ estimate_best_mode_of_operation (uint64_t avg_element_size, + (ibf_bucket_count * counter_bytes) * 1.2); /* Estimate full byte count for differential sync */ - uint64_t element_size = (avg_element_size + sizeof(struct - GNUNET_SETU_ElementMessage)) \ + uint64_t element_size = (avg_element_size + + sizeof (struct GNUNET_SETU_ElementMessage)) \ * estimated_total_diff; uint64_t done_size = sizeof_done_header; - uint64_t inquery_size = (sizeof(struct IBF_Key) + sizeof(struct - InquiryMessage)) + uint64_t inquery_size = (sizeof (struct IBF_Key) + + sizeof (struct InquiryMessage)) * estimated_total_diff; uint64_t demand_size = (sizeof(struct GNUNET_HashCode) + sizeof(struct GNUNET_MessageHeader)) * estimated_total_diff; - uint64_t offer_size = (sizeof(struct GNUNET_HashCode) + sizeof(struct - GNUNET_MessageHeader)) + uint64_t offer_size = (sizeof (struct GNUNET_HashCode) + + sizeof (struct GNUNET_MessageHeader)) * estimated_total_diff; uint64_t total_bytes_diff = (element_size + done_size + inquery_size @@ -1183,12 +1184,13 @@ estimate_best_mode_of_operation (uint64_t avg_element_size, * @param allowed_phases * @param size_phases * @param op - * @return GNUNET_YES if message permitted in phase and GNUNET_NO if not permitted in given + * @return #GNUNET_YES if message permitted in phase and #GNUNET_NO if not permitted in given * phase */ -static int -check_valid_phase (const uint8_t allowed_phases[], size_t size_phases, struct - Operation *op) +static enum GNUNET_GenericReturnValue +check_valid_phase (const uint8_t allowed_phases[], + size_t size_phases, + struct Operation *op) { /** * Iterate over allowed phases -- cgit v1.2.3 From 2c2cc95e7ad9c315374068aa0b3d3dca4ede928f Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 9 Aug 2021 15:28:56 +0200 Subject: -check return values --- src/util/os_priority.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/util/os_priority.c b/src/util/os_priority.c index 1ed9bcbf7..dc2f0f97e 100644 --- a/src/util/os_priority.c +++ b/src/util/os_priority.c @@ -316,7 +316,7 @@ open_dev_null (int target_fd, int flags) if (-1 == dup2 (fd, target_fd)) { GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "dup2"); - (void) close (fd); + GNUNET_break (0 == close (fd)); return; } GNUNET_break (0 == close (fd)); @@ -395,7 +395,7 @@ start_process (enum GNUNET_OS_InheritStdioFlags std_inheritance, if (NULL != childpipe_write) GNUNET_DISK_file_close (childpipe_write); if (0 <= dup_childpipe_read_fd) - close (dup_childpipe_read_fd); + GNUNET_break (0 == close (dup_childpipe_read_fd)); return NULL; } childpipe_read_fd = dup_childpipe_read_fd; @@ -474,7 +474,7 @@ start_process (enum GNUNET_OS_InheritStdioFlags std_inheritance, if (NULL != childpipe_write) GNUNET_DISK_file_close (childpipe_write); if (0 <= childpipe_read_fd) - close (childpipe_read_fd); + GNUNET_break (0 == close (childpipe_read_fd)); errno = eno; return NULL; } @@ -486,7 +486,7 @@ start_process (enum GNUNET_OS_InheritStdioFlags std_inheritance, gnunet_proc->control_pipe = childpipe_write; if (0 != (std_inheritance & GNUNET_OS_USE_PIPE_CONTROL)) { - close (childpipe_read_fd); + GNUNET_break (0 == close (childpipe_read_fd)); } GNUNET_array_grow (lscp, ls, 0); return gnunet_proc; @@ -564,7 +564,7 @@ start_process (enum GNUNET_OS_InheritStdioFlags std_inheritance, { /* Bury any existing FD, no matter what; they should all be closed * on exec anyway and the important ones have been dup'ed away */ - (void) close (tgt); + GNUNET_break (0 == close (tgt)); GNUNET_assert (-1 != dup2 (lscp[i], tgt)); } /* unset close-on-exec flag */ -- cgit v1.2.3 From 885490c46980b90dd40a46c0790d4e334188e2dc Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 9 Aug 2021 15:37:40 +0200 Subject: -check return values --- src/util/network.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/util/network.c b/src/util/network.c index e771a9834..61da37ab7 100644 --- a/src/util/network.c +++ b/src/util/network.c @@ -122,7 +122,7 @@ GNUNET_NETWORK_test_pf (int pf) } else { - close (s); + GNUNET_break (0 == close (s)); ret = GNUNET_OK; } switch (pf) -- cgit v1.2.3 From 064e862c6f0a052fda3167cb6bf338f34bcbe9d8 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 9 Aug 2021 15:44:36 +0200 Subject: -check return values --- src/vpn/gnunet-helper-vpn.c | 43 +++++++++++++++---------------------------- 1 file changed, 15 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/vpn/gnunet-helper-vpn.c b/src/vpn/gnunet-helper-vpn.c index 7eeb07379..a75298183 100644 --- a/src/vpn/gnunet-helper-vpn.c +++ b/src/vpn/gnunet-helper-vpn.c @@ -107,7 +107,7 @@ init_tun (char *dev) fprintf (stderr, "File descriptor to large: %d", fd); - (void) close (fd); + GNUNET_break (0 == close (fd)); return -1; } @@ -127,7 +127,7 @@ init_tun (char *dev) "Error with ioctl on `%s': %s\n", "/dev/net/tun", strerror (errno)); - (void) close (fd); + GNUNET_break (0 == close (fd)); return -1; } strcpy (dev, ifr.ifr_name); @@ -188,7 +188,7 @@ set_address6 (const char *dev, "ioctl failed at %d: %s\n", __LINE__, strerror (errno)); - (void) close (fd); + GNUNET_break (0 == close (fd)); exit (1); } @@ -208,7 +208,7 @@ set_address6 (const char *dev, "ioctl failed at line %d: %s\n", __LINE__, strerror (errno)); - (void) close (fd); + GNUNET_break (0 == close (fd)); exit (1); } @@ -223,7 +223,7 @@ set_address6 (const char *dev, "ioctl failed at line %d: %s\n", __LINE__, strerror (errno)); - (void) close (fd); + GNUNET_break (0 == close (fd)); exit (1); } @@ -239,17 +239,11 @@ set_address6 (const char *dev, "ioctl failed at line %d: %s\n", __LINE__, strerror (errno)); - (void) close (fd); + GNUNET_break (0 == close (fd)); exit (1); } - if (0 != close (fd)) - { - fprintf (stderr, - "close failed: %s\n", - strerror (errno)); - exit (1); - } + GNUNET_assert (0 == close (fd)); } @@ -305,7 +299,7 @@ set_address4 (const char *dev, "ioctl failed at %d: %s\n", __LINE__, strerror (errno)); - (void) close (fd); + GNUNET_break (0 == close (fd)); exit (1); } @@ -320,7 +314,7 @@ set_address4 (const char *dev, fprintf (stderr, "Failed to parse IPv4 address mask `%s'\n", mask); - (void) close (fd); + GNUNET_break (0 == close (fd)); exit (1); } @@ -333,7 +327,7 @@ set_address4 (const char *dev, "ioctl failed at line %d: %s\n", __LINE__, strerror (errno)); - (void) close (fd); + GNUNET_break (0 == close (fd)); exit (1); } @@ -346,7 +340,7 @@ set_address4 (const char *dev, "ioctl failed at line %d: %s\n", __LINE__, strerror (errno)); - (void) close (fd); + GNUNET_break (0 == close (fd)); exit (1); } @@ -360,18 +354,11 @@ set_address4 (const char *dev, "ioctl failed at line %d: %s\n", __LINE__, strerror (errno)); - (void) close (fd); + GNUNET_break (0 == close (fd)); exit (1); } - if (0 != close (fd)) - { - fprintf (stderr, - "close failed: %s\n", - strerror (errno)); - (void) close (fd); - exit (1); - } + GNUNET_assert (0 == close (fd)); } @@ -653,7 +640,7 @@ main (int argc, char **argv) { fprintf (stderr, "Fatal: prefix_len out of range\n"); - close (fd_tun); + GNUNET_break (0 == close (fd_tun)); return 1; } @@ -701,6 +688,6 @@ main (int argc, char **argv) run (fd_tun); global_ret = 0; cleanup: - close (fd_tun); + GNUNET_break (0 == close (fd_tun)); return global_ret; } -- cgit v1.2.3 From 7598cf6b7969d74c3219cb0abac523144ad4d2a2 Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Tue, 10 Aug 2021 10:44:56 +0200 Subject: - fix vpn helper linking --- src/vpn/Makefile.am | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/vpn/Makefile.am b/src/vpn/Makefile.am index d1ecd9f98..a5bbb6e22 100644 --- a/src/vpn/Makefile.am +++ b/src/vpn/Makefile.am @@ -31,7 +31,10 @@ bin_PROGRAMS = \ gnunet-vpn gnunet_helper_vpn_SOURCES = \ -gnunet-helper-vpn.c + gnunet-helper-vpn.c +gnunet_helper_vpn_LDADD = \ + $(top_builddir)/src/util/libgnunetutil.la \ + $(GN_LIBINTL) gnunet_service_vpn_SOURCES = \ gnunet-service-vpn.c -- cgit v1.2.3 From 6c76e94d03436fcd7b3ddd8fd0b512fc8e8c5aae Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 10 Aug 2021 21:38:08 +0200 Subject: -vpn helper does not even link against libgnunetutil, avoid GNUNET_assert/break --- src/vpn/gnunet-helper-vpn.c | 44 +++++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/vpn/gnunet-helper-vpn.c b/src/vpn/gnunet-helper-vpn.c index a75298183..7686d51d5 100644 --- a/src/vpn/gnunet-helper-vpn.c +++ b/src/vpn/gnunet-helper-vpn.c @@ -107,7 +107,7 @@ init_tun (char *dev) fprintf (stderr, "File descriptor to large: %d", fd); - GNUNET_break (0 == close (fd)); + (void) close (fd); return -1; } @@ -127,7 +127,7 @@ init_tun (char *dev) "Error with ioctl on `%s': %s\n", "/dev/net/tun", strerror (errno)); - GNUNET_break (0 == close (fd)); + (void) close (fd); return -1; } strcpy (dev, ifr.ifr_name); @@ -188,7 +188,7 @@ set_address6 (const char *dev, "ioctl failed at %d: %s\n", __LINE__, strerror (errno)); - GNUNET_break (0 == close (fd)); + (void) close (fd); exit (1); } @@ -208,7 +208,7 @@ set_address6 (const char *dev, "ioctl failed at line %d: %s\n", __LINE__, strerror (errno)); - GNUNET_break (0 == close (fd)); + (void) close (fd); exit (1); } @@ -223,7 +223,7 @@ set_address6 (const char *dev, "ioctl failed at line %d: %s\n", __LINE__, strerror (errno)); - GNUNET_break (0 == close (fd)); + (void) close (fd); exit (1); } @@ -239,11 +239,18 @@ set_address6 (const char *dev, "ioctl failed at line %d: %s\n", __LINE__, strerror (errno)); - GNUNET_break (0 == close (fd)); + (void) close (fd); exit (1); } - GNUNET_assert (0 == close (fd)); + if (0 != close (fd)) + { + fprintf (stderr, + "close failed at line %d: %s\n", + __LINE__, + strerror (errno)); + exit (1); + } } @@ -299,7 +306,7 @@ set_address4 (const char *dev, "ioctl failed at %d: %s\n", __LINE__, strerror (errno)); - GNUNET_break (0 == close (fd)); + (void) close (fd); exit (1); } @@ -314,7 +321,7 @@ set_address4 (const char *dev, fprintf (stderr, "Failed to parse IPv4 address mask `%s'\n", mask); - GNUNET_break (0 == close (fd)); + (void) close (fd); exit (1); } @@ -327,7 +334,7 @@ set_address4 (const char *dev, "ioctl failed at line %d: %s\n", __LINE__, strerror (errno)); - GNUNET_break (0 == close (fd)); + (void) close (fd); exit (1); } @@ -340,7 +347,7 @@ set_address4 (const char *dev, "ioctl failed at line %d: %s\n", __LINE__, strerror (errno)); - GNUNET_break (0 == close (fd)); + (void) close (fd); exit (1); } @@ -354,11 +361,18 @@ set_address4 (const char *dev, "ioctl failed at line %d: %s\n", __LINE__, strerror (errno)); - GNUNET_break (0 == close (fd)); + (void) close (fd); exit (1); } - GNUNET_assert (0 == close (fd)); + if (0 != close (fd)) + { + fprintf (stderr, + "close failed at line %d: %s\n", + __LINE__, + strerror (errno)); + exit (1); + } } @@ -640,7 +654,7 @@ main (int argc, char **argv) { fprintf (stderr, "Fatal: prefix_len out of range\n"); - GNUNET_break (0 == close (fd_tun)); + (void) close (fd_tun); return 1; } @@ -688,6 +702,6 @@ main (int argc, char **argv) run (fd_tun); global_ret = 0; cleanup: - GNUNET_break (0 == close (fd_tun)); + (void) close (fd_tun); return global_ret; } -- cgit v1.2.3 From 26132842da462e44c397bda0941bcb9bf5e1c942 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 16 Aug 2021 09:14:56 +0200 Subject: -fix indent --- src/include/gnunet_container_lib.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/include/gnunet_container_lib.h b/src/include/gnunet_container_lib.h index c8930746d..3eb80595c 100644 --- a/src/include/gnunet_container_lib.h +++ b/src/include/gnunet_container_lib.h @@ -2608,7 +2608,8 @@ GNUNET_CONTAINER_heap_node_get_cost ( * @return #GNUNET_YES if we should continue to iterate, * #GNUNET_NO if not. */ -typedef int (*GNUNET_CONTAINER_HeapIterator) ( +typedef int +(*GNUNET_CONTAINER_HeapIterator) ( void *cls, struct GNUNET_CONTAINER_HeapNode *node, void *element, -- cgit v1.2.3 From 58b837048d27e04db8f5c02d6559fe7880c6cdb3 Mon Sep 17 00:00:00 2001 From: t3sserakt Date: Mon, 16 Aug 2021 09:20:39 +0200 Subject: - small changes to simple send --- src/include/gnunet_testbed_ng_service.h | 3 ++- src/testbed/testbed_api_cmd_netjail_start.c | 18 +++++++++++++ .../testbed_api_cmd_netjail_start_testbed.c | 31 +++++++++++++++++++--- src/testbed/testbed_api_cmd_netjail_stop.c | 18 +++++++++++++ src/transport/Makefile.am | 28 +++++++++---------- src/transport/plugin_cmd_simple_send.c | 15 ++++++----- src/transport/test_transport_api_cmd_simple_send.c | 11 +++++--- 7 files changed, 95 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/include/gnunet_testbed_ng_service.h b/src/include/gnunet_testbed_ng_service.h index 49e9f56bc..2ff5228cf 100644 --- a/src/include/gnunet_testbed_ng_service.h +++ b/src/include/gnunet_testbed_ng_service.h @@ -233,7 +233,8 @@ struct GNUNET_TESTING_Command GNUNET_TESTBED_cmd_netjail_start_testbed (const char *label, char *local_m, char *global_n, - char *plugin_name); + char *plugin_name, + unsigned int *rv); /** diff --git a/src/testbed/testbed_api_cmd_netjail_start.c b/src/testbed/testbed_api_cmd_netjail_start.c index bc035abe7..8edfb8b62 100644 --- a/src/testbed/testbed_api_cmd_netjail_start.c +++ b/src/testbed/testbed_api_cmd_netjail_start.c @@ -139,6 +139,24 @@ netjail_start_run (void *cls, ns->local_m, ns->global_n, NULL}; + unsigned int helper_check = GNUNET_OS_check_helper_binary (NETJAIL_START_SCRIPT, + GNUNET_YES, + NULL); + + if (GNUNET_NO == helper_check) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "No SUID for %s!\n", + NETJAIL_START_SCRIPT); + GNUNET_TESTING_interpreter_fail (); + } + else if (GNUNET_NO == helper_check) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "%s not found!\n", + NETJAIL_START_SCRIPT); + GNUNET_TESTING_interpreter_fail (); + } ns->start_proc = GNUNET_OS_start_process_vap (GNUNET_OS_INHERIT_STD_ERR, NULL, diff --git a/src/testbed/testbed_api_cmd_netjail_start_testbed.c b/src/testbed/testbed_api_cmd_netjail_start_testbed.c index 2b81c05d1..db9cf7508 100644 --- a/src/testbed/testbed_api_cmd_netjail_start_testbed.c +++ b/src/testbed/testbed_api_cmd_netjail_start_testbed.c @@ -54,6 +54,8 @@ struct HelperMessage struct NetJailState { + unsigned int *rv; + struct HelperMessage *hp_messages_head; struct HelperMessage *hp_messages_tail; @@ -285,8 +287,9 @@ helper_mst (void *cls, const struct GNUNET_MessageHeader *message) static void exp_cb (void *cls) { + struct NetJailState *ns = cls; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Called exp_cb.\n"); - GNUNET_TESTING_interpreter_fail (); + *ns->rv = 1; } @@ -334,6 +337,9 @@ start_testbed (struct NetJailState *ns, struct NULL}; unsigned int m = atoi (m_char); unsigned int n = atoi (n_char); + unsigned int helper_check = GNUNET_OS_check_helper_binary (NETJAIL_EXEC_SCRIPT, + GNUNET_YES, + NULL); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "m: %d n: %d\n", @@ -364,6 +370,23 @@ start_testbed (struct NetJailState *ns, struct "test_testbed_api.conf"); }*/ + + + if (GNUNET_NO == helper_check) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "No SUID for %s!\n", + NETJAIL_EXEC_SCRIPT); + *ns->rv = 1; + } + else if (GNUNET_NO == helper_check) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "%s not found!\n", + NETJAIL_EXEC_SCRIPT); + *ns->rv = 1; + } + GNUNET_array_append (ns->helper, ns->n_helper, GNUNET_HELPER_start ( GNUNET_YES, NETJAIL_EXEC_SCRIPT, @@ -405,7 +428,7 @@ start_testbed (struct NetJailState *ns, struct GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Send handle is NULL!\n"); GNUNET_free (msg); - GNUNET_TESTING_interpreter_fail (); + *ns->rv = 1; } } @@ -524,7 +547,8 @@ struct GNUNET_TESTING_Command GNUNET_TESTBED_cmd_netjail_start_testbed (const char *label, char *local_m, char *global_n, - char *plugin_name) + char *plugin_name, + unsigned int *rv) { struct NetJailState *ns; @@ -532,6 +556,7 @@ GNUNET_TESTBED_cmd_netjail_start_testbed (const char *label, ns->local_m = local_m; ns->global_n = global_n; ns->plugin_name = plugin_name; + ns->rv = rv; struct GNUNET_TESTING_Command cmd = { .cls = ns, diff --git a/src/testbed/testbed_api_cmd_netjail_stop.c b/src/testbed/testbed_api_cmd_netjail_stop.c index c0fc33ff9..947384fed 100644 --- a/src/testbed/testbed_api_cmd_netjail_stop.c +++ b/src/testbed/testbed_api_cmd_netjail_stop.c @@ -135,6 +135,24 @@ netjail_stop_run (void *cls, ns->local_m, ns->global_n, NULL}; + unsigned int helper_check = GNUNET_OS_check_helper_binary (NETJAIL_STOP_SCRIPT, + GNUNET_YES, + NULL); + + if (GNUNET_NO == helper_check) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "No SUID for %s!\n", + NETJAIL_STOP_SCRIPT); + GNUNET_TESTING_interpreter_fail (); + } + else if (GNUNET_NO == helper_check) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "%s not found!\n", + NETJAIL_STOP_SCRIPT); + GNUNET_TESTING_interpreter_fail (); + } ns->stop_proc = GNUNET_OS_start_process_vap (GNUNET_OS_INHERIT_STD_ERR, NULL, diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am index 55a338729..e19ebd8e9 100644 --- a/src/transport/Makefile.am +++ b/src/transport/Makefile.am @@ -398,20 +398,20 @@ plugin_LTLIBRARIES = \ $(HTTP_SERVER_PLUGIN_LA) \ $(HTTPS_SERVER_PLUGIN_LA) \ $(WLAN_PLUGIN_LA) \ - $(BT_PLUGIN_LA) -# libgnunet_plugin_cmd_simple_send.la - -#libgnunet_plugin_cmd_simple_send_la_SOURCES = \ -# plugin_cmd_simple_send.c -#libgnunet_plugin_cmd_simple_send_la_LIBADD = \ -# $(top_builddir)/src/util/libgnunetutil.la \ -# $(top_builddir)/src/testing/libgnunettesting.la \ -# $(top_builddir)/src/statistics/libgnunetstatistics.la \ -# $(top_builddir)/src/testbed/libgnunettestbed.la \ -# libgnunettransporttesting2.la \ -# $(LTLIBINTL) -#libgnunet_plugin_cmd_simple_send_la_LDFLAGS = \ -# $(GN_PLUGIN_LDFLAGS) + $(BT_PLUGIN_LA) \ + libgnunet_plugin_cmd_simple_send.la + +libgnunet_plugin_cmd_simple_send_la_SOURCES = \ + plugin_cmd_simple_send.c +libgnunet_plugin_cmd_simple_send_la_LIBADD = \ + $(top_builddir)/src/util/libgnunetutil.la \ + $(top_builddir)/src/testing/libgnunettesting.la \ + $(top_builddir)/src/statistics/libgnunetstatistics.la \ + $(top_builddir)/src/testbed/libgnunettestbed.la \ + libgnunettransporttesting2.la \ + $(LTLIBINTL) +libgnunet_plugin_cmd_simple_send_la_LDFLAGS = \ + $(GN_PLUGIN_LDFLAGS) if HAVE_EXPERIMENTAL plugin_LTLIBRARIES += libgnunet_plugin_transport_udp.la diff --git a/src/transport/plugin_cmd_simple_send.c b/src/transport/plugin_cmd_simple_send.c index e2407c8c0..2a4a8c137 100644 --- a/src/transport/plugin_cmd_simple_send.c +++ b/src/transport/plugin_cmd_simple_send.c @@ -98,13 +98,13 @@ start_testcase (TESTBED_CMD_HELPER_write_cb write_message, char *router_ip, n); LOG (GNUNET_ERROR_TYPE_ERROR, - "cfgname: %s\n", + "plugin cfgname: %s\n", cfgname); LOG (GNUNET_ERROR_TYPE_ERROR, "node ip: %s\n", node_ip); - + testdir = GNUNET_malloc (strlen (BASE_DIR) + strlen (m) + strlen (n) + 1); @@ -142,11 +142,12 @@ start_testcase (TESTBED_CMD_HELPER_write_cb write_message, char *router_ip, "start-peer-1", "this is useless"), GNUNET_TRANSPORT_cmd_send_simple ("send-simple-1", - m, - n, - 0, - "start-peer-1", - "this is useless"), + m, + n, + (atoi (n) - 1) * atoi (local_m) + atoi ( + m), + "start-peer-1", + "this is useless"), GNUNET_TESTING_cmd_local_test_finished ("local-test-finished-1", write_message) }; diff --git a/src/transport/test_transport_api_cmd_simple_send.c b/src/transport/test_transport_api_cmd_simple_send.c index 9ae8fcc2b..26da53c47 100644 --- a/src/transport/test_transport_api_cmd_simple_send.c +++ b/src/transport/test_transport_api_cmd_simple_send.c @@ -28,6 +28,10 @@ #include "gnunet_testbed_ng_service.h" #include "gnunet_util_lib.h" +#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 120) + +static unsigned int rv = 0; + /** * Main function to run the test cases. @@ -45,7 +49,8 @@ run (void *cls) GNUNET_TESTBED_cmd_netjail_start_testbed ("netjail-start-testbed-1", "2", "1", - "libgnunet_plugin_cmd_simple_send"), + "libgnunet_plugin_cmd_simple_send", + &rv), GNUNET_TESTBED_cmd_stop_testbed ("stop-testbed", "netjail-start-testbed-1", "2", @@ -58,7 +63,7 @@ run (void *cls) GNUNET_TESTING_run (NULL, commands, - GNUNET_TIME_UNIT_FOREVER_REL); + TIMEOUT); } @@ -66,8 +71,6 @@ int main (int argc, char *const *argv) { - int rv = 0; - GNUNET_log_setup ("test-netjail", "DEBUG", NULL); -- cgit v1.2.3 From 0f00c002810907f4edf740203bdf24d81124fd32 Mon Sep 17 00:00:00 2001 From: t3sserakt Date: Mon, 16 Aug 2021 11:04:33 +0200 Subject: - commented plugin in Makefile.am because of circular dependency problem --- src/transport/Makefile.am | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am index 0613f663d..0782a631b 100644 --- a/src/transport/Makefile.am +++ b/src/transport/Makefile.am @@ -398,20 +398,20 @@ plugin_LTLIBRARIES = \ $(HTTP_SERVER_PLUGIN_LA) \ $(HTTPS_SERVER_PLUGIN_LA) \ $(WLAN_PLUGIN_LA) \ - $(BT_PLUGIN_LA) \ - libgnunet_plugin_cmd_simple_send.la - -libgnunet_plugin_cmd_simple_send_la_SOURCES = \ - plugin_cmd_simple_send.c -libgnunet_plugin_cmd_simple_send_la_LIBADD = \ - $(top_builddir)/src/util/libgnunetutil.la \ - $(top_builddir)/src/testing/libgnunettesting.la \ - $(top_builddir)/src/statistics/libgnunetstatistics.la \ - $(top_builddir)/src/testbed/libgnunettestbed.la \ - libgnunettransporttesting2.la \ - $(LTLIBINTL) -libgnunet_plugin_cmd_simple_send_la_LDFLAGS = \ - $(GN_PLUGIN_LDFLAGS) + $(BT_PLUGIN_LA) +# libgnunet_plugin_cmd_simple_send.la + +#libgnunet_plugin_cmd_simple_send_la_SOURCES = \ +# plugin_cmd_simple_send.c +#libgnunet_plugin_cmd_simple_send_la_LIBADD = \ +# $(top_builddir)/src/util/libgnunetutil.la \ +# $(top_builddir)/src/testing/libgnunettesting.la \ +# $(top_builddir)/src/statistics/libgnunetstatistics.la \ +# $(top_builddir)/src/testbed/libgnunettestbed.la \ +# libgnunettransporttesting2.la \ +# $(LTLIBINTL) +#libgnunet_plugin_cmd_simple_send_la_LDFLAGS = \ +# $(GN_PLUGIN_LDFLAGS) if HAVE_EXPERIMENTAL plugin_LTLIBRARIES += libgnunet_plugin_transport_udp.la -- cgit v1.2.3 From 1e063cd73452396778cf00127346b9b08a922317 Mon Sep 17 00:00:00 2001 From: t3sserakt Date: Tue, 17 Aug 2021 14:21:53 +0200 Subject: - renamed methods and variables to prepare moving files from testbed to testing, to fix circular dependency problem --- po/POTFILES.in | 124 +++++---- src/include/gnunet_testbed_ng_service.h | 203 +-------------- src/include/gnunet_testing_plugin.h | 4 +- src/testbed/Makefile.am | 11 - src/testbed/gnunet-cmd.c | 123 --------- src/testbed/plugin_testcmd.c | 2 +- src/testbed/test_testbed_api_cmd_netjail.c | 20 +- src/testbed/testbed_api_cmd_controller.c | 203 --------------- src/testbed/testbed_api_cmd_local_test_finished.c | 4 +- src/testbed/testbed_api_cmd_netjail_start.c | 11 +- .../testbed_api_cmd_netjail_start_testbed.c | 99 +++----- src/testbed/testbed_api_cmd_netjail_stop.c | 11 +- src/testbed/testbed_api_cmd_netjail_stop_testbed.c | 36 +-- src/testbed/testbed_api_cmd_peer.c | 281 --------------------- src/testbed/testbed_api_cmd_peer_store.c | 60 ----- src/testbed/testbed_api_cmd_send_peer_ready.c | 4 +- src/testbed/testbed_api_cmd_tng_connect.c | 55 ---- src/testbed/testbed_api_cmd_tng_service.c | 276 -------------------- src/testing/netjail_exec.sh | 16 ++ src/testing/netjail_start.sh | 52 ++++ src/testing/netjail_stop.sh | 26 ++ src/testing/testing_api_cmd_send_peer_ready.c | 4 +- src/transport/plugin_cmd_simple_send.c | 2 +- src/transport/test_transport_api_cmd_simple_send.c | 22 +- 24 files changed, 264 insertions(+), 1385 deletions(-) delete mode 100644 src/testbed/gnunet-cmd.c delete mode 100644 src/testbed/testbed_api_cmd_controller.c delete mode 100644 src/testbed/testbed_api_cmd_peer.c delete mode 100644 src/testbed/testbed_api_cmd_peer_store.c delete mode 100644 src/testbed/testbed_api_cmd_tng_connect.c delete mode 100644 src/testbed/testbed_api_cmd_tng_service.c create mode 100755 src/testing/netjail_exec.sh create mode 100755 src/testing/netjail_start.sh create mode 100755 src/testing/netjail_stop.sh (limited to 'src') diff --git a/po/POTFILES.in b/po/POTFILES.in index edd56bf95..8ed952089 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -10,13 +10,21 @@ src/arm/arm_monitor_api.c src/arm/gnunet-arm.c src/arm/gnunet-service-arm.c src/arm/mockup-service.c +src/ats-tests/ats-testing-experiment.c +src/ats-tests/ats-testing-log.c +src/ats-tests/ats-testing-preferences.c +src/ats-tests/ats-testing-traffic.c +src/ats-tests/ats-testing.c +src/ats-tests/gnunet-ats-sim.c +src/ats-tests/gnunet-solver-eval.c +src/ats-tool/gnunet-ats.c src/ats/ats_api_connectivity.c src/ats/ats_api_performance.c src/ats/ats_api_scanner.c src/ats/ats_api_scheduling.c src/ats/gnunet-ats-solver-eval.c -src/ats/gnunet-service-ats_addresses.c src/ats/gnunet-service-ats.c +src/ats/gnunet-service-ats_addresses.c src/ats/gnunet-service-ats_connectivity.c src/ats/gnunet-service-ats_normalization.c src/ats/gnunet-service-ats_performance.c @@ -25,14 +33,6 @@ src/ats/gnunet-service-ats_preferences.c src/ats/gnunet-service-ats_reservations.c src/ats/gnunet-service-ats_scheduling.c src/ats/plugin_ats_proportional.c -src/ats-tests/ats-testing.c -src/ats-tests/ats-testing-experiment.c -src/ats-tests/ats-testing-log.c -src/ats-tests/ats-testing-preferences.c -src/ats-tests/ats-testing-traffic.c -src/ats-tests/gnunet-ats-sim.c -src/ats-tests/gnunet-solver-eval.c -src/ats-tool/gnunet-ats.c src/auction/gnunet-auction-create.c src/auction/gnunet-auction-info.c src/auction/gnunet-auction-join.c @@ -50,8 +50,8 @@ src/cadet/cadet_api_list_peers.c src/cadet/cadet_api_list_tunnels.c src/cadet/cadet_test_lib.c src/cadet/desirability_table.c -src/cadet/gnunet-cadet.c src/cadet/gnunet-cadet-profiler.c +src/cadet/gnunet-cadet.c src/cadet/gnunet-service-cadet.c src/cadet/gnunet-service-cadet_channel.c src/cadet/gnunet-service-cadet_connection.c @@ -67,15 +67,15 @@ src/consensus/gnunet-service-consensus.c src/consensus/plugin_block_consensus.c src/conversation/conversation_api.c src/conversation/conversation_api_call.c -src/conversation/gnunet-conversation.c src/conversation/gnunet-conversation-test.c -src/conversation/gnunet_gst.c -src/conversation/gnunet_gst_test.c -src/conversation/gnunet-helper-audio-playback.c +src/conversation/gnunet-conversation.c src/conversation/gnunet-helper-audio-playback-gst.c -src/conversation/gnunet-helper-audio-record.c +src/conversation/gnunet-helper-audio-playback.c src/conversation/gnunet-helper-audio-record-gst.c +src/conversation/gnunet-helper-audio-record.c src/conversation/gnunet-service-conversation.c +src/conversation/gnunet_gst.c +src/conversation/gnunet_gst_test.c src/conversation/microphone.c src/conversation/plugin_gnsrecord_conversation.c src/conversation/speaker.c @@ -105,7 +105,6 @@ src/dht/dht_api.c src/dht/dht_test_lib.c src/dht/gnunet-dht-get.c src/dht/gnunet-dht-monitor.c -src/dht/gnunet_dht_profiler.c src/dht/gnunet-dht-put.c src/dht/gnunet-service-dht.c src/dht/gnunet-service-dht_clients.c @@ -114,6 +113,7 @@ src/dht/gnunet-service-dht_hello.c src/dht/gnunet-service-dht_neighbours.c src/dht/gnunet-service-dht_nse.c src/dht/gnunet-service-dht_routing.c +src/dht/gnunet_dht_profiler.c src/dht/plugin_block_dht.c src/dhtu/plugin_dhtu_gnunet.c src/dhtu/plugin_dhtu_ip.c @@ -150,8 +150,8 @@ src/fs/gnunet-auto-share.c src/fs/gnunet-daemon-fsprofiler.c src/fs/gnunet-directory.c src/fs/gnunet-download.c -src/fs/gnunet-fs.c src/fs/gnunet-fs-profiler.c +src/fs/gnunet-fs.c src/fs/gnunet-helper-fs-publish.c src/fs/gnunet-publish.c src/fs/gnunet-search.c @@ -171,9 +171,9 @@ src/gns/gns_tld_api.c src/gns/gnunet-bcd.c src/gns/gnunet-dns2gns.c src/gns/gnunet-gns-benchmark.c -src/gns/gnunet-gns.c src/gns/gnunet-gns-import.c src/gns/gnunet-gns-proxy.c +src/gns/gnunet-gns.c src/gns/gnunet-service-gns.c src/gns/gnunet-service-gns_interceptor.c src/gns/gnunet-service-gns_resolver.c @@ -191,8 +191,8 @@ src/gnsrecord/json_gnsrecord.c src/gnsrecord/plugin_gnsrecord_dns.c src/hello/address.c src/hello/gnunet-hello.c -src/hello/hello.c src/hello/hello-ng.c +src/hello/hello.c src/hostlist/gnunet-daemon-hostlist.c src/hostlist/gnunet-daemon-hostlist_client.c src/hostlist/gnunet-daemon-hostlist_server.c @@ -208,8 +208,8 @@ src/json/json_helper.c src/json/json_mhd.c src/json/json_pack.c src/messenger/gnunet-messenger.c -src/messenger/gnunet-service-messenger_basement.c src/messenger/gnunet-service-messenger.c +src/messenger/gnunet-service-messenger_basement.c src/messenger/gnunet-service-messenger_ego_store.c src/messenger/gnunet-service-messenger_handle.c src/messenger/gnunet-service-messenger_list_handles.c @@ -248,8 +248,8 @@ src/namecache/namecache_api.c src/namecache/plugin_namecache_flat.c src/namecache/plugin_namecache_postgres.c src/namecache/plugin_namecache_sqlite.c -src/namestore/gnunet-namestore.c src/namestore/gnunet-namestore-fcfsd.c +src/namestore/gnunet-namestore.c src/namestore/gnunet-service-namestore.c src/namestore/gnunet-zoneimport.c src/namestore/namestore_api.c @@ -275,17 +275,17 @@ src/nat/gnunet-service-nat_mini.c src/nat/gnunet-service-nat_stun.c src/nat/nat_api.c src/nat/nat_api_stun.c -src/nse/gnunet-nse.c src/nse/gnunet-nse-profiler.c +src/nse/gnunet-nse.c src/nse/gnunet-service-nse.c src/nse/nse_api.c src/nt/nt.c -src/peerinfo/gnunet-service-peerinfo.c -src/peerinfo/peerinfo_api.c -src/peerinfo/peerinfo_api_notify.c src/peerinfo-tool/gnunet-peerinfo.c src/peerinfo-tool/gnunet-peerinfo_plugins.c src/peerinfo-tool/plugin_rest_peerinfo.c +src/peerinfo/gnunet-service-peerinfo.c +src/peerinfo/peerinfo_api.c +src/peerinfo/peerinfo_api_notify.c src/peerstore/gnunet-peerstore.c src/peerstore/gnunet-service-peerstore.c src/peerstore/peerstore_api.c @@ -335,27 +335,27 @@ src/rest/gnunet-rest-server.c src/rest/plugin_rest_config.c src/rest/plugin_rest_copying.c src/rest/rest.c -src/revocation/gnunet-revocation.c src/revocation/gnunet-revocation-tvg.c +src/revocation/gnunet-revocation.c src/revocation/gnunet-service-revocation.c src/revocation/plugin_block_revocation.c src/revocation/revocation_api.c -src/rps/gnunet-rps.c src/rps/gnunet-rps-profiler.c +src/rps/gnunet-rps.c src/rps/gnunet-service-rps.c src/rps/gnunet-service-rps_custommap.c src/rps/gnunet-service-rps_sampler.c src/rps/gnunet-service-rps_sampler_elem.c src/rps/gnunet-service-rps_view.c -src/rps/rps_api.c src/rps/rps-sampler_client.c src/rps/rps-sampler_common.c src/rps/rps-test_util.c +src/rps/rps_api.c src/scalarproduct/gnunet-scalarproduct.c -src/scalarproduct/gnunet-service-scalarproduct_alice.c -src/scalarproduct/gnunet-service-scalarproduct_bob.c src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c +src/scalarproduct/gnunet-service-scalarproduct_alice.c +src/scalarproduct/gnunet-service-scalarproduct_bob.c src/scalarproduct/scalarproduct_api.c src/secretsharing/gnunet-secretsharing-profiler.c src/secretsharing/gnunet-service-secretsharing.c @@ -369,12 +369,12 @@ src/set/gnunet-set-ibf-profiler.c src/set/gnunet-set-profiler.c src/set/ibf.c src/set/ibf_sim.c +src/set/plugin_block_set_test.c +src/set/set_api.c src/seti/gnunet-service-seti.c src/seti/gnunet-seti-profiler.c src/seti/plugin_block_seti_test.c src/seti/seti_api.c -src/set/plugin_block_set_test.c -src/set/set_api.c src/setu/gnunet-service-setu.c src/setu/gnunet-service-setu_strata_estimator.c src/setu/gnunet-setu-ibf-profiler.c @@ -393,17 +393,17 @@ src/statistics/gnunet-statistics.c src/statistics/statistics_api.c src/template/gnunet-service-template.c src/template/gnunet-template.c +src/testbed-logger/gnunet-service-testbed-logger.c +src/testbed-logger/testbed_logger_api.c src/testbed/generate-underlay-topology.c -src/testbed/gnunet-cmd.c src/testbed/gnunet-cmds-helper.c src/testbed/gnunet-daemon-latency-logger.c src/testbed/gnunet-daemon-testbed-blacklist.c src/testbed/gnunet-daemon-testbed-underlay.c src/testbed/gnunet-helper-testbed.c -src/testbed/gnunet_mpi_test.c src/testbed/gnunet-service-test-barriers.c -src/testbed/gnunet-service-testbed_barriers.c src/testbed/gnunet-service-testbed.c +src/testbed/gnunet-service-testbed_barriers.c src/testbed/gnunet-service-testbed_cache.c src/testbed/gnunet-service-testbed_connectionpool.c src/testbed/gnunet-service-testbed_cpustatus.c @@ -411,67 +411,61 @@ src/testbed/gnunet-service-testbed_links.c src/testbed/gnunet-service-testbed_meminfo.c src/testbed/gnunet-service-testbed_oc.c src/testbed/gnunet-service-testbed_peers.c -src/testbed/gnunet_testbed_mpi_spawn.c src/testbed/gnunet-testbed-profiler.c -src/testbed-logger/gnunet-service-testbed-logger.c -src/testbed-logger/testbed_logger_api.c +src/testbed/gnunet_mpi_test.c +src/testbed/gnunet_testbed_mpi_spawn.c src/testbed/plugin_testcmd.c -src/testbed/testbed_api_barriers.c src/testbed/testbed_api.c +src/testbed/testbed_api_barriers.c src/testbed/testbed_api_cmd_block_until_all_peers_started.c -src/testbed/testbed_api_cmd_controller.c src/testbed/testbed_api_cmd_local_test_finished.c src/testbed/testbed_api_cmd_netjail_start.c src/testbed/testbed_api_cmd_netjail_start_testbed.c src/testbed/testbed_api_cmd_netjail_stop.c src/testbed/testbed_api_cmd_netjail_stop_testbed.c -src/testbed/testbed_api_cmd_peer.c -src/testbed/testbed_api_cmd_peer_store.c src/testbed/testbed_api_cmd_send_peer_ready.c -src/testbed/testbed_api_cmd_tng_connect.c -src/testbed/testbed_api_cmd_tng_service.c src/testbed/testbed_api_hosts.c src/testbed/testbed_api_operations.c src/testbed/testbed_api_peers.c src/testbed/testbed_api_sd.c src/testbed/testbed_api_services.c src/testbed/testbed_api_statistics.c -src/testbed/testbed_api_testbed.c src/testbed/testbed_api_test.c +src/testbed/testbed_api_testbed.c src/testbed/testbed_api_topology.c src/testbed/testbed_api_underlay.c src/testing/gnunet-testing.c src/testing/list-keys.c +src/testing/testing.c src/testing/testing_api_cmd_batch.c -src/testing/testing_api_cmd_hello_world_birth.c src/testing/testing_api_cmd_hello_world.c +src/testing/testing_api_cmd_hello_world_birth.c src/testing/testing_api_cmd_send_peer_ready.c src/testing/testing_api_cmd_system_create.c src/testing/testing_api_loop.c src/testing/testing_api_trait_cmd.c src/testing/testing_api_trait_process.c src/testing/testing_api_traits.c -src/testing/testing.c src/topology/friends.c src/topology/gnunet-daemon-topology.c src/transport/gnunet-communicator-tcp.c src/transport/gnunet-communicator-udp.c src/transport/gnunet-communicator-unix.c src/transport/gnunet-helper-transport-bluetooth.c -src/transport/gnunet-helper-transport-wlan.c src/transport/gnunet-helper-transport-wlan-dummy.c +src/transport/gnunet-helper-transport-wlan.c src/transport/gnunet-service-tng.c -src/transport/gnunet-service-transport_ats.c src/transport/gnunet-service-transport.c +src/transport/gnunet-service-transport_ats.c src/transport/gnunet-service-transport_hello.c src/transport/gnunet-service-transport_manipulation.c src/transport/gnunet-service-transport_neighbours.c src/transport/gnunet-service-transport_plugins.c src/transport/gnunet-service-transport_validation.c -src/transport/gnunet-transport.c src/transport/gnunet-transport-profiler.c src/transport/gnunet-transport-wlan-receiver.c src/transport/gnunet-transport-wlan-sender.c +src/transport/gnunet-transport.c src/transport/plugin_cmd_simple_send.c src/transport/plugin_transport_http_client.c src/transport/plugin_transport_http_common.c @@ -479,14 +473,25 @@ src/transport/plugin_transport_http_server.c src/transport/plugin_transport_smtp.c src/transport/plugin_transport_tcp.c src/transport/plugin_transport_template.c -src/transport/plugin_transport_udp_broadcasting.c src/transport/plugin_transport_udp.c +src/transport/plugin_transport_udp_broadcasting.c src/transport/plugin_transport_unix.c src/transport/plugin_transport_wlan.c src/transport/tcp_connection_legacy.c src/transport/tcp_server_legacy.c src/transport/tcp_server_mst_legacy.c src/transport/tcp_service_legacy.c +src/transport/transport-testing-communicator.c +src/transport/transport-testing-filenames.c +src/transport/transport-testing-filenames2.c +src/transport/transport-testing-loggers.c +src/transport/transport-testing-loggers2.c +src/transport/transport-testing-main.c +src/transport/transport-testing-main2.c +src/transport/transport-testing-send.c +src/transport/transport-testing-send2.c +src/transport/transport-testing.c +src/transport/transport-testing2.c src/transport/transport_api2_application.c src/transport/transport_api2_communication.c src/transport/transport_api2_core.c @@ -502,17 +507,6 @@ src/transport/transport_api_manipulation.c src/transport/transport_api_monitor_peers.c src/transport/transport_api_monitor_plugins.c src/transport/transport_api_offer_hello.c -src/transport/transport-testing2.c -src/transport/transport-testing.c -src/transport/transport-testing-communicator.c -src/transport/transport-testing-filenames2.c -src/transport/transport-testing-filenames.c -src/transport/transport-testing-loggers2.c -src/transport/transport-testing-loggers.c -src/transport/transport-testing-main2.c -src/transport/transport-testing-main.c -src/transport/transport-testing-send2.c -src/transport/transport-testing-send.c src/util/bandwidth.c src/util/benchmark.c src/util/bio.c @@ -527,8 +521,8 @@ src/util/consttime_memcmp.c src/util/container_bloomfilter.c src/util/container_heap.c src/util/container_meta_data.c -src/util/container_multihashmap32.c src/util/container_multihashmap.c +src/util/container_multihashmap32.c src/util/container_multipeermap.c src/util/container_multishortmap.c src/util/container_multiuuidmap.c @@ -554,8 +548,8 @@ src/util/dnsstub.c src/util/getopt.c src/util/getopt_helpers.c src/util/gnunet-base32.c -src/util/gnunet-config.c src/util/gnunet-config-diff.c +src/util/gnunet-config.c src/util/gnunet-crypto-tvg.c src/util/gnunet-ecc.c src/util/gnunet-qr.c @@ -593,8 +587,8 @@ src/vpn/gnunet-helper-vpn.c src/vpn/gnunet-service-vpn.c src/vpn/gnunet-vpn.c src/vpn/vpn_api.c -src/zonemaster/gnunet-service-zonemaster.c src/zonemaster/gnunet-service-zonemaster-monitor.c +src/zonemaster/gnunet-service-zonemaster.c src/fs/fs_api.h src/include/gnunet_json_lib.h src/testbed/testbed_api.h diff --git a/src/include/gnunet_testbed_ng_service.h b/src/include/gnunet_testbed_ng_service.h index 2ff5228cf..5979cd85a 100644 --- a/src/include/gnunet_testbed_ng_service.h +++ b/src/include/gnunet_testbed_ng_service.h @@ -38,176 +38,6 @@ #include "gnunet_util_lib.h" #include "gnunet_testing_ng_lib.h" -struct TngState; - -struct PeerCmdState -{ - /** - * The label of a controller command. - */ - const char *controller_label; - - /** - * Handle to operation - */ - struct GNUNET_TESTBED_Operation *operation; - - /** - * Name of the host, use "NULL" for localhost. - */ - const char *hostname; - - /** - * Username to use for the login; may be NULL. - */ - const char *username; - - /** - * Port number to use for ssh; use 0 to let ssh decide. - */ - uint16_t port; - - /** - * The configuration to use as a template while starting a controller - * on this host. Operation queue sizes specific to a host are also - * read from this configuration handle. - */ - struct GNUNET_CONFIGURATION_Handle *cfg; - - /** - * The host to run peers and controllers on - */ - struct GNUNET_TESTBED_Host *host; - - /** - * Abort task identifier - */ - struct GNUNET_SCHEDULER_Task *abort_task; - - /** - * Flag indicating if peer is ready. - */ - int peer_ready; - - /** - * Flag indicating controller is going down. - */ - int peer_going_down; - - /** - * Interpreter state. - */ - struct GNUNET_TESTING_Interpreter *is; - - /** - * Peer to start - */ - struct GNUNET_TESTBED_Peer *peer; -}; - -struct ControllerState -{ - /** - * The ip address of the controller which will be set as TRUSTED - * HOST(all connections form this ip are permitted by the testbed) when - * starting testbed controller at host. This can either be a single ip - * address or a network address in CIDR notation. - */ - const char *trusted_ip; - - /** - * Name of the host, use "NULL" for localhost. - */ - const char *hostname; - - /** - * Username to use for the login; may be NULL. - */ - const char *username; - - /** - * Port number to use for ssh; use 0 to let ssh decide. - */ - uint16_t port; - - /** - * The configuration to use as a template while starting a controller - * on this host. Operation queue sizes specific to a host are also - * read from this configuration handle. - */ - struct GNUNET_CONFIGURATION_Handle *cfg; - - /** - * The host to run peers and controllers on - */ - struct GNUNET_TESTBED_Host *host; - - /** - * The controller process - */ - struct GNUNET_TESTBED_ControllerProc *cp; - - /** - * The controller handle - */ - struct GNUNET_TESTBED_Controller *controller; - - /** - * A bit mask with set of events to call the controller for. - */ - uint64_t event_mask; - - /** - * Abort task identifier - */ - struct GNUNET_SCHEDULER_Task *abort_task; - - /** - * Handle for host registration - */ - struct GNUNET_TESTBED_HostRegistrationHandle *reg_handle; - - /** - * Flag indicating if host create with controller is ready. - */ - int host_ready; - - /** - * Flag indicating controller is going down. - */ - int controller_going_down; - - /** - * Interpreter state. - */ - struct GNUNET_TESTING_Interpreter *is; -}; - -/** - * Offer data from trait - * - * @param cmd command to extract the controller from. - * @param pt pointer to controller. - * @return #GNUNET_OK on success. - */ -int -GNUNET_TESTBED_get_trait_controller (const struct GNUNET_TESTING_Command *cmd, - struct GNUNET_TESTBED_Controller ** - controller); - -struct GNUNET_TESTING_Command -GNUNET_TESTBED_cmd_controller (const char *label, - const char *host, - uint64_t event_mask); - -void -GNUNET_TESTBED_shutdown_controller (struct ControllerState *cs); - -void -GNUNET_TESTBED_shutdown_peer (struct PeerCmdState *ps); - -void -GNUNET_TESTBED_shutdown_service (struct TngState *ss); /** * Create command. @@ -217,7 +47,7 @@ GNUNET_TESTBED_shutdown_service (struct TngState *ss); * @return command. */ struct GNUNET_TESTING_Command -GNUNET_TESTBED_cmd_netjail_start (const char *label, +GNUNET_TESTING_cmd_netjail_start (const char *label, char *local_m, char *global_n); @@ -230,11 +60,11 @@ GNUNET_TESTBED_cmd_netjail_start (const char *label, * @return command. */ struct GNUNET_TESTING_Command -GNUNET_TESTBED_cmd_netjail_start_testbed (const char *label, - char *local_m, - char *global_n, - char *plugin_name, - unsigned int *rv); +GNUNET_TESTING_cmd_netjail_start_testing_system (const char *label, + char *local_m, + char *global_n, + char *plugin_name, + unsigned int *rv); /** @@ -245,29 +75,24 @@ GNUNET_TESTBED_cmd_netjail_start_testbed (const char *label, * @return command. */ struct GNUNET_TESTING_Command -GNUNET_TESTBED_cmd_netjail_stop (const char *label, +GNUNET_TESTING_cmd_netjail_stop (const char *label, char *local_m, char *global_n); struct GNUNET_TESTING_Command -GNUNET_TESTBED_cmd_stop_testbed (const char *label, - const char *helper_start_label, - char *local_m, - char *global_n); +GNUNET_TESTING_cmd_stop_testing_system (const char *label, + const char *helper_start_label, + char *local_m, + char *global_n); int -GNUNET_TESTBED_get_trait_helper_handles (const struct +GNUNET_TESTING_get_trait_helper_handles (const struct GNUNET_TESTING_Command *cmd, struct GNUNET_HELPER_Handle ***helper); -int -GNUNET_TESTBED_get_trait_hosts (const struct - GNUNET_TESTING_Command *cmd, - struct GNUNET_TESTBED_Host ***hosts); - struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_block_until_all_peers_started (const char *label, unsigned int * @@ -275,11 +100,11 @@ GNUNET_TESTING_cmd_block_until_all_peers_started (const char *label, struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_send_peer_ready (const char *label, - TESTBED_CMD_HELPER_write_cb write_message); + TESTING_CMD_HELPER_write_cb write_message); struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_local_test_finished (const char *label, - TESTBED_CMD_HELPER_write_cb + TESTING_CMD_HELPER_write_cb write_message); #endif diff --git a/src/include/gnunet_testing_plugin.h b/src/include/gnunet_testing_plugin.h index 103eb23be..151827d4b 100644 --- a/src/include/gnunet_testing_plugin.h +++ b/src/include/gnunet_testing_plugin.h @@ -37,11 +37,11 @@ extern "C" #endif typedef void -(*TESTBED_CMD_HELPER_write_cb) (struct GNUNET_MessageHeader *message, size_t +(*TESTING_CMD_HELPER_write_cb) (struct GNUNET_MessageHeader *message, size_t msg_length); typedef void -(*GNUNET_TESTING_PLUGIN_StartTestCase) (TESTBED_CMD_HELPER_write_cb +(*GNUNET_TESTING_PLUGIN_StartTestCase) (TESTING_CMD_HELPER_write_cb write_message, char *router_ip, char *node_ip, char *n, diff --git a/src/testbed/Makefile.am b/src/testbed/Makefile.am index b4b2cff97..5a221cd69 100644 --- a/src/testbed/Makefile.am +++ b/src/testbed/Makefile.am @@ -23,7 +23,6 @@ if HAVE_SQLITE endif libexec_PROGRAMS = \ - gnunet-cmd \ gnunet-cmds-helper \ gnunet-service-testbed \ gnunet-helper-testbed \ @@ -90,14 +89,6 @@ gnunet_helper_testbed_LDADD = $(XLIB) \ libgnunettestbed.la \ $(LTLIBINTL) $(Z_LIBS) -gnunet_cmd_SOURCES = \ - gnunet-cmd.c -gnunet_cmd_LDADD = $(XLIB) \ - $(top_builddir)/src/util/libgnunetutil.la \ - $(top_builddir)/src/testing/libgnunettesting.la \ - libgnunettestbed.la \ - $(LTLIBINTL) $(Z_LIBS) - gnunet_cmds_helper_SOURCES = \ gnunet-cmds-helper.c gnunet_cmds_helper_LDADD = $(XLIB) \ @@ -138,8 +129,6 @@ libgnunettestbed_la_SOURCES = \ testbed_api_cmd_netjail_stop.c \ testbed_api.c testbed_api.h testbed.h \ testbed_api_hosts.c testbed_api_hosts.h testbed_helper.h \ - testbed_api_cmd_controller.c \ - testbed_api_cmd_peer.c \ testbed_api_operations.c testbed_api_operations.h \ testbed_api_peers.c testbed_api_peers.h \ testbed_api_services.c \ diff --git a/src/testbed/gnunet-cmd.c b/src/testbed/gnunet-cmd.c deleted file mode 100644 index 0ba94fdd9..000000000 --- a/src/testbed/gnunet-cmd.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - This file is part of GNUnet - Copyright (C) 2008--2013, 2016 GNUnet e.V. - - GNUnet is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - GNUnet 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 - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - - SPDX-License-Identifier: AGPL3.0-or-later - */ - -/** - * @file testbed/gnunet-cmd.c - * - * @brief Binary to start testcase plugins - * - * @author t3sserakt - */ - -#include "platform.h" -#include "gnunet_util_lib.h" -#include "gnunet_testing_lib.h" -#include "gnunet_testing_plugin.h" - -/** - * Generic logging shortcut - */ -#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__) - -#define NODE_BASE_IP "192.168.15." - -#define ROUTER_BASE_IP "92.68.150." - -/** - * Handle for a plugin. - */ -struct Plugin -{ - /** - * Name of the shared library. - */ - char *library_name; - - /** - * Plugin API. - */ - struct GNUNET_TESTING_PluginFunctions *api; - - char *node_ip; - - char *plugin_name; - - char *global_n; - - char *local_m; - - char *n; - - char *m; -}; - - -/** - * Main function to run the test cases. - * - * @param cls plugin to use. - * - */ -static void -run (void *cls) -{ - struct Plugin *plugin = cls; - char *router_ip; - char *node_ip; - - router_ip = GNUNET_malloc (strlen (ROUTER_BASE_IP) + strlen (plugin->m) + 1); - strcpy (router_ip, ROUTER_BASE_IP); - strcat (router_ip, plugin->m); - - node_ip = GNUNET_malloc (strlen (NODE_BASE_IP) + strlen (plugin->n) + 1); - strcat (node_ip, NODE_BASE_IP); - strcat (node_ip, plugin->n); - - plugin->api->start_testcase (NULL, router_ip, node_ip, NULL, NULL, NULL); - -} - - -int -main (int argc, char *const *argv) -{ - int rv = 0; - struct Plugin *plugin; - - GNUNET_log_setup ("gnunet-cmd", - "DEBUG", - NULL); - - plugin = GNUNET_new (struct Plugin); - plugin->api = GNUNET_PLUGIN_load (argv[0], - NULL); - plugin->library_name = GNUNET_strdup (argv[0]); - - plugin->global_n = argv[1]; - plugin->local_m = argv[2]; - plugin->n = argv[3]; - plugin->m = argv[4]; - - GNUNET_SCHEDULER_run (&run, - plugin); - - GNUNET_free (plugin); - return rv; -} diff --git a/src/testbed/plugin_testcmd.c b/src/testbed/plugin_testcmd.c index e08ec067d..b74b67240 100644 --- a/src/testbed/plugin_testcmd.c +++ b/src/testbed/plugin_testcmd.c @@ -45,7 +45,7 @@ all_peers_started () } static void -start_testcase (TESTBED_CMD_HELPER_write_cb write_message, char *router_ip, +start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip, char *node_ip, char *n, char *m, diff --git a/src/testbed/test_testbed_api_cmd_netjail.c b/src/testbed/test_testbed_api_cmd_netjail.c index 8bb9e40e8..85da39f0e 100644 --- a/src/testbed/test_testbed_api_cmd_netjail.c +++ b/src/testbed/test_testbed_api_cmd_netjail.c @@ -39,18 +39,18 @@ static void run (void *cls) { struct GNUNET_TESTING_Command commands[] = { - GNUNET_TESTBED_cmd_netjail_start ("netjail-start-1", + GNUNET_TESTING_cmd_netjail_start ("netjail-start-1", "2", "2"), - GNUNET_TESTBED_cmd_netjail_start_testbed ("netjail-start-testbed-1", - "2", - "2", - "libgnunet_plugin_testcmd"), - GNUNET_TESTBED_cmd_stop_testbed ("stop-testbed", - "netjail-start-testbed-1", - "2", - "2"), - GNUNET_TESTBED_cmd_netjail_stop ("netjail-stop-1", + GNUNET_TESTING_cmd_netjail_start_testing_system ("netjail-start-testbed-1", + "2", + "2", + "libgnunet_plugin_testcmd"), + GNUNET_TESTING_cmd_stop_testing_system ("stop-testbed", + "netjail-start-testbed-1", + "2", + "2"), + GNUNET_TESTING_cmd_netjail_stop ("netjail-stop-1", "2", "2"), GNUNET_TESTING_cmd_end () diff --git a/src/testbed/testbed_api_cmd_controller.c b/src/testbed/testbed_api_cmd_controller.c deleted file mode 100644 index 794b1ccf3..000000000 --- a/src/testbed/testbed_api_cmd_controller.c +++ /dev/null @@ -1,203 +0,0 @@ -/* - This file is part of GNUnet - Copyright (C) 2021 GNUnet e.V. - - GNUnet is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - GNUnet 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 - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - - SPDX-License-Identifier: AGPL3.0-or-later - */ - -/** - * @file testbed/testbed_api_cmd_controller.c - * @brief Command to create a controller. - * @author t3sserakt - */ -#include "platform.h" -#include "gnunet_util_lib.h" -#include "gnunet_testing_ng_lib.h" -#include "gnunet-service-testbed.h" -#include "testbed_api_hosts.h" -#include "gnunet_testbed_ng_service.h" - - -/** - * Generic logging shortcut - */ -#define LOG(kind, ...) \ - GNUNET_log (kind, __VA_ARGS__) - - -/** -* -* -* @param cls closure -* @param cmd current CMD being cleaned up. -*/ -static void -controller_cleanup (void *cls, - const struct GNUNET_TESTING_Command *cmd) -{ - (void) cls; -} - - -/** - * Signature of the event handler function called by the - * respective event controller. - * - * @param cls closure - * @param event information about the event - */ -static void -controller_cb (void *cls, - const struct GNUNET_TESTBED_EventInformation *event) -{ - struct ControllerState *cs = cls; - - if (NULL != event->details.operation_finished.emsg) - { - LOG (GNUNET_ERROR_TYPE_ERROR, "There was an operation error: %s\n", - event->details.operation_finished.emsg); - GNUNET_TESTBED_shutdown_controller (cs); - } - else if (NULL == event->details.operation_finished.generic) - { - GNUNET_TESTBED_operation_done (event->op); - } -} - - -static void -controller_run (void *cls, - const struct GNUNET_TESTING_Command *cmd, - struct GNUNET_TESTING_Interpreter *is) -{ - struct ControllerState *cs = cls; - - cs->is = is; - - cs->controller = - GNUNET_TESTBED_controller_connect (cs->host, cs->event_mask, &controller_cb, - cs); - - -} - -/** -* -* -* @param cls closure. -* @param[out] ret result -* @param trait name of the trait. -* @param index index number of the object to offer. -* @return #GNUNET_OK on success. -*/ -static int -controller_traits (void *cls, - const void **ret, - const char *trait, - unsigned int index) -{ - (void) cls; - - struct ControllerState *cs = cls; - - - struct GNUNET_TESTING_Trait traits[] = { - { - .index = 0, - .trait_name = "controller", - .ptr = (const void *) cs->controller, - }, - GNUNET_TESTING_trait_end () - }; - - return GNUNET_TESTING_get_trait (traits, - ret, - trait, - index); - return GNUNET_OK; -} - - -/** - * Offer data from trait - * - * @param cmd command to extract the controller from. - * @param pt pointer to controller. - * @return #GNUNET_OK on success. - */ -int -GNUNET_TESTBED_get_trait_controller (const struct GNUNET_TESTING_Command *cmd, - struct GNUNET_TESTBED_Controller ** - controller) -{ - return cmd->traits (cmd->cls, - (const void **) controller, - "controller", - (unsigned int) 0); -} - - -/** - * Shutdown nicely - * - * @param cs controller state. - */ -void -GNUNET_TESTBED_shutdown_controller (struct ControllerState *cs) -{ - LOG (GNUNET_ERROR_TYPE_DEBUG, - "Shutting down...\n"); - - cs->controller_going_down = GNUNET_YES; - - if (NULL != cs->abort_task) - GNUNET_SCHEDULER_cancel (cs->abort_task); - if (NULL != cs->reg_handle) - GNUNET_TESTBED_cancel_registration (cs->reg_handle); - if (NULL != cs->controller) - GNUNET_TESTBED_controller_disconnect (cs->controller); - if (NULL != cs->cfg) - GNUNET_CONFIGURATION_destroy (cs->cfg); - if (NULL != cs->cp) - GNUNET_TESTBED_controller_stop (cs->cp); - if (NULL != cs->host) - GNUNET_TESTBED_host_destroy (cs->host); -} - - - -struct GNUNET_TESTING_Command -GNUNET_TESTBED_cmd_controller (const char *label, - const char *host, - uint64_t event_mask) -{ - struct ControllerState *cs; - - cs = GNUNET_new (struct ControllerState); - cs->event_mask = event_mask; - cs->hostname = host; - - - struct GNUNET_TESTING_Command cmd = { - .cls = cs, - .label = label, - .run = &controller_run, - .cleanup = &controller_cleanup, - .traits = &controller_traits - }; - - return cmd; -} diff --git a/src/testbed/testbed_api_cmd_local_test_finished.c b/src/testbed/testbed_api_cmd_local_test_finished.c index b5f4b8b31..c02546945 100644 --- a/src/testbed/testbed_api_cmd_local_test_finished.c +++ b/src/testbed/testbed_api_cmd_local_test_finished.c @@ -35,7 +35,7 @@ struct LocalFinishedState { - TESTBED_CMD_HELPER_write_cb write_message; + TESTING_CMD_HELPER_write_cb write_message; struct GNUNET_CMDS_LOCAL_FINISHED *reply; }; @@ -107,7 +107,7 @@ local_test_finished_finish (void *cls, */ struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_local_test_finished (const char *label, - TESTBED_CMD_HELPER_write_cb + TESTING_CMD_HELPER_write_cb write_message) { struct LocalFinishedState *lfs; diff --git a/src/testbed/testbed_api_cmd_netjail_start.c b/src/testbed/testbed_api_cmd_netjail_start.c index 8edfb8b62..0cc020275 100644 --- a/src/testbed/testbed_api_cmd_netjail_start.c +++ b/src/testbed/testbed_api_cmd_netjail_start.c @@ -28,7 +28,7 @@ #include "gnunet_testing_ng_lib.h" #include "gnunet_testbed_ng_service.h" -#define NETJAIL_START_SCRIPT "./../testbed/netjail_start.sh" +#define NETJAIL_START_SCRIPT "./../testing/netjail_start.sh" struct NetJailState { @@ -139,9 +139,10 @@ netjail_start_run (void *cls, ns->local_m, ns->global_n, NULL}; - unsigned int helper_check = GNUNET_OS_check_helper_binary (NETJAIL_START_SCRIPT, - GNUNET_YES, - NULL); + unsigned int helper_check = GNUNET_OS_check_helper_binary ( + NETJAIL_START_SCRIPT, + GNUNET_YES, + NULL); if (GNUNET_NO == helper_check) { @@ -193,7 +194,7 @@ netjail_start_finish (void *cls, * @return command. */ struct GNUNET_TESTING_Command -GNUNET_TESTBED_cmd_netjail_start (const char *label, +GNUNET_TESTING_cmd_netjail_start (const char *label, char *local_m, char *global_n) { diff --git a/src/testbed/testbed_api_cmd_netjail_start_testbed.c b/src/testbed/testbed_api_cmd_netjail_start_testbed.c index db9cf7508..3d1a1d893 100644 --- a/src/testbed/testbed_api_cmd_netjail_start_testbed.c +++ b/src/testbed/testbed_api_cmd_netjail_start_testbed.c @@ -30,7 +30,7 @@ #include "testbed_api_hosts.h" #include "testbed_helper.h" -#define NETJAIL_EXEC_SCRIPT "./../testbed/netjail_exec.sh" +#define NETJAIL_EXEC_SCRIPT "./../testing/netjail_exec.sh" struct HelperMessage; @@ -87,23 +87,16 @@ struct NetJailState unsigned int n_msg; - unsigned int number_of_testbeds_started; + unsigned int number_of_testsystems_started; unsigned int number_of_peers_started; unsigned int number_of_local_test_finished; - /** - * The host where the controller is running - */ - struct GNUNET_TESTBED_Host **host; - - unsigned int n_host; - char *plugin_name; }; -struct TestbedCount +struct TestingSystemCount { unsigned int count; @@ -168,14 +161,14 @@ netjail_exec_traits (void *cls, /** - * Offer handles to testbed helper from trait + * Offer handles to testing cmd helper from trait * * @param cmd command to extract the message from. * @param pt pointer to message. * @return #GNUNET_OK on success. */ int -GNUNET_TESTBED_get_trait_helper_handles (const struct +GNUNET_TESTING_get_trait_helper_handles (const struct GNUNET_TESTING_Command *cmd, struct GNUNET_HELPER_Handle ***helper) { @@ -186,14 +179,14 @@ GNUNET_TESTBED_get_trait_helper_handles (const struct } /** - * Offer handles to testbed helper from trait + * Offer messages received via testing cmd helper from trait * * @param cmd command to extract the message from. * @param pt pointer to message. * @return #GNUNET_OK on success. */ int -GNUNET_TESTBED_get_trait_helper_messages (const struct +GNUNET_TESTING_get_trait_helper_messages (const struct GNUNET_TESTING_Command *cmd, struct HelperMessage *** hp_messages_head) @@ -216,7 +209,7 @@ GNUNET_TESTBED_get_trait_helper_messages (const struct static void clear_msg (void *cls, int result) { - struct TestbedCount *tbc = cls; + struct TestingSystemCount *tbc = cls; struct NetJailState *ns = tbc->ns; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -244,7 +237,7 @@ clear_msg (void *cls, int result) static int helper_mst (void *cls, const struct GNUNET_MessageHeader *message) { - struct TestbedCount *tbc = cls; + struct TestingSystemCount *tbc = cls; struct NetJailState *ns = tbc->ns; struct HelperMessage *hp_msg; @@ -253,10 +246,9 @@ helper_mst (void *cls, const struct GNUNET_MessageHeader *message) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "helper_mst tbc->count: %d\n", tbc->count); - // GNUNET_TESTBED_extract_cfg (host, message); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received message from helper.\n"); - ns->number_of_testbeds_started++; + ns->number_of_testsystems_started++; } else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED == ntohs ( message->type)) @@ -320,57 +312,38 @@ create_helper_init_msg_ (char *m_char, static void -start_testbed (struct NetJailState *ns, struct - GNUNET_CONFIGURATION_Handle *config, - char *m_char, - char *n_char) +start_helper (struct NetJailState *ns, struct + GNUNET_CONFIGURATION_Handle *config, + char *m_char, + char *n_char) { // struct GNUNET_CONFIGURATION_Handle *cfg; struct GNUNET_CMDS_HelperInit *msg; - struct TestbedCount *tbc; + struct TestingSystemCount *tbc; char *const script_argv[] = {NETJAIL_EXEC_SCRIPT, m_char, n_char, - GNUNET_OS_get_libexec_binary_path(HELPER_CMDS_BINARY), + GNUNET_OS_get_libexec_binary_path ( + HELPER_CMDS_BINARY), ns->global_n, ns->local_m, NULL}; unsigned int m = atoi (m_char); unsigned int n = atoi (n_char); - unsigned int helper_check = GNUNET_OS_check_helper_binary (NETJAIL_EXEC_SCRIPT, - GNUNET_YES, - NULL); + unsigned int helper_check = GNUNET_OS_check_helper_binary ( + NETJAIL_EXEC_SCRIPT, + GNUNET_YES, + NULL); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "m: %d n: %d\n", m, n); - tbc = GNUNET_new (struct TestbedCount); + tbc = GNUNET_new (struct TestingSystemCount); tbc->ns = ns; tbc->count = (n - 1) * atoi (ns->local_m) + m; - // cfg = GNUNET_CONFIGURATION_dup (config); - - // TODO We do not need this? - /*GNUNET_array_append (ns->host, ns->n_host, - GNUNET_TESTBED_host_create_with_id (tbc->count - 1, - NULL, - NULL, - cfg, - 0));*/ - - /*if ((GNUNET_YES != GNUNET_DISK_file_test ("test_testbed_api.conf")) || - (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (config, - "test_testbed_api.conf"))) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - _ ( - "Unreadable or malformed configuration file `%s', exit ...\n"), - "test_testbed_api.conf"); - }*/ - - if (GNUNET_NO == helper_check) { @@ -396,13 +369,13 @@ start_testbed (struct NetJailState *ns, struct tbc)); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "First using helper %d %d\n", + "First using helper %d %d\n", tbc->count - 1, ns->n_helper); struct GNUNET_HELPER_Handle *helper = ns->helper[tbc->count - 1]; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "First using helper %d %d %p\n", + "First using helper %d %d %p\n", tbc->count - 1, ns->n_helper, helper); @@ -456,9 +429,9 @@ netjail_exec_run (void *cls, { sprintf (str_n, "%d", i); sprintf (str_m, "%d", j); - start_testbed (ns, config, - str_m, - str_n); + start_helper (ns, config, + str_m, + str_n); } } } @@ -475,7 +448,7 @@ netjail_start_finish (void *cls, struct GNUNET_CMDS_ALL_PEERS_STARTED *reply; size_t msg_length; struct GNUNET_HELPER_Handle *helper; - struct TestbedCount *tbc; + struct TestingSystemCount *tbc; if (ns->number_of_local_test_finished == total_number) { @@ -483,11 +456,11 @@ netjail_start_finish (void *cls, cont (cont_cls); } - if (ns->number_of_testbeds_started == total_number) + if (ns->number_of_testsystems_started == total_number) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All helpers started!\n"); - ns->number_of_testbeds_started = 0; + ns->number_of_testsystems_started = 0; } if (ns->number_of_peers_started == total_number) @@ -498,7 +471,7 @@ netjail_start_finish (void *cls, for (int i = 1; i <= atoi (ns->global_n); i++) { for (int j = 1; j <= atoi (ns->local_m); j++) { - tbc = GNUNET_new (struct TestbedCount); + tbc = GNUNET_new (struct TestingSystemCount); tbc->ns = ns; // TODO This needs to be more generic. As we send more messages back and forth, we can not grow the arrays again and again, because this is to error prone. tbc->count = (i - 1) * atoi (ns->local_m) + j + total_number; @@ -544,11 +517,11 @@ netjail_start_finish (void *cls, * @return command. */ struct GNUNET_TESTING_Command -GNUNET_TESTBED_cmd_netjail_start_testbed (const char *label, - char *local_m, - char *global_n, - char *plugin_name, - unsigned int *rv) +GNUNET_TESTING_cmd_netjail_start_testing_system (const char *label, + char *local_m, + char *global_n, + char *plugin_name, + unsigned int *rv) { struct NetJailState *ns; diff --git a/src/testbed/testbed_api_cmd_netjail_stop.c b/src/testbed/testbed_api_cmd_netjail_stop.c index 947384fed..f837ec08c 100644 --- a/src/testbed/testbed_api_cmd_netjail_stop.c +++ b/src/testbed/testbed_api_cmd_netjail_stop.c @@ -29,7 +29,7 @@ #include "gnunet_testbed_ng_service.h" -#define NETJAIL_STOP_SCRIPT "./../testbed/netjail_stop.sh" +#define NETJAIL_STOP_SCRIPT "./../testing/netjail_stop.sh" struct GNUNET_ChildWaitHandle *cwh; @@ -135,9 +135,10 @@ netjail_stop_run (void *cls, ns->local_m, ns->global_n, NULL}; - unsigned int helper_check = GNUNET_OS_check_helper_binary (NETJAIL_STOP_SCRIPT, - GNUNET_YES, - NULL); + unsigned int helper_check = GNUNET_OS_check_helper_binary ( + NETJAIL_STOP_SCRIPT, + GNUNET_YES, + NULL); if (GNUNET_NO == helper_check) { @@ -192,7 +193,7 @@ netjail_stop_finish (void *cls, * @return command. */ struct GNUNET_TESTING_Command -GNUNET_TESTBED_cmd_netjail_stop (const char *label, +GNUNET_TESTING_cmd_netjail_stop (const char *label, char *local_m, char *global_n) { diff --git a/src/testbed/testbed_api_cmd_netjail_stop_testbed.c b/src/testbed/testbed_api_cmd_netjail_stop_testbed.c index 9a9d489a7..c74c1e94f 100644 --- a/src/testbed/testbed_api_cmd_netjail_stop_testbed.c +++ b/src/testbed/testbed_api_cmd_netjail_stop_testbed.c @@ -53,8 +53,8 @@ struct StopHelperState * @param cmd current CMD being cleaned up. */ static void -stop_testbed_cleanup (void *cls, - const struct GNUNET_TESTING_Command *cmd) +stop_testing_system_cleanup (void *cls, + const struct GNUNET_TESTING_Command *cmd) { } @@ -70,10 +70,10 @@ stop_testbed_cleanup (void *cls, * @return #GNUNET_OK on success. */ static int -stop_testbed_traits (void *cls, - const void **ret, - const char *trait, - unsigned int index) +stop_testing_system_traits (void *cls, + const void **ret, + const char *trait, + unsigned int index) { return GNUNET_OK; } @@ -87,9 +87,9 @@ stop_testbed_traits (void *cls, * @param is interpreter state. */ static void -stop_testbed_run (void *cls, - const struct GNUNET_TESTING_Command *cmd, - struct GNUNET_TESTING_Interpreter *is) +stop_testing_system_run (void *cls, + const struct GNUNET_TESTING_Command *cmd, + struct GNUNET_TESTING_Interpreter *is) { struct StopHelperState *shs = cls; struct GNUNET_HELPER_Handle **helper; @@ -97,7 +97,7 @@ stop_testbed_run (void *cls, start_helper_cmd = GNUNET_TESTING_interpreter_lookup_command ( shs->helper_start_label); - GNUNET_TESTBED_get_trait_helper_handles (start_helper_cmd, + GNUNET_TESTING_get_trait_helper_handles (start_helper_cmd, &helper); for (int i = 1; i <= atoi (shs->global_n); i++) { @@ -118,11 +118,11 @@ stop_testbed_run (void *cls, * @return command. */ struct GNUNET_TESTING_Command -GNUNET_TESTBED_cmd_stop_testbed (const char *label, - const char *helper_start_label, - char *local_m, - char *global_n - ) +GNUNET_TESTING_cmd_stop_testing_system (const char *label, + const char *helper_start_label, + char *local_m, + char *global_n + ) { struct StopHelperState *shs; @@ -134,9 +134,9 @@ GNUNET_TESTBED_cmd_stop_testbed (const char *label, struct GNUNET_TESTING_Command cmd = { .cls = shs, .label = label, - .run = &stop_testbed_run, - .cleanup = &stop_testbed_cleanup, - .traits = &stop_testbed_traits + .run = &stop_testing_system_run, + .cleanup = &stop_testing_system_cleanup, + .traits = &stop_testing_system_traits }; return cmd; diff --git a/src/testbed/testbed_api_cmd_peer.c b/src/testbed/testbed_api_cmd_peer.c deleted file mode 100644 index 2e253e408..000000000 --- a/src/testbed/testbed_api_cmd_peer.c +++ /dev/null @@ -1,281 +0,0 @@ -/* - This file is part of GNUnet - Copyright (C) 2021 GNUnet e.V. - - GNUnet is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - GNUnet 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 - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - - SPDX-License-Identifier: AGPL3.0-or-later - */ - - -/** - * @file testbed/testbed_api_cmd_peer.c - * @brief Command to create a peer. - * @author t3sserakt - */ -#include "platform.h" -#include "gnunet_util_lib.h" -#include "gnunet_testing_ng_lib.h" -#include "gnunet_testbed_ng_service.h" -#include "gnunet-service-testbed.h" -#include "testbed_api_peers.h" - - -/** - * Generic logging shortcut - */ -#define LOG(kind, ...) \ - GNUNET_log (kind, __VA_ARGS__) - - -/** -* -* -* @param cls closure. -* @param[out] ret result -* @param trait name of the trait. -* @param index index number of the object to offer. -* @return #GNUNET_OK on success. -*/ -static int -peer_traits (void *cls, - const void **ret, - const char *trait, - unsigned int index) -{ - struct PeerCmdState *ps = cls; - - struct GNUNET_TESTING_Trait traits[] = { - { - .index = 0, - .trait_name = "peer", - .ptr = (const void *) ps->peer, - }, - GNUNET_TESTING_trait_end () - }; - - return GNUNET_TESTING_get_trait (traits, - ret, - trait, - index); - - return GNUNET_OK; -} - -/** - * Offer data from trait - * - * @param cmd command to extract the controller from. - * @param peer pointer GNUNET_TESTBED_PEER - * @return #GNUNET_OK on success. - */ -int -GNUNET_TESTBED_get_trait_peer (const struct GNUNET_TESTING_Command *cmd, - struct GNUNET_TESTBED_Peer ** - peer) -{ - return cmd->traits (cmd->cls, - (const void **) peer, - "peer", - (unsigned int) 0); -} - - -/** -* -* -* @param cls closure -* @param cmd current CMD being cleaned up. -*/ -static void -peer_cleanup (void *cls, - const struct GNUNET_TESTING_Command *cmd) -{ - (void) cls; -} - - -/** - * abort task to run on test timed out - * - * @param cls NULL - * @param tc the task context - */ -static void -do_abort (void *cls) -{ - struct PeerCmdState *ps = cls; - - if (GNUNET_NO == ps->peer_ready) - { - LOG (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n"); - ps->abort_task = NULL; - GNUNET_TESTBED_shutdown_peer (ps); - } -} - - -/** - * Functions of this signature are called when a peer has been successfully - * created - * - * @param cls the closure from GNUNET_TESTBED_peer_create() - * @param emsg MAY contain an error description, if starting peer failed. - */ -static void -peer_started_cb (void *cls, - const char *emsg) -{ - struct PeerCmdState *ps = cls; - - GNUNET_TESTBED_operation_done (ps->operation); - if (NULL == emsg) - { - ps->peer_ready = GNUNET_YES; - } - else - { - LOG (GNUNET_ERROR_TYPE_ERROR, "There was an error starting a peer: %s\n", - emsg); - } - -} - - -/** - * Functions of this signature are called when a peer has been successfully - * created - * - * @param cls the closure from GNUNET_TESTBED_peer_create() - * @param peer the handle for the created peer; NULL on any error during - * creation - * @param emsg NULL if peer is not NULL; else MAY contain the error description - */ -static void -peer_create_cb (void *cls, - struct GNUNET_TESTBED_Peer *peer, - const char *emsg) -{ - struct PeerCmdState *ps = cls; - - ps->peer = peer; - GNUNET_TESTBED_operation_done (ps->operation); - ps->operation = GNUNET_TESTBED_peer_start (NULL, - peer, - &peer_started_cb, - ps); -} - - -static void -peer_run (void *cls, - const struct GNUNET_TESTING_Command *cmd, - struct GNUNET_TESTING_Interpreter *is) -{ - struct PeerCmdState *ps = cls; - const struct GNUNET_TESTING_Command *controller_cmd; - struct GNUNET_TESTBED_Controller *controller; - - ps->is = is; - controller_cmd = GNUNET_TESTING_interpreter_lookup_command ( - ps->controller_label); - GNUNET_TESTBED_get_trait_controller (controller_cmd, - &controller); - ps->host = GNUNET_TESTBED_host_create (ps->hostname, ps->username, ps->cfg, - ps->port); - ps->operation = - GNUNET_TESTBED_peer_create (controller, - ps->host, - ps->cfg, - &peer_create_cb, - ps); - - ps->abort_task = - GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply - (GNUNET_TIME_UNIT_MINUTES, 5), - &do_abort, - ps); -} - - -void -peer_stopped_cb (void *cls, - const char *emsg) -{ - struct PeerCmdState *ps = cls; - - if (NULL != emsg) - { - LOG (GNUNET_ERROR_TYPE_ERROR, "There was an error stopping a peer: %s\n", - emsg); - } - GNUNET_TESTBED_operation_done (ps->operation); - GNUNET_TESTBED_peer_destroy (ps->peer); -} - - -/** - * Shutdown nicely - * - * @param cs controller state. - */ -void -GNUNET_TESTBED_shutdown_peer (struct PeerCmdState *ps) -{ - LOG (GNUNET_ERROR_TYPE_DEBUG, - "Shutting down...\n"); - - ps->peer_going_down = GNUNET_YES; - - if (NULL != ps->abort_task) - GNUNET_SCHEDULER_cancel (ps->abort_task); - if (NULL != ps->cfg) - GNUNET_CONFIGURATION_destroy (ps->cfg); - if (NULL != ps->host) - GNUNET_TESTBED_host_destroy (ps->host); - - GNUNET_TESTBED_operation_done (ps->operation); - ps->operation = GNUNET_TESTBED_peer_stop (NULL, ps->peer, peer_stopped_cb, - ps); - -} - - -struct GNUNET_TESTING_Command -GNUNET_TESTBED_cmd_peer (const char *label, - const char *controller_label, - const char *hostname, - const char *username, - uint16_t port, - struct GNUNET_CONFIGURATION_Handle *cfg) -{ - struct PeerCmdState *ps; - - ps = GNUNET_new (struct PeerCmdState); - ps->hostname = hostname; - ps->username = username; - ps->port = port; - ps->cfg = cfg; - ps->controller_label = controller_label; - - struct GNUNET_TESTING_Command cmd = { - .cls = ps, - .label = label, - .run = &peer_run, - .cleanup = &peer_cleanup, - .traits = &peer_traits - }; - - return cmd; -} diff --git a/src/testbed/testbed_api_cmd_peer_store.c b/src/testbed/testbed_api_cmd_peer_store.c deleted file mode 100644 index fc96f589c..000000000 --- a/src/testbed/testbed_api_cmd_peer_store.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - This file is part of GNUnet - Copyright (C) 2021 GNUnet e.V. - - GNUnet is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - GNUnet 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 - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - - SPDX-License-Identifier: AGPL3.0-or-later - */ - -/** - * @file testbed/testbed_api_cmd_peer_store.c - * @brief Command to start the peer store service of a peer. - * @author t3sserakt - */ - - -static void -service_run (void *cls, - const struct GNUNET_TESTING_Command *cmd, - struct GNUNET_TESTING_Interpreter *is) -{ - struct PeerStoreState *pss = cls; - - pss->psh = GNUNET_PEERSTORE_connect (pss->cfg); - GNUNET_TESTING_interpreter_next (ps->is); -} - - -struct GNUNET_TESTING_Command -GNUNET_TESTBED_cmd_peer_store (const char *label, - struct GNUNET_CONFIGURATION_Handle *cfg) -{ - - struct PeerStoreState *pss; - - pss = GNUNET_new (struct PeerStoreState); - pss->cfg = cfg; - - struct GNUNET_TESTING_Command cmd = { - .cls = pss, - .label = label, - .run = &peer_store_run, - .cleanup = &peer_store_cleanup, - .traits = &peer_store_traits - }; - - return cmd; - -} diff --git a/src/testbed/testbed_api_cmd_send_peer_ready.c b/src/testbed/testbed_api_cmd_send_peer_ready.c index f175a3e18..987f0853e 100644 --- a/src/testbed/testbed_api_cmd_send_peer_ready.c +++ b/src/testbed/testbed_api_cmd_send_peer_ready.c @@ -31,7 +31,7 @@ struct SendPeerReadyState { - TESTBED_CMD_HELPER_write_cb write_message; + TESTING_CMD_HELPER_write_cb write_message; struct GNUNET_CMDS_PEER_STARTED *reply; }; @@ -84,7 +84,7 @@ send_peer_ready_run (void *cls, */ struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_send_peer_ready (const char *label, - TESTBED_CMD_HELPER_write_cb write_message) + TESTING_CMD_HELPER_write_cb write_message) { struct SendPeerReadyState *sprs; diff --git a/src/testbed/testbed_api_cmd_tng_connect.c b/src/testbed/testbed_api_cmd_tng_connect.c deleted file mode 100644 index e52cd3c76..000000000 --- a/src/testbed/testbed_api_cmd_tng_connect.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - This file is part of GNUnet - Copyright (C) 2021 GNUnet e.V. - - GNUnet is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - GNUnet 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 - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - - SPDX-License-Identifier: AGPL3.0-or-later - */ - - -/** - * @file testbed/testbed_api_cmd_peer.c - * @brief Command to create a peer. - * @author t3sserakt - */ - - -static void -tng_connect_run (void *cls, - const struct GNUNET_TESTING_Command *cmd, - struct GNUNET_TESTING_Interpreter *is) -{ - struct TngConnectState *tcs = cls; - - tcs->ah = GNUNET_TRANSPORT_application_init (tcs->cfg); -} - -struct GNUNET_TESTING_Command -GNUNET_TESTBED_cmd_tng_connect (const char *label) -{ - struct TngConnectState *tcs; - - ts = GNUNET_new (struct TngConnectState); - - struct GNUNET_TESTING_Command cmd = { - .cls = tcs, - .label = label, - .run = &tng_connect_run, - .cleanup = &tmg_connect_cleanup, - .traits = &tng_connect_traits - }; - - return cmd; -} diff --git a/src/testbed/testbed_api_cmd_tng_service.c b/src/testbed/testbed_api_cmd_tng_service.c deleted file mode 100644 index cce2e14e3..000000000 --- a/src/testbed/testbed_api_cmd_tng_service.c +++ /dev/null @@ -1,276 +0,0 @@ -/* - This file is part of GNUnet - Copyright (C) 2021 GNUnet e.V. - - GNUnet is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - GNUnet 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 - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - - SPDX-License-Identifier: AGPL3.0-or-later - */ - -/** - * @file testbed/testbed_api_cmd_tng.c - * @brief Command to start the transport service of a peer. - * @author t3sserakt - */ -#include "platform.h" -#include "gnunet_util_lib.h" -#include "gnunet_testing_ng_lib.h" -#include "gnunet-service-testbed.h" -#include "testbed_api_hosts.h" -#include "gnunet_testbed_ng_service.h" - -/** - * Generic logging shortcut - */ -#define LOG(kind, ...) \ - GNUNET_log (kind, __VA_ARGS__) - - -/** - * abort task to run on test timed out - * - * @param cls NULL - * @param tc the task context - */ -static void -do_abort (void *cls) -{ - struct TngState *ts = cls; - - if (GNUNET_NO == ts->service_ready) - { - LOG (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n"); - ts->abort_task = NULL; - GNUNET_TESTBED_shutdown_service (ts); - } -} - -/** -* -* -* @param cls closure -* @param cmd current CMD being cleaned up. -*/ -static void -tng_service_cleanup (void *cls, - const struct GNUNET_TESTING_Command *cmd) -{ - (void) cls; -} - -/** -* -* -* @param cls closure. -* @param[out] ret result -* @param trait name of the trait. -* @param index index number of the object to offer. -* @return #GNUNET_OK on success. -*/ -static int -tng_service_traits (void *cls, - const void **ret, - const char *trait, - unsigned int index) -{ - (void) cls; - return GNUNET_OK; -} - - -static void * -notify_connect (void *cls, - const struct GNUNET_PeerIdentity *peer, - struct GNUNET_MQ_Handle *mq) -{ - struct TngState *ts = cls; - - if (NULL != emsg) - { - LOG (GNUNET_ERROR_TYPE_ERROR, - "There was an error starting the transport subsystem: %s\n", - emsg); - } - GNUNET_TESTING_interpreter_next (ps->is); - return ts->nc (ts->cb_cls); - -} - - -static void -notify_disconnect (void *cls, - const struct GNUNET_PeerIdentity *peer, - void *handler_cls) -{ -} - - - - -/** - * Adapter function called to establish a connection to - * a service. - * - * @param cls closure - * @param cfg configuration of the peer to connect to; will be available until - * GNUNET_TESTBED_operation_done() is called on the operation returned - * from GNUNET_TESTBED_service_connect() - * @return service handle to return in 'op_result', NULL on error - */ -static void * -connect_adapter (void *cls, - const struct GNUNET_CONFIGURATION_Handle *cfg) -{ - struct TngState *ts = cls; - - service_handle = GNUNET_TRANSPORT_core_connect (cfg, - ts->peer_identity, - ts->handlers, - ts, - ¬ify_connect, - ¬ify_disconnect); - return service_handle; -} - - -/** - * Adapter function called to destroy a connection to - * a service. - * - * @param cls closure - * @param op_result service handle returned from the connect adapter - */ -static void -disconnect_adapter (void *cls, - void *op_result) -{ -} - -/** - * Callback to be called when a service connect operation is completed - * - * @param cls the callback closure from functions generating an operation - * @param op the operation that has been finished - * @param ca_result the service handle returned from GNUNET_TESTBED_ConnectAdapter() - * @param emsg error message in case the operation has failed; will be NULL if - * operation has executed successfully. - */ -static void -service_connect_comp_cb (void *cls, - struct GNUNET_TESTBED_Operation *op, - void *ca_result, - const char *emsg) -{ - struct TngState *ts = cls; - - if (NULL != emsg) - { - LOG (GNUNET_ERROR_TYPE_DEBUG, - "An error occurred connecting to service %s\n", - emsg); - GNUNET_TESTBED_operation_done (ts->operation); - } -} - - -/** - * Callback to be called when the requested peer information is available - * - * @param cls the closure from GNUNET_TESTBED_peer_getinformation() - * @param op the operation this callback corresponds to - * @param pinfo the result; will be NULL if the operation has failed - * @param emsg error message if the operation has failed; - * NULL if the operation is successful - */ -static void -pi_cb (void *cls, - struct GNUNET_TESTBED_Operation *op, - const struct GNUNET_TESTBED_PeerInformation *pinfo, - const char *emsg) -{ - struct TngState *ts = cls; - - ts->peer_identity = pinfo->id; - ts->operation = - GNUNET_TESTBED_service_connect (NULL, peer, NULL, - &service_connect_comp_cb, ts, - &connect_adapter, - &disconnect_adapter, - ts); -} - - -static void -tng_service_run (void *cls, - const struct GNUNET_TESTING_Command *cmd, - struct GNUNET_TESTING_Interpreter *is) -{ - struct TngState *ts = cls; - struct GNUNET_TESTBED_Peer *peer; - const struct GNUNET_TESTING_Command *peer_cmd; - - ts->is = is; - peer_cmd = GNUNET_TESTING_interpreter_lookup_command ( - ts->peer_label); - GNUNET_TESTBED_get_trait_peer (peer_cmd, - &peer); - - ts->operation = GNUNET_TESTBED_peer_get_information (peer, - GNUNET_TESTBED_PIT_IDENTITY, - &pi_cb, - ts); -} - -/** - * Shutdown nicely - * - * @param cs service state. - */ -void -GNUNET_TESTBED_shutdown_service (struct TngState *cs) -{ - LOG (GNUNET_ERROR_TYPE_DEBUG, - "Shutting down...\n"); -} - - -struct GNUNET_TESTING_Command -GNUNET_TESTBED_cmd_tng_service (const char *label, - const char *peer_label, - const struct GNUNET_MQ_MessageHandler *handlers, - GNUNET_TRANSPORT_NotifyConnect nc, - void *cb_cls) - -{ - struct TngState *ts; - - ts = GNUNET_new (struct TngState); - ts->servicename = servicename; - ts->peer_label = peer_label; - ts->handlers = handlers; - ts->nc = nc; - ts->nd = nd; - ts->cb_cls; - - - struct GNUNET_TESTING_Command cmd = { - .cls = ts, - .label = label, - .run = &tng_service_run, - .cleanup = &tmg_service_cleanup, - .traits = &tng_service_traits - }; - - return cmd; -} diff --git a/src/testing/netjail_exec.sh b/src/testing/netjail_exec.sh new file mode 100755 index 000000000..b76d2e444 --- /dev/null +++ b/src/testing/netjail_exec.sh @@ -0,0 +1,16 @@ +#!/bin/sh +. "./../testbed/netjail_core.sh" + +set -eu +set -x + +export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + +M=$1 +N=$2 + +NODE=$(netjail_print_name "N" $N $M) + + + +netjail_node_exec_without_fds $NODE $3 $4 $5 $1 $2 diff --git a/src/testing/netjail_start.sh b/src/testing/netjail_start.sh new file mode 100755 index 000000000..4c1c33c83 --- /dev/null +++ b/src/testing/netjail_start.sh @@ -0,0 +1,52 @@ +#!/bin/sh +. "./../testbed/netjail_core.sh" + +set -eu +set -x + +export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + +LOCAL_M=$1 +GLOBAL_N=$2 + +# TODO: stunserver? ..and globally known peer? + +shift 2 + +LOCAL_GROUP="192.168.15" +GLOBAL_GROUP="92.68.150" + +NETWORK_NET=$(netjail_print_name "n" $GLOBAL_N $LOCAL_M) + +netjail_bridge $NETWORK_NET + +for N in $(seq $GLOBAL_N); do + ROUTER=$(netjail_print_name "R" $N) + + netjail_node $ROUTER + netjail_node_link_bridge $ROUTER $NETWORK_NET "$GLOBAL_GROUP.$N" 24 + + ROUTER_NET=$(netjail_print_name "r" $N) + + netjail_bridge $ROUTER_NET + + for M in $(seq $LOCAL_M); do + NODE=$(netjail_print_name "N" $N $M) + + netjail_node $NODE + netjail_node_link_bridge $NODE $ROUTER_NET "$LOCAL_GROUP.$M" 24 + done + + ROUTER_ADDR="$LOCAL_GROUP.$(($LOCAL_M+1))" + + netjail_node_link_bridge $ROUTER $ROUTER_NET $ROUTER_ADDR 24 + netjail_node_add_nat $ROUTER $ROUTER_ADDR 24 + + for M in $(seq $LOCAL_M); do + NODE=$(netjail_print_name "N" $N $M) + + netjail_node_add_default $NODE $ROUTER_ADDR + done +done + + diff --git a/src/testing/netjail_stop.sh b/src/testing/netjail_stop.sh new file mode 100755 index 000000000..689bf7ae9 --- /dev/null +++ b/src/testing/netjail_stop.sh @@ -0,0 +1,26 @@ +#!/bin/sh +. "./../testbed/netjail_core.sh" + +set -eu +set -x + +export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + +LOCAL_M=$1 +GLOBAL_N=$2 +NETWORK_NET=$(netjail_print_name "n" $GLOBAL_N $LOCAL_M) + +shift 2 + +for N in $(seq $GLOBAL_N); do + for M in $(seq $LOCAL_M); do + netjail_node_clear $(netjail_print_name "N" $N $M) + done + + netjail_bridge_clear $(netjail_print_name "r" $N) + netjail_node_clear $(netjail_print_name "R" $N) +done + +netjail_bridge_clear $NETWORK_NET + +echo "Done" diff --git a/src/testing/testing_api_cmd_send_peer_ready.c b/src/testing/testing_api_cmd_send_peer_ready.c index 27761c4d5..e5e004924 100644 --- a/src/testing/testing_api_cmd_send_peer_ready.c +++ b/src/testing/testing_api_cmd_send_peer_ready.c @@ -32,7 +32,7 @@ struct SendPeerReadyState { - TESTBED_CMD_HELPER_write_cb write_message; + TESTING_CMD_HELPER_write_cb write_message; struct GNUNET_CMDS_PEER_STARTED *reply; }; @@ -85,7 +85,7 @@ send_peer_ready_run (void *cls, */ struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_send_peer_ready (const char *label, - TESTBED_CMD_HELPER_write_cb write_message) + TESTING_CMD_HELPER_write_cb write_message) { struct SendPeerReadyState *sprs; diff --git a/src/transport/plugin_cmd_simple_send.c b/src/transport/plugin_cmd_simple_send.c index 2a4a8c137..468f4e48a 100644 --- a/src/transport/plugin_cmd_simple_send.c +++ b/src/transport/plugin_cmd_simple_send.c @@ -83,7 +83,7 @@ all_peers_started () } static void -start_testcase (TESTBED_CMD_HELPER_write_cb write_message, char *router_ip, +start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip, char *node_ip, char *m, char *n, diff --git a/src/transport/test_transport_api_cmd_simple_send.c b/src/transport/test_transport_api_cmd_simple_send.c index 26da53c47..1cc16f307 100644 --- a/src/transport/test_transport_api_cmd_simple_send.c +++ b/src/transport/test_transport_api_cmd_simple_send.c @@ -43,19 +43,19 @@ static void run (void *cls) { struct GNUNET_TESTING_Command commands[] = { - GNUNET_TESTBED_cmd_netjail_start ("netjail-start-1", + GNUNET_TESTING_cmd_netjail_start ("netjail-start-1", "2", "1"), - GNUNET_TESTBED_cmd_netjail_start_testbed ("netjail-start-testbed-1", - "2", - "1", - "libgnunet_plugin_cmd_simple_send", - &rv), - GNUNET_TESTBED_cmd_stop_testbed ("stop-testbed", - "netjail-start-testbed-1", - "2", - "1"), - GNUNET_TESTBED_cmd_netjail_stop ("netjail-stop-1", + GNUNET_TESTING_cmd_netjail_start_testing_system ("netjail-start-testbed-1", + "2", + "1", + "libgnunet_plugin_cmd_simple_send", + &rv), + GNUNET_TESTING_cmd_stop_testing_system ("stop-testbed", + "netjail-start-testbed-1", + "2", + "1"), + GNUNET_TESTING_cmd_netjail_stop ("netjail-stop-1", "2", "1"), GNUNET_TESTING_cmd_end () -- cgit v1.2.3 From 32a8c505c1fa27bb43c4e7c8d288566d51417f56 Mon Sep 17 00:00:00 2001 From: t3sserakt Date: Tue, 17 Aug 2021 19:57:12 +0200 Subject: - moved test code from testbed to testing --- po/POTFILES.in | 16 +- src/include/Makefile.am | 1 - src/include/gnunet_testbed_ng_service.h | 110 ---- src/include/gnunet_testing_ng_lib.h | 68 +++ src/testbed/Makefile.am | 41 -- src/testbed/gnunet-cmds-helper.c | 663 --------------------- src/testbed/plugin_testcmd.c | 116 ---- src/testbed/test_testbed_api_cmd_netjail.c | 80 --- src/testbed/testbed_api.h | 6 +- ...testbed_api_cmd_block_until_all_peers_started.c | 128 ---- src/testbed/testbed_api_cmd_local_test_finished.c | 131 ---- src/testbed/testbed_api_cmd_netjail_start.c | 218 ------- src/testbed/testbed_api_cmd_netjail_stop.c | 216 ------- src/testbed/testbed_api_cmd_netjail_stop_testbed.c | 143 ----- src/testbed/testbed_api_cmd_send_peer_ready.c | 103 ---- src/testbed/testbed_api_hosts.c | 53 +- src/testbed/testbed_helper.h | 54 -- src/testing/Makefile.am | 41 ++ src/testing/gnunet-cmds-helper.c | 662 ++++++++++++++++++++ src/testing/test_testing_api_cmd_netjail.c | 79 +++ src/testing/test_testing_plugin_testcmd.c | 116 ++++ ...testing_api_cmd_block_until_all_peers_started.c | 128 ++++ src/testing/testing_api_cmd_local_test_finished.c | 131 ++++ src/testing/testing_api_cmd_netjail_start.c | 217 +++++++ .../testing_api_cmd_netjail_start_testsystem.c | 541 +++++++++++++++++ src/testing/testing_api_cmd_netjail_stop.c | 215 +++++++ .../testing_api_cmd_netjail_stop_testsystem.c | 141 +++++ src/testing/testing_api_cmd_send_peer_ready.c | 5 +- src/testing/testing_cmds.h | 90 +++ src/transport/Makefile.am | 27 +- src/transport/plugin_cmd_simple_send.c | 196 ------ src/transport/test_transport_api_cmd_simple_send.c | 3 +- .../test_transport_plugin_cmd_simple_send.c | 194 ++++++ 33 files changed, 2669 insertions(+), 2264 deletions(-) delete mode 100644 src/include/gnunet_testbed_ng_service.h delete mode 100644 src/testbed/gnunet-cmds-helper.c delete mode 100644 src/testbed/plugin_testcmd.c delete mode 100644 src/testbed/test_testbed_api_cmd_netjail.c delete mode 100644 src/testbed/testbed_api_cmd_block_until_all_peers_started.c delete mode 100644 src/testbed/testbed_api_cmd_local_test_finished.c delete mode 100644 src/testbed/testbed_api_cmd_netjail_start.c delete mode 100644 src/testbed/testbed_api_cmd_netjail_stop.c delete mode 100644 src/testbed/testbed_api_cmd_netjail_stop_testbed.c delete mode 100644 src/testbed/testbed_api_cmd_send_peer_ready.c create mode 100644 src/testing/gnunet-cmds-helper.c create mode 100644 src/testing/test_testing_api_cmd_netjail.c create mode 100644 src/testing/test_testing_plugin_testcmd.c create mode 100644 src/testing/testing_api_cmd_block_until_all_peers_started.c create mode 100644 src/testing/testing_api_cmd_local_test_finished.c create mode 100644 src/testing/testing_api_cmd_netjail_start.c create mode 100644 src/testing/testing_api_cmd_netjail_start_testsystem.c create mode 100644 src/testing/testing_api_cmd_netjail_stop.c create mode 100644 src/testing/testing_api_cmd_netjail_stop_testsystem.c create mode 100644 src/testing/testing_cmds.h delete mode 100644 src/transport/plugin_cmd_simple_send.c create mode 100644 src/transport/test_transport_plugin_cmd_simple_send.c (limited to 'src') diff --git a/po/POTFILES.in b/po/POTFILES.in index 8ed952089..6675d0d25 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -396,7 +396,6 @@ src/template/gnunet-template.c src/testbed-logger/gnunet-service-testbed-logger.c src/testbed-logger/testbed_logger_api.c src/testbed/generate-underlay-topology.c -src/testbed/gnunet-cmds-helper.c src/testbed/gnunet-daemon-latency-logger.c src/testbed/gnunet-daemon-testbed-blacklist.c src/testbed/gnunet-daemon-testbed-underlay.c @@ -414,16 +413,9 @@ src/testbed/gnunet-service-testbed_peers.c src/testbed/gnunet-testbed-profiler.c src/testbed/gnunet_mpi_test.c src/testbed/gnunet_testbed_mpi_spawn.c -src/testbed/plugin_testcmd.c src/testbed/testbed_api.c src/testbed/testbed_api_barriers.c -src/testbed/testbed_api_cmd_block_until_all_peers_started.c -src/testbed/testbed_api_cmd_local_test_finished.c -src/testbed/testbed_api_cmd_netjail_start.c src/testbed/testbed_api_cmd_netjail_start_testbed.c -src/testbed/testbed_api_cmd_netjail_stop.c -src/testbed/testbed_api_cmd_netjail_stop_testbed.c -src/testbed/testbed_api_cmd_send_peer_ready.c src/testbed/testbed_api_hosts.c src/testbed/testbed_api_operations.c src/testbed/testbed_api_peers.c @@ -434,12 +426,19 @@ src/testbed/testbed_api_test.c src/testbed/testbed_api_testbed.c src/testbed/testbed_api_topology.c src/testbed/testbed_api_underlay.c +src/testing/gnunet-cmds-helper.c src/testing/gnunet-testing.c src/testing/list-keys.c src/testing/testing.c src/testing/testing_api_cmd_batch.c +src/testing/testing_api_cmd_block_until_all_peers_started.c src/testing/testing_api_cmd_hello_world.c src/testing/testing_api_cmd_hello_world_birth.c +src/testing/testing_api_cmd_local_test_finished.c +src/testing/testing_api_cmd_netjail_start.c +src/testing/testing_api_cmd_netjail_start_testbed.c +src/testing/testing_api_cmd_netjail_stop.c +src/testing/testing_api_cmd_netjail_stop_testbed.c src/testing/testing_api_cmd_send_peer_ready.c src/testing/testing_api_cmd_system_create.c src/testing/testing_api_loop.c @@ -466,7 +465,6 @@ src/transport/gnunet-transport-profiler.c src/transport/gnunet-transport-wlan-receiver.c src/transport/gnunet-transport-wlan-sender.c src/transport/gnunet-transport.c -src/transport/plugin_cmd_simple_send.c src/transport/plugin_transport_http_client.c src/transport/plugin_transport_http_common.c src/transport/plugin_transport_http_server.c diff --git a/src/include/Makefile.am b/src/include/Makefile.am index 16ff25350..9c22b5977 100644 --- a/src/include/Makefile.am +++ b/src/include/Makefile.am @@ -115,7 +115,6 @@ gnunetinclude_HEADERS = \ gnunet_strings_lib.h \ gnunet_testbed_service.h \ gnunet_testbed_logger_service.h \ - gnunet_testbed_ng_service.h \ gnunet_testing_lib.h \ gnunet_testing_plugin.h \ gnunet_testing_ng_lib.h \ diff --git a/src/include/gnunet_testbed_ng_service.h b/src/include/gnunet_testbed_ng_service.h deleted file mode 100644 index 5979cd85a..000000000 --- a/src/include/gnunet_testbed_ng_service.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - This file is part of GNUnet - Copyright (C) 2021 GNUnet e.V. - - GNUnet is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - GNUnet 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 - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - - SPDX-License-Identifier: AGPL3.0-or-later - */ - -/** - * @author t3sserakt - * - * @file - * API for writing tests and creating large-scale emulation testbeds for GNUnet with command pattern. - * - * @defgroup testbed Testbed service - * Writing tests and creating large-scale emulation testbeds for GNUnet with command pattern. - * - * @see [Documentation](https://docs.gnunet.org/handbook/gnunet.html#TESTBED-NG-Subsystem) - * - * @{ - */ - -#ifndef GNUNET_TESTBED_NG_SERVICE_H -#define GNUNET_TESTBED_NG_SERVICE_H - -#include "gnunet_util_lib.h" -#include "gnunet_testing_ng_lib.h" - - -/** - * Create command. - * - * @param label name for command. - * @param binaryname to start. - * @return command. - */ -struct GNUNET_TESTING_Command -GNUNET_TESTING_cmd_netjail_start (const char *label, - char *local_m, - char *global_n); - - -/** - * Create command. - * - * @param label name for command. - * @param binaryname to exec. - * @return command. - */ -struct GNUNET_TESTING_Command -GNUNET_TESTING_cmd_netjail_start_testing_system (const char *label, - char *local_m, - char *global_n, - char *plugin_name, - unsigned int *rv); - - -/** - * Create command. - * - * @param label name for command. - * @param binaryname to stop. - * @return command. - */ -struct GNUNET_TESTING_Command -GNUNET_TESTING_cmd_netjail_stop (const char *label, - char *local_m, - char *global_n); - - -struct GNUNET_TESTING_Command -GNUNET_TESTING_cmd_stop_testing_system (const char *label, - const char *helper_start_label, - char *local_m, - char *global_n); - - -int -GNUNET_TESTING_get_trait_helper_handles (const struct - GNUNET_TESTING_Command *cmd, - struct GNUNET_HELPER_Handle ***helper); - - -struct GNUNET_TESTING_Command -GNUNET_TESTING_cmd_block_until_all_peers_started (const char *label, - unsigned int * - all_peers_started); - -struct GNUNET_TESTING_Command -GNUNET_TESTING_cmd_send_peer_ready (const char *label, - TESTING_CMD_HELPER_write_cb write_message); - -struct GNUNET_TESTING_Command -GNUNET_TESTING_cmd_local_test_finished (const char *label, - TESTING_CMD_HELPER_write_cb - write_message); - -#endif diff --git a/src/include/gnunet_testing_ng_lib.h b/src/include/gnunet_testing_ng_lib.h index aad7ddec2..035d1bcad 100644 --- a/src/include/gnunet_testing_ng_lib.h +++ b/src/include/gnunet_testing_ng_lib.h @@ -842,4 +842,72 @@ struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_system_create (const char *label, const char *testdir); + +/** + * Create command. + * + * @param label name for command. + * @param binaryname to start. + * @return command. + */ +struct GNUNET_TESTING_Command +GNUNET_TESTING_cmd_netjail_start (const char *label, + char *local_m, + char *global_n); + + +/** + * Create command. + * + * @param label name for command. + * @param binaryname to exec. + * @return command. + */ +struct GNUNET_TESTING_Command +GNUNET_TESTING_cmd_netjail_start_testing_system (const char *label, + char *local_m, + char *global_n, + char *plugin_name, + unsigned int *rv); + + +/** + * Create command. + * + * @param label name for command. + * @param binaryname to stop. + * @return command. + */ +struct GNUNET_TESTING_Command +GNUNET_TESTING_cmd_netjail_stop (const char *label, + char *local_m, + char *global_n); + + +struct GNUNET_TESTING_Command +GNUNET_TESTING_cmd_stop_testing_system (const char *label, + const char *helper_start_label, + char *local_m, + char *global_n); + + +int +GNUNET_TESTING_get_trait_helper_handles (const struct + GNUNET_TESTING_Command *cmd, + struct GNUNET_HELPER_Handle ***helper); + + +struct GNUNET_TESTING_Command +GNUNET_TESTING_cmd_block_until_all_peers_started (const char *label, + unsigned int * + all_peers_started); + +struct GNUNET_TESTING_Command +GNUNET_TESTING_cmd_send_peer_ready (const char *label, + TESTING_CMD_HELPER_write_cb write_message); + +struct GNUNET_TESTING_Command +GNUNET_TESTING_cmd_local_test_finished (const char *label, + TESTING_CMD_HELPER_write_cb + write_message); #endif diff --git a/src/testbed/Makefile.am b/src/testbed/Makefile.am index 5a221cd69..d1f43f0f6 100644 --- a/src/testbed/Makefile.am +++ b/src/testbed/Makefile.am @@ -23,7 +23,6 @@ if HAVE_SQLITE endif libexec_PROGRAMS = \ - gnunet-cmds-helper \ gnunet-service-testbed \ gnunet-helper-testbed \ gnunet-daemon-testbed-blacklist \ @@ -36,21 +35,6 @@ bin_PROGRAMS = \ noinst_PROGRAMS = \ $(generate_underlay) -plugin_LTLIBRARIES = \ - libgnunet_plugin_testcmd.la - -libgnunet_plugin_testcmd_la_SOURCES = \ - plugin_testcmd.c -libgnunet_plugin_testcmd_la_LIBADD = \ - $(top_builddir)/src/util/libgnunetutil.la \ - $(top_builddir)/src/arm/libgnunetarm.la \ - $(top_builddir)/src/testing/libgnunettesting.la \ - $(top_builddir)/src/statistics/libgnunetstatistics.la \ - libgnunettestbed.la \ - $(LTLIBINTL) -libgnunet_plugin_testcmd_la_LDFLAGS = \ - $(GN_PLUGIN_LDFLAGS) - gnunet_service_testbed_SOURCES = \ gnunet-service-testbed.c gnunet-service-testbed.h \ gnunet-service-testbed_links.c gnunet-service-testbed_links.h \ @@ -89,15 +73,6 @@ gnunet_helper_testbed_LDADD = $(XLIB) \ libgnunettestbed.la \ $(LTLIBINTL) $(Z_LIBS) -gnunet_cmds_helper_SOURCES = \ - gnunet-cmds-helper.c -gnunet_cmds_helper_LDADD = $(XLIB) \ - $(top_builddir)/src/util/libgnunetutil.la \ - $(top_builddir)/src/testing/libgnunettesting.la \ - $(top_builddir)/src/transport/libgnunettransporttesting2.la \ - libgnunettestbed.la \ - $(LTLIBINTL) $(Z_LIBS) - gnunet_daemon_testbed_blacklist_SOURCES = gnunet-daemon-testbed-blacklist.c gnunet_daemon_testbed_blacklist_LDADD = $(XLIB) \ $(top_builddir)/src/transport/libgnunettransport.la \ @@ -120,13 +95,6 @@ lib_LTLIBRARIES = \ libgnunettestbed.la libgnunettestbed_la_SOURCES = \ - testbed_api_cmd_local_test_finished.c \ - testbed_api_cmd_send_peer_ready.c \ - testbed_api_cmd_block_until_all_peers_started.c \ - testbed_api_cmd_netjail_start.c \ - testbed_api_cmd_netjail_start_testbed.c \ - testbed_api_cmd_netjail_stop_testbed.c \ - testbed_api_cmd_netjail_stop.c \ testbed_api.c testbed_api.h testbed.h \ testbed_api_hosts.c testbed_api_hosts.h testbed_helper.h \ testbed_api_operations.c testbed_api_operations.h \ @@ -165,7 +133,6 @@ generate_underlay_topology_LDADD = $(XLIB) \ $(LTLIBINTL) -lsqlite3 check_PROGRAMS = \ - test_testbed_api_cmd_netjail \ test_testbed_api_hosts \ test_gnunet_helper_testbed \ test_testbed_api_controllerlink \ @@ -200,7 +167,6 @@ check_PROGRAMS = \ if ENABLE_TEST_RUN AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; TESTS = \ - test_testbed_api_cmd_netjail \ test_testbed_api \ test_testbed_api_sd \ test_testbed_api_operations \ @@ -231,13 +197,6 @@ if ENABLE_TEST_RUN $(underlay_testcases) endif -test_testbed_api_cmd_netjail_SOURCES = \ - test_testbed_api_cmd_netjail.c -test_testbed_api_cmd_netjail_LDADD = \ - $(top_builddir)/src/testing/libgnunettesting.la \ - $(top_builddir)/src/util/libgnunetutil.la \ - libgnunettestbed.la - test_testbed_api_SOURCES = \ test_testbed_api.c test_testbed_api_LDADD = \ diff --git a/src/testbed/gnunet-cmds-helper.c b/src/testbed/gnunet-cmds-helper.c deleted file mode 100644 index 4bc0656de..000000000 --- a/src/testbed/gnunet-cmds-helper.c +++ /dev/null @@ -1,663 +0,0 @@ -/* - This file is part of GNUnet - Copyright (C) 2008--2013, 2016 GNUnet e.V. - - GNUnet is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - GNUnet 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 - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - - SPDX-License-Identifier: AGPL3.0-or-later - */ - -/** - * @file testbed/gnunet-cmds-helper.c - * @brief Helper binary that is started from a remote interpreter loop to start - * a local interpreter loop. - * - * This helper monitors for three termination events. They are: (1)The - * stdin of the helper is closed for reading; (2)the helper received - * SIGTERM/SIGINT; (3)the local loop crashed. In case of events 1 and 2 - * the helper kills the interpreter loop. When the interpreter loop - * crashed (event 3), the helper should send a SIGTERM to its own process - * group; this behaviour will help terminate any child processes the loop - * has started and prevents them from leaking and running forever. - * - * @author t3sserakt - * @author Sree Harsha Totakura - */ - - -#include "platform.h" -#include "gnunet_util_lib.h" -#include "gnunet_testing_lib.h" -#include "gnunet_testbed_service.h" -#include "testbed_helper.h" -#include "testbed_api.h" -#include "gnunet_testing_plugin.h" -#include - - -/** - * Generic logging shortcut - */ -#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__) - -/** - * Debug logging shorthand - */ -#define LOG_DEBUG(...) LOG (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__) - -#define NODE_BASE_IP "192.168.15." - -#define ROUTER_BASE_IP "92.68.150." - -/** - * Handle for a plugin. - */ -struct Plugin -{ - /** - * Name of the shared library. - */ - char *library_name; - - /** - * Plugin API. - */ - struct GNUNET_TESTING_PluginFunctions *api; - - char *node_ip; - - char *plugin_name; - - char *global_n; - - char *local_m; - - char *n; - - char *m; -}; - -struct NodeIdentifier -{ - char *n; - - char *m; - - char *global_n; - - char *local_m; -}; - -/** - * Context for a single write on a chunk of memory - */ -struct WriteContext -{ - /** - * The data to write - */ - void *data; - - /** - * The length of the data - */ - size_t length; - - /** - * The current position from where the write operation should begin - */ - size_t pos; -}; - -struct Plugin *plugin; - -/** - * The process handle to the testbed service - -static struct GNUNET_OS_Process *cmd_binary_process;*/ - -/** - * Handle to the testing system - */ -static struct GNUNET_TESTING_System *test_system; - -/** - * Our message stream tokenizer - */ -struct GNUNET_MessageStreamTokenizer *tokenizer; - -/** - * Disk handle from stdin - */ -static struct GNUNET_DISK_FileHandle *stdin_fd; - -/** - * Disk handle for stdout - */ -static struct GNUNET_DISK_FileHandle *stdout_fd; - -/** - * Pipe used to communicate shutdown via signal. - */ -static struct GNUNET_DISK_PipeHandle *sigpipe; - -/** - * Task identifier for the read task - */ -static struct GNUNET_SCHEDULER_Task *read_task_id; - -/** - * Task identifier for the write task - */ -static struct GNUNET_SCHEDULER_Task *write_task_id; - -/** - * Task to kill the child - */ -static struct GNUNET_SCHEDULER_Task *child_death_task_id; - -/** - * Are we done reading messages from stdin? - */ -static int done_reading; - -/** - * Result to return in case we fail - */ -static int status; - - -/** - * Task to shut down cleanly - * - * @param cls NULL - */ -static void -shutdown_task (void *cls) -{ - - LOG_DEBUG ("Shutting down.\n"); - LOG (GNUNET_ERROR_TYPE_ERROR, - "Shutting down tokenizer!\n"); - - if (NULL != read_task_id) - { - GNUNET_SCHEDULER_cancel (read_task_id); - read_task_id = NULL; - } - if (NULL != write_task_id) - { - struct WriteContext *wc; - - wc = GNUNET_SCHEDULER_cancel (write_task_id); - write_task_id = NULL; - GNUNET_free (wc->data); - GNUNET_free (wc); - } - if (NULL != child_death_task_id) - { - GNUNET_SCHEDULER_cancel (child_death_task_id); - child_death_task_id = NULL; - } - if (NULL != stdin_fd) - (void) GNUNET_DISK_file_close (stdin_fd); - if (NULL != stdout_fd) - (void) GNUNET_DISK_file_close (stdout_fd); - GNUNET_MST_destroy (tokenizer); - tokenizer = NULL; - - if (NULL != test_system) - { - GNUNET_TESTING_system_destroy (test_system, GNUNET_YES); - test_system = NULL; - } -} - - -/** - * Task to write to the standard out - * - * @param cls the WriteContext - */ -static void -write_task (void *cls) -{ - struct WriteContext *wc = cls; - ssize_t bytes_wrote; - - LOG (GNUNET_ERROR_TYPE_ERROR, - "Writing data!\n"); - - GNUNET_assert (NULL != wc); - write_task_id = NULL; - bytes_wrote = GNUNET_DISK_file_write (stdout_fd, - wc->data + wc->pos, - wc->length - wc->pos); - if (GNUNET_SYSERR == bytes_wrote) - { - LOG (GNUNET_ERROR_TYPE_WARNING, - "Cannot reply back successful initialization\n"); - GNUNET_free (wc->data); - GNUNET_free (wc); - return; - } - wc->pos += bytes_wrote; - if (wc->pos == wc->length) - { - GNUNET_free (wc->data); - GNUNET_free (wc); - LOG (GNUNET_ERROR_TYPE_ERROR, - "Written successfully!\n"); - return; - } - LOG (GNUNET_ERROR_TYPE_ERROR, - "Written data!\n"); - write_task_id = GNUNET_SCHEDULER_add_write_file (GNUNET_TIME_UNIT_FOREVER_REL, - stdout_fd, - &write_task, - wc); -} - - -/** - * Task triggered whenever we receive a SIGCHLD (child - * process died). - * - * @param cls closure, NULL if we need to self-restart - */ -/*static void -child_death_task (void *cls) -{ - const struct GNUNET_DISK_FileHandle *pr; - char c[16]; - - pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ); - child_death_task_id = NULL; - // consume the signal - GNUNET_break (0 < GNUNET_DISK_file_read (pr, &c, sizeof(c))); - LOG_DEBUG ("Got SIGCHLD\n"); - - LOG_DEBUG ("Child hasn't died. Resuming to monitor its status\n"); - child_death_task_id = - GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, - pr, - &child_death_task, - NULL); -}*/ - - -static void -write_message (struct GNUNET_MessageHeader *message, size_t msg_length) -{ - struct WriteContext *wc; - - LOG (GNUNET_ERROR_TYPE_ERROR, - "enter write_message!\n"); - wc = GNUNET_new (struct WriteContext); - wc->length = msg_length; - wc->data = message; - write_task_id = GNUNET_SCHEDULER_add_write_file ( - GNUNET_TIME_UNIT_FOREVER_REL, - stdout_fd, - &write_task, - wc); - LOG (GNUNET_ERROR_TYPE_ERROR, - "leave write_message!\n"); -} - - -/** - * Function to run the test cases. - * - * @param cls plugin to use. - * - */ -/*static void -run_plugin (void *cls) -{ - struct Plugin *plugin = cls; - char *router_ip; - char *node_ip; - - router_ip = GNUNET_malloc (strlen (ROUTER_BASE_IP) + strlen (plugin->m) + 1); - strcpy (router_ip, ROUTER_BASE_IP); - strcat (router_ip, plugin->m); - - node_ip = GNUNET_malloc (strlen (NODE_BASE_IP) + strlen (plugin->n) + 1); - strcat (node_ip, NODE_BASE_IP); - strcat (node_ip, plugin->n); - - plugin->api->start_testcase (&write_message, router_ip, node_ip); - -}*/ - - -/** - * Functions with this signature are called whenever a - * complete message is received by the tokenizer. - * - * Do not call #GNUNET_mst_destroy() in this callback - * - * @param cls identification of the client - * @param message the actual message - * @return #GNUNET_OK on success, - * #GNUNET_NO to stop further processing (no error) - * #GNUNET_SYSERR to stop further processing with error - */ -static int -tokenizer_cb (void *cls, const struct GNUNET_MessageHeader *message) -{ - struct NodeIdentifier *ni = cls; - const struct GNUNET_CMDS_HelperInit *msg; - struct GNUNET_CMDS_HelperReply *reply; - char *binary; - char *plugin_name; - size_t plugin_name_size; - uint16_t msize; - size_t msg_length; - char *router_ip; - char *node_ip; - - LOG (GNUNET_ERROR_TYPE_ERROR, - "tokenizer \n"); - - msize = ntohs (message->size); - if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_INIT == ntohs (message->type)) - { - msg = (const struct GNUNET_CMDS_HelperInit *) message; - plugin_name_size = ntohs (msg->plugin_name_size); - if ((sizeof(struct GNUNET_CMDS_HelperInit) + plugin_name_size) > msize) - { - GNUNET_break (0); - LOG (GNUNET_ERROR_TYPE_WARNING, - "Received unexpected message -- exiting\n"); - goto error; - } - plugin_name = GNUNET_malloc (plugin_name_size + 1); - GNUNET_strlcpy (plugin_name, - ((char *) &msg[1]), - plugin_name_size + 1); - - binary = GNUNET_OS_get_libexec_binary_path ("gnunet-cmd"); - - LOG (GNUNET_ERROR_TYPE_ERROR, - "plugin_name: %s \n", - plugin_name); - - // cmd_binary_process = GNUNET_OS_start_process ( - /*GNUNET_OS_INHERIT_STD_ERR verbose? , - NULL, - NULL, - NULL, - binary, - plugin_name, - ni->global_n, - ni->local_m, - ni->n, - ni->m, - NULL);*/ - - plugin = GNUNET_new (struct Plugin); - plugin->api = GNUNET_PLUGIN_load (plugin_name, - NULL); - plugin->library_name = GNUNET_strdup (basename(plugin_name)); - - plugin->global_n = ni->global_n; - plugin->local_m = ni->local_m; - plugin->n = ni->n; - plugin->m = ni->m; - - router_ip = GNUNET_malloc (strlen (ROUTER_BASE_IP) + strlen (plugin->m) - + 1); - strcpy (router_ip, ROUTER_BASE_IP); - strcat (router_ip, plugin->m); - - node_ip = GNUNET_malloc (strlen (NODE_BASE_IP) + strlen (plugin->n) + 1); - strcat (node_ip, NODE_BASE_IP); - strcat (node_ip, plugin->n); - - plugin->api->start_testcase (&write_message, router_ip, node_ip, plugin->m, - plugin->n, plugin->local_m); - - LOG (GNUNET_ERROR_TYPE_ERROR, - "We got here!\n"); - - /*if (NULL == cmd_binary_process) - { - LOG (GNUNET_ERROR_TYPE_ERROR, - "Starting plugin failed!\n"); - return GNUNET_SYSERR; - }*/ - - LOG (GNUNET_ERROR_TYPE_ERROR, - "We got here 2!\n"); - - LOG (GNUNET_ERROR_TYPE_ERROR, - "global_n: %s local_n: %s n: %s m: %s.\n", - ni->global_n, - ni->local_m, - ni->n, - ni->m); - - LOG (GNUNET_ERROR_TYPE_ERROR, - "We got here 3!\n"); - - GNUNET_free (binary); - - // done_reading = GNUNET_YES; - - msg_length = sizeof(struct GNUNET_CMDS_HelperReply); - reply = GNUNET_new (struct GNUNET_CMDS_HelperReply); - reply->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_REPLY); - reply->header.size = htons ((uint16_t) msg_length); - - LOG (GNUNET_ERROR_TYPE_ERROR, - "We got here 4!\n"); - - write_message ((struct GNUNET_MessageHeader *) reply, msg_length); - - LOG (GNUNET_ERROR_TYPE_ERROR, - "We got here 5!\n"); - - /*child_death_task_id = GNUNET_SCHEDULER_add_read_file ( - GNUNET_TIME_UNIT_FOREVER_REL, - GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ), - &child_death_task, - NULL);*/ - return GNUNET_OK; - } - else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED == ntohs ( - message->type)) - { - plugin->api->all_peers_started (); - return GNUNET_OK; - } - else - { - LOG (GNUNET_ERROR_TYPE_WARNING, "Received unexpected message -- exiting\n"); - goto error; - } - - - error: - status = GNUNET_SYSERR; - LOG (GNUNET_ERROR_TYPE_ERROR, - "tokenizer shutting down!\n"); - GNUNET_SCHEDULER_shutdown (); - return GNUNET_SYSERR; -} - - -/** - * Task to read from stdin - * - * @param cls NULL - */ -static void -read_task (void *cls) -{ - char buf[GNUNET_MAX_MESSAGE_SIZE]; - ssize_t sread; - - read_task_id = NULL; - sread = GNUNET_DISK_file_read (stdin_fd, buf, sizeof(buf)); - if ((GNUNET_SYSERR == sread) || (0 == sread)) - { - LOG_DEBUG ("STDIN closed\n"); - LOG (GNUNET_ERROR_TYPE_ERROR, - "tokenizer shutting down during reading!\n"); - GNUNET_SCHEDULER_shutdown (); - return; - } - if (GNUNET_YES == done_reading) - { - /* didn't expect any more data! */ - GNUNET_break_op (0); - LOG (GNUNET_ERROR_TYPE_ERROR, - "tokenizer shutting down during reading, didn't expect any more data!\n"); - GNUNET_SCHEDULER_shutdown (); - return; - } - LOG_DEBUG ("Read %u bytes\n", (unsigned int) sread); - LOG (GNUNET_ERROR_TYPE_ERROR, - "Read %u bytes\n", (unsigned int) sread); - /* FIXME: could introduce a GNUNET_MST_read2 to read - directly from 'stdin_fd' and save a memcpy() here */ - if (GNUNET_OK != - GNUNET_MST_from_buffer (tokenizer, buf, sread, GNUNET_NO, GNUNET_NO)) - { - GNUNET_break (0); - LOG (GNUNET_ERROR_TYPE_ERROR, - "tokenizer shutting down during reading, writing to buffer failed!\n"); - GNUNET_SCHEDULER_shutdown (); - return; - } - read_task_id /* No timeout while reading */ - = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, - stdin_fd, - &read_task, - NULL); -} - - -/** - * Main function that will be run. - * - * @param cls closure - * @param args remaining command-line arguments - * @param cfgfile name of the configuration file used (for saving, can be NULL!) - * @param cfg configuration - */ -static void -run (void *cls, - char *const *args, - const char *cfgfile, - const struct GNUNET_CONFIGURATION_Handle *cfg) -{ - struct NodeIdentifier *ni = cls; - - LOG_DEBUG ("Starting interpreter loop helper...\n"); - - tokenizer = GNUNET_MST_create (&tokenizer_cb, ni); - stdin_fd = GNUNET_DISK_get_handle_from_native (stdin); - stdout_fd = GNUNET_DISK_get_handle_from_native (stdout); - read_task_id = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, - stdin_fd, - &read_task, - NULL); - GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); -} - - -/** - * Signal handler called for SIGCHLD. - */ -static void -sighandler_child_death () -{ - static char c; - int old_errno; /* back-up errno */ - - old_errno = errno; - GNUNET_break ( - 1 == - GNUNET_DISK_file_write (GNUNET_DISK_pipe_handle (sigpipe, - GNUNET_DISK_PIPE_END_WRITE), - &c, - sizeof(c))); - errno = old_errno; -} - - -/** - * Main function - * - * @param argc the number of command line arguments - * @param argv command line arg array - * @return return code - */ -int -main (int argc, char **argv) -{ - struct NodeIdentifier *ni; - struct GNUNET_SIGNAL_Context *shc_chld; - struct GNUNET_GETOPT_CommandLineOption options[] = - { GNUNET_GETOPT_OPTION_END }; - int ret; - - GNUNET_log_setup ("gnunet-cmds-helper", - "DEBUG", - NULL); - ni = GNUNET_new (struct NodeIdentifier); - ni->global_n = argv[1]; - ni->local_m = argv[2]; - ni->n = argv[3]; - ni->m = argv[4]; - - LOG (GNUNET_ERROR_TYPE_ERROR, - "global_n: %s local_n: %s n: %s m: %s.\n", - ni->global_n, - ni->local_m, - ni->n, - ni->m); - - status = GNUNET_OK; - if (NULL == - (sigpipe = GNUNET_DISK_pipe (GNUNET_DISK_PF_NONE))) - { - GNUNET_break (0); - return 1; - } - shc_chld = - GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD, &sighandler_child_death); - ret = GNUNET_PROGRAM_run (argc, - argv, - "gnunet-cmds-helper", - "Helper for starting a local interpreter loop", - options, - &run, - ni); - LOG (GNUNET_ERROR_TYPE_ERROR, - "run finished\n"); - GNUNET_SIGNAL_handler_uninstall (shc_chld); - shc_chld = NULL; - GNUNET_DISK_pipe_close (sigpipe); - GNUNET_free (ni); - if (GNUNET_OK != ret) - return 1; - return (GNUNET_OK == status) ? 0 : 1; -} - - -/* end of gnunet-cmds-helper.c */ diff --git a/src/testbed/plugin_testcmd.c b/src/testbed/plugin_testcmd.c deleted file mode 100644 index b74b67240..000000000 --- a/src/testbed/plugin_testcmd.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - This file is part of GNUnet - Copyright (C) 2013, 2014 GNUnet e.V. - - GNUnet is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - GNUnet 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 - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - - SPDX-License-Identifier: AGPL3.0-or-later - */ - -/** - * @file testbed/plugin_testcmd.c - * @brief a plugin to provide the API for running test cases. - * @author t3sserakt - */ -#include "platform.h" -#include "gnunet_testing_ng_lib.h" -#include "gnunet_util_lib.h" -#include "gnunet_testbed_ng_service.h" - -/** - * Generic logging shortcut - */ -#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__) - -unsigned int are_all_peers_started; - -static void -all_peers_started () -{ - are_all_peers_started = GNUNET_YES; - LOG (GNUNET_ERROR_TYPE_ERROR, - "setting are_all_peers_started: %d\n", - are_all_peers_started); -} - -static void -start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip, - char *node_ip, - char *n, - char *m, - char *local_m) -{ - struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); - - LOG (GNUNET_ERROR_TYPE_ERROR, - "We got here 6!\n"); - - are_all_peers_started = GNUNET_NO; - - struct GNUNET_TESTING_Command commands[] = { - GNUNET_TESTING_cmd_hello_world_birth ("hello-world-birth-0", - &now), - GNUNET_TESTING_cmd_hello_world ("hello-world-0","hello-world-birth-0",""), - GNUNET_TESTING_cmd_send_peer_ready ("send-peer-ready-1", - write_message), - GNUNET_TESTING_cmd_block_until_all_peers_started ("block-1", - &are_all_peers_started), - GNUNET_TESTING_cmd_local_test_finished ("local-test-finished-1", - write_message) - }; - - GNUNET_TESTING_run (NULL, - commands, - GNUNET_TIME_UNIT_FOREVER_REL); - LOG (GNUNET_ERROR_TYPE_ERROR, - "We got here 7!\n"); - -} - - -/** - * Entry point for the plugin. - * - * @param cls NULL - * @return the exported block API - */ -void * -libgnunet_plugin_testcmd_init (void *cls) -{ - struct GNUNET_TESTING_PluginFunctions *api; - - api = GNUNET_new (struct GNUNET_TESTING_PluginFunctions); - api->start_testcase = &start_testcase; - api->all_peers_started = &all_peers_started; - return api; -} - - -/** - * Exit point from the plugin. - * - * @param cls the return value from #libgnunet_plugin_block_test_init - * @return NULL - */ -void * -libgnunet_plugin_testcmd_done (void *cls) -{ - struct GNUNET_TESTING_PluginFunctions *api = cls; - - GNUNET_free (api); - return NULL; -} - - -/* end of plugin_testcmd.c */ diff --git a/src/testbed/test_testbed_api_cmd_netjail.c b/src/testbed/test_testbed_api_cmd_netjail.c deleted file mode 100644 index 85da39f0e..000000000 --- a/src/testbed/test_testbed_api_cmd_netjail.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - This file is part of GNUnet - Copyright (C) 2021 GNUnet e.V. - - GNUnet is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - GNUnet 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 - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - - SPDX-License-Identifier: AGPL3.0-or-later - */ - -/** - * @file testing/test_testbed_api_cmd_netjail.c - * @brief Test case executing a script in a network name space. - * @author t3sserakt - */ -#include "platform.h" -#include "gnunet_testing_ng_lib.h" -#include "gnunet_testbed_ng_service.h" -#include "gnunet_util_lib.h" - - -/** - * Main function to run the test cases. - * - * @param cls not used. - * - */ -static void -run (void *cls) -{ - struct GNUNET_TESTING_Command commands[] = { - GNUNET_TESTING_cmd_netjail_start ("netjail-start-1", - "2", - "2"), - GNUNET_TESTING_cmd_netjail_start_testing_system ("netjail-start-testbed-1", - "2", - "2", - "libgnunet_plugin_testcmd"), - GNUNET_TESTING_cmd_stop_testing_system ("stop-testbed", - "netjail-start-testbed-1", - "2", - "2"), - GNUNET_TESTING_cmd_netjail_stop ("netjail-stop-1", - "2", - "2"), - GNUNET_TESTING_cmd_end () - }; - - GNUNET_TESTING_run (NULL, - commands, - GNUNET_TIME_UNIT_FOREVER_REL); -} - - -int -main (int argc, - char *const *argv) -{ - int rv = 0; - - GNUNET_log_setup ("test-netjail", - "DEBUG", - NULL); - GNUNET_SCHEDULER_run (&run, - NULL); - - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Test finished!\n"); - return rv; -} diff --git a/src/testbed/testbed_api.h b/src/testbed/testbed_api.h index 9a54ca36c..d4ef832ad 100644 --- a/src/testbed/testbed_api.h +++ b/src/testbed/testbed_api.h @@ -37,11 +37,6 @@ */ #define HELPER_TESTBED_BINARY "gnunet-helper-testbed" -/** - * Cmds Helper binary name - */ -#define HELPER_CMDS_BINARY "gnunet-cmds-helper" - /** * Enumeration of operations @@ -185,6 +180,7 @@ struct OperationContext typedef void (*TESTBED_opcq_empty_cb) (void *cls); + /** * Handle to interact with a GNUnet testbed controller. Each * controller has at least one master handle which is created when the diff --git a/src/testbed/testbed_api_cmd_block_until_all_peers_started.c b/src/testbed/testbed_api_cmd_block_until_all_peers_started.c deleted file mode 100644 index 8659fbb46..000000000 --- a/src/testbed/testbed_api_cmd_block_until_all_peers_started.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - This file is part of GNUnet - Copyright (C) 2021 GNUnet e.V. - - GNUnet is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - GNUnet 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 - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - - SPDX-License-Identifier: AGPL3.0-or-later - */ - -/** - * @file testing_api_cmd_block_until_all_peers_started.c - * @brief cmd to block the interpreter loop until all peers started. - * @author t3sserakt - */ -#include "platform.h" -#include "gnunet_util_lib.h" -#include "gnunet_testing_ng_lib.h" - -/** - * Generic logging shortcut - */ -#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__) - -struct BlockState -{ - unsigned int *all_peers_started; -}; - - -static int -block_until_all_peers_started_traits (void *cls, - const void **ret, - const char *trait, - unsigned int index) -{ - return GNUNET_OK; -} - - -static void -block_until_all_peers_started_cleanup (void *cls, - const struct GNUNET_TESTING_Command *cmd) -{ - struct BlockState *bs = cls; - - GNUNET_free (bs); -} - - -static void -block_until_all_peers_started_run (void *cls, - const struct GNUNET_TESTING_Command *cmd, - struct GNUNET_TESTING_Interpreter *is) -{ - LOG (GNUNET_ERROR_TYPE_ERROR, - "block_until_all_peers_started_run!\n"); -} - - -static int -block_until_all_peers_started_finish (void *cls, - GNUNET_SCHEDULER_TaskCallback cont, - void *cont_cls) -{ - struct BlockState *bs = cls; - unsigned int *ret = bs->all_peers_started; - - LOG (GNUNET_ERROR_TYPE_ERROR, - "We got here 10\n"); - - if (GNUNET_YES == *ret) - { - LOG (GNUNET_ERROR_TYPE_ERROR, - "We do not need to block anymore!\n"); - cont (cont_cls); - } - else - { - LOG (GNUNET_ERROR_TYPE_ERROR, - "You shall not pass!\n"); - } - - return *ret; -} - - -/** - * Create command. - * - * @param label name for command. - * @return command. - */ -struct GNUNET_TESTING_Command -GNUNET_TESTING_cmd_block_until_all_peers_started (const char *label, - unsigned int * - all_peers_started) -{ - struct BlockState *bs; - - LOG (GNUNET_ERROR_TYPE_ERROR, - "we have all_peers_started: %u\n", - *all_peers_started); - - bs = GNUNET_new (struct BlockState); - bs->all_peers_started = all_peers_started; - - struct GNUNET_TESTING_Command cmd = { - .cls = bs, - .label = label, - .run = &block_until_all_peers_started_run, - .finish = &block_until_all_peers_started_finish, - .cleanup = &block_until_all_peers_started_cleanup, - .traits = &block_until_all_peers_started_traits - }; - - return cmd; -} diff --git a/src/testbed/testbed_api_cmd_local_test_finished.c b/src/testbed/testbed_api_cmd_local_test_finished.c deleted file mode 100644 index c02546945..000000000 --- a/src/testbed/testbed_api_cmd_local_test_finished.c +++ /dev/null @@ -1,131 +0,0 @@ -/* - This file is part of GNUnet - Copyright (C) 2021 GNUnet e.V. - - GNUnet is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - GNUnet 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 - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - - SPDX-License-Identifier: AGPL3.0-or-later - */ - -/** - * @file testing_api_cmd_block_until_all_peers_started.c - * @brief cmd to block the interpreter loop until all peers started. - * @author t3sserakt - */ -#include "platform.h" -#include "gnunet_util_lib.h" -#include "gnunet_testing_ng_lib.h" -#include "testbed_helper.h" - -/** - * Generic logging shortcut - */ -#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__) - -struct LocalFinishedState -{ - TESTING_CMD_HELPER_write_cb write_message; - - struct GNUNET_CMDS_LOCAL_FINISHED *reply; -}; - - -static int -local_test_finished_traits (void *cls, - const void **ret, - const char *trait, - unsigned int index) -{ - return GNUNET_OK; -} - - -static void -local_test_finished_cleanup (void *cls, - const struct GNUNET_TESTING_Command *cmd) -{ - struct LocalFinishedState *lfs = cls; - - GNUNET_free (lfs->reply); - GNUNET_free (lfs); -} - - -static void -local_test_finished_run (void *cls, - const struct GNUNET_TESTING_Command *cmd, - struct GNUNET_TESTING_Interpreter *is) -{ - struct LocalFinishedState *lfs = cls; - - struct GNUNET_CMDS_LOCAL_FINISHED *reply; - size_t msg_length; - - LOG (GNUNET_ERROR_TYPE_ERROR, - "We got here 12!\n"); - - msg_length = sizeof(struct GNUNET_CMDS_LOCAL_FINISHED); - reply = GNUNET_new (struct GNUNET_CMDS_LOCAL_FINISHED); - reply->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED); - reply->header.size = htons ((uint16_t) msg_length); - lfs->reply = reply; - lfs->write_message ((struct GNUNET_MessageHeader *) reply, msg_length); - - LOG (GNUNET_ERROR_TYPE_ERROR, - "We got here 13!\n"); -} - - -static int -local_test_finished_finish (void *cls, - GNUNET_SCHEDULER_TaskCallback cont, - void *cont_cls) -{ - // This will stop the local loop without shutting down the scheduler, because we do not call the continuation, which is the interpreter_next method. - LOG (GNUNET_ERROR_TYPE_ERROR, - "Stopping local loop\n"); - return GNUNET_YES; -} - - -/** - * Create command. - * - * @param label name for command. - * @return command. - */ -struct GNUNET_TESTING_Command -GNUNET_TESTING_cmd_local_test_finished (const char *label, - TESTING_CMD_HELPER_write_cb - write_message) -{ - struct LocalFinishedState *lfs; - - LOG (GNUNET_ERROR_TYPE_ERROR, - "We got here 11!\n"); - - lfs = GNUNET_new (struct LocalFinishedState); - lfs->write_message = write_message; - - struct GNUNET_TESTING_Command cmd = { - .cls = lfs, - .label = label, - .run = &local_test_finished_run, - .finish = &local_test_finished_finish, - .cleanup = &local_test_finished_cleanup, - .traits = &local_test_finished_traits - }; - - return cmd; -} diff --git a/src/testbed/testbed_api_cmd_netjail_start.c b/src/testbed/testbed_api_cmd_netjail_start.c deleted file mode 100644 index 0cc020275..000000000 --- a/src/testbed/testbed_api_cmd_netjail_start.c +++ /dev/null @@ -1,218 +0,0 @@ -/* - This file is part of GNUnet - Copyright (C) 2021 GNUnet e.V. - - GNUnet is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - GNUnet 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 - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - - SPDX-License-Identifier: AGPL3.0-or-later - */ - -/** - * @file testing/testing_api_cmd_hello_world.c - * @brief Command to start the netjail script. - * @author t3sserakt - */ -#include "platform.h" -#include "gnunet_util_lib.h" -#include "gnunet_testing_ng_lib.h" -#include "gnunet_testbed_ng_service.h" - -#define NETJAIL_START_SCRIPT "./../testing/netjail_start.sh" - -struct NetJailState -{ - struct GNUNET_ChildWaitHandle *cwh; - - char *local_m; - - char *global_n; - - /** - * The process id of the start script. - */ - struct GNUNET_OS_Process *start_proc; - - unsigned int finished; -}; - - -/** -* -* -* @param cls closure -* @param cmd current CMD being cleaned up. -*/ -static void -netjail_start_cleanup (void *cls, - const struct GNUNET_TESTING_Command *cmd) -{ - struct NetJailState *ns = cls; - - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "netjail_start_cleanup!\n"); - - if (NULL != ns->cwh) - { - GNUNET_wait_child_cancel (ns->cwh); - ns->cwh = NULL; - } - if (NULL != ns->start_proc) - { - GNUNET_assert (0 == - GNUNET_OS_process_kill (ns->start_proc, - SIGKILL)); - GNUNET_assert (GNUNET_OK == - GNUNET_OS_process_wait (ns->start_proc)); - GNUNET_OS_process_destroy (ns->start_proc); - ns->start_proc = NULL; - } - GNUNET_free (ns); -} - - -/** -* -* -* @param cls closure. -* @param[out] ret result -* @param trait name of the trait. -* @param index index number of the object to offer. -* @return #GNUNET_OK on success. -*/ -static int -netjail_start_traits (void *cls, - const void **ret, - const char *trait, - unsigned int index) -{ - return GNUNET_OK; -} - -static void -child_completed_callback (void *cls, - enum GNUNET_OS_ProcessStatusType type, - long unsigned int exit_code) -{ - struct NetJailState *ns = cls; - - if (0 == exit_code) - { - ns->finished = GNUNET_YES; - } - else - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Child completed with an error!\n"); - ns->finished = GNUNET_SYSERR; - } - GNUNET_OS_process_destroy (ns->start_proc); - ns->start_proc = NULL; -} - - - -/** -* Run the "hello world" CMD. -* -* @param cls closure. -* @param cmd CMD being run. -* @param is interpreter state. -*/ -static void -netjail_start_run (void *cls, - const struct GNUNET_TESTING_Command *cmd, - struct GNUNET_TESTING_Interpreter *is) -{ - struct NetJailState *ns = cls; - char *const script_argv[] = {NETJAIL_START_SCRIPT, - ns->local_m, - ns->global_n, - NULL}; - unsigned int helper_check = GNUNET_OS_check_helper_binary ( - NETJAIL_START_SCRIPT, - GNUNET_YES, - NULL); - - if (GNUNET_NO == helper_check) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "No SUID for %s!\n", - NETJAIL_START_SCRIPT); - GNUNET_TESTING_interpreter_fail (); - } - else if (GNUNET_NO == helper_check) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "%s not found!\n", - NETJAIL_START_SCRIPT); - GNUNET_TESTING_interpreter_fail (); - } - - ns->start_proc = GNUNET_OS_start_process_vap (GNUNET_OS_INHERIT_STD_ERR, - NULL, - NULL, - NULL, - NETJAIL_START_SCRIPT, - script_argv); - - ns->cwh = GNUNET_wait_child (ns->start_proc, - &child_completed_callback, - ns); - GNUNET_break (NULL != ns->cwh); -} - -static int -netjail_start_finish (void *cls, - GNUNET_SCHEDULER_TaskCallback cont, - void *cont_cls) -{ - struct NetJailState *ns = cls; - - if (ns->finished) - { - cont (cont_cls); - } - return ns->finished; -} - -/** - * Create command. - * - * @param label name for command. - * @param binaryname to start. - * @return command. - */ -struct GNUNET_TESTING_Command -GNUNET_TESTING_cmd_netjail_start (const char *label, - char *local_m, - char *global_n) -{ - struct NetJailState *ns; - - ns = GNUNET_new (struct NetJailState); - ns->local_m = local_m; - ns->global_n = global_n; - ns->finished = GNUNET_NO; - - struct GNUNET_TESTING_Command cmd = { - .cls = ns, - .label = label, - .run = &netjail_start_run, - .finish = &netjail_start_finish, - .cleanup = &netjail_start_cleanup, - .traits = &netjail_start_traits - }; - - return cmd; -} diff --git a/src/testbed/testbed_api_cmd_netjail_stop.c b/src/testbed/testbed_api_cmd_netjail_stop.c deleted file mode 100644 index f837ec08c..000000000 --- a/src/testbed/testbed_api_cmd_netjail_stop.c +++ /dev/null @@ -1,216 +0,0 @@ -/* - This file is part of GNUnet - Copyright (C) 2021 GNUnet e.V. - - GNUnet is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - GNUnet 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 - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - - SPDX-License-Identifier: AGPL3.0-or-later - */ - -/** - * @file testing/testing_api_cmd_hello_world.c - * @brief Command to stop the netjail script. - * @author t3sserakt - */ -#include "platform.h" -#include "gnunet_util_lib.h" -#include "gnunet_testing_ng_lib.h" -#include "gnunet_testbed_ng_service.h" - - -#define NETJAIL_STOP_SCRIPT "./../testing/netjail_stop.sh" - -struct GNUNET_ChildWaitHandle *cwh; - -struct NetJailState -{ - char *local_m; - - char *global_n; - - /** - * The process id of the start script. - */ - struct GNUNET_OS_Process *stop_proc; - - unsigned int finished; -}; - - -/** -* -* -* @param cls closure -* @param cmd current CMD being cleaned up. -*/ -static void -netjail_stop_cleanup (void *cls, - const struct GNUNET_TESTING_Command *cmd) -{ - struct NetJailState *ns = cls; - - if (NULL != cwh) - { - GNUNET_wait_child_cancel (cwh); - cwh = NULL; - } - if (NULL != ns->stop_proc) - { - GNUNET_assert (0 == - GNUNET_OS_process_kill (ns->stop_proc, - SIGKILL)); - GNUNET_assert (GNUNET_OK == - GNUNET_OS_process_wait (ns->stop_proc)); - GNUNET_OS_process_destroy (ns->stop_proc); - ns->stop_proc = NULL; - } -} - - -/** -* -* -* @param cls closure. -* @param[out] ret result -* @param trait name of the trait. -* @param index index number of the object to offer. -* @return #GNUNET_OK on success. -*/ -static int -netjail_stop_traits (void *cls, - const void **ret, - const char *trait, - unsigned int index) -{ - return GNUNET_OK; -} - - -static void -child_completed_callback (void *cls, - enum GNUNET_OS_ProcessStatusType type, - long unsigned int exit_code) -{ - struct NetJailState *ns = cls; - - cwh = NULL; - if (0 == exit_code) - { - ns->finished = GNUNET_YES; - } - else - { - ns->finished = GNUNET_SYSERR; - } - GNUNET_OS_process_destroy (ns->stop_proc); - ns->stop_proc = NULL; -} - - -/** -* Run the "hello world" CMD. -* -* @param cls closure. -* @param cmd CMD being run. -* @param is interpreter state. -*/ -static void -netjail_stop_run (void *cls, - const struct GNUNET_TESTING_Command *cmd, - struct GNUNET_TESTING_Interpreter *is) -{ - struct NetJailState *ns = cls; - char *const script_argv[] = {NETJAIL_STOP_SCRIPT, - ns->local_m, - ns->global_n, - NULL}; - unsigned int helper_check = GNUNET_OS_check_helper_binary ( - NETJAIL_STOP_SCRIPT, - GNUNET_YES, - NULL); - - if (GNUNET_NO == helper_check) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "No SUID for %s!\n", - NETJAIL_STOP_SCRIPT); - GNUNET_TESTING_interpreter_fail (); - } - else if (GNUNET_NO == helper_check) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "%s not found!\n", - NETJAIL_STOP_SCRIPT); - GNUNET_TESTING_interpreter_fail (); - } - - ns->stop_proc = GNUNET_OS_start_process_vap (GNUNET_OS_INHERIT_STD_ERR, - NULL, - NULL, - NULL, - NETJAIL_STOP_SCRIPT, - script_argv); - - cwh = GNUNET_wait_child (ns->stop_proc, - &child_completed_callback, - ns); - GNUNET_break (NULL != cwh); - -} - - -static int -netjail_stop_finish (void *cls, - GNUNET_SCHEDULER_TaskCallback cont, - void *cont_cls) -{ - struct NetJailState *ns = cls; - - if (ns->finished) - { - cont (cont_cls); - } - return ns->finished; -} - - -/** - * Create command. - * - * @param label name for command. - * @param binaryname to stop. - * @return command. - */ -struct GNUNET_TESTING_Command -GNUNET_TESTING_cmd_netjail_stop (const char *label, - char *local_m, - char *global_n) -{ - struct NetJailState *ns; - - ns = GNUNET_new (struct NetJailState); - ns->local_m = local_m; - ns->global_n = global_n; - - struct GNUNET_TESTING_Command cmd = { - .cls = ns, - .label = label, - .run = &netjail_stop_run, - .finish = &netjail_stop_finish, - .cleanup = &netjail_stop_cleanup, - .traits = &netjail_stop_traits - }; - - return cmd; -} diff --git a/src/testbed/testbed_api_cmd_netjail_stop_testbed.c b/src/testbed/testbed_api_cmd_netjail_stop_testbed.c deleted file mode 100644 index c74c1e94f..000000000 --- a/src/testbed/testbed_api_cmd_netjail_stop_testbed.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - This file is part of GNUnet - Copyright (C) 2021 GNUnet e.V. - - GNUnet is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - GNUnet 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 - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - - SPDX-License-Identifier: AGPL3.0-or-later - */ - -/** - * @file testing/testing_api_cmd_hello_world.c - * @brief Command to start the netjail peers. - * @author t3sserakt - */ -#include "platform.h" -#include "gnunet_testing_ng_lib.h" -#include "gnunet_testbed_ng_service.h" -#include "testbed_api.h" -#include "testbed_api_hosts.h" - - -struct StopHelperState -{ - - const char *helper_start_label; - - /** - * The process handle - */ - struct GNUNET_HELPER_Handle **helper; - - char *local_m; - - char *global_n; -}; - - -/** -* -* -* @param cls closure -* @param cmd current CMD being cleaned up. -*/ -static void -stop_testing_system_cleanup (void *cls, - const struct GNUNET_TESTING_Command *cmd) -{ - -} - - -/** -* -* -* @param cls closure. -* @param[out] ret result -* @param trait name of the trait. -* @param index index number of the object to offer. -* @return #GNUNET_OK on success. -*/ -static int -stop_testing_system_traits (void *cls, - const void **ret, - const char *trait, - unsigned int index) -{ - return GNUNET_OK; -} - - -/** -* Run the "hello world" CMD. -* -* @param cls closure. -* @param cmd CMD being run. -* @param is interpreter state. -*/ -static void -stop_testing_system_run (void *cls, - const struct GNUNET_TESTING_Command *cmd, - struct GNUNET_TESTING_Interpreter *is) -{ - struct StopHelperState *shs = cls; - struct GNUNET_HELPER_Handle **helper; - const struct GNUNET_TESTING_Command *start_helper_cmd; - - start_helper_cmd = GNUNET_TESTING_interpreter_lookup_command ( - shs->helper_start_label); - GNUNET_TESTING_get_trait_helper_handles (start_helper_cmd, - &helper); - - for (int i = 1; i <= atoi (shs->global_n); i++) { - for (int j = 1; j <= atoi (shs->local_m); j++) - { - GNUNET_HELPER_stop (helper[(i - 1) * atoi (shs->local_m) + j - 1], - GNUNET_YES); - } - } -} - - -/** - * Create command. - * - * @param label name for command. - * @param binaryname to exec. - * @return command. - */ -struct GNUNET_TESTING_Command -GNUNET_TESTING_cmd_stop_testing_system (const char *label, - const char *helper_start_label, - char *local_m, - char *global_n - ) -{ - struct StopHelperState *shs; - - shs = GNUNET_new (struct StopHelperState); - shs->helper_start_label = helper_start_label; - shs->local_m = local_m; - shs->global_n = global_n; - - struct GNUNET_TESTING_Command cmd = { - .cls = shs, - .label = label, - .run = &stop_testing_system_run, - .cleanup = &stop_testing_system_cleanup, - .traits = &stop_testing_system_traits - }; - - return cmd; -} diff --git a/src/testbed/testbed_api_cmd_send_peer_ready.c b/src/testbed/testbed_api_cmd_send_peer_ready.c deleted file mode 100644 index 987f0853e..000000000 --- a/src/testbed/testbed_api_cmd_send_peer_ready.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - This file is part of GNUnet - Copyright (C) 2021 GNUnet e.V. - - GNUnet is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - GNUnet 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 - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - - SPDX-License-Identifier: AGPL3.0-or-later - */ - -/** - * @file testing_api_cmd_send_peer_ready.c - * @brief cmd to send a helper message if peer is ready. - * @author t3sserakt - */ -#include "platform.h" -#include "gnunet_util_lib.h" -#include "gnunet_testing_ng_lib.h" -#include "testbed_helper.h" - - -struct SendPeerReadyState -{ - TESTING_CMD_HELPER_write_cb write_message; - - struct GNUNET_CMDS_PEER_STARTED *reply; -}; - - -static int -send_peer_ready_traits (void *cls, - const void **ret, - const char *trait, - unsigned int index) -{ - return GNUNET_OK; -} - - -static void -send_peer_ready_cleanup (void *cls, - const struct GNUNET_TESTING_Command *cmd) -{ - struct SendPeerReadyState *sprs = cls; - - GNUNET_free (sprs->reply); - GNUNET_free (sprs); -} - - -static void -send_peer_ready_run (void *cls, - const struct GNUNET_TESTING_Command *cmd, - struct GNUNET_TESTING_Interpreter *is) -{ - struct SendPeerReadyState *sprs = cls; - struct GNUNET_CMDS_PEER_STARTED *reply; - size_t msg_length; - - msg_length = sizeof(struct GNUNET_CMDS_PEER_STARTED); - reply = GNUNET_new (struct GNUNET_CMDS_PEER_STARTED); - reply->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED); - reply->header.size = htons ((uint16_t) msg_length); - sprs->reply = reply; - sprs->write_message ((struct GNUNET_MessageHeader *) reply, msg_length); -} - - -/** - * Create command. - * - * @param label name for command. - * @return command. - */ -struct GNUNET_TESTING_Command -GNUNET_TESTING_cmd_send_peer_ready (const char *label, - TESTING_CMD_HELPER_write_cb write_message) -{ - struct SendPeerReadyState *sprs; - - sprs = GNUNET_new (struct SendPeerReadyState); - sprs->write_message = write_message; - - struct GNUNET_TESTING_Command cmd = { - .cls = sprs, - .label = label, - .run = &send_peer_ready_run, - .cleanup = &send_peer_ready_cleanup, - .traits = &send_peer_ready_traits - }; - - return cmd; -} diff --git a/src/testbed/testbed_api_hosts.c b/src/testbed/testbed_api_hosts.c index d0a460fe6..1a8d9976d 100644 --- a/src/testbed/testbed_api_hosts.c +++ b/src/testbed/testbed_api_hosts.c @@ -964,10 +964,22 @@ gen_rsh_suffix_args (const char *const *append_args) } -void -GNUNET_TESTBED_extract_cfg (struct GNUNET_TESTBED_Host *host, const struct - GNUNET_MessageHeader *message) +/** + * Functions with this signature are called whenever a + * complete message is received by the tokenizer. + * + * Do not call GNUNET_SERVER_mst_destroy in callback + * + * @param cls closure + * @param client identification of the client + * @param message the actual message + * + * @return #GNUNET_OK on success, #GNUNET_SYSERR to stop further processing + */ +static int +helper_mst (void *cls, const struct GNUNET_MessageHeader *message) { + struct GNUNET_TESTBED_ControllerProc *cp = cls; const struct GNUNET_TESTBED_HelperReply *msg; const char *hostname; char *config; @@ -989,43 +1001,22 @@ GNUNET_TESTBED_extract_cfg (struct GNUNET_TESTBED_Host *host, const struct xconfig_size)); /* Replace the configuration template present in the host with the controller's running configuration */ - GNUNET_CONFIGURATION_destroy (host->cfg); - host->cfg = GNUNET_CONFIGURATION_create (); - GNUNET_assert (GNUNET_CONFIGURATION_deserialize (host->cfg, + GNUNET_CONFIGURATION_destroy (cp->host->cfg); + cp->host->cfg = GNUNET_CONFIGURATION_create (); + GNUNET_assert (GNUNET_CONFIGURATION_deserialize (cp->host->cfg, config, config_size, NULL)); GNUNET_free (config); - if (NULL == (hostname = GNUNET_TESTBED_host_get_hostname (host))) + if (NULL == (hostname = GNUNET_TESTBED_host_get_hostname (cp->host))) hostname = "localhost"; /* Change the hostname so that we can connect to it */ - GNUNET_CONFIGURATION_set_value_string (host->cfg, + GNUNET_CONFIGURATION_set_value_string (cp->host->cfg, "testbed", "hostname", hostname); - host->locked = GNUNET_NO; -} - -/** - * Functions with this signature are called whenever a - * complete message is received by the tokenizer. - * - * Do not call GNUNET_SERVER_mst_destroy in callback - * - * @param cls closure - * @param client identification of the client - * @param message the actual message - * - * @return #GNUNET_OK on success, #GNUNET_SYSERR to stop further processing - */ -static int -helper_mst (void *cls, const struct GNUNET_MessageHeader *message) -{ - struct GNUNET_TESTBED_ControllerProc *cp = cls; - struct GNUNET_TESTBED_Host *host = cp->host; - - GNUNET_TESTBED_extract_cfg (host, message); - + cp->host->locked = GNUNET_NO; + cp->host->controller_started = GNUNET_YES; cp->cb (cp->cls, cp->host->cfg, GNUNET_OK); return GNUNET_OK; } diff --git a/src/testbed/testbed_helper.h b/src/testbed/testbed_helper.h index af90ce85d..817ad559d 100644 --- a/src/testbed/testbed_helper.h +++ b/src/testbed/testbed_helper.h @@ -84,60 +84,6 @@ struct GNUNET_TESTBED_HelperReply * un-compressed */ }; -/** - * Initialization message for gnunet-cmds-testbed to start cmd binary. - */ -struct GNUNET_CMDS_HelperInit -{ - /** - * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_INIT - */ - struct GNUNET_MessageHeader header; - - /** - * - */ - uint16_t plugin_name_size GNUNET_PACKED; - - /* Followed by plugin name of the plugin running the test case. This is not NULL - * terminated */ -}; - -/** - * Reply message from cmds helper process - */ -struct GNUNET_CMDS_HelperReply -{ - /** - * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_REPLY - */ - struct GNUNET_MessageHeader header; -}; - -struct GNUNET_CMDS_PEER_STARTED -{ - /** - * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED - */ - struct GNUNET_MessageHeader header; -}; - -struct GNUNET_CMDS_ALL_PEERS_STARTED -{ - /** - * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED - */ - struct GNUNET_MessageHeader header; -}; - -struct GNUNET_CMDS_LOCAL_FINISHED -{ - /** - * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED - */ - struct GNUNET_MessageHeader header; -}; - GNUNET_NETWORK_STRUCT_END #endif /* end of testbed_helper.h */ diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am index 8b28e6e23..15469a310 100644 --- a/src/testing/Makefile.am +++ b/src/testing/Makefile.am @@ -11,10 +11,43 @@ pkgcfgdir= $(pkgdatadir)/config.d/ dist_pkgcfg_DATA = \ testing.conf +libexec_PROGRAMS = \ + gnunet-cmds-helper + +plugindir = $(libdir)/gnunet + +plugin_LTLIBRARIES = \ + libgnunet_test_testing_plugin_testcmd.la + lib_LTLIBRARIES = \ libgnunettesting.la +gnunet_cmds_helper_SOURCES = \ + gnunet-cmds-helper.c +gnunet_cmds_helper_LDADD = $(XLIB) \ + $(top_builddir)/src/util/libgnunetutil.la \ + libgnunettesting.la \ + $(LTLIBINTL) $(Z_LIBS) + +libgnunet_test_testing_plugin_testcmd_la_SOURCES = \ + test_testing_plugin_testcmd.c +libgnunet_test_testing_plugin_testcmd_la_LIBADD = \ + $(top_builddir)/src/util/libgnunetutil.la \ + $(top_builddir)/src/arm/libgnunetarm.la \ + libgnunettesting.la \ + $(top_builddir)/src/statistics/libgnunetstatistics.la \ + $(LTLIBINTL) +libgnunet_test_testing_plugin_testcmd_la_LDFLAGS = \ + $(GN_PLUGIN_LDFLAGS) + libgnunettesting_la_SOURCES = \ + testing_api_cmd_local_test_finished.c \ + testing_api_cmd_send_peer_ready.c \ + testing_api_cmd_block_until_all_peers_started.c \ + testing_api_cmd_netjail_start.c \ + testing_api_cmd_netjail_start_testsystem.c \ + testing_api_cmd_netjail_stop_testsystem.c \ + testing_api_cmd_netjail_stop.c \ testing.c testing.h \ testing_api_cmd_system_create.c \ testing_api_cmd_batch.c \ @@ -56,6 +89,7 @@ list_keys_LDADD = \ check_PROGRAMS = \ + test_testing_api_cmd_netjail \ test_testing_hello_world \ test_testing_portreservation \ test_testing_servicestartup \ @@ -66,6 +100,7 @@ check_PROGRAMS = \ if ENABLE_TEST_RUN AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; TESTS = \ + test_testing_api_cmd_netjail \ test_testing_hello_world \ test_testing_portreservation \ test_testing_peerstartup \ @@ -73,6 +108,12 @@ TESTS = \ test_testing_servicestartup endif +test_testing_api_cmd_netjail_SOURCES = \ + test_testing_api_cmd_netjail.c +test_testing_api_cmd_netjail_LDADD = \ + libgnunettesting.la \ + $(top_builddir)/src/util/libgnunetutil.la + test_testing_hello_world_SOURCES = \ test_testing_hello_world.c test_testing_hello_world_LDADD = \ diff --git a/src/testing/gnunet-cmds-helper.c b/src/testing/gnunet-cmds-helper.c new file mode 100644 index 000000000..d9fcf3541 --- /dev/null +++ b/src/testing/gnunet-cmds-helper.c @@ -0,0 +1,662 @@ +/* + This file is part of GNUnet + Copyright (C) 2008--2013, 2016 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet 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 + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + + SPDX-License-Identifier: AGPL3.0-or-later + */ + +/** + * @file testbed/gnunet-cmds-helper.c + * @brief Helper binary that is started from a remote interpreter loop to start + * a local interpreter loop. + * + * This helper monitors for three termination events. They are: (1)The + * stdin of the helper is closed for reading; (2)the helper received + * SIGTERM/SIGINT; (3)the local loop crashed. In case of events 1 and 2 + * the helper kills the interpreter loop. When the interpreter loop + * crashed (event 3), the helper should send a SIGTERM to its own process + * group; this behaviour will help terminate any child processes the loop + * has started and prevents them from leaking and running forever. + * + * @author t3sserakt + * @author Sree Harsha Totakura + */ + + +#include "platform.h" +#include "gnunet_util_lib.h" +#include "gnunet_testing_lib.h" +#include "gnunet_testing_ng_lib.h" +#include "testing_cmds.h" +#include "gnunet_testing_plugin.h" +#include + + +/** + * Generic logging shortcut + */ +#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__) + +/** + * Debug logging shorthand + */ +#define LOG_DEBUG(...) LOG (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__) + +#define NODE_BASE_IP "192.168.15." + +#define ROUTER_BASE_IP "92.68.150." + +/** + * Handle for a plugin. + */ +struct Plugin +{ + /** + * Name of the shared library. + */ + char *library_name; + + /** + * Plugin API. + */ + struct GNUNET_TESTING_PluginFunctions *api; + + char *node_ip; + + char *plugin_name; + + char *global_n; + + char *local_m; + + char *n; + + char *m; +}; + +struct NodeIdentifier +{ + char *n; + + char *m; + + char *global_n; + + char *local_m; +}; + +/** + * Context for a single write on a chunk of memory + */ +struct WriteContext +{ + /** + * The data to write + */ + void *data; + + /** + * The length of the data + */ + size_t length; + + /** + * The current position from where the write operation should begin + */ + size_t pos; +}; + +struct Plugin *plugin; + +/** + * The process handle to the testbed service + +static struct GNUNET_OS_Process *cmd_binary_process;*/ + +/** + * Handle to the testing system + */ +static struct GNUNET_TESTING_System *test_system; + +/** + * Our message stream tokenizer + */ +struct GNUNET_MessageStreamTokenizer *tokenizer; + +/** + * Disk handle from stdin + */ +static struct GNUNET_DISK_FileHandle *stdin_fd; + +/** + * Disk handle for stdout + */ +static struct GNUNET_DISK_FileHandle *stdout_fd; + +/** + * Pipe used to communicate shutdown via signal. + */ +static struct GNUNET_DISK_PipeHandle *sigpipe; + +/** + * Task identifier for the read task + */ +static struct GNUNET_SCHEDULER_Task *read_task_id; + +/** + * Task identifier for the write task + */ +static struct GNUNET_SCHEDULER_Task *write_task_id; + +/** + * Task to kill the child + */ +static struct GNUNET_SCHEDULER_Task *child_death_task_id; + +/** + * Are we done reading messages from stdin? + */ +static int done_reading; + +/** + * Result to return in case we fail + */ +static int status; + + +/** + * Task to shut down cleanly + * + * @param cls NULL + */ +static void +shutdown_task (void *cls) +{ + + LOG_DEBUG ("Shutting down.\n"); + LOG (GNUNET_ERROR_TYPE_ERROR, + "Shutting down tokenizer!\n"); + + if (NULL != read_task_id) + { + GNUNET_SCHEDULER_cancel (read_task_id); + read_task_id = NULL; + } + if (NULL != write_task_id) + { + struct WriteContext *wc; + + wc = GNUNET_SCHEDULER_cancel (write_task_id); + write_task_id = NULL; + GNUNET_free (wc->data); + GNUNET_free (wc); + } + if (NULL != child_death_task_id) + { + GNUNET_SCHEDULER_cancel (child_death_task_id); + child_death_task_id = NULL; + } + if (NULL != stdin_fd) + (void) GNUNET_DISK_file_close (stdin_fd); + if (NULL != stdout_fd) + (void) GNUNET_DISK_file_close (stdout_fd); + GNUNET_MST_destroy (tokenizer); + tokenizer = NULL; + + if (NULL != test_system) + { + GNUNET_TESTING_system_destroy (test_system, GNUNET_YES); + test_system = NULL; + } +} + + +/** + * Task to write to the standard out + * + * @param cls the WriteContext + */ +static void +write_task (void *cls) +{ + struct WriteContext *wc = cls; + ssize_t bytes_wrote; + + LOG (GNUNET_ERROR_TYPE_ERROR, + "Writing data!\n"); + + GNUNET_assert (NULL != wc); + write_task_id = NULL; + bytes_wrote = GNUNET_DISK_file_write (stdout_fd, + wc->data + wc->pos, + wc->length - wc->pos); + if (GNUNET_SYSERR == bytes_wrote) + { + LOG (GNUNET_ERROR_TYPE_WARNING, + "Cannot reply back successful initialization\n"); + GNUNET_free (wc->data); + GNUNET_free (wc); + return; + } + wc->pos += bytes_wrote; + if (wc->pos == wc->length) + { + GNUNET_free (wc->data); + GNUNET_free (wc); + LOG (GNUNET_ERROR_TYPE_ERROR, + "Written successfully!\n"); + return; + } + LOG (GNUNET_ERROR_TYPE_ERROR, + "Written data!\n"); + write_task_id = GNUNET_SCHEDULER_add_write_file (GNUNET_TIME_UNIT_FOREVER_REL, + stdout_fd, + &write_task, + wc); +} + + +/** + * Task triggered whenever we receive a SIGCHLD (child + * process died). + * + * @param cls closure, NULL if we need to self-restart + */ +/*static void +child_death_task (void *cls) +{ + const struct GNUNET_DISK_FileHandle *pr; + char c[16]; + + pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ); + child_death_task_id = NULL; + // consume the signal + GNUNET_break (0 < GNUNET_DISK_file_read (pr, &c, sizeof(c))); + LOG_DEBUG ("Got SIGCHLD\n"); + + LOG_DEBUG ("Child hasn't died. Resuming to monitor its status\n"); + child_death_task_id = + GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, + pr, + &child_death_task, + NULL); +}*/ + + +static void +write_message (struct GNUNET_MessageHeader *message, size_t msg_length) +{ + struct WriteContext *wc; + + LOG (GNUNET_ERROR_TYPE_ERROR, + "enter write_message!\n"); + wc = GNUNET_new (struct WriteContext); + wc->length = msg_length; + wc->data = message; + write_task_id = GNUNET_SCHEDULER_add_write_file ( + GNUNET_TIME_UNIT_FOREVER_REL, + stdout_fd, + &write_task, + wc); + LOG (GNUNET_ERROR_TYPE_ERROR, + "leave write_message!\n"); +} + + +/** + * Function to run the test cases. + * + * @param cls plugin to use. + * + */ +/*static void +run_plugin (void *cls) +{ + struct Plugin *plugin = cls; + char *router_ip; + char *node_ip; + + router_ip = GNUNET_malloc (strlen (ROUTER_BASE_IP) + strlen (plugin->m) + 1); + strcpy (router_ip, ROUTER_BASE_IP); + strcat (router_ip, plugin->m); + + node_ip = GNUNET_malloc (strlen (NODE_BASE_IP) + strlen (plugin->n) + 1); + strcat (node_ip, NODE_BASE_IP); + strcat (node_ip, plugin->n); + + plugin->api->start_testcase (&write_message, router_ip, node_ip); + +}*/ + + +/** + * Functions with this signature are called whenever a + * complete message is received by the tokenizer. + * + * Do not call #GNUNET_mst_destroy() in this callback + * + * @param cls identification of the client + * @param message the actual message + * @return #GNUNET_OK on success, + * #GNUNET_NO to stop further processing (no error) + * #GNUNET_SYSERR to stop further processing with error + */ +static int +tokenizer_cb (void *cls, const struct GNUNET_MessageHeader *message) +{ + struct NodeIdentifier *ni = cls; + const struct GNUNET_CMDS_HelperInit *msg; + struct GNUNET_CMDS_HelperReply *reply; + char *binary; + char *plugin_name; + size_t plugin_name_size; + uint16_t msize; + size_t msg_length; + char *router_ip; + char *node_ip; + + LOG (GNUNET_ERROR_TYPE_ERROR, + "tokenizer \n"); + + msize = ntohs (message->size); + if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_INIT == ntohs (message->type)) + { + msg = (const struct GNUNET_CMDS_HelperInit *) message; + plugin_name_size = ntohs (msg->plugin_name_size); + if ((sizeof(struct GNUNET_CMDS_HelperInit) + plugin_name_size) > msize) + { + GNUNET_break (0); + LOG (GNUNET_ERROR_TYPE_WARNING, + "Received unexpected message -- exiting\n"); + goto error; + } + plugin_name = GNUNET_malloc (plugin_name_size + 1); + GNUNET_strlcpy (plugin_name, + ((char *) &msg[1]), + plugin_name_size + 1); + + binary = GNUNET_OS_get_libexec_binary_path ("gnunet-cmd"); + + LOG (GNUNET_ERROR_TYPE_ERROR, + "plugin_name: %s \n", + plugin_name); + + // cmd_binary_process = GNUNET_OS_start_process ( + /*GNUNET_OS_INHERIT_STD_ERR verbose? , + NULL, + NULL, + NULL, + binary, + plugin_name, + ni->global_n, + ni->local_m, + ni->n, + ni->m, + NULL);*/ + + plugin = GNUNET_new (struct Plugin); + plugin->api = GNUNET_PLUGIN_load (plugin_name, + NULL); + plugin->library_name = GNUNET_strdup (basename (plugin_name)); + + plugin->global_n = ni->global_n; + plugin->local_m = ni->local_m; + plugin->n = ni->n; + plugin->m = ni->m; + + router_ip = GNUNET_malloc (strlen (ROUTER_BASE_IP) + strlen (plugin->m) + + 1); + strcpy (router_ip, ROUTER_BASE_IP); + strcat (router_ip, plugin->m); + + node_ip = GNUNET_malloc (strlen (NODE_BASE_IP) + strlen (plugin->n) + 1); + strcat (node_ip, NODE_BASE_IP); + strcat (node_ip, plugin->n); + + plugin->api->start_testcase (&write_message, router_ip, node_ip, plugin->m, + plugin->n, plugin->local_m); + + LOG (GNUNET_ERROR_TYPE_ERROR, + "We got here!\n"); + + /*if (NULL == cmd_binary_process) + { + LOG (GNUNET_ERROR_TYPE_ERROR, + "Starting plugin failed!\n"); + return GNUNET_SYSERR; + }*/ + + LOG (GNUNET_ERROR_TYPE_ERROR, + "We got here 2!\n"); + + LOG (GNUNET_ERROR_TYPE_ERROR, + "global_n: %s local_n: %s n: %s m: %s.\n", + ni->global_n, + ni->local_m, + ni->n, + ni->m); + + LOG (GNUNET_ERROR_TYPE_ERROR, + "We got here 3!\n"); + + GNUNET_free (binary); + + // done_reading = GNUNET_YES; + + msg_length = sizeof(struct GNUNET_CMDS_HelperReply); + reply = GNUNET_new (struct GNUNET_CMDS_HelperReply); + reply->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_REPLY); + reply->header.size = htons ((uint16_t) msg_length); + + LOG (GNUNET_ERROR_TYPE_ERROR, + "We got here 4!\n"); + + write_message ((struct GNUNET_MessageHeader *) reply, msg_length); + + LOG (GNUNET_ERROR_TYPE_ERROR, + "We got here 5!\n"); + + /*child_death_task_id = GNUNET_SCHEDULER_add_read_file ( + GNUNET_TIME_UNIT_FOREVER_REL, + GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ), + &child_death_task, + NULL);*/ + return GNUNET_OK; + } + else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED == ntohs ( + message->type)) + { + plugin->api->all_peers_started (); + return GNUNET_OK; + } + else + { + LOG (GNUNET_ERROR_TYPE_WARNING, "Received unexpected message -- exiting\n"); + goto error; + } + + + error: + status = GNUNET_SYSERR; + LOG (GNUNET_ERROR_TYPE_ERROR, + "tokenizer shutting down!\n"); + GNUNET_SCHEDULER_shutdown (); + return GNUNET_SYSERR; +} + + +/** + * Task to read from stdin + * + * @param cls NULL + */ +static void +read_task (void *cls) +{ + char buf[GNUNET_MAX_MESSAGE_SIZE]; + ssize_t sread; + + read_task_id = NULL; + sread = GNUNET_DISK_file_read (stdin_fd, buf, sizeof(buf)); + if ((GNUNET_SYSERR == sread) || (0 == sread)) + { + LOG_DEBUG ("STDIN closed\n"); + LOG (GNUNET_ERROR_TYPE_ERROR, + "tokenizer shutting down during reading!\n"); + GNUNET_SCHEDULER_shutdown (); + return; + } + if (GNUNET_YES == done_reading) + { + /* didn't expect any more data! */ + GNUNET_break_op (0); + LOG (GNUNET_ERROR_TYPE_ERROR, + "tokenizer shutting down during reading, didn't expect any more data!\n"); + GNUNET_SCHEDULER_shutdown (); + return; + } + LOG_DEBUG ("Read %u bytes\n", (unsigned int) sread); + LOG (GNUNET_ERROR_TYPE_ERROR, + "Read %u bytes\n", (unsigned int) sread); + /* FIXME: could introduce a GNUNET_MST_read2 to read + directly from 'stdin_fd' and save a memcpy() here */ + if (GNUNET_OK != + GNUNET_MST_from_buffer (tokenizer, buf, sread, GNUNET_NO, GNUNET_NO)) + { + GNUNET_break (0); + LOG (GNUNET_ERROR_TYPE_ERROR, + "tokenizer shutting down during reading, writing to buffer failed!\n"); + GNUNET_SCHEDULER_shutdown (); + return; + } + read_task_id /* No timeout while reading */ + = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, + stdin_fd, + &read_task, + NULL); +} + + +/** + * Main function that will be run. + * + * @param cls closure + * @param args remaining command-line arguments + * @param cfgfile name of the configuration file used (for saving, can be NULL!) + * @param cfg configuration + */ +static void +run (void *cls, + char *const *args, + const char *cfgfile, + const struct GNUNET_CONFIGURATION_Handle *cfg) +{ + struct NodeIdentifier *ni = cls; + + LOG_DEBUG ("Starting interpreter loop helper...\n"); + + tokenizer = GNUNET_MST_create (&tokenizer_cb, ni); + stdin_fd = GNUNET_DISK_get_handle_from_native (stdin); + stdout_fd = GNUNET_DISK_get_handle_from_native (stdout); + read_task_id = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, + stdin_fd, + &read_task, + NULL); + GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); +} + + +/** + * Signal handler called for SIGCHLD. + */ +static void +sighandler_child_death () +{ + static char c; + int old_errno; /* back-up errno */ + + old_errno = errno; + GNUNET_break ( + 1 == + GNUNET_DISK_file_write (GNUNET_DISK_pipe_handle (sigpipe, + GNUNET_DISK_PIPE_END_WRITE), + &c, + sizeof(c))); + errno = old_errno; +} + + +/** + * Main function + * + * @param argc the number of command line arguments + * @param argv command line arg array + * @return return code + */ +int +main (int argc, char **argv) +{ + struct NodeIdentifier *ni; + struct GNUNET_SIGNAL_Context *shc_chld; + struct GNUNET_GETOPT_CommandLineOption options[] = + { GNUNET_GETOPT_OPTION_END }; + int ret; + + GNUNET_log_setup ("gnunet-cmds-helper", + "DEBUG", + NULL); + ni = GNUNET_new (struct NodeIdentifier); + ni->global_n = argv[1]; + ni->local_m = argv[2]; + ni->n = argv[3]; + ni->m = argv[4]; + + LOG (GNUNET_ERROR_TYPE_ERROR, + "global_n: %s local_n: %s n: %s m: %s.\n", + ni->global_n, + ni->local_m, + ni->n, + ni->m); + + status = GNUNET_OK; + if (NULL == + (sigpipe = GNUNET_DISK_pipe (GNUNET_DISK_PF_NONE))) + { + GNUNET_break (0); + return 1; + } + shc_chld = + GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD, &sighandler_child_death); + ret = GNUNET_PROGRAM_run (argc, + argv, + "gnunet-cmds-helper", + "Helper for starting a local interpreter loop", + options, + &run, + ni); + LOG (GNUNET_ERROR_TYPE_ERROR, + "run finished\n"); + GNUNET_SIGNAL_handler_uninstall (shc_chld); + shc_chld = NULL; + GNUNET_DISK_pipe_close (sigpipe); + GNUNET_free (ni); + if (GNUNET_OK != ret) + return 1; + return (GNUNET_OK == status) ? 0 : 1; +} + + +/* end of gnunet-cmds-helper.c */ diff --git a/src/testing/test_testing_api_cmd_netjail.c b/src/testing/test_testing_api_cmd_netjail.c new file mode 100644 index 000000000..543642109 --- /dev/null +++ b/src/testing/test_testing_api_cmd_netjail.c @@ -0,0 +1,79 @@ +/* + This file is part of GNUnet + Copyright (C) 2021 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet 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 + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + + SPDX-License-Identifier: AGPL3.0-or-later + */ + +/** + * @file testing/test_testbed_api_cmd_netjail.c + * @brief Test case executing a script in a network name space. + * @author t3sserakt + */ +#include "platform.h" +#include "gnunet_testing_ng_lib.h" +#include "gnunet_util_lib.h" + + +/** + * Main function to run the test cases. + * + * @param cls not used. + * + */ +static void +run (void *cls) +{ + struct GNUNET_TESTING_Command commands[] = { + GNUNET_TESTING_cmd_netjail_start ("netjail-start-1", + "2", + "2"), + GNUNET_TESTING_cmd_netjail_start_testing_system ("netjail-start-testbed-1", + "2", + "2", + "libgnunet_plugin_testcmd"), + GNUNET_TESTING_cmd_stop_testing_system ("stop-testbed", + "netjail-start-testbed-1", + "2", + "2"), + GNUNET_TESTING_cmd_netjail_stop ("netjail-stop-1", + "2", + "2"), + GNUNET_TESTING_cmd_end () + }; + + GNUNET_TESTING_run (NULL, + commands, + GNUNET_TIME_UNIT_FOREVER_REL); +} + + +int +main (int argc, + char *const *argv) +{ + int rv = 0; + + GNUNET_log_setup ("test-netjail", + "DEBUG", + NULL); + GNUNET_SCHEDULER_run (&run, + NULL); + + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Test finished!\n"); + return rv; +} diff --git a/src/testing/test_testing_plugin_testcmd.c b/src/testing/test_testing_plugin_testcmd.c new file mode 100644 index 000000000..aeb0db5dc --- /dev/null +++ b/src/testing/test_testing_plugin_testcmd.c @@ -0,0 +1,116 @@ +/* + This file is part of GNUnet + Copyright (C) 2013, 2014 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet 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 + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + + SPDX-License-Identifier: AGPL3.0-or-later + */ + +/** + * @file testbed/plugin_testcmd.c + * @brief a plugin to provide the API for running test cases. + * @author t3sserakt + */ +#include "platform.h" +#include "gnunet_testing_ng_lib.h" +#include "gnunet_util_lib.h" +#include "gnunet_testing_ng_lib.h" + +/** + * Generic logging shortcut + */ +#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__) + +unsigned int are_all_peers_started; + +static void +all_peers_started () +{ + are_all_peers_started = GNUNET_YES; + LOG (GNUNET_ERROR_TYPE_ERROR, + "setting are_all_peers_started: %d\n", + are_all_peers_started); +} + +static void +start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip, + char *node_ip, + char *n, + char *m, + char *local_m) +{ + struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); + + LOG (GNUNET_ERROR_TYPE_ERROR, + "We got here 6!\n"); + + are_all_peers_started = GNUNET_NO; + + struct GNUNET_TESTING_Command commands[] = { + GNUNET_TESTING_cmd_hello_world_birth ("hello-world-birth-0", + &now), + GNUNET_TESTING_cmd_hello_world ("hello-world-0","hello-world-birth-0",""), + GNUNET_TESTING_cmd_send_peer_ready ("send-peer-ready-1", + write_message), + GNUNET_TESTING_cmd_block_until_all_peers_started ("block-1", + &are_all_peers_started), + GNUNET_TESTING_cmd_local_test_finished ("local-test-finished-1", + write_message) + }; + + GNUNET_TESTING_run (NULL, + commands, + GNUNET_TIME_UNIT_FOREVER_REL); + LOG (GNUNET_ERROR_TYPE_ERROR, + "We got here 7!\n"); + +} + + +/** + * Entry point for the plugin. + * + * @param cls NULL + * @return the exported block API + */ +void * +libgnunet_plugin_testcmd_init (void *cls) +{ + struct GNUNET_TESTING_PluginFunctions *api; + + api = GNUNET_new (struct GNUNET_TESTING_PluginFunctions); + api->start_testcase = &start_testcase; + api->all_peers_started = &all_peers_started; + return api; +} + + +/** + * Exit point from the plugin. + * + * @param cls the return value from #libgnunet_plugin_block_test_init + * @return NULL + */ +void * +libgnunet_plugin_testcmd_done (void *cls) +{ + struct GNUNET_TESTING_PluginFunctions *api = cls; + + GNUNET_free (api); + return NULL; +} + + +/* end of plugin_testcmd.c */ diff --git a/src/testing/testing_api_cmd_block_until_all_peers_started.c b/src/testing/testing_api_cmd_block_until_all_peers_started.c new file mode 100644 index 000000000..8659fbb46 --- /dev/null +++ b/src/testing/testing_api_cmd_block_until_all_peers_started.c @@ -0,0 +1,128 @@ +/* + This file is part of GNUnet + Copyright (C) 2021 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet 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 + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + + SPDX-License-Identifier: AGPL3.0-or-later + */ + +/** + * @file testing_api_cmd_block_until_all_peers_started.c + * @brief cmd to block the interpreter loop until all peers started. + * @author t3sserakt + */ +#include "platform.h" +#include "gnunet_util_lib.h" +#include "gnunet_testing_ng_lib.h" + +/** + * Generic logging shortcut + */ +#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__) + +struct BlockState +{ + unsigned int *all_peers_started; +}; + + +static int +block_until_all_peers_started_traits (void *cls, + const void **ret, + const char *trait, + unsigned int index) +{ + return GNUNET_OK; +} + + +static void +block_until_all_peers_started_cleanup (void *cls, + const struct GNUNET_TESTING_Command *cmd) +{ + struct BlockState *bs = cls; + + GNUNET_free (bs); +} + + +static void +block_until_all_peers_started_run (void *cls, + const struct GNUNET_TESTING_Command *cmd, + struct GNUNET_TESTING_Interpreter *is) +{ + LOG (GNUNET_ERROR_TYPE_ERROR, + "block_until_all_peers_started_run!\n"); +} + + +static int +block_until_all_peers_started_finish (void *cls, + GNUNET_SCHEDULER_TaskCallback cont, + void *cont_cls) +{ + struct BlockState *bs = cls; + unsigned int *ret = bs->all_peers_started; + + LOG (GNUNET_ERROR_TYPE_ERROR, + "We got here 10\n"); + + if (GNUNET_YES == *ret) + { + LOG (GNUNET_ERROR_TYPE_ERROR, + "We do not need to block anymore!\n"); + cont (cont_cls); + } + else + { + LOG (GNUNET_ERROR_TYPE_ERROR, + "You shall not pass!\n"); + } + + return *ret; +} + + +/** + * Create command. + * + * @param label name for command. + * @return command. + */ +struct GNUNET_TESTING_Command +GNUNET_TESTING_cmd_block_until_all_peers_started (const char *label, + unsigned int * + all_peers_started) +{ + struct BlockState *bs; + + LOG (GNUNET_ERROR_TYPE_ERROR, + "we have all_peers_started: %u\n", + *all_peers_started); + + bs = GNUNET_new (struct BlockState); + bs->all_peers_started = all_peers_started; + + struct GNUNET_TESTING_Command cmd = { + .cls = bs, + .label = label, + .run = &block_until_all_peers_started_run, + .finish = &block_until_all_peers_started_finish, + .cleanup = &block_until_all_peers_started_cleanup, + .traits = &block_until_all_peers_started_traits + }; + + return cmd; +} diff --git a/src/testing/testing_api_cmd_local_test_finished.c b/src/testing/testing_api_cmd_local_test_finished.c new file mode 100644 index 000000000..5b74d4e04 --- /dev/null +++ b/src/testing/testing_api_cmd_local_test_finished.c @@ -0,0 +1,131 @@ +/* + This file is part of GNUnet + Copyright (C) 2021 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet 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 + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + + SPDX-License-Identifier: AGPL3.0-or-later + */ + +/** + * @file testing_api_cmd_block_until_all_peers_started.c + * @brief cmd to block the interpreter loop until all peers started. + * @author t3sserakt + */ +#include "platform.h" +#include "gnunet_util_lib.h" +#include "gnunet_testing_ng_lib.h" +#include "testing_cmds.h" + +/** + * Generic logging shortcut + */ +#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__) + +struct LocalFinishedState +{ + TESTING_CMD_HELPER_write_cb write_message; + + struct GNUNET_CMDS_LOCAL_FINISHED *reply; +}; + + +static int +local_test_finished_traits (void *cls, + const void **ret, + const char *trait, + unsigned int index) +{ + return GNUNET_OK; +} + + +static void +local_test_finished_cleanup (void *cls, + const struct GNUNET_TESTING_Command *cmd) +{ + struct LocalFinishedState *lfs = cls; + + GNUNET_free (lfs->reply); + GNUNET_free (lfs); +} + + +static void +local_test_finished_run (void *cls, + const struct GNUNET_TESTING_Command *cmd, + struct GNUNET_TESTING_Interpreter *is) +{ + struct LocalFinishedState *lfs = cls; + + struct GNUNET_CMDS_LOCAL_FINISHED *reply; + size_t msg_length; + + LOG (GNUNET_ERROR_TYPE_ERROR, + "We got here 12!\n"); + + msg_length = sizeof(struct GNUNET_CMDS_LOCAL_FINISHED); + reply = GNUNET_new (struct GNUNET_CMDS_LOCAL_FINISHED); + reply->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED); + reply->header.size = htons ((uint16_t) msg_length); + lfs->reply = reply; + lfs->write_message ((struct GNUNET_MessageHeader *) reply, msg_length); + + LOG (GNUNET_ERROR_TYPE_ERROR, + "We got here 13!\n"); +} + + +static int +local_test_finished_finish (void *cls, + GNUNET_SCHEDULER_TaskCallback cont, + void *cont_cls) +{ + // This will stop the local loop without shutting down the scheduler, because we do not call the continuation, which is the interpreter_next method. + LOG (GNUNET_ERROR_TYPE_ERROR, + "Stopping local loop\n"); + return GNUNET_YES; +} + + +/** + * Create command. + * + * @param label name for command. + * @return command. + */ +struct GNUNET_TESTING_Command +GNUNET_TESTING_cmd_local_test_finished (const char *label, + TESTING_CMD_HELPER_write_cb + write_message) +{ + struct LocalFinishedState *lfs; + + LOG (GNUNET_ERROR_TYPE_ERROR, + "We got here 11!\n"); + + lfs = GNUNET_new (struct LocalFinishedState); + lfs->write_message = write_message; + + struct GNUNET_TESTING_Command cmd = { + .cls = lfs, + .label = label, + .run = &local_test_finished_run, + .finish = &local_test_finished_finish, + .cleanup = &local_test_finished_cleanup, + .traits = &local_test_finished_traits + }; + + return cmd; +} diff --git a/src/testing/testing_api_cmd_netjail_start.c b/src/testing/testing_api_cmd_netjail_start.c new file mode 100644 index 000000000..c82392a08 --- /dev/null +++ b/src/testing/testing_api_cmd_netjail_start.c @@ -0,0 +1,217 @@ +/* + This file is part of GNUnet + Copyright (C) 2021 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet 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 + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + + SPDX-License-Identifier: AGPL3.0-or-later + */ + +/** + * @file testing/testing_api_cmd_hello_world.c + * @brief Command to start the netjail script. + * @author t3sserakt + */ +#include "platform.h" +#include "gnunet_util_lib.h" +#include "gnunet_testing_ng_lib.h" + +#define NETJAIL_START_SCRIPT "./../testing/netjail_start.sh" + +struct NetJailState +{ + struct GNUNET_ChildWaitHandle *cwh; + + char *local_m; + + char *global_n; + + /** + * The process id of the start script. + */ + struct GNUNET_OS_Process *start_proc; + + unsigned int finished; +}; + + +/** +* +* +* @param cls closure +* @param cmd current CMD being cleaned up. +*/ +static void +netjail_start_cleanup (void *cls, + const struct GNUNET_TESTING_Command *cmd) +{ + struct NetJailState *ns = cls; + + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "netjail_start_cleanup!\n"); + + if (NULL != ns->cwh) + { + GNUNET_wait_child_cancel (ns->cwh); + ns->cwh = NULL; + } + if (NULL != ns->start_proc) + { + GNUNET_assert (0 == + GNUNET_OS_process_kill (ns->start_proc, + SIGKILL)); + GNUNET_assert (GNUNET_OK == + GNUNET_OS_process_wait (ns->start_proc)); + GNUNET_OS_process_destroy (ns->start_proc); + ns->start_proc = NULL; + } + GNUNET_free (ns); +} + + +/** +* +* +* @param cls closure. +* @param[out] ret result +* @param trait name of the trait. +* @param index index number of the object to offer. +* @return #GNUNET_OK on success. +*/ +static int +netjail_start_traits (void *cls, + const void **ret, + const char *trait, + unsigned int index) +{ + return GNUNET_OK; +} + +static void +child_completed_callback (void *cls, + enum GNUNET_OS_ProcessStatusType type, + long unsigned int exit_code) +{ + struct NetJailState *ns = cls; + + if (0 == exit_code) + { + ns->finished = GNUNET_YES; + } + else + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Child completed with an error!\n"); + ns->finished = GNUNET_SYSERR; + } + GNUNET_OS_process_destroy (ns->start_proc); + ns->start_proc = NULL; +} + + + +/** +* Run the "hello world" CMD. +* +* @param cls closure. +* @param cmd CMD being run. +* @param is interpreter state. +*/ +static void +netjail_start_run (void *cls, + const struct GNUNET_TESTING_Command *cmd, + struct GNUNET_TESTING_Interpreter *is) +{ + struct NetJailState *ns = cls; + char *const script_argv[] = {NETJAIL_START_SCRIPT, + ns->local_m, + ns->global_n, + NULL}; + unsigned int helper_check = GNUNET_OS_check_helper_binary ( + NETJAIL_START_SCRIPT, + GNUNET_YES, + NULL); + + if (GNUNET_NO == helper_check) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "No SUID for %s!\n", + NETJAIL_START_SCRIPT); + GNUNET_TESTING_interpreter_fail (); + } + else if (GNUNET_NO == helper_check) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "%s not found!\n", + NETJAIL_START_SCRIPT); + GNUNET_TESTING_interpreter_fail (); + } + + ns->start_proc = GNUNET_OS_start_process_vap (GNUNET_OS_INHERIT_STD_ERR, + NULL, + NULL, + NULL, + NETJAIL_START_SCRIPT, + script_argv); + + ns->cwh = GNUNET_wait_child (ns->start_proc, + &child_completed_callback, + ns); + GNUNET_break (NULL != ns->cwh); +} + +static int +netjail_start_finish (void *cls, + GNUNET_SCHEDULER_TaskCallback cont, + void *cont_cls) +{ + struct NetJailState *ns = cls; + + if (ns->finished) + { + cont (cont_cls); + } + return ns->finished; +} + +/** + * Create command. + * + * @param label name for command. + * @param binaryname to start. + * @return command. + */ +struct GNUNET_TESTING_Command +GNUNET_TESTING_cmd_netjail_start (const char *label, + char *local_m, + char *global_n) +{ + struct NetJailState *ns; + + ns = GNUNET_new (struct NetJailState); + ns->local_m = local_m; + ns->global_n = global_n; + ns->finished = GNUNET_NO; + + struct GNUNET_TESTING_Command cmd = { + .cls = ns, + .label = label, + .run = &netjail_start_run, + .finish = &netjail_start_finish, + .cleanup = &netjail_start_cleanup, + .traits = &netjail_start_traits + }; + + return cmd; +} diff --git a/src/testing/testing_api_cmd_netjail_start_testsystem.c b/src/testing/testing_api_cmd_netjail_start_testsystem.c new file mode 100644 index 000000000..5c2f71168 --- /dev/null +++ b/src/testing/testing_api_cmd_netjail_start_testsystem.c @@ -0,0 +1,541 @@ +/* + This file is part of GNUnet + Copyright (C) 2021 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet 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 + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + + SPDX-License-Identifier: AGPL3.0-or-later + */ + +/** + * @file testing/testing_api_cmd_hello_world.c + * @brief Command to start the netjail peers. + * @author t3sserakt + */ +#include "platform.h" +#include "gnunet_testing_ng_lib.h" +#include "testing_cmds.h" + +#define NETJAIL_EXEC_SCRIPT "./../testing/netjail_exec.sh" + +struct HelperMessage; + +struct HelperMessage +{ + + struct HelperMessage *next; + + struct HelperMessage *prev; + + /** + * Size of the original message. + */ + uint16_t bytes_msg; + + /* Followed by @e bytes_msg of msg.*/ +}; + + + +struct NetJailState +{ + + unsigned int *rv; + + struct HelperMessage *hp_messages_head; + + struct HelperMessage *hp_messages_tail; + + /** + * The process handle + */ + struct GNUNET_HELPER_Handle **helper; + + unsigned int n_helper; + + char *binary_name; + + char *local_m; + + char *global_n; + + /** + * The send handle for the helper + */ + struct GNUNET_HELPER_SendHandle **shandle; + + unsigned int n_shandle; + + /** + * The message corresponding to send handle + */ + struct GNUNET_MessageHeader **msg; + + unsigned int n_msg; + + unsigned int number_of_testsystems_started; + + unsigned int number_of_peers_started; + + unsigned int number_of_local_test_finished; + + char *plugin_name; +}; + +struct TestingSystemCount +{ + unsigned int count; + + struct NetJailState *ns; +}; + +/** +* +* +* @param cls closure +* @param cmd current CMD being cleaned up. +*/ +static void +netjail_exec_cleanup (void *cls, + const struct GNUNET_TESTING_Command *cmd) +{ + struct NetJailState *ns = cls; + + GNUNET_free (ns->binary_name); +} + + +/** +* +* +* @param cls closure. +* @param[out] ret result +* @param trait name of the trait. +* @param index index number of the object to offer. +* @return #GNUNET_OK on success. +*/ +static int +netjail_exec_traits (void *cls, + const void **ret, + const char *trait, + unsigned int index) +{ + struct NetJailState *ns = cls; + struct GNUNET_HELPER_Handle **helper = ns->helper; + struct HelperMessage *hp_messages_head = ns->hp_messages_head; + + + struct GNUNET_TESTING_Trait traits[] = { + { + .index = 0, + .trait_name = "helper_handles", + .ptr = (const void *) helper, + }, + { + .index = 1, + .trait_name = "hp_msgs_head", + .ptr = (const void *) hp_messages_head, + }, + GNUNET_TESTING_trait_end () + }; + + return GNUNET_TESTING_get_trait (traits, + ret, + trait, + index); +} + + +/** + * Offer handles to testing cmd helper from trait + * + * @param cmd command to extract the message from. + * @param pt pointer to message. + * @return #GNUNET_OK on success. + */ +int +GNUNET_TESTING_get_trait_helper_handles (const struct + GNUNET_TESTING_Command *cmd, + struct GNUNET_HELPER_Handle ***helper) +{ + return cmd->traits (cmd->cls, + (const void **) helper, + "helper_handles", + (unsigned int) 0); +} + +/** + * Offer messages received via testing cmd helper from trait + * + * @param cmd command to extract the message from. + * @param pt pointer to message. + * @return #GNUNET_OK on success. + */ +int +GNUNET_TESTING_get_trait_helper_messages (const struct + GNUNET_TESTING_Command *cmd, + struct HelperMessage *** + hp_messages_head) +{ + return cmd->traits (cmd->cls, + (const void **) hp_messages_head, + "hp_msgs_head", + (unsigned int) 1); +} + + +/** + * Continuation function from GNUNET_HELPER_send() + * + * @param cls closure + * @param result GNUNET_OK on success, + * GNUNET_NO if helper process died + * GNUNET_SYSERR during GNUNET_HELPER_stop + */ +static void +clear_msg (void *cls, int result) +{ + struct TestingSystemCount *tbc = cls; + struct NetJailState *ns = tbc->ns; + + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "clear_msg tbc->count: %d\n", + tbc->count); + GNUNET_assert (NULL != ns->shandle[tbc->count - 1]); + ns->shandle[tbc->count - 1] = NULL; + GNUNET_free (ns->msg[tbc->count - 1]); + ns->msg[tbc->count - 1] = NULL; +} + + +/** + * Functions with this signature are called whenever a + * complete message is received by the tokenizer. + * + * Do not call GNUNET_SERVER_mst_destroy in callback + * + * @param cls closure + * @param client identification of the client + * @param message the actual message + * + * @return #GNUNET_OK on success, #GNUNET_SYSERR to stop further processing + */ +static int +helper_mst (void *cls, const struct GNUNET_MessageHeader *message) +{ + struct TestingSystemCount *tbc = cls; + struct NetJailState *ns = tbc->ns; + struct HelperMessage *hp_msg; + + if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_REPLY == ntohs (message->type)) + { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "helper_mst tbc->count: %d\n", + tbc->count); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Received message from helper.\n"); + ns->number_of_testsystems_started++; + } + else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED == ntohs ( + message->type)) + { + ns->number_of_peers_started++; + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "number_of_peers_started: %d\n", + ns->number_of_peers_started); + } + else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED == ntohs ( + message->type)) + { + ns->number_of_local_test_finished++; + } + else + { + hp_msg = GNUNET_new (struct HelperMessage); + hp_msg->bytes_msg = message->size; + memcpy (&hp_msg[1], message, message->size); + GNUNET_CONTAINER_DLL_insert (ns->hp_messages_head, ns->hp_messages_tail, + hp_msg); + } + + return GNUNET_OK; +} + + +static void +exp_cb (void *cls) +{ + struct NetJailState *ns = cls; + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Called exp_cb.\n"); + *ns->rv = 1; +} + + +static struct GNUNET_CMDS_HelperInit * +create_helper_init_msg_ (char *m_char, + char *n_char, + const char *plugin_name) +{ + struct GNUNET_CMDS_HelperInit *msg; + uint16_t plugin_name_len; + uint16_t msg_size; + + GNUNET_assert (NULL != plugin_name); + plugin_name_len = strlen (plugin_name); + msg_size = sizeof(struct GNUNET_CMDS_HelperInit) + plugin_name_len; + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "msg_size: %d \n", + msg_size); + msg = GNUNET_malloc (msg_size); + msg->header.size = htons (msg_size); + msg->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_INIT); + msg->plugin_name_size = htons (plugin_name_len); + GNUNET_memcpy ((char *) &msg[1], + plugin_name, + plugin_name_len); + return msg; +} + + +static void +start_helper (struct NetJailState *ns, struct + GNUNET_CONFIGURATION_Handle *config, + char *m_char, + char *n_char) +{ + // struct GNUNET_CONFIGURATION_Handle *cfg; + struct GNUNET_CMDS_HelperInit *msg; + struct TestingSystemCount *tbc; + char *const script_argv[] = {NETJAIL_EXEC_SCRIPT, + m_char, + n_char, + GNUNET_OS_get_libexec_binary_path ( + HELPER_CMDS_BINARY), + ns->global_n, + ns->local_m, + NULL}; + unsigned int m = atoi (m_char); + unsigned int n = atoi (n_char); + unsigned int helper_check = GNUNET_OS_check_helper_binary ( + NETJAIL_EXEC_SCRIPT, + GNUNET_YES, + NULL); + + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "m: %d n: %d\n", + m, + n); + + tbc = GNUNET_new (struct TestingSystemCount); + tbc->ns = ns; + tbc->count = (n - 1) * atoi (ns->local_m) + m; + + + if (GNUNET_NO == helper_check) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "No SUID for %s!\n", + NETJAIL_EXEC_SCRIPT); + *ns->rv = 1; + } + else if (GNUNET_NO == helper_check) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "%s not found!\n", + NETJAIL_EXEC_SCRIPT); + *ns->rv = 1; + } + + GNUNET_array_append (ns->helper, ns->n_helper, GNUNET_HELPER_start ( + GNUNET_YES, + NETJAIL_EXEC_SCRIPT, + script_argv, + &helper_mst, + &exp_cb, + tbc)); + + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "First using helper %d %d\n", + tbc->count - 1, + ns->n_helper); + struct GNUNET_HELPER_Handle *helper = ns->helper[tbc->count - 1]; + + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "First using helper %d %d %p\n", + tbc->count - 1, + ns->n_helper, + helper); + + msg = create_helper_init_msg_ (m_char, + n_char, + ns->plugin_name); + GNUNET_array_append (ns->msg, ns->n_msg, &msg->header); + + GNUNET_array_append (ns->shandle, ns->n_shandle, GNUNET_HELPER_send ( + helper, + &msg->header, + GNUNET_NO, + &clear_msg, + tbc)); + + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Message %d send!\n", + tbc->count); + + if (NULL == ns->shandle[tbc->count - 1]) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Send handle is NULL!\n"); + GNUNET_free (msg); + *ns->rv = 1; + } +} + + +/** +* Run the "hello world" CMD. +* +* @param cls closure. +* @param cmd CMD being run. +* @param is interpreter state. +*/ +static void +netjail_exec_run (void *cls, + const struct GNUNET_TESTING_Command *cmd, + struct GNUNET_TESTING_Interpreter *is) +{ + char str_m[12]; + char str_n[12]; + struct NetJailState *ns = cls; + struct GNUNET_CONFIGURATION_Handle *config = + GNUNET_CONFIGURATION_create (); + + for (int i = 1; i <= atoi (ns->global_n); i++) { + for (int j = 1; j <= atoi (ns->local_m); j++) + { + sprintf (str_n, "%d", i); + sprintf (str_m, "%d", j); + start_helper (ns, config, + str_m, + str_n); + } + } +} + + +static int +netjail_start_finish (void *cls, + GNUNET_SCHEDULER_TaskCallback cont, + void *cont_cls) +{ + unsigned int ret = GNUNET_NO; + struct NetJailState *ns = cls; + unsigned int total_number = atoi (ns->local_m) * atoi (ns->global_n); + struct GNUNET_CMDS_ALL_PEERS_STARTED *reply; + size_t msg_length; + struct GNUNET_HELPER_Handle *helper; + struct TestingSystemCount *tbc; + + if (ns->number_of_local_test_finished == total_number) + { + ret = GNUNET_YES; + cont (cont_cls); + } + + if (ns->number_of_testsystems_started == total_number) + { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "All helpers started!\n"); + ns->number_of_testsystems_started = 0; + } + + if (ns->number_of_peers_started == total_number) + { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "All peers started!\n"); + + for (int i = 1; i <= atoi (ns->global_n); i++) { + for (int j = 1; j <= atoi (ns->local_m); j++) + { + tbc = GNUNET_new (struct TestingSystemCount); + tbc->ns = ns; + // TODO This needs to be more generic. As we send more messages back and forth, we can not grow the arrays again and again, because this is to error prone. + tbc->count = (i - 1) * atoi (ns->local_m) + j + total_number; + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Second using helper %d %d %d\n", + tbc->count - 1 - total_number, + i, + j); + helper = ns->helper[tbc->count - 1 - total_number]; + msg_length = sizeof(struct GNUNET_CMDS_ALL_PEERS_STARTED); + reply = GNUNET_new (struct GNUNET_CMDS_ALL_PEERS_STARTED); + reply->header.type = htons ( + GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED); + reply->header.size = htons ((uint16_t) msg_length); + + GNUNET_array_append (ns->msg, ns->n_msg, &reply->header); + + struct GNUNET_HELPER_SendHandle *sh = GNUNET_HELPER_send ( + helper, + &reply->header, + GNUNET_NO, + &clear_msg, + tbc); + + GNUNET_array_append (ns->shandle, ns->n_shandle, sh); + + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "All peers started message %d send!\n", + tbc->count); + } + } + ns->number_of_peers_started = 0; + } + return ret; +} + + +/** + * Create command. + * + * @param label name for command. + * @param binaryname to exec. + * @return command. + */ +struct GNUNET_TESTING_Command +GNUNET_TESTING_cmd_netjail_start_testing_system (const char *label, + char *local_m, + char *global_n, + char *plugin_name, + unsigned int *rv) +{ + struct NetJailState *ns; + + ns = GNUNET_new (struct NetJailState); + ns->local_m = local_m; + ns->global_n = global_n; + ns->plugin_name = plugin_name; + ns->rv = rv; + + struct GNUNET_TESTING_Command cmd = { + .cls = ns, + .label = label, + .run = &netjail_exec_run, + .finish = &netjail_start_finish, + .cleanup = &netjail_exec_cleanup, + .traits = &netjail_exec_traits + }; + + return cmd; +} diff --git a/src/testing/testing_api_cmd_netjail_stop.c b/src/testing/testing_api_cmd_netjail_stop.c new file mode 100644 index 000000000..710b4fbf4 --- /dev/null +++ b/src/testing/testing_api_cmd_netjail_stop.c @@ -0,0 +1,215 @@ +/* + This file is part of GNUnet + Copyright (C) 2021 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet 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 + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + + SPDX-License-Identifier: AGPL3.0-or-later + */ + +/** + * @file testing/testing_api_cmd_hello_world.c + * @brief Command to stop the netjail script. + * @author t3sserakt + */ +#include "platform.h" +#include "gnunet_util_lib.h" +#include "gnunet_testing_ng_lib.h" + + +#define NETJAIL_STOP_SCRIPT "./../testing/netjail_stop.sh" + +struct GNUNET_ChildWaitHandle *cwh; + +struct NetJailState +{ + char *local_m; + + char *global_n; + + /** + * The process id of the start script. + */ + struct GNUNET_OS_Process *stop_proc; + + unsigned int finished; +}; + + +/** +* +* +* @param cls closure +* @param cmd current CMD being cleaned up. +*/ +static void +netjail_stop_cleanup (void *cls, + const struct GNUNET_TESTING_Command *cmd) +{ + struct NetJailState *ns = cls; + + if (NULL != cwh) + { + GNUNET_wait_child_cancel (cwh); + cwh = NULL; + } + if (NULL != ns->stop_proc) + { + GNUNET_assert (0 == + GNUNET_OS_process_kill (ns->stop_proc, + SIGKILL)); + GNUNET_assert (GNUNET_OK == + GNUNET_OS_process_wait (ns->stop_proc)); + GNUNET_OS_process_destroy (ns->stop_proc); + ns->stop_proc = NULL; + } +} + + +/** +* +* +* @param cls closure. +* @param[out] ret result +* @param trait name of the trait. +* @param index index number of the object to offer. +* @return #GNUNET_OK on success. +*/ +static int +netjail_stop_traits (void *cls, + const void **ret, + const char *trait, + unsigned int index) +{ + return GNUNET_OK; +} + + +static void +child_completed_callback (void *cls, + enum GNUNET_OS_ProcessStatusType type, + long unsigned int exit_code) +{ + struct NetJailState *ns = cls; + + cwh = NULL; + if (0 == exit_code) + { + ns->finished = GNUNET_YES; + } + else + { + ns->finished = GNUNET_SYSERR; + } + GNUNET_OS_process_destroy (ns->stop_proc); + ns->stop_proc = NULL; +} + + +/** +* Run the "hello world" CMD. +* +* @param cls closure. +* @param cmd CMD being run. +* @param is interpreter state. +*/ +static void +netjail_stop_run (void *cls, + const struct GNUNET_TESTING_Command *cmd, + struct GNUNET_TESTING_Interpreter *is) +{ + struct NetJailState *ns = cls; + char *const script_argv[] = {NETJAIL_STOP_SCRIPT, + ns->local_m, + ns->global_n, + NULL}; + unsigned int helper_check = GNUNET_OS_check_helper_binary ( + NETJAIL_STOP_SCRIPT, + GNUNET_YES, + NULL); + + if (GNUNET_NO == helper_check) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "No SUID for %s!\n", + NETJAIL_STOP_SCRIPT); + GNUNET_TESTING_interpreter_fail (); + } + else if (GNUNET_NO == helper_check) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "%s not found!\n", + NETJAIL_STOP_SCRIPT); + GNUNET_TESTING_interpreter_fail (); + } + + ns->stop_proc = GNUNET_OS_start_process_vap (GNUNET_OS_INHERIT_STD_ERR, + NULL, + NULL, + NULL, + NETJAIL_STOP_SCRIPT, + script_argv); + + cwh = GNUNET_wait_child (ns->stop_proc, + &child_completed_callback, + ns); + GNUNET_break (NULL != cwh); + +} + + +static int +netjail_stop_finish (void *cls, + GNUNET_SCHEDULER_TaskCallback cont, + void *cont_cls) +{ + struct NetJailState *ns = cls; + + if (ns->finished) + { + cont (cont_cls); + } + return ns->finished; +} + + +/** + * Create command. + * + * @param label name for command. + * @param binaryname to stop. + * @return command. + */ +struct GNUNET_TESTING_Command +GNUNET_TESTING_cmd_netjail_stop (const char *label, + char *local_m, + char *global_n) +{ + struct NetJailState *ns; + + ns = GNUNET_new (struct NetJailState); + ns->local_m = local_m; + ns->global_n = global_n; + + struct GNUNET_TESTING_Command cmd = { + .cls = ns, + .label = label, + .run = &netjail_stop_run, + .finish = &netjail_stop_finish, + .cleanup = &netjail_stop_cleanup, + .traits = &netjail_stop_traits + }; + + return cmd; +} diff --git a/src/testing/testing_api_cmd_netjail_stop_testsystem.c b/src/testing/testing_api_cmd_netjail_stop_testsystem.c new file mode 100644 index 000000000..bed9f3ebf --- /dev/null +++ b/src/testing/testing_api_cmd_netjail_stop_testsystem.c @@ -0,0 +1,141 @@ +/* + This file is part of GNUnet + Copyright (C) 2021 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet 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 + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + + SPDX-License-Identifier: AGPL3.0-or-later + */ + +/** + * @file testing/testing_api_cmd_hello_world.c + * @brief Command to start the netjail peers. + * @author t3sserakt + */ +#include "platform.h" +#include "gnunet_testing_ng_lib.h" +#include "testing_cmds.h" + + +struct StopHelperState +{ + + const char *helper_start_label; + + /** + * The process handle + */ + struct GNUNET_HELPER_Handle **helper; + + char *local_m; + + char *global_n; +}; + + +/** +* +* +* @param cls closure +* @param cmd current CMD being cleaned up. +*/ +static void +stop_testing_system_cleanup (void *cls, + const struct GNUNET_TESTING_Command *cmd) +{ + +} + + +/** +* +* +* @param cls closure. +* @param[out] ret result +* @param trait name of the trait. +* @param index index number of the object to offer. +* @return #GNUNET_OK on success. +*/ +static int +stop_testing_system_traits (void *cls, + const void **ret, + const char *trait, + unsigned int index) +{ + return GNUNET_OK; +} + + +/** +* Run the "hello world" CMD. +* +* @param cls closure. +* @param cmd CMD being run. +* @param is interpreter state. +*/ +static void +stop_testing_system_run (void *cls, + const struct GNUNET_TESTING_Command *cmd, + struct GNUNET_TESTING_Interpreter *is) +{ + struct StopHelperState *shs = cls; + struct GNUNET_HELPER_Handle **helper; + const struct GNUNET_TESTING_Command *start_helper_cmd; + + start_helper_cmd = GNUNET_TESTING_interpreter_lookup_command ( + shs->helper_start_label); + GNUNET_TESTING_get_trait_helper_handles (start_helper_cmd, + &helper); + + for (int i = 1; i <= atoi (shs->global_n); i++) { + for (int j = 1; j <= atoi (shs->local_m); j++) + { + GNUNET_HELPER_stop (helper[(i - 1) * atoi (shs->local_m) + j - 1], + GNUNET_YES); + } + } +} + + +/** + * Create command. + * + * @param label name for command. + * @param binaryname to exec. + * @return command. + */ +struct GNUNET_TESTING_Command +GNUNET_TESTING_cmd_stop_testing_system (const char *label, + const char *helper_start_label, + char *local_m, + char *global_n + ) +{ + struct StopHelperState *shs; + + shs = GNUNET_new (struct StopHelperState); + shs->helper_start_label = helper_start_label; + shs->local_m = local_m; + shs->global_n = global_n; + + struct GNUNET_TESTING_Command cmd = { + .cls = shs, + .label = label, + .run = &stop_testing_system_run, + .cleanup = &stop_testing_system_cleanup, + .traits = &stop_testing_system_traits + }; + + return cmd; +} diff --git a/src/testing/testing_api_cmd_send_peer_ready.c b/src/testing/testing_api_cmd_send_peer_ready.c index e5e004924..afe28de77 100644 --- a/src/testing/testing_api_cmd_send_peer_ready.c +++ b/src/testing/testing_api_cmd_send_peer_ready.c @@ -26,8 +26,7 @@ #include "platform.h" #include "gnunet_util_lib.h" #include "gnunet_testing_ng_lib.h" -#include "testbed_api.h" -#include "testbed_helper.h" +#include "testing_cmds.h" struct SendPeerReadyState @@ -68,7 +67,7 @@ send_peer_ready_run (void *cls, struct GNUNET_CMDS_PEER_STARTED *reply; size_t msg_length; - msg_length = sizeof(struct GNUNET_CMDS_HelperInit);// GNUNET_CMDS_PEER_STARTED); + msg_length = sizeof(struct GNUNET_CMDS_PEER_STARTED); reply = GNUNET_new (struct GNUNET_CMDS_PEER_STARTED); reply->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED); reply->header.size = htons ((uint16_t) msg_length); diff --git a/src/testing/testing_cmds.h b/src/testing/testing_cmds.h new file mode 100644 index 000000000..7a5860aea --- /dev/null +++ b/src/testing/testing_cmds.h @@ -0,0 +1,90 @@ +/* + This file is part of GNUnet + Copyright (C) 2021 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet 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 + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + + SPDX-License-Identifier: AGPL3.0-or-later + */ + +/** + * @file testing/testing_cmds.h + * @brief Message formats for communication between testing cmds helper and testcase plugins. + * @author t3sserakt + */ + +#ifndef TESTING_CMDS_H +#define TESTING_CMDS_H + +#define HELPER_CMDS_BINARY "gnunet-cmds-helper" + +GNUNET_NETWORK_STRUCT_BEGIN + +/** + * Initialization message for gnunet-cmds-testbed to start cmd binary. + */ +struct GNUNET_CMDS_HelperInit +{ + /** + * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_INIT + */ + struct GNUNET_MessageHeader header; + + /** + * + */ + uint16_t plugin_name_size GNUNET_PACKED; + + /* Followed by plugin name of the plugin running the test case. This is not NULL + * terminated */ +}; + +/** + * Reply message from cmds helper process + */ +struct GNUNET_CMDS_HelperReply +{ + /** + * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_REPLY + */ + struct GNUNET_MessageHeader header; +}; + +struct GNUNET_CMDS_PEER_STARTED +{ + /** + * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED + */ + struct GNUNET_MessageHeader header; +}; + +struct GNUNET_CMDS_ALL_PEERS_STARTED +{ + /** + * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED + */ + struct GNUNET_MessageHeader header; +}; + +struct GNUNET_CMDS_LOCAL_FINISHED +{ + /** + * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED + */ + struct GNUNET_MessageHeader header; +}; + +GNUNET_NETWORK_STRUCT_END +#endif +/* end of testing_cmds.h */ diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am index 0782a631b..0696188c5 100644 --- a/src/transport/Makefile.am +++ b/src/transport/Makefile.am @@ -398,20 +398,19 @@ plugin_LTLIBRARIES = \ $(HTTP_SERVER_PLUGIN_LA) \ $(HTTPS_SERVER_PLUGIN_LA) \ $(WLAN_PLUGIN_LA) \ - $(BT_PLUGIN_LA) -# libgnunet_plugin_cmd_simple_send.la - -#libgnunet_plugin_cmd_simple_send_la_SOURCES = \ -# plugin_cmd_simple_send.c -#libgnunet_plugin_cmd_simple_send_la_LIBADD = \ -# $(top_builddir)/src/util/libgnunetutil.la \ -# $(top_builddir)/src/testing/libgnunettesting.la \ -# $(top_builddir)/src/statistics/libgnunetstatistics.la \ -# $(top_builddir)/src/testbed/libgnunettestbed.la \ -# libgnunettransporttesting2.la \ -# $(LTLIBINTL) -#libgnunet_plugin_cmd_simple_send_la_LDFLAGS = \ -# $(GN_PLUGIN_LDFLAGS) + $(BT_PLUGIN_LA) \ + libgnunet_test_transport_plugin_cmd_simple_send.la + +libgnunet_test_transport_plugin_cmd_simple_send_la_SOURCES = \ + test_transport_plugin_cmd_simple_send.c +libgnunet_test_transport_plugin_cmd_simple_send_la_LIBADD = \ + $(top_builddir)/src/util/libgnunetutil.la \ + $(top_builddir)/src/testing/libgnunettesting.la \ + $(top_builddir)/src/statistics/libgnunetstatistics.la \ + libgnunettransporttesting2.la \ + $(LTLIBINTL) +libgnunet_test_transport_plugin_cmd_simple_send_la_LDFLAGS = \ + $(GN_PLUGIN_LDFLAGS) if HAVE_EXPERIMENTAL plugin_LTLIBRARIES += libgnunet_plugin_transport_udp.la diff --git a/src/transport/plugin_cmd_simple_send.c b/src/transport/plugin_cmd_simple_send.c deleted file mode 100644 index 468f4e48a..000000000 --- a/src/transport/plugin_cmd_simple_send.c +++ /dev/null @@ -1,196 +0,0 @@ -/* - This file is part of GNUnet - Copyright (C) 2013, 2014 GNUnet e.V. - - GNUnet is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - GNUnet 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 - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - - SPDX-License-Identifier: AGPL3.0-or-later - */ - -/** - * @file testbed/plugin_cmd_simple_send.c - * @brief a plugin to provide the API for running test cases. - * @author t3sserakt - */ -#include "platform.h" -#include "gnunet_testing_ng_lib.h" -#include "gnunet_util_lib.h" -#include "gnunet_transport_application_service.h" -// #include "gnunet_transport_service.h" -#include "gnunet_testbed_ng_service.h" -#include "transport-testing2.h" -#include "transport-testing-cmds.h" - -/** - * Generic logging shortcut - */ -#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__) - -#define BASE_DIR "testdir" - -struct GNUNET_MQ_MessageHandler *handlers; - -unsigned int are_all_peers_started; - -static int -check_test (void *cls, - const struct GNUNET_TRANSPORT_TESTING_TestMessage *message) -{ - return GNUNET_OK; -} - -static void -handle_test (void *cls, - const struct GNUNET_TRANSPORT_TESTING_TestMessage *message) -{ - LOG (GNUNET_ERROR_TYPE_ERROR, - "message received\n"); -} - -static int -check_test2 (void *cls, - const struct GNUNET_TRANSPORT_TESTING_TestMessage *message) -{ - return GNUNET_OK; -} - -static void -handle_test2 (void *cls, - const struct GNUNET_TRANSPORT_TESTING_TestMessage *message) -{ - LOG (GNUNET_ERROR_TYPE_ERROR, - "message received\n"); -} - -static void -all_peers_started () -{ - are_all_peers_started = GNUNET_YES; - LOG (GNUNET_ERROR_TYPE_ERROR, - "setting are_all_peers_started: %d\n", - are_all_peers_started); -} - -static void -start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip, - char *node_ip, - char *m, - char *n, - char *local_m) -{ - char *testdir; - char *cfgname; - - GNUNET_asprintf (&cfgname, - "%s%s.conf", - "test_transport_api2_tcp_node", - n); - - LOG (GNUNET_ERROR_TYPE_ERROR, - "plugin cfgname: %s\n", - cfgname); - - LOG (GNUNET_ERROR_TYPE_ERROR, - "node ip: %s\n", - node_ip); - - testdir = GNUNET_malloc (strlen (BASE_DIR) + strlen (m) + strlen (n) - + 1); - - strcpy (testdir, BASE_DIR); - strcat (testdir, m); - strcat (testdir, n); - - struct GNUNET_MQ_MessageHandler handlers[] = { - GNUNET_MQ_hd_var_size (test, - GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE, - struct GNUNET_TRANSPORT_TESTING_TestMessage, - NULL), - GNUNET_MQ_hd_var_size (test2, - GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE2, - struct GNUNET_TRANSPORT_TESTING_TestMessage, - NULL), - GNUNET_MQ_handler_end () - }; - - struct GNUNET_TESTING_Command commands[] = { - GNUNET_TESTING_cmd_system_create ("system-create-1", - testdir), - GNUNET_TRANSPORT_cmd_start_peer ("start-peer-1", - "system-create-1", - m, - n, - local_m, - handlers, - cfgname), - GNUNET_TESTING_cmd_send_peer_ready ("send-peer-ready-1", - write_message), - GNUNET_TESTING_cmd_block_until_all_peers_started ("block-1", - &are_all_peers_started), - GNUNET_TRANSPORT_cmd_connect_peers ("connect-peers-1", - "start-peer-1", - "this is useless"), - GNUNET_TRANSPORT_cmd_send_simple ("send-simple-1", - m, - n, - (atoi (n) - 1) * atoi (local_m) + atoi ( - m), - "start-peer-1", - "this is useless"), - GNUNET_TESTING_cmd_local_test_finished ("local-test-finished-1", - write_message) - }; - - GNUNET_TESTING_run (NULL, - commands, - GNUNET_TIME_UNIT_FOREVER_REL); - -} - - -/** - * Entry point for the plugin. - * - * @param cls NULL - * @return the exported block API - */ -void * -libgnunet_plugin_cmd_simple_send_init (void *cls) -{ - struct GNUNET_TESTING_PluginFunctions *api; - - api = GNUNET_new (struct GNUNET_TESTING_PluginFunctions); - api->start_testcase = &start_testcase; - api->all_peers_started = &all_peers_started; - return api; -} - - -/** - * Exit point from the plugin. - * - * @param cls the return value from #libgnunet_plugin_block_test_init - * @return NULL - */ -void * -libgnunet_plugin_cmd_simple_send_done (void *cls) -{ - struct GNUNET_TESTING_PluginFunctions *api = cls; - - GNUNET_free (api); - return NULL; -} - - -/* end of plugin_cmd_simple_send.c */ diff --git a/src/transport/test_transport_api_cmd_simple_send.c b/src/transport/test_transport_api_cmd_simple_send.c index 1cc16f307..13497366e 100644 --- a/src/transport/test_transport_api_cmd_simple_send.c +++ b/src/transport/test_transport_api_cmd_simple_send.c @@ -25,7 +25,6 @@ */ #include "platform.h" #include "gnunet_testing_ng_lib.h" -#include "gnunet_testbed_ng_service.h" #include "gnunet_util_lib.h" #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 120) @@ -49,7 +48,7 @@ run (void *cls) GNUNET_TESTING_cmd_netjail_start_testing_system ("netjail-start-testbed-1", "2", "1", - "libgnunet_plugin_cmd_simple_send", + "libgnunet_test_transport_plugin_cmd_simple_send", &rv), GNUNET_TESTING_cmd_stop_testing_system ("stop-testbed", "netjail-start-testbed-1", diff --git a/src/transport/test_transport_plugin_cmd_simple_send.c b/src/transport/test_transport_plugin_cmd_simple_send.c new file mode 100644 index 000000000..c4f7fcfe3 --- /dev/null +++ b/src/transport/test_transport_plugin_cmd_simple_send.c @@ -0,0 +1,194 @@ +/* + This file is part of GNUnet + Copyright (C) 2021 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet 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 + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + + SPDX-License-Identifier: AGPL3.0-or-later + */ + +/** + * @file testbed/plugin_cmd_simple_send.c + * @brief a plugin to provide the API for running test cases. + * @author t3sserakt + */ +#include "platform.h" +#include "gnunet_testing_ng_lib.h" +#include "gnunet_util_lib.h" +#include "gnunet_transport_application_service.h" +#include "transport-testing2.h" +#include "transport-testing-cmds.h" + +/** + * Generic logging shortcut + */ +#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__) + +#define BASE_DIR "testdir" + +struct GNUNET_MQ_MessageHandler *handlers; + +unsigned int are_all_peers_started; + +static int +check_test (void *cls, + const struct GNUNET_TRANSPORT_TESTING_TestMessage *message) +{ + return GNUNET_OK; +} + +static void +handle_test (void *cls, + const struct GNUNET_TRANSPORT_TESTING_TestMessage *message) +{ + LOG (GNUNET_ERROR_TYPE_ERROR, + "message received\n"); +} + +static int +check_test2 (void *cls, + const struct GNUNET_TRANSPORT_TESTING_TestMessage *message) +{ + return GNUNET_OK; +} + +static void +handle_test2 (void *cls, + const struct GNUNET_TRANSPORT_TESTING_TestMessage *message) +{ + LOG (GNUNET_ERROR_TYPE_ERROR, + "message received\n"); +} + +static void +all_peers_started () +{ + are_all_peers_started = GNUNET_YES; + LOG (GNUNET_ERROR_TYPE_ERROR, + "setting are_all_peers_started: %d\n", + are_all_peers_started); +} + +static void +start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip, + char *node_ip, + char *m, + char *n, + char *local_m) +{ + char *testdir; + char *cfgname; + + GNUNET_asprintf (&cfgname, + "%s%s.conf", + "test_transport_api2_tcp_node", + n); + + LOG (GNUNET_ERROR_TYPE_ERROR, + "plugin cfgname: %s\n", + cfgname); + + LOG (GNUNET_ERROR_TYPE_ERROR, + "node ip: %s\n", + node_ip); + + testdir = GNUNET_malloc (strlen (BASE_DIR) + strlen (m) + strlen (n) + + 1); + + strcpy (testdir, BASE_DIR); + strcat (testdir, m); + strcat (testdir, n); + + struct GNUNET_MQ_MessageHandler handlers[] = { + GNUNET_MQ_hd_var_size (test, + GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE, + struct GNUNET_TRANSPORT_TESTING_TestMessage, + NULL), + GNUNET_MQ_hd_var_size (test2, + GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE2, + struct GNUNET_TRANSPORT_TESTING_TestMessage, + NULL), + GNUNET_MQ_handler_end () + }; + + struct GNUNET_TESTING_Command commands[] = { + GNUNET_TESTING_cmd_system_create ("system-create-1", + testdir), + GNUNET_TRANSPORT_cmd_start_peer ("start-peer-1", + "system-create-1", + m, + n, + local_m, + handlers, + cfgname), + GNUNET_TESTING_cmd_send_peer_ready ("send-peer-ready-1", + write_message), + GNUNET_TESTING_cmd_block_until_all_peers_started ("block-1", + &are_all_peers_started), + GNUNET_TRANSPORT_cmd_connect_peers ("connect-peers-1", + "start-peer-1", + "this is useless"), + GNUNET_TRANSPORT_cmd_send_simple ("send-simple-1", + m, + n, + (atoi (n) - 1) * atoi (local_m) + atoi ( + m), + "start-peer-1", + "this is useless"), + GNUNET_TESTING_cmd_local_test_finished ("local-test-finished-1", + write_message) + }; + + GNUNET_TESTING_run (NULL, + commands, + GNUNET_TIME_UNIT_FOREVER_REL); + +} + + +/** + * Entry point for the plugin. + * + * @param cls NULL + * @return the exported block API + */ +void * +libgnunet_test_transport_plugin_cmd_simple_send_init (void *cls) +{ + struct GNUNET_TESTING_PluginFunctions *api; + + api = GNUNET_new (struct GNUNET_TESTING_PluginFunctions); + api->start_testcase = &start_testcase; + api->all_peers_started = &all_peers_started; + return api; +} + + +/** + * Exit point from the plugin. + * + * @param cls the return value from #libgnunet_test_transport_plugin_block_test_init + * @return NULL + */ +void * +libgnunet_test_transport_plugin_cmd_simple_send_done (void *cls) +{ + struct GNUNET_TESTING_PluginFunctions *api = cls; + + GNUNET_free (api); + return NULL; +} + + +/* end of plugin_cmd_simple_send.c */ -- cgit v1.2.3 From 48b633f2a47f47200fb72cca8d84b1f0c2d44ee0 Mon Sep 17 00:00:00 2001 From: t3sserakt Date: Tue, 17 Aug 2021 20:37:50 +0200 Subject: - moved additional files from testbed to testing --- src/testbed/netjail_core.sh | 107 ------------------------------------------- src/testbed/netjail_exec.sh | 16 ------- src/testbed/netjail_start.sh | 52 --------------------- src/testbed/netjail_stop.sh | 26 ----------- src/testing/netjail_core.sh | 107 +++++++++++++++++++++++++++++++++++++++++++ src/testing/netjail_exec.sh | 2 +- src/testing/netjail_start.sh | 2 +- src/testing/netjail_stop.sh | 2 +- 8 files changed, 110 insertions(+), 204 deletions(-) delete mode 100755 src/testbed/netjail_core.sh delete mode 100755 src/testbed/netjail_exec.sh delete mode 100755 src/testbed/netjail_start.sh delete mode 100755 src/testbed/netjail_stop.sh create mode 100755 src/testing/netjail_core.sh (limited to 'src') diff --git a/src/testbed/netjail_core.sh b/src/testbed/netjail_core.sh deleted file mode 100755 index f49d4b312..000000000 --- a/src/testbed/netjail_core.sh +++ /dev/null @@ -1,107 +0,0 @@ -#!/bin/sh -# - -JAILOR=${SUDO_USER:?must run in sudo} - -# running with `sudo` is required to be -# able running the actual commands as the -# original user. - -export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" - -netjail_check() { - NODE_COUNT=$1 - - FD_COUNT=$(($(ls /proc/self/fd | wc -w) - 4)) - - # quit if `$FD_COUNT < ($LOCAL_M * $GLOBAL_N * 2)`: - # the script also requires `sudo -C ($FD_COUNT + 4)` - # so you need 'Defaults closefrom_override' in the - # sudoers file. - - if [ $FD_COUNT -lt $(($NODE_COUNT * 2)) ]; then - echo "File descriptors do not match requirements!" >&2 - exit 1 - fi -} - -netjail_print_name() { - printf "%s%02x%02x" $1 $2 ${3:-0} -} - -netjail_bridge() { - BRIDGE=$1 - - ip link add $BRIDGE type bridge - ip link set dev $BRIDGE up -} - -netjail_bridge_clear() { - BRIDGE=$1 - - ip link delete $BRIDGE -} - -netjail_node() { - NODE=$1 - - ip netns add $NODE -} - -netjail_node_clear() { - NODE=$1 - - ip netns delete $NODE -} - -netjail_node_link_bridge() { - NODE=$1 - BRIDGE=$2 - ADDRESS=$3 - MASK=$4 - - LINK_IF="$NODE-$BRIDGE-0" - LINK_BR="$NODE-$BRIDGE-1" - - ip link add $LINK_IF type veth peer name $LINK_BR - ip link set $LINK_IF netns $NODE - ip link set $LINK_BR master $BRIDGE - - ip -n $NODE addr add "$ADDRESS/$MASK" dev $LINK_IF - ip -n $NODE link set $LINK_IF up - ip -n $NODE link set up dev lo - - ip link set $LINK_BR up -} - -netjail_node_add_nat() { - NODE=$1 - ADDRESS=$2 - MASK=$3 - - ip netns exec $NODE iptables -t nat -A POSTROUTING -s "$ADDRESS/$MASK" -j MASQUERADE -} - -netjail_node_add_default() { - NODE=$1 - ADDRESS=$2 - - ip -n $NODE route add default via $ADDRESS -} - -netjail_node_exec() { - NODE=$1 - FD_IN=$2 - FD_OUT=$3 - shift 3 - - ip netns exec $NODE sudo -u $JAILOR -- $@ 1>& $FD_OUT 0<& $FD_IN -} - -netjail_node_exec_without_fds() { - NODE=$1 - shift 1 - - ip netns exec $NODE sudo -u $JAILOR -- $@ -} - diff --git a/src/testbed/netjail_exec.sh b/src/testbed/netjail_exec.sh deleted file mode 100755 index b76d2e444..000000000 --- a/src/testbed/netjail_exec.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -. "./../testbed/netjail_core.sh" - -set -eu -set -x - -export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" - -M=$1 -N=$2 - -NODE=$(netjail_print_name "N" $N $M) - - - -netjail_node_exec_without_fds $NODE $3 $4 $5 $1 $2 diff --git a/src/testbed/netjail_start.sh b/src/testbed/netjail_start.sh deleted file mode 100755 index 4c1c33c83..000000000 --- a/src/testbed/netjail_start.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh -. "./../testbed/netjail_core.sh" - -set -eu -set -x - -export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" - -LOCAL_M=$1 -GLOBAL_N=$2 - -# TODO: stunserver? ..and globally known peer? - -shift 2 - -LOCAL_GROUP="192.168.15" -GLOBAL_GROUP="92.68.150" - -NETWORK_NET=$(netjail_print_name "n" $GLOBAL_N $LOCAL_M) - -netjail_bridge $NETWORK_NET - -for N in $(seq $GLOBAL_N); do - ROUTER=$(netjail_print_name "R" $N) - - netjail_node $ROUTER - netjail_node_link_bridge $ROUTER $NETWORK_NET "$GLOBAL_GROUP.$N" 24 - - ROUTER_NET=$(netjail_print_name "r" $N) - - netjail_bridge $ROUTER_NET - - for M in $(seq $LOCAL_M); do - NODE=$(netjail_print_name "N" $N $M) - - netjail_node $NODE - netjail_node_link_bridge $NODE $ROUTER_NET "$LOCAL_GROUP.$M" 24 - done - - ROUTER_ADDR="$LOCAL_GROUP.$(($LOCAL_M+1))" - - netjail_node_link_bridge $ROUTER $ROUTER_NET $ROUTER_ADDR 24 - netjail_node_add_nat $ROUTER $ROUTER_ADDR 24 - - for M in $(seq $LOCAL_M); do - NODE=$(netjail_print_name "N" $N $M) - - netjail_node_add_default $NODE $ROUTER_ADDR - done -done - - diff --git a/src/testbed/netjail_stop.sh b/src/testbed/netjail_stop.sh deleted file mode 100755 index 689bf7ae9..000000000 --- a/src/testbed/netjail_stop.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -. "./../testbed/netjail_core.sh" - -set -eu -set -x - -export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" - -LOCAL_M=$1 -GLOBAL_N=$2 -NETWORK_NET=$(netjail_print_name "n" $GLOBAL_N $LOCAL_M) - -shift 2 - -for N in $(seq $GLOBAL_N); do - for M in $(seq $LOCAL_M); do - netjail_node_clear $(netjail_print_name "N" $N $M) - done - - netjail_bridge_clear $(netjail_print_name "r" $N) - netjail_node_clear $(netjail_print_name "R" $N) -done - -netjail_bridge_clear $NETWORK_NET - -echo "Done" diff --git a/src/testing/netjail_core.sh b/src/testing/netjail_core.sh new file mode 100755 index 000000000..f49d4b312 --- /dev/null +++ b/src/testing/netjail_core.sh @@ -0,0 +1,107 @@ +#!/bin/sh +# + +JAILOR=${SUDO_USER:?must run in sudo} + +# running with `sudo` is required to be +# able running the actual commands as the +# original user. + +export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + +netjail_check() { + NODE_COUNT=$1 + + FD_COUNT=$(($(ls /proc/self/fd | wc -w) - 4)) + + # quit if `$FD_COUNT < ($LOCAL_M * $GLOBAL_N * 2)`: + # the script also requires `sudo -C ($FD_COUNT + 4)` + # so you need 'Defaults closefrom_override' in the + # sudoers file. + + if [ $FD_COUNT -lt $(($NODE_COUNT * 2)) ]; then + echo "File descriptors do not match requirements!" >&2 + exit 1 + fi +} + +netjail_print_name() { + printf "%s%02x%02x" $1 $2 ${3:-0} +} + +netjail_bridge() { + BRIDGE=$1 + + ip link add $BRIDGE type bridge + ip link set dev $BRIDGE up +} + +netjail_bridge_clear() { + BRIDGE=$1 + + ip link delete $BRIDGE +} + +netjail_node() { + NODE=$1 + + ip netns add $NODE +} + +netjail_node_clear() { + NODE=$1 + + ip netns delete $NODE +} + +netjail_node_link_bridge() { + NODE=$1 + BRIDGE=$2 + ADDRESS=$3 + MASK=$4 + + LINK_IF="$NODE-$BRIDGE-0" + LINK_BR="$NODE-$BRIDGE-1" + + ip link add $LINK_IF type veth peer name $LINK_BR + ip link set $LINK_IF netns $NODE + ip link set $LINK_BR master $BRIDGE + + ip -n $NODE addr add "$ADDRESS/$MASK" dev $LINK_IF + ip -n $NODE link set $LINK_IF up + ip -n $NODE link set up dev lo + + ip link set $LINK_BR up +} + +netjail_node_add_nat() { + NODE=$1 + ADDRESS=$2 + MASK=$3 + + ip netns exec $NODE iptables -t nat -A POSTROUTING -s "$ADDRESS/$MASK" -j MASQUERADE +} + +netjail_node_add_default() { + NODE=$1 + ADDRESS=$2 + + ip -n $NODE route add default via $ADDRESS +} + +netjail_node_exec() { + NODE=$1 + FD_IN=$2 + FD_OUT=$3 + shift 3 + + ip netns exec $NODE sudo -u $JAILOR -- $@ 1>& $FD_OUT 0<& $FD_IN +} + +netjail_node_exec_without_fds() { + NODE=$1 + shift 1 + + ip netns exec $NODE sudo -u $JAILOR -- $@ +} + diff --git a/src/testing/netjail_exec.sh b/src/testing/netjail_exec.sh index b76d2e444..c20a8c117 100755 --- a/src/testing/netjail_exec.sh +++ b/src/testing/netjail_exec.sh @@ -1,5 +1,5 @@ #!/bin/sh -. "./../testbed/netjail_core.sh" +. "./../testing/netjail_core.sh" set -eu set -x diff --git a/src/testing/netjail_start.sh b/src/testing/netjail_start.sh index 4c1c33c83..0984a3c42 100755 --- a/src/testing/netjail_start.sh +++ b/src/testing/netjail_start.sh @@ -1,5 +1,5 @@ #!/bin/sh -. "./../testbed/netjail_core.sh" +. "./../testing/netjail_core.sh" set -eu set -x diff --git a/src/testing/netjail_stop.sh b/src/testing/netjail_stop.sh index 689bf7ae9..08f68cf7f 100755 --- a/src/testing/netjail_stop.sh +++ b/src/testing/netjail_stop.sh @@ -1,5 +1,5 @@ #!/bin/sh -. "./../testbed/netjail_core.sh" +. "./../testing/netjail_core.sh" set -eu set -x -- cgit v1.2.3 From 71a70133ad41085750ee1018fe026838d0aab5ac Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 18 Aug 2021 10:25:33 +0200 Subject: -swap WARNING/ERROR to fix #6991 --- src/pq/pq_connect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/pq/pq_connect.c b/src/pq/pq_connect.c index b06a591cf..275fd7450 100644 --- a/src/pq/pq_connect.c +++ b/src/pq/pq_connect.c @@ -348,7 +348,7 @@ GNUNET_PQ_reconnect (struct GNUNET_PQ_Context *db) 0); if (GNUNET_NO == ret) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Failed to find SQL file to load database versioning logic\n"); PQfinish (db->conn); db->conn = NULL; -- cgit v1.2.3 From 69406e8930cccd2dcd32fa7067abb6937788bba7 Mon Sep 17 00:00:00 2001 From: t3sserakt Date: Wed, 18 Aug 2021 22:05:53 +0200 Subject: - fixed copyright year --- src/testing/gnunet-cmds-helper.c | 2 +- src/testing/test_testing_plugin_testcmd.c | 2 +- src/transport/transport-testing-cmds.h | 13 +++++++------ 3 files changed, 9 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/testing/gnunet-cmds-helper.c b/src/testing/gnunet-cmds-helper.c index d9fcf3541..5705f46c2 100644 --- a/src/testing/gnunet-cmds-helper.c +++ b/src/testing/gnunet-cmds-helper.c @@ -1,6 +1,6 @@ /* This file is part of GNUnet - Copyright (C) 2008--2013, 2016 GNUnet e.V. + Copyright (C) 2021 GNUnet e.V. GNUnet is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published diff --git a/src/testing/test_testing_plugin_testcmd.c b/src/testing/test_testing_plugin_testcmd.c index aeb0db5dc..444272fcd 100644 --- a/src/testing/test_testing_plugin_testcmd.c +++ b/src/testing/test_testing_plugin_testcmd.c @@ -1,6 +1,6 @@ /* This file is part of GNUnet - Copyright (C) 2013, 2014 GNUnet e.V. + Copyright (C) 2021 GNUnet e.V. GNUnet is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published diff --git a/src/transport/transport-testing-cmds.h b/src/transport/transport-testing-cmds.h index f171f833f..ece3b09a2 100644 --- a/src/transport/transport-testing-cmds.h +++ b/src/transport/transport-testing-cmds.h @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - Copyright (C) 2006, 2009, 2015, 2016 GNUnet e.V. + Copyright (C) 2021 GNUnet e.V. GNUnet is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published @@ -44,10 +44,10 @@ GNUNET_TRANSPORT_cmd_connect_peers (const char *label, struct GNUNET_TESTING_Command GNUNET_TRANSPORT_cmd_send_simple (const char *label, - char *m, - char *n, - uint32_t num, - const char *peer1_label, + char *m, + char *n, + uint32_t num, + const char *peer1_label, const char *peer2_label); int @@ -60,7 +60,8 @@ GNUNET_TRANSPORT_get_trait_connected_peers_map (const struct GNUNET_TESTING_Command *cmd, struct - GNUNET_CONTAINER_MultiShortmap ** + GNUNET_CONTAINER_MultiShortmap * + * connected_peers_map); int GNUNET_TRANSPORT_get_trait_hello_size (const struct -- cgit v1.2.3 From 9ef7f0704fa0458f2e27ba188aec5102dbb780b2 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 22 Aug 2021 11:44:22 +0200 Subject: -prepend X to ensure identifiers do not start with a number --- src/pq/pq_event.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/pq/pq_event.c b/src/pq/pq_event.c index e6c2d07fd..2890869a3 100644 --- a/src/pq/pq_event.c +++ b/src/pq/pq_event.c @@ -388,7 +388,7 @@ register_notify (void *cls, struct GNUNET_DB_EventHandler *eh = value; manage_subscribe (db, - "LISTEN ", + "LISTEN X", eh); return GNUNET_OK; } @@ -440,7 +440,7 @@ GNUNET_PQ_event_listen (struct GNUNET_PQ_Context *db, fd); } manage_subscribe (db, - "LISTEN ", + "LISTEN X", eh); GNUNET_assert (0 == pthread_mutex_unlock (&db->notify_lock)); @@ -461,7 +461,7 @@ GNUNET_PQ_event_listen_cancel (struct GNUNET_DB_EventHandler *eh) eh)); manage_subscribe (db, - "UNLISTEN ", + "UNLISTEN X", eh); if ( (NULL != db->sc) && (0 == GNUNET_CONTAINER_multishortmap_size (db->channel_map)) ) @@ -486,7 +486,7 @@ GNUNET_PQ_event_notify (struct GNUNET_PQ_Context *db, PGresult *result; end = stpcpy (sql, - "NOTIFY "); + "NOTIFY X"); end = es_to_channel (es, end); end = stpcpy (end, -- cgit v1.2.3 From ea901fb4978ee7e9cfd2f74c810f2146bdf9d46b Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 22 Aug 2021 23:59:54 +0200 Subject: -simplify libgnunetpq to only support single-threaded applications that do use the scheudler (when using event API) --- src/include/gnunet_pq_lib.h | 49 +-------------- src/pq/pq.h | 40 ++++++------ src/pq/pq_connect.c | 17 ++---- src/pq/pq_event.c | 145 ++++++++++++++++++++------------------------ src/pq/test_pq.c | 64 +------------------ src/util/os_priority.c | 4 +- 6 files changed, 101 insertions(+), 218 deletions(-) (limited to 'src') diff --git a/src/include/gnunet_pq_lib.h b/src/include/gnunet_pq_lib.h index ecc2b9719..ff4498938 100644 --- a/src/include/gnunet_pq_lib.h +++ b/src/include/gnunet_pq_lib.h @@ -852,33 +852,6 @@ void GNUNET_PQ_reconnect (struct GNUNET_PQ_Context *db); -/** - * Function called whenever the socket needed for - * notifications from postgres changes. - * - * @param cls closure - * @param fd socket to listen on, -1 for none - */ -typedef void -(*GNUNET_PQ_SocketCallback)(void *cls, - int fd); - - -/** - * Obtain the file descriptor to poll on for notifications. - * Useful if the GNUnet scheduler is NOT to be used for - * such notifications. - * - * @param db database handle - * @param sc function to call with the socket - * @param sc_cls closure for @a sc - */ -void -GNUNET_PQ_event_set_socket_callback (struct GNUNET_PQ_Context *db, - GNUNET_PQ_SocketCallback sc, - void *sc_cls); - - /** * Poll for database events now. Used if the event FD * is ready and the application wants to trigger applicable @@ -892,24 +865,6 @@ void GNUNET_PQ_event_do_poll (struct GNUNET_PQ_Context *db); -/** - * Run poll event loop using the GNUnet scheduler. - * - * @param db database handle - */ -void -GNUNET_PQ_event_scheduler_start (struct GNUNET_PQ_Context *db); - - -/** - * Stop running poll event loop using the GNUnet scheduler. - * - * @param db database handle - */ -void -GNUNET_PQ_event_scheduler_stop (struct GNUNET_PQ_Context *db); - - /** * Register callback to be invoked on events of type @a es. * @@ -921,14 +876,16 @@ GNUNET_PQ_event_scheduler_stop (struct GNUNET_PQ_Context *db); * * @param db database context to use * @param es specification of the event to listen for + * @param timeout when to trigger @a cb based on timeout * @param cb function to call when the event happens, possibly - * multiple times (until #GNUNET_PQ_event_listen_cancel() is invoked) + * multiple times (until #GNUNET_PQ_event_listen_cancel() is invoked), including on timeout * @param cb_cls closure for @a cb * @return handle useful to cancel the listener */ struct GNUNET_DB_EventHandler * GNUNET_PQ_event_listen (struct GNUNET_PQ_Context *db, const struct GNUNET_DB_EventHeaderP *es, + struct GNUNET_TIME_Relative timeout, GNUNET_DB_EventCallback cb, void *cb_cls); diff --git a/src/pq/pq.h b/src/pq/pq.h index 107fd116c..950d38220 100644 --- a/src/pq/pq.h +++ b/src/pq/pq.h @@ -28,6 +28,7 @@ #include "gnunet_util_lib.h" #include "gnunet_pq_lib.h" + /** * Handle to Postgres database. */ @@ -58,26 +59,11 @@ struct GNUNET_PQ_Context */ char *load_path; - /** - * Function to call on Postgres FDs. - */ - GNUNET_PQ_SocketCallback sc; - - /** - * Closure for @e sc. - */ - void *sc_cls; - /** * Map managing event subscriptions. */ struct GNUNET_CONTAINER_MultiShortmap *channel_map; - /** - * Lock to access @e channel_map. - */ - pthread_mutex_t notify_lock; - /** * Task responsible for processing events. */ @@ -87,7 +73,7 @@ struct GNUNET_PQ_Context * File descriptor wrapper for @e event_task. */ struct GNUNET_NETWORK_Handle *rfd; - + /** * Is scheduling via the GNUnet scheduler desired? */ @@ -100,9 +86,29 @@ struct GNUNET_PQ_Context * after a disconnect. * * @param db the DB handle + * @param fd socket to listen on + */ +void +GNUNET_PQ_event_reconnect_ (struct GNUNET_PQ_Context *db, + int fd); + + +/** + * Run poll event loop using the GNUnet scheduler. + * + * @param db database handle + */ +void +GNUNET_PQ_event_scheduler_start_ (struct GNUNET_PQ_Context *db); + + +/** + * Stop running poll event loop using the GNUnet scheduler. + * + * @param db database handle */ void -GNUNET_PQ_event_reconnect_ (struct GNUNET_PQ_Context *db); +GNUNET_PQ_event_scheduler_stop_ (struct GNUNET_PQ_Context *db); #endif diff --git a/src/pq/pq_connect.c b/src/pq/pq_connect.c index 275fd7450..05e787939 100644 --- a/src/pq/pq_connect.c +++ b/src/pq/pq_connect.c @@ -103,9 +103,6 @@ GNUNET_PQ_connect (const char *config_str, } db->channel_map = GNUNET_CONTAINER_multishortmap_create (16, GNUNET_YES); - GNUNET_assert (0 == - pthread_mutex_init (&db->notify_lock, - NULL)); GNUNET_PQ_reconnect (db); if (NULL == db->conn) { @@ -294,9 +291,8 @@ GNUNET_PQ_reconnect_if_down (struct GNUNET_PQ_Context *db) void GNUNET_PQ_reconnect (struct GNUNET_PQ_Context *db) { - if (NULL != db->sc) - db->sc (db->sc_cls, - -1); + GNUNET_PQ_event_reconnect_ (db, + -1); if (NULL != db->conn) PQfinish (db->conn); db->conn = PQconnectdb (db->config_str); @@ -416,11 +412,8 @@ GNUNET_PQ_reconnect (struct GNUNET_PQ_Context *db) db->conn = NULL; return; } - GNUNET_PQ_event_reconnect_ (db); - if ( (NULL != db->sc) && - (0 != GNUNET_CONTAINER_multishortmap_size (db->channel_map)) ) - db->sc (db->sc_cls, - PQsocket (db->conn)); + GNUNET_PQ_event_reconnect_ (db, + PQsocket (db->conn)); } @@ -473,8 +466,6 @@ GNUNET_PQ_disconnect (struct GNUNET_PQ_Context *db) GNUNET_assert (0 == GNUNET_CONTAINER_multishortmap_size (db->channel_map)); GNUNET_CONTAINER_multishortmap_destroy (db->channel_map); - GNUNET_assert (0 == - pthread_mutex_destroy (&db->notify_lock)); GNUNET_free (db->es); GNUNET_free (db->ps); GNUNET_free (db->load_path); diff --git a/src/pq/pq_event.c b/src/pq/pq_event.c index 2890869a3..3a0bfcde3 100644 --- a/src/pq/pq_event.c +++ b/src/pq/pq_event.c @@ -51,6 +51,11 @@ struct GNUNET_DB_EventHandler * Database context this event handler is with. */ struct GNUNET_PQ_Context *db; + + /** + * Task to run on timeout. + */ + struct GNUNET_SCHEDULER_Task *timeout_task; }; @@ -162,36 +167,11 @@ do_notify (void *cls, } -void -GNUNET_PQ_event_set_socket_callback (struct GNUNET_PQ_Context *db, - GNUNET_PQ_SocketCallback sc, - void *sc_cls) -{ - int fd; - - db->sc = sc; - db->sc_cls = sc_cls; - if (NULL == sc) - return; - GNUNET_assert (0 == - pthread_mutex_lock (&db->notify_lock)); - fd = PQsocket (db->conn); - if ( (-1 != fd) && - (0 != GNUNET_CONTAINER_multishortmap_size (db->channel_map)) ) - sc (sc_cls, - fd); - GNUNET_assert (0 == - pthread_mutex_unlock (&db->notify_lock)); -} - - void GNUNET_PQ_event_do_poll (struct GNUNET_PQ_Context *db) { PGnotify *n; - GNUNET_assert (0 == - pthread_mutex_lock (&db->notify_lock)); if (1 != PQconsumeInput (db->conn)) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -204,9 +184,17 @@ GNUNET_PQ_event_do_poll (struct GNUNET_PQ_Context *db) .extra = NULL }; + if ('X' != toupper ((int) n->relname[0])) + { + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Ignoring notification for unsupported channel identifier `%s'\n", + n->relname); + PQfreemem (n); + continue; + } if (GNUNET_OK != - GNUNET_STRINGS_string_to_data (n->relname, - strlen (n->relname), + GNUNET_STRINGS_string_to_data (&n->relname[1], + strlen (&n->relname[1]), &sh, sizeof (sh))) { @@ -236,23 +224,9 @@ GNUNET_PQ_event_do_poll (struct GNUNET_PQ_Context *db) GNUNET_free (ctx.extra); PQfreemem (n); } - GNUNET_assert (0 == - pthread_mutex_unlock (&db->notify_lock)); } -/** - * Function called when the Postgres FD changes and we need - * to update the scheduler event loop task. - * - * @param cls a `struct GNUNET_PQ_Context *` - * @param fd the file descriptor, possibly -1 - */ -static void -scheduler_fd_cb (void *cls, - int fd); - - /** * The GNUnet scheduler notifies us that we need to * trigger the DB event poller. @@ -308,27 +282,21 @@ scheduler_fd_cb (void *cls, void -GNUNET_PQ_event_scheduler_start (struct GNUNET_PQ_Context *db) +GNUNET_PQ_event_scheduler_start_ (struct GNUNET_PQ_Context *db) { - int fd; - - GNUNET_assert (! db->scheduler_on); - GNUNET_assert (NULL == db->sc); + if (db->scheduler_on) + return; db->scheduler_on = true; - db->sc = &scheduler_fd_cb; - db->sc_cls = db; - fd = PQsocket (db->conn); scheduler_fd_cb (db, - fd); + PQsocket (db->conn)); } void -GNUNET_PQ_event_scheduler_stop (struct GNUNET_PQ_Context *db) +GNUNET_PQ_event_scheduler_stop_ (struct GNUNET_PQ_Context *db) { GNUNET_assert (db->scheduler_on); GNUNET_free (db->rfd); - db->sc = NULL; db->scheduler_on = false; if (NULL != db->event_task) { @@ -338,6 +306,13 @@ GNUNET_PQ_event_scheduler_stop (struct GNUNET_PQ_Context *db) } +/** + * Helper function to trigger an SQL @a cmd on @a db + * + * @param db database to send command to + * @param cmd prefix of the command to send + * @param eh details about the event + */ static void manage_subscribe (struct GNUNET_PQ_Context *db, const char *cmd, @@ -351,6 +326,9 @@ manage_subscribe (struct GNUNET_PQ_Context *db, cmd); end = sh_to_channel (&eh->sh, end); + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Executing PQ command `%s'\n", + sql); result = PQexec (db->conn, sql); if (PGRES_COMMAND_OK != PQresultStatus (result)) @@ -395,21 +373,41 @@ register_notify (void *cls, void -GNUNET_PQ_event_reconnect_ (struct GNUNET_PQ_Context *db) +GNUNET_PQ_event_reconnect_ (struct GNUNET_PQ_Context *db, + int fd) { - GNUNET_assert (0 == - pthread_mutex_lock (&db->notify_lock)); + if (! db->scheduler_on) + return; + scheduler_fd_cb (db, + fd); GNUNET_CONTAINER_multishortmap_iterate (db->channel_map, ®ister_notify, db); - GNUNET_assert (0 == - pthread_mutex_unlock (&db->notify_lock)); +} + + +/** + * Function run on timeout for an event. Triggers + * the notification, but does NOT clear the handler. + * + * @param cls a `struct GNUNET_DB_EventHandler *` + */ +static void +event_timeout (void *cls) +{ + struct GNUNET_DB_EventHandler *eh = cls; + + eh->timeout_task = NULL; + eh->cb (eh->cb_cls, + NULL, + 0); } struct GNUNET_DB_EventHandler * GNUNET_PQ_event_listen (struct GNUNET_PQ_Context *db, const struct GNUNET_DB_EventHeaderP *es, + struct GNUNET_TIME_Relative timeout, GNUNET_DB_EventCallback cb, void *cb_cls) { @@ -422,28 +420,20 @@ GNUNET_PQ_event_listen (struct GNUNET_PQ_Context *db, &eh->sh); eh->cb = cb; eh->cb_cls = cb_cls; - GNUNET_assert (0 == - pthread_mutex_lock (&db->notify_lock)); was_zero = (0 == GNUNET_CONTAINER_multishortmap_size (db->channel_map)); GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multishortmap_put (db->channel_map, &eh->sh, eh, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); - if ( (NULL != db->sc) && - was_zero) - { - int fd = PQsocket (db->conn); - - if (-1 != fd) - db->sc (db->sc_cls, - fd); - } + if (was_zero) + GNUNET_PQ_event_scheduler_start_ (db); manage_subscribe (db, "LISTEN X", eh); - GNUNET_assert (0 == - pthread_mutex_unlock (&db->notify_lock)); + eh->timeout_task = GNUNET_SCHEDULER_add_delayed (timeout, + &event_timeout, + eh); return eh; } @@ -453,8 +443,6 @@ GNUNET_PQ_event_listen_cancel (struct GNUNET_DB_EventHandler *eh) { struct GNUNET_PQ_Context *db = eh->db; - GNUNET_assert (0 == - pthread_mutex_lock (&db->notify_lock)); GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multishortmap_remove (db->channel_map, &eh->sh, @@ -463,14 +451,15 @@ GNUNET_PQ_event_listen_cancel (struct GNUNET_DB_EventHandler *eh) manage_subscribe (db, "UNLISTEN X", eh); - if ( (NULL != db->sc) && - (0 == GNUNET_CONTAINER_multishortmap_size (db->channel_map)) ) + if (0 == GNUNET_CONTAINER_multishortmap_size (db->channel_map)) + { + GNUNET_PQ_event_scheduler_stop_ (db); + } + if (NULL != eh->timeout_task) { - db->sc (db->sc_cls, - -1); + GNUNET_SCHEDULER_cancel (eh->timeout_task); + eh->timeout_task = NULL; } - GNUNET_assert (0 == - pthread_mutex_unlock (&db->notify_lock)); GNUNET_free (eh); } diff --git a/src/pq/test_pq.c b/src/pq/test_pq.c index ffbb4d129..90b5c6489 100644 --- a/src/pq/test_pq.c +++ b/src/pq/test_pq.c @@ -240,63 +240,6 @@ run_queries (struct GNUNET_PQ_Context *db) } -static void -event_cb (void *cls, - const void *extra, - size_t extra_size) -{ - unsigned int *cnt = cls; - - GNUNET_assert (5 == extra_size); - GNUNET_assert (0 == memcmp ("world", - extra, - 5)); - (*cnt)++; -} - - -/** - * Run subscribe/notify tests. - * - * @param db database handle - * @return 0 on success - */ -static int -test_notify (struct GNUNET_PQ_Context *db) -{ - struct GNUNET_DB_EventHeaderP e1 = { - .size = htons (sizeof (e1)), - .type = htons (1) - }; - struct GNUNET_DB_EventHeaderP e2 = { - .size = htons (sizeof (e2)), - .type = htons (2) - }; - unsigned int called = 0; - struct GNUNET_DB_EventHandler *eh; - - eh = GNUNET_PQ_event_listen (db, - &e1, - &event_cb, - &called); - GNUNET_assert (NULL != eh); - GNUNET_PQ_event_notify (db, - &e2, - "hello", - 5); - GNUNET_PQ_event_do_poll (db); - GNUNET_assert (0 == called); - GNUNET_PQ_event_notify (db, - &e1, - "world", - 5); - GNUNET_PQ_event_do_poll (db); - GNUNET_assert (1 == called); - GNUNET_PQ_event_listen_cancel (eh); - return 0; -} - - /** * Task called on shutdown. * @@ -305,7 +248,6 @@ test_notify (struct GNUNET_PQ_Context *db) static void event_end (void *cls) { - GNUNET_PQ_event_scheduler_stop (db); GNUNET_PQ_event_listen_cancel (eh); eh = NULL; if (NULL != tt) @@ -368,9 +310,9 @@ sched_tests (void *cls) tt = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &timeout_cb, NULL); - GNUNET_PQ_event_scheduler_start (db); eh = GNUNET_PQ_event_listen (db, &es, + GNUNET_TIME_UNIT_FOREVER_REL, &event_sched_cb, NULL); GNUNET_PQ_reconnect (db); @@ -404,7 +346,7 @@ main (int argc, }; GNUNET_log_setup ("test-pq", - "WARNING", + "INFO", NULL); db = GNUNET_PQ_connect ("postgres:///gnunetcheck", NULL, @@ -433,8 +375,6 @@ main (int argc, return 1; } ret = run_queries (db); - ret |= test_notify (db); - ret |= test_notify (db); if (0 != ret) { GNUNET_break (0); diff --git a/src/util/os_priority.c b/src/util/os_priority.c index dc2f0f97e..08320b291 100644 --- a/src/util/os_priority.c +++ b/src/util/os_priority.c @@ -47,7 +47,6 @@ struct GNUNET_OS_Process */ pid_t pid; - /** * Pipe we use to signal the process. * NULL if unused, or if process was deemed uncontrollable. @@ -301,7 +300,8 @@ GNUNET_OS_process_destroy (struct GNUNET_OS_Process *proc) * @param flags open flags (O_RDONLY, O_WRONLY) */ static void -open_dev_null (int target_fd, int flags) +open_dev_null (int target_fd, + int flags) { int fd; -- cgit v1.2.3 From 9ad1a017071f553b287e0aec37e913e954208ae6 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 23 Aug 2021 06:54:23 +0200 Subject: -remove dead flag --- src/pq/Makefile.am | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/pq/Makefile.am b/src/pq/Makefile.am index 0febac4ac..cbb123cbb 100644 --- a/src/pq/Makefile.am +++ b/src/pq/Makefile.am @@ -24,7 +24,6 @@ libgnunetpq_la_LIBADD = -lpq \ libgnunetpq_la_LDFLAGS = \ $(POSTGRESQL_LDFLAGS) \ $(GN_LIB_LDFLAGS) \ - -lpthread \ -version-info 1:0:0 if ENABLE_TEST_RUN -- cgit v1.2.3 From 987846582ed27dc699f0f0c4143010ffd2c19329 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 23 Aug 2021 07:37:40 +0200 Subject: -fix indentation --- src/util/network.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/util/network.c b/src/util/network.c index 61da37ab7..014701e02 100644 --- a/src/util/network.c +++ b/src/util/network.c @@ -506,15 +506,15 @@ GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc, #endif if (AF_UNIX == address->sa_family) GNUNET_NETWORK_unix_precheck ((const struct sockaddr_un *) address); + { const int on = 1; - /* This is required here for TCP sockets, but only on UNIX */ - if ((SOCK_STREAM == desc->type) && - (0 != setsockopt (desc->fd, - SOL_SOCKET, - SO_REUSEADDR, - &on, sizeof(on)))) + if ( (SOCK_STREAM == desc->type) && + (0 != setsockopt (desc->fd, + SOL_SOCKET, + SO_REUSEADDR, + &on, sizeof(on))) ) LOG_STRERROR (GNUNET_ERROR_TYPE_DEBUG, "setsockopt"); } @@ -883,15 +883,13 @@ GNUNET_NETWORK_socket_setsockopt (struct GNUNET_NETWORK_Handle *fd, const void *option_value, socklen_t option_len) { - int ret; - - ret = setsockopt (fd->fd, - level, - option_name, - option_value, - option_len); - - return ret == 0 ? GNUNET_OK : GNUNET_SYSERR; + return (0 == setsockopt (fd->fd, + level, + option_name, + option_value, + option_len)) + ? GNUNET_OK + : GNUNET_SYSERR; } -- cgit v1.2.3 From 00cbe1e8e09fc2ef567f59de5b4dc14c0562c35f Mon Sep 17 00:00:00 2001 From: t3sserakt Date: Tue, 24 Aug 2021 10:57:03 +0200 Subject: - added cmds to stop a peer and remove a test environment, used in simple send test case plugin --- src/testing/Makefile.am | 1 + src/testing/testing_api_cmd_system_destroy.c | 122 +++++++++++++++ src/transport/Makefile.am | 2 + .../test_transport_plugin_cmd_simple_send.c | 99 ++++++++++--- src/transport/transport_api_cmd_stop_peer.c | 163 +++++++++++++++++++++ 5 files changed, 368 insertions(+), 19 deletions(-) create mode 100644 src/testing/testing_api_cmd_system_destroy.c create mode 100644 src/transport/transport_api_cmd_stop_peer.c (limited to 'src') diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am index 15469a310..c01e9bdbd 100644 --- a/src/testing/Makefile.am +++ b/src/testing/Makefile.am @@ -50,6 +50,7 @@ libgnunettesting_la_SOURCES = \ testing_api_cmd_netjail_stop.c \ testing.c testing.h \ testing_api_cmd_system_create.c \ + testing_api_cmd_system_destroy.c \ testing_api_cmd_batch.c \ testing_api_cmd_hello_world.c \ testing_api_cmd_hello_world_birth.c \ diff --git a/src/testing/testing_api_cmd_system_destroy.c b/src/testing/testing_api_cmd_system_destroy.c new file mode 100644 index 000000000..e94d8dad0 --- /dev/null +++ b/src/testing/testing_api_cmd_system_destroy.c @@ -0,0 +1,122 @@ +/* + This file is part of GNUnet + Copyright (C) 2021 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet 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 + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + + SPDX-License-Identifier: AGPL3.0-or-later + */ + +/** + * @file testing_api_cmd_system_destroy.c + * @brief cmd to destroy a testing system handle. + * @author t3sserakt + */ +#include "platform.h" +#include "gnunet_util_lib.h" +#include "gnunet_testing_ng_lib.h" +#include "gnunet_testing_lib.h" + + +/** + * Struct to hold information for callbacks. + * + */ +struct TestSystemState +{ + // Label of the cmd which started the test system. + const char *create_label; +}; + + +/** + * The run method of this cmd will remove the test environment for a node. + * + */ +static void +system_destroy_run (void *cls, + const struct GNUNET_TESTING_Command *cmd, + struct GNUNET_TESTING_Interpreter *is) +{ + struct TestSystemState *tss = cls; + const struct GNUNET_TESTING_Command *system_cmd; + struct GNUNET_TESTING_System *tl_system; + + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "system destroy\n"); + + system_cmd = GNUNET_TESTING_interpreter_lookup_command (tss->create_label); + GNUNET_TESTING_get_trait_test_system (system_cmd, + &tl_system); + GNUNET_TESTING_system_destroy (tl_system, GNUNET_YES); + + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "system destroyed\n"); +} + + +/** + * The cleanup function of this cmd frees resources the cmd allocated. + * + */ +static void +system_destroy_cleanup (void *cls, + const struct GNUNET_TESTING_Command *cmd) +{ + struct TestSystemState *tss = cls; + + GNUNET_free (tss); +} + + +/** + * Trait function of this cmd does nothing. + * + */ +static int +system_destroy_traits (void *cls, + const void **ret, + const char *trait, + unsigned int index) +{ + return GNUNET_OK; +} + + +/** + * Create command. + * + * @param label name for command. + * @param create_label Label of the cmd which started the test system. + * @return command. + */ +struct GNUNET_TESTING_Command +GNUNET_TESTING_cmd_system_destroy (const char *label, + const char *create_label) +{ + struct TestSystemState *tss; + + tss = GNUNET_new (struct TestSystemState); + tss->create_label = create_label; + + struct GNUNET_TESTING_Command cmd = { + .cls = tss, + .label = label, + .run = &system_destroy_run, + .cleanup = &system_destroy_cleanup, + .traits = &system_destroy_traits + }; + + return cmd; +} diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am index 0696188c5..afa37bac5 100644 --- a/src/transport/Makefile.am +++ b/src/transport/Makefile.am @@ -169,8 +169,10 @@ libgnunettransporttesting_la_LDFLAGS = \ libgnunettransporttesting2_la_SOURCES = \ transport_api_cmd_connecting_peers.c \ transport_api_cmd_start_peer.c \ + transport_api_cmd_stop_peer.c \ transport_api_cmd_send_simple.c \ transport-testing2.c transport-testing2.h \ + transport-testing-ng.h \ transport-testing-cmds.h \ transport-testing-filenames2.c \ transport-testing-loggers2.c \ diff --git a/src/transport/test_transport_plugin_cmd_simple_send.c b/src/transport/test_transport_plugin_cmd_simple_send.c index c4f7fcfe3..ac5c01075 100644 --- a/src/transport/test_transport_plugin_cmd_simple_send.c +++ b/src/transport/test_transport_plugin_cmd_simple_send.c @@ -37,10 +37,30 @@ #define BASE_DIR "testdir" -struct GNUNET_MQ_MessageHandler *handlers; +/** + * The name for a specific test environment directory. + * + */ +char *testdir; +/** + * The name for the configuration file of the specific node. + * + */ +char *cfgname; + +/** + * Flag indicating if all peers have been started. + * + */ unsigned int are_all_peers_started; + +/** + * Function called to check a message of type GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE being + * received. + * + */ static int check_test (void *cls, const struct GNUNET_TRANSPORT_TESTING_TestMessage *message) @@ -48,6 +68,12 @@ check_test (void *cls, return GNUNET_OK; } + +/** + * Function called to handle a message of type GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE + * being received. + * + */ static void handle_test (void *cls, const struct GNUNET_TRANSPORT_TESTING_TestMessage *message) @@ -56,6 +82,12 @@ handle_test (void *cls, "message received\n"); } + +/** + * Function called to check a message of type GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE2 + * being received. + * + */ static int check_test2 (void *cls, const struct GNUNET_TRANSPORT_TESTING_TestMessage *message) @@ -63,6 +95,12 @@ check_test2 (void *cls, return GNUNET_OK; } + +/** + * Function called to handle a message of type GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE2 + * being received. + * + */ static void handle_test2 (void *cls, const struct GNUNET_TRANSPORT_TESTING_TestMessage *message) @@ -71,6 +109,11 @@ handle_test2 (void *cls, "message received\n"); } + +/** + * Callback to set the flag indicating all peers started. Will be called via the plugin api. + * + */ static void all_peers_started () { @@ -80,6 +123,17 @@ all_peers_started () are_all_peers_started); } + +/** + * Function to start a local test case. + * + * @param write_message Callback to send a message to the master loop. + * @param router_ip Global address of the network namespace. + * @param node_ip Local address of a node i a network namespace. + * @param m The number of the node in a network namespace. + * @param n The number of the network namespace. + * @param local_m The number of nodes in a network namespace. + */ static void start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip, char *node_ip, @@ -87,12 +141,9 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip, char *n, char *local_m) { - char *testdir; - char *cfgname; GNUNET_asprintf (&cfgname, - "%s%s.conf", - "test_transport_api2_tcp_node", + "test_transport_api2_tcp_node%s.conf", n); LOG (GNUNET_ERROR_TYPE_ERROR, @@ -103,12 +154,18 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip, "node ip: %s\n", node_ip); - testdir = GNUNET_malloc (strlen (BASE_DIR) + strlen (m) + strlen (n) + GNUNET_asprintf (&testdir, + "%s%s%s", + BASE_DIR, + m, + n); + + /*testdir = GNUNET_malloc (strlen (BASE_DIR) + strlen (m) + strlen (n) + 1); strcpy (testdir, BASE_DIR); strcat (testdir, m); - strcat (testdir, n); + strcat (testdir, n);*/ struct GNUNET_MQ_MessageHandler handlers[] = { GNUNET_MQ_hd_var_size (test, @@ -123,30 +180,32 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip, }; struct GNUNET_TESTING_Command commands[] = { - GNUNET_TESTING_cmd_system_create ("system-create-1", + GNUNET_TESTING_cmd_system_create ("system-create", testdir), - GNUNET_TRANSPORT_cmd_start_peer ("start-peer-1", - "system-create-1", + GNUNET_TRANSPORT_cmd_start_peer ("start-peer", + "system-create", m, n, local_m, handlers, cfgname), - GNUNET_TESTING_cmd_send_peer_ready ("send-peer-ready-1", + GNUNET_TESTING_cmd_send_peer_ready ("send-peer-ready", write_message), - GNUNET_TESTING_cmd_block_until_all_peers_started ("block-1", + GNUNET_TESTING_cmd_block_until_all_peers_started ("block", &are_all_peers_started), - GNUNET_TRANSPORT_cmd_connect_peers ("connect-peers-1", - "start-peer-1", - "this is useless"), - GNUNET_TRANSPORT_cmd_send_simple ("send-simple-1", + GNUNET_TRANSPORT_cmd_connect_peers ("connect-peers", + "start-peer"), + GNUNET_TRANSPORT_cmd_send_simple ("send-simple", m, n, (atoi (n) - 1) * atoi (local_m) + atoi ( m), - "start-peer-1", - "this is useless"), - GNUNET_TESTING_cmd_local_test_finished ("local-test-finished-1", + "start-peer"), + GNUNET_TRANSPORT_cmd_stop_peer ("stop-peer", + "start-peer"), + GNUNET_TESTING_cmd_system_destroy ("system-destroy", + "system-create"), + GNUNET_TESTING_cmd_local_test_finished ("local-test-finished", write_message) }; @@ -187,6 +246,8 @@ libgnunet_test_transport_plugin_cmd_simple_send_done (void *cls) struct GNUNET_TESTING_PluginFunctions *api = cls; GNUNET_free (api); + GNUNET_free (testdir); + GNUNET_free (cfgname); return NULL; } diff --git a/src/transport/transport_api_cmd_stop_peer.c b/src/transport/transport_api_cmd_stop_peer.c new file mode 100644 index 000000000..2277520ec --- /dev/null +++ b/src/transport/transport_api_cmd_stop_peer.c @@ -0,0 +1,163 @@ +/* + This file is part of GNUnet + Copyright (C) 2021 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet 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 + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + + SPDX-License-Identifier: AGPL3.0-or-later + */ + +/** + * @file testing_api_cmd_stop_peer.c + * @brief cmd to stop a peer. + * @author t3sserakt + */ +#include "platform.h" +#include "gnunet_util_lib.h" +#include "gnunet_testing_ng_lib.h" +#include "gnunet_peerstore_service.h" +#include "gnunet_transport_core_service.h" +#include "gnunet_transport_application_service.h" +#include "transport-testing-ng.h" + +/** + * Generic logging shortcut + */ +#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__) + + +/** + * Struct to hold information for callbacks. + * + */ +struct StopPeerState +{ + // Label of the cmd to start the peer. + const char *start_label; +}; + + +/** + * The run method of this cmd will stop all services of a peer which were used to test the transport service. + * + */ +static void +stop_peer_run (void *cls, + const struct GNUNET_TESTING_Command *cmd, + struct GNUNET_TESTING_Interpreter *is) +{ + struct StopPeerState *stop_ps = cls; + struct StartPeerState *sps; + const struct GNUNET_TESTING_Command *start_cmd; + + start_cmd = GNUNET_TESTING_interpreter_lookup_command (stop_ps->start_label); + GNUNET_TRANSPORT_get_trait_state (start_cmd, + &sps); + + if (NULL != sps->pic) + { + GNUNET_PEERSTORE_iterate_cancel (sps->pic); + sps->pic = NULL; + } + if (NULL != sps->th) + { + GNUNET_TRANSPORT_core_disconnect (sps->th); + sps->th = NULL; + } + if (NULL != sps->ah) + { + GNUNET_TRANSPORT_application_done (sps->ah); + sps->ah = NULL; + } + if (NULL != sps->ph) + { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Disconnecting from PEERSTORE service\n"); + GNUNET_PEERSTORE_disconnect (sps->ph, GNUNET_NO); + sps->ph = NULL; + } + if (NULL != sps->peer) + { + if (GNUNET_OK != + GNUNET_TESTING_peer_stop (sps->peer)) + { + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Testing lib failed to stop peer %u (`%s')\n", + sps->no, + GNUNET_i2s (&sps->id)); + } + GNUNET_TESTING_peer_destroy (sps->peer); + sps->peer = NULL; + } + if (NULL != sps->rh_task) + GNUNET_SCHEDULER_cancel (sps->rh_task); + sps->rh_task = NULL; + +} + + +/** + * The cleanup function of this cmd frees resources the cmd allocated. + * + */ +static void +stop_peer_cleanup (void *cls, + const struct GNUNET_TESTING_Command *cmd) +{ + struct StopPeerState *sps = cls; + + GNUNET_free (sps); +} + + +/** + * Trait function of this cmd does nothing. + * + */ +static int +stop_peer_traits (void *cls, + const void **ret, + const char *trait, + unsigned int index) +{ + return GNUNET_OK; +} + + +/** + * Create command. + * + * @param label name for command. + * @param start_label Label of the cmd to start the peer. + * @return command. + */ +struct GNUNET_TESTING_Command +GNUNET_TRANSPORT_cmd_stop_peer (const char *label, + const char *start_label) +{ + struct StopPeerState *sps; + + sps = GNUNET_new (struct StopPeerState); + sps->start_label = start_label; + + struct GNUNET_TESTING_Command cmd = { + .cls = sps, + .label = label, + .run = &stop_peer_run, + .cleanup = &stop_peer_cleanup, + .traits = &stop_peer_traits + }; + + return cmd; +} -- cgit v1.2.3 From 9d5a8c05f3a33c49fd97e5b8ef99d58b96704c6d Mon Sep 17 00:00:00 2001 From: t3sserakt Date: Tue, 24 Aug 2021 11:22:45 +0200 Subject: - added header changes for cmds to stop a peer and remove a test environment, used in simple send test case plugin --- src/include/gnunet_testing_ng_lib.h | 6 +++ src/transport/transport-testing-ng.h | 74 +++++++++++++++++++++++++++--------- 2 files changed, 61 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/include/gnunet_testing_ng_lib.h b/src/include/gnunet_testing_ng_lib.h index 035d1bcad..939863d67 100644 --- a/src/include/gnunet_testing_ng_lib.h +++ b/src/include/gnunet_testing_ng_lib.h @@ -838,11 +838,17 @@ GNUNET_TESTING_get_trait_test_system (const struct GNUNET_TESTING_Command *cmd, struct GNUNET_TESTING_System **test_system); + struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_system_create (const char *label, const char *testdir); +struct GNUNET_TESTING_Command +GNUNET_TESTING_cmd_system_destroy (const char *label, + const char *create_label); + + /** * Create command. * diff --git a/src/transport/transport-testing-ng.h b/src/transport/transport-testing-ng.h index cd5ba65a9..cd4e1f3fe 100644 --- a/src/transport/transport-testing-ng.h +++ b/src/transport/transport-testing-ng.h @@ -22,50 +22,86 @@ * @author t3sserakt */ -struct TngState +struct StartPeerState { /** - * Handle to operation + * Receive callback */ - struct GNUNET_TESTBED_Operation *operation; + struct GNUNET_MQ_MessageHandler *handlers; + + const char *cfgname; + + /** + * Peer's configuration + */ + struct GNUNET_CONFIGURATION_Handle *cfg; + + struct GNUNET_TESTING_Peer *peer; /** - * Flag indicating if service is ready. + * Peer identity */ - int service_ready; + struct GNUNET_PeerIdentity id; /** - * Abort task identifier + * Peer's transport service handle */ - struct GNUNET_SCHEDULER_Task *abort_task; + struct GNUNET_TRANSPORT_CoreHandle *th; /** - * Label of peer command. + * Application handle */ - const char *peer_label; + struct GNUNET_TRANSPORT_ApplicationHandle *ah; /** - * Name of service to start. + * Peer's PEERSTORE Handle */ - const char *servicename; + struct GNUNET_PEERSTORE_Handle *ph; /** - * Peer identity of the system. + * Hello get task */ - struct GNUNET_PeerIdentity *peer_identity; + struct GNUNET_SCHEDULER_Task *rh_task; /** - * Message handler for transport service. + * Peer's transport get hello handle to retrieve peer's HELLO message */ - const struct GNUNET_MQ_MessageHandler *handlers; + struct GNUNET_PEERSTORE_IterateContext *pic; /** - * Notify connect callback + * Hello */ - GNUNET_TRANSPORT_NotifyConnect nc; + char *hello; + + /** + * Hello size + */ + size_t hello_size; + + char *m; + + char *n; + + char *local_m; + + unsigned int finished; + + const char *system_label; /** - * Closure for the @a nc callback + * An unique number to identify the peer */ - void *cb_cls; + unsigned int no; + + struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map; + + struct GNUNET_TESTING_System *tl_system; + }; + + +int +GNUNET_TRANSPORT_get_trait_state (const struct + GNUNET_TESTING_Command + *cmd, + struct StartPeerState **sps); -- cgit v1.2.3 From 5ddaa3f8eb5e01882540f21ddf237f3a41311e8a Mon Sep 17 00:00:00 2001 From: t3sserakt Date: Tue, 24 Aug 2021 11:56:13 +0200 Subject: - fixed mem leaks, added code doc, formatting, removed trace logs --- .../testbed_api_cmd_netjail_start_testbed.c | 544 --------------------- src/testing/gnunet-cmds-helper.c | 190 ++----- ...testing_api_cmd_block_until_all_peers_started.c | 41 +- src/testing/testing_api_cmd_local_test_finished.c | 42 +- src/testing/testing_api_cmd_netjail_start.c | 42 +- .../testing_api_cmd_netjail_start_testsystem.c | 228 ++++++--- src/testing/testing_api_cmd_netjail_stop.c | 40 +- .../testing_api_cmd_netjail_stop_testsystem.c | 25 +- src/testing/testing_api_cmd_send_peer_ready.c | 25 + src/testing/testing_api_cmd_system_create.c | 25 +- src/testing/testing_api_cmd_system_destroy.c | 6 - src/testing/testing_api_loop.c | 44 +- src/transport/gnunet-communicator-tcp.c | 29 +- src/transport/test_transport_api_cmd_simple_send.c | 12 +- .../test_transport_plugin_cmd_simple_send.c | 7 - src/transport/transport-testing-cmds.h | 10 +- src/transport/transport_api_cmd_connecting_peers.c | 94 ++-- src/transport/transport_api_cmd_send_simple.c | 65 ++- src/transport/transport_api_cmd_start_peer.c | 268 +++++----- src/transport/transport_api_cmd_stop_peer.c | 2 +- 20 files changed, 660 insertions(+), 1079 deletions(-) delete mode 100644 src/testbed/testbed_api_cmd_netjail_start_testbed.c (limited to 'src') diff --git a/src/testbed/testbed_api_cmd_netjail_start_testbed.c b/src/testbed/testbed_api_cmd_netjail_start_testbed.c deleted file mode 100644 index 3d1a1d893..000000000 --- a/src/testbed/testbed_api_cmd_netjail_start_testbed.c +++ /dev/null @@ -1,544 +0,0 @@ -/* - This file is part of GNUnet - Copyright (C) 2021 GNUnet e.V. - - GNUnet is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - GNUnet 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 - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - - SPDX-License-Identifier: AGPL3.0-or-later - */ - -/** - * @file testing/testing_api_cmd_hello_world.c - * @brief Command to start the netjail peers. - * @author t3sserakt - */ -#include "platform.h" -#include "gnunet_testing_ng_lib.h" -#include "gnunet_testbed_ng_service.h" -#include "testbed_api.h" -#include "testbed_api_hosts.h" -#include "testbed_helper.h" - -#define NETJAIL_EXEC_SCRIPT "./../testing/netjail_exec.sh" - -struct HelperMessage; - -struct HelperMessage -{ - - struct HelperMessage *next; - - struct HelperMessage *prev; - - /** - * Size of the original message. - */ - uint16_t bytes_msg; - - /* Followed by @e bytes_msg of msg.*/ -}; - - - -struct NetJailState -{ - - unsigned int *rv; - - struct HelperMessage *hp_messages_head; - - struct HelperMessage *hp_messages_tail; - - /** - * The process handle - */ - struct GNUNET_HELPER_Handle **helper; - - unsigned int n_helper; - - char *binary_name; - - char *local_m; - - char *global_n; - - /** - * The send handle for the helper - */ - struct GNUNET_HELPER_SendHandle **shandle; - - unsigned int n_shandle; - - /** - * The message corresponding to send handle - */ - struct GNUNET_MessageHeader **msg; - - unsigned int n_msg; - - unsigned int number_of_testsystems_started; - - unsigned int number_of_peers_started; - - unsigned int number_of_local_test_finished; - - char *plugin_name; -}; - -struct TestingSystemCount -{ - unsigned int count; - - struct NetJailState *ns; -}; - -/** -* -* -* @param cls closure -* @param cmd current CMD being cleaned up. -*/ -static void -netjail_exec_cleanup (void *cls, - const struct GNUNET_TESTING_Command *cmd) -{ - struct NetJailState *ns = cls; - - GNUNET_free (ns->binary_name); -} - - -/** -* -* -* @param cls closure. -* @param[out] ret result -* @param trait name of the trait. -* @param index index number of the object to offer. -* @return #GNUNET_OK on success. -*/ -static int -netjail_exec_traits (void *cls, - const void **ret, - const char *trait, - unsigned int index) -{ - struct NetJailState *ns = cls; - struct GNUNET_HELPER_Handle **helper = ns->helper; - struct HelperMessage *hp_messages_head = ns->hp_messages_head; - - - struct GNUNET_TESTING_Trait traits[] = { - { - .index = 0, - .trait_name = "helper_handles", - .ptr = (const void *) helper, - }, - { - .index = 1, - .trait_name = "hp_msgs_head", - .ptr = (const void *) hp_messages_head, - }, - GNUNET_TESTING_trait_end () - }; - - return GNUNET_TESTING_get_trait (traits, - ret, - trait, - index); -} - - -/** - * Offer handles to testing cmd helper from trait - * - * @param cmd command to extract the message from. - * @param pt pointer to message. - * @return #GNUNET_OK on success. - */ -int -GNUNET_TESTING_get_trait_helper_handles (const struct - GNUNET_TESTING_Command *cmd, - struct GNUNET_HELPER_Handle ***helper) -{ - return cmd->traits (cmd->cls, - (const void **) helper, - "helper_handles", - (unsigned int) 0); -} - -/** - * Offer messages received via testing cmd helper from trait - * - * @param cmd command to extract the message from. - * @param pt pointer to message. - * @return #GNUNET_OK on success. - */ -int -GNUNET_TESTING_get_trait_helper_messages (const struct - GNUNET_TESTING_Command *cmd, - struct HelperMessage *** - hp_messages_head) -{ - return cmd->traits (cmd->cls, - (const void **) hp_messages_head, - "hp_msgs_head", - (unsigned int) 1); -} - - -/** - * Continuation function from GNUNET_HELPER_send() - * - * @param cls closure - * @param result GNUNET_OK on success, - * GNUNET_NO if helper process died - * GNUNET_SYSERR during GNUNET_HELPER_stop - */ -static void -clear_msg (void *cls, int result) -{ - struct TestingSystemCount *tbc = cls; - struct NetJailState *ns = tbc->ns; - - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "clear_msg tbc->count: %d\n", - tbc->count); - GNUNET_assert (NULL != ns->shandle[tbc->count - 1]); - ns->shandle[tbc->count - 1] = NULL; - GNUNET_free (ns->msg[tbc->count - 1]); - ns->msg[tbc->count - 1] = NULL; -} - - -/** - * Functions with this signature are called whenever a - * complete message is received by the tokenizer. - * - * Do not call GNUNET_SERVER_mst_destroy in callback - * - * @param cls closure - * @param client identification of the client - * @param message the actual message - * - * @return #GNUNET_OK on success, #GNUNET_SYSERR to stop further processing - */ -static int -helper_mst (void *cls, const struct GNUNET_MessageHeader *message) -{ - struct TestingSystemCount *tbc = cls; - struct NetJailState *ns = tbc->ns; - struct HelperMessage *hp_msg; - - if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_REPLY == ntohs (message->type)) - { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "helper_mst tbc->count: %d\n", - tbc->count); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Received message from helper.\n"); - ns->number_of_testsystems_started++; - } - else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED == ntohs ( - message->type)) - { - ns->number_of_peers_started++; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "number_of_peers_started: %d\n", - ns->number_of_peers_started); - } - else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED == ntohs ( - message->type)) - { - ns->number_of_local_test_finished++; - } - else - { - hp_msg = GNUNET_new (struct HelperMessage); - hp_msg->bytes_msg = message->size; - memcpy (&hp_msg[1], message, message->size); - GNUNET_CONTAINER_DLL_insert (ns->hp_messages_head, ns->hp_messages_tail, - hp_msg); - } - - return GNUNET_OK; -} - - -static void -exp_cb (void *cls) -{ - struct NetJailState *ns = cls; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Called exp_cb.\n"); - *ns->rv = 1; -} - - -static struct GNUNET_CMDS_HelperInit * -create_helper_init_msg_ (char *m_char, - char *n_char, - const char *plugin_name) -{ - struct GNUNET_CMDS_HelperInit *msg; - uint16_t plugin_name_len; - uint16_t msg_size; - - GNUNET_assert (NULL != plugin_name); - plugin_name_len = strlen (plugin_name); - msg_size = sizeof(struct GNUNET_CMDS_HelperInit) + plugin_name_len; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "msg_size: %d \n", - msg_size); - msg = GNUNET_malloc (msg_size); - msg->header.size = htons (msg_size); - msg->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_INIT); - msg->plugin_name_size = htons (plugin_name_len); - GNUNET_memcpy ((char *) &msg[1], - plugin_name, - plugin_name_len); - return msg; -} - - -static void -start_helper (struct NetJailState *ns, struct - GNUNET_CONFIGURATION_Handle *config, - char *m_char, - char *n_char) -{ - // struct GNUNET_CONFIGURATION_Handle *cfg; - struct GNUNET_CMDS_HelperInit *msg; - struct TestingSystemCount *tbc; - char *const script_argv[] = {NETJAIL_EXEC_SCRIPT, - m_char, - n_char, - GNUNET_OS_get_libexec_binary_path ( - HELPER_CMDS_BINARY), - ns->global_n, - ns->local_m, - NULL}; - unsigned int m = atoi (m_char); - unsigned int n = atoi (n_char); - unsigned int helper_check = GNUNET_OS_check_helper_binary ( - NETJAIL_EXEC_SCRIPT, - GNUNET_YES, - NULL); - - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "m: %d n: %d\n", - m, - n); - - tbc = GNUNET_new (struct TestingSystemCount); - tbc->ns = ns; - tbc->count = (n - 1) * atoi (ns->local_m) + m; - - - if (GNUNET_NO == helper_check) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "No SUID for %s!\n", - NETJAIL_EXEC_SCRIPT); - *ns->rv = 1; - } - else if (GNUNET_NO == helper_check) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "%s not found!\n", - NETJAIL_EXEC_SCRIPT); - *ns->rv = 1; - } - - GNUNET_array_append (ns->helper, ns->n_helper, GNUNET_HELPER_start ( - GNUNET_YES, - NETJAIL_EXEC_SCRIPT, - script_argv, - &helper_mst, - &exp_cb, - tbc)); - - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "First using helper %d %d\n", - tbc->count - 1, - ns->n_helper); - struct GNUNET_HELPER_Handle *helper = ns->helper[tbc->count - 1]; - - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "First using helper %d %d %p\n", - tbc->count - 1, - ns->n_helper, - helper); - - msg = create_helper_init_msg_ (m_char, - n_char, - ns->plugin_name); - GNUNET_array_append (ns->msg, ns->n_msg, &msg->header); - - GNUNET_array_append (ns->shandle, ns->n_shandle, GNUNET_HELPER_send ( - helper, - &msg->header, - GNUNET_NO, - &clear_msg, - tbc)); - - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Message %d send!\n", - tbc->count); - - if (NULL == ns->shandle[tbc->count - 1]) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Send handle is NULL!\n"); - GNUNET_free (msg); - *ns->rv = 1; - } -} - - -/** -* Run the "hello world" CMD. -* -* @param cls closure. -* @param cmd CMD being run. -* @param is interpreter state. -*/ -static void -netjail_exec_run (void *cls, - const struct GNUNET_TESTING_Command *cmd, - struct GNUNET_TESTING_Interpreter *is) -{ - char str_m[12]; - char str_n[12]; - struct NetJailState *ns = cls; - struct GNUNET_CONFIGURATION_Handle *config = - GNUNET_CONFIGURATION_create (); - - for (int i = 1; i <= atoi (ns->global_n); i++) { - for (int j = 1; j <= atoi (ns->local_m); j++) - { - sprintf (str_n, "%d", i); - sprintf (str_m, "%d", j); - start_helper (ns, config, - str_m, - str_n); - } - } -} - - -static int -netjail_start_finish (void *cls, - GNUNET_SCHEDULER_TaskCallback cont, - void *cont_cls) -{ - unsigned int ret = GNUNET_NO; - struct NetJailState *ns = cls; - unsigned int total_number = atoi (ns->local_m) * atoi (ns->global_n); - struct GNUNET_CMDS_ALL_PEERS_STARTED *reply; - size_t msg_length; - struct GNUNET_HELPER_Handle *helper; - struct TestingSystemCount *tbc; - - if (ns->number_of_local_test_finished == total_number) - { - ret = GNUNET_YES; - cont (cont_cls); - } - - if (ns->number_of_testsystems_started == total_number) - { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "All helpers started!\n"); - ns->number_of_testsystems_started = 0; - } - - if (ns->number_of_peers_started == total_number) - { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "All peers started!\n"); - - for (int i = 1; i <= atoi (ns->global_n); i++) { - for (int j = 1; j <= atoi (ns->local_m); j++) - { - tbc = GNUNET_new (struct TestingSystemCount); - tbc->ns = ns; - // TODO This needs to be more generic. As we send more messages back and forth, we can not grow the arrays again and again, because this is to error prone. - tbc->count = (i - 1) * atoi (ns->local_m) + j + total_number; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Second using helper %d %d %d\n", - tbc->count - 1 - total_number, - i, - j); - helper = ns->helper[tbc->count - 1 - total_number]; - msg_length = sizeof(struct GNUNET_CMDS_ALL_PEERS_STARTED); - reply = GNUNET_new (struct GNUNET_CMDS_ALL_PEERS_STARTED); - reply->header.type = htons ( - GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED); - reply->header.size = htons ((uint16_t) msg_length); - - GNUNET_array_append (ns->msg, ns->n_msg, &reply->header); - - struct GNUNET_HELPER_SendHandle *sh = GNUNET_HELPER_send ( - helper, - &reply->header, - GNUNET_NO, - &clear_msg, - tbc); - - GNUNET_array_append (ns->shandle, ns->n_shandle, sh); - - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "All peers started message %d send!\n", - tbc->count); - } - } - ns->number_of_peers_started = 0; - } - return ret; -} - - -/** - * Create command. - * - * @param label name for command. - * @param binaryname to exec. - * @return command. - */ -struct GNUNET_TESTING_Command -GNUNET_TESTING_cmd_netjail_start_testing_system (const char *label, - char *local_m, - char *global_n, - char *plugin_name, - unsigned int *rv) -{ - struct NetJailState *ns; - - ns = GNUNET_new (struct NetJailState); - ns->local_m = local_m; - ns->global_n = global_n; - ns->plugin_name = plugin_name; - ns->rv = rv; - - struct GNUNET_TESTING_Command cmd = { - .cls = ns, - .label = label, - .run = &netjail_exec_run, - .finish = &netjail_start_finish, - .cleanup = &netjail_exec_cleanup, - .traits = &netjail_exec_traits - }; - - return cmd; -} diff --git a/src/testing/gnunet-cmds-helper.c b/src/testing/gnunet-cmds-helper.c index 5705f46c2..21ea33888 100644 --- a/src/testing/gnunet-cmds-helper.c +++ b/src/testing/gnunet-cmds-helper.c @@ -47,7 +47,7 @@ /** * Generic logging shortcut - */ +testing_api_cmd_block_until_all_peers_started.c */ #define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__) /** @@ -74,27 +74,71 @@ struct Plugin */ struct GNUNET_TESTING_PluginFunctions *api; + /** + * IP address of the specific node the helper is running for. + * + */ char *node_ip; + /** + * Name of the test case plugin. + * + */ char *plugin_name; + /** + * The number of namespaces + * + */ char *global_n; + /** + * The number of local nodes per namespace. + * + */ char *local_m; + /** + * The number of the namespace this node is in. + * + */ char *n; + /** + * The number of the node in the namespace. + * + */ char *m; }; +/** + * Struct with information about a specific node and the whole network namespace setup. + * + */ struct NodeIdentifier { + /** + * The number of the namespace this node is in. + * + */ char *n; + /** + * The number of the node in the namespace. + * + */ char *m; + /** + * The number of namespaces + * + */ char *global_n; + /** + * The number of local nodes per namespace. + * + */ char *local_m; }; @@ -161,11 +205,6 @@ static struct GNUNET_SCHEDULER_Task *read_task_id; */ static struct GNUNET_SCHEDULER_Task *write_task_id; -/** - * Task to kill the child - */ -static struct GNUNET_SCHEDULER_Task *child_death_task_id; - /** * Are we done reading messages from stdin? */ @@ -187,8 +226,6 @@ shutdown_task (void *cls) { LOG_DEBUG ("Shutting down.\n"); - LOG (GNUNET_ERROR_TYPE_ERROR, - "Shutting down tokenizer!\n"); if (NULL != read_task_id) { @@ -204,11 +241,6 @@ shutdown_task (void *cls) GNUNET_free (wc->data); GNUNET_free (wc); } - if (NULL != child_death_task_id) - { - GNUNET_SCHEDULER_cancel (child_death_task_id); - child_death_task_id = NULL; - } if (NULL != stdin_fd) (void) GNUNET_DISK_file_close (stdin_fd); if (NULL != stdout_fd) @@ -235,9 +267,6 @@ write_task (void *cls) struct WriteContext *wc = cls; ssize_t bytes_wrote; - LOG (GNUNET_ERROR_TYPE_ERROR, - "Writing data!\n"); - GNUNET_assert (NULL != wc); write_task_id = NULL; bytes_wrote = GNUNET_DISK_file_write (stdout_fd, @@ -256,12 +285,8 @@ write_task (void *cls) { GNUNET_free (wc->data); GNUNET_free (wc); - LOG (GNUNET_ERROR_TYPE_ERROR, - "Written successfully!\n"); return; } - LOG (GNUNET_ERROR_TYPE_ERROR, - "Written data!\n"); write_task_id = GNUNET_SCHEDULER_add_write_file (GNUNET_TIME_UNIT_FOREVER_REL, stdout_fd, &write_task, @@ -270,39 +295,14 @@ write_task (void *cls) /** - * Task triggered whenever we receive a SIGCHLD (child - * process died). + * Callback to write a message to the master loop. * - * @param cls closure, NULL if we need to self-restart */ -/*static void -child_death_task (void *cls) -{ - const struct GNUNET_DISK_FileHandle *pr; - char c[16]; - - pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ); - child_death_task_id = NULL; - // consume the signal - GNUNET_break (0 < GNUNET_DISK_file_read (pr, &c, sizeof(c))); - LOG_DEBUG ("Got SIGCHLD\n"); - - LOG_DEBUG ("Child hasn't died. Resuming to monitor its status\n"); - child_death_task_id = - GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, - pr, - &child_death_task, - NULL); -}*/ - - static void write_message (struct GNUNET_MessageHeader *message, size_t msg_length) { struct WriteContext *wc; - LOG (GNUNET_ERROR_TYPE_ERROR, - "enter write_message!\n"); wc = GNUNET_new (struct WriteContext); wc->length = msg_length; wc->data = message; @@ -311,37 +311,9 @@ write_message (struct GNUNET_MessageHeader *message, size_t msg_length) stdout_fd, &write_task, wc); - LOG (GNUNET_ERROR_TYPE_ERROR, - "leave write_message!\n"); } -/** - * Function to run the test cases. - * - * @param cls plugin to use. - * - */ -/*static void -run_plugin (void *cls) -{ - struct Plugin *plugin = cls; - char *router_ip; - char *node_ip; - - router_ip = GNUNET_malloc (strlen (ROUTER_BASE_IP) + strlen (plugin->m) + 1); - strcpy (router_ip, ROUTER_BASE_IP); - strcat (router_ip, plugin->m); - - node_ip = GNUNET_malloc (strlen (NODE_BASE_IP) + strlen (plugin->n) + 1); - strcat (node_ip, NODE_BASE_IP); - strcat (node_ip, plugin->n); - - plugin->api->start_testcase (&write_message, router_ip, node_ip); - -}*/ - - /** * Functions with this signature are called whenever a * complete message is received by the tokenizer. @@ -368,9 +340,6 @@ tokenizer_cb (void *cls, const struct GNUNET_MessageHeader *message) char *router_ip; char *node_ip; - LOG (GNUNET_ERROR_TYPE_ERROR, - "tokenizer \n"); - msize = ntohs (message->size); if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_INIT == ntohs (message->type)) { @@ -390,23 +359,6 @@ tokenizer_cb (void *cls, const struct GNUNET_MessageHeader *message) binary = GNUNET_OS_get_libexec_binary_path ("gnunet-cmd"); - LOG (GNUNET_ERROR_TYPE_ERROR, - "plugin_name: %s \n", - plugin_name); - - // cmd_binary_process = GNUNET_OS_start_process ( - /*GNUNET_OS_INHERIT_STD_ERR verbose? , - NULL, - NULL, - NULL, - binary, - plugin_name, - ni->global_n, - ni->local_m, - ni->n, - ni->m, - NULL);*/ - plugin = GNUNET_new (struct Plugin); plugin->api = GNUNET_PLUGIN_load (plugin_name, NULL); @@ -429,51 +381,15 @@ tokenizer_cb (void *cls, const struct GNUNET_MessageHeader *message) plugin->api->start_testcase (&write_message, router_ip, node_ip, plugin->m, plugin->n, plugin->local_m); - LOG (GNUNET_ERROR_TYPE_ERROR, - "We got here!\n"); - - /*if (NULL == cmd_binary_process) - { - LOG (GNUNET_ERROR_TYPE_ERROR, - "Starting plugin failed!\n"); - return GNUNET_SYSERR; - }*/ - - LOG (GNUNET_ERROR_TYPE_ERROR, - "We got here 2!\n"); - - LOG (GNUNET_ERROR_TYPE_ERROR, - "global_n: %s local_n: %s n: %s m: %s.\n", - ni->global_n, - ni->local_m, - ni->n, - ni->m); - - LOG (GNUNET_ERROR_TYPE_ERROR, - "We got here 3!\n"); - GNUNET_free (binary); - // done_reading = GNUNET_YES; - msg_length = sizeof(struct GNUNET_CMDS_HelperReply); reply = GNUNET_new (struct GNUNET_CMDS_HelperReply); reply->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_REPLY); reply->header.size = htons ((uint16_t) msg_length); - LOG (GNUNET_ERROR_TYPE_ERROR, - "We got here 4!\n"); - write_message ((struct GNUNET_MessageHeader *) reply, msg_length); - LOG (GNUNET_ERROR_TYPE_ERROR, - "We got here 5!\n"); - - /*child_death_task_id = GNUNET_SCHEDULER_add_read_file ( - GNUNET_TIME_UNIT_FOREVER_REL, - GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ), - &child_death_task, - NULL);*/ return GNUNET_OK; } else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED == ntohs ( @@ -514,8 +430,6 @@ read_task (void *cls) if ((GNUNET_SYSERR == sread) || (0 == sread)) { LOG_DEBUG ("STDIN closed\n"); - LOG (GNUNET_ERROR_TYPE_ERROR, - "tokenizer shutting down during reading!\n"); GNUNET_SCHEDULER_shutdown (); return; } @@ -529,8 +443,6 @@ read_task (void *cls) return; } LOG_DEBUG ("Read %u bytes\n", (unsigned int) sread); - LOG (GNUNET_ERROR_TYPE_ERROR, - "Read %u bytes\n", (unsigned int) sread); /* FIXME: could introduce a GNUNET_MST_read2 to read directly from 'stdin_fd' and save a memcpy() here */ if (GNUNET_OK != @@ -624,13 +536,6 @@ main (int argc, char **argv) ni->n = argv[3]; ni->m = argv[4]; - LOG (GNUNET_ERROR_TYPE_ERROR, - "global_n: %s local_n: %s n: %s m: %s.\n", - ni->global_n, - ni->local_m, - ni->n, - ni->m); - status = GNUNET_OK; if (NULL == (sigpipe = GNUNET_DISK_pipe (GNUNET_DISK_PF_NONE))) @@ -647,8 +552,7 @@ main (int argc, char **argv) options, &run, ni); - LOG (GNUNET_ERROR_TYPE_ERROR, - "run finished\n"); + GNUNET_SIGNAL_handler_uninstall (shc_chld); shc_chld = NULL; GNUNET_DISK_pipe_close (sigpipe); diff --git a/src/testing/testing_api_cmd_block_until_all_peers_started.c b/src/testing/testing_api_cmd_block_until_all_peers_started.c index 8659fbb46..e9d3f0ed3 100644 --- a/src/testing/testing_api_cmd_block_until_all_peers_started.c +++ b/src/testing/testing_api_cmd_block_until_all_peers_started.c @@ -32,12 +32,24 @@ */ #define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__) +/** + * Struct with information for callbacks. + * + */ struct BlockState { + /** + * Flag to indicate if all peers have started. + * + */ unsigned int *all_peers_started; }; +/** + * Trait function of this cmd does nothing. + * + */ static int block_until_all_peers_started_traits (void *cls, const void **ret, @@ -48,6 +60,10 @@ block_until_all_peers_started_traits (void *cls, } +/** + * The cleanup function of this cmd frees resources the cmd allocated. + * + */ static void block_until_all_peers_started_cleanup (void *cls, const struct GNUNET_TESTING_Command *cmd) @@ -58,16 +74,24 @@ block_until_all_peers_started_cleanup (void *cls, } +/** + * This function does nothing but to start the cmd. + * + */ static void block_until_all_peers_started_run (void *cls, const struct GNUNET_TESTING_Command *cmd, struct GNUNET_TESTING_Interpreter *is) { - LOG (GNUNET_ERROR_TYPE_ERROR, + LOG (GNUNET_ERROR_TYPE_DEBUG, "block_until_all_peers_started_run!\n"); } +/** + * Function to check if BlockState#all_peers_started is GNUNET_YES. In that case interpreter_next will be called. + * + */ static int block_until_all_peers_started_finish (void *cls, GNUNET_SCHEDULER_TaskCallback cont, @@ -76,20 +100,10 @@ block_until_all_peers_started_finish (void *cls, struct BlockState *bs = cls; unsigned int *ret = bs->all_peers_started; - LOG (GNUNET_ERROR_TYPE_ERROR, - "We got here 10\n"); - if (GNUNET_YES == *ret) { - LOG (GNUNET_ERROR_TYPE_ERROR, - "We do not need to block anymore!\n"); cont (cont_cls); } - else - { - LOG (GNUNET_ERROR_TYPE_ERROR, - "You shall not pass!\n"); - } return *ret; } @@ -99,6 +113,7 @@ block_until_all_peers_started_finish (void *cls, * Create command. * * @param label name for command. + * @param all_peers_started Flag which will be set from outside. * @return command. */ struct GNUNET_TESTING_Command @@ -108,10 +123,6 @@ GNUNET_TESTING_cmd_block_until_all_peers_started (const char *label, { struct BlockState *bs; - LOG (GNUNET_ERROR_TYPE_ERROR, - "we have all_peers_started: %u\n", - *all_peers_started); - bs = GNUNET_new (struct BlockState); bs->all_peers_started = all_peers_started; diff --git a/src/testing/testing_api_cmd_local_test_finished.c b/src/testing/testing_api_cmd_local_test_finished.c index 5b74d4e04..383de4c10 100644 --- a/src/testing/testing_api_cmd_local_test_finished.c +++ b/src/testing/testing_api_cmd_local_test_finished.c @@ -33,14 +33,31 @@ */ #define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__) + +/** + * Struct to hold information for callbacks. + * + */ struct LocalFinishedState { + /** + * Callback to write messages to the master loop. + * + */ TESTING_CMD_HELPER_write_cb write_message; + /** + * The message send back to the master loop. + * + */ struct GNUNET_CMDS_LOCAL_FINISHED *reply; }; +/** + * Trait function of this cmd does nothing. + * + */ static int local_test_finished_traits (void *cls, const void **ret, @@ -51,6 +68,10 @@ local_test_finished_traits (void *cls, } +/** + * The cleanup function of this cmd frees resources the cmd allocated. + * + */ static void local_test_finished_cleanup (void *cls, const struct GNUNET_TESTING_Command *cmd) @@ -62,6 +83,10 @@ local_test_finished_cleanup (void *cls, } +/** + * This function sends a GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED message to the master loop. + * + */ static void local_test_finished_run (void *cls, const struct GNUNET_TESTING_Command *cmd, @@ -72,28 +97,25 @@ local_test_finished_run (void *cls, struct GNUNET_CMDS_LOCAL_FINISHED *reply; size_t msg_length; - LOG (GNUNET_ERROR_TYPE_ERROR, - "We got here 12!\n"); - msg_length = sizeof(struct GNUNET_CMDS_LOCAL_FINISHED); reply = GNUNET_new (struct GNUNET_CMDS_LOCAL_FINISHED); reply->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED); reply->header.size = htons ((uint16_t) msg_length); lfs->reply = reply; lfs->write_message ((struct GNUNET_MessageHeader *) reply, msg_length); - - LOG (GNUNET_ERROR_TYPE_ERROR, - "We got here 13!\n"); } +/** + * This finish function will stop the local loop without shutting down the scheduler, because we do not call the continuation, which is the interpreter_next method. + * + */ static int local_test_finished_finish (void *cls, GNUNET_SCHEDULER_TaskCallback cont, void *cont_cls) { - // This will stop the local loop without shutting down the scheduler, because we do not call the continuation, which is the interpreter_next method. - LOG (GNUNET_ERROR_TYPE_ERROR, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Stopping local loop\n"); return GNUNET_YES; } @@ -103,6 +125,7 @@ local_test_finished_finish (void *cls, * Create command. * * @param label name for command. + * @param write_message Callback to write messages to the master loop. * @return command. */ struct GNUNET_TESTING_Command @@ -112,9 +135,6 @@ GNUNET_TESTING_cmd_local_test_finished (const char *label, { struct LocalFinishedState *lfs; - LOG (GNUNET_ERROR_TYPE_ERROR, - "We got here 11!\n"); - lfs = GNUNET_new (struct LocalFinishedState); lfs->write_message = write_message; diff --git a/src/testing/testing_api_cmd_netjail_start.c b/src/testing/testing_api_cmd_netjail_start.c index c82392a08..536b356a6 100644 --- a/src/testing/testing_api_cmd_netjail_start.c +++ b/src/testing/testing_api_cmd_netjail_start.c @@ -29,12 +29,19 @@ #define NETJAIL_START_SCRIPT "./../testing/netjail_start.sh" +/** + * Struct to hold information for callbacks. + * + */ struct NetJailState { + // Child Wait handle struct GNUNET_ChildWaitHandle *cwh; + // Number of local nodes in each namespace. char *local_m; + // The number of namespaces. char *global_n; /** @@ -42,16 +49,15 @@ struct NetJailState */ struct GNUNET_OS_Process *start_proc; + // Flag indication if the script finished. unsigned int finished; }; /** -* -* -* @param cls closure -* @param cmd current CMD being cleaned up. -*/ + * The cleanup function of this cmd frees resources the cmd allocated. + * + */ static void netjail_start_cleanup (void *cls, const struct GNUNET_TESTING_Command *cmd) @@ -81,14 +87,9 @@ netjail_start_cleanup (void *cls, /** -* -* -* @param cls closure. -* @param[out] ret result -* @param trait name of the trait. -* @param index index number of the object to offer. -* @return #GNUNET_OK on success. -*/ + * Trait function of this cmd does nothing. + * + */ static int netjail_start_traits (void *cls, const void **ret, @@ -98,6 +99,11 @@ netjail_start_traits (void *cls, return GNUNET_OK; } + +/** + * Callback which will be called if the setup script finished. + * + */ static void child_completed_callback (void *cls, enum GNUNET_OS_ProcessStatusType type, @@ -122,7 +128,7 @@ child_completed_callback (void *cls, /** -* Run the "hello world" CMD. +* The run method starts the script which setup the network namespaces. * * @param cls closure. * @param cmd CMD being run. @@ -171,6 +177,11 @@ netjail_start_run (void *cls, GNUNET_break (NULL != ns->cwh); } + +/** + * This function checks the flag NetJailState#finished, if this cmd finished. + * + */ static int netjail_start_finish (void *cls, GNUNET_SCHEDULER_TaskCallback cont, @@ -189,7 +200,8 @@ netjail_start_finish (void *cls, * Create command. * * @param label name for command. - * @param binaryname to start. + * @param local_m Number of local nodes in each namespace. + * @param global_n The number of namespaces. * @return command. */ struct GNUNET_TESTING_Command diff --git a/src/testing/testing_api_cmd_netjail_start_testsystem.c b/src/testing/testing_api_cmd_netjail_start_testsystem.c index 5c2f71168..01bac9b05 100644 --- a/src/testing/testing_api_cmd_netjail_start_testsystem.c +++ b/src/testing/testing_api_cmd_netjail_start_testsystem.c @@ -29,13 +29,21 @@ #define NETJAIL_EXEC_SCRIPT "./../testing/netjail_exec.sh" -struct HelperMessage; - +/** + * Struct to store messages send/received by the helper into a DLL + * + */ struct HelperMessage { + /** + * Kept in a DLL. + */ struct HelperMessage *next; + /** + * Kept in a DLL. + */ struct HelperMessage *prev; /** @@ -47,27 +55,51 @@ struct HelperMessage }; - +/** + * Struct to store information handed over to callbacks. + * + */ struct NetJailState { - + /** + * Pointer to the return value of the test. + * + */ unsigned int *rv; + /** + * Head of the DLL which stores messages received by the helper. + * + */ struct HelperMessage *hp_messages_head; + /** + * Tail of the DLL which stores messages received by the helper. + * + */ struct HelperMessage *hp_messages_tail; /** - * The process handle + * Array with handles of helper processes. */ struct GNUNET_HELPER_Handle **helper; + /** + * Size of the array NetJailState#helper. + * + */ unsigned int n_helper; - char *binary_name; - + /** + * Number of nodes in a network namespace. //TODO make this a unsigned int + * + */ char *local_m; + /** + * Number of network namespaces. //TODO make this a unsigned int + * + */ char *global_n; /** @@ -75,33 +107,91 @@ struct NetJailState */ struct GNUNET_HELPER_SendHandle **shandle; + /** + * Size of the array NetJailState#shandle. + * + */ unsigned int n_shandle; /** - * The message corresponding to send handle + * The messages send to the helper. */ struct GNUNET_MessageHeader **msg; + /** + * Size of the array NetJailState#msg. + * + */ unsigned int n_msg; + /** + * Number of test environments started. + * + */ unsigned int number_of_testsystems_started; + /** + * Number of peers started. + * + */ unsigned int number_of_peers_started; + /** + * Number of local tests finished. + * + */ unsigned int number_of_local_test_finished; + /** + * Name of the test case plugin the helper will load. + * + */ char *plugin_name; + + /** + * HEAD of the DLL containing TestingSystemCount. + * + */ + struct TestingSystemCount *tbcs_head; + + /** + * TAIL of the DLL containing TestingSystemCount. + * + */ + struct TestingSystemCount *tbcs_tail; }; +/** + * Struct containing the number of the test environment and the NetJailState which + * will be handed to callbacks specific to a test environment. + */ struct TestingSystemCount { + /** + * Kept in a DLL. + */ + struct TestingSystemCount *next; + + /** + * Kept in a DLL. + */ + struct TestingSystemCount *prev; + + /** + * The number of the test environment. + * + */ unsigned int count; + /** + * Struct to store information handed over to callbacks. + * + */ struct NetJailState *ns; }; /** -* +* Code to clean up ressource this cmd used. * * @param cls closure * @param cmd current CMD being cleaned up. @@ -111,20 +201,31 @@ netjail_exec_cleanup (void *cls, const struct GNUNET_TESTING_Command *cmd) { struct NetJailState *ns = cls; + struct HelperMessage *message_pos; + struct TestingSystemCount *tbc_pos; - GNUNET_free (ns->binary_name); + while (NULL != (message_pos = ns->hp_messages_head)) + { + GNUNET_CONTAINER_DLL_remove (ns->hp_messages_head, + ns->hp_messages_tail, + message_pos); + GNUNET_free (message_pos); + } + while (NULL != (tbc_pos = ns->tbcs_head)) + { + GNUNET_CONTAINER_DLL_remove (ns->tbcs_head, + ns->tbcs_tail, + tbc_pos); + GNUNET_free (tbc_pos); + } + GNUNET_free (ns); } /** -* -* -* @param cls closure. -* @param[out] ret result -* @param trait name of the trait. -* @param index index number of the object to offer. -* @return #GNUNET_OK on success. -*/ + * This function prepares an array with traits. + * + */ static int netjail_exec_traits (void *cls, const void **ret, @@ -209,9 +310,6 @@ clear_msg (void *cls, int result) struct TestingSystemCount *tbc = cls; struct NetJailState *ns = tbc->ns; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "clear_msg tbc->count: %d\n", - tbc->count); GNUNET_assert (NULL != ns->shandle[tbc->count - 1]); ns->shandle[tbc->count - 1] = NULL; GNUNET_free (ns->msg[tbc->count - 1]); @@ -240,20 +338,12 @@ helper_mst (void *cls, const struct GNUNET_MessageHeader *message) if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_REPLY == ntohs (message->type)) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "helper_mst tbc->count: %d\n", - tbc->count); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Received message from helper.\n"); ns->number_of_testsystems_started++; } else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED == ntohs ( message->type)) { ns->number_of_peers_started++; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "number_of_peers_started: %d\n", - ns->number_of_peers_started); } else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED == ntohs ( message->type)) @@ -272,7 +362,10 @@ helper_mst (void *cls, const struct GNUNET_MessageHeader *message) return GNUNET_OK; } - +/** + * Callback called if there was an exception during execution of the helper. + * + */ static void exp_cb (void *cls) { @@ -281,7 +374,14 @@ exp_cb (void *cls) *ns->rv = 1; } - +/** + * Function to initialize a init message for the helper. + * + * @param m_char The actual node in a namespace. //TODO Change this to unsigned int + * @param n_char The actual namespace. //TODO Change this to unsigned int + * @param plugin_name Name of the test case plugin the helper will load. + * + */ static struct GNUNET_CMDS_HelperInit * create_helper_init_msg_ (char *m_char, char *n_char, @@ -294,9 +394,6 @@ create_helper_init_msg_ (char *m_char, GNUNET_assert (NULL != plugin_name); plugin_name_len = strlen (plugin_name); msg_size = sizeof(struct GNUNET_CMDS_HelperInit) + plugin_name_len; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "msg_size: %d \n", - msg_size); msg = GNUNET_malloc (msg_size); msg->header.size = htons (msg_size); msg->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_INIT); @@ -308,13 +405,17 @@ create_helper_init_msg_ (char *m_char, } +/** + * Function which start a single helper process. + * + */ static void start_helper (struct NetJailState *ns, struct GNUNET_CONFIGURATION_Handle *config, char *m_char, char *n_char) { - // struct GNUNET_CONFIGURATION_Handle *cfg; + struct GNUNET_HELPER_Handle *helper; struct GNUNET_CMDS_HelperInit *msg; struct TestingSystemCount *tbc; char *const script_argv[] = {NETJAIL_EXEC_SCRIPT, @@ -332,15 +433,13 @@ start_helper (struct NetJailState *ns, struct GNUNET_YES, NULL); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "m: %d n: %d\n", - m, - n); - tbc = GNUNET_new (struct TestingSystemCount); tbc->ns = ns; tbc->count = (n - 1) * atoi (ns->local_m) + m; + GNUNET_CONTAINER_DLL_insert (ns->tbcs_head, ns->tbcs_tail, + tbc); + if (GNUNET_NO == helper_check) { @@ -365,17 +464,7 @@ start_helper (struct NetJailState *ns, struct &exp_cb, tbc)); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "First using helper %d %d\n", - tbc->count - 1, - ns->n_helper); - struct GNUNET_HELPER_Handle *helper = ns->helper[tbc->count - 1]; - - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "First using helper %d %d %p\n", - tbc->count - 1, - ns->n_helper, - helper); + helper = ns->helper[tbc->count - 1]; msg = create_helper_init_msg_ (m_char, n_char, @@ -389,10 +478,6 @@ start_helper (struct NetJailState *ns, struct &clear_msg, tbc)); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Message %d send!\n", - tbc->count); - if (NULL == ns->shandle[tbc->count - 1]) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -404,7 +489,7 @@ start_helper (struct NetJailState *ns, struct /** -* Run the "hello world" CMD. +* This function starts a helper process for each node. * * @param cls closure. * @param cmd CMD being run. @@ -434,6 +519,15 @@ netjail_exec_run (void *cls, } +/** + * This function checks on three different information. + * + * 1. Did all helpers start. This is only logged. + * 2. Did all peer start. + * In this case a GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED is send to all peers. + * 3. Did all peers finished the test case. In this case interpreter_next will be called. + * + */ static int netjail_start_finish (void *cls, GNUNET_SCHEDULER_TaskCallback cont, @@ -455,16 +549,11 @@ netjail_start_finish (void *cls, if (ns->number_of_testsystems_started == total_number) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "All helpers started!\n"); ns->number_of_testsystems_started = 0; } if (ns->number_of_peers_started == total_number) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "All peers started!\n"); - for (int i = 1; i <= atoi (ns->global_n); i++) { for (int j = 1; j <= atoi (ns->local_m); j++) { @@ -472,11 +561,7 @@ netjail_start_finish (void *cls, tbc->ns = ns; // TODO This needs to be more generic. As we send more messages back and forth, we can not grow the arrays again and again, because this is to error prone. tbc->count = (i - 1) * atoi (ns->local_m) + j + total_number; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Second using helper %d %d %d\n", - tbc->count - 1 - total_number, - i, - j); + helper = ns->helper[tbc->count - 1 - total_number]; msg_length = sizeof(struct GNUNET_CMDS_ALL_PEERS_STARTED); reply = GNUNET_new (struct GNUNET_CMDS_ALL_PEERS_STARTED); @@ -494,10 +579,6 @@ netjail_start_finish (void *cls, tbc); GNUNET_array_append (ns->shandle, ns->n_shandle, sh); - - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "All peers started message %d send!\n", - tbc->count); } } ns->number_of_peers_started = 0; @@ -509,8 +590,11 @@ netjail_start_finish (void *cls, /** * Create command. * - * @param label name for command. - * @param binaryname to exec. + * @param label Name for the command. + * @param local_m Number of nodes in a network namespace. //TODO make this a unsigned int + * @param global_n Number of network namespaces. //TODO make this a unsigned int + * @param plugin_name Name of the test case plugin the helper will load. + * @param rv Pointer to the return value of the test. * @return command. */ struct GNUNET_TESTING_Command diff --git a/src/testing/testing_api_cmd_netjail_stop.c b/src/testing/testing_api_cmd_netjail_stop.c index 710b4fbf4..99084d9af 100644 --- a/src/testing/testing_api_cmd_netjail_stop.c +++ b/src/testing/testing_api_cmd_netjail_stop.c @@ -30,12 +30,19 @@ #define NETJAIL_STOP_SCRIPT "./../testing/netjail_stop.sh" +// Child Wait handle struct GNUNET_ChildWaitHandle *cwh; +/** + * Struct to hold information for callbacks. + * + */ struct NetJailState { + // Number of local nodes in each namespace. char *local_m; + // The number of namespaces. char *global_n; /** @@ -43,16 +50,15 @@ struct NetJailState */ struct GNUNET_OS_Process *stop_proc; + // Flag indication if the script finished. unsigned int finished; }; /** -* -* -* @param cls closure -* @param cmd current CMD being cleaned up. -*/ + * The cleanup function of this cmd frees resources the cmd allocated. + * + */ static void netjail_stop_cleanup (void *cls, const struct GNUNET_TESTING_Command *cmd) @@ -78,14 +84,9 @@ netjail_stop_cleanup (void *cls, /** -* -* -* @param cls closure. -* @param[out] ret result -* @param trait name of the trait. -* @param index index number of the object to offer. -* @return #GNUNET_OK on success. -*/ + * Trait function of this cmd does nothing. + * + */ static int netjail_stop_traits (void *cls, const void **ret, @@ -96,6 +97,10 @@ netjail_stop_traits (void *cls, } +/** + * Callback which will be called if the setup script finished. + * + */ static void child_completed_callback (void *cls, enum GNUNET_OS_ProcessStatusType type, @@ -118,7 +123,7 @@ child_completed_callback (void *cls, /** -* Run the "hello world" CMD. +* The run method starts the script which deletes the network namespaces. * * @param cls closure. * @param cmd CMD being run. @@ -169,6 +174,10 @@ netjail_stop_run (void *cls, } +/** + * This function checks the flag NetJailState#finished, if this cmd finished. + * + */ static int netjail_stop_finish (void *cls, GNUNET_SCHEDULER_TaskCallback cont, @@ -188,7 +197,8 @@ netjail_stop_finish (void *cls, * Create command. * * @param label name for command. - * @param binaryname to stop. + * @param local_m Number of local nodes in each namespace. + * @param global_n The number of namespaces. * @return command. */ struct GNUNET_TESTING_Command diff --git a/src/testing/testing_api_cmd_netjail_stop_testsystem.c b/src/testing/testing_api_cmd_netjail_stop_testsystem.c index bed9f3ebf..d6e733e05 100644 --- a/src/testing/testing_api_cmd_netjail_stop_testsystem.c +++ b/src/testing/testing_api_cmd_netjail_stop_testsystem.c @@ -28,6 +28,10 @@ #include "testing_cmds.h" +/** + * Struct to store information handed over to callbacks. + * + */ struct StopHelperState { @@ -45,7 +49,7 @@ struct StopHelperState /** -* +* Code to clean up ressource this cmd used. * * @param cls closure * @param cmd current CMD being cleaned up. @@ -59,14 +63,9 @@ stop_testing_system_cleanup (void *cls, /** -* -* -* @param cls closure. -* @param[out] ret result -* @param trait name of the trait. -* @param index index number of the object to offer. -* @return #GNUNET_OK on success. -*/ + * Trait function of this cmd does nothing. + * + */ static int stop_testing_system_traits (void *cls, const void **ret, @@ -78,7 +77,7 @@ stop_testing_system_traits (void *cls, /** -* Run the "hello world" CMD. +* This function stops the helper process for each node. * * @param cls closure. * @param cmd CMD being run. @@ -110,9 +109,11 @@ stop_testing_system_run (void *cls, /** * Create command. - * + * @param helper_start_label label of the cmd to start the test system. * @param label name for command. - * @param binaryname to exec. + * @param . + * @param local_m Number of nodes in a network namespace. //TODO make this a unsigned int + * @param global_n Number of network namespaces. //TODO make this a unsigned int * @return command. */ struct GNUNET_TESTING_Command diff --git a/src/testing/testing_api_cmd_send_peer_ready.c b/src/testing/testing_api_cmd_send_peer_ready.c index afe28de77..016837214 100644 --- a/src/testing/testing_api_cmd_send_peer_ready.c +++ b/src/testing/testing_api_cmd_send_peer_ready.c @@ -29,14 +29,30 @@ #include "testing_cmds.h" +/** + * Struct to hold information for callbacks. + * + */ struct SendPeerReadyState { + /** + * Callback to write messages to the master loop. + * + */ TESTING_CMD_HELPER_write_cb write_message; + /** + * The message send back to the master loop. + * + */ struct GNUNET_CMDS_PEER_STARTED *reply; }; +/** + * Trait function of this cmd does nothing. + * + */ static int send_peer_ready_traits (void *cls, const void **ret, @@ -47,6 +63,10 @@ send_peer_ready_traits (void *cls, } +/** + * The cleanup function of this cmd frees resources the cmd allocated. + * + */ static void send_peer_ready_cleanup (void *cls, const struct GNUNET_TESTING_Command *cmd) @@ -58,6 +78,10 @@ send_peer_ready_cleanup (void *cls, } +/** + * This function sends a GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED message to the master loop. + * + */ static void send_peer_ready_run (void *cls, const struct GNUNET_TESTING_Command *cmd, @@ -80,6 +104,7 @@ send_peer_ready_run (void *cls, * Create command. * * @param label name for command. + * @param write_message Callback to write messages to the master loop. * @return command. */ struct GNUNET_TESTING_Command diff --git a/src/testing/testing_api_cmd_system_create.c b/src/testing/testing_api_cmd_system_create.c index 2007b4ef3..f3a0b1a4c 100644 --- a/src/testing/testing_api_cmd_system_create.c +++ b/src/testing/testing_api_cmd_system_create.c @@ -28,6 +28,10 @@ #include "gnunet_testing_ng_lib.h" #include "gnunet_testing_lib.h" +/** + * Struct to hold information for callbacks. + * + */ struct TestSystemState { struct GNUNET_TESTING_System *test_system; @@ -36,6 +40,10 @@ struct TestSystemState }; +/** + * The run method of this cmd will setup a test environment for a node. + * + */ static void system_create_run (void *cls, const struct GNUNET_TESTING_Command *cmd, @@ -54,6 +62,11 @@ system_create_run (void *cls, "system created\n"); } + +/** + * This function prepares an array with traits. + * + */ static int system_create_traits (void *cls, const void **ret, @@ -79,6 +92,12 @@ system_create_traits (void *cls, } +/** + * Function to get the trait with struct GNUNET_TESTING_System + * + * @param[out] test_system The struct GNUNET_TESTING_System. + * @return #GNUNET_OK if no error occurred, #GNUNET_SYSERR otherwise. + */ int GNUNET_TESTING_get_trait_test_system (const struct GNUNET_TESTING_Command *cmd, @@ -91,13 +110,16 @@ GNUNET_TESTING_get_trait_test_system (const struct } +/** + * The cleanup function of this cmd frees resources the cmd allocated. + * + */ static void system_create_cleanup (void *cls, const struct GNUNET_TESTING_Command *cmd) { struct TestSystemState *tss = cls; - GNUNET_free (tss->test_system); GNUNET_free (tss); } @@ -106,6 +128,7 @@ system_create_cleanup (void *cls, * Create command. * * @param label name for command. + * @param label name for the test environment directory. * @return command. */ struct GNUNET_TESTING_Command diff --git a/src/testing/testing_api_cmd_system_destroy.c b/src/testing/testing_api_cmd_system_destroy.c index e94d8dad0..5ed0c2fd2 100644 --- a/src/testing/testing_api_cmd_system_destroy.c +++ b/src/testing/testing_api_cmd_system_destroy.c @@ -53,16 +53,10 @@ system_destroy_run (void *cls, const struct GNUNET_TESTING_Command *system_cmd; struct GNUNET_TESTING_System *tl_system; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "system destroy\n"); - system_cmd = GNUNET_TESTING_interpreter_lookup_command (tss->create_label); GNUNET_TESTING_get_trait_test_system (system_cmd, &tl_system); GNUNET_TESTING_system_destroy (tl_system, GNUNET_YES); - - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "system destroyed\n"); } diff --git a/src/testing/testing_api_loop.c b/src/testing/testing_api_loop.c index f4fa4e17e..0c24c0e26 100644 --- a/src/testing/testing_api_loop.c +++ b/src/testing/testing_api_loop.c @@ -35,6 +35,7 @@ struct GNUNET_TESTING_Interpreter *is; + /** * Closure used to sync an asynchronous with an synchronous command. */ @@ -57,6 +58,7 @@ struct SyncTaskClosure struct GNUNET_TESTING_Interpreter *is; }; + /** * Closure used to run the finish task. */ @@ -74,6 +76,7 @@ struct FinishTaskClosure struct GNUNET_TESTING_Interpreter *is; }; + /** * Lookup command by label. * @@ -185,6 +188,10 @@ interpreter_next (void *cls) } +/** + * This function checks if the finish function of a command returns GNUNET_YES, when the command is finished. In this case the finish function might have called interpreter_next. IF GNUNET_NO was returned this function is added to the scheduler again. In case of an error interpreter_fail is called. + * + */ static void run_finish_task_next (void *cls) { @@ -212,6 +219,12 @@ run_finish_task_next (void *cls) } +/** + * This function checks if the finish function of an asynchronous command returns GNUNET_YES, when the command is finished. In this case the finish function might have called interpreter_next. IF GNUNET_NO was returned this function is added to the scheduler again. In case of an error interpreter_fail is called. + * + * //TODO run_finish_task_next and this function can be merged. + * + */ static void run_finish_task_sync (void *cls) { @@ -248,13 +261,17 @@ run_finish_task_sync (void *cls) } else { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Sync task finished with an error.\n"); GNUNET_TESTING_interpreter_fail (); } } +/** + * run method of the command created by the interpreter to wait for another command to finish. + * + */ static void start_finish_on_ref (void *cls, const struct GNUNET_TESTING_Command *cmd, @@ -277,6 +294,17 @@ start_finish_on_ref (void *cls, } +/** + * Create (synchronous) command that waits for another command to finish. + * If @a cmd_ref did not finish after @a timeout, this command will fail + * the test case. + * + * @param finish_label label for this command + * @param cmd_ref reference to a previous command which we should + * wait for (call `finish()` on) + * @param timeout how long to wait at most for @a cmd_ref to finish + * @return a finish-command. + */ const struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_finish (const char *finish_label, const char *cmd_ref, @@ -340,7 +368,7 @@ GNUNET_TESTING_interpreter_fail () while (GNUNET_TESTING_cmd_is_batch (cmd)) { cmd = GNUNET_TESTING_cmd_batch_get_current (cmd); - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Batch is at command `%s'\n", cmd->label); } @@ -354,7 +382,7 @@ GNUNET_TESTING_interpreter_fail () if (NULL == cmd->label) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failed at command `%s'\n", cmd->label); @@ -415,7 +443,7 @@ interpreter_run (void *cls) if (NULL == cmd->label) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Running command END %p\n", is); is->result = GNUNET_OK; @@ -424,7 +452,7 @@ interpreter_run (void *cls) } else if (NULL != cmd) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Running command `%s' %p\n", cmd->label, is); @@ -478,8 +506,14 @@ do_shutdown (void *cls) for (unsigned int j = 0; NULL != (cmd = &is->commands[j])->label; j++) { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Cleaning up cmd %s\n", + cmd->label); cmd->cleanup (cmd->cls, cmd); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Cleaned up cmd %s\n", + cmd->label); } if (NULL != is->finish_task) diff --git a/src/transport/gnunet-communicator-tcp.c b/src/transport/gnunet-communicator-tcp.c index 10e2f7d40..d8bf7c1a8 100644 --- a/src/transport/gnunet-communicator-tcp.c +++ b/src/transport/gnunet-communicator-tcp.c @@ -879,12 +879,15 @@ queue_destroy (struct Queue *queue) struct GNUNET_HashCode h_sock; int sockfd; - sockfd = GNUNET_NETWORK_get_fd (queue->listen_sock); - GNUNET_CRYPTO_hash (&sockfd, - sizeof(int), - &h_sock); + if (NULL != queue->listen_sock) + { + sockfd = GNUNET_NETWORK_get_fd (queue->listen_sock); + GNUNET_CRYPTO_hash (&sockfd, + sizeof(int), + &h_sock); - lt = GNUNET_CONTAINER_multihashmap_get (lt_map, &h_sock); + lt = GNUNET_CONTAINER_multihashmap_get (lt_map, &h_sock); + } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting queue for peer `%s'\n", @@ -1900,9 +1903,9 @@ queue_read (void *cls) BUF_SIZE - queue->cread_off); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received %lu bytes from TCP queue\n", rcvd); - GNUNET_log_from_nocheck (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log_from_nocheck (GNUNET_ERROR_TYPE_DEBUG, "transport", - "Received %lu bytes from TCP queue\n", rcvd); + "Received %lu bytes from TCP queue\n", rcvd); if (-1 == rcvd) { if ((EAGAIN != errno) && (EINTR != errno)) @@ -2678,9 +2681,9 @@ proto_read_kx (void *cls) sizeof(pq->ibuf) - pq->ibuf_off); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received %lu bytes for KX\n", rcvd); - GNUNET_log_from_nocheck (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log_from_nocheck (GNUNET_ERROR_TYPE_DEBUG, "transport", - "Received %lu bytes for KX\n", rcvd); + "Received %lu bytes for KX\n", rcvd); if (-1 == rcvd) { if ((EAGAIN != errno) && (EINTR != errno)) @@ -2830,10 +2833,10 @@ queue_read_kx (void *cls) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received %lu bytes for KX\n", rcvd); - GNUNET_log_from_nocheck (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log_from_nocheck (GNUNET_ERROR_TYPE_DEBUG, "transport", - "Received %lu bytes for KX\n", - rcvd); + "Received %lu bytes for KX\n", + rcvd); if (-1 == rcvd) { if ((EAGAIN != errno) && (EINTR != errno)) @@ -3082,9 +3085,9 @@ do_shutdown (void *cls) GNUNET_CONTAINER_multihashmap_iterate (lt_map, &get_lt_delete_it, NULL); GNUNET_CONTAINER_multipeermap_iterate (queue_map, &get_queue_delete_it, NULL); GNUNET_CONTAINER_multipeermap_destroy (queue_map); - GNUNET_TRANSPORT_communicator_address_remove_all (ch); if (NULL != ch) { + GNUNET_TRANSPORT_communicator_address_remove_all (ch); GNUNET_TRANSPORT_communicator_disconnect (ch); ch = NULL; } diff --git a/src/transport/test_transport_api_cmd_simple_send.c b/src/transport/test_transport_api_cmd_simple_send.c index 13497366e..27b9f95de 100644 --- a/src/transport/test_transport_api_cmd_simple_send.c +++ b/src/transport/test_transport_api_cmd_simple_send.c @@ -29,6 +29,10 @@ #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 120) +/** + * Return value of the test. + * + */ static unsigned int rv = 0; @@ -42,19 +46,19 @@ static void run (void *cls) { struct GNUNET_TESTING_Command commands[] = { - GNUNET_TESTING_cmd_netjail_start ("netjail-start-1", + GNUNET_TESTING_cmd_netjail_start ("netjail-start", "2", "1"), - GNUNET_TESTING_cmd_netjail_start_testing_system ("netjail-start-testbed-1", + GNUNET_TESTING_cmd_netjail_start_testing_system ("netjail-start-testbed ", "2", "1", "libgnunet_test_transport_plugin_cmd_simple_send", &rv), GNUNET_TESTING_cmd_stop_testing_system ("stop-testbed", - "netjail-start-testbed-1", + "netjail-start-testbed ", "2", "1"), - GNUNET_TESTING_cmd_netjail_stop ("netjail-stop-1", + GNUNET_TESTING_cmd_netjail_stop ("netjail-stop ", "2", "1"), GNUNET_TESTING_cmd_end () diff --git a/src/transport/test_transport_plugin_cmd_simple_send.c b/src/transport/test_transport_plugin_cmd_simple_send.c index ac5c01075..4b5018b60 100644 --- a/src/transport/test_transport_plugin_cmd_simple_send.c +++ b/src/transport/test_transport_plugin_cmd_simple_send.c @@ -160,13 +160,6 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip, m, n); - /*testdir = GNUNET_malloc (strlen (BASE_DIR) + strlen (m) + strlen (n) - + 1); - - strcpy (testdir, BASE_DIR); - strcat (testdir, m); - strcat (testdir, n);*/ - struct GNUNET_MQ_MessageHandler handlers[] = { GNUNET_MQ_hd_var_size (test, GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE, diff --git a/src/transport/transport-testing-cmds.h b/src/transport/transport-testing-cmds.h index ece3b09a2..1461a3d4d 100644 --- a/src/transport/transport-testing-cmds.h +++ b/src/transport/transport-testing-cmds.h @@ -37,18 +37,20 @@ GNUNET_TRANSPORT_cmd_start_peer (const char *label, struct GNUNET_MQ_MessageHandler *handlers, const char *cfgname); +struct GNUNET_TESTING_Command +GNUNET_TRANSPORT_cmd_stop_peer (const char *label, + const char *start_label); + struct GNUNET_TESTING_Command GNUNET_TRANSPORT_cmd_connect_peers (const char *label, - const char *peer1_label, - const char *peer2_label); + const char *start_peer_label); struct GNUNET_TESTING_Command GNUNET_TRANSPORT_cmd_send_simple (const char *label, char *m, char *n, uint32_t num, - const char *peer1_label, - const char *peer2_label); + const char *start_peer_label); int GNUNET_TRANSPORT_get_trait_peer_id (const struct diff --git a/src/transport/transport_api_cmd_connecting_peers.c b/src/transport/transport_api_cmd_connecting_peers.c index d5c4a5d48..34b3d5925 100644 --- a/src/transport/transport_api_cmd_connecting_peers.c +++ b/src/transport/transport_api_cmd_connecting_peers.c @@ -36,16 +36,30 @@ */ #define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__) +/** + * Struct to store information needed in callbacks. + * + */ struct ConnectPeersState { - const char *peer1_label; - - const char *peer2_label; - + /** + * Label of the cmd to start a peer. + * + */ + const char *start_peer_label; + + /** + * The peer identity of this peer. + * + */ struct GNUNET_PeerIdentity *id; }; +/** + * The run method of this cmd will connect to peers. + * + */ static void connect_peers_run (void *cls, const struct GNUNET_TESTING_Command *cmd, @@ -53,47 +67,38 @@ connect_peers_run (void *cls, { struct ConnectPeersState *cps = cls; const struct GNUNET_TESTING_Command *peer1_cmd; - //const struct GNUNET_TESTING_Command *peer2_cmd; + // const struct GNUNET_TESTING_Command *peer2_cmd; struct GNUNET_TRANSPORT_ApplicationHandle *ah; struct GNUNET_PeerIdentity *peer = GNUNET_new (struct GNUNET_PeerIdentity); char *addr; - //struct GNUNET_TIME_Absolute t; + // struct GNUNET_TIME_Absolute t; char *hello; - //size_t *hello_size; + // size_t *hello_size; enum GNUNET_NetworkType nt = 0; char *peer_id; struct GNUNET_PeerIdentity *id; - peer1_cmd = GNUNET_TESTING_interpreter_lookup_command (cps->peer1_label); + peer1_cmd = GNUNET_TESTING_interpreter_lookup_command (cps->start_peer_label); GNUNET_TRANSPORT_get_trait_application_handle (peer1_cmd, &ah); GNUNET_TRANSPORT_get_trait_hello (peer1_cmd, &hello); - LOG (GNUNET_ERROR_TYPE_ERROR, - "hello: %s\n", - hello); - GNUNET_TRANSPORT_get_trait_peer_id (peer1_cmd, - &id); - LOG (GNUNET_ERROR_TYPE_ERROR, - "pid %s\n", - GNUNET_i2s_full(id)); + &id); - if(strstr(hello, "60002") != NULL) - { + if (strstr (hello, "60002") != NULL) + { addr = "tcp-192.168.15.2:60003"; peer_id = "F2F3X9G1YNCTXKK7A4J6M4ZM4BBSKC9DEXZVHCWQ475M0C7PNWCG"; - } + } else - { + { addr = "tcp-192.168.15.1:60002"; peer_id = "4TTC9WBSVP9RJT6DVEZ7E0TDW7TQXC11NR1EMR2F8ARS87WZ2730"; - } + } - LOG (GNUNET_ERROR_TYPE_ERROR, - "get pub key\n"); GNUNET_CRYPTO_eddsa_public_key_from_string (peer_id, strlen (peer_id), &peer->public_key); @@ -116,10 +121,9 @@ connect_peers_run (void *cls, &nt, &t);*/ - //---------------------------------------------- + // ---------------------------------------------- + - LOG (GNUNET_ERROR_TYPE_ERROR, - "application validate\n"); GNUNET_TRANSPORT_application_validate (ah, peer, nt, @@ -127,6 +131,10 @@ connect_peers_run (void *cls, } +/** + * The finish function of this cmd will check if the peer we are trying to connect to is in the connected peers map of the start peer cmd for this peer. + * + */ static int connect_peers_finish (void *cls, GNUNET_SCHEDULER_TaskCallback cont, @@ -140,36 +148,34 @@ connect_peers_finish (void *cls, struct GNUNET_HashCode hc; int node_number; - LOG (GNUNET_ERROR_TYPE_ERROR, - "Connect finished?\n"); - - peer1_cmd = GNUNET_TESTING_interpreter_lookup_command (cps->peer1_label); + peer1_cmd = GNUNET_TESTING_interpreter_lookup_command (cps->start_peer_label); GNUNET_TRANSPORT_get_trait_connected_peers_map (peer1_cmd, - &connected_peers_map); + &connected_peers_map); node_number = 1; - GNUNET_CRYPTO_hash (&node_number, sizeof(node_number), &hc); - + GNUNET_CRYPTO_hash (&node_number, sizeof(node_number), &hc); + // TODO we need to store with a key identifying the netns node in the future. For now we have only one connecting node. memcpy (key, &hc, sizeof (*key)); ret = GNUNET_CONTAINER_multishortmap_contains (connected_peers_map, - key); + key); if (GNUNET_YES == ret) { cont (cont_cls); - LOG (GNUNET_ERROR_TYPE_ERROR, - "connect peer finish\n"); } + GNUNET_free (key); return ret; - /*cont (cont_cls); - return GNUNET_OK;*/ } +/** + * Trait function of this cmd does nothing. + * + */ static int connect_peers_traits (void *cls, const void **ret, @@ -180,12 +186,17 @@ connect_peers_traits (void *cls, } +/** + * The cleanup function of this cmd frees resources the cmd allocated. + * + */ static void connect_peers_cleanup (void *cls, const struct GNUNET_TESTING_Command *cmd) { struct ConnectPeersState *cps = cls; + GNUNET_free (cps->id); GNUNET_free (cps); } @@ -194,18 +205,17 @@ connect_peers_cleanup (void *cls, * Create command. * * @param label name for command. + * @param start_peer_label Label of the cmd to start a peer. * @return command. */ struct GNUNET_TESTING_Command GNUNET_TRANSPORT_cmd_connect_peers (const char *label, - const char *peer1_label, - const char *peer2_label) + const char *start_peer_label) { struct ConnectPeersState *cps; cps = GNUNET_new (struct ConnectPeersState); - cps->peer1_label = peer1_label; - cps->peer2_label = peer2_label; + cps->start_peer_label = start_peer_label; struct GNUNET_TESTING_Command cmd = { diff --git a/src/transport/transport_api_cmd_send_simple.c b/src/transport/transport_api_cmd_send_simple.c index 6c4b76f48..f9e515c0f 100644 --- a/src/transport/transport_api_cmd_send_simple.c +++ b/src/transport/transport_api_cmd_send_simple.c @@ -29,19 +29,42 @@ #include "transport-testing2.h" #include "transport-testing-cmds.h" +/** + * Struct to hold information for callbacks. + * + */ struct SendSimpleState { + /** + * The number of the local node of the actual network namespace. + * + */ char *m; + /** + * The number of the actual namespace. + * + */ char *n; + /** + * Number globally identifying the node. + * + */ uint32_t num; - const char *peer1_label; - - const char *peer2_label; + /** + * Label of the cmd to start a peer. + * + */ + const char *start_peer_label; }; + +/** + * Trait function of this cmd does nothing. + * + */ static int send_simple_traits (void *cls, const void **ret, @@ -52,6 +75,10 @@ send_simple_traits (void *cls, } +/** + * The cleanup function of this cmd frees resources the cmd allocated. + * + */ static void send_simple_cleanup (void *cls, const struct GNUNET_TESTING_Command *cmd) @@ -62,6 +89,10 @@ send_simple_cleanup (void *cls, } +/** + * The run method of this cmd will send a simple message to the connected peer. + * + */ static void send_simple_run (void *cls, const struct GNUNET_TESTING_Command *cmd, @@ -72,14 +103,12 @@ send_simple_run (void *cls, struct GNUNET_TRANSPORT_TESTING_TestMessage *test; struct GNUNET_MQ_Handle *mq; struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map; - //struct GNUNET_PeerIdentity *id; const struct GNUNET_TESTING_Command *peer1_cmd; - //const struct GNUNET_TESTING_Command *peer2_cmd; struct GNUNET_ShortHashCode *key = GNUNET_new (struct GNUNET_ShortHashCode); struct GNUNET_HashCode hc; int node_number; - peer1_cmd = GNUNET_TESTING_interpreter_lookup_command (sss->peer1_label); + peer1_cmd = GNUNET_TESTING_interpreter_lookup_command (sss->start_peer_label); GNUNET_TRANSPORT_get_trait_connected_peers_map (peer1_cmd, &connected_peers_map); @@ -88,9 +117,9 @@ send_simple_run (void *cls, memcpy (key, &hc, sizeof (*key)); - + mq = GNUNET_CONTAINER_multishortmap_get (connected_peers_map, - key); + key); env = GNUNET_MQ_msg_extra (test, 2600 - sizeof(*test), @@ -99,12 +128,9 @@ send_simple_run (void *cls, memset (&test[1], sss->num, 2600 - sizeof(*test)); - /*GNUNET_MQ_notify_sent (env, - cont, - cont_cls);*/ GNUNET_MQ_send (mq, env); - + GNUNET_free (key); } @@ -113,15 +139,18 @@ send_simple_run (void *cls, * Create command. * * @param label name for command. + * @param m The number of the local node of the actual network namespace. + * @param n The number of the actual namespace. + * @param num Number globally identifying the node. + * @param start_peer_label Label of the cmd to start a peer. * @return command. */ struct GNUNET_TESTING_Command GNUNET_TRANSPORT_cmd_send_simple (const char *label, - char *m, - char *n, - uint32_t num, - const char *peer1_label, - const char *peer2_label) + char *m, + char *n, + uint32_t num, + const char *start_peer_label) { struct SendSimpleState *sss; @@ -129,7 +158,7 @@ GNUNET_TRANSPORT_cmd_send_simple (const char *label, sss->m = m; sss->n = n; sss->num = num; - sss->peer1_label = peer1_label; + sss->start_peer_label = start_peer_label; struct GNUNET_TESTING_Command cmd = { .cls = sss, diff --git a/src/transport/transport_api_cmd_start_peer.c b/src/transport/transport_api_cmd_start_peer.c index 8696a99dc..9277bc346 100644 --- a/src/transport/transport_api_cmd_start_peer.c +++ b/src/transport/transport_api_cmd_start_peer.c @@ -29,93 +29,22 @@ #include "gnunet_peerstore_service.h" #include "gnunet_transport_core_service.h" #include "gnunet_transport_application_service.h" +#include "transport-testing-ng.h" /** * Generic logging shortcut */ #define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__) -struct StartPeerState -{ - /** - * Receive callback - */ - struct GNUNET_MQ_MessageHandler *handlers; - - const char *cfgname; - - /** - * Peer's configuration - */ - struct GNUNET_CONFIGURATION_Handle *cfg; - - struct GNUNET_TESTING_Peer *peer; - - /** - * Peer identity - */ - struct GNUNET_PeerIdentity id; - - /** - * Peer's transport service handle - */ - struct GNUNET_TRANSPORT_CoreHandle *th; - - /** - * Application handle - */ - struct GNUNET_TRANSPORT_ApplicationHandle *ah; - - /** - * Peer's PEERSTORE Handle - */ - struct GNUNET_PEERSTORE_Handle *ph; - - /** - * Hello get task - */ - struct GNUNET_SCHEDULER_Task *rh_task; - - /** - * Peer's transport get hello handle to retrieve peer's HELLO message - */ - struct GNUNET_PEERSTORE_IterateContext *pic; - - /** - * Hello - */ - char *hello; - - /** - * Hello size - */ - size_t hello_size; - - char *m; - - char *n; - - char *local_m; - - unsigned int finished; - - const char *system_label; - - /** - * An unique number to identify the peer - */ - unsigned int no; - - struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map; - - struct GNUNET_TESTING_System *tl_system; - -}; - static void retrieve_hello (void *cls); + +/** + * Callback delivering the hello of this peer from peerstore. + * + */ static void hello_iter_cb (void *cb_cls, const struct GNUNET_PEERSTORE_Record *record, @@ -140,6 +69,11 @@ hello_iter_cb (void *cb_cls, } + +/** + * Function to start the retrival task to retrieve the hello of this peer from the peerstore. + * + */ static void retrieve_hello (void *cls) { @@ -154,6 +88,11 @@ retrieve_hello (void *cls) } + +/** + * This function checks StartPeerState#finished, which is set when the hello was retrieved. + * + */ static int start_peer_finish (void *cls, GNUNET_SCHEDULER_TaskCallback cont, @@ -170,6 +109,10 @@ start_peer_finish (void *cls, } +/** + * Disconnect callback for the connection to the core service. + * + */ static void notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer, @@ -186,6 +129,10 @@ notify_disconnect (void *cls, } +/** + * Connect callback for the connection to the core service. + * + */ static void * notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer, @@ -206,23 +153,27 @@ notify_connect (void *cls, GNUNET_i2s (&sps->id)); // TODO we need to store with a key identifying the netns node in the future. For now we have only one connecting node. - node_number = 1; - GNUNET_CRYPTO_hash (&node_number, sizeof(node_number), &hc); - + node_number = 1; + GNUNET_CRYPTO_hash (&node_number, sizeof(node_number), &hc); + memcpy (key, &hc, sizeof (*key)); GNUNET_CONTAINER_multishortmap_put (sps->connected_peers_map, - key, - mq, - GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); + key, + mq, + GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); + GNUNET_free (key); // TODO what does the handler function need? return ret; } - +/** + * The run method of this cmd will start all services of a peer to test the transport service. + * + */ static void start_peer_run (void *cls, const struct GNUNET_TESTING_Command *cmd, @@ -234,9 +185,6 @@ start_peer_run (void *cls, const struct GNUNET_TESTING_Command *system_cmd; struct GNUNET_TESTING_System *tl_system; - LOG (GNUNET_ERROR_TYPE_ERROR, - "start peer 1\n"); - if (GNUNET_NO == GNUNET_DISK_file_test (sps->cfgname)) { LOG (GNUNET_ERROR_TYPE_ERROR, @@ -269,8 +217,6 @@ start_peer_run (void *cls, return; } - LOG (GNUNET_ERROR_TYPE_ERROR, - "start peer 2\n"); sps->peer = GNUNET_TESTING_peer_configure (sps->tl_system, sps->cfg, sps->no, @@ -287,8 +233,6 @@ start_peer_run (void *cls, return; } - LOG (GNUNET_ERROR_TYPE_ERROR, - "start peer 3\n"); if (GNUNET_OK != GNUNET_TESTING_peer_start (sps->peer)) { LOG (GNUNET_ERROR_TYPE_ERROR, @@ -298,17 +242,14 @@ start_peer_run (void *cls, GNUNET_TESTING_interpreter_fail (); return; } -LOG (GNUNET_ERROR_TYPE_ERROR, - "start peer 4\n"); + memset (&dummy, '\0', sizeof(dummy)); - LOG (GNUNET_ERROR_TYPE_ERROR, - "start peer 4.1\n"); + GNUNET_TESTING_peer_get_identity (sps->peer, &sps->id); - LOG (GNUNET_ERROR_TYPE_ERROR, - "start peer 4.2\n"); + if (0 == memcmp (&dummy, &sps->id, sizeof(struct GNUNET_PeerIdentity))) @@ -324,8 +265,7 @@ LOG (GNUNET_ERROR_TYPE_ERROR, "Peer %u configured with identity `%s'\n", sps->no, GNUNET_i2s_full (&sps->id)); - LOG (GNUNET_ERROR_TYPE_ERROR, - "start peer 4.3\n"); + sps->th = GNUNET_TRANSPORT_core_connect (sps->cfg, NULL, sps->handlers, @@ -342,8 +282,7 @@ LOG (GNUNET_ERROR_TYPE_ERROR, GNUNET_TESTING_interpreter_fail (); return; } - LOG (GNUNET_ERROR_TYPE_ERROR, - "start peer 5\n"); + sps->ph = GNUNET_PEERSTORE_connect (sps->cfg); if (NULL == sps->th) { @@ -355,8 +294,7 @@ LOG (GNUNET_ERROR_TYPE_ERROR, GNUNET_TESTING_interpreter_fail (); return; } - LOG (GNUNET_ERROR_TYPE_ERROR, - "start peer 6\n"); + sps->ah = GNUNET_TRANSPORT_application_init (sps->cfg); if (NULL == sps->ah) { @@ -371,28 +309,16 @@ LOG (GNUNET_ERROR_TYPE_ERROR, sps->rh_task = GNUNET_SCHEDULER_add_now (retrieve_hello, sps); } - +/** + * The cleanup function of this cmd frees resources the cmd allocated. + * + */ static void start_peer_cleanup (void *cls, const struct GNUNET_TESTING_Command *cmd) { struct StartPeerState *sps = cls; - if (NULL != sps->rh_task) - GNUNET_SCHEDULER_cancel (sps->rh_task); - sps->rh_task = NULL; - if (NULL != sps->ah) - { - GNUNET_TRANSPORT_application_done (sps->ah); - sps->ah = NULL; - } - if (NULL != sps->ph) - { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Disconnecting from PEERSTORE service\n"); - GNUNET_PEERSTORE_disconnect (sps->ph, GNUNET_NO); - sps->ph = NULL; - } if (NULL != sps->handlers) { GNUNET_free (sps->handlers); @@ -403,34 +329,16 @@ start_peer_cleanup (void *cls, GNUNET_CONFIGURATION_destroy (sps->cfg); sps->cfg = NULL; } - if (NULL != sps->peer) - { - if (GNUNET_OK != - GNUNET_TESTING_peer_stop (sps->peer)) - { - LOG (GNUNET_ERROR_TYPE_DEBUG, - "Testing lib failed to stop peer %u (`%s')\n", - sps->no, - GNUNET_i2s (&sps->id)); - } - GNUNET_TESTING_peer_destroy (sps->peer); - sps->peer = NULL; - } - if (NULL != sps->th) - { - GNUNET_TRANSPORT_core_disconnect (sps->th); - sps->th = NULL; - } - if (NULL != sps->tl_system) - { - GNUNET_free (sps->tl_system); - } GNUNET_free (sps->hello); GNUNET_free (sps->connected_peers_map); GNUNET_free (sps); } +/** + * This function prepares an array with traits. + * + */ static int start_peer_traits (void *cls, const void **ret, @@ -472,6 +380,11 @@ start_peer_traits (void *cls, .trait_name = "hello_size", .ptr = (const void *) hello_size, }, + { + .index = 5, + .trait_name = "state", + .ptr = (const void *) sps, + }, GNUNET_TESTING_trait_end () }; @@ -481,6 +394,34 @@ start_peer_traits (void *cls, index); } + +/** + * Function to get the trait with the struct StartPeerState. + * + * @param[out] sps struct StartPeerState. + * @return #GNUNET_OK if no error occurred, #GNUNET_SYSERR otherwise. + * + */ +int +GNUNET_TRANSPORT_get_trait_state (const struct + GNUNET_TESTING_Command + *cmd, + struct StartPeerState **sps) +{ + return cmd->traits (cmd->cls, + (const void **) sps, + "state", + (unsigned int) 5); +} + + +/** + * Function to get the trait with the size of the hello. + * + * @param[out] hello_size size of hello. + * @return #GNUNET_OK if no error occurred, #GNUNET_SYSERR otherwise. + * + */ int GNUNET_TRANSPORT_get_trait_hello_size (const struct GNUNET_TESTING_Command @@ -493,6 +434,13 @@ GNUNET_TRANSPORT_get_trait_hello_size (const struct (unsigned int) 4); } +/** + * Function to get the trait with the hello. + * + * @param[out] hello The hello for the peer. + * @return #GNUNET_OK if no error occurred, #GNUNET_SYSERR otherwise. + * + */ int GNUNET_TRANSPORT_get_trait_hello (const struct GNUNET_TESTING_Command @@ -505,12 +453,21 @@ GNUNET_TRANSPORT_get_trait_hello (const struct (unsigned int) 3); } + +/** + * Function to get the trait with the map of connected peers. + * + * @param[out] connected_peers_map The map with connected peers. + * @return #GNUNET_OK if no error occurred, #GNUNET_SYSERR otherwise. + * + */ int GNUNET_TRANSPORT_get_trait_connected_peers_map (const struct GNUNET_TESTING_Command *cmd, struct - GNUNET_CONTAINER_MultiShortmap ** + GNUNET_CONTAINER_MultiShortmap * + * connected_peers_map) { return cmd->traits (cmd->cls, @@ -520,6 +477,12 @@ GNUNET_TRANSPORT_get_trait_connected_peers_map (const struct } +/** + * Function to get the trait with the transport application handle. + * + * @param[out] ah The application handle. + * @return #GNUNET_OK if no error occurred, #GNUNET_SYSERR otherwise. + */ int GNUNET_TRANSPORT_get_trait_application_handle (const struct GNUNET_TESTING_Command *cmd, @@ -534,6 +497,12 @@ GNUNET_TRANSPORT_get_trait_application_handle (const struct } +/** + * Function to get the trait with the peer id. + * + * @param[out] id The peer id. + * @return #GNUNET_OK if no error occurred, #GNUNET_SYSERR otherwise. + */ int GNUNET_TRANSPORT_get_trait_peer_id (const struct GNUNET_TESTING_Command *cmd, @@ -550,6 +519,12 @@ GNUNET_TRANSPORT_get_trait_peer_id (const struct * Create command. * * @param label name for command. + * @param system_label Label of the cmd to setup a test environment. + * @param m The number of the local node of the actual network namespace. + * @param n The number of the actual namespace. + * @param local_m Number of local nodes in each namespace. + * @param handlers Handler for messages received by this peer. + * @param cfgname Configuration file name for this peer. * @return command. */ struct GNUNET_TESTING_Command @@ -566,10 +541,6 @@ GNUNET_TRANSPORT_cmd_start_peer (const char *label, GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO); unsigned int i; - LOG (GNUNET_ERROR_TYPE_ERROR, - "start peer 0.1 with cfg: %s\n", - cfgname); - sps = GNUNET_new (struct StartPeerState); sps->m = m; sps->n = n; @@ -579,9 +550,6 @@ GNUNET_TRANSPORT_cmd_start_peer (const char *label, sps->connected_peers_map = connected_peers_map; sps->cfgname = cfgname; - LOG (GNUNET_ERROR_TYPE_ERROR, - "start peer 0.2\n"); - if (NULL != handlers) { for (i = 0; NULL != handlers[i].cb; i++) @@ -593,8 +561,6 @@ GNUNET_TRANSPORT_cmd_start_peer (const char *label, i * sizeof(struct GNUNET_MQ_MessageHandler)); } - LOG (GNUNET_ERROR_TYPE_ERROR, - "start peer 0.3\n"); struct GNUNET_TESTING_Command cmd = { .cls = sps, .label = label, diff --git a/src/transport/transport_api_cmd_stop_peer.c b/src/transport/transport_api_cmd_stop_peer.c index 2277520ec..7a0050a63 100644 --- a/src/transport/transport_api_cmd_stop_peer.c +++ b/src/transport/transport_api_cmd_stop_peer.c @@ -92,7 +92,7 @@ stop_peer_run (void *cls, if (GNUNET_OK != GNUNET_TESTING_peer_stop (sps->peer)) { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_ERROR, "Testing lib failed to stop peer %u (`%s')\n", sps->no, GNUNET_i2s (&sps->id)); -- cgit v1.2.3 From 5bb46d9a3ab568145f594c5a3cfa31ead3df38eb Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 24 Aug 2021 15:21:32 +0200 Subject: -remove dead ats-tests, fix strange Debian build issues --- configure.ac | 3 +- contrib/Makefile.inc | 3 +- debian/changelog | 7 + debian/control | 1 + debian/rules | 4 +- po/POTFILES.in | 3 +- src/Makefile.am | 2 - src/ats-tests/.gitignore | 14 - src/ats-tests/Makefile.am | 170 ---- src/ats-tests/ats-testing-experiment.c | 820 ---------------- src/ats-tests/ats-testing-log.c | 979 ------------------- src/ats-tests/ats-testing-preferences.c | 265 ----- src/ats-tests/ats-testing-traffic.c | 393 -------- src/ats-tests/ats-testing.c | 975 ------------------- src/ats-tests/ats-testing.h | 757 --------------- .../evaluation1_dru_3_peers_1addr_1scope_prop.conf | 24 - .../evaluation1_dru_3_peers_1addr_1scope_prop.exp | 46 - src/ats-tests/experiments/send_linear_10_sec.exp | 30 - src/ats-tests/experiments/test.exp | 55 -- src/ats-tests/gnunet-ats-sim.c | 399 -------- src/ats-tests/gnunet-solver-eval.c | 1025 -------------------- src/ats-tests/gnunet_ats_sim_default.conf | 6 - src/ats-tests/perf_ats.c | 601 ------------ src/ats-tests/perf_ats.h | 256 ----- src/ats-tests/perf_ats_logging.c | 780 --------------- src/ats-tests/perf_ats_proportional_bandwidth.conf | 4 - src/ats-tests/perf_ats_proportional_latency.conf | 4 - src/ats-tests/perf_ats_proportional_none.conf | 4 - src/ats-tests/template_perf_ats.conf | 52 - src/block/Makefile.am | 13 - src/dns/Makefile.am | 6 - src/fs/Makefile.am | 4 - src/gnsrecord/Makefile.am | 2 - src/peerinfo-tool/Makefile.am | 8 - src/reclaim/Makefile.am | 13 - src/regex/Makefile.am | 3 - src/revocation/Makefile.am | 5 - src/testbed/Makefile.am | 6 - src/testing/Makefile.am | 3 - .../testing_api_cmd_netjail_start_testsystem.c | 11 +- .../testing_api_cmd_netjail_stop_testsystem.c | 5 +- src/transport/Makefile.am | 29 +- src/transport/transport_api_cmd_start_peer.c | 7 +- src/util/Makefile.am | 2 - 44 files changed, 44 insertions(+), 7755 deletions(-) delete mode 100644 src/ats-tests/.gitignore delete mode 100644 src/ats-tests/Makefile.am delete mode 100644 src/ats-tests/ats-testing-experiment.c delete mode 100644 src/ats-tests/ats-testing-log.c delete mode 100644 src/ats-tests/ats-testing-preferences.c delete mode 100644 src/ats-tests/ats-testing-traffic.c delete mode 100644 src/ats-tests/ats-testing.c delete mode 100644 src/ats-tests/ats-testing.h delete mode 100644 src/ats-tests/experiments/evaluation1_dru_3_peers_1addr_1scope_prop.conf delete mode 100644 src/ats-tests/experiments/evaluation1_dru_3_peers_1addr_1scope_prop.exp delete mode 100644 src/ats-tests/experiments/send_linear_10_sec.exp delete mode 100644 src/ats-tests/experiments/test.exp delete mode 100644 src/ats-tests/gnunet-ats-sim.c delete mode 100644 src/ats-tests/gnunet-solver-eval.c delete mode 100644 src/ats-tests/gnunet_ats_sim_default.conf delete mode 100644 src/ats-tests/perf_ats.c delete mode 100644 src/ats-tests/perf_ats.h delete mode 100644 src/ats-tests/perf_ats_logging.c delete mode 100644 src/ats-tests/perf_ats_proportional_bandwidth.conf delete mode 100644 src/ats-tests/perf_ats_proportional_latency.conf delete mode 100644 src/ats-tests/perf_ats_proportional_none.conf delete mode 100644 src/ats-tests/template_perf_ats.conf (limited to 'src') diff --git a/configure.ac b/configure.ac index 3b66a368e..945a0a23d 100644 --- a/configure.ac +++ b/configure.ac @@ -21,7 +21,7 @@ # AC_PREREQ([2.69]) # Checks for programs. -AC_INIT([gnunet],[0.15.1],[bug-gnunet@gnu.org]) +AC_INIT([gnunet],[0.15.2],[bug-gnunet@gnu.org]) AC_CONFIG_AUX_DIR([build-aux]) # check for legacy option that is no longer supported (#5627) and fail hard @@ -1921,7 +1921,6 @@ src/arm/arm.conf src/ats/Makefile src/ats/ats.conf src/ats-tool/Makefile -src/ats-tests/Makefile src/auction/Makefile src/block/Makefile src/cadet/Makefile diff --git a/contrib/Makefile.inc b/contrib/Makefile.inc index a563ef4a1..c737a07f8 100644 --- a/contrib/Makefile.inc +++ b/contrib/Makefile.inc @@ -8,8 +8,7 @@ BUILDCOMMON_SHLIB_FILES = \ build-common/sh/lib.sh/existence_python.sh \ build-common/sh/lib.sh/msg.sh \ build-common/sh/lib.sh/progname.sh \ - build-common/sh/lib.sh/version_gnunet.sh \ - build-common/LICENSE + build-common/sh/lib.sh/version_gnunet.sh BUILDCOMMON_CONF_FILES = \ build-common/conf/.dir-locals.el \ diff --git a/debian/changelog b/debian/changelog index c20964fa2..21a78fb2e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +gnunet (0.15.2) unstable; urgency=low + + * New upstream release, bumping version. + * Fixes linker issues. Very strange that Debian insists on explicit indirect dependencies for plugins. + + -- Christian Grothoff Tue, 24 Aug 2021 21:14:18 +0200 + gnunet (0.15.1) unstable; urgency=low * New upstream release, bumping version. diff --git a/debian/control b/debian/control index 57acc6e1e..362cf1b2a 100644 --- a/debian/control +++ b/debian/control @@ -95,6 +95,7 @@ Section: libdevel Architecture: any Depends: libgnunet (= ${binary:Version}), + gnunet (= ${binary:Version}), libextractor-dev (>=1:0.6.3), libgcrypt20-dev (>=1.6), libmicrohttpd-dev (>=0.9.33), diff --git a/debian/rules b/debian/rules index 69f44aa80..b8d577405 100755 --- a/debian/rules +++ b/debian/rules @@ -46,7 +46,9 @@ override_dh_auto_clean: rm -rf contrib/gnunet_janitor.py contrib/gnunet_pyexpect.py libltdl/ \ src/integration-tests/*.py -# Remove files already present in libgnunet from main gnunet package +# Remove files already present in libgnunet from main gnunet package and libgnunet-dev package override_dh_install: dh_install cd debian/libgnunet; find . -type f,l -exec rm -f ../gnunet/{} \; + cd debian/libgnunet; find . -type f,l -exec rm -f ../libgnunet-dev/{} \; + cd debian/gnunet; find . -type f,l -exec rm -f ../libgnunet-dev/{} \; diff --git a/po/POTFILES.in b/po/POTFILES.in index 00ca933da..e6aa9f39b 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -415,7 +415,6 @@ src/testbed/gnunet_mpi_test.c src/testbed/gnunet_testbed_mpi_spawn.c src/testbed/testbed_api.c src/testbed/testbed_api_barriers.c -src/testbed/testbed_api_cmd_netjail_start_testbed.c src/testbed/testbed_api_hosts.c src/testbed/testbed_api_operations.c src/testbed/testbed_api_peers.c @@ -441,6 +440,7 @@ src/testing/testing_api_cmd_netjail_stop.c src/testing/testing_api_cmd_netjail_stop_testsystem.c src/testing/testing_api_cmd_send_peer_ready.c src/testing/testing_api_cmd_system_create.c +src/testing/testing_api_cmd_system_destroy.c src/testing/testing_api_loop.c src/testing/testing_api_trait_cmd.c src/testing/testing_api_trait_process.c @@ -499,6 +499,7 @@ src/transport/transport_api_blacklist.c src/transport/transport_api_cmd_connecting_peers.c src/transport/transport_api_cmd_send_simple.c src/transport/transport_api_cmd_start_peer.c +src/transport/transport_api_cmd_stop_peer.c src/transport/transport_api_core.c src/transport/transport_api_hello_get.c src/transport/transport_api_manipulation.c diff --git a/src/Makefile.am b/src/Makefile.am index 5df85f9db..ef8c5b110 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,7 +3,6 @@ if HAVE_TESTING TESTING = testing TESTBED = testbed-logger testbed - ATS_TESTS = ats-tests endif if HAVE_EXPERIMENTAL @@ -72,7 +71,6 @@ SUBDIRS = \ ats-tool \ core \ $(TESTBED) \ - $(ATS_TESTS) \ nse \ dhtu \ dht \ diff --git a/src/ats-tests/.gitignore b/src/ats-tests/.gitignore deleted file mode 100644 index 5e15db496..000000000 --- a/src/ats-tests/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -gnunet-solver-eval -gnunet-ats-sim -perf_ats_proportional_core_bandwidth -perf_ats_proportional_core_latency -perf_ats_proportional_core_none -perf_ats_proportional_transport_bandwidth -perf_ats_proportional_transport_latency -perf_ats_proportional_transport_none -perf_ats_mlp_core_bandwidth -perf_ats_mlp_core_latency -perf_ats_mlp_core_none -perf_ats_mlp_transport_bandwidth -perf_ats_mlp_transport_latency -perf_ats_mlp_transport_none diff --git a/src/ats-tests/Makefile.am b/src/ats-tests/Makefile.am deleted file mode 100644 index d515d3e17..000000000 --- a/src/ats-tests/Makefile.am +++ /dev/null @@ -1,170 +0,0 @@ -#t This Makefile.am is in the public domain -AM_CPPFLAGS = -I$(top_srcdir)/src/include - -pkgcfgdir= $(pkgdatadir)/config.d/ - -libexecdir= $(pkglibdir)/libexec/ - -if USE_COVERAGE - AM_CFLAGS = -fprofile-arcs -ftest-coverage -endif - -if HAVE_TESTING -TESTING_TESTS = \ - perf_ats_proportional_transport_none \ - perf_ats_proportional_transport_bandwidth \ - perf_ats_proportional_transport_latency \ - perf_ats_proportional_core_none \ - perf_ats_proportional_core_bandwidth \ - perf_ats_proportional_core_latency \ - $(PERF_MLP) - -endif - -lib_LTLIBRARIES = \ - libgnunetatstesting.la - -check_PROGRAMS = \ - $(TESTING_TESTS) - -if ENABLE_TEST_RUN -AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; -TESTS = $(check_PROGRAMS) -endif - -noinst_PROGRAMS = \ - gnunet-ats-sim gnunet-solver-eval - -libgnunetatstesting_la_SOURCES = \ - ats-testing.c ats-testing.h \ - ats-testing-log.c ats-testing-traffic.c \ - ats-testing-experiment.c ats-testing-preferences.c -libgnunetatstesting_la_LIBADD = \ - $(top_builddir)/src/testbed/libgnunettestbed.la \ - $(top_builddir)/src/testing/libgnunettesting.la \ - $(top_builddir)/src/statistics/libgnunetstatistics.la \ - $(top_builddir)/src/core/libgnunetcore.la \ - $(top_builddir)/src/transport/libgnunettransport.la \ - $(top_builddir)/src/hello/libgnunethello.la \ - $(top_builddir)/src/ats/libgnunetats.la \ - $(top_builddir)/src/arm/libgnunetarm.la \ - $(top_builddir)/src/util/libgnunetutil.la \ - $(GN_LIBINTL) -libgnunetatstesting_la_DEPENDENCIES = \ - $(top_builddir)/src/testbed/libgnunettestbed.la \ - $(top_builddir)/src/ats/libgnunetats.la -libgnunetatstesting_la_LDFLAGS = \ - $(GN_LIB_LDFLAGS) - -gnunet_ats_sim_SOURCES = \ - gnunet-ats-sim.c -gnunet_ats_sim_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la \ - $(top_builddir)/src/ats-tests/libgnunetatstesting.la \ - $(top_builddir)/src/testing/libgnunettesting.la \ - $(top_builddir)/src/testbed/libgnunettestbed.la \ - $(top_builddir)/src/ats/libgnunetats.la \ - $(top_builddir)/src/core/libgnunetcore.la \ - $(top_builddir)/src/transport/libgnunettransport.la -gnunet_ats_sim_DEPENDENCIES = \ - libgnunetatstesting.la \ - $(top_builddir)/src/util/libgnunetutil.la -gnunet_ats_sim_LDFLAGS = \ - $(GN_LIBINTL) - - -gnunet_solver_eval_SOURCES = \ - gnunet-solver-eval.c -gnunet_solver_eval_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la \ - $(top_builddir)/src/ats/libgnunetats.la \ - $(top_builddir)/src/core/libgnunetcore.la \ - $(top_builddir)/src/transport/libgnunettransport.la -gnunet_solver_eval_DEPENDENCIES = \ - $(top_builddir)/src/util/libgnunetutil.la -gnunet_solver_eval_LDFLAGS = \ - $(GN_LIBINTL) - -perf_ats_proportional_core_none_SOURCES = \ - perf_ats.c -perf_ats_proportional_core_none_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la \ - $(top_builddir)/src/ats-tests/libgnunetatstesting.la \ - $(top_builddir)/src/testbed/libgnunettestbed.la \ - $(top_builddir)/src/ats/libgnunetats.la \ - $(top_builddir)/src/core/libgnunetcore.la \ - $(top_builddir)/src/transport/libgnunettransport.la -perf_ats_proportional_core_none_DEPENDENCIES = \ - libgnunetatstesting.la \ - $(top_builddir)/src/util/libgnunetutil.la - -perf_ats_proportional_transport_none_SOURCES = \ - perf_ats.c -perf_ats_proportional_transport_none_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la \ - $(top_builddir)/src/ats-tests/libgnunetatstesting.la \ - $(top_builddir)/src/testbed/libgnunettestbed.la \ - $(top_builddir)/src/ats/libgnunetats.la \ - $(top_builddir)/src/core/libgnunetcore.la \ - $(top_builddir)/src/transport/libgnunettransport.la -perf_ats_proportional_transport_none_DEPENDENCIES = \ - libgnunetatstesting.la \ - $(top_builddir)/src/util/libgnunetutil.la - -perf_ats_proportional_core_bandwidth_SOURCES = \ - perf_ats.c -perf_ats_proportional_core_bandwidth_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la \ - $(top_builddir)/src/ats-tests/libgnunetatstesting.la \ - $(top_builddir)/src/testbed/libgnunettestbed.la \ - $(top_builddir)/src/ats/libgnunetats.la \ - $(top_builddir)/src/core/libgnunetcore.la \ - $(top_builddir)/src/transport/libgnunettransport.la -perf_ats_proportional_core_bandwidth_DEPENDENCIES = \ - libgnunetatstesting.la \ - $(top_builddir)/src/util/libgnunetutil.la - -perf_ats_proportional_transport_bandwidth_SOURCES = \ - perf_ats.c -perf_ats_proportional_transport_bandwidth_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la \ - $(top_builddir)/src/ats-tests/libgnunetatstesting.la \ - $(top_builddir)/src/testbed/libgnunettestbed.la \ - $(top_builddir)/src/ats/libgnunetats.la \ - $(top_builddir)/src/core/libgnunetcore.la \ - $(top_builddir)/src/transport/libgnunettransport.la -perf_ats_proportional_transport_bandwidth_DEPENDENCIES = \ - libgnunetatstesting.la \ - $(top_builddir)/src/util/libgnunetutil.la - -perf_ats_proportional_core_latency_SOURCES = \ - perf_ats.c -perf_ats_proportional_core_latency_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la \ - $(top_builddir)/src/ats-tests/libgnunetatstesting.la \ - $(top_builddir)/src/testbed/libgnunettestbed.la \ - $(top_builddir)/src/ats/libgnunetats.la \ - $(top_builddir)/src/core/libgnunetcore.la \ - $(top_builddir)/src/transport/libgnunettransport.la -perf_ats_proportional_core_latency_DEPENDENCIES = \ - libgnunetatstesting.la \ - $(top_builddir)/src/util/libgnunetutil.la - -perf_ats_proportional_transport_latency_SOURCES = \ - perf_ats.c -perf_ats_proportional_transport_latency_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la \ - $(top_builddir)/src/ats-tests/libgnunetatstesting.la \ - $(top_builddir)/src/testbed/libgnunettestbed.la \ - $(top_builddir)/src/ats/libgnunetats.la \ - $(top_builddir)/src/core/libgnunetcore.la \ - $(top_builddir)/src/transport/libgnunettransport.la -perf_ats_proportional_transport_latency_DEPENDENCIES = \ - libgnunetatstesting.la \ - $(top_builddir)/src/util/libgnunetutil.la - -EXTRA_DIST = \ - gnunet_ats_sim_default.conf \ - perf_ats_proportional_none.conf \ - perf_ats_proportional_bandwidth.conf \ - perf_ats_proportional_latency.conf diff --git a/src/ats-tests/ats-testing-experiment.c b/src/ats-tests/ats-testing-experiment.c deleted file mode 100644 index 9f8db1be4..000000000 --- a/src/ats-tests/ats-testing-experiment.c +++ /dev/null @@ -1,820 +0,0 @@ -/* - This file is part of GNUnet. - Copyright (C) 2010-2013 GNUnet e.V. - - GNUnet is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - GNUnet 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 - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - - SPDX-License-Identifier: AGPL3.0-or-later - */ -/** - * @file ats-tests/ats-testing-experiment.c - * @brief ats benchmark: controlled experiment execution - * @author Christian Grothoff - * @author Matthias Wachs - */ -#include "platform.h" -#include "gnunet_util_lib.h" -#include "ats-testing.h" - -const char * -print_op (enum OperationType op) -{ - switch (op) - { - case START_SEND: - return "START_SEND"; - - case STOP_SEND: - return "STOP_SEND"; - - case START_PREFERENCE: - return "START_PREFERENCE"; - - case STOP_PREFERENCE: - return "STOP_PREFERENCE"; - - default: - break; - } - return ""; -} - - -static struct Experiment * -create_experiment () -{ - struct Experiment *e; - - e = GNUNET_new (struct Experiment); - e->name = NULL; - e->num_masters = 0; - e->num_slaves = 0; - e->start = NULL; - e->total_duration = GNUNET_TIME_UNIT_ZERO; - return e; -} - - -static void -free_experiment (struct Experiment *e) -{ - struct Episode *cur; - struct Episode *next; - struct GNUNET_ATS_TEST_Operation *cur_o; - struct GNUNET_ATS_TEST_Operation *next_o; - - next = e->start; - for (cur = next; NULL != cur; cur = next) - { - next = cur->next; - - next_o = cur->head; - for (cur_o = next_o; NULL != cur_o; cur_o = next_o) - { - next_o = cur_o->next; - GNUNET_free (cur_o); - } - GNUNET_free (cur); - } - - GNUNET_free (e->name); - GNUNET_free (e->cfg_file); - GNUNET_free (e); -} - - -static int -load_episode (struct Experiment *e, - struct Episode *cur, - struct GNUNET_CONFIGURATION_Handle *cfg) -{ - struct GNUNET_ATS_TEST_Operation *o; - char *sec_name; - char *op_name; - char *op; - char *type; - char *pref; - int op_counter = 0; - - fprintf (stderr, "Parsing episode %u\n", cur->id); - GNUNET_asprintf (&sec_name, "episode-%u", cur->id); - - while (1) - { - /* Load operation */ - GNUNET_asprintf (&op_name, "op-%u-operation", op_counter); - if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg, - sec_name, - op_name, &op)) - { - GNUNET_free (op_name); - break; - } - o = GNUNET_new (struct GNUNET_ATS_TEST_Operation); - /* operations = set_rate, start_send, stop_send, set_preference */ - if (0 == strcmp (op, "start_send")) - { - o->type = START_SEND; - } - else if (0 == strcmp (op, "stop_send")) - { - o->type = STOP_SEND; - } - else if (0 == strcmp (op, "start_preference")) - { - o->type = START_PREFERENCE; - } - else if (0 == strcmp (op, "stop_preference")) - { - o->type = STOP_PREFERENCE; - } - else - { - fprintf (stderr, "Invalid operation %u `%s' in episode %u\n", - op_counter, op, cur->id); - GNUNET_free (op); - GNUNET_free (op_name); - GNUNET_free (o); - GNUNET_free (sec_name); - return GNUNET_SYSERR; - } - GNUNET_free (op_name); - - /* Get source */ - GNUNET_asprintf (&op_name, "op-%u-src", op_counter); - if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg, - sec_name, - op_name, - &o->src_id)) - { - fprintf (stderr, "Missing src in operation %u `%s' in episode %u\n", - op_counter, op, cur->id); - GNUNET_free (op); - GNUNET_free (op_name); - GNUNET_free (o); - GNUNET_free (sec_name); - return GNUNET_SYSERR; - } - if (o->src_id > (e->num_masters - 1)) - { - fprintf (stderr, "Invalid src %llu in operation %u `%s' in episode %u\n", - o->src_id, op_counter, op, cur->id); - GNUNET_free (op); - GNUNET_free (op_name); - GNUNET_free (o); - GNUNET_free (sec_name); - return GNUNET_SYSERR; - } - GNUNET_free (op_name); - - /* Get destination */ - GNUNET_asprintf (&op_name, "op-%u-dest", op_counter); - if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg, - sec_name, - op_name, - &o->dest_id)) - { - fprintf (stderr, "Missing src in operation %u `%s' in episode %u\n", - op_counter, op, cur->id); - GNUNET_free (op); - GNUNET_free (op_name); - GNUNET_free (o); - GNUNET_free (sec_name); - return GNUNET_SYSERR; - } - if (o->dest_id > (e->num_slaves - 1)) - { - fprintf (stderr, - "Invalid destination %llu in operation %u `%s' in episode %u\n", - o->dest_id, op_counter, op, cur->id); - GNUNET_free (op); - GNUNET_free (op_name); - GNUNET_free (o); - GNUNET_free (sec_name); - return GNUNET_SYSERR; - } - GNUNET_free (op_name); - - GNUNET_asprintf (&op_name, "op-%u-type", op_counter); - if ((GNUNET_SYSERR != GNUNET_CONFIGURATION_get_value_string (cfg, - sec_name, - op_name, - &type)) && - (STOP_SEND != o->type) && - (STOP_PREFERENCE != o->type)) - { - /* Load arguments for set_rate, start_send, set_preference */ - if (0 == strcmp (type, "constant")) - { - o->gen_type = GNUNET_ATS_TEST_TG_CONSTANT; - } - else if (0 == strcmp (type, "linear")) - { - o->gen_type = GNUNET_ATS_TEST_TG_LINEAR; - } - else if (0 == strcmp (type, "sinus")) - { - o->gen_type = GNUNET_ATS_TEST_TG_SINUS; - } - else if (0 == strcmp (type, "random")) - { - o->gen_type = GNUNET_ATS_TEST_TG_RANDOM; - } - else - { - fprintf (stderr, "Invalid type %u `%s' in episode %u\n", - op_counter, op, cur->id); - GNUNET_free (type); - GNUNET_free (op); - GNUNET_free (op_name); - GNUNET_free (sec_name); - GNUNET_free (o); - return GNUNET_SYSERR; - } - GNUNET_free (op_name); - - /* Get base rate */ - GNUNET_asprintf (&op_name, "op-%u-base-rate", op_counter); - if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg, - sec_name, - op_name, - &o->base_rate)) - { - fprintf (stderr, - "Missing base rate in operation %u `%s' in episode %u\n", - op_counter, op, cur->id); - GNUNET_free (type); - GNUNET_free (op); - GNUNET_free (op_name); - GNUNET_free (sec_name); - GNUNET_free (o); - return GNUNET_SYSERR; - } - GNUNET_free (op_name); - - /* Get max rate */ - GNUNET_asprintf (&op_name, "op-%u-max-rate", op_counter); - if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg, - sec_name, - op_name, - &o->max_rate)) - { - if ((GNUNET_ATS_TEST_TG_LINEAR == o->gen_type) || - (GNUNET_ATS_TEST_TG_RANDOM == o->gen_type) || - (GNUNET_ATS_TEST_TG_SINUS == o->gen_type)) - { - fprintf (stderr, - "Missing max rate in operation %u `%s' in episode %u\n", - op_counter, op, cur->id); - GNUNET_free (type); - GNUNET_free (op_name); - GNUNET_free (op); - GNUNET_free (o); - GNUNET_free (sec_name); - return GNUNET_SYSERR; - } - } - GNUNET_free (op_name); - - /* Get period */ - GNUNET_asprintf (&op_name, "op-%u-period", op_counter); - if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (cfg, - sec_name, - op_name, - &o->period)) - { - o->period = cur->duration; - } - GNUNET_free (op_name); - - if (START_PREFERENCE == o->type) - { - /* Get frequency */ - GNUNET_asprintf (&op_name, "op-%u-frequency", op_counter); - if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (cfg, - sec_name, - op_name, - &o->frequency)) - { - fprintf (stderr, - "Missing frequency in operation %u `%s' in episode %u\n", - op_counter, op, cur->id); - GNUNET_free (type); - GNUNET_free (op_name); - GNUNET_free (op); - GNUNET_free (o); - GNUNET_free (sec_name); - return GNUNET_SYSERR; - } - GNUNET_free (op_name); - - /* Get preference */ - GNUNET_asprintf (&op_name, "op-%u-pref", op_counter); - if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg, - sec_name, - op_name, - &pref)) - { - fprintf (stderr, - "Missing preference in operation %u `%s' in episode %u\n", - op_counter, op, cur->id); - GNUNET_free (type); - GNUNET_free (op_name); - GNUNET_free (op); - GNUNET_free (pref); - GNUNET_free (o); - GNUNET_free (sec_name); - return GNUNET_SYSERR; - } - - if (0 == strcmp (pref, "bandwidth")) - o->pref_type = GNUNET_ATS_PREFERENCE_BANDWIDTH; - else if (0 == strcmp (pref, "latency")) - o->pref_type = GNUNET_ATS_PREFERENCE_LATENCY; - else - { - fprintf (stderr, - "Invalid preference in operation %u `%s' in episode %u\n", - op_counter, op, cur->id); - GNUNET_free (type); - GNUNET_free (op_name); - GNUNET_free (op); - GNUNET_free (pref); - GNUNET_free (o); - GNUNET_free (sec_name); - return GNUNET_SYSERR; - } - GNUNET_free (pref); - GNUNET_free (op_name); - } - } - - /* Safety checks */ - if ((GNUNET_ATS_TEST_TG_LINEAR == o->gen_type) || - (GNUNET_ATS_TEST_TG_SINUS == o->gen_type)) - { - if ((o->max_rate - o->base_rate) > o->base_rate) - { - /* This will cause an underflow */ - GNUNET_break (0); - } - fprintf (stderr, - "Selected max rate and base rate cannot be used for desired traffic form!\n"); - } - - if ((START_SEND == o->type) || (START_PREFERENCE == o->type)) - fprintf (stderr, - "Found operation %u in episode %u: %s [%llu]->[%llu] == %s, %llu -> %llu in %s\n", - op_counter, cur->id, print_op (o->type), o->src_id, - o->dest_id, (NULL != type) ? type : "", - o->base_rate, o->max_rate, - GNUNET_STRINGS_relative_time_to_string (o->period, GNUNET_YES)); - else - fprintf (stderr, "Found operation %u in episode %u: %s [%llu]->[%llu]\n", - op_counter, cur->id, print_op (o->type), o->src_id, o->dest_id); - - GNUNET_free (type); - GNUNET_free (op); - - GNUNET_CONTAINER_DLL_insert (cur->head, cur->tail, o); - op_counter++; - } - GNUNET_free (sec_name); - - return GNUNET_OK; -} - - -static int -load_episodes (struct Experiment *e, struct GNUNET_CONFIGURATION_Handle *cfg) -{ - int e_counter = 0; - char *sec_name; - struct GNUNET_TIME_Relative e_duration; - struct Episode *cur; - struct Episode *last; - - e_counter = 0; - last = NULL; - while (1) - { - GNUNET_asprintf (&sec_name, "episode-%u", e_counter); - if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (cfg, - sec_name, - "duration", - &e_duration)) - { - GNUNET_free (sec_name); - break; - } - - cur = GNUNET_new (struct Episode); - cur->duration = e_duration; - cur->id = e_counter; - - if (GNUNET_OK != load_episode (e, cur, cfg)) - { - GNUNET_free (sec_name); - GNUNET_free (cur); - return GNUNET_SYSERR; - } - - fprintf (stderr, "Found episode %u with duration %s \n", - e_counter, - GNUNET_STRINGS_relative_time_to_string (cur->duration, - GNUNET_YES)); - - /* Update experiment */ - e->num_episodes++; - e->total_duration = GNUNET_TIME_relative_add (e->total_duration, - cur->duration); - /* Put in linked list */ - if (NULL == last) - e->start = cur; - else - last->next = cur; - - GNUNET_free (sec_name); - e_counter++; - last = cur; - } - return e_counter; -} - - -static void -timeout_experiment (void *cls) -{ - struct Experiment *e = cls; - - e->experiment_timeout_task = NULL; - fprintf (stderr, "Experiment timeout!\n"); - - if (NULL != e->episode_timeout_task) - { - GNUNET_SCHEDULER_cancel (e->episode_timeout_task); - e->episode_timeout_task = NULL; - } - - e->e_done_cb (e, GNUNET_TIME_absolute_get_duration (e->start_time), - GNUNET_SYSERR); -} - - -static void -enforce_start_send (struct GNUNET_ATS_TEST_Operation *op) -{ - struct BenchmarkPeer *peer; - struct BenchmarkPartner *partner; - - peer = GNUNET_ATS_TEST_get_peer (op->src_id); - if (NULL == peer) - { - GNUNET_break (0); - return; - } - - partner = GNUNET_ATS_TEST_get_partner (op->src_id, op->dest_id); - if (NULL == partner) - { - GNUNET_break (0); - return; - } - - fprintf (stderr, "Found master %llu slave %llu\n", op->src_id, op->dest_id); - - if (NULL != partner->tg) - { - fprintf (stderr, "Stopping traffic between master %llu slave %llu\n", - op->src_id, op->dest_id); - GNUNET_ATS_TEST_generate_traffic_stop (partner->tg); - partner->tg = NULL; - } - - partner->tg = GNUNET_ATS_TEST_generate_traffic_start (peer, partner, - op->gen_type, - op->base_rate, - op->max_rate, - op->period, - GNUNET_TIME_UNIT_FOREVER_REL); -} - - -static void -enforce_stop_send (struct GNUNET_ATS_TEST_Operation *op) -{ - struct BenchmarkPartner *p; - - p = GNUNET_ATS_TEST_get_partner (op->src_id, op->dest_id); - if (NULL == p) - { - GNUNET_break (0); - return; - } - - fprintf (stderr, "Found master %llu slave %llu\n", op->src_id, op->dest_id); - - if (NULL != p->tg) - { - fprintf (stderr, "Stopping traffic between master %llu slave %llu\n", - op->src_id, op->dest_id); - GNUNET_ATS_TEST_generate_traffic_stop (p->tg); - p->tg = NULL; - } -} - - -static void -enforce_start_preference (struct GNUNET_ATS_TEST_Operation *op) -{ - struct BenchmarkPeer *peer; - struct BenchmarkPartner *partner; - - peer = GNUNET_ATS_TEST_get_peer (op->src_id); - if (NULL == peer) - { - GNUNET_break (0); - return; - } - - partner = GNUNET_ATS_TEST_get_partner (op->src_id, op->dest_id); - if (NULL == partner) - { - GNUNET_break (0); - return; - } - - fprintf (stderr, "Found master %llu slave %llu\n", op->src_id, op->dest_id); - - if (NULL != partner->pg) - { - fprintf (stderr, "Stopping traffic between master %llu slave %llu\n", - op->src_id, op->dest_id); - GNUNET_ATS_TEST_generate_preferences_stop (partner->pg); - partner->pg = NULL; - } - - partner->pg = GNUNET_ATS_TEST_generate_preferences_start (peer, partner, - op->gen_type, - op->base_rate, - op->max_rate, - op->period, - op->frequency, - op->pref_type); -} - - -static void -enforce_stop_preference (struct GNUNET_ATS_TEST_Operation *op) -{ - struct BenchmarkPartner *p; - - p = GNUNET_ATS_TEST_get_partner (op->src_id, op->dest_id); - if (NULL == p) - { - GNUNET_break (0); - return; - } - - fprintf (stderr, "Found master %llu slave %llu\n", op->src_id, op->dest_id); - - if (NULL != p->pg) - { - fprintf (stderr, "Stopping preference between master %llu slave %llu\n", - op->src_id, op->dest_id); - GNUNET_ATS_TEST_generate_preferences_stop (p->pg); - p->pg = NULL; - } -} - - -static void -enforce_episode (struct Episode *ep) -{ - struct GNUNET_ATS_TEST_Operation *cur; - - for (cur = ep->head; NULL != cur; cur = cur->next) - { - fprintf (stderr, "Enforcing operation: %s [%llu]->[%llu] == %llu\n", - print_op (cur->type), cur->src_id, cur->dest_id, cur->base_rate); - switch (cur->type) - { - case START_SEND: - enforce_start_send (cur); - break; - - case STOP_SEND: - enforce_stop_send (cur); - break; - - case START_PREFERENCE: - enforce_start_preference (cur); - break; - - case STOP_PREFERENCE: - enforce_stop_preference (cur); - break; - - default: - break; - } - } -} - - -static void -timeout_episode (void *cls) -{ - struct Experiment *e = cls; - - e->episode_timeout_task = NULL; - if (NULL != e->ep_done_cb) - e->ep_done_cb (e->cur); - - /* Scheduling next */ - e->cur = e->cur->next; - if (NULL == e->cur) - { - /* done */ - fprintf (stderr, "Last episode done!\n"); - if (NULL != e->experiment_timeout_task) - { - GNUNET_SCHEDULER_cancel (e->experiment_timeout_task); - e->experiment_timeout_task = NULL; - } - e->e_done_cb (e, GNUNET_TIME_absolute_get_duration (e->start_time), - GNUNET_OK); - return; - } - - fprintf (stderr, "Running episode %u with timeout %s\n", - e->cur->id, - GNUNET_STRINGS_relative_time_to_string (e->cur->duration, - GNUNET_YES)); - enforce_episode (e->cur); - - e->episode_timeout_task = GNUNET_SCHEDULER_add_delayed (e->cur->duration, - &timeout_episode, e); -} - - -void -GNUNET_ATS_TEST_experimentation_run (struct Experiment *e, - GNUNET_ATS_TESTING_EpisodeDoneCallback - ep_done_cb, - GNUNET_ATS_TESTING_ExperimentDoneCallback - e_done_cb) -{ - fprintf (stderr, "Running experiment `%s' with timeout %s\n", e->name, - GNUNET_STRINGS_relative_time_to_string (e->max_duration, - GNUNET_YES)); - e->e_done_cb = e_done_cb; - e->ep_done_cb = ep_done_cb; - e->start_time = GNUNET_TIME_absolute_get (); - - /* Start total time out */ - e->experiment_timeout_task = GNUNET_SCHEDULER_add_delayed (e->max_duration, - &timeout_experiment, - e); - - /* Start */ - e->cur = e->start; - fprintf (stderr, "Running episode %u with timeout %s\n", - e->cur->id, - GNUNET_STRINGS_relative_time_to_string (e->cur->duration, - GNUNET_YES)); - enforce_episode (e->cur); - e->episode_timeout_task = GNUNET_SCHEDULER_add_delayed (e->cur->duration, - &timeout_episode, e); -} - - -struct Experiment * -GNUNET_ATS_TEST_experimentation_load (const char *filename) -{ - struct Experiment *e; - struct GNUNET_CONFIGURATION_Handle *cfg; - - e = NULL; - - cfg = GNUNET_CONFIGURATION_create (); - if (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (cfg, filename)) - { - fprintf (stderr, "Failed to load `%s'\n", filename); - GNUNET_CONFIGURATION_destroy (cfg); - return NULL; - } - - e = create_experiment (); - - if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg, "experiment", - "name", &e->name)) - { - fprintf (stderr, "Invalid %s", "name"); - free_experiment (e); - return NULL; - } - else - fprintf (stderr, "Experiment name: `%s'\n", e->name); - - if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_filename (cfg, - "experiment", - "cfg_file", - &e->cfg_file)) - { - fprintf (stderr, "Invalid %s", "cfg_file"); - free_experiment (e); - return NULL; - } - else - fprintf (stderr, "Experiment name: `%s'\n", e->cfg_file); - - if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg, "experiment", - "masters", - &e->num_masters)) - { - fprintf (stderr, "Invalid %s", "masters"); - free_experiment (e); - return NULL; - } - else - fprintf (stderr, "Experiment masters: `%llu'\n", - e->num_masters); - - if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg, "experiment", - "slaves", - &e->num_slaves)) - { - fprintf (stderr, "Invalid %s", "slaves"); - free_experiment (e); - return NULL; - } - else - fprintf (stderr, "Experiment slaves: `%llu'\n", - e->num_slaves); - - if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (cfg, "experiment", - "log_freq", - &e->log_freq)) - { - fprintf (stderr, "Invalid %s", "log_freq"); - free_experiment (e); - return NULL; - } - else - fprintf (stderr, "Experiment logging frequency: `%s'\n", - GNUNET_STRINGS_relative_time_to_string (e->log_freq, GNUNET_YES)); - - if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (cfg, "experiment", - "max_duration", - &e->max_duration)) - { - fprintf (stderr, "Invalid %s", "max_duration"); - free_experiment (e); - return NULL; - } - else - fprintf (stderr, "Experiment duration: `%s'\n", - GNUNET_STRINGS_relative_time_to_string (e->max_duration, - GNUNET_YES)); - - load_episodes (e, cfg); - fprintf (stderr, "Loaded %u episodes with total duration %s\n", - e->num_episodes, - GNUNET_STRINGS_relative_time_to_string (e->total_duration, - GNUNET_YES)); - - GNUNET_CONFIGURATION_destroy (cfg); - return e; -} - - -void -GNUNET_ATS_TEST_experimentation_stop (struct Experiment *e) -{ - if (NULL != e->experiment_timeout_task) - { - GNUNET_SCHEDULER_cancel (e->experiment_timeout_task); - e->experiment_timeout_task = NULL; - } - if (NULL != e->episode_timeout_task) - { - GNUNET_SCHEDULER_cancel (e->episode_timeout_task); - e->episode_timeout_task = NULL; - } - free_experiment (e); -} - - -/* end of file ats-testing-experiment.c*/ diff --git a/src/ats-tests/ats-testing-log.c b/src/ats-tests/ats-testing-log.c deleted file mode 100644 index dfdfa8a80..000000000 --- a/src/ats-tests/ats-testing-log.c +++ /dev/null @@ -1,979 +0,0 @@ -/* - This file is part of GNUnet. - Copyright (C) 2010-2013 GNUnet e.V. - - GNUnet is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - GNUnet 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 - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - - SPDX-License-Identifier: AGPL3.0-or-later - */ -/** - * @file ats-tests/ats-testing-log.c - * @brief ats benchmark: logging for performance tests - * @author Christian Grothoff - * @author Matthias Wachs - */ -#include "platform.h" -#include "gnunet_util_lib.h" -#include "ats-testing.h" - -#define THROUGHPUT_TEMPLATE "#!/usr/bin/gnuplot \n" \ - "set datafile separator ';' \n" \ - "set title \"Throughput between Master and Slaves\" \n" \ - "set xlabel \"Time in ms\" \n" \ - "set ylabel \"Bytes/s\" \n" \ - "set grid \n" - -#define RTT_TEMPLATE "#!/usr/bin/gnuplot \n" \ - "set datafile separator ';' \n" \ - "set title \"Application level roundtrip time between Master and Slaves\" \n" \ - "set xlabel \"Time in ms\" \n" \ - "set ylabel \"ms\" \n" \ - "set grid \n" - -#define BW_TEMPLATE "#!/usr/bin/gnuplot \n" \ - "set datafile separator ';' \n" \ - "set title \"Bandwidth inbound and outbound between Master and Slaves\" \n" \ - "set xlabel \"Time in ms\" \n" \ - "set ylabel \"Bytes / s \" \n" \ - "set grid \n" - -#define LOG_ITEMS_TIME 2 -#define LOG_ITEMS_PER_PEER 17 - -#define LOG_ITEM_BYTES_SENT 1 -#define LOG_ITEM_MSGS_SENT 2 -#define LOG_ITEM_THROUGHPUT_SENT 3 -#define LOG_ITEM_BYTES_RECV 4 -#define LOG_ITEM_MSGS_RECV 5 -#define LOG_ITEM_THROUGHPUT_RECV 6 -#define LOG_ITEM_APP_RTT 7 -#define LOG_ITEM_ATS_BW_IN 8 -#define LOG_ITEM_ATS_BW_OUT 9 -#define LOG_ITEM_ATS_COSTS_LAN 10 -#define LOG_ITEM_ATS_WAN 11 -#define LOG_ITEM_ATS_WLAN 12 -#define LOG_ITEM_ATS_DELAY 13 -#define LOG_ITEM_ATS_DISTANCE 14 -#define LOG_ITEM_ATS_NETWORKTYPE 15 -#define LOG_ITEM_ATS_UTIL_UP 16 -#define LOG_ITEM_ATS_UTIL_DOWN 17 - -/** - * A single logging time step for a partner - */ -struct PartnerLoggingTimestep -{ - /** - * Peer - */ - struct BenchmarkPeer *slave; - - /** - * Total number of messages this peer has sent - */ - unsigned int total_messages_sent; - - /** - * Total number of bytes this peer has sent - */ - unsigned int total_bytes_sent; - - /** - * Total number of messages this peer has received - */ - unsigned int total_messages_received; - - /** - * Total number of bytes this peer has received - */ - unsigned int total_bytes_received; - - /** - * Total outbound throughput for master in Bytes / s - */ - unsigned int throughput_sent; - - /** - * Total inbound throughput for master in Bytes / s - */ - unsigned int throughput_recv; - - /** - * Accumulated RTT for all messages - */ - unsigned int total_app_rtt; - - /** - * Current application level delay - */ - unsigned int app_rtt; - - /* Current ATS properties */ - - unsigned int ats_distance; - - struct GNUNET_TIME_Relative ats_delay; - - uint32_t bandwidth_in; - - uint32_t bandwidth_out; - - uint32_t ats_utilization_out; - - uint32_t ats_utilization_in; - - enum GNUNET_NetworkType ats_network_type; - - double pref_bandwidth; - double pref_delay; -}; - - -/** - * A single logging time step for a peer - */ -struct PeerLoggingTimestep -{ - /** - * Next in DLL - */ - struct PeerLoggingTimestep *next; - - /** - * Prev in DLL - */ - struct PeerLoggingTimestep *prev; - - /** - * Logging timestamp - */ - struct GNUNET_TIME_Absolute timestamp; - - /** - * Total number of messages this peer has sent - */ - unsigned int total_messages_sent; - - /** - * Total number of bytes this peer has sent - */ - unsigned int total_bytes_sent; - - /** - * Total number of messages this peer has received - */ - unsigned int total_messages_received; - - /** - * Total number of bytes this peer has received - */ - unsigned int total_bytes_received; - - /** - * Total outbound throughput for master in Bytes / s - */ - unsigned int total_throughput_send; - - /** - * Total inbound throughput for master in Bytes / s - */ - unsigned int total_throughput_recv; - - /** - * Logs for slaves - */ - struct PartnerLoggingTimestep *slaves_log; -}; - -/** - * Entry for a benchmark peer - */ -struct LoggingPeer -{ - /** - * Peer - */ - struct BenchmarkPeer *peer; - - /** - * Start time - */ - struct GNUNET_TIME_Absolute start; - - /** - * DLL for logging entries: head - */ - struct PeerLoggingTimestep *head; - - /** - * DLL for logging entries: tail - */ - struct PeerLoggingTimestep *tail; -}; - -struct LoggingHandle -{ - /** - * Logging task - */ - struct GNUNET_SCHEDULER_Task *log_task; - - /** - * Reference to perf_ats' masters - */ - int num_masters; - int num_slaves; - int running; - int verbose; - const char *name; - struct GNUNET_TIME_Relative frequency; - - /** - * Log structure of length num_peers - */ - struct LoggingPeer *lp; -}; - - -static void -write_throughput_gnuplot_script (char *fn, struct LoggingPeer *lp, char **fs, - int slaves) -{ - struct GNUNET_DISK_FileHandle *f; - char *gfn; - char *data; - int c_s; - - GNUNET_asprintf (&gfn, "gnuplot_throughput_%s", fn); - fprintf (stderr, - "Writing throughput plot for master %u and %u slaves to `%s'\n", - lp->peer->no, slaves, gfn); - - f = GNUNET_DISK_file_open (gfn, - GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE, - GNUNET_DISK_PERM_USER_EXEC - | GNUNET_DISK_PERM_USER_READ - | GNUNET_DISK_PERM_USER_WRITE); - if (NULL == f) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open gnuplot file `%s'\n", - gfn); - GNUNET_free (gfn); - return; - } - - /* Write header */ - if (GNUNET_SYSERR == GNUNET_DISK_file_write (f, THROUGHPUT_TEMPLATE, - strlen (THROUGHPUT_TEMPLATE))) - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Cannot write data to plot file `%s'\n", gfn); - - /* Write master data */ - GNUNET_asprintf (&data, - "plot '%s' using 2:%u with lines title 'Master %u send total', \\\n" \ - "'%s' using 2:%u with lines title 'Master %u receive total', \\\n", - fn, LOG_ITEMS_TIME + LOG_ITEM_THROUGHPUT_SENT, lp->peer->no, - fn, LOG_ITEMS_TIME + LOG_ITEM_THROUGHPUT_RECV, lp->peer->no); - if (GNUNET_SYSERR == GNUNET_DISK_file_write (f, data, strlen (data))) - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Cannot write data to plot file `%s'\n", gfn); - GNUNET_free (data); - - for (c_s = 0; c_s < slaves; c_s++) - { - GNUNET_asprintf (&data, - "'%s' using 2:%u with lines title 'Master %u - Slave %u send', \\\n" \ - "'%s' using 2:%u with lines title 'Master %u - Slave %u receive'%s\n", - fs[c_s], - LOG_ITEMS_TIME + LOG_ITEM_THROUGHPUT_SENT, - lp->peer->no, - lp->peer->partners[c_s].dest->no, - fs[c_s], - LOG_ITEMS_TIME + LOG_ITEM_THROUGHPUT_RECV, - lp->peer->no, - lp->peer->partners[c_s].dest->no, - (c_s < lp->peer->num_partners - 1) ? ", \\" : - "\n pause -1"); - if (GNUNET_SYSERR == GNUNET_DISK_file_write (f, data, strlen (data))) - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Cannot write data to plot file `%s'\n", gfn); - GNUNET_free (data); - } - - if (GNUNET_SYSERR == GNUNET_DISK_file_close (f)) - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Cannot close gnuplot file `%s'\n", gfn); - else - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Data successfully written to plot file `%s'\n", gfn); - GNUNET_free (gfn); -} - - -static void -write_rtt_gnuplot_script (char *fn, struct LoggingPeer *lp, char **fs, int - slaves) -{ - struct GNUNET_DISK_FileHandle *f; - char *gfn; - char *data; - int c_s; - - GNUNET_asprintf (&gfn, "gnuplot_rtt_%s", fn); - fprintf (stderr, "Writing rtt plot for master %u to `%s'\n", - lp->peer->no, gfn); - - f = GNUNET_DISK_file_open (gfn, - GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE, - GNUNET_DISK_PERM_USER_EXEC - | GNUNET_DISK_PERM_USER_READ - | GNUNET_DISK_PERM_USER_WRITE); - if (NULL == f) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open gnuplot file `%s'\n", - gfn); - GNUNET_free (gfn); - return; - } - - /* Write header */ - if (GNUNET_SYSERR == GNUNET_DISK_file_write (f, RTT_TEMPLATE, strlen ( - RTT_TEMPLATE))) - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Cannot write data to plot file `%s'\n", gfn); - - for (c_s = 0; c_s < slaves; c_s++) - { - GNUNET_asprintf (&data, - "%s'%s' using 2:%u with lines title 'Master %u - Slave %u '%s\n", - (0 == c_s) ? "plot " : "", - fs[c_s], - LOG_ITEMS_TIME + LOG_ITEM_APP_RTT, - lp->peer->no, - lp->peer->partners[c_s].dest->no, - (c_s < lp->peer->num_partners - 1) ? ", \\" : - "\n pause -1"); - if (GNUNET_SYSERR == GNUNET_DISK_file_write (f, data, strlen (data))) - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Cannot write data to plot file `%s'\n", gfn); - GNUNET_free (data); - } - - if (GNUNET_SYSERR == GNUNET_DISK_file_close (f)) - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot close gnuplot file `%s'\n", - gfn); - else - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Data successfully written to plot file `%s'\n", gfn); - GNUNET_free (gfn); -} - - -static void -write_bw_gnuplot_script (char *fn, struct LoggingPeer *lp, char **fs, int - slaves) -{ - struct GNUNET_DISK_FileHandle *f; - char *gfn; - char *data; - int c_s; - - GNUNET_asprintf (&gfn, "gnuplot_bw_%s", fn); - fprintf (stderr, "Writing bandwidth plot for master %u to `%s'\n", - lp->peer->no, gfn); - - f = GNUNET_DISK_file_open (gfn, - GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE, - GNUNET_DISK_PERM_USER_EXEC - | GNUNET_DISK_PERM_USER_READ - | GNUNET_DISK_PERM_USER_WRITE); - if (NULL == f) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open gnuplot file `%s'\n", - gfn); - GNUNET_free (gfn); - return; - } - - /* Write header */ - if (GNUNET_SYSERR == GNUNET_DISK_file_write (f, BW_TEMPLATE, strlen ( - BW_TEMPLATE))) - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Cannot write data to plot file `%s'\n", gfn); - - for (c_s = 0; c_s < slaves; c_s++) - { - GNUNET_asprintf (&data, "%s" \ - "'%s' using 2:%u with lines title 'BW out master %u - Slave %u ', \\\n" \ - "'%s' using 2:%u with lines title 'BW in master %u - Slave %u '" \ - "%s\n", - (0 == c_s) ? "plot " : "", - fs[c_s], - LOG_ITEMS_TIME + LOG_ITEM_ATS_BW_OUT, - lp->peer->no, c_s, - fs[c_s], - LOG_ITEMS_TIME + LOG_ITEM_ATS_BW_IN, - lp->peer->no, c_s, - (c_s < lp->peer->num_partners - 1) ? ", \\" : - "\n pause -1"); - if (GNUNET_SYSERR == GNUNET_DISK_file_write (f, data, strlen (data))) - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Cannot write data to plot file `%s'\n", gfn); - GNUNET_free (data); - } - - if (GNUNET_SYSERR == GNUNET_DISK_file_close (f)) - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot close gnuplot file `%s'\n", - gfn); - else - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Data successfully written to plot file `%s'\n", gfn); - GNUNET_free (gfn); -} - - -void -GNUNET_ATS_TEST_logging_write_to_file (struct LoggingHandle *l, - const char *experiment_name, - int plots) -{ - struct GNUNET_DISK_FileHandle *f[l->num_slaves]; - struct GNUNET_DISK_FileHandle *f_m; - const char *tmp_exp_name; - char *filename_master; - char *filename_slaves[l->num_slaves]; - char *data; - struct PeerLoggingTimestep *cur_lt; - struct PartnerLoggingTimestep *plt; - struct GNUNET_TIME_Absolute timestamp; - int c_m; - int c_s; - - - timestamp = GNUNET_TIME_absolute_get (); - - tmp_exp_name = experiment_name; - for (c_m = 0; c_m < l->num_masters; c_m++) - { - GNUNET_asprintf (&filename_master, "%s_%llu_master%u_%s", - experiment_name, - (unsigned long long) timestamp.abs_value_us, c_m, l->name); - fprintf (stderr, "Writing data for master %u to file `%s'\n", - c_m, filename_master); - - f_m = GNUNET_DISK_file_open (filename_master, - GNUNET_DISK_OPEN_WRITE - | GNUNET_DISK_OPEN_CREATE, - GNUNET_DISK_PERM_USER_READ - | GNUNET_DISK_PERM_USER_WRITE); - if (NULL == f_m) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open log file `%s'\n", - filename_master); - GNUNET_free (filename_master); - return; - } - - GNUNET_asprintf (&data, "# master %u; experiment : %s\n" - "timestamp; timestamp delta; #messages sent; #bytes sent; #throughput sent; #messages received; #bytes received; #throughput received; \n", - c_m, experiment_name); - if (GNUNET_SYSERR == GNUNET_DISK_file_write (f_m, data, strlen (data))) - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Cannot write data to log file `%s'\n", filename_master); - GNUNET_free (data); - - for (c_s = 0; c_s < l->lp[c_m].peer->num_partners; c_s++) - { - GNUNET_asprintf (&filename_slaves[c_s], "%s_%llu_master%u_slave_%u_%s", - tmp_exp_name, - (unsigned long long) timestamp.abs_value_us, - c_m, c_s, l->name); - - fprintf (stderr, "Writing data for master %u slave %u to file `%s'\n", - c_m, c_s, filename_slaves[c_s]); - - f[c_s] = GNUNET_DISK_file_open (filename_slaves[c_s], - GNUNET_DISK_OPEN_WRITE - | GNUNET_DISK_OPEN_CREATE, - GNUNET_DISK_PERM_USER_READ - | GNUNET_DISK_PERM_USER_WRITE); - if (NULL == f[c_s]) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open log file `%s'\n", - filename_slaves[c_s]); - GNUNET_free (filename_slaves[c_s]); - GNUNET_break (GNUNET_OK == GNUNET_DISK_file_close (f_m)); - GNUNET_free (filename_master); - return; - } - - /* Header */ - GNUNET_asprintf (&data, "# master %u; slave %u ; experiment : %s\n" - "timestamp; timestamp delta; #messages sent; #bytes sent; #throughput sent; #messages received; #bytes received; #throughput received; " \ - "rtt; bw in; bw out; ats_cost_lan; ats_cost_wlan; ats_delay; ats_distance; ats_network_type; ats_utilization_up ;ats_utilization_down;" \ - "pref bandwidth; pref delay\n", - c_m, c_s, experiment_name); - if (GNUNET_SYSERR == GNUNET_DISK_file_write (f[c_s], data, strlen (data))) - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Cannot write data to log file `%s'\n", - filename_slaves[c_s]); - GNUNET_free (data); - } - - for (cur_lt = l->lp[c_m].head; NULL != cur_lt; cur_lt = cur_lt->next) - { - if (l->verbose) - fprintf (stderr, - "Master [%u]: timestamp %llu %llu ; %u %u %u ; %u %u %u\n", - l->lp[c_m].peer->no, - (long long unsigned int) cur_lt->timestamp.abs_value_us, - (long long unsigned int) GNUNET_TIME_absolute_get_difference ( - l->lp[c_m].start, - cur_lt - ->timestamp).rel_value_us / 1000, - cur_lt->total_messages_sent, - cur_lt->total_bytes_sent, - cur_lt->total_throughput_send, - cur_lt->total_messages_received, - cur_lt->total_bytes_received, - cur_lt->total_throughput_recv); - - /* Assembling master string */ - GNUNET_asprintf (&data, "%llu;%llu;%u;%u;%u;%u;%u;%u;\n", - (long long unsigned int) cur_lt->timestamp.abs_value_us, - (long long unsigned - int) GNUNET_TIME_absolute_get_difference ( - l->lp[c_m].start, - cur_lt - ->timestamp). - rel_value_us / 1000, - cur_lt->total_messages_sent, - cur_lt->total_bytes_sent, - cur_lt->total_throughput_send, - cur_lt->total_messages_received, - cur_lt->total_bytes_received, - cur_lt->total_throughput_recv); - - if (GNUNET_SYSERR == GNUNET_DISK_file_write (f_m, data, strlen (data))) - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Cannot write data to master file %u\n", c_m); - GNUNET_free (data); - - - for (c_s = 0; c_s < l->lp[c_m].peer->num_partners; c_s++) - { - plt = &cur_lt->slaves_log[c_s]; - /* Log partners */ - - /* Assembling slave string */ - GNUNET_asprintf (&data, - "%llu;%llu;%u;%u;%u;%u;%u;%u;%.3f;%u;%u;%llu;%u;%u;%u;%u;%.3f;%.3f\n", - (long long unsigned - int) cur_lt->timestamp.abs_value_us, - (long long unsigned - int) GNUNET_TIME_absolute_get_difference ( - l->lp[c_m].start, - cur_lt - ->timestamp) - .rel_value_us / 1000, - plt->total_messages_sent, - plt->total_bytes_sent, - plt->throughput_sent, - plt->total_messages_received, - plt->total_bytes_received, - plt->throughput_recv, - (double) plt->app_rtt / 1000, - plt->bandwidth_in, - plt->bandwidth_out, - (unsigned long long) plt->ats_delay.rel_value_us, - plt->ats_distance, - plt->ats_network_type, - plt->ats_utilization_out, - plt->ats_utilization_in, - plt->pref_bandwidth, - plt->pref_delay); - - if (l->verbose) - fprintf (stderr, - "\t Slave [%u]: %u %u %u ; %u %u %u rtt %u delay %llu bw_in %u bw_out %u \n", - plt->slave->no, - plt->total_messages_sent, - plt->total_bytes_sent, - plt->throughput_sent, - plt->total_messages_received, - plt->total_bytes_received, - plt->throughput_recv, - plt->app_rtt, - (long long unsigned int) plt->ats_delay.rel_value_us, - plt->bandwidth_in, - plt->bandwidth_out); - - if (GNUNET_SYSERR == GNUNET_DISK_file_write (f[c_s], data, strlen ( - data))) - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Cannot write data to log file `%s'\n", - filename_slaves[c_s]); - GNUNET_free (data); - } - } - - for (c_s = 0; c_s < l->lp[c_m].peer->num_partners; c_s++) - { - if (GNUNET_SYSERR == GNUNET_DISK_file_close (f[c_s])) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Cannot close log file for master[%u] slave[%u]\n", c_m, - c_s); - continue; - } - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Data file successfully written to log file for `%s'\n", - filename_slaves[c_s]); - } - - if (GNUNET_SYSERR == GNUNET_DISK_file_close (f_m)) - { - GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, - "close", - filename_master); - GNUNET_free (filename_master); - return; - } - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Data file successfully written to log file for master `%s'\n", - filename_master); - - if (GNUNET_YES == plots) - { - write_throughput_gnuplot_script (filename_master, &l->lp[c_m], - filename_slaves, l->num_slaves); - write_rtt_gnuplot_script (filename_master, &l->lp[c_m], filename_slaves, - l->num_slaves); - write_bw_gnuplot_script (filename_master, &l->lp[c_m], filename_slaves, - l->num_slaves); - } - } - GNUNET_free (filename_master); -} - - -/** - * Log all data now - * - * @param l logging handle to use - */ -void -GNUNET_ATS_TEST_logging_now (struct LoggingHandle *l) -{ - struct LoggingPeer *bp; - struct PeerLoggingTimestep *mlt; - struct PeerLoggingTimestep *prev_log_mlt; - struct PartnerLoggingTimestep *slt; - struct PartnerLoggingTimestep *prev_log_slt; - struct BenchmarkPartner *p; - struct GNUNET_TIME_Relative delta; - int c_s; - int c_m; - unsigned int app_rtt; - double mult; - - if (GNUNET_YES != l->running) - return; - - for (c_m = 0; c_m < l->num_masters; c_m++) - { - bp = &l->lp[c_m]; - mlt = GNUNET_new (struct PeerLoggingTimestep); - GNUNET_CONTAINER_DLL_insert_tail (l->lp[c_m].head, l->lp[c_m].tail, mlt); - prev_log_mlt = mlt->prev; - - /* Collect data */ - /* Current master state */ - mlt->timestamp = GNUNET_TIME_absolute_get (); - mlt->total_bytes_sent = bp->peer->total_bytes_sent; - mlt->total_messages_sent = bp->peer->total_messages_sent; - mlt->total_bytes_received = bp->peer->total_bytes_received; - mlt->total_messages_received = bp->peer->total_messages_received; - - /* Throughput */ - if (NULL == prev_log_mlt) - { - /* Get difference to start */ - delta = GNUNET_TIME_absolute_get_difference (l->lp[c_m].start, - mlt->timestamp); - } - else - { - /* Get difference to last timestep */ - delta = GNUNET_TIME_absolute_get_difference (mlt->prev->timestamp, - mlt->timestamp); - } - - /* Multiplication factor for throughput calculation */ - mult = (double) GNUNET_TIME_UNIT_SECONDS.rel_value_us - / (delta.rel_value_us); - - /* Total throughput */ - if (NULL != prev_log_mlt) - { - if (mlt->total_bytes_sent - mlt->prev->total_bytes_sent > 0) - { - mlt->total_throughput_send = mult * (mlt->total_bytes_sent - - mlt->prev->total_bytes_sent); - } - else - { - mlt->total_throughput_send = 0; - // mlt->total_throughput_send = prev_log_mlt->total_throughput_send; /* no msgs send */ - } - - if (mlt->total_bytes_received - mlt->prev->total_bytes_received > 0) - { - mlt->total_throughput_recv = mult * (mlt->total_bytes_received - - mlt->prev->total_bytes_received); - } - else - { - mlt->total_throughput_recv = 0; - // mlt->total_throughput_recv = prev_log_mlt->total_throughput_recv; /* no msgs received */ - } - } - else - { - mlt->total_throughput_send = mult * mlt->total_bytes_sent; - mlt->total_throughput_recv = mult * mlt->total_bytes_received; - } - - if (GNUNET_YES == l->verbose) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Master[%u] delta: %llu us, bytes (sent/received): %u / %u; throughput send/recv: %u / %u\n", - c_m, - (unsigned long long) delta.rel_value_us, - mlt->total_bytes_sent, - mlt->total_bytes_received, - mlt->total_throughput_send, - mlt->total_throughput_recv); - } - - mlt->slaves_log = GNUNET_malloc (bp->peer->num_partners - * sizeof(struct PartnerLoggingTimestep)); - - for (c_s = 0; c_s < bp->peer->num_partners; c_s++) - { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Collect logging data master[%u] slave [%u]\n", c_m, c_s); - - p = &bp->peer->partners[c_s]; - slt = &mlt->slaves_log[c_s]; - - slt->slave = p->dest; - /* Bytes sent from master to this slave */ - slt->total_bytes_sent = p->bytes_sent; - /* Messages sent from master to this slave */ - slt->total_messages_sent = p->messages_sent; - /* Bytes master received from this slave */ - slt->total_bytes_received = p->bytes_received; - /* Messages master received from this slave */ - slt->total_messages_received = p->messages_received; - slt->total_app_rtt = p->total_app_rtt; - /* ats performance information */ - slt->ats_delay = p->props.delay; - slt->ats_distance = p->props.distance; - slt->ats_network_type = p->props.scope; - slt->ats_utilization_in = p->props.utilization_out; - slt->ats_utilization_out = p->props.utilization_out; - slt->bandwidth_in = p->bandwidth_in; - slt->bandwidth_out = p->bandwidth_out; - slt->pref_bandwidth = p->pref_bandwidth; - slt->pref_delay = p->pref_delay; - - /* Total application level rtt */ - if (NULL == prev_log_mlt) - { - if (0 != slt->total_messages_sent) - app_rtt = slt->total_app_rtt / slt->total_messages_sent; - else - app_rtt = 0; - } - else - { - prev_log_slt = &prev_log_mlt->slaves_log[c_s]; - if ((slt->total_messages_sent - prev_log_slt->total_messages_sent) > 0) - app_rtt = (slt->total_app_rtt - prev_log_slt->total_app_rtt) - / (slt->total_messages_sent - - prev_log_slt->total_messages_sent); - else - { - app_rtt = prev_log_slt->app_rtt; /* No messages were */ - } - } - slt->app_rtt = app_rtt; - - /* Partner throughput */ - if (NULL != prev_log_mlt) - { - prev_log_slt = &prev_log_mlt->slaves_log[c_s]; - if (slt->total_bytes_sent > prev_log_slt->total_bytes_sent) - slt->throughput_sent = mult * (slt->total_bytes_sent - - prev_log_slt->total_bytes_sent); - else - slt->throughput_sent = 0; - - if (slt->total_bytes_received > prev_log_slt->total_bytes_received) - slt->throughput_recv = mult - * (slt->total_bytes_received - - prev_log_slt->total_bytes_received); - else - slt->throughput_recv = 0; - } - else - { - slt->throughput_sent = mult * slt->total_bytes_sent; - slt->throughput_recv = mult * slt->total_bytes_received; - } - - if (GNUNET_YES == l->verbose) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Master [%u] -> Slave [%u]: delta: %llu us, bytes (sent/received): %u / %u; throughput send/recv: %u / %u\n", - c_m, c_s, - (unsigned long long) delta.rel_value_us, - mlt->total_bytes_sent, - mlt->total_bytes_received, - slt->throughput_sent, - slt->throughput_recv); - } - else - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Master [%u]: slave [%u]\n", - bp->peer->no, p->dest->no); - } - } -} - - -static void -collect_log_task (void *cls) -{ - struct LoggingHandle *l = cls; - - l->log_task = NULL; - GNUNET_ATS_TEST_logging_now (l); - l->log_task = GNUNET_SCHEDULER_add_delayed (l->frequency, - &collect_log_task, - l); -} - - -/** - * Stop logging - * - * @param l the logging handle - */ -void -GNUNET_ATS_TEST_logging_stop (struct LoggingHandle *l) -{ - if (GNUNET_YES != l->running) - return; - - if (NULL != l->log_task) - { - GNUNET_SCHEDULER_cancel (l->log_task); - l->log_task = NULL; - } - l->running = GNUNET_NO; - - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - _ ("Stop logging\n")); -} - - -/** - * Clean up logging data - * - * @param l the logging handle - */ -void -GNUNET_ATS_TEST_logging_clean_up (struct LoggingHandle *l) -{ - int c_m; - struct PeerLoggingTimestep *cur; - - if (GNUNET_YES == l->running) - GNUNET_ATS_TEST_logging_stop (l); - - for (c_m = 0; c_m < l->num_masters; c_m++) - { - while (NULL != (cur = l->lp[c_m].head)) - { - GNUNET_CONTAINER_DLL_remove (l->lp[c_m].head, l->lp[c_m].tail, cur); - GNUNET_free (cur->slaves_log); - GNUNET_free (cur); - } - } - - GNUNET_free (l->lp); - GNUNET_free (l); -} - - -/** - * Start logging - * - * @param log_frequency the logging frequency - * @param testname the testname - * @param masters the master peers used for benchmarking - * @param num_masters the number of master peers - * @param num_slaves the number of slave peers - * @param verbose verbose logging - * @return the logging handle or NULL on error - */ -struct LoggingHandle * -GNUNET_ATS_TEST_logging_start (struct GNUNET_TIME_Relative log_frequency, - const char *testname, - struct BenchmarkPeer *masters, - int num_masters, - int num_slaves, - int verbose) -{ - struct LoggingHandle *l; - int c_m; - - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - _ ("Start logging `%s'\n"), testname); - - l = GNUNET_new (struct LoggingHandle); - l->num_masters = num_masters; - l->num_slaves = num_slaves; - l->name = testname; - l->frequency = log_frequency; - l->verbose = verbose; - l->lp = GNUNET_malloc (num_masters * sizeof(struct LoggingPeer)); - - for (c_m = 0; c_m < num_masters; c_m++) - { - l->lp[c_m].peer = &masters[c_m]; - l->lp[c_m].start = GNUNET_TIME_absolute_get (); - } - - /* Schedule logging task */ - l->log_task = GNUNET_SCHEDULER_add_now (&collect_log_task, l); - l->running = GNUNET_YES; - - return l; -} - - -/* end of file ats-testing-log.c */ diff --git a/src/ats-tests/ats-testing-preferences.c b/src/ats-tests/ats-testing-preferences.c deleted file mode 100644 index f30fde960..000000000 --- a/src/ats-tests/ats-testing-preferences.c +++ /dev/null @@ -1,265 +0,0 @@ -/* - This file is part of GNUnet. - Copyright (C) 2010-2013 GNUnet e.V. - - GNUnet is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - GNUnet 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 - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - - SPDX-License-Identifier: AGPL3.0-or-later - */ -/** - * @file ats-tests/ats-testing-preferences.c - * @brief ats benchmark: preference generator - * @author Christian Grothoff - * @author Matthias Wachs - */ -#include "platform.h" -#include "gnunet_util_lib.h" -#include "ats-testing.h" - -static struct PreferenceGenerator *pg_head; -static struct PreferenceGenerator *pg_tail; - -extern struct GNUNET_ATS_TEST_Topology *top; - -static double -get_preference (struct PreferenceGenerator *pg) -{ - struct GNUNET_TIME_Relative time_delta; - double delta_value; - double pref_value; - - /* Calculate the current preference value */ - switch (pg->type) - { - case GNUNET_ATS_TEST_TG_CONSTANT: - pref_value = pg->base_value; - break; - - case GNUNET_ATS_TEST_TG_LINEAR: - time_delta = GNUNET_TIME_absolute_get_duration (pg->time_start); - /* Calculate point of time in the current period */ - time_delta.rel_value_us = time_delta.rel_value_us - % pg->duration_period.rel_value_us; - delta_value = ((double) time_delta.rel_value_us - / pg->duration_period.rel_value_us) * (pg->max_value - - pg->base_value); - if ((pg->max_value < pg->base_value) && - ((pg->max_value - pg->base_value) > pg->base_value)) - { - /* This will cause an underflow */ - GNUNET_break (0); - } - pref_value = pg->base_value + delta_value; - break; - - case GNUNET_ATS_TEST_TG_RANDOM: - delta_value = (double) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, - 10000 * (pg->max_value - - pg->base_value)) - / 10000; - pref_value = pg->base_value + delta_value; - break; - - case GNUNET_ATS_TEST_TG_SINUS: - time_delta = GNUNET_TIME_absolute_get_duration (pg->time_start); - /* Calculate point of time in the current period */ - time_delta.rel_value_us = time_delta.rel_value_us - % pg->duration_period.rel_value_us; - if ((pg->max_value - pg->base_value) > pg->base_value) - { - /* This will cause an underflow for second half of sinus period, - * will be detected in general when experiments are loaded */ - GNUNET_break (0); - } - delta_value = (pg->max_value - pg->base_value) - * sin ((2 * M_PI) - / ((double) pg->duration_period.rel_value_us) - * time_delta.rel_value_us); - pref_value = pg->base_value + delta_value; - break; - - default: - pref_value = 0.0; - break; - } - GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Current preference value is %f\n", - pref_value); - return pref_value; -} - - -static void -set_pref_task (void *cls) -{ - struct BenchmarkPartner *p = cls; - double pref_value; - - p->pg->set_task = NULL; - - pref_value = get_preference (p->pg); - - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Setting preference for master [%u] and slave [%u] for %s to %f\n", - p->me->no, p->dest->no, - GNUNET_ATS_print_preference_type (p->pg->kind), pref_value); - - GNUNET_ATS_performance_change_preference (p->me->ats_perf_handle, - &p->dest->id, - p->pg->kind, - pref_value, - GNUNET_ATS_PREFERENCE_END); - - switch (p->pg->kind) - { - case GNUNET_ATS_PREFERENCE_BANDWIDTH: - p->pref_bandwidth = pref_value; - break; - - case GNUNET_ATS_PREFERENCE_LATENCY: - p->pref_delay = pref_value; - break; - - default: - break; - } - - p->pg->set_task = GNUNET_SCHEDULER_add_delayed (p->pg->frequency, - set_pref_task, p); -} - - -/** - * Generate between the source master and the partner and set preferences with a - * value depending on the generator. - * - * @param src source - * @param dest partner - * @param type type of preferences to generate - * @param base_value traffic base rate to send data with - * @param value_rate traffic maximum rate to send data with - * @param period duration of a period of preferences generation (~ 1/frequency) - * @param frequency how long to generate preferences - * @param kind ATS preference to generate - * @return the preference generator - */ -struct PreferenceGenerator * -GNUNET_ATS_TEST_generate_preferences_start (struct BenchmarkPeer *src, - struct BenchmarkPartner *dest, - enum GeneratorType type, - unsigned int base_value, - unsigned int value_rate, - struct GNUNET_TIME_Relative period, - struct GNUNET_TIME_Relative - frequency, - enum GNUNET_ATS_PreferenceKind kind) -{ - struct PreferenceGenerator *pg; - - if (NULL != dest->pg) - { - GNUNET_break (0); - return NULL; - } - - pg = GNUNET_new (struct PreferenceGenerator); - GNUNET_CONTAINER_DLL_insert (pg_head, pg_tail, pg); - pg->type = type; - pg->src = src; - pg->dest = dest; - pg->kind = kind; - pg->base_value = base_value; - pg->max_value = value_rate; - pg->duration_period = period; - pg->frequency = frequency; - pg->time_start = GNUNET_TIME_absolute_get (); - - switch (type) - { - case GNUNET_ATS_TEST_TG_CONSTANT: - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Setting up constant preference generator master[%u] `%s' and slave [%u] `%s' max %u Bips\n", - dest->me->no, GNUNET_i2s (&dest->me->id), - dest->dest->no, GNUNET_i2s (&dest->dest->id), - base_value); - break; - - case GNUNET_ATS_TEST_TG_LINEAR: - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Setting up linear preference generator master[%u] `%s' and slave [%u] `%s' min %u Bips max %u Bips\n", - dest->me->no, GNUNET_i2s (&dest->me->id), - dest->dest->no, GNUNET_i2s (&dest->dest->id), - base_value, value_rate); - break; - - case GNUNET_ATS_TEST_TG_SINUS: - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Setting up sinus preference generator master[%u] `%s' and slave [%u] `%s' baserate %u Bips, amplitude %u Bps\n", - dest->me->no, GNUNET_i2s (&dest->me->id), - dest->dest->no, GNUNET_i2s (&dest->dest->id), - base_value, value_rate); - break; - - case GNUNET_ATS_TEST_TG_RANDOM: - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Setting up random preference generator master[%u] `%s' and slave [%u] `%s' min %u Bips max %u Bps\n", - dest->me->no, GNUNET_i2s (&dest->me->id), - dest->dest->no, GNUNET_i2s (&dest->dest->id), - base_value, value_rate); - break; - - default: - break; - } - - dest->pg = pg; - pg->set_task = GNUNET_SCHEDULER_add_now (&set_pref_task, dest); - return pg; -} - - -void -GNUNET_ATS_TEST_generate_preferences_stop (struct PreferenceGenerator *pg) -{ - GNUNET_CONTAINER_DLL_remove (pg_head, pg_tail, pg); - pg->dest->pg = NULL; - - if (NULL != pg->set_task) - { - GNUNET_SCHEDULER_cancel (pg->set_task); - pg->set_task = NULL; - } - - GNUNET_free (pg); -} - - -/** - * Stop all preferences generators - */ -void -GNUNET_ATS_TEST_generate_preferences_stop_all () -{ - struct PreferenceGenerator *cur; - struct PreferenceGenerator *next; - - next = pg_head; - for (cur = next; NULL != cur; cur = next) - { - next = cur->next; - GNUNET_ATS_TEST_generate_preferences_stop (cur); - } -} - - -/* end of file ats-testing-preferences.c */ diff --git a/src/ats-tests/ats-testing-traffic.c b/src/ats-tests/ats-testing-traffic.c deleted file mode 100644 index f19eac871..000000000 --- a/src/ats-tests/ats-testing-traffic.c +++ /dev/null @@ -1,393 +0,0 @@ -/* - This file is part of GNUnet. - Copyright (C) 2010-2013, 2016 GNUnet e.V. - - GNUnet is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - GNUnet 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 - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - - SPDX-License-Identifier: AGPL3.0-or-later - */ -/** - * @file ats-tests/ats-testing-traffic.c - * @brief ats benchmark: traffic generator - * @author Christian Grothoff - * @author Matthias Wachs - */ -#include "platform.h" -#include "gnunet_util_lib.h" -#include "ats-testing.h" - -static struct TrafficGenerator *tg_head; -static struct TrafficGenerator *tg_tail; - -extern struct GNUNET_ATS_TEST_Topology *top; - -static struct GNUNET_TIME_Relative -get_delay (struct TrafficGenerator *tg) -{ - struct GNUNET_TIME_Relative delay; - struct GNUNET_TIME_Relative time_delta; - long long int cur_rate; - long long int delta_rate; - - delay.rel_value_us = 0; - - /* Calculate the current transmission rate based on the type of traffic */ - switch (tg->type) - { - case GNUNET_ATS_TEST_TG_CONSTANT: - if (UINT32_MAX == tg->base_rate) - return GNUNET_TIME_UNIT_ZERO; - cur_rate = tg->base_rate; - break; - - case GNUNET_ATS_TEST_TG_LINEAR: - time_delta = GNUNET_TIME_absolute_get_duration (tg->time_start); - /* Calculate point of time in the current period */ - time_delta.rel_value_us = time_delta.rel_value_us - % tg->duration_period.rel_value_us; - delta_rate = ((double) time_delta.rel_value_us - / tg->duration_period.rel_value_us) - * (tg->max_rate - tg->base_rate); - if ((tg->max_rate < tg->base_rate) && ((tg->max_rate - tg->base_rate) > - tg->base_rate)) - { - /* This will cause an underflow */ - GNUNET_break (0); - } - cur_rate = tg->base_rate + delta_rate; - break; - - case GNUNET_ATS_TEST_TG_RANDOM: - cur_rate = tg->base_rate + GNUNET_CRYPTO_random_u32 ( - GNUNET_CRYPTO_QUALITY_WEAK, - tg->max_rate - - tg->base_rate); - break; - - case GNUNET_ATS_TEST_TG_SINUS: - time_delta = GNUNET_TIME_absolute_get_duration (tg->time_start); - /* Calculate point of time in the current period */ - time_delta.rel_value_us = time_delta.rel_value_us - % tg->duration_period.rel_value_us; - if ((tg->max_rate - tg->base_rate) > tg->base_rate) - { - /* This will cause an underflow for second half of sinus period, - * will be detected in general when experiments are loaded */ - GNUNET_break (0); - } - delta_rate = (tg->max_rate - tg->base_rate) - * sin ((2 * M_PI) - / ((double) tg->duration_period.rel_value_us) - * time_delta.rel_value_us); - cur_rate = tg->base_rate + delta_rate; - break; - - default: - return delay; - break; - } - - if (cur_rate < 0) - { - cur_rate = 1; - } - /* Calculate the delay for the next message based on the current delay */ - delay.rel_value_us = GNUNET_TIME_UNIT_SECONDS.rel_value_us - * TEST_MESSAGE_SIZE / cur_rate; - - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Current rate is %lld, calculated delay is %llu\n", - cur_rate, - (unsigned long long) delay.rel_value_us); - return delay; -} - - -static void -update_ping_data (void *cls) -{ - struct BenchmarkPartner *p = cls; - struct GNUNET_TIME_Relative delay; - - p->messages_sent++; - p->bytes_sent += TEST_MESSAGE_SIZE; - p->me->total_messages_sent++; - p->me->total_bytes_sent += TEST_MESSAGE_SIZE; - - if (NULL == p->tg) - { - GNUNET_break (0); - return; - } - delay = get_delay (p->tg); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Delay for next transmission %s\n", - GNUNET_STRINGS_relative_time_to_string (delay, - GNUNET_YES)); - p->tg->next_ping_transmission - = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), - delay); -} - - -static void -comm_schedule_send (void *cls) -{ - struct BenchmarkPartner *p = cls; - struct TestMessage *msg; - struct GNUNET_MQ_Envelope *env; - - p->tg->send_task = NULL; - p->last_message_sent = GNUNET_TIME_absolute_get (); - env = GNUNET_MQ_msg (msg, - TEST_MESSAGE_TYPE_PING); - memset (msg->padding, - 'a', - sizeof(msg->padding)); - GNUNET_MQ_notify_sent (env, - &update_ping_data, - p); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Master [%u]: Sending PING to [%u]\n", - p->me->no, - p->dest->no); - GNUNET_MQ_send (p->mq, - env); -} - - -static void -update_pong_data (void *cls) -{ - struct BenchmarkPartner *p = cls; - - p->messages_sent++; - p->bytes_sent += TEST_MESSAGE_SIZE; - p->me->total_messages_sent++; - p->me->total_bytes_sent += TEST_MESSAGE_SIZE; -} - - -void -GNUNET_ATS_TEST_traffic_handle_ping (struct BenchmarkPartner *p) -{ - struct TestMessage *msg; - struct GNUNET_MQ_Envelope *env; - - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Slave [%u]: Received PING from [%u], sending PONG\n", - p->me->no, - p->dest->no); - p->messages_received++; - p->bytes_received += TEST_MESSAGE_SIZE; - p->me->total_messages_received++; - p->me->total_bytes_received += TEST_MESSAGE_SIZE; - - - env = GNUNET_MQ_msg (msg, - TEST_MESSAGE_TYPE_PING); - memset (msg->padding, - 'a', - sizeof(msg->padding)); - GNUNET_MQ_notify_sent (env, - &update_pong_data, - p); - GNUNET_MQ_send (p->mq, - env); -} - - -void -GNUNET_ATS_TEST_traffic_handle_pong (struct BenchmarkPartner *p) -{ - struct GNUNET_TIME_Relative left; - - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Master [%u]: Received PONG from [%u], next message\n", - p->me->no, - p->dest->no); - - p->messages_received++; - p->bytes_received += TEST_MESSAGE_SIZE; - p->me->total_messages_received++; - p->me->total_bytes_received += TEST_MESSAGE_SIZE; - p->total_app_rtt += GNUNET_TIME_absolute_get_difference (p->last_message_sent, - GNUNET_TIME_absolute_get ()) - .rel_value_us; - - /* Schedule next send event */ - if (NULL == p->tg) - return; - - left = GNUNET_TIME_absolute_get_remaining (p->tg->next_ping_transmission); - if (UINT32_MAX == p->tg->base_rate) - { - p->tg->send_task = GNUNET_SCHEDULER_add_now (&comm_schedule_send, p); - } - else if (0 == left.rel_value_us) - { - p->tg->send_task = GNUNET_SCHEDULER_add_now (&comm_schedule_send, p); - } - else - { - /* Enforce minimum transmission rate 1 msg / sec */ - if (GNUNET_TIME_UNIT_SECONDS.rel_value_us == (left = - GNUNET_TIME_relative_min ( - left, - GNUNET_TIME_UNIT_SECONDS)) - .rel_value_us) - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Enforcing minimum send rate between master [%u] and slave [%u]\n", - p->me->no, p->dest->no); - p->tg->send_task = GNUNET_SCHEDULER_add_delayed (left, - &comm_schedule_send, p); - } -} - - -/** - * Generate between the source master and the partner and send traffic with a - * maximum rate. - * - * @param src traffic source - * @param dest traffic partner - * @param type type of traffic to generate - * @param base_rate traffic base rate to send data with - * @param max_rate traffic maximum rate to send data with - * @param period duration of a period of traffic generation (~ 1/frequency) - * @param duration how long to generate traffic - * @return the traffic generator - */ -struct TrafficGenerator * -GNUNET_ATS_TEST_generate_traffic_start (struct BenchmarkPeer *src, - struct BenchmarkPartner *dest, - enum GeneratorType type, - unsigned int base_rate, - unsigned int max_rate, - struct GNUNET_TIME_Relative period, - struct GNUNET_TIME_Relative duration) -{ - struct TrafficGenerator *tg; - - if (NULL != dest->tg) - { - GNUNET_break (0); - return NULL; - } - - tg = GNUNET_new (struct TrafficGenerator); - GNUNET_CONTAINER_DLL_insert (tg_head, - tg_tail, - tg); - tg->type = type; - tg->src = src; - tg->dest = dest; - tg->base_rate = base_rate; - tg->max_rate = max_rate; - tg->duration_period = period; - tg->time_start = GNUNET_TIME_absolute_get (); - tg->next_ping_transmission = GNUNET_TIME_UNIT_FOREVER_ABS; - - switch (type) - { - case GNUNET_ATS_TEST_TG_CONSTANT: - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Setting up constant traffic generator master[%u] `%s' and slave [%u] `%s' max %u Bips\n", - dest->me->no, - GNUNET_i2s (&dest->me->id), - dest->dest->no, - GNUNET_i2s (&dest->dest->id), - base_rate); - break; - - case GNUNET_ATS_TEST_TG_LINEAR: - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Setting up linear traffic generator master[%u] `%s' and slave [%u] `%s' min %u Bips max %u Bips\n", - dest->me->no, - GNUNET_i2s (&dest->me->id), - dest->dest->no, - GNUNET_i2s (&dest->dest->id), - base_rate, - max_rate); - break; - - case GNUNET_ATS_TEST_TG_SINUS: - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Setting up sinus traffic generator master[%u] `%s' and slave [%u] `%s' baserate %u Bips, amplitude %u Bps\n", - dest->me->no, - GNUNET_i2s (&dest->me->id), - dest->dest->no, - GNUNET_i2s (&dest->dest->id), - base_rate, - max_rate); - break; - - case GNUNET_ATS_TEST_TG_RANDOM: - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Setting up random traffic generator master[%u] `%s' and slave [%u] `%s' min %u Bips max %u Bps\n", - dest->me->no, - GNUNET_i2s (&dest->me->id), - dest->dest->no, - GNUNET_i2s (&dest->dest->id), - base_rate, - max_rate); - break; - - default: - break; - } - - dest->tg = tg; - tg->send_task - = GNUNET_SCHEDULER_add_now (&comm_schedule_send, - dest); - return tg; -} - - -void -GNUNET_ATS_TEST_generate_traffic_stop (struct TrafficGenerator *tg) -{ - GNUNET_CONTAINER_DLL_remove (tg_head, - tg_tail, - tg); - tg->dest->tg = NULL; - if (NULL != tg->send_task) - { - GNUNET_SCHEDULER_cancel (tg->send_task); - tg->send_task = NULL; - } - GNUNET_free (tg); -} - - -/** - * Stop all traffic generators - */ -void -GNUNET_ATS_TEST_generate_traffic_stop_all () -{ - struct TrafficGenerator *cur; - struct TrafficGenerator *next; - - next = tg_head; - for (cur = next; NULL != cur; cur = next) - { - next = cur->next; - GNUNET_ATS_TEST_generate_traffic_stop (cur); - } -} - - -/* end of file ats-testing-traffic.c */ diff --git a/src/ats-tests/ats-testing.c b/src/ats-tests/ats-testing.c deleted file mode 100644 index c6ba8533d..000000000 --- a/src/ats-tests/ats-testing.c +++ /dev/null @@ -1,975 +0,0 @@ -/* - This file is part of GNUnet. - Copyright (C) 2010-2013, 2016, 2017 GNUnet e.V. - - GNUnet is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - GNUnet 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 - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - - SPDX-License-Identifier: AGPL3.0-or-later - */ -/** - * @file ats-tests/ats-testing.c - * @brief ats testing library: setup topology - * solvers - * @author Christian Grothoff - * @author Matthias Wachs - */ -#include "ats-testing.h" - - -/** - * Connect peers with testbed - */ -struct TestbedConnectOperation -{ - /** - * The benchmarking master initiating this connection - */ - struct BenchmarkPeer *master; - - /** - * The benchmarking slave to connect to - */ - struct BenchmarkPeer *slave; - - /** - * Testbed operation to connect peers - */ - struct GNUNET_TESTBED_Operation *connect_op; -}; - -struct GNUNET_CONFIGURATION_Handle *cfg; - -struct GNUNET_ATS_TEST_Topology *top; - - -/** - * Shutdown nicely - * - * @param cls NULL - */ -static void -do_shutdown (void *cls) -{ - int c_m; - int c_s; - int c_op; - struct BenchmarkPeer *p; - - top->state.benchmarking = GNUNET_NO; - - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Benchmarking done\n"); - - GNUNET_ATS_TEST_generate_traffic_stop_all (); - - for (c_m = 0; c_m < top->num_masters; c_m++) - { - p = &top->mps[c_m]; - if (NULL != top->mps[c_m].peer_id_op) - { - GNUNET_TESTBED_operation_done (p->peer_id_op); - p->peer_id_op = NULL; - } - - if (NULL != p->ats_task) - GNUNET_SCHEDULER_cancel (p->ats_task); - p->ats_task = NULL; - - for (c_op = 0; c_op < p->num_partners; c_op++) - { - if ((NULL != p->core_connect_ops) && - (NULL != p->core_connect_ops[c_op].connect_op)) - { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Failed to connect peer 0 and %u\n", - c_op); - GNUNET_TESTBED_operation_done (p->core_connect_ops[c_op].connect_op); - p->core_connect_ops[c_op].connect_op = NULL; - } - } - - if (NULL != p->ats_perf_op) - { - GNUNET_TESTBED_operation_done (p->ats_perf_op); - p->ats_perf_op = NULL; - } - - if (NULL != p->comm_op) - { - GNUNET_TESTBED_operation_done (p->comm_op); - p->comm_op = NULL; - } - GNUNET_free (p->core_connect_ops); - GNUNET_free (p->partners); - p->partners = NULL; - } - - for (c_s = 0; c_s < top->num_slaves; c_s++) - { - p = &top->sps[c_s]; - if (NULL != p->peer_id_op) - { - GNUNET_TESTBED_operation_done (p->peer_id_op); - p->peer_id_op = NULL; - } - if (NULL != p->ats_perf_op) - { - GNUNET_TESTBED_operation_done (p->ats_perf_op); - p->ats_perf_op = NULL; - } - if (NULL != p->comm_op) - { - GNUNET_TESTBED_operation_done (p->comm_op); - p->comm_op = NULL; - } - GNUNET_free (p->partners); - p->partners = NULL; - } - GNUNET_SCHEDULER_shutdown (); - GNUNET_free (top); - top = NULL; -} - - -static struct BenchmarkPartner * -find_partner (struct BenchmarkPeer *me, - const struct GNUNET_PeerIdentity *peer) -{ - int c_m; - - for (c_m = 0; c_m < me->num_partners; c_m++) - { - /* Find a partner with other as destination */ - if (0 == GNUNET_memcmp (peer, - &me->partners[c_m].dest->id)) - { - return &me->partners[c_m]; - } - } - - return NULL; -} - - -static struct BenchmarkPeer * -find_peer (const struct GNUNET_PeerIdentity *peer) -{ - int c_p; - - for (c_p = 0; c_p < top->num_masters; c_p++) - { - if (0 == GNUNET_memcmp (&top->mps[c_p].id, - peer)) - return &top->mps[c_p]; - } - - for (c_p = 0; c_p < top->num_slaves; c_p++) - { - if (0 == GNUNET_memcmp (&top->sps[c_p].id, - peer)) - return &top->sps[c_p]; - } - return NULL; -} - - -/** - * Method called whenever a given peer connects. - * - * @param cls closure - * @param peer peer identity this notification is about - * @param mq queue to use to send messages to @a peer - * @return the `struct BenchmarkPartner` of @a peer - */ -static void * -comm_connect_cb (void *cls, - const struct GNUNET_PeerIdentity *peer, - struct GNUNET_MQ_Handle *mq) -{ - struct BenchmarkPeer *me = cls; - struct BenchmarkPeer *remote; - struct BenchmarkPartner *p; - char *id; - int c; - int completed; - - remote = find_peer (peer); - if (NULL == remote) - { - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "Unknown peer connected: `%s'\n", - GNUNET_i2s (peer)); - GNUNET_break (0); - return NULL; - } - - id = GNUNET_strdup (GNUNET_i2s (&me->id)); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "%s [%u] `%s' connected to %s [%u] %s\n", - (me->master == GNUNET_YES) ? "Master" : "Slave", - me->no, - id, - (remote->master == GNUNET_YES) ? "Master" : "Slave", - remote->no, - GNUNET_i2s (peer)); - - me->core_connections++; - if ((GNUNET_YES == me->master) && - (GNUNET_NO == remote->master) && - (GNUNET_NO == top->state.connected_CORE)) - { - me->core_slave_connections++; - - if (me->core_slave_connections == top->num_slaves) - { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Master [%u] connected all slaves\n", - me->no); - } - completed = GNUNET_YES; - for (c = 0; c < top->num_masters; c++) - { - if (top->mps[c].core_slave_connections != top->num_slaves) - completed = GNUNET_NO; - } - if (GNUNET_YES == completed) - { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "All master peers connected all slave peers\n"); - top->state.connected_CORE = GNUNET_YES; - /* Notify about setup done */ - if (NULL != top->done_cb) - top->done_cb (top->done_cb_cls, - top->mps, - top->sps); - } - } - GNUNET_free (id); - p = find_partner (me, - peer); - if (NULL != p) - p->mq = mq; - return p; -} - - -/** - * @param cls this peer - * @param peer id of disconnecting peer - * @param internal_cls the `struct BenchmarkPartner` of @a peer - */ -static void -comm_disconnect_cb (void *cls, - const struct GNUNET_PeerIdentity *peer, - void *internal_cls) -{ - struct BenchmarkPeer *me = cls; - struct BenchmarkPartner *p = internal_cls; - char *id; - - if (NULL == p) - return; - - id = GNUNET_strdup (GNUNET_i2s (&me->id)); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "%s disconnected from %s\n", - id, - GNUNET_i2s (peer)); - GNUNET_assert (me->core_connections > 0); - me->core_connections--; - - if ((GNUNET_YES == top->state.benchmarking) && - ((GNUNET_YES == me->master) || - (GNUNET_YES == p->dest->master))) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "%s disconnected from %s while benchmarking\n", - id, - GNUNET_i2s (peer)); - } - GNUNET_free (id); -} - - -static void -handle_pong (void *cls, - const struct TestMessage *message) -{ - struct BenchmarkPartner *p = cls; - - GNUNET_ATS_TEST_traffic_handle_pong (p); -} - - -static void -handle_ping (void *cls, - const struct TestMessage *message) -{ - struct BenchmarkPartner *p = cls; - - GNUNET_ATS_TEST_traffic_handle_ping (p); -} - - -static void * -transport_connect_adapter (void *cls, - const struct GNUNET_CONFIGURATION_Handle *cfg) -{ - struct BenchmarkPeer *me = cls; - struct GNUNET_MQ_MessageHandler handlers[] = { - GNUNET_MQ_hd_fixed_size (ping, - TEST_MESSAGE_TYPE_PING, - struct TestMessage, - me), - GNUNET_MQ_hd_fixed_size (pong, - TEST_MESSAGE_TYPE_PONG, - struct TestMessage, - me), - GNUNET_MQ_handler_end () - }; - - me->th = GNUNET_TRANSPORT_core_connect (cfg, - &me->id, - handlers, - me, - &comm_connect_cb, - &comm_disconnect_cb, - NULL); - if (NULL == me->th) - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Failed to create transport connection \n"); - return me->th; -} - - -static void -transport_disconnect_adapter (void *cls, - void *op_result) -{ - struct BenchmarkPeer *me = cls; - - GNUNET_TRANSPORT_core_disconnect (me->th); - me->th = NULL; -} - - -static void * -core_connect_adapter (void *cls, - const struct GNUNET_CONFIGURATION_Handle *cfg) -{ - struct BenchmarkPeer *me = cls; - struct GNUNET_MQ_MessageHandler handlers[] = { - GNUNET_MQ_hd_fixed_size (ping, - TEST_MESSAGE_TYPE_PING, - struct TestMessage, - me), - GNUNET_MQ_hd_fixed_size (pong, - TEST_MESSAGE_TYPE_PONG, - struct TestMessage, - me), - GNUNET_MQ_handler_end () - }; - - me->ch = GNUNET_CORE_connect (cfg, - me, - NULL, - &comm_connect_cb, - &comm_disconnect_cb, - handlers); - if (NULL == me->ch) - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Failed to create core connection \n"); - return me->ch; -} - - -static void -core_disconnect_adapter (void *cls, - void *op_result) -{ - struct BenchmarkPeer *me = cls; - - GNUNET_CORE_disconnect (me->ch); - me->ch = NULL; -} - - -static void -connect_completion_callback (void *cls, - struct GNUNET_TESTBED_Operation *op, - const char *emsg) -{ - struct TestbedConnectOperation *cop = cls; - static int ops = 0; - int c; - - if (NULL == emsg) - { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - _ ("Connected master [%u] with slave [%u]\n"), - cop->master->no, - cop->slave->no); - } - else - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - _ ("Failed to connect master peer [%u] with slave [%u]\n"), - cop->master->no, cop->slave->no); - GNUNET_break (0); - GNUNET_SCHEDULER_shutdown (); - } - GNUNET_TESTBED_operation_done (op); - ops++; - for (c = 0; c < top->num_slaves; c++) - { - if (cop == &cop->master->core_connect_ops[c]) - cop->master->core_connect_ops[c].connect_op = NULL; - } - if (ops == top->num_masters * top->num_slaves) - { - top->state.connected_PEERS = GNUNET_YES; - } -} - - -static void -do_connect_peers (void *cls) -{ - int c_m; - int c_s; - struct BenchmarkPeer *p; - - if ((top->state.connected_ATS_service == GNUNET_NO) || - (top->state.connected_COMM_service == GNUNET_NO)) - return; - - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Connecting peers on CORE level\n"); - for (c_m = 0; c_m < top->num_masters; c_m++) - { - p = &top->mps[c_m]; - p->core_connect_ops = GNUNET_malloc (top->num_slaves - * sizeof(struct - TestbedConnectOperation)); - - for (c_s = 0; c_s < top->num_slaves; c_s++) - { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Connecting master [%u] with slave [%u]\n", - p->no, - top->sps[c_s].no); - p->core_connect_ops[c_s].master = p; - p->core_connect_ops[c_s].slave = &top->sps[c_s]; - p->core_connect_ops[c_s].connect_op - = GNUNET_TESTBED_overlay_connect (NULL, - &connect_completion_callback, - &p->core_connect_ops[c_s], - top->sps[c_s].peer, - p->peer); - if (NULL == p->core_connect_ops[c_s].connect_op) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Could not connect master [%u] and slave [%u]\n", - p->no, - top->sps[c_s].no); - GNUNET_break (0); - GNUNET_SCHEDULER_shutdown (); - return; - } - } - } -} - - -static void -comm_connect_completion_cb (void *cls, - struct GNUNET_TESTBED_Operation *op, - void *ca_result, - const char *emsg) -{ - static int comm_done = 0; - - if ((NULL != emsg) || (NULL == ca_result)) - { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Initialization failed, shutdown\n"); - GNUNET_break (0); - GNUNET_SCHEDULER_shutdown (); - return; - } - comm_done++; - - if (comm_done == top->num_slaves + top->num_masters) - { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Connected to all %s services\n", - (GNUNET_YES == top->test_core) ? "CORE" : "TRANSPORT"); - top->state.connected_COMM_service = GNUNET_YES; - GNUNET_SCHEDULER_add_now (&do_connect_peers, - NULL); - } -} - - -static void -do_comm_connect (void *cls) -{ - int c_s; - int c_m; - - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Connecting to all %s services\n", - (GNUNET_YES == top->test_core) ? "CORE" : "TRANSPORT"); - for (c_m = 0; c_m < top->num_masters; c_m++) - { - if (GNUNET_YES == top->test_core) - top->mps[c_m].comm_op - = GNUNET_TESTBED_service_connect (NULL, - top->mps[c_m].peer, - "core", - &comm_connect_completion_cb, - NULL, - &core_connect_adapter, - &core_disconnect_adapter, - &top->mps[c_m]); - else - { - top->mps[c_m].comm_op - = GNUNET_TESTBED_service_connect (NULL, - top->mps[c_m].peer, - "transport", - &comm_connect_completion_cb, - NULL, - &transport_connect_adapter, - &transport_disconnect_adapter, - &top->mps[c_m]); - } - } - - for (c_s = 0; c_s < top->num_slaves; c_s++) - { - if (GNUNET_YES == top->test_core) - top->sps[c_s].comm_op - = GNUNET_TESTBED_service_connect (NULL, - top->sps[c_s].peer, - "core", - &comm_connect_completion_cb, - NULL, - &core_connect_adapter, - &core_disconnect_adapter, - &top->sps[c_s]); - else - { - top->sps[c_s].comm_op - = GNUNET_TESTBED_service_connect (NULL, - top->sps[c_s].peer, - "transport", - &comm_connect_completion_cb, - NULL, - &transport_connect_adapter, - &transport_disconnect_adapter, - &top->sps[c_s]); - } - } -} - - -static void -ats_performance_info_cb (void *cls, - const struct GNUNET_HELLO_Address *address, - int address_active, - struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, - struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, - const struct GNUNET_ATS_Properties *ats_prop) -{ - struct BenchmarkPeer *me = cls; - struct BenchmarkPartner *p; - int log; - char *peer_id; - - if (NULL == address) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Peer %u: ATS Service disconnected!\n", - me->no); - return; - } - - p = find_partner (me, - &address->peer); - if (NULL == p) - { - /* This is not one of my partners - * Will happen since the peers will connect to each other due to gossiping - */ - return; - } - peer_id = GNUNET_strdup (GNUNET_i2s (&me->id)); - - log = GNUNET_NO; - if ((p->bandwidth_in != ntohl (bandwidth_in.value__)) || - (p->bandwidth_out != ntohl (bandwidth_out.value__))) - log = GNUNET_YES; - p->bandwidth_in = ntohl (bandwidth_in.value__); - p->bandwidth_out = ntohl (bandwidth_out.value__); - - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "%s [%u] received ATS information: %s\n", - (GNUNET_YES == p->me->master) ? "Master" : "Slave", - p->me->no, - GNUNET_i2s (&p->dest->id)); - - p->props.utilization_out = ats_prop->utilization_out; - p->props.utilization_in = ats_prop->utilization_in; - p->props.scope = ats_prop->scope; - p->props.delay = ats_prop->delay; - p->props.distance = ats_prop->distance; - - if (GNUNET_YES == log) - top->ats_perf_cb (cls, address, - address_active, - bandwidth_out, - bandwidth_in, - ats_prop); - GNUNET_free (peer_id); -} - - -static void * -ats_perf_connect_adapter (void *cls, - const struct GNUNET_CONFIGURATION_Handle *cfg) -{ - struct BenchmarkPeer *me = cls; - - me->ats_perf_handle - = GNUNET_ATS_performance_init (cfg, - &ats_performance_info_cb, - me); - if (NULL == me->ats_perf_handle) - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Failed to create ATS performance handle \n"); - return me->ats_perf_handle; -} - - -static void -ats_perf_disconnect_adapter (void *cls, - void *op_result) -{ - struct BenchmarkPeer *me = cls; - - GNUNET_ATS_performance_done (me->ats_perf_handle); - me->ats_perf_handle = NULL; -} - - -static void -ats_connect_completion_cb (void *cls, - struct GNUNET_TESTBED_Operation *op, - void *ca_result, - const char *emsg) -{ - static int op_done = 0; - - if ((NULL != emsg) || (NULL == ca_result)) - { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Initialization failed, shutdown\n"); - GNUNET_break (0); - GNUNET_SCHEDULER_shutdown (); - return; - } - op_done++; - if (op_done == (top->num_masters + top->num_slaves)) - { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Connected to all ATS services\n"); - top->state.connected_ATS_service = GNUNET_YES; - GNUNET_SCHEDULER_add_now (&do_comm_connect, - NULL); - } -} - - -static void -do_connect_ats (void *cls) -{ - int c_m; - int c_s; - - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Connecting to all ATS services\n"); - for (c_m = 0; c_m < top->num_masters; c_m++) - { - top->mps[c_m].ats_perf_op - = GNUNET_TESTBED_service_connect (NULL, - top->mps[c_m].peer, - "ats", - &ats_connect_completion_cb, - NULL, - &ats_perf_connect_adapter, - &ats_perf_disconnect_adapter, - &top->mps[c_m]); - } - - for (c_s = 0; c_s < top->num_slaves; c_s++) - { - top->sps[c_s].ats_perf_op - = GNUNET_TESTBED_service_connect (NULL, - top->sps[c_s].peer, - "ats", - &ats_connect_completion_cb, - NULL, - &ats_perf_connect_adapter, - &ats_perf_disconnect_adapter, - &top->sps[c_s]); - } -} - - -static void -peerinformation_cb (void *cb_cls, - struct GNUNET_TESTBED_Operation *op, - const struct GNUNET_TESTBED_PeerInformation *pinfo, - const char *emsg) -{ - struct BenchmarkPeer *p = cb_cls; - static int done = 0; - - GNUNET_assert (pinfo->pit == GNUNET_TESTBED_PIT_IDENTITY); - - p->id = *pinfo->result.id; - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "%s [%u] has peer id `%s'\n", - (p->master == GNUNET_YES) ? "Master" : "Slave", - p->no, - GNUNET_i2s (&p->id)); - - GNUNET_TESTBED_operation_done (op); - p->peer_id_op = NULL; - done++; - - if (done == top->num_slaves + top->num_masters) - { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Retrieved all peer ID, connect to ATS\n"); - GNUNET_SCHEDULER_add_now (&do_connect_ats, - NULL); - } -} - - -/** - * Signature of a main function for a testcase. - * - * @param cls closure - * @param h testbed handle - * @param num_peers number of peers in 'peers' - * @param peers_ handle to peers run in the testbed - * @param links_succeeded the number of overlay link connection attempts that - * succeeded - * @param links_failed the number of overlay link connection attempts that - * failed - */ -static void -main_run (void *cls, - struct GNUNET_TESTBED_RunHandle *h, - unsigned int num_peers, - struct GNUNET_TESTBED_Peer **peers_, - unsigned int links_succeeded, - unsigned int links_failed) -{ - int c_m; - int c_s; - - GNUNET_assert (NULL == cls); - GNUNET_assert (top->num_masters + top->num_slaves == num_peers); - GNUNET_assert (NULL != peers_); - - GNUNET_SCHEDULER_add_shutdown (&do_shutdown, - top); - - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Setting up %u masters and %u slaves\n", - top->num_masters, - top->num_slaves); - - /* Setup master peers */ - for (c_m = 0; c_m < top->num_masters; c_m++) - { - GNUNET_assert (NULL != peers_[c_m]); - top->mps[c_m].peer = peers_[c_m]; - top->mps[c_m].no = c_m; - top->mps[c_m].master = GNUNET_YES; - top->mps[c_m].pref_partner = &top->sps[c_m]; - top->mps[c_m].pref_value = TEST_ATS_PREFERENCE_DEFAULT; - top->mps[c_m].partners = - GNUNET_malloc (top->num_slaves * sizeof(struct BenchmarkPartner)); - top->mps[c_m].num_partners = top->num_slaves; - /* Initialize partners */ - for (c_s = 0; c_s < top->num_slaves; c_s++) - { - top->mps[c_m].partners[c_s].me = &top->mps[c_m]; - top->mps[c_m].partners[c_s].dest = &top->sps[c_s]; - } - /* Get configuration */ - top->mps[c_m].peer_id_op - = GNUNET_TESTBED_peer_get_information (top->mps[c_m].peer, - GNUNET_TESTBED_PIT_IDENTITY, - &peerinformation_cb, - &top->mps[c_m]); - } - - /* Setup slave peers */ - for (c_s = 0; c_s < top->num_slaves; c_s++) - { - GNUNET_assert (NULL != peers_[c_s + top->num_masters]); - top->sps[c_s].peer = peers_[c_s + top->num_masters]; - top->sps[c_s].no = c_s + top->num_masters; - top->sps[c_s].master = GNUNET_NO; - top->sps[c_s].partners = - GNUNET_new_array (top->num_masters, - struct BenchmarkPartner); - top->sps[c_s].num_partners = top->num_masters; - /* Initialize partners */ - for (c_m = 0; c_m < top->num_masters; c_m++) - { - top->sps[c_s].partners[c_m].me = &top->sps[c_s]; - top->sps[c_s].partners[c_m].dest = &top->mps[c_m]; - - /* Initialize properties */ - top->sps[c_s].partners[c_m].props.delay = GNUNET_TIME_UNIT_ZERO; - top->sps[c_s].partners[c_m].props.distance = 0; - top->sps[c_s].partners[c_m].props.scope = GNUNET_NT_UNSPECIFIED; - top->sps[c_s].partners[c_m].props.utilization_in = 0; - top->sps[c_s].partners[c_m].props.utilization_out = 0; - } - /* Get configuration */ - top->sps[c_s].peer_id_op - = GNUNET_TESTBED_peer_get_information (top->sps[c_s].peer, - GNUNET_TESTBED_PIT_IDENTITY, - &peerinformation_cb, - &top->sps[c_s]); - } -} - - -/** - * Controller event callback - * - * @param cls NULL - * @param event the controller event - */ -static void -controller_event_cb (void *cls, - const struct GNUNET_TESTBED_EventInformation *event) -{ - switch (event->type) - { - case GNUNET_TESTBED_ET_CONNECT: - break; - - case GNUNET_TESTBED_ET_OPERATION_FINISHED: - break; - - default: - GNUNET_break (0); - GNUNET_SCHEDULER_shutdown (); - } -} - - -struct BenchmarkPeer * -GNUNET_ATS_TEST_get_peer (int src) -{ - if (src > top->num_masters) - return NULL; - return &top->mps[src]; -} - - -struct BenchmarkPartner * -GNUNET_ATS_TEST_get_partner (int src, - int dest) -{ - if (src > top->num_masters) - return NULL; - if (dest > top->num_slaves) - return NULL; - return &top->mps[src].partners[dest]; -} - - -/** - * Create a topology for ats testing - * - * @param name test name - * @param cfg_file configuration file to use for the peers - * @param num_slaves number of slaves - * @param num_masters number of masters - * @param test_core connect to CORE service (GNUNET_YES) or transport (GNUNET_NO) - * @param done_cb function to call when topology is setup - * @param done_cb_cls cls for callback - * @param log_request_cb callback to call when logging is required - */ -void -GNUNET_ATS_TEST_create_topology (char *name, char *cfg_file, - unsigned int num_slaves, - unsigned int num_masters, - int test_core, - GNUNET_ATS_TEST_TopologySetupDoneCallback - done_cb, - void *done_cb_cls, - GNUNET_ATS_AddressInformationCallback - log_request_cb) -{ - top = GNUNET_new (struct GNUNET_ATS_TEST_Topology); - top->num_masters = num_masters; - top->num_slaves = num_slaves; - top->done_cb = done_cb; - top->done_cb_cls = done_cb_cls; - top->test_core = test_core; - top->ats_perf_cb = log_request_cb; - top->mps = GNUNET_new_array (num_masters, - struct BenchmarkPeer); - top->sps = GNUNET_new_array (num_slaves, - struct BenchmarkPeer); - - /* Start topology */ - uint64_t event_mask; - event_mask = 0; - event_mask |= (1LL << GNUNET_TESTBED_ET_CONNECT); - event_mask |= (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED); - (void) GNUNET_TESTBED_test_run (name, - cfg_file, - num_slaves + num_masters, - event_mask, - &controller_event_cb, NULL, - &main_run, NULL); -} - - -/** - * Shutdown topology - */ -void -GNUNET_ATS_TEST_shutdown_topology (void) -{ - if (NULL == top) - return; - GNUNET_SCHEDULER_shutdown (); -} - - -/* end of file ats-testing.c */ diff --git a/src/ats-tests/ats-testing.h b/src/ats-tests/ats-testing.h deleted file mode 100644 index 017ffef4f..000000000 --- a/src/ats-tests/ats-testing.h +++ /dev/null @@ -1,757 +0,0 @@ -/* - This file is part of GNUnet. - Copyright (C) 2010-2013 GNUnet e.V. - - GNUnet is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - GNUnet 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 - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - - SPDX-License-Identifier: AGPL3.0-or-later - */ -/** - * @file ats-tests/ats-testing.h - * @brief ats testing library: setup topology and provide logging to test ats - * @author Christian Grothoff - * @author Matthias Wachs - */ -#include "platform.h" -#include "gnunet_util_lib.h" -#include "gnunet_testbed_service.h" -#include "gnunet_ats_service.h" -#include "gnunet_core_service.h" -#include "gnunet_transport_service.h" - -#define TEST_ATS_PREFERENCE_DEFAULT 1.0 - -/** - * Message type sent for traffic generation - */ -#define TEST_MESSAGE_TYPE_PING 12345 - -/** - * Message type sent as response during traffic generation - */ -#define TEST_MESSAGE_TYPE_PONG 12346 - -/** - * Size of test messages - */ -#define TEST_MESSAGE_SIZE 100 - - -struct TestMessage -{ - struct GNUNET_MessageHeader header; - - uint8_t padding[TEST_MESSAGE_SIZE - sizeof(struct GNUNET_MessageHeader)]; -}; - - -struct BenchmarkPartner; - -struct BenchmarkPeer; - -struct GNUNET_ATS_TEST_Topology; - -struct TrafficGenerator; - -struct LoggingHandle; - -enum GeneratorType -{ - GNUNET_ATS_TEST_TG_LINEAR, - GNUNET_ATS_TEST_TG_CONSTANT, - GNUNET_ATS_TEST_TG_RANDOM, - GNUNET_ATS_TEST_TG_SINUS -}; - - -/** - * Callback to call when topology setup is completed - * - * @param cls the closure - * @param masters array of master peers - * @param slaves array of master peers - */ -typedef void (*GNUNET_ATS_TEST_TopologySetupDoneCallback) ( - void *cls, - struct BenchmarkPeer *masters, - struct BenchmarkPeer *slaves); - -/** - * Callback called when logging is required for the data contained - * - * @param cls the closure - * @param address an address - * @param address_active is address active - * @param bandwidth_out bandwidth outbound - * @param bandwidth_in bandwidth inbound - * @param prop performance information - */ -typedef void (*GNUNET_ATS_TEST_LogRequest) ( - void *cls, - const struct GNUNET_HELLO_Address *address, - int address_active, - struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, - struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, - const struct GNUNET_ATS_Properties *prop); - -/** - * Information we track for a peer in the testbed. - */ -struct BenchmarkPeer -{ - /** - * Handle with testbed. - */ - struct GNUNET_TESTBED_Peer *peer; - - /** - * Unique identifier - */ - int no; - - /** - * Is this peer a measter: GNUNET_YES/GNUNET_NO - */ - int master; - - /** - * Peer ID - */ - struct GNUNET_PeerIdentity id; - - /** - * Testbed operation to get peer information - */ - struct GNUNET_TESTBED_Operation *peer_id_op; - - /** - * Testbed operation to connect to ATS performance service - */ - struct GNUNET_TESTBED_Operation *ats_perf_op; - - /** - * Testbed operation to connect to core - */ - struct GNUNET_TESTBED_Operation *comm_op; - - /** - * ATS performance handle - */ - struct GNUNET_ATS_PerformanceHandle *ats_perf_handle; - - /** - * Masters only: - * Testbed connect operations to connect masters to slaves - */ - struct TestbedConnectOperation *core_connect_ops; - - /** - * Core handle - */ - struct GNUNET_CORE_Handle *ch; - - /** - * Transport handle - */ - struct GNUNET_TRANSPORT_CoreHandle *th; - - /** - * Masters only: - * Peer to set ATS preferences for - */ - struct BenchmarkPeer *pref_partner; - - /** - * Masters only - * Progress task - */ - struct GNUNET_SCHEDULER_Task *ats_task; - - /** - * Masters only - * Progress task - */ - double pref_value; - - /** - * Array of partners with num_slaves entries (if master) or - * num_master entries (if slave) - */ - struct BenchmarkPartner *partners; - - /** - * Number of partners - */ - int num_partners; - - /** - * Number of core connections - */ - int core_connections; - - /** - * Masters only: - * Number of connections to slave peers - */ - int core_slave_connections; - - /** - * Total number of messages this peer has sent - */ - unsigned int total_messages_sent; - - /** - * Total number of bytes this peer has sent - */ - unsigned int total_bytes_sent; - - /** - * Total number of messages this peer has received - */ - unsigned int total_messages_received; - - /** - * Total number of bytes this peer has received - */ - unsigned int total_bytes_received; -}; - -struct TrafficGenerator -{ - struct TrafficGenerator *prev; - struct TrafficGenerator *next; - - enum GeneratorType type; - - struct BenchmarkPeer *src; - struct BenchmarkPartner *dest; - - long int base_rate; - long int max_rate; - struct GNUNET_TIME_Relative duration_period; - - struct GNUNET_SCHEDULER_Task *send_task; - struct GNUNET_TIME_Absolute next_ping_transmission; - struct GNUNET_TIME_Absolute time_start; -}; - - -struct PreferenceGenerator -{ - struct PreferenceGenerator *prev; - struct PreferenceGenerator *next; - - enum GeneratorType type; - - struct BenchmarkPeer *src; - struct BenchmarkPartner *dest; - - enum GNUNET_ATS_PreferenceKind kind; - - long int base_value; - long int max_value; - struct GNUNET_TIME_Relative duration_period; - struct GNUNET_TIME_Relative frequency; - - struct GNUNET_SCHEDULER_Task *set_task; - struct GNUNET_TIME_Absolute next_ping_transmission; - struct GNUNET_TIME_Absolute time_start; -}; - -/** - * Information about a benchmarking partner - */ -struct BenchmarkPartner -{ - /** - * The peer itself this partner belongs to - */ - struct BenchmarkPeer *me; - - /** - * The partner peer - */ - struct BenchmarkPeer *dest; - - /** - * Message queue handle. - */ - struct GNUNET_MQ_Handle *mq; - - /** - * Handle for traffic generator - */ - struct TrafficGenerator *tg; - - /** - * Handle for preference generator - */ - struct PreferenceGenerator *pg; - - /** - * Timestamp to calculate communication layer delay - */ - struct GNUNET_TIME_Absolute last_message_sent; - - /** - * Accumulated RTT for all messages - */ - unsigned int total_app_rtt; - - /** - * Number of messages sent to this partner - */ - unsigned int messages_sent; - - /** - * Number of bytes sent to this partner - */ - unsigned int bytes_sent; - - /** - * Number of messages received from this partner - */ - unsigned int messages_received; - - /** - * Number of bytes received from this partner - */ - unsigned int bytes_received; - - /** - * Current ATS properties - */ - struct GNUNET_ATS_Properties props; - - /** - * Bandwidth assigned inbound - */ - uint32_t bandwidth_in; - - /** - * Bandwidth assigned outbound - */ - uint32_t bandwidth_out; - - /** - * Current preference values for bandwidth - */ - double pref_bandwidth; - - /** - * Current preference values for delay - */ - double pref_delay; -}; - - -/** - * Overall state of the performance benchmark - */ -struct BenchmarkState -{ - /** - * Are we connected to ATS service of all peers: GNUNET_YES/NO - */ - int connected_ATS_service; - - /** - * Are we connected to CORE service of all peers: GNUNET_YES/NO - */ - int connected_COMM_service; - - /** - * Are we connected to all peers: GNUNET_YES/NO - */ - int connected_PEERS; - - /** - * Are we connected to all slave peers on CORE level: GNUNET_YES/NO - */ - int connected_CORE; - - /** - * Are we connected to CORE service of all peers: GNUNET_YES/NO - */ - int benchmarking; -}; - - -struct GNUNET_ATS_TEST_Topology -{ - /** - * Progress task - */ - struct GNUNET_SCHEDULER_Task *progress_task; - - /** - * Test result - */ - int result; - - /** - * Test core (#GNUNET_YES) or transport (#GNUNET_NO) - */ - int test_core; - - /** - * Solver string - */ - char *solver; - - /** - * Preference string - */ - char *testname; - - /** - * Preference string - */ - char *pref_str; - - /** - * ATS preference value - */ - int pref_val; - - /** - * Number master peers - */ - unsigned int num_masters; - - /** - * Array of master peers - */ - struct BenchmarkPeer *mps; - - /** - * Number slave peers - */ - unsigned int num_slaves; - - /** - * Array of slave peers - */ - struct BenchmarkPeer *sps; - - /** - * Benchmark duration - */ - struct GNUNET_TIME_Relative perf_duration; - - /** - * Logging frequency - */ - struct GNUNET_TIME_Relative log_frequency; - - /** - * Benchmark state - */ - struct BenchmarkState state; - - GNUNET_ATS_TEST_TopologySetupDoneCallback done_cb; - - GNUNET_ATS_AddressInformationCallback ats_perf_cb; - - void *done_cb_cls; -}; - -enum OperationType -{ - START_SEND, - STOP_SEND, - START_PREFERENCE, - STOP_PREFERENCE -}; - -struct Episode; - -struct Experiment; - -typedef void (*GNUNET_ATS_TESTING_EpisodeDoneCallback) (struct Episode *e); - -typedef void (*GNUNET_ATS_TESTING_ExperimentDoneCallback) ( - struct Experiment *e, - struct GNUNET_TIME_Relative duration, - int success); - -/** - * An operation in an experiment - */ -struct GNUNET_ATS_TEST_Operation -{ - struct GNUNET_ATS_TEST_Operation *next; - struct GNUNET_ATS_TEST_Operation *prev; - - long long unsigned int src_id; - long long unsigned int dest_id; - - long long unsigned int base_rate; - long long unsigned int max_rate; - struct GNUNET_TIME_Relative period; - struct GNUNET_TIME_Relative frequency; - - enum OperationType type; - enum GeneratorType gen_type; - enum GNUNET_ATS_PreferenceKind pref_type; -}; - -struct Episode -{ - int id; - struct Episode *next; - struct GNUNET_TIME_Relative duration; - - struct GNUNET_ATS_TEST_Operation *head; - struct GNUNET_ATS_TEST_Operation *tail; -}; - - -struct Experiment -{ - char *name; - char *cfg_file; - unsigned long long int num_masters; - unsigned long long int num_slaves; - struct GNUNET_TIME_Relative log_freq; - struct GNUNET_TIME_Relative max_duration; - struct GNUNET_TIME_Relative total_duration; - struct GNUNET_TIME_Absolute start_time; - unsigned int num_episodes; - struct Episode *start; - - struct GNUNET_SCHEDULER_Task *experiment_timeout_task; - struct GNUNET_SCHEDULER_Task *episode_timeout_task; - struct Episode *cur; - - GNUNET_ATS_TESTING_EpisodeDoneCallback ep_done_cb; - GNUNET_ATS_TESTING_ExperimentDoneCallback e_done_cb; -}; - - -extern struct GNUNET_CONFIGURATION_Handle *cfg; - -/** - * Execute the specified experiment - * - * @param e the Experiment - * @param ep_done_cb a episode is completed - * @param e_done_cb the experiment is completed - */ -void -GNUNET_ATS_TEST_experimentation_run ( - struct Experiment *e, - GNUNET_ATS_TESTING_EpisodeDoneCallback ep_done_cb, - GNUNET_ATS_TESTING_ExperimentDoneCallback e_done_cb); - - -/** - * Load an experiment from a file - * - * @param filename the file - * @return the Experiment or NULL on failure - */ -struct Experiment * -GNUNET_ATS_TEST_experimentation_load (const char *filename); - - -/** - * Stop an experiment - * - * @param e the experiment - */ -void -GNUNET_ATS_TEST_experimentation_stop (struct Experiment *e); - - -void -GNUNET_ATS_TEST_traffic_handle_ping (struct BenchmarkPartner *p); - - -void -GNUNET_ATS_TEST_traffic_handle_pong (struct BenchmarkPartner *p); - - -/** - * Generate between the source master and the partner and send traffic with a - * maximum rate. - * - * @param src traffic source - * @param dest traffic partner - * @param type type of traffic to generate - * @param base_rate traffic base rate to send data with - * @param max_rate traffic maximum rate to send data with - * @param period duration of a period of traffic generation (~ 1/frequency) - * @param duration how long to generate traffic - * @return the traffic generator - */ -struct TrafficGenerator * -GNUNET_ATS_TEST_generate_traffic_start (struct BenchmarkPeer *src, - struct BenchmarkPartner *dest, - enum GeneratorType type, - unsigned int base_rate, - unsigned int max_rate, - struct GNUNET_TIME_Relative period, - struct GNUNET_TIME_Relative duration); - - -void -GNUNET_ATS_TEST_generate_traffic_stop (struct TrafficGenerator *tg); - - -/** - * Stop all traffic generators - */ -void -GNUNET_ATS_TEST_generate_traffic_stop_all (void); - - -/** - * Generate between the source master and the partner and set preferences with a - * value depending on the generator. - * - * @param src source - * @param dest partner - * @param type type of preferences to generate - * @param base_value traffic base rate to send data with - * @param value_rate traffic maximum rate to send data with - * @param period duration of a period of preferences generation (~ 1/frequency) - * @param frequency how long to generate preferences - * @param kind ATS preference to generate - * @return the traffic generator - */ -struct PreferenceGenerator * -GNUNET_ATS_TEST_generate_preferences_start ( - struct BenchmarkPeer *src, - struct BenchmarkPartner *dest, - enum GeneratorType type, - unsigned int base_value, - unsigned int value_rate, - struct GNUNET_TIME_Relative period, - struct GNUNET_TIME_Relative frequency, - enum GNUNET_ATS_PreferenceKind kind); - - -void -GNUNET_ATS_TEST_generate_preferences_stop (struct PreferenceGenerator *pg); - - -void -GNUNET_ATS_TEST_generate_preferences_stop_all (void); - - -/** - * Start logging - * - * @param log_frequency the logging frequency - * @param testname the testname - * @param masters the master peers used for benchmarking - * @param num_masters the number of master peers - * @param num_slaves the number of slave peers - * @param verbose verbose logging - * @return the logging handle or NULL on error - */ -struct LoggingHandle * -GNUNET_ATS_TEST_logging_start (struct GNUNET_TIME_Relative log_frequency, - const char *testname, - struct BenchmarkPeer *masters, - int num_masters, - int num_slaves, - int verbose); - - -/** - * Stop logging - * - * @param l the logging handle - */ -void -GNUNET_ATS_TEST_logging_clean_up (struct LoggingHandle *l); - - -/** - * Stop logging - * - * @param l the logging handle - */ -void -GNUNET_ATS_TEST_logging_stop (struct LoggingHandle *l); - - -/** - * Log all data now - * - * @param l logging handle to use - */ -void -GNUNET_ATS_TEST_logging_now (struct LoggingHandle *l); - - -/** - * Write logging data to file - * - * @param l logging handle to use - * @param test_name name of the current test - * @param plots create gnuplots: #GNUNET_YES or #GNUNET_NO - */ -void -GNUNET_ATS_TEST_logging_write_to_file (struct LoggingHandle *l, - const char *test_name, - int plots); - - -/** - * Topology related functions - */ -struct BenchmarkPeer * -GNUNET_ATS_TEST_get_peer (int src); - - -struct BenchmarkPartner * -GNUNET_ATS_TEST_get_partner (int src, int dest); - - -/** - * Create a topology for ats testing - * - * @param name test name - * @param cfg_file configuration file to use for the peers - * @param num_slaves number of slaves - * @param num_masters number of masters - * @param test_core connect to CORE service (#GNUNET_YES) or transport - * (#GNUNET_NO) - * @param done_cb function to call when topology is setup - * @param done_cb_cls cls for callback - * @param log_request_cb callback to call when logging is required - */ -void -GNUNET_ATS_TEST_create_topology ( - char *name, - char *cfg_file, - unsigned int num_slaves, - unsigned int num_masters, - int test_core, - GNUNET_ATS_TEST_TopologySetupDoneCallback done_cb, - void *done_cb_cls, - GNUNET_ATS_TEST_LogRequest ats_perf_cb); - - -/** - * Shutdown topology - */ -void -GNUNET_ATS_TEST_shutdown_topology (void); - - -/* end of file ats-testing.h */ diff --git a/src/ats-tests/experiments/evaluation1_dru_3_peers_1addr_1scope_prop.conf b/src/ats-tests/experiments/evaluation1_dru_3_peers_1addr_1scope_prop.conf deleted file mode 100644 index 4b66e5aea..000000000 --- a/src/ats-tests/experiments/evaluation1_dru_3_peers_1addr_1scope_prop.conf +++ /dev/null @@ -1,24 +0,0 @@ -@INLINE@ template_perf_ats.conf - -[transport] -plugins = unix - -[ats] -MODE = MLP -UNSPECIFIED_QUOTA_IN = 128 KiB -UNSPECIFIED_QUOTA_OUT = 128 KiB -# LOOPBACK -LOOPBACK_QUOTA_IN = 128 KiB -LOOPBACK_QUOTA_OUT = 128 KiB -# LAN -LAN_QUOTA_IN = 128 KiB -LAN_QUOTA_OUT = 128 KiB -# WAN -WAN_QUOTA_IN = 128 KiB -WAN_QUOTA_OUT = 128 KiB -# WLAN -WLAN_QUOTA_IN = 128 KiB -WLAN_QUOTA_OUT = 128 KiB -# BLUETOOTH -BLUETOOTH_QUOTA_IN = 128 KiB -BLUETOOTH_QUOTA_OUT = 128 KiB \ No newline at end of file diff --git a/src/ats-tests/experiments/evaluation1_dru_3_peers_1addr_1scope_prop.exp b/src/ats-tests/experiments/evaluation1_dru_3_peers_1addr_1scope_prop.exp deleted file mode 100644 index 6a04e7491..000000000 --- a/src/ats-tests/experiments/evaluation1_dru_3_peers_1addr_1scope_prop.exp +++ /dev/null @@ -1,46 +0,0 @@ -[experiment] -name = sc1_eval_dru_prop -masters = 1 -slaves = 3 -max_duration = 20 s -log_freq = 100 ms -cfg_file = experiments/evaluation1_dru_3_peers_1addr_1scope_prop.conf - -[episode-0] -# operations = start_send, stop_send, start_preference, stop_preference -duration = 10 s -op-0-operation = start_send -op-0-src = 0 -op-0-dest = 0 -op-0-type = constant -#op-0-period = 10 s -op-0-base-rate= 10000 -#op-0-max-rate = 10000 - -op-1-operation = start_send -op-1-src = 0 -op-1-dest = 1 -op-1-type = constant -#op-1-period = 10 s -op-1-base-rate= 10000 -#op-1-max-rate = 10000 - -op-2-operation = start_send -op-2-src = 0 -op-2-dest = 2 -op-2-type = constant -#op-1-period = 10 s -op-2-base-rate= 10000 -#op-1-max-rate = 10000 - -[episode-1] -duration = 10 s -op-0-operation = start_preference -op-0-src = 0 -op-0-dest = 2 -op-0-type = constant -#op-0-period = 10 s -op-0-pref = bandwidth -op-0-frequency = 1 s -op-0-base-rate= 50 -#op-0-max-rate = 10000 \ No newline at end of file diff --git a/src/ats-tests/experiments/send_linear_10_sec.exp b/src/ats-tests/experiments/send_linear_10_sec.exp deleted file mode 100644 index efd2c7b08..000000000 --- a/src/ats-tests/experiments/send_linear_10_sec.exp +++ /dev/null @@ -1,30 +0,0 @@ -[experiment] - name = test - masters = 1 - slaves = 3 - max_duration = 2 s - cfg_file = gnunet_ats_sim_default.conf - -[episode-0] -# operations = set_rate, start_send, stop_send, set_preference -duration = 2 s -op-0-operation = set_rate -op-0-src = 0 -op-0-dest = 0 -op-0-type = constant -op-0-base-rate= 10000 -op-0-max-rate = 10000 - -op-1-operation = set_rate -op-1-src = 0 -op-1-dest = 1 -op-1-type = constant -op-1-base-rate= 10000 -op-1-max-rate = 10000 - -op-2-operation = set_rate -op-2-src = 0 -op-2-dest = 2 -op-2-type = constant -op-2-base-rate= 10000 -op-2-max-rate = 10000 \ No newline at end of file diff --git a/src/ats-tests/experiments/test.exp b/src/ats-tests/experiments/test.exp deleted file mode 100644 index 636139f89..000000000 --- a/src/ats-tests/experiments/test.exp +++ /dev/null @@ -1,55 +0,0 @@ -[experiment] - name = test - masters = 1 - slaves = 2 - max_duration = 15 s - log_freq = 100 ms - cfg_file = gnunet_ats_sim_default.conf - -[episode-0] -# operations = start_send, stop_send, start_preference, stop_preference -duration = 10 s -op-0-operation = start_send -op-0-src = 0 -op-0-dest = 0 -op-0-type = constant -op-0-base-rate= 10000 -op-0-max-rate = 10000 - -op-1-operation = start_send -op-1-src = 0 -op-1-dest = 1 -op-1-type = sinus -op-1-period = 5 s -op-1-base-rate= 10000 -op-1-max-rate = 15000 - -op-2-operation = start_preference -op-2-src = 0 -op-2-dest = 0 -op-2-type = constant -op-2-period = 5 s -op-2-base-rate= 10 -op-2-max-rate = 5 -op-2-pref = latency -op-2-frequency = 2 s - -op-3-operation = start_preference -op-3-src = 0 -op-3-dest = 1 -op-3-type = linear -op-3-period = 5 s -op-3-base-rate= 40 -op-3-max-rate = 50 -op-3-pref = bandwidth -op-3-frequency = 750 ms - -[episode-1] -duration = 5 s -op-0-operation = stop_preference -op-0-src = 0 -op-0-dest = 0 - -op-1-operation = stop_preference -op-1-src = 0 -op-1-dest = 1 diff --git a/src/ats-tests/gnunet-ats-sim.c b/src/ats-tests/gnunet-ats-sim.c deleted file mode 100644 index 15cd52e2f..000000000 --- a/src/ats-tests/gnunet-ats-sim.c +++ /dev/null @@ -1,399 +0,0 @@ -/* - This file is part of GNUnet. - Copyright (C) 2010-2013 GNUnet e.V. - - GNUnet is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - GNUnet 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 - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - - SPDX-License-Identifier: AGPL3.0-or-later - */ -/** - * @file ats-tests/gnunet-ats-sim.c - * @brief ats traffic simulator: this tool uses the ats-test library to setup a - * topology and generate traffic between these peers. The traffic description - * is loaded from a experiment description file - * @author Christian Grothoff - * @author Matthias Wachs - */ -#include "platform.h" -#include "gnunet_util_lib.h" -#include "gnunet_testbed_service.h" -#include "gnunet_ats_service.h" -#include "gnunet_core_service.h" -#include "ats-testing.h" - -#define TEST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, \ - 10) - -static struct BenchmarkPeer *masters_p; -static struct BenchmarkPeer *slaves_p; - -/** - * cmd option -e: experiment file - */ -static char *opt_exp_file; - -/** - * cmd option -l: enable logging - */ -static int opt_log; - -/** - * cmd option -p: enable plots - */ -static int opt_plot; - -/** - * cmd option -v: verbose logs - */ -static int opt_verbose; - -static struct GNUNET_SCHEDULER_Task *timeout_task; - -static struct Experiment *e; - -static struct LoggingHandle *l; - - -static void -evaluate (struct GNUNET_TIME_Relative duration_total) -{ - int c_m; - int c_s; - unsigned int duration; - struct BenchmarkPeer *mp; - struct BenchmarkPartner *p; - - unsigned int b_sent_sec; - double kb_sent_percent; - unsigned int b_recv_sec; - double kb_recv_percent; - unsigned int rtt; - - - duration = (duration_total.rel_value_us / (1000 * 1000)); - if (0 == duration) - duration = 1; - for (c_m = 0; c_m < e->num_masters; c_m++) - { - mp = &masters_p[c_m]; - fprintf (stderr, - _ ( - "Master [%u]: sent: %u KiB in %u sec. = %u KiB/s, received: %u KiB in %u sec. = %u KiB/s\n"), - mp->no, mp->total_bytes_sent / 1024, - duration, - (mp->total_bytes_sent / 1024) / duration, - mp->total_bytes_received / 1024, - duration, - (mp->total_bytes_received / 1024) / duration); - - for (c_s = 0; c_s < e->num_slaves; c_s++) - { - p = &mp->partners[c_s]; - - b_sent_sec = 0; - b_recv_sec = 0; - kb_sent_percent = 0.0; - kb_recv_percent = 0.0; - rtt = 0; - - if (duration > 0) - { - b_sent_sec = p->bytes_sent / duration; - b_recv_sec = p->bytes_received / duration; - } - - if (mp->total_bytes_sent > 0) - kb_sent_percent = ((double) p->bytes_sent * 100) / mp->total_bytes_sent; - if (mp->total_bytes_received > 0) - kb_recv_percent = ((double) p->bytes_received * 100) - / mp->total_bytes_received; - if (1000 * p->messages_sent > 0) - rtt = p->total_app_rtt / (1000 * p->messages_sent); - fprintf (stderr, - "%c Master [%u] -> Slave [%u]: sent %u Bips (%.2f %%), received %u Bips (%.2f %%)\n", - (mp->pref_partner == p->dest) ? '*' : ' ', - mp->no, p->dest->no, - b_sent_sec, kb_sent_percent, - b_recv_sec, kb_recv_percent); - fprintf (stderr, - "%c Master [%u] -> Slave [%u]: Average application layer RTT: %u ms\n", - (mp->pref_partner == p->dest) ? '*' : ' ', - mp->no, p->dest->no, rtt); - } - } -} - - -static void -do_shutdown (void *cls) -{ - fprintf (stderr, "Shutdown\n"); - if (NULL != timeout_task) - { - GNUNET_SCHEDULER_cancel (timeout_task); - timeout_task = NULL; - } - if (NULL != l) - { - GNUNET_ATS_TEST_logging_stop (l); - GNUNET_ATS_TEST_logging_clean_up (l); - l = NULL; - } - - /* Stop traffic generation */ - GNUNET_ATS_TEST_generate_traffic_stop_all (); - - /* Stop all preference generations */ - GNUNET_ATS_TEST_generate_preferences_stop_all (); - - if (NULL != e) - { - GNUNET_ATS_TEST_experimentation_stop (e); - e = NULL; - } - GNUNET_ATS_TEST_shutdown_topology (); -} - - -static void -do_timeout (void *cls) -{ - timeout_task = NULL; - GNUNET_SCHEDULER_shutdown (); -} - - -static void -log_request__cb (void *cls, - const struct GNUNET_HELLO_Address *address, - int address_active, - struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, - struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, - const struct GNUNET_ATS_Properties *ats) -{ - if (NULL != l) - { - // GNUNET_break (0); - // GNUNET_ATS_TEST_logging_now (l); - } -} - - -static void -experiment_done_cb (struct Experiment *e, - struct GNUNET_TIME_Relative duration, - int success) -{ - if (GNUNET_OK == success) - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Experiment done successful in %s\n", - GNUNET_STRINGS_relative_time_to_string (duration, - GNUNET_YES)); - else - GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Experiment failed \n"); - - /* Stop logging */ - GNUNET_ATS_TEST_logging_stop (l); - - /* Stop traffic generation */ - GNUNET_ATS_TEST_generate_traffic_stop_all (); - - /* Stop all preference generations */ - GNUNET_ATS_TEST_generate_preferences_stop_all (); - - evaluate (duration); - if (opt_log) - GNUNET_ATS_TEST_logging_write_to_file (l, opt_exp_file, opt_plot); - GNUNET_SCHEDULER_shutdown (); -} - - -static void -episode_done_cb (struct Episode *ep) -{ - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Episode %u done\n", - ep->id); -} - - -static void -topology_setup_done (void *cls, - struct BenchmarkPeer *masters, - struct BenchmarkPeer *slaves) -{ - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Topology setup complete!\n"); - - masters_p = masters; - slaves_p = slaves; - - l = GNUNET_ATS_TEST_logging_start (e->log_freq, - e->name, - masters_p, - e->num_masters, e->num_slaves, - opt_verbose); - GNUNET_ATS_TEST_experimentation_run (e, - &episode_done_cb, - &experiment_done_cb); -/* - GNUNET_ATS_TEST_generate_preferences_start(&masters[0],&masters[0].partners[0], - GNUNET_ATS_TEST_TG_CONSTANT, 1, 1, GNUNET_TIME_UNIT_SECONDS, - GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 250), - GNUNET_ATS_PREFERENCE_BANDWIDTH); - *//* - GNUNET_ATS_TEST_generate_preferences_start(&masters[0],&masters[0].partners[0], - GNUNET_ATS_TEST_TG_LINEAR, 1, 50, - GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 2), - GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 250), - GNUNET_ATS_PREFERENCE_BANDWIDTH); - *//* - GNUNET_ATS_TEST_generate_preferences_start(&masters[0],&masters[0].partners[0], - GNUNET_ATS_TEST_TG_RANDOM, 1, 50, - GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 2), - GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 250), - GNUNET_ATS_PREFERENCE_BANDWIDTH); - *//* - GNUNET_ATS_TEST_generate_preferences_start(&masters[0],&masters[0].partners[0], - GNUNET_ATS_TEST_TG_SINUS, 10, 5, - GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 5), - GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 250), - GNUNET_ATS_PREFERENCE_BANDWIDTH); - */ -#if 0 - int c_m; - int c_s; - for (c_m = 0; c_m < e->num_masters; c_m++) - { - for (c_s = 0; c_s < e->num_slaves; c_s++) - { - /* Generate maximum traffic to all peers */ - /* Example: Generate traffic with constant 10,000 Bytes/s */ - GNUNET_ATS_TEST_generate_traffic_start (&masters[c_m], - &masters[c_m].partners[c_s], - GNUNET_ATS_TEST_TG_CONSTANT, - 10000, - GNUNET_TIME_UNIT_FOREVER_REL); - /* Example: Generate traffic with an increasing rate from 1000 to 2000 - * Bytes/s with in a minute */ - GNUNET_ATS_TEST_generate_traffic_start (&masters[c_m], - &masters[c_m].partners[c_s], - GNUNET_ATS_TEST_TG_LINEAR, - 1000, - 2000, - GNUNET_TIME_UNIT_MINUTES, - GNUNET_TIME_UNIT_FOREVER_REL); - /* Example: Generate traffic with a random rate between 1000 to 2000 - * Bytes/s */ - GNUNET_ATS_TEST_generate_traffic_start (&masters[c_m], - &masters[c_m].partners[c_s], - GNUNET_ATS_TEST_TG_RANDOM, - 1000, - 2000, - GNUNET_TIME_UNIT_FOREVER_REL, - GNUNET_TIME_UNIT_FOREVER_REL); - /* Example: Generate traffic with a sinus form, a base rate of - * 1000 Bytes/s, an amplitude of (max-base), and a period of 1 minute */ - GNUNET_ATS_TEST_generate_traffic_start (&masters[c_m], - &masters[c_m].partners[c_s], - GNUNET_ATS_TEST_TG_SINUS, - 1000, - 2000, - GNUNET_TIME_UNIT_MINUTES, - GNUNET_TIME_UNIT_FOREVER_REL); - } - } -#endif - - timeout_task - = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_add ( - GNUNET_TIME_UNIT_MINUTES, - e->max_duration), - &do_timeout, - NULL); - GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); -} - - -static void -parse_args (int argc, char *argv[]) -{ - int c; - - opt_exp_file = NULL; - opt_log = GNUNET_NO; - opt_plot = GNUNET_NO; - - for (c = 0; c < argc; c++) - { - if ((c < (argc - 1)) && (0 == strcmp (argv[c], "-e"))) - { - GNUNET_free (opt_exp_file); - opt_exp_file = GNUNET_strdup (argv[c + 1]); - } - if (0 == strcmp (argv[c], "-l")) - { - opt_log = GNUNET_YES; - } - if (0 == strcmp (argv[c], "-p")) - { - opt_plot = GNUNET_YES; - } - if (0 == strcmp (argv[c], "-v")) - { - opt_verbose = GNUNET_YES; - } - } -} - - -int -main (int argc, char *argv[]) -{ - GNUNET_log_setup ("gnunet-ats-sim", "INFO", NULL); - - parse_args (argc, argv); - if (NULL == opt_exp_file) - { - fprintf (stderr, "No experiment given...\n"); - return 1; - } - - fprintf (stderr, "Loading experiment `%s' \n", opt_exp_file); - e = GNUNET_ATS_TEST_experimentation_load (opt_exp_file); - if (NULL == e) - { - fprintf (stderr, "Invalid experiment\n"); - return 1; - } - if (0 == e->num_episodes) - { - fprintf (stderr, "No episodes included\n"); - return 1; - } - - /* Setup a topology with */ - GNUNET_ATS_TEST_create_topology ("gnunet-ats-sim", e->cfg_file, - e->num_slaves, - e->num_masters, - GNUNET_NO, - &topology_setup_done, - NULL, - &log_request__cb); - GNUNET_free (opt_exp_file); - return 0; -} - - -/* end of file gnunet-ats-sim.c */ diff --git a/src/ats-tests/gnunet-solver-eval.c b/src/ats-tests/gnunet-solver-eval.c deleted file mode 100644 index 7a3461bf7..000000000 --- a/src/ats-tests/gnunet-solver-eval.c +++ /dev/null @@ -1,1025 +0,0 @@ -/* - This file is part of GNUnet. - Copyright (C) 2010-2013 GNUnet e.V. - - GNUnet is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - GNUnet 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 - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - - SPDX-License-Identifier: AGPL3.0-or-later - */ -/** - * @file ats-tests/ats-testing-experiment.c - * @brief ats benchmark: controlled experiment execution - * @author Christian Grothoff - * @author Matthias Wachs - */ -#include "platform.h" -#include "gnunet_util_lib.h" -#include "gnunet_ats_plugin.h" -#include "gnunet_ats_service.h" -#include "ats-testing.h" - - -/** - * Experiments - */ -const char * -print_op (enum OperationType op) -{ - switch (op) - { - case START_SEND: - return "START_SEND"; - - case STOP_SEND: - return "STOP_SEND"; - - case START_PREFERENCE: - return "START_PREFERENCE"; - - case STOP_PREFERENCE: - return "STOP_PREFERENCE"; - - default: - break; - } - return ""; -} - - -static struct Experiment * -create_experiment () -{ - struct Experiment *e; - - e = GNUNET_new (struct Experiment); - e->name = NULL; - e->num_masters = 0; - e->num_slaves = 0; - e->start = NULL; - e->total_duration = GNUNET_TIME_UNIT_ZERO; - return e; -} - - -static void -free_experiment (struct Experiment *e) -{ - struct Episode *cur; - struct Episode *next; - struct GNUNET_ATS_TEST_Operation *cur_o; - struct GNUNET_ATS_TEST_Operation *next_o; - - next = e->start; - for (cur = next; NULL != cur; cur = next) - { - next = cur->next; - - next_o = cur->head; - for (cur_o = next_o; NULL != cur_o; cur_o = next_o) - { - next_o = cur_o->next; - GNUNET_free (cur_o); - } - GNUNET_free (cur); - } - - GNUNET_free (e->name); - GNUNET_free (e->cfg_file); - GNUNET_free (e); -} - - -static int -load_episode (struct Experiment *e, - struct Episode *cur, - struct GNUNET_CONFIGURATION_Handle *cfg) -{ - struct GNUNET_ATS_TEST_Operation *o; - char *sec_name; - char *op_name; - char *op; - char *type; - char *pref; - int op_counter = 0; - - fprintf (stderr, "Parsing episode %u\n", cur->id); - GNUNET_asprintf (&sec_name, "episode-%u", cur->id); - - while (1) - { - /* Load operation */ - GNUNET_asprintf (&op_name, "op-%u-operation", op_counter); - if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg, - sec_name, - op_name, &op)) - { - GNUNET_free (op_name); - break; - } - o = GNUNET_new (struct GNUNET_ATS_TEST_Operation); - /* operations = set_rate, start_send, stop_send, set_preference */ - if (0 == strcmp (op, "start_send")) - { - o->type = START_SEND; - } - else if (0 == strcmp (op, "stop_send")) - { - o->type = STOP_SEND; - } - else if (0 == strcmp (op, "start_preference")) - { - o->type = START_PREFERENCE; - } - else if (0 == strcmp (op, "stop_preference")) - { - o->type = STOP_PREFERENCE; - } - else - { - fprintf (stderr, "Invalid operation %u `%s' in episode %u\n", - op_counter, op, cur->id); - GNUNET_free (op); - GNUNET_free (op_name); - GNUNET_free (sec_name); - GNUNET_free (o); - return GNUNET_SYSERR; - } - GNUNET_free (op_name); - - /* Get source */ - GNUNET_asprintf (&op_name, "op-%u-src", op_counter); - if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg, - sec_name, - op_name, - &o->src_id)) - { - fprintf (stderr, "Missing src in operation %u `%s' in episode %u\n", - op_counter, op, cur->id); - GNUNET_free (op); - GNUNET_free (op_name); - GNUNET_free (sec_name); - GNUNET_free (o); - return GNUNET_SYSERR; - } - if (o->src_id > (e->num_masters - 1)) - { - fprintf (stderr, "Invalid src %llu in operation %u `%s' in episode %u\n", - o->src_id, op_counter, op, cur->id); - GNUNET_free (op); - GNUNET_free (op_name); - GNUNET_free (sec_name); - GNUNET_free (o); - return GNUNET_SYSERR; - } - GNUNET_free (op_name); - - /* Get destination */ - GNUNET_asprintf (&op_name, "op-%u-dest", op_counter); - if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg, - sec_name, - op_name, - &o->dest_id)) - { - fprintf (stderr, "Missing src in operation %u `%s' in episode %u\n", - op_counter, op, cur->id); - GNUNET_free (op); - GNUNET_free (op_name); - GNUNET_free (sec_name); - GNUNET_free (o); - return GNUNET_SYSERR; - } - if (o->dest_id > (e->num_slaves - 1)) - { - fprintf (stderr, - "Invalid destination %llu in operation %u `%s' in episode %u\n", - o->dest_id, - op_counter, - op, - cur->id); - GNUNET_free (op); - GNUNET_free (op_name); - GNUNET_free (sec_name); - GNUNET_free (o); - return GNUNET_SYSERR; - } - GNUNET_free (op_name); - - GNUNET_asprintf (&op_name, "op-%u-type", op_counter); - if ((GNUNET_SYSERR != - GNUNET_CONFIGURATION_get_value_string (cfg, - sec_name, - op_name, - &type)) && - (STOP_SEND != o->type) && - (STOP_PREFERENCE != o->type)) - { - /* Load arguments for set_rate, start_send, set_preference */ - if (0 == strcmp (type, "constant")) - { - o->gen_type = GNUNET_ATS_TEST_TG_CONSTANT; - } - else if (0 == strcmp (type, "linear")) - { - o->gen_type = GNUNET_ATS_TEST_TG_LINEAR; - } - else if (0 == strcmp (type, "sinus")) - { - o->gen_type = GNUNET_ATS_TEST_TG_SINUS; - } - else if (0 == strcmp (type, "random")) - { - o->gen_type = GNUNET_ATS_TEST_TG_RANDOM; - } - else - { - fprintf (stderr, "Invalid type %u `%s' in episode %u\n", - op_counter, op, cur->id); - GNUNET_free (type); - GNUNET_free (op); - GNUNET_free (op_name); - GNUNET_free (sec_name); - GNUNET_free (o); - return GNUNET_SYSERR; - } - GNUNET_free (op_name); - - /* Get base rate */ - GNUNET_asprintf (&op_name, "op-%u-base-rate", op_counter); - if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg, - sec_name, - op_name, - &o->base_rate)) - { - fprintf (stderr, - "Missing base rate in operation %u `%s' in episode %u\n", - op_counter, op, cur->id); - GNUNET_free (type); - GNUNET_free (op); - GNUNET_free (op_name); - GNUNET_free (sec_name); - GNUNET_free (o); - return GNUNET_SYSERR; - } - GNUNET_free (op_name); - - /* Get max rate */ - GNUNET_asprintf (&op_name, "op-%u-max-rate", op_counter); - if (GNUNET_SYSERR == - GNUNET_CONFIGURATION_get_value_number (cfg, - sec_name, - op_name, - &o->max_rate)) - { - if ((GNUNET_ATS_TEST_TG_LINEAR == o->gen_type) || - (GNUNET_ATS_TEST_TG_RANDOM == o->gen_type) || - (GNUNET_ATS_TEST_TG_SINUS == o->gen_type)) - { - fprintf (stderr, - "Missing max rate in operation %u `%s' in episode %u\n", - op_counter, op, cur->id); - GNUNET_free (type); - GNUNET_free (op_name); - GNUNET_free (op); - GNUNET_free (sec_name); - GNUNET_free (o); - return GNUNET_SYSERR; - } - } - GNUNET_free (op_name); - - /* Get period */ - GNUNET_asprintf (&op_name, "op-%u-period", op_counter); - if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (cfg, - sec_name, - op_name, - &o->period)) - { - o->period = cur->duration; - } - GNUNET_free (op_name); - - if (START_PREFERENCE == o->type) - { - /* Get frequency */ - GNUNET_asprintf (&op_name, "op-%u-frequency", op_counter); - if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (cfg, - sec_name, - op_name, - &o->frequency)) - { - fprintf (stderr, - "Missing frequency in operation %u `%s' in episode %u\n", - op_counter, op, cur->id); - GNUNET_free (type); - GNUNET_free (op_name); - GNUNET_free (op); - GNUNET_free (sec_name); - GNUNET_free (o); - return GNUNET_SYSERR; - } - GNUNET_free (op_name); - - /* Get preference */ - GNUNET_asprintf (&op_name, "op-%u-pref", op_counter); - if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg, - sec_name, - op_name, - &pref)) - { - fprintf (stderr, - "Missing preference in operation %u `%s' in episode %u\n", - op_counter, op, cur->id); - GNUNET_free (type); - GNUNET_free (op_name); - GNUNET_free (op); - GNUNET_free (sec_name); - GNUNET_free (pref); - GNUNET_free (o); - return GNUNET_SYSERR; - } - - if (0 == strcmp (pref, "bandwidth")) - o->pref_type = GNUNET_ATS_PREFERENCE_BANDWIDTH; - else if (0 == strcmp (pref, "latency")) - o->pref_type = GNUNET_ATS_PREFERENCE_LATENCY; - else - { - fprintf (stderr, - "Invalid preference in operation %u `%s' in episode %u\n", - op_counter, - op, - cur->id); - GNUNET_free (type); - GNUNET_free (op_name); - GNUNET_free (op); - GNUNET_free (sec_name); - GNUNET_free (pref); - GNUNET_free (o); - return GNUNET_SYSERR; - } - GNUNET_free (pref); - GNUNET_free (op_name); - } - } - - /* Safety checks */ - if ((GNUNET_ATS_TEST_TG_LINEAR == o->gen_type) || - (GNUNET_ATS_TEST_TG_SINUS == o->gen_type)) - { - if ((o->max_rate - o->base_rate) > o->base_rate) - { - /* This will cause an underflow */ - GNUNET_break (0); - } - fprintf (stderr, - "Selected max rate and base rate cannot be used for desired traffic form!\n"); - } - - if ((START_SEND == o->type) || (START_PREFERENCE == o->type)) - fprintf (stderr, - "Found operation %u in episode %u: %s [%llu]->[%llu] == %s, %llu -> %llu in %s\n", - op_counter, cur->id, print_op (o->type), o->src_id, - o->dest_id, (NULL != type) ? type : "", - o->base_rate, o->max_rate, - GNUNET_STRINGS_relative_time_to_string (o->period, GNUNET_YES)); - else - fprintf (stderr, "Found operation %u in episode %u: %s [%llu]->[%llu]\n", - op_counter, cur->id, print_op (o->type), o->src_id, o->dest_id); - - GNUNET_free (type); - GNUNET_free (op); - - GNUNET_CONTAINER_DLL_insert (cur->head, cur->tail, o); - op_counter++; - } - GNUNET_free (sec_name); - - return GNUNET_OK; -} - - -static int -load_episodes (struct Experiment *e, struct GNUNET_CONFIGURATION_Handle *cfg) -{ - int e_counter = 0; - char *sec_name; - struct GNUNET_TIME_Relative e_duration; - struct Episode *cur; - struct Episode *last; - - e_counter = 0; - last = NULL; - while (1) - { - GNUNET_asprintf (&sec_name, "episode-%u", e_counter); - if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (cfg, - sec_name, - "duration", - &e_duration)) - { - GNUNET_free (sec_name); - break; - } - - cur = GNUNET_new (struct Episode); - cur->duration = e_duration; - cur->id = e_counter; - - if (GNUNET_OK != load_episode (e, cur, cfg)) - { - GNUNET_free (sec_name); - GNUNET_free (cur); - return GNUNET_SYSERR; - } - - fprintf (stderr, "Found episode %u with duration %s \n", - e_counter, - GNUNET_STRINGS_relative_time_to_string (cur->duration, - GNUNET_YES)); - - /* Update experiment */ - e->num_episodes++; - e->total_duration = GNUNET_TIME_relative_add (e->total_duration, - cur->duration); - /* Put in linked list */ - if (NULL == last) - e->start = cur; - else - last->next = cur; - - GNUNET_free (sec_name); - e_counter++; - last = cur; - } - return e_counter; -} - - -static void -timeout_experiment (void *cls) -{ - struct Experiment *e = cls; - - e->experiment_timeout_task = NULL; - fprintf (stderr, "Experiment timeout!\n"); - - if (NULL != e->episode_timeout_task) - { - GNUNET_SCHEDULER_cancel (e->episode_timeout_task); - e->episode_timeout_task = NULL; - } - - e->e_done_cb (e, GNUNET_TIME_absolute_get_duration (e->start_time), - GNUNET_SYSERR); -} - - -static void -enforce_start_send (struct GNUNET_ATS_TEST_Operation *op) -{ - /* - struct BenchmarkPeer *peer; - struct BenchmarkPartner *partner; - - peer = GNUNET_ATS_TEST_get_peer (op->src_id); - if (NULL == peer) - { - GNUNET_break (0); - return; - } - - partner = GNUNET_ATS_TEST_get_partner (op->src_id, op->dest_id); - if (NULL == partner) - { - GNUNET_break (0); - return; - } - - fprintf (stderr, "Found master %llu slave %llu\n",op->src_id, op->dest_id); - - if (NULL != partner->tg) - { - fprintf (stderr, "Stopping traffic between master %llu slave %llu\n",op->src_id, op->dest_id); - GNUNET_ATS_TEST_generate_traffic_stop(partner->tg); - partner->tg = NULL; - } - - partner->tg = GNUNET_ATS_TEST_generate_traffic_start(peer, partner, - op->tg_type, op->base_rate, op->max_rate, op->period, - GNUNET_TIME_UNIT_FOREVER_REL); - */} - - -static void -enforce_stop_send (struct GNUNET_ATS_TEST_Operation *op) -{ - /* - struct BenchmarkPartner *p; - p = GNUNET_ATS_TEST_get_partner (op->src_id, op->dest_id); - if (NULL == p) - { - GNUNET_break (0); - return; - } - - fprintf (stderr, "Found master %llu slave %llu\n",op->src_id, op->dest_id); - - if (NULL != p->tg) - { - fprintf (stderr, "Stopping traffic between master %llu slave %llu\n", - op->src_id, op->dest_id); - GNUNET_ATS_TEST_generate_traffic_stop(p->tg); - p->tg = NULL; - } - */} - - -static void -enforce_start_preference (struct GNUNET_ATS_TEST_Operation *op) -{ - /* - struct BenchmarkPeer *peer; - struct BenchmarkPartner *partner; - - peer = GNUNET_ATS_TEST_get_peer (op->src_id); - if (NULL == peer) - { - GNUNET_break (0); - return; - } - - partner = GNUNET_ATS_TEST_get_partner (op->src_id, op->dest_id); - if (NULL == partner) - { - GNUNET_break (0); - return; - } - - fprintf (stderr, "Found master %llu slave %llu\n",op->src_id, op->dest_id); - - if (NULL != partner->pg) - { - fprintf (stderr, "Stopping traffic between master %llu slave %llu\n", - op->src_id, op->dest_id); - GNUNET_ATS_TEST_generate_preferences_stop(partner->pg); - partner->pg = NULL; - } - - partner->pg = GNUNET_ATS_TEST_generate_preferences_start(peer, partner, - op->tg_type, op->base_rate, op->max_rate, op->period, op->frequency, - op->pref_type); - */} - - -static void -enforce_stop_preference (struct GNUNET_ATS_TEST_Operation *op) -{ - /* - struct BenchmarkPartner *p; - p = GNUNET_ATS_TEST_get_partner (op->src_id, op->dest_id); - if (NULL == p) - { - GNUNET_break (0); - return; - } - - fprintf (stderr, "Found master %llu slave %llu\n",op->src_id, op->dest_id); - - if (NULL != p->pg) - { - fprintf (stderr, "Stopping preference between master %llu slave %llu\n", - op->src_id, op->dest_id); - GNUNET_ATS_TEST_generate_preferences_stop (p->pg); - p->pg = NULL; - } - */} - - -static void -enforce_episode (struct Episode *ep) -{ - struct GNUNET_ATS_TEST_Operation *cur; - - for (cur = ep->head; NULL != cur; cur = cur->next) - { - fprintf (stderr, "Enforcing operation: %s [%llu]->[%llu] == %llu\n", - print_op (cur->type), cur->src_id, cur->dest_id, cur->base_rate); - switch (cur->type) - { - case START_SEND: - enforce_start_send (cur); - break; - - case STOP_SEND: - enforce_stop_send (cur); - break; - - case START_PREFERENCE: - enforce_start_preference (cur); - break; - - case STOP_PREFERENCE: - enforce_stop_preference (cur); - break; - - default: - break; - } - } -} - - -static void -timeout_episode (void *cls) -{ - struct Experiment *e = cls; - - e->episode_timeout_task = NULL; - if (NULL != e->ep_done_cb) - e->ep_done_cb (e->cur); - - /* Scheduling next */ - e->cur = e->cur->next; - if (NULL == e->cur) - { - /* done */ - fprintf (stderr, "Last episode done!\n"); - if (NULL != e->experiment_timeout_task) - { - GNUNET_SCHEDULER_cancel (e->experiment_timeout_task); - e->experiment_timeout_task = NULL; - } - e->e_done_cb (e, GNUNET_TIME_absolute_get_duration (e->start_time), - GNUNET_OK); - return; - } - - fprintf (stderr, "Running episode %u with timeout %s\n", - e->cur->id, - GNUNET_STRINGS_relative_time_to_string (e->cur->duration, - GNUNET_YES)); - enforce_episode (e->cur); - - e->episode_timeout_task = GNUNET_SCHEDULER_add_delayed (e->cur->duration, - &timeout_episode, e); -} - - -void -GNUNET_ATS_solvers_experimentation_run (struct Experiment *e, - GNUNET_ATS_TESTING_EpisodeDoneCallback - ep_done_cb, - GNUNET_ATS_TESTING_ExperimentDoneCallback - e_done_cb) -{ - fprintf (stderr, "Running experiment `%s' with timeout %s\n", e->name, - GNUNET_STRINGS_relative_time_to_string (e->max_duration, - GNUNET_YES)); - e->e_done_cb = e_done_cb; - e->ep_done_cb = ep_done_cb; - e->start_time = GNUNET_TIME_absolute_get (); - - /* Start total time out */ - e->experiment_timeout_task = GNUNET_SCHEDULER_add_delayed (e->max_duration, - &timeout_experiment, - e); - - /* Start */ - e->cur = e->start; - fprintf (stderr, "Running episode %u with timeout %s\n", - e->cur->id, - GNUNET_STRINGS_relative_time_to_string (e->cur->duration, - GNUNET_YES)); - enforce_episode (e->cur); - e->episode_timeout_task = GNUNET_SCHEDULER_add_delayed (e->cur->duration, - &timeout_episode, e); -} - - -struct Experiment * -GNUNET_ATS_solvers_experimentation_load (char *filename) -{ - struct Experiment *e; - struct GNUNET_CONFIGURATION_Handle *cfg; - - e = NULL; - - cfg = GNUNET_CONFIGURATION_create (); - if (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (cfg, filename)) - { - fprintf (stderr, "Failed to load `%s'\n", filename); - GNUNET_CONFIGURATION_destroy (cfg); - return NULL; - } - - e = create_experiment (); - - if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg, "experiment", - "name", &e->name)) - { - fprintf (stderr, "Invalid %s", "name"); - free_experiment (e); - return NULL; - } - else - fprintf (stderr, "Experiment name: `%s'\n", e->name); - - if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_filename (cfg, - "experiment", - "cfg_file", - &e->cfg_file)) - { - fprintf (stderr, "Invalid %s", "cfg_file"); - free_experiment (e); - return NULL; - } - else - fprintf (stderr, "Experiment name: `%s'\n", e->cfg_file); - - if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg, "experiment", - "masters", - &e->num_masters)) - { - fprintf (stderr, "Invalid %s", "masters"); - free_experiment (e); - return NULL; - } - else - fprintf (stderr, "Experiment masters: `%llu'\n", - e->num_masters); - - if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg, "experiment", - "slaves", - &e->num_slaves)) - { - fprintf (stderr, "Invalid %s", "slaves"); - free_experiment (e); - return NULL; - } - else - fprintf (stderr, "Experiment slaves: `%llu'\n", - e->num_slaves); - - if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (cfg, "experiment", - "log_freq", - &e->log_freq)) - { - fprintf (stderr, "Invalid %s", "log_freq"); - free_experiment (e); - return NULL; - } - else - fprintf (stderr, "Experiment logging frequency: `%s'\n", - GNUNET_STRINGS_relative_time_to_string (e->log_freq, GNUNET_YES)); - - if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (cfg, "experiment", - "max_duration", - &e->max_duration)) - { - fprintf (stderr, "Invalid %s", "max_duration"); - free_experiment (e); - return NULL; - } - else - fprintf (stderr, "Experiment duration: `%s'\n", - GNUNET_STRINGS_relative_time_to_string (e->max_duration, - GNUNET_YES)); - - load_episodes (e, cfg); - fprintf (stderr, "Loaded %u episodes with total duration %s\n", - e->num_episodes, - GNUNET_STRINGS_relative_time_to_string (e->total_duration, - GNUNET_YES)); - - GNUNET_CONFIGURATION_destroy (cfg); - return e; -} - - -void -GNUNET_ATS_solvers_experimentation_stop (struct Experiment *e) -{ - if (NULL != e->experiment_timeout_task) - { - GNUNET_SCHEDULER_cancel (e->experiment_timeout_task); - e->experiment_timeout_task = NULL; - } - if (NULL != e->episode_timeout_task) - { - GNUNET_SCHEDULER_cancel (e->episode_timeout_task); - e->episode_timeout_task = NULL; - } - free_experiment (e); -} - - -/** - * Solver - */ - -struct GNUNET_ATS_TESTING_SolverHandle -{ - char *plugin; - struct GNUNET_ATS_PluginEnvironment env; - void *solver; -}; - -enum GNUNET_ATS_Solvers -{ - GNUNET_ATS_SOLVER_PROPORTIONAL, - GNUNET_ATS_SOLVER_MLP, - GNUNET_ATS_SOLVER_RIL, -}; - -void -GNUNET_ATS_solvers_solver_stop (struct GNUNET_ATS_TESTING_SolverHandle *sh) -{ - GNUNET_PLUGIN_unload (sh->plugin, sh->solver); - GNUNET_free (sh->plugin); - GNUNET_free (sh); -} - - -struct GNUNET_ATS_TESTING_SolverHandle * -GNUNET_ATS_solvers_solver_start (enum GNUNET_ATS_Solvers type) -{ - struct GNUNET_ATS_TESTING_SolverHandle *sh; - char *solver_str; - - switch (type) - { - case GNUNET_ATS_SOLVER_PROPORTIONAL: - solver_str = "proportional"; - break; - - case GNUNET_ATS_SOLVER_MLP: - solver_str = "mlp"; - break; - - case GNUNET_ATS_SOLVER_RIL: - solver_str = "ril"; - break; - - default: - GNUNET_break (0); - return NULL; - break; - } - - sh = GNUNET_new (struct GNUNET_ATS_TESTING_SolverHandle); - GNUNET_asprintf (&sh->plugin, "libgnunet_plugin_ats_%s", solver_str); - // sh->solver = GNUNET_PLUGIN_load (sh->plugin, &sh->env); - if (NULL == sh->solver) - { - fprintf (stderr, "Failed to load solver `%s'\n", sh->plugin); - exit (1); - } - - return sh; -} - - -static struct Experiment *e; - -static struct GNUNET_ATS_TESTING_SolverHandle *sh; - -/** - * cmd option -e: experiment file - */ -static char *opt_exp_file; - -static char *opt_solver; - -/** - * cmd option -l: enable logging - */ -static int opt_log; - -/** - * cmd option -p: enable plots - */ -static int opt_plot; - -/** - * cmd option -v: verbose logs - */ -static int opt_verbose; - -static void -run (void *cls, char *const *args, const char *cfgfile, - const struct GNUNET_CONFIGURATION_Handle *cfg) -{ - enum GNUNET_ATS_Solvers solver; - - if (NULL == opt_exp_file) - { - fprintf (stderr, "No experiment given ...\n"); - exit (1); - } - - if (NULL == opt_solver) - { - fprintf (stderr, "No solver given ...\n"); - exit (1); - } - - if (0 == strcmp (opt_solver, "mlp")) - { - solver = GNUNET_ATS_SOLVER_MLP; - } - else if (0 == strcmp (opt_solver, "proportional")) - { - solver = GNUNET_ATS_SOLVER_PROPORTIONAL; - } - else if (0 == strcmp (opt_solver, "ril")) - { - solver = GNUNET_ATS_SOLVER_RIL; - } - else - { - fprintf (stderr, "No solver given ..."); - return; - } - - /* load experiment */ - e = GNUNET_ATS_solvers_experimentation_load (opt_exp_file); - if (NULL == e) - { - fprintf (stderr, "Failed to load experiment ...\n"); - return; - } - - /* load solver */ - sh = GNUNET_ATS_solvers_solver_start (solver); - if (NULL == sh) - { - fprintf (stderr, "Failed to start solver ...\n"); - return; - } - - /* start logging */ - - /* run experiment */ - - /* WAIT */ -} - - -/** - * Main function of the benchmark - * - * @param argc argument count - * @param argv argument values - */ -int -main (int argc, char *argv[]) -{ - opt_exp_file = NULL; - opt_solver = NULL; - opt_log = GNUNET_NO; - opt_plot = GNUNET_NO; - - struct GNUNET_GETOPT_CommandLineOption options[] = { - GNUNET_GETOPT_option_string ('s', - "solver", - NULL, - gettext_noop ("solver to use"), - &opt_solver), - - GNUNET_GETOPT_option_string ('e', - "experiment", - NULL, - gettext_noop ("experiment to use"), - &opt_exp_file), - - GNUNET_GETOPT_option_flag ('e', - "experiment", - gettext_noop ("experiment to use"), - &opt_verbose), - GNUNET_GETOPT_OPTION_END - }; - - if (GNUNET_OK != - GNUNET_PROGRAM_run (argc, - argv, argv[0], - NULL, - options, - &run, argv[0])) - return 1; - - return 0; -} - - -/* end of file gnunet-solver-eval.c*/ diff --git a/src/ats-tests/gnunet_ats_sim_default.conf b/src/ats-tests/gnunet_ats_sim_default.conf deleted file mode 100644 index a838306c3..000000000 --- a/src/ats-tests/gnunet_ats_sim_default.conf +++ /dev/null @@ -1,6 +0,0 @@ -@INLINE@ template_perf_ats.conf -[transport] -plugins = unix - -[ats] -MODE = proportional diff --git a/src/ats-tests/perf_ats.c b/src/ats-tests/perf_ats.c deleted file mode 100644 index 64756b8aa..000000000 --- a/src/ats-tests/perf_ats.c +++ /dev/null @@ -1,601 +0,0 @@ -/* - This file is part of GNUnet. - Copyright (C) 2010-2013, 2016 GNUnet e.V. - - GNUnet is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - GNUnet 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 - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - - SPDX-License-Identifier: AGPL3.0-or-later - */ -/** - * @file ats/perf_ats.c - * @brief ats benchmark: start peers and modify preferences, monitor change over time - * @author Christian Grothoff - * @author Matthias Wachs - */ -#include "platform.h" -#include "gnunet_util_lib.h" -#include "gnunet_testbed_service.h" -#include "gnunet_ats_service.h" -#include "gnunet_core_service.h" -#include "ats-testing.h" - - -#define TEST_ATS_PREFRENCE_FREQUENCY GNUNET_TIME_relative_multiply ( \ - GNUNET_TIME_UNIT_SECONDS, 1) -#define TEST_ATS_PREFRENCE_START 1.0 -#define TEST_ATS_PREFRENCE_DELTA 1.0 - -#define TEST_MESSAGE_FREQUENCY GNUNET_TIME_relative_multiply ( \ - GNUNET_TIME_UNIT_SECONDS, 1) - -#define TEST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, \ - 120) -#define BENCHMARK_DURATION GNUNET_TIME_relative_multiply ( \ - GNUNET_TIME_UNIT_SECONDS, 10) -#define LOGGING_FREQUENCY GNUNET_TIME_relative_multiply ( \ - GNUNET_TIME_UNIT_MILLISECONDS, 500) -#define TESTNAME_PREFIX "perf_ats_" -#define DEFAULT_SLAVES_NUM 2 -#define DEFAULT_MASTERS_NUM 1 - -/** - * timeout task - */ -static struct GNUNET_SCHEDULER_Task *timeout_task; - -/** - * Progress task - */ -static struct GNUNET_SCHEDULER_Task *progress_task; - -/** - * Test result - */ -static int result; - -/** - * Test result logging - */ -static int logging; - -/** - * Test core (#GNUNET_YES) or transport (#GNUNET_NO) - */ -static int test_core; - -/** - * Solver string - */ -static char *solver; - -/** - * Preference string - */ -static char *testname; - -/** - * Preference string - */ -static char *pref_str; - -/** - * ATS preference value - */ -static int pref_val; - -/** - * Benchmark duration - */ -static struct GNUNET_TIME_Relative perf_duration; - -/** - * Logging frequency - */ -static struct GNUNET_TIME_Relative log_frequency; - -/** - * Number master peers - */ -static unsigned int num_masters; - -/** - * Array of master peers - */ -static struct BenchmarkPeer *mps; - -/** - * Number slave peers - */ -static unsigned int num_slaves; - -/** - * Array of master peers - */ -static struct BenchmarkPeer *sps; - -static struct LoggingHandle *l; - - -static void -evaluate () -{ - int c_m; - int c_s; - unsigned int duration; - struct BenchmarkPeer *mp; - struct BenchmarkPartner *p; - - unsigned int kb_sent_sec; - double kb_sent_percent; - unsigned int kb_recv_sec; - double kb_recv_percent; - unsigned int rtt; - - duration = 1 + (perf_duration.rel_value_us / (1000 * 1000)); - for (c_m = 0; c_m < num_masters; c_m++) - { - mp = &mps[c_m]; - fprintf (stderr, - "Master [%u]: sent: %u KiB in %u sec. = %u KiB/s, received: %u KiB in %u sec. = %u KiB/s\n", - mp->no, mp->total_bytes_sent / 1024, duration, - (mp->total_bytes_sent / 1024) / duration, - mp->total_bytes_received / 1024, duration, - (mp->total_bytes_received / 1024) / duration); - - for (c_s = 0; c_s < num_slaves; c_s++) - { - p = &mp->partners[c_s]; - kb_sent_sec = 0; - kb_recv_sec = 0; - kb_sent_percent = 0.0; - kb_recv_percent = 0.0; - rtt = 0; - - if (duration > 0) - { - kb_sent_sec = (p->bytes_sent / 1024) / duration; - kb_recv_sec = (p->bytes_received / 1024) / duration; - } - - if (mp->total_bytes_sent > 0) - kb_sent_percent = ((double) p->bytes_sent * 100) / mp->total_bytes_sent; - if (mp->total_bytes_received > 0) - kb_recv_percent = ((double) p->bytes_received * 100) - / mp->total_bytes_received; - if (1000 * p->messages_sent > 0) - rtt = p->total_app_rtt / (1000 * p->messages_sent); - fprintf (stderr, - "%c Master [%u] -> Slave [%u]: sent %u KiB/s (%.2f %%), received %u KiB/s (%.2f %%)\n", - (mp->pref_partner == p->dest) ? '*' : ' ', - mp->no, p->dest->no, - kb_sent_sec, kb_sent_percent, - kb_recv_sec, kb_recv_percent); - fprintf (stderr, - "%c Master [%u] -> Slave [%u]: Average application layer RTT: %u ms\n", - (mp->pref_partner == p->dest) ? '*' : ' ', - mp->no, p->dest->no, rtt); - } - } -} - - -/** - * Shutdown nicely - * - * @param cls NULL - */ -static void -do_shutdown (void *cls) -{ - if (GNUNET_YES == logging) - GNUNET_ATS_TEST_logging_clean_up (l); - if (NULL != timeout_task) - { - GNUNET_SCHEDULER_cancel (timeout_task); - timeout_task = NULL; - } - if (NULL != progress_task) - { - fprintf (stderr, "0\n"); - GNUNET_SCHEDULER_cancel (progress_task); - progress_task = NULL; - } - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Benchmarking done\n"); - GNUNET_ATS_TEST_shutdown_topology (); -} - - -/** - * Shutdown nicely - * - * @param cls NULL - */ -static void -do_timeout (void *cls) -{ - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Terminating with timeout\n"); - timeout_task = NULL; - evaluate (); - GNUNET_SCHEDULER_shutdown (); -} - - -static void -print_progress (void *cls) -{ - static int calls; - - progress_task = NULL; - fprintf (stderr, - "%llu..", - (long long unsigned) perf_duration.rel_value_us / (1000 * 1000) - - calls); - calls++; - - progress_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, - &print_progress, - NULL); -} - - -static void -ats_pref_task (void *cls) -{ - struct BenchmarkPeer *me = cls; - - me->ats_task = NULL; - - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - " Master [%u] set preference for slave [%u] to %f\n", - me->no, me->pref_partner->no, me->pref_value); - GNUNET_ATS_performance_change_preference (me->ats_perf_handle, - &me->pref_partner->id, - pref_val, me->pref_value, - GNUNET_ATS_PREFERENCE_END); - me->pref_value += TEST_ATS_PREFRENCE_DELTA; - me->ats_task = GNUNET_SCHEDULER_add_delayed (TEST_ATS_PREFRENCE_FREQUENCY, - &ats_pref_task, cls); -} - - -static void -start_benchmark (void *cls) -{ - int c_m; - int c_s; - - progress_task = GNUNET_SCHEDULER_add_now (&print_progress, - NULL); - - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Topology connected, start benchmarking...\n"); - - /* Start sending test messages */ - for (c_m = 0; c_m < num_masters; c_m++) - { - for (c_s = 0; c_s < num_slaves; c_s++) - { - GNUNET_ATS_TEST_generate_traffic_start (&mps[c_m], - &mps[c_m].partners[c_s], - GNUNET_ATS_TEST_TG_LINEAR, - UINT32_MAX, - UINT32_MAX, - GNUNET_TIME_UNIT_MINUTES, - GNUNET_TIME_UNIT_FOREVER_REL); - } - if (pref_val != GNUNET_ATS_PREFERENCE_END) - mps[c_m].ats_task = GNUNET_SCHEDULER_add_now (&ats_pref_task, - &mps[c_m]); - } - - if (GNUNET_YES == logging) - l = GNUNET_ATS_TEST_logging_start (log_frequency, - testname, mps, - num_masters, num_slaves, - GNUNET_NO); -} - - -static void -do_benchmark (void *cls, - struct BenchmarkPeer *masters, - struct BenchmarkPeer *slaves) -{ - mps = masters; - sps = slaves; - GNUNET_SCHEDULER_add_shutdown (&do_shutdown, - NULL); - timeout_task = GNUNET_SCHEDULER_add_delayed (perf_duration, - &do_timeout, - NULL); - progress_task = GNUNET_SCHEDULER_add_now (&start_benchmark, - NULL); -} - - -static struct BenchmarkPartner * -find_partner (struct BenchmarkPeer *me, - const struct GNUNET_PeerIdentity *peer) -{ - int c_m; - - GNUNET_assert (NULL != me); - GNUNET_assert (NULL != peer); - - for (c_m = 0; c_m < me->num_partners; c_m++) - { - /* Find a partner with other as destination */ - if (0 == GNUNET_memcmp (peer, &me->partners[c_m].dest->id)) - { - return &me->partners[c_m]; - } - } - return NULL; -} - - -static void -log_request_cb (void *cls, - const struct GNUNET_HELLO_Address *address, - int address_active, - struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, - struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, - const struct GNUNET_ATS_Properties *ats) -{ - struct BenchmarkPeer *me = cls; - struct BenchmarkPartner *p; - char *peer_id; - - p = find_partner (me, &address->peer); - if (NULL == p) - { - /* This is not one of my partners - * Will happen since the peers will connect to each other due to gossiping - */ - return; - } - peer_id = GNUNET_strdup (GNUNET_i2s (&me->id)); - - if ((p->bandwidth_in != ntohl (bandwidth_in.value__)) || - (p->bandwidth_out != ntohl (bandwidth_out.value__))) - p->bandwidth_in = ntohl (bandwidth_in.value__); - p->bandwidth_out = ntohl (bandwidth_out.value__); - - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "%s [%u] received ATS information for peers `%s'\n", - (GNUNET_YES == p->me->master) ? "Master" : "Slave", - p->me->no, - GNUNET_i2s (&p->dest->id)); - - GNUNET_free (peer_id); - if (NULL != l) - GNUNET_ATS_TEST_logging_now (l); -} - - -/* - * Start the performance test case - */ -int -main (int argc, char *argv[]) -{ - char *tmp; - char *tmp_sep; - char *test_name; - char *conf_name; - char *comm_name; - char *dotexe; - char *prefs[] = GNUNET_ATS_PreferenceTypeString; - int c; - - result = 0; - - /* Determine testname - * perf_ats___[.exe]*/ - - /* Find test prefix, store in temp */ - tmp = strstr (argv[0], TESTNAME_PREFIX); - if (NULL == tmp) - { - fprintf (stderr, "Unable to parse test name `%s'\n", argv[0]); - return GNUNET_SYSERR; - } - - /* Set tmp to end of test name prefix */ - tmp += strlen (TESTNAME_PREFIX); - - /* Determine solver name */ - solver = GNUNET_strdup (tmp); - /* Remove .exe prefix */ - if ((NULL != (dotexe = strstr (solver, ".exe"))) && (dotexe[4] == '\0')) - dotexe[0] = '\0'; - - /* Determine first '_' after solver */ - tmp_sep = strchr (solver, '_'); - if (NULL == tmp_sep) - { - fprintf (stderr, "Unable to parse test name `%s'\n", argv[0]); - GNUNET_free (solver); - return GNUNET_SYSERR; - } - tmp_sep[0] = '\0'; - comm_name = GNUNET_strdup (&tmp_sep[1]); - tmp_sep = strchr (comm_name, '_'); - if (NULL == tmp_sep) - { - fprintf (stderr, "Unable to parse test name `%s'\n", argv[0]); - GNUNET_free (solver); - return GNUNET_SYSERR; - } - tmp_sep[0] = '\0'; - for (c = 0; c <= strlen (comm_name); c++) - comm_name[c] = toupper (comm_name[c]); - if (0 == strcmp (comm_name, "CORE")) - test_core = GNUNET_YES; - else if (0 == strcmp (comm_name, "TRANSPORT")) - test_core = GNUNET_NO; - else - { - GNUNET_free (comm_name); - GNUNET_free (solver); - return GNUNET_SYSERR; - } - - pref_str = GNUNET_strdup (tmp_sep + 1); - - GNUNET_asprintf (&conf_name, "%s%s_%s.conf", TESTNAME_PREFIX, solver, - pref_str); - GNUNET_asprintf (&test_name, "%s%s_%s", TESTNAME_PREFIX, solver, pref_str); - - for (c = 0; c <= strlen (pref_str); c++) - pref_str[c] = toupper (pref_str[c]); - pref_val = -1; - - if (0 != strcmp (pref_str, "NONE")) - { - for (c = 0; c < GNUNET_ATS_PREFERENCE_END; c++) - { - if (0 == strcmp (pref_str, prefs[c])) - { - pref_val = c; - break; - } - } - } - else - { - /* abuse terminator to indicate no pref */ - pref_val = GNUNET_ATS_PREFERENCE_END; - } - if (-1 == pref_val) - { - fprintf (stderr, "Unknown preference: `%s'\n", pref_str); - GNUNET_free (solver); - GNUNET_free (pref_str); - GNUNET_free (comm_name); - return -1; - } - - for (c = 0; c < (argc - 1); c++) - { - if (0 == strcmp (argv[c], "-d")) - break; - } - if (c < argc - 1) - { - if (GNUNET_OK != GNUNET_STRINGS_fancy_time_to_relative (argv[c + 1], - &perf_duration)) - fprintf (stderr, "Failed to parse duration `%s'\n", argv[c + 1]); - } - else - { - perf_duration = BENCHMARK_DURATION; - } - fprintf (stderr, "Running benchmark for %llu secs\n", (unsigned long - long) (perf_duration. - rel_value_us) - / (1000 * 1000)); - - for (c = 0; c < (argc - 1); c++) - { - if (0 == strcmp (argv[c], "-s")) - break; - } - if (c < argc - 1) - { - if ((0L != (num_slaves = strtol (argv[c + 1], NULL, 10))) - && (num_slaves >= 1)) - fprintf (stderr, "Starting %u slave peers\n", num_slaves); - else - num_slaves = DEFAULT_SLAVES_NUM; - } - else - num_slaves = DEFAULT_SLAVES_NUM; - - for (c = 0; c < (argc - 1); c++) - { - if (0 == strcmp (argv[c], "-m")) - break; - } - if (c < argc - 1) - { - if ((0L != (num_masters = strtol (argv[c + 1], NULL, 10))) - && (num_masters >= 2)) - fprintf (stderr, "Starting %u master peers\n", num_masters); - else - num_masters = DEFAULT_MASTERS_NUM; - } - else - num_masters = DEFAULT_MASTERS_NUM; - - logging = GNUNET_NO; - for (c = 0; c < argc; c++) - { - if (0 == strcmp (argv[c], "-l")) - logging = GNUNET_YES; - } - - if (GNUNET_YES == logging) - { - for (c = 0; c < (argc - 1); c++) - { - if (0 == strcmp (argv[c], "-f")) - break; - } - if (c < argc - 1) - { - if (GNUNET_OK != GNUNET_STRINGS_fancy_time_to_relative (argv[c + 1], - &log_frequency)) - fprintf (stderr, "Failed to parse duration `%s'\n", argv[c + 1]); - } - else - { - log_frequency = LOGGING_FREQUENCY; - } - fprintf (stderr, "Using log frequency %llu ms\n", - (unsigned long long) (log_frequency.rel_value_us) / (1000)); - } - - GNUNET_asprintf (&testname, "%s_%s_%s", solver, comm_name, pref_str); - - if (num_slaves < num_masters) - { - fprintf (stderr, - "Number of master peers is lower than slaves! exit...\n"); - GNUNET_free (test_name); - GNUNET_free (solver); - GNUNET_free (pref_str); - GNUNET_free (comm_name); - return GNUNET_SYSERR; - } - - /** - * Setup the topology - */ - GNUNET_ATS_TEST_create_topology ("perf-ats", - conf_name, - num_slaves, - num_masters, - test_core, - &do_benchmark, - NULL, - &log_request_cb); - - return result; -} - - -/* end of file perf_ats.c */ diff --git a/src/ats-tests/perf_ats.h b/src/ats-tests/perf_ats.h deleted file mode 100644 index 6460aa098..000000000 --- a/src/ats-tests/perf_ats.h +++ /dev/null @@ -1,256 +0,0 @@ -/* - This file is part of GNUnet. - Copyright (C) 2010-2013 GNUnet e.V. - - GNUnet is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - GNUnet 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 - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - - SPDX-License-Identifier: AGPL3.0-or-later - */ -/** - * @file ats/perf_ats.c - * @brief ats benchmark: start peers and modify preferences, monitor change over time - * @author Christian Grothoff - * @author Matthias Wachs - */ -#include "platform.h" -#include "gnunet_util_lib.h" -#include "gnunet_testbed_service.h" -#include "gnunet_ats_service.h" -#include "gnunet_core_service.h" -#include "ats-testing.h" - -#define TEST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, \ - 120) -#define BENCHMARK_DURATION GNUNET_TIME_relative_multiply ( \ - GNUNET_TIME_UNIT_SECONDS, 10) -#define LOGGING_FREQUENCY GNUNET_TIME_relative_multiply ( \ - GNUNET_TIME_UNIT_MILLISECONDS, 500) -#define TESTNAME_PREFIX "perf_ats_" -#define DEFAULT_SLAVES_NUM 2 -#define DEFAULT_MASTERS_NUM 1 - -#define TEST_ATS_PREFRENCE_FREQUENCY GNUNET_TIME_relative_multiply ( \ - GNUNET_TIME_UNIT_SECONDS, 1) -#define TEST_ATS_PREFRENCE_START 1.0 -#define TEST_ATS_PREFRENCE_DELTA 1.0 - -#define TEST_MESSAGE_TYPE_PING 12345 -#define TEST_MESSAGE_TYPE_PONG 12346 -#define TEST_MESSAGE_SIZE 1000 -#define TEST_MESSAGE_FREQUENCY GNUNET_TIME_relative_multiply ( \ - GNUNET_TIME_UNIT_SECONDS, 1) - -/** - * Information about a benchmarking partner - */ -struct BenchmarkPartner -{ - /** - * The peer itself this partner belongs to - */ - struct BenchmarkPeer *me; - - /** - * The partner peer - */ - struct BenchmarkPeer *dest; - - /** - * Core transmit handles - */ - struct GNUNET_CORE_TransmitHandle *cth; - - /** - * Transport transmit handles - */ - struct GNUNET_TRANSPORT_TransmitHandle *tth; - - /** - * Timestamp to calculate communication layer delay - */ - struct GNUNET_TIME_Absolute last_message_sent; - - /** - * Accumulated RTT for all messages - */ - unsigned int total_app_rtt; - - /** - * Number of messages sent to this partner - */ - unsigned int messages_sent; - - /** - * Number of bytes sent to this partner - */ - unsigned int bytes_sent; - - /** - * Number of messages received from this partner - */ - unsigned int messages_received; - - /** - * Number of bytes received from this partner - */ - unsigned int bytes_received; - - /* Current ATS properties */ - - uint32_t ats_distance; - - uint32_t ats_delay; - - uint32_t bandwidth_in; - - uint32_t bandwidth_out; - - uint32_t ats_utilization_up; - - uint32_t ats_utilization_down; - - uint32_t ats_network_type; - - uint32_t ats_cost_wan; - - uint32_t ats_cost_lan; - - uint32_t ats_cost_wlan; -}; - - -/** - * Information we track for a peer in the testbed. - */ -struct BenchmarkPeer -{ - /** - * Handle with testbed. - */ - struct GNUNET_TESTBED_Peer *peer; - - /** - * Unique identifier - */ - int no; - - /** - * Is this peer a measter: GNUNET_YES/GNUNET_NO - */ - int master; - - /** - * Peer ID - */ - struct GNUNET_PeerIdentity id; - - /** - * Testbed operation to get peer information - */ - struct GNUNET_TESTBED_Operation *peer_id_op; - - /** - * Testbed operation to connect to ATS performance service - */ - struct GNUNET_TESTBED_Operation *ats_perf_op; - - /** - * Testbed operation to connect to core - */ - struct GNUNET_TESTBED_Operation *comm_op; - - /** - * ATS performance handle - */ - struct GNUNET_ATS_PerformanceHandle *ats_perf_handle; - - /** - * Masters only: - * Testbed connect operations to connect masters to slaves - */ - struct TestbedConnectOperation *core_connect_ops; - - /** - * Core handle - */ - struct GNUNET_CORE_Handle *ch; - - /** - * Core handle - */ - struct GNUNET_TRANSPORT_Handle *th; - - /** - * Masters only: - * Peer to set ATS preferences for - */ - struct BenchmarkPeer *pref_partner; - - /** - * Masters only - * Progress task - */ - struct GNUNET_SCHEDULER_Task *ats_task; - - /** - * Masters only - * Progress task - */ - double pref_value; - - /** - * Array of partners with num_slaves entries (if master) or - * num_master entries (if slave) - */ - struct BenchmarkPartner *partners; - - /** - * Number of partners - */ - int num_partners; - - /** - * Number of core connections - */ - int core_connections; - - /** - * Masters only: - * Number of connections to slave peers - */ - int core_slave_connections; - - /** - * Total number of messages this peer has sent - */ - unsigned int total_messages_sent; - - /** - * Total number of bytes this peer has sent - */ - unsigned int total_bytes_sent; - - /** - * Total number of messages this peer has received - */ - unsigned int total_messages_received; - - /** - * Total number of bytes this peer has received - */ - unsigned int total_bytes_received; -}; - - -/* end of file perf_ats.h */ diff --git a/src/ats-tests/perf_ats_logging.c b/src/ats-tests/perf_ats_logging.c deleted file mode 100644 index ac8fa8950..000000000 --- a/src/ats-tests/perf_ats_logging.c +++ /dev/null @@ -1,780 +0,0 @@ -/* - This file is part of GNUnet. - Copyright (C) 2010-2013 GNUnet e.V. - - GNUnet is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - GNUnet 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 - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - - SPDX-License-Identifier: AGPL3.0-or-later - */ -/** - * @file ats/perf_ats_logging.c - * @brief ats benchmark: logging for performance tests - * @author Christian Grothoff - * @author Matthias Wachs - */ -#include "platform.h" -#include "gnunet_util_lib.h" -#include "perf_ats.h" - -#define THROUGHPUT_TEMPLATE "#!/usr/bin/gnuplot \n" \ - "set datafile separator ';' \n" \ - "set title \"Throughput between Master and Slaves\" \n" \ - "set xlabel \"Time in ms\" \n" \ - "set ylabel \"Bytes/s\" \n" \ - "set grid \n" - -#define RTT_TEMPLATE "#!/usr/bin/gnuplot \n" \ - "set datafile separator ';' \n" \ - "set title \"Application level roundtrip time between Master and Slaves\" \n" \ - "set xlabel \"Time in ms\" \n" \ - "set ylabel \"ms\" \n" \ - "set grid \n" - -#define BW_TEMPLATE "#!/usr/bin/gnuplot \n" \ - "set datafile separator ';' \n" \ - "set title \"Bandwidth inbound and outbound between Master and Slaves\" \n" \ - "set xlabel \"Time in ms\" \n" \ - "set ylabel \"Bytes / s \" \n" \ - "set grid \n" - -#define LOG_ITEMS_TIME 2 -#define LOG_ITEMS_PER_PEER 17 - -#define LOG_ITEM_BYTES_SENT 1 -#define LOG_ITEM_MSGS_SENT 2 -#define LOG_ITEM_THROUGHPUT_SENT 3 -#define LOG_ITEM_BYTES_RECV 4 -#define LOG_ITEM_MSGS_RECV 5 -#define LOG_ITEM_THROUGHPUT_RECV 6 -#define LOG_ITEM_APP_RTT 7 -#define LOG_ITEM_ATS_BW_IN 8 -#define LOG_ITEM_ATS_BW_OUT 9 -#define LOG_ITEM_ATS_COSTS_LAN 10 -#define LOG_ITEM_ATS_WAN 11 -#define LOG_ITEM_ATS_WLAN 12 -#define LOG_ITEM_ATS_DELAY 13 -#define LOG_ITEM_ATS_DISTANCE 14 -#define LOG_ITEM_ATS_NETWORKTYPE 15 -#define LOG_ITEM_ATS_UTIL_UP 16 -#define LOG_ITEM_ATS_UTIL_DOWN 17 - -/** - * Logging task - */ -static struct GNUNET_SCHEDULER_Task *log_task; - -/** - * Reference to perf_ats' masters - */ -static int num_peers; -static int running; -static char *name; -static struct GNUNET_TIME_Relative frequency; - -/** - * A single logging time step for a partner - */ -struct PartnerLoggingTimestep -{ - /** - * Peer - */ - struct BenchmarkPeer *slave; - - /** - * Total number of messages this peer has sent - */ - unsigned int total_messages_sent; - - /** - * Total number of bytes this peer has sent - */ - unsigned int total_bytes_sent; - - /** - * Total number of messages this peer has received - */ - unsigned int total_messages_received; - - /** - * Total number of bytes this peer has received - */ - unsigned int total_bytes_received; - - /** - * Total outbound throughput for master in Bytes / s - */ - unsigned int throughput_sent; - - /** - * Total inbound throughput for master in Bytes / s - */ - unsigned int throughput_recv; - - /** - * Accumulated RTT for all messages - */ - unsigned int total_app_rtt; - - /** - * Current application level delay - */ - unsigned int app_rtt; - - /* Current ATS properties */ - - uint32_t ats_distance; - - uint32_t ats_delay; - - uint32_t bandwidth_in; - - uint32_t bandwidth_out; - - uint32_t ats_utilization_up; - - uint32_t ats_utilization_down; - - uint32_t ats_network_type; - - uint32_t ats_cost_wan; - - uint32_t ats_cost_lan; - - uint32_t ats_cost_wlan; -}; - - -/** - * A single logging time step for a peer - */ -struct PeerLoggingTimestep -{ - /** - * Next in DLL - */ - struct PeerLoggingTimestep *next; - - /** - * Prev in DLL - */ - struct PeerLoggingTimestep *prev; - - /** - * Logging timestamp - */ - struct GNUNET_TIME_Absolute timestamp; - - /** - * Total number of messages this peer has sent - */ - unsigned int total_messages_sent; - - /** - * Total number of bytes this peer has sent - */ - unsigned int total_bytes_sent; - - /** - * Total number of messages this peer has received - */ - unsigned int total_messages_received; - - /** - * Total number of bytes this peer has received - */ - unsigned int total_bytes_received; - - /** - * Total outbound throughput for master in Bytes / s - */ - unsigned int total_throughput_send; - - /** - * Total inbound throughput for master in Bytes / s - */ - unsigned int total_throughput_recv; - - /** - * Logs for slaves - */ - struct PartnerLoggingTimestep *slaves_log; -}; - -/** - * Entry for a benchmark peer - */ -struct LoggingPeer -{ - /** - * Peer - */ - struct BenchmarkPeer *peer; - - /** - * Start time - */ - struct GNUNET_TIME_Absolute start; - - /** - * DLL for logging entries: head - */ - struct PeerLoggingTimestep *head; - - /** - * DLL for logging entries: tail - */ - struct PeerLoggingTimestep *tail; -}; - -/** - * Log structure of length num_peers - */ -static struct LoggingPeer *lp; - - -static void -write_throughput_gnuplot_script (char *fn, struct LoggingPeer *lp) -{ - struct GNUNET_DISK_FileHandle *f; - char *gfn; - char *data; - int c_s; - int peer_index; - - GNUNET_asprintf (&gfn, "gnuplot_throughput_%s", fn); - f = GNUNET_DISK_file_open (gfn, - GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE, - GNUNET_DISK_PERM_USER_EXEC - | GNUNET_DISK_PERM_USER_READ - | GNUNET_DISK_PERM_USER_WRITE); - if (NULL == f) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open gnuplot file `%s'\n", - gfn); - GNUNET_free (gfn); - return; - } - - /* Write header */ - - if (GNUNET_SYSERR == GNUNET_DISK_file_write (f, THROUGHPUT_TEMPLATE, strlen ( - THROUGHPUT_TEMPLATE))) - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Cannot write data to plot file `%s'\n", gfn); - - /* Write master data */ - peer_index = LOG_ITEMS_TIME; - GNUNET_asprintf (&data, - "plot '%s' using 2:%u with lines title 'Master %u send total', \\\n" \ - "'%s' using 2:%u with lines title 'Master %u receive total', \\\n", - fn, peer_index + LOG_ITEM_THROUGHPUT_SENT, lp->peer->no, - fn, peer_index + LOG_ITEM_THROUGHPUT_RECV, lp->peer->no); - if (GNUNET_SYSERR == GNUNET_DISK_file_write (f, data, strlen (data))) - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Cannot write data to plot file `%s'\n", gfn); - GNUNET_free (data); - - peer_index = LOG_ITEMS_TIME + LOG_ITEMS_PER_PEER; - for (c_s = 0; c_s < lp->peer->num_partners; c_s++) - { - GNUNET_asprintf (&data, - "'%s' using 2:%u with lines title 'Master %u - Slave %u send', \\\n" \ - "'%s' using 2:%u with lines title 'Master %u - Slave %u receive'%s\n", - fn, peer_index + LOG_ITEM_THROUGHPUT_SENT, lp->peer->no, - lp->peer->partners[c_s].dest->no, - fn, peer_index + LOG_ITEM_THROUGHPUT_RECV, lp->peer->no, - lp->peer->partners[c_s].dest->no, - (c_s < lp->peer->num_partners - 1) ? ", \\" : - "\n pause -1"); - if (GNUNET_SYSERR == GNUNET_DISK_file_write (f, data, strlen (data))) - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Cannot write data to plot file `%s'\n", gfn); - GNUNET_free (data); - peer_index += LOG_ITEMS_PER_PEER; - } - - if (GNUNET_SYSERR == GNUNET_DISK_file_close (f)) - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot close gnuplot file `%s'\n", - gfn); - else - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Data successfully written to plot file `%s'\n", gfn); - - GNUNET_free (gfn); -} - - -static void -write_rtt_gnuplot_script (char *fn, struct LoggingPeer *lp) -{ - struct GNUNET_DISK_FileHandle *f; - char *gfn; - char *data; - int c_s; - int index; - - GNUNET_asprintf (&gfn, "gnuplot_rtt_%s", fn); - f = GNUNET_DISK_file_open (gfn, - GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE, - GNUNET_DISK_PERM_USER_EXEC - | GNUNET_DISK_PERM_USER_READ - | GNUNET_DISK_PERM_USER_WRITE); - if (NULL == f) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open gnuplot file `%s'\n", - gfn); - GNUNET_free (gfn); - return; - } - - /* Write header */ - - if (GNUNET_SYSERR == GNUNET_DISK_file_write (f, RTT_TEMPLATE, strlen ( - RTT_TEMPLATE))) - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Cannot write data to plot file `%s'\n", gfn); - - index = LOG_ITEMS_TIME + LOG_ITEMS_PER_PEER; - for (c_s = 0; c_s < lp->peer->num_partners; c_s++) - { - GNUNET_asprintf (&data, - "%s'%s' using 2:%u with lines title 'Master %u - Slave %u '%s\n", - (0 == c_s) ? "plot " : "", - fn, index + LOG_ITEM_APP_RTT, lp->peer->no, - lp->peer->partners[c_s].dest->no, - (c_s < lp->peer->num_partners - 1) ? ", \\" : - "\n pause -1"); - if (GNUNET_SYSERR == GNUNET_DISK_file_write (f, data, strlen (data))) - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Cannot write data to plot file `%s'\n", gfn); - GNUNET_free (data); - index += LOG_ITEMS_PER_PEER; - } - - if (GNUNET_SYSERR == GNUNET_DISK_file_close (f)) - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot close gnuplot file `%s'\n", - gfn); - else - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Data successfully written to plot file `%s'\n", gfn); - GNUNET_free (gfn); -} - - -static void -write_bw_gnuplot_script (char *fn, struct LoggingPeer *lp) -{ - struct GNUNET_DISK_FileHandle *f; - char *gfn; - char *data; - int c_s; - int index; - - GNUNET_asprintf (&gfn, "gnuplot_bw_%s", fn); - f = GNUNET_DISK_file_open (gfn, - GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE, - GNUNET_DISK_PERM_USER_EXEC - | GNUNET_DISK_PERM_USER_READ - | GNUNET_DISK_PERM_USER_WRITE); - if (NULL == f) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open gnuplot file `%s'\n", - gfn); - GNUNET_free (gfn); - return; - } - - /* Write header */ - - if (GNUNET_SYSERR == GNUNET_DISK_file_write (f, BW_TEMPLATE, strlen ( - BW_TEMPLATE))) - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Cannot write data to plot file `%s'\n", gfn); - - index = LOG_ITEMS_TIME + LOG_ITEMS_PER_PEER; - for (c_s = 0; c_s < lp->peer->num_partners; c_s++) - { - GNUNET_asprintf (&data, "%s" \ - "'%s' using 2:%u with lines title 'BW out master %u - Slave %u ', \\\n" \ - "'%s' using 2:%u with lines title 'BW in master %u - Slave %u '" \ - "%s\n", - (0 == c_s) ? "plot " : "", - fn, index + LOG_ITEM_ATS_BW_OUT, lp->peer->no, - lp->peer->partners[c_s].dest->no, - fn, index + LOG_ITEM_ATS_BW_IN, lp->peer->no, - lp->peer->partners[c_s].dest->no, - (c_s < lp->peer->num_partners - 1) ? ", \\" : - "\n pause -1"); - if (GNUNET_SYSERR == GNUNET_DISK_file_write (f, data, strlen (data))) - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Cannot write data to plot file `%s'\n", gfn); - GNUNET_free (data); - index += LOG_ITEMS_PER_PEER; - } - - if (GNUNET_SYSERR == GNUNET_DISK_file_close (f)) - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot close gnuplot file `%s'\n", - gfn); - else - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Data successfully written to plot file `%s'\n", gfn); - GNUNET_free (gfn); -} - - -static void -write_to_file () -{ - struct GNUNET_DISK_FileHandle *f; - - char *filename; - char *data; - char *slave_string; - char *slave_string_tmp; - struct PeerLoggingTimestep *cur_lt; - struct PartnerLoggingTimestep *plt; - int c_m; - int c_s; - - for (c_m = 0; c_m < num_peers; c_m++) - { - GNUNET_asprintf (&filename, "%llu_master_%u_%s_%s.data", - GNUNET_TIME_absolute_get ().abs_value_us, - lp[c_m].peer->no, GNUNET_i2s (&lp[c_m].peer->id), name); - - f = GNUNET_DISK_file_open (filename, - GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE, - GNUNET_DISK_PERM_USER_READ - | GNUNET_DISK_PERM_USER_WRITE); - if (NULL == f) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open log file `%s'\n", - filename); - GNUNET_free (filename); - return; - } - - for (cur_lt = lp[c_m].head; NULL != cur_lt; cur_lt = cur_lt->next) - { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Master [%u]: timestamp %llu %llu ; %u %u %u ; %u %u %u\n", - lp[c_m].peer->no, - cur_lt->timestamp, GNUNET_TIME_absolute_get_difference ( - lp[c_m].start, cur_lt->timestamp).rel_value_us / 1000, - cur_lt->total_messages_sent, cur_lt->total_bytes_sent, - cur_lt->total_throughput_send, - cur_lt->total_messages_received, cur_lt->total_bytes_received, - cur_lt->total_throughput_recv); - - slave_string = GNUNET_strdup (";"); - for (c_s = 0; c_s < lp[c_m].peer->num_partners; c_s++) - { - plt = &cur_lt->slaves_log[c_s]; - /* Log partners */ - - /* Assembling slave string */ - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "\t Slave [%u]: %u %u %u ; %u %u %u rtt %u delay %u bw_in %u bw_out %u \n", - plt->slave->no, - plt->total_messages_sent, plt->total_bytes_sent, - plt->throughput_sent, - plt->total_messages_received, plt->total_bytes_received, - plt->throughput_recv, - plt->app_rtt, plt->ats_delay, - plt->bandwidth_in, plt->bandwidth_out); - - GNUNET_asprintf (&slave_string_tmp, - "%s%u;%u;%u;%u;%u;%u;%.3f;%u;%u;%u;%u;%u;%u;%u;%u;%u;%u;", - slave_string, - plt->total_messages_sent, plt->total_bytes_sent, - plt->throughput_sent, - plt->total_messages_received, - plt->total_bytes_received, plt->throughput_sent, - (double) plt->app_rtt / 1000, - plt->bandwidth_in, plt->bandwidth_out, - plt->ats_cost_lan, plt->ats_cost_wan, - plt->ats_cost_wlan, - plt->ats_delay, plt->ats_distance, - plt->ats_network_type, - plt->ats_utilization_up, plt->ats_utilization_down); - GNUNET_free (slave_string); - slave_string = slave_string_tmp; - } - /* Assembling master string */ - - - GNUNET_asprintf (&data, "%llu;%llu;%u;%u;%u;%u;%u;%u;;;;;;;;;;;%s\n", - cur_lt->timestamp, - GNUNET_TIME_absolute_get_difference (lp[c_m].start, - cur_lt->timestamp). - rel_value_us / 1000, - cur_lt->total_messages_sent, cur_lt->total_bytes_sent, - cur_lt->total_throughput_send, - cur_lt->total_messages_received, - cur_lt->total_bytes_received, - cur_lt->total_throughput_recv, - slave_string); - GNUNET_free (slave_string); - - if (GNUNET_SYSERR == GNUNET_DISK_file_write (f, data, strlen (data))) - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Cannot write data to log file `%s'\n", filename); - GNUNET_free (data); - } - if (GNUNET_SYSERR == GNUNET_DISK_file_close (f)) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot close log file `%s'\n", - filename); - GNUNET_free (filename); - return; - } - - write_throughput_gnuplot_script (filename, lp); - write_rtt_gnuplot_script (filename, lp); - write_bw_gnuplot_script (filename, lp); - - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Data file successfully written to log file `%s'\n", filename); - GNUNET_free (filename); - } -} - - -void -collect_log_now (void) -{ - struct LoggingPeer *bp; - struct PeerLoggingTimestep *mlt; - struct PeerLoggingTimestep *prev_log_mlt; - struct PartnerLoggingTimestep *slt; - struct PartnerLoggingTimestep *prev_log_slt; - struct BenchmarkPartner *p; - struct GNUNET_TIME_Relative delta; - int c_s; - int c_m; - unsigned int app_rtt; - double mult; - - if (GNUNET_YES != running) - return; - - for (c_m = 0; c_m < num_peers; c_m++) - { - bp = &lp[c_m]; - mlt = GNUNET_new (struct PeerLoggingTimestep); - GNUNET_CONTAINER_DLL_insert_tail (bp->head, bp->tail, mlt); - prev_log_mlt = mlt->prev; - - /* Collect data */ - - /* Current master state */ - mlt->timestamp = GNUNET_TIME_absolute_get (); - mlt->total_bytes_sent = bp->peer->total_bytes_sent; - mlt->total_messages_sent = bp->peer->total_messages_sent; - mlt->total_bytes_received = bp->peer->total_bytes_received; - mlt->total_messages_received = bp->peer->total_messages_received; - - /* Throughput */ - if (NULL == prev_log_mlt) - { - /* Get difference to start */ - delta = GNUNET_TIME_absolute_get_difference (lp[c_m].start, - mlt->timestamp); - } - else - { - /* Get difference to last timestep */ - delta = GNUNET_TIME_absolute_get_difference (mlt->prev->timestamp, - mlt->timestamp); - } - - /* Multiplication factor for throughput calculation */ - mult = (1.0 * 1000 * 1000) / (delta.rel_value_us); - - /* Total throughput */ - if (NULL != prev_log_mlt) - { - if (mlt->total_bytes_sent - mlt->prev->total_bytes_sent > 0) - mlt->total_throughput_send = mult * (mlt->total_bytes_sent - - mlt->prev->total_bytes_sent); - else - mlt->total_throughput_send = prev_log_mlt->total_throughput_send; /* no msgs send */ - - if (mlt->total_bytes_received - mlt->prev->total_bytes_received > 0) - mlt->total_throughput_recv = mult * (mlt->total_bytes_received - - mlt->prev->total_bytes_received); - else - mlt->total_throughput_recv = prev_log_mlt->total_throughput_recv; /* no msgs received */ - } - else - { - mlt->total_throughput_send = mult * mlt->total_bytes_sent; - mlt->total_throughput_send = mult * mlt->total_bytes_received; - } - - mlt->slaves_log = GNUNET_malloc (bp->peer->num_partners - * sizeof(struct PartnerLoggingTimestep)); - - for (c_s = 0; c_s < bp->peer->num_partners; c_s++) - { - p = &bp->peer->partners[c_s]; - slt = &mlt->slaves_log[c_s]; - - slt->slave = p->dest; - /* Bytes sent from master to this slave */ - slt->total_bytes_sent = p->bytes_sent; - /* Messages sent from master to this slave */ - slt->total_messages_sent = p->messages_sent; - /* Bytes master received from this slave */ - slt->total_bytes_received = p->bytes_received; - /* Messages master received from this slave */ - slt->total_messages_received = p->messages_received; - slt->total_app_rtt = p->total_app_rtt; - /* ats performance information */ - slt->ats_cost_lan = p->ats_cost_lan; - slt->ats_cost_wan = p->ats_cost_wan; - slt->ats_cost_wlan = p->ats_cost_wlan; - slt->ats_delay = p->ats_delay; - slt->ats_distance = p->ats_distance; - slt->ats_network_type = p->ats_network_type; - slt->ats_utilization_down = p->ats_utilization_down; - slt->ats_utilization_up = p->ats_utilization_up; - slt->bandwidth_in = p->bandwidth_in; - slt->bandwidth_out = p->bandwidth_out; - - /* Total application level rtt */ - if (NULL == prev_log_mlt) - { - if (0 != slt->total_messages_sent) - app_rtt = slt->total_app_rtt / slt->total_messages_sent; - else - app_rtt = 0; - } - else - { - prev_log_slt = &prev_log_mlt->slaves_log[c_s]; - if ((slt->total_messages_sent - prev_log_slt->total_messages_sent) > 0) - app_rtt = (slt->total_app_rtt - prev_log_slt->total_app_rtt) - / (slt->total_messages_sent - - prev_log_slt->total_messages_sent); - else - app_rtt = prev_log_slt->app_rtt; /* No messages were */ - } - slt->app_rtt = app_rtt; - - /* Partner throughput */ - if (NULL != prev_log_mlt) - { - prev_log_slt = &prev_log_mlt->slaves_log[c_s]; - if (slt->total_bytes_sent - prev_log_slt->total_bytes_sent > 0) - slt->throughput_sent = mult * (slt->total_bytes_sent - - prev_log_slt->total_bytes_sent); - else - slt->throughput_sent = prev_log_slt->throughput_sent; /* no msgs send */ - - if (slt->total_bytes_received - prev_log_slt->total_bytes_received > 0) - slt->throughput_recv = mult * (slt->total_bytes_received - - prev_log_slt->total_bytes_received); - else - slt->throughput_recv = prev_log_slt->throughput_recv; /* no msgs received */ - } - else - { - slt->throughput_sent = mult * slt->total_bytes_sent; - slt->throughput_sent = mult * slt->total_bytes_received; - } - - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Master [%u]: slave [%u]\n", - bp->peer->no, p->dest->no); - } - } -} - - -static void -collect_log_task (void *cls) -{ - log_task = NULL; - collect_log_now (); - log_task = GNUNET_SCHEDULER_add_delayed (frequency, - &collect_log_task, NULL); -} - - -void -perf_logging_stop () -{ - int c_m; - struct PeerLoggingTimestep *cur; - - if (GNUNET_YES != running) - return; - - if (NULL != log_task) - { - GNUNET_SCHEDULER_cancel (log_task); - log_task = NULL; - } - collect_log_task (NULL); - - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - _ ("Stop logging\n")); - - write_to_file (); - - for (c_m = 0; c_m < num_peers; c_m++) - { - while (NULL != (cur = lp[c_m].head)) - { - GNUNET_CONTAINER_DLL_remove (lp[c_m].head, lp[c_m].tail, cur); - GNUNET_free (cur->slaves_log); - GNUNET_free (cur); - } - } - - GNUNET_free (lp); -} - - -void -perf_logging_start (struct GNUNET_TIME_Relative log_frequency, - char *testname, struct BenchmarkPeer *masters, int - num_masters) -{ - int c_m; - - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - _ ("Start logging `%s'\n"), testname); - - num_peers = num_masters; - name = testname; - frequency = log_frequency; - - lp = GNUNET_malloc (num_masters * sizeof(struct LoggingPeer)); - - for (c_m = 0; c_m < num_masters; c_m++) - { - lp[c_m].peer = &masters[c_m]; - lp[c_m].start = GNUNET_TIME_absolute_get (); - } - - /* Schedule logging task */ - log_task = GNUNET_SCHEDULER_add_now (&collect_log_task, NULL); - running = GNUNET_YES; -} - - -/* end of file perf_ats_logging.c */ diff --git a/src/ats-tests/perf_ats_proportional_bandwidth.conf b/src/ats-tests/perf_ats_proportional_bandwidth.conf deleted file mode 100644 index dba96c0fe..000000000 --- a/src/ats-tests/perf_ats_proportional_bandwidth.conf +++ /dev/null @@ -1,4 +0,0 @@ -@INLINE@ template_perf_ats.conf - -[ats] -MODE = proportional diff --git a/src/ats-tests/perf_ats_proportional_latency.conf b/src/ats-tests/perf_ats_proportional_latency.conf deleted file mode 100644 index dba96c0fe..000000000 --- a/src/ats-tests/perf_ats_proportional_latency.conf +++ /dev/null @@ -1,4 +0,0 @@ -@INLINE@ template_perf_ats.conf - -[ats] -MODE = proportional diff --git a/src/ats-tests/perf_ats_proportional_none.conf b/src/ats-tests/perf_ats_proportional_none.conf deleted file mode 100644 index dba96c0fe..000000000 --- a/src/ats-tests/perf_ats_proportional_none.conf +++ /dev/null @@ -1,4 +0,0 @@ -@INLINE@ template_perf_ats.conf - -[ats] -MODE = proportional diff --git a/src/ats-tests/template_perf_ats.conf b/src/ats-tests/template_perf_ats.conf deleted file mode 100644 index 74f608bfb..000000000 --- a/src/ats-tests/template_perf_ats.conf +++ /dev/null @@ -1,52 +0,0 @@ -@INLINE@ ../../contrib/conf/gnunet/no_forcestart.conf - -[testbed] -# How long should operations wait? -OPERATION_TIMEOUT = 60 s - -[transport-udp] -BROADCAST = NO - -[peerinfo] -USE_INCLUDED_HELLOS = NO - -[transport] -#PREFIX = valgrind --leak-check=yes - -[ats] -# PREFIX = valgrind - -# Network specific inbound/outbound quotas -UNSPECIFIED_QUOTA_IN = 128 KiB -UNSPECIFIED_QUOTA_OUT = 128 KiB -# LOOPBACK -LOOPBACK_QUOTA_IN = 128 KiB -LOOPBACK_QUOTA_OUT = 128 KiB -# LAN -LAN_QUOTA_IN = 128 KiB -LAN_QUOTA_OUT = 128 KiB -# WAN -WAN_QUOTA_IN = 128 KiB -WAN_QUOTA_OUT = 128 KiB -# WLAN -WLAN_QUOTA_IN = 128 KiB -WLAN_QUOTA_OUT = 128 KiB -# BLUETOOTH -BLUETOOTH_QUOTA_IN = 128 KiB -BLUETOOTH_QUOTA_OUT = 128 KiB - -[transport-blacklist-M1RGJB4FQSM17JJ3M9BF7Q0I8MCO8C462NMOHI26RLT7C7A2KE6HCOPRA4ARM5HPL1J9IDDK5G8SFU5GUSHCTBH90ECETK1BFQD76R0] -HIJN5O404QNUR37OSJUTNJ6H2KJS198DHI2J3I8SE3DMKVRG1RNQPODN1IJBF14KEMPPPRM0B9F9ILFKHOFCA655CH6M5OCNCMR0FE0 = -CDTU8QQ8UPLGHR3B91V0CLTDOHONLB8QGHGUEM2JM1GANTEV0O6T20SD2N2HDN2QSHDG6IDTBR48KRDCS601FI6VHG59E7DQA98JD2O = - -[transport-blacklist-93ARIS6Q347RPU9EFPS9LA00VPHQLG3RBLKEKTHV4D6UVGEAC75KIIBFB5U9KK9P9P1RU1CBPV4BSSDUTB2AL2N2LG9KSO9APQNLS0O] -HIJN5O404QNUR37OSJUTNJ6H2KJS198DHI2J3I8SE3DMKVRG1RNQPODN1IJBF14KEMPPPRM0B9F9ILFKHOFCA655CH6M5OCNCMR0FE0 = -CDTU8QQ8UPLGHR3B91V0CLTDOHONLB8QGHGUEM2JM1GANTEV0O6T20SD2N2HDN2QSHDG6IDTBR48KRDCS601FI6VHG59E7DQA98JD2O = - -[transport-blacklist-OF84RAOAU2B1SOSEHJH6350MA0F7C98U55RI76LGIQOM7O33TFHPNUFB47CDBSCOLIINMVJ2U82445ABOBQRIVREG20L31KVDV5HG60] -HIJN5O404QNUR37OSJUTNJ6H2KJS198DHI2J3I8SE3DMKVRG1RNQPODN1IJBF14KEMPPPRM0B9F9ILFKHOFCA655CH6M5OCNCMR0FE0 = -CDTU8QQ8UPLGHR3B91V0CLTDOHONLB8QGHGUEM2JM1GANTEV0O6T20SD2N2HDN2QSHDG6IDTBR48KRDCS601FI6VHG59E7DQA98JD2O = - -[transport-blacklist-548J7M14O4I0F8I84U0UFARVJ97DB6QOT3MCA8O8SNAIT5JJ8TR95LUVAP3N5L7DN33IB49SNMF3Q3C0VPLTGP9ASCULA9S2OIMHHH8] -HIJN5O404QNUR37OSJUTNJ6H2KJS198DHI2J3I8SE3DMKVRG1RNQPODN1IJBF14KEMPPPRM0B9F9ILFKHOFCA655CH6M5OCNCMR0FE0 = -CDTU8QQ8UPLGHR3B91V0CLTDOHONLB8QGHGUEM2JM1GANTEV0O6T20SD2N2HDN2QSHDG6IDTBR48KRDCS601FI6VHG59E7DQA98JD2O = diff --git a/src/block/Makefile.am b/src/block/Makefile.am index ceeff4c66..ea796bf8f 100644 --- a/src/block/Makefile.am +++ b/src/block/Makefile.am @@ -26,10 +26,6 @@ libgnunet_plugin_block_template_la_LIBADD = \ libgnunetblock.la \ $(top_builddir)/src/util/libgnunetutil.la \ $(LTLIBINTL) -libgnunet_plugin_block_template_la_DEPENDENCIES = \ - libgnunetblockgroup.la \ - libgnunetblock.la \ - $(top_builddir)/src/util/libgnunetutil.la libgnunet_plugin_block_template_la_LDFLAGS = \ $(GN_PLUGIN_LDFLAGS) @@ -40,10 +36,6 @@ libgnunet_plugin_block_test_la_LIBADD = \ libgnunetblock.la \ $(top_builddir)/src/util/libgnunetutil.la \ $(LTLIBINTL) -libgnunet_plugin_block_test_la_DEPENDENCIES = \ - libgnunetblockgroup.la \ - libgnunetblock.la \ - $(top_builddir)/src/util/libgnunetutil.la libgnunet_plugin_block_test_la_LDFLAGS = \ $(GN_PLUGIN_LDFLAGS) @@ -51,8 +43,6 @@ libgnunetblock_la_SOURCES = \ block.c libgnunetblock_la_LIBADD = \ $(top_builddir)/src/util/libgnunetutil.la -libgnunetblock_la_DEPENDENCIES = \ - $(top_builddir)/src/util/libgnunetutil.la libgnunetblock_la_LDFLAGS = \ $(GN_LIB_LDFLAGS) \ $(GN_LIBINTL) \ @@ -63,9 +53,6 @@ libgnunetblockgroup_la_SOURCES = \ libgnunetblockgroup_la_LIBADD = \ libgnunetblock.la \ $(top_builddir)/src/util/libgnunetutil.la -libgnunetblockgroup_la_DEPENDENCIES = \ - libgnunetblock.la \ - $(top_builddir)/src/util/libgnunetutil.la libgnunetblockgroup_la_LDFLAGS = \ $(GN_LIB_LDFLAGS) \ $(GN_LIBINTL) \ diff --git a/src/dns/Makefile.am b/src/dns/Makefile.am index 45107304b..f8672d55e 100644 --- a/src/dns/Makefile.am +++ b/src/dns/Makefile.am @@ -83,10 +83,6 @@ libgnunet_plugin_block_dns_la_LIBADD = \ $(top_builddir)/src/block/libgnunetblockgroup.la \ $(top_builddir)/src/block/libgnunetblock.la \ $(top_builddir)/src/util/libgnunetutil.la -libgnunet_plugin_block_dns_la_DEPENDENCIES = \ - $(top_builddir)/src/block/libgnunetblockgroup.la \ - $(top_builddir)/src/block/libgnunetblock.la \ - $(top_builddir)/src/util/libgnunetutil.la libgnunet_plugin_block_dns_la_LDFLAGS = \ $(GN_LIBINTL) \ $(top_builddir)/src/block/$(GN_PLUGIN_LDFLAGS) @@ -99,5 +95,3 @@ endif EXTRA_DIST = \ $(check_SCRIPTS) - - diff --git a/src/fs/Makefile.am b/src/fs/Makefile.am index 2400d412e..5b6ba2376 100644 --- a/src/fs/Makefile.am +++ b/src/fs/Makefile.am @@ -49,10 +49,6 @@ libgnunetfs_la_LIBADD = \ $(top_builddir)/src/statistics/libgnunetstatistics.la \ $(top_builddir)/src/util/libgnunetutil.la \ $(GN_LIBINTL) $(XLIB) $(LIBGCRYPT_LIBS) -lunistring -libgnunetfs_la_DEPENDENCIES = \ - $(top_builddir)/src/datastore/libgnunetdatastore.la \ - $(top_builddir)/src/statistics/libgnunetstatistics.la \ - $(top_builddir)/src/util/libgnunetutil.la if HAVE_LIBEXTRACTOR libgnunetfs_la_LIBADD += \ diff --git a/src/gnsrecord/Makefile.am b/src/gnsrecord/Makefile.am index 27f5446a1..42ac4ede4 100644 --- a/src/gnsrecord/Makefile.am +++ b/src/gnsrecord/Makefile.am @@ -53,8 +53,6 @@ libgnunetgnsrecord_la_LIBADD = \ $(LIBGCRYPT_LIBS) \ -lsodium \ $(GN_LIBINTL) -libgnunetgnsrecord_la_DEPENDENCIES = \ - $(top_builddir)/src/identity/libgnunetidentity.la libgnunetgnsrecord_la_LDFLAGS = \ $(GN_LIB_LDFLAGS) \ -version-info 0:0:0 diff --git a/src/peerinfo-tool/Makefile.am b/src/peerinfo-tool/Makefile.am index 74af5890b..825ad5452 100644 --- a/src/peerinfo-tool/Makefile.am +++ b/src/peerinfo-tool/Makefile.am @@ -26,14 +26,6 @@ libgnunet_plugin_rest_peerinfo_la_LIBADD = \ $(top_builddir)/src/json/libgnunetjson.la \ $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \ $(LTLIBINTL) -ljansson $(MHD_LIBS) -libgnunet_plugin_rest_peerinfo_la_DEPENDENCIES = \ - $(top_builddir)/src/hello/libgnunethello.la \ - $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ - $(top_builddir)/src/transport/libgnunettransport.la \ - $(top_builddir)/src/ats/libgnunetats.la \ - $(top_builddir)/src/rest/libgnunetrest.la \ - $(top_builddir)/src/json/libgnunetjson.la \ - $(top_builddir)/src/util/libgnunetutil.la libgnunet_plugin_rest_peerinfo_la_LDFLAGS = \ $(GN_PLUGIN_LDFLAGS) libgnunet_plugin_rest_peerinfo_la_CFLAGS = $(MHD_CFLAGS) $(AM_CFLAGS) diff --git a/src/reclaim/Makefile.am b/src/reclaim/Makefile.am index 1a0b7fae4..350d77d4b 100644 --- a/src/reclaim/Makefile.am +++ b/src/reclaim/Makefile.am @@ -61,14 +61,6 @@ libgnunet_plugin_rest_reclaim_la_LIBADD = \ $(top_builddir)/src/namestore/libgnunetnamestore.la \ $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \ $(LTLIBINTL) -ljansson $(MHD_LIBS) -libgnunet_plugin_rest_reclaim_la_DEPENDENCIES = \ - $(top_builddir)/src/identity/libgnunetidentity.la \ - libgnunetreclaim.la \ - $(top_builddir)/src/json/libgnunetjson.la \ - $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ - $(top_builddir)/src/rest/libgnunetrest.la \ - $(top_builddir)/src/namestore/libgnunetnamestore.la \ - $(top_builddir)/src/util/libgnunetutil.la libgnunet_plugin_rest_reclaim_la_LDFLAGS = \ $(GN_PLUGIN_LDFLAGS) libgnunet_plugin_rest_reclaim_la_CFLAGS = $(MHD_CFLAGS) $(AM_CFLAGS) @@ -102,11 +94,6 @@ libgnunet_plugin_rest_pabc_la_LIBADD = \ $(top_builddir)/src/rest/libgnunetrest.la \ $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \ $(LTLIBINTL) -ljansson -lpabc $(MHD_LIBS) -libgnunet_plugin_rest_pabc_la_DEPENDENCIES = \ - libgnunetreclaim.la \ - $(top_builddir)/src/json/libgnunetjson.la \ - $(top_builddir)/src/rest/libgnunetrest.la \ - $(top_builddir)/src/util/libgnunetutil.la libgnunet_plugin_rest_pabc_la_LDFLAGS = \ $(GN_PLUGIN_LDFLAGS) libgnunet_plugin_rest_pabc_la_CFLAGS = $(MHD_CFLAGS) $(AM_CFLAGS) diff --git a/src/regex/Makefile.am b/src/regex/Makefile.am index 0b55d134f..9a7466cb2 100644 --- a/src/regex/Makefile.am +++ b/src/regex/Makefile.am @@ -53,9 +53,6 @@ libgnunetregex_internal_a_SOURCES = \ regex_internal_lib.h \ regex_internal.h regex_internal.c \ regex_internal_dht.c -libgnunetregex_internal_a_DEPENDENCIES = \ - libgnunetregexblock.la - libgnunetregex_la_SOURCES = \ regex_api_announce.c \ diff --git a/src/revocation/Makefile.am b/src/revocation/Makefile.am index b1a079a0d..d0c58584e 100644 --- a/src/revocation/Makefile.am +++ b/src/revocation/Makefile.am @@ -32,11 +32,6 @@ libgnunet_plugin_block_revocation_la_LIBADD = \ $(top_builddir)/src/util/libgnunetutil.la \ $(top_builddir)/src/identity/libgnunetidentity.la \ $(LTLIBINTL) -libgnunet_plugin_block_revocation_la_DEPENDENCIES = \ - libgnunetrevocation.la \ - $(top_builddir)/src/block/libgnunetblockgroup.la \ - $(top_builddir)/src/block/libgnunetblock.la \ - $(top_builddir)/src/util/libgnunetutil.la libgnunet_plugin_block_revocation_la_LDFLAGS = \ $(GN_PLUGIN_LDFLAGS) diff --git a/src/testbed/Makefile.am b/src/testbed/Makefile.am index d1f43f0f6..11399e77c 100644 --- a/src/testbed/Makefile.am +++ b/src/testbed/Makefile.am @@ -115,12 +115,6 @@ libgnunettestbed_la_LIBADD = $(XLIB) \ $(top_builddir)/src/arm/libgnunetarm.la \ $(top_builddir)/src/util/libgnunetutil.la \ $(LTLIBINTL) -libgnunettestbed_la_DEPENDENCIES = \ - $(top_builddir)/src/statistics/libgnunetstatistics.la \ - $(top_builddir)/src/transport/libgnunettransport.la \ - $(top_builddir)/src/hello/libgnunethello.la \ - $(top_builddir)/src/testing/libgnunettesting.la \ - $(top_builddir)/src/util/libgnunetutil.la libgnunettestbed_la_LDFLAGS = \ $(GN_LIB_LDFLAGS) \ -version-info 0:0:0 diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am index c01e9bdbd..6e0f29c4e 100644 --- a/src/testing/Makefile.am +++ b/src/testing/Makefile.am @@ -62,9 +62,6 @@ libgnunettesting_la_LIBADD = \ $(top_builddir)/src/arm/libgnunetarm.la \ $(top_builddir)/src/util/libgnunetutil.la \ $(LTLIBINTL) -libgnunettesting_la_DEPENDENCIES = \ - $(top_builddir)/src/arm/libgnunetarm.la \ - $(top_builddir)/src/util/libgnunetutil.la libgnunettesting_la_LDFLAGS = \ $(GN_LIB_LDFLAGS) \ -version-info 2:0:1 diff --git a/src/testing/testing_api_cmd_netjail_start_testsystem.c b/src/testing/testing_api_cmd_netjail_start_testsystem.c index 01bac9b05..0fe0541b0 100644 --- a/src/testing/testing_api_cmd_netjail_start_testsystem.c +++ b/src/testing/testing_api_cmd_netjail_start_testsystem.c @@ -191,7 +191,7 @@ struct TestingSystemCount }; /** -* Code to clean up ressource this cmd used. +* Code to clean up resource this cmd used. * * @param cls closure * @param cmd current CMD being cleaned up. @@ -276,6 +276,7 @@ GNUNET_TESTING_get_trait_helper_handles (const struct (unsigned int) 0); } + /** * Offer messages received via testing cmd helper from trait * @@ -362,6 +363,7 @@ helper_mst (void *cls, const struct GNUNET_MessageHeader *message) return GNUNET_OK; } + /** * Callback called if there was an exception during execution of the helper. * @@ -374,6 +376,7 @@ exp_cb (void *cls) *ns->rv = 1; } + /** * Function to initialize a init message for the helper. * @@ -506,7 +509,8 @@ netjail_exec_run (void *cls, struct GNUNET_CONFIGURATION_Handle *config = GNUNET_CONFIGURATION_create (); - for (int i = 1; i <= atoi (ns->global_n); i++) { + for (int i = 1; i <= atoi (ns->global_n); i++) + { for (int j = 1; j <= atoi (ns->local_m); j++) { sprintf (str_n, "%d", i); @@ -554,7 +558,8 @@ netjail_start_finish (void *cls, if (ns->number_of_peers_started == total_number) { - for (int i = 1; i <= atoi (ns->global_n); i++) { + for (int i = 1; i <= atoi (ns->global_n); i++) + { for (int j = 1; j <= atoi (ns->local_m); j++) { tbc = GNUNET_new (struct TestingSystemCount); diff --git a/src/testing/testing_api_cmd_netjail_stop_testsystem.c b/src/testing/testing_api_cmd_netjail_stop_testsystem.c index d6e733e05..0ae82a26a 100644 --- a/src/testing/testing_api_cmd_netjail_stop_testsystem.c +++ b/src/testing/testing_api_cmd_netjail_stop_testsystem.c @@ -49,7 +49,7 @@ struct StopHelperState /** -* Code to clean up ressource this cmd used. +* Code to clean up resource this cmd used. * * @param cls closure * @param cmd current CMD being cleaned up. @@ -97,7 +97,8 @@ stop_testing_system_run (void *cls, GNUNET_TESTING_get_trait_helper_handles (start_helper_cmd, &helper); - for (int i = 1; i <= atoi (shs->global_n); i++) { + for (int i = 1; i <= atoi (shs->global_n); i++) + { for (int j = 1; j <= atoi (shs->local_m); j++) { GNUNET_HELPER_stop (helper[(i - 1) * atoi (shs->local_m) + j - 1], diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am index afa37bac5..70687f7b5 100644 --- a/src/transport/Makefile.am +++ b/src/transport/Makefile.am @@ -156,13 +156,6 @@ libgnunettransporttesting_la_LIBADD = \ $(top_builddir)/src/testing/libgnunettesting.la \ $(top_builddir)/src/arm/libgnunetarm.la \ $(GN_LIBINTL) -libgnunettransporttesting_la_DEPENDENCIES = \ - libgnunettransport.la \ - $(top_builddir)/src/hello/libgnunethello.la \ - $(top_builddir)/src/ats/libgnunetats.la \ - $(top_builddir)/src/util/libgnunetutil.la \ - $(top_builddir)/src/testing/libgnunettesting.la \ - $(top_builddir)/src/arm/libgnunetarm.la libgnunettransporttesting_la_LDFLAGS = \ $(GN_LIB_LDFLAGS) @@ -190,7 +183,8 @@ libgnunettransporttesting2_la_LIBADD = \ $(top_builddir)/src/util/libgnunetutil.la libgnunettransporttesting2_la_LDFLAGS = \ $(GN_LIBINTL) \ - $(GN_LIB_LDFLAGS) + $(GN_LIB_LDFLAGS) \ + -version-info 0:0:0 libgnunettransport_la_SOURCES = \ transport.h \ @@ -208,10 +202,6 @@ libgnunettransport_la_LIBADD = \ $(top_builddir)/src/ats/libgnunetats.la \ $(top_builddir)/src/util/libgnunetutil.la \ $(GN_LIBINTL) -libgnunettransport_la_DEPENDENCIES = \ - $(top_builddir)/src/hello/libgnunethello.la \ - $(top_builddir)/src/ats/libgnunetats.la \ - $(top_builddir)/src/util/libgnunetutil.la libgnunettransport_la_LDFLAGS = \ $(GN_LIB_LDFLAGS) \ -version-info 4:0:2 @@ -406,16 +396,23 @@ plugin_LTLIBRARIES = \ libgnunet_test_transport_plugin_cmd_simple_send_la_SOURCES = \ test_transport_plugin_cmd_simple_send.c libgnunet_test_transport_plugin_cmd_simple_send_la_LIBADD = \ - $(top_builddir)/src/util/libgnunetutil.la \ + libgnunettransporttesting2.la \ + libgnunettransportapplication.la \ + libgnunettransport.la \ $(top_builddir)/src/testing/libgnunettesting.la \ + $(top_builddir)/src/peerstore/libgnunetpeerstore.la \ $(top_builddir)/src/statistics/libgnunetstatistics.la \ - libgnunettransporttesting2.la \ + $(top_builddir)/src/hello/libgnunethello.la \ + $(top_builddir)/src/ats/libgnunetats.la \ + $(top_builddir)/src/arm/libgnunetarm.la \ + $(top_builddir)/src/util/libgnunetutil.la \ $(LTLIBINTL) libgnunet_test_transport_plugin_cmd_simple_send_la_LDFLAGS = \ $(GN_PLUGIN_LDFLAGS) if HAVE_EXPERIMENTAL -plugin_LTLIBRARIES += libgnunet_plugin_transport_udp.la +plugin_LTLIBRARIES += \ + libgnunet_plugin_transport_udp.la endif # Note: real plugins of course need to be added @@ -731,8 +728,8 @@ test_transport_api_cmd_simple_send_LDADD = \ $(top_builddir)/src/testing/libgnunettesting.la \ $(top_builddir)/src/util/libgnunetutil.la \ $(top_builddir)/src/testbed/libgnunettestbed.la \ - libgnunettransport.la \ $(top_builddir)/src/hello/libgnunethello.la \ + libgnunettransport.la \ libgnunettransporttesting.la test_transport_testing_startstop_SOURCES = \ diff --git a/src/transport/transport_api_cmd_start_peer.c b/src/transport/transport_api_cmd_start_peer.c index 9277bc346..729d981c0 100644 --- a/src/transport/transport_api_cmd_start_peer.c +++ b/src/transport/transport_api_cmd_start_peer.c @@ -69,9 +69,9 @@ hello_iter_cb (void *cb_cls, } - /** - * Function to start the retrival task to retrieve the hello of this peer from the peerstore. + * Function to start the retrieval task to retrieve the hello of this peer + * from the peerstore. * */ static void @@ -170,6 +170,7 @@ notify_connect (void *cls, return ret; } + /** * The run method of this cmd will start all services of a peer to test the transport service. * @@ -309,6 +310,7 @@ start_peer_run (void *cls, sps->rh_task = GNUNET_SCHEDULER_add_now (retrieve_hello, sps); } + /** * The cleanup function of this cmd frees resources the cmd allocated. * @@ -434,6 +436,7 @@ GNUNET_TRANSPORT_get_trait_hello_size (const struct (unsigned int) 4); } + /** * Function to get the trait with the hello. * diff --git a/src/util/Makefile.am b/src/util/Makefile.am index 89d040a0c..6d5307235 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am @@ -361,8 +361,6 @@ test_os_start_process_SOURCES = \ test_os_start_process.c test_os_start_process_LDADD = \ libgnunetutil.la -test_os_start_process_DEPENDENCIES = \ - libgnunetutil.la test_client_nc_SOURCES = \ test_client.c -- cgit v1.2.3 From 8d78615d0bf1307807e9e9ab92672a61f17ea4c7 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 24 Aug 2021 15:25:21 +0200 Subject: -remove pthread dependency, add additional libexec binary to gnunet package --- contrib/Makefile.inc | 3 ++- debian/gnunet.install | 1 + src/setu/Makefile.am | 11 +++-------- 3 files changed, 6 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/contrib/Makefile.inc b/contrib/Makefile.inc index c737a07f8..a563ef4a1 100644 --- a/contrib/Makefile.inc +++ b/contrib/Makefile.inc @@ -8,7 +8,8 @@ BUILDCOMMON_SHLIB_FILES = \ build-common/sh/lib.sh/existence_python.sh \ build-common/sh/lib.sh/msg.sh \ build-common/sh/lib.sh/progname.sh \ - build-common/sh/lib.sh/version_gnunet.sh + build-common/sh/lib.sh/version_gnunet.sh \ + build-common/LICENSE BUILDCOMMON_CONF_FILES = \ build-common/conf/.dir-locals.el \ diff --git a/debian/gnunet.install b/debian/gnunet.install index 7bf5dce83..a19f47cc8 100644 --- a/debian/gnunet.install +++ b/debian/gnunet.install @@ -1,5 +1,6 @@ etc/gnunet.conf usr/bin/ +usr/libexec/gnunet-cmds-helper usr/lib/*/gnunet/ usr/lib/*/*.so.* usr/share/man/ diff --git a/src/setu/Makefile.am b/src/setu/Makefile.am index 6e2865d8c..77d048add 100644 --- a/src/setu/Makefile.am +++ b/src/setu/Makefile.am @@ -7,8 +7,6 @@ libexecdir= $(pkglibdir)/libexec/ plugindir = $(libdir)/gnunet -PTHREAD = -lpthread - pkgcfg_DATA = \ setu.conf @@ -65,8 +63,7 @@ libgnunetsetu_la_SOURCES = \ setu_api.c setu.h libgnunetsetu_la_LIBADD = \ $(top_builddir)/src/util/libgnunetutil.la \ - $(LTLIBINTL) \ - $(PTHREAD) + $(LTLIBINTL) libgnunetsetu_la_LDFLAGS = \ $(GN_LIB_LDFLAGS) @@ -94,8 +91,7 @@ perf_setu_api_SOURCES = \ perf_setu_api_LDADD = \ $(top_builddir)/src/util/libgnunetutil.la \ $(top_builddir)/src/testing/libgnunettesting.la \ - libgnunetsetu.la \ - $(PTHREAD) + libgnunetsetu.la plugin_LTLIBRARIES = \ @@ -107,8 +103,7 @@ libgnunet_plugin_block_setu_test_la_LIBADD = \ $(top_builddir)/src/block/libgnunetblock.la \ $(top_builddir)/src/block/libgnunetblockgroup.la \ $(top_builddir)/src/util/libgnunetutil.la \ - $(LTLIBINTL) \ - $(PTHREAD) + $(LTLIBINTL) libgnunet_plugin_block_setu_test_la_LDFLAGS = \ $(GN_PLUGIN_LDFLAGS) -- cgit v1.2.3 From 47d691ee2dcba940a9de6b95866c2da9c579ce94 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 24 Aug 2021 19:51:11 +0200 Subject: -add missing testing_cmds.h --- po/de.po | 61 +++++++++++++++------------------------- po/es.po | 60 +++++++++++++-------------------------- po/fr.po | 57 ++++++++++++------------------------- po/it.po | 50 ++++++++------------------------- po/sr.po | 75 ++++++++++++++++++++++--------------------------- po/sv.po | 58 +++++++++++++------------------------- po/vi.po | 63 +++++++++++++++-------------------------- po/zh_CN.po | 58 +++++++++++++------------------------- src/testing/Makefile.am | 3 +- 9 files changed, 168 insertions(+), 317 deletions(-) (limited to 'src') diff --git a/po/de.po b/po/de.po index 4e0b43960..e52f04f4b 100644 --- a/po/de.po +++ b/po/de.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: gnunet 0.10.1\n" "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" -"POT-Creation-Date: 2021-08-23 13:27+0200\n" +"POT-Creation-Date: 2021-08-24 15:42+0200\n" "PO-Revision-Date: 2015-03-08 16:16+0100\n" "Last-Translator: Mario Blättermann \n" "Language-Team: German \n" @@ -499,42 +499,6 @@ msgstr "" msgid "Initiating shutdown as requested by client.\n" msgstr "" -#: src/ats-tests/ats-testing-log.c:899 -msgid "Stop logging\n" -msgstr "Protokollierung stoppen\n" - -#: src/ats-tests/ats-testing-log.c:955 -#, fuzzy, c-format -msgid "Start logging `%s'\n" -msgstr "Collection `%s' begonnen.\n" - -#: src/ats-tests/ats-testing.c:420 -#, c-format -msgid "Connected master [%u] with slave [%u]\n" -msgstr "" - -#: src/ats-tests/ats-testing.c:427 -#, fuzzy, c-format -msgid "Failed to connect master peer [%u] with slave [%u]\n" -msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" - -#: src/ats-tests/gnunet-ats-sim.c:92 -#, c-format -msgid "" -"Master [%u]: sent: %u KiB in %u sec. = %u KiB/s, received: %u KiB in %u sec. " -"= %u KiB/s\n" -msgstr "" - -#: src/ats-tests/gnunet-solver-eval.c:997 src/ats/gnunet-ats-solver-eval.c:3552 -msgid "solver to use" -msgstr "" - -#: src/ats-tests/gnunet-solver-eval.c:1003 -#: src/ats-tests/gnunet-solver-eval.c:1008 -#: src/ats/gnunet-ats-solver-eval.c:3557 -msgid "experiment to use" -msgstr "" - #: src/ats-tool/gnunet-ats.c:299 #, c-format msgid "%u address resolutions had a timeout\n" @@ -673,6 +637,14 @@ msgid "" "%llu\n" msgstr "" +#: src/ats/gnunet-ats-solver-eval.c:3552 +msgid "solver to use" +msgstr "" + +#: src/ats/gnunet-ats-solver-eval.c:3557 +msgid "experiment to use" +msgstr "" + #: src/ats/gnunet-ats-solver-eval.c:3564 msgid "print logging" msgstr "" @@ -7078,14 +7050,14 @@ msgstr "# HELLO-Meldungen empfangen" msgid "GNUnet topology control" msgstr "" -#: src/transport/gnunet-communicator-tcp.c:3314 +#: src/transport/gnunet-communicator-tcp.c:3317 #: src/transport/gnunet-communicator-udp.c:3790 #: src/transport/gnunet-service-tng.c:10223 #: src/transport/gnunet-service-transport.c:2627 msgid "Transport service is lacking key configuration settings. Exiting.\n" msgstr "" -#: src/transport/gnunet-communicator-tcp.c:3652 +#: src/transport/gnunet-communicator-tcp.c:3655 msgid "GNUnet TCP communicator" msgstr "" @@ -9272,6 +9244,17 @@ msgstr "Tunnel über VPN einrichten." msgid "Failed to connect to the namestore!\n" msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" +#~ msgid "Stop logging\n" +#~ msgstr "Protokollierung stoppen\n" + +#, fuzzy, c-format +#~ msgid "Start logging `%s'\n" +#~ msgstr "Collection `%s' begonnen.\n" + +#, fuzzy, c-format +#~ msgid "Failed to connect master peer [%u] with slave [%u]\n" +#~ msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" + #, fuzzy, c-format #~ msgid "Unsupported form value `%s'\n" #~ msgstr "Kommando `%s' wird nicht unterstützt. Vorgang wird abgebrochen.\n" diff --git a/po/es.po b/po/es.po index dab861e48..8cf36e59c 100644 --- a/po/es.po +++ b/po/es.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: gnunet 0.9.5a\n" "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" -"POT-Creation-Date: 2021-08-23 13:27+0200\n" +"POT-Creation-Date: 2021-08-24 15:42+0200\n" "PO-Revision-Date: 2013-02-23 17:50+0100\n" "Last-Translator: Miguel Ángel Arruga Vivas \n" "Language-Team: Spanish \n" @@ -525,43 +525,6 @@ msgstr "El servicio «%s» finalizó con estado %s/%d, se reiniciará en %llu ms msgid "Initiating shutdown as requested by client.\n" msgstr "Iniciando apagado bajo petición del cliente.\n" -#: src/ats-tests/ats-testing-log.c:899 -msgid "Stop logging\n" -msgstr "" - -#: src/ats-tests/ats-testing-log.c:955 -#, fuzzy, c-format -msgid "Start logging `%s'\n" -msgstr "Iniciando descarga «%s».\n" - -#: src/ats-tests/ats-testing.c:420 -#, c-format -msgid "Connected master [%u] with slave [%u]\n" -msgstr "" - -#: src/ats-tests/ats-testing.c:427 -#, fuzzy, c-format -msgid "Failed to connect master peer [%u] with slave [%u]\n" -msgstr "Fallo al conectar a gnunetd.\n" - -#: src/ats-tests/gnunet-ats-sim.c:92 -#, c-format -msgid "" -"Master [%u]: sent: %u KiB in %u sec. = %u KiB/s, received: %u KiB in %u sec. " -"= %u KiB/s\n" -msgstr "" - -#: src/ats-tests/gnunet-solver-eval.c:997 src/ats/gnunet-ats-solver-eval.c:3552 -#, fuzzy -msgid "solver to use" -msgstr "valor a establecer" - -#: src/ats-tests/gnunet-solver-eval.c:1003 -#: src/ats-tests/gnunet-solver-eval.c:1008 -#: src/ats/gnunet-ats-solver-eval.c:3557 -msgid "experiment to use" -msgstr "experimento para usar" - # Miguel: ¿Como podría traducir "resolutions" y "resolve"? # Son difíciles de no calcar, puesto que no conozco como expresar # el concepto de obtener una dirección a partir de un nombre @@ -723,6 +686,15 @@ msgstr "" "No hay configurada una cuota de salida para la red «%s», asignando el ancho " "de banda predeterminado %llu\n" +#: src/ats/gnunet-ats-solver-eval.c:3552 +#, fuzzy +msgid "solver to use" +msgstr "valor a establecer" + +#: src/ats/gnunet-ats-solver-eval.c:3557 +msgid "experiment to use" +msgstr "experimento para usar" + #: src/ats/gnunet-ats-solver-eval.c:3564 #, fuzzy msgid "print logging" @@ -7317,7 +7289,7 @@ msgstr "# mensajes «HELLO» recibidos" msgid "GNUnet topology control" msgstr "" -#: src/transport/gnunet-communicator-tcp.c:3314 +#: src/transport/gnunet-communicator-tcp.c:3317 #: src/transport/gnunet-communicator-udp.c:3790 #: src/transport/gnunet-service-tng.c:10223 #: src/transport/gnunet-service-transport.c:2627 @@ -7327,7 +7299,7 @@ msgstr "" "El servicio de transporte carece de opciones de configuración de clave. " "Saliendo.\n" -#: src/transport/gnunet-communicator-tcp.c:3652 +#: src/transport/gnunet-communicator-tcp.c:3655 #, fuzzy msgid "GNUnet TCP communicator" msgstr "Configurador Gtk de GNUnet" @@ -9606,6 +9578,14 @@ msgstr "Configurar túneles vía VPN." msgid "Failed to connect to the namestore!\n" msgstr "¡Se produjo un fallo al conectar con el almacén de nombres!\n" +#, fuzzy, c-format +#~ msgid "Start logging `%s'\n" +#~ msgstr "Iniciando descarga «%s».\n" + +#, fuzzy, c-format +#~ msgid "Failed to connect master peer [%u] with slave [%u]\n" +#~ msgstr "Fallo al conectar a gnunetd.\n" + # form?? #, c-format #~ msgid "Unsupported form value `%s'\n" diff --git a/po/fr.po b/po/fr.po index ea75a63ed..226efdb6b 100644 --- a/po/fr.po +++ b/po/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: gnunet 0.10.1\n" "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" -"POT-Creation-Date: 2021-08-23 13:27+0200\n" +"POT-Creation-Date: 2021-08-24 15:42+0200\n" "PO-Revision-Date: 2015-12-24 01:20+0100\n" "Last-Translator: Stéphane Aulery \n" "Language-Team: French \n" @@ -491,42 +491,6 @@ msgstr "" msgid "Initiating shutdown as requested by client.\n" msgstr "" -#: src/ats-tests/ats-testing-log.c:899 -msgid "Stop logging\n" -msgstr "Arrêter la journalisation\n" - -#: src/ats-tests/ats-testing-log.c:955 -#, c-format -msgid "Start logging `%s'\n" -msgstr "Démarrer la journalisation « %s »\n" - -#: src/ats-tests/ats-testing.c:420 -#, c-format -msgid "Connected master [%u] with slave [%u]\n" -msgstr "" - -#: src/ats-tests/ats-testing.c:427 -#, c-format -msgid "Failed to connect master peer [%u] with slave [%u]\n" -msgstr "" - -#: src/ats-tests/gnunet-ats-sim.c:92 -#, c-format -msgid "" -"Master [%u]: sent: %u KiB in %u sec. = %u KiB/s, received: %u KiB in %u sec. " -"= %u KiB/s\n" -msgstr "" - -#: src/ats-tests/gnunet-solver-eval.c:997 src/ats/gnunet-ats-solver-eval.c:3552 -msgid "solver to use" -msgstr "solveur utilisé" - -#: src/ats-tests/gnunet-solver-eval.c:1003 -#: src/ats-tests/gnunet-solver-eval.c:1008 -#: src/ats/gnunet-ats-solver-eval.c:3557 -msgid "experiment to use" -msgstr "" - #: src/ats-tool/gnunet-ats.c:299 #, c-format msgid "%u address resolutions had a timeout\n" @@ -663,6 +627,14 @@ msgid "" "%llu\n" msgstr "" +#: src/ats/gnunet-ats-solver-eval.c:3552 +msgid "solver to use" +msgstr "solveur utilisé" + +#: src/ats/gnunet-ats-solver-eval.c:3557 +msgid "experiment to use" +msgstr "" + #: src/ats/gnunet-ats-solver-eval.c:3564 msgid "print logging" msgstr "afficher le journal" @@ -6810,14 +6782,14 @@ msgstr "" msgid "GNUnet topology control" msgstr "" -#: src/transport/gnunet-communicator-tcp.c:3314 +#: src/transport/gnunet-communicator-tcp.c:3317 #: src/transport/gnunet-communicator-udp.c:3790 #: src/transport/gnunet-service-tng.c:10223 #: src/transport/gnunet-service-transport.c:2627 msgid "Transport service is lacking key configuration settings. Exiting.\n" msgstr "" -#: src/transport/gnunet-communicator-tcp.c:3652 +#: src/transport/gnunet-communicator-tcp.c:3655 msgid "GNUnet TCP communicator" msgstr "" @@ -8930,6 +8902,13 @@ msgstr "Configurer des tunnels via VPN." msgid "Failed to connect to the namestore!\n" msgstr "" +#~ msgid "Stop logging\n" +#~ msgstr "Arrêter la journalisation\n" + +#, c-format +#~ msgid "Start logging `%s'\n" +#~ msgstr "Démarrer la journalisation « %s »\n" + #~ msgid "b" #~ msgstr "o" diff --git a/po/it.po b/po/it.po index f28f93c20..867f5f663 100644 --- a/po/it.po +++ b/po/it.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: gnunet 0.10.1\n" "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" -"POT-Creation-Date: 2021-08-23 13:27+0200\n" +"POT-Creation-Date: 2021-08-24 15:42+0200\n" "PO-Revision-Date: 2019-10-16 11:00+0200\n" "Last-Translator: Sebastiano Pistore \n" "Language-Team: Italian \n" @@ -492,42 +492,6 @@ msgstr "" msgid "Initiating shutdown as requested by client.\n" msgstr "" -#: src/ats-tests/ats-testing-log.c:899 -msgid "Stop logging\n" -msgstr "" - -#: src/ats-tests/ats-testing-log.c:955 -#, c-format -msgid "Start logging `%s'\n" -msgstr "" - -#: src/ats-tests/ats-testing.c:420 -#, c-format -msgid "Connected master [%u] with slave [%u]\n" -msgstr "" - -#: src/ats-tests/ats-testing.c:427 -#, c-format -msgid "Failed to connect master peer [%u] with slave [%u]\n" -msgstr "" - -#: src/ats-tests/gnunet-ats-sim.c:92 -#, c-format -msgid "" -"Master [%u]: sent: %u KiB in %u sec. = %u KiB/s, received: %u KiB in %u sec. " -"= %u KiB/s\n" -msgstr "" - -#: src/ats-tests/gnunet-solver-eval.c:997 src/ats/gnunet-ats-solver-eval.c:3552 -msgid "solver to use" -msgstr "" - -#: src/ats-tests/gnunet-solver-eval.c:1003 -#: src/ats-tests/gnunet-solver-eval.c:1008 -#: src/ats/gnunet-ats-solver-eval.c:3557 -msgid "experiment to use" -msgstr "" - #: src/ats-tool/gnunet-ats.c:299 #, c-format msgid "%u address resolutions had a timeout\n" @@ -665,6 +629,14 @@ msgid "" "%llu\n" msgstr "" +#: src/ats/gnunet-ats-solver-eval.c:3552 +msgid "solver to use" +msgstr "" + +#: src/ats/gnunet-ats-solver-eval.c:3557 +msgid "experiment to use" +msgstr "" + #: src/ats/gnunet-ats-solver-eval.c:3564 msgid "print logging" msgstr "" @@ -6836,14 +6808,14 @@ msgstr "" msgid "GNUnet topology control" msgstr "" -#: src/transport/gnunet-communicator-tcp.c:3314 +#: src/transport/gnunet-communicator-tcp.c:3317 #: src/transport/gnunet-communicator-udp.c:3790 #: src/transport/gnunet-service-tng.c:10223 #: src/transport/gnunet-service-transport.c:2627 msgid "Transport service is lacking key configuration settings. Exiting.\n" msgstr "" -#: src/transport/gnunet-communicator-tcp.c:3652 +#: src/transport/gnunet-communicator-tcp.c:3655 msgid "GNUnet TCP communicator" msgstr "" diff --git a/po/sr.po b/po/sr.po index 5f1d5360d..065663d89 100644 --- a/po/sr.po +++ b/po/sr.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: gnunet-0.10.1\n" "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" -"POT-Creation-Date: 2021-08-23 13:27+0200\n" +"POT-Creation-Date: 2021-08-24 15:42+0200\n" "PO-Revision-Date: 2020-10-23 18:39+0200\n" "Last-Translator: Мирослав Николић \n" "Language-Team: Serbian <(nothing)>\n" @@ -506,44 +506,6 @@ msgstr "" msgid "Initiating shutdown as requested by client.\n" msgstr "Започињем гашење као што је затражио клијент.\n" -#: src/ats-tests/ats-testing-log.c:899 -msgid "Stop logging\n" -msgstr "Заустављам дневничење\n" - -#: src/ats-tests/ats-testing-log.c:955 -#, c-format -msgid "Start logging `%s'\n" -msgstr "Започињем дневничење „%s“\n" - -#: src/ats-tests/ats-testing.c:420 -#, c-format -msgid "Connected master [%u] with slave [%u]\n" -msgstr "Повезан је надређени [%u] са потчињеним [%u]\n" - -#: src/ats-tests/ats-testing.c:427 -#, c-format -msgid "Failed to connect master peer [%u] with slave [%u]\n" -msgstr "Нисам успео да повежем надређеног парњака [%u] са потчињеним [%u]\n" - -#: src/ats-tests/gnunet-ats-sim.c:92 -#, c-format -msgid "" -"Master [%u]: sent: %u KiB in %u sec. = %u KiB/s, received: %u KiB in %u sec. " -"= %u KiB/s\n" -msgstr "" -"Надређени [%u]: послао: %u KiB за %u сек. = %u KiB/s, примио: %u KiB за %u " -"сек. = %u KiB/s\n" - -#: src/ats-tests/gnunet-solver-eval.c:997 src/ats/gnunet-ats-solver-eval.c:3552 -msgid "solver to use" -msgstr "решавач за коришћење" - -#: src/ats-tests/gnunet-solver-eval.c:1003 -#: src/ats-tests/gnunet-solver-eval.c:1008 -#: src/ats/gnunet-ats-solver-eval.c:3557 -msgid "experiment to use" -msgstr "експеримент за коришћење" - #: src/ats-tool/gnunet-ats.c:299 #, c-format msgid "%u address resolutions had a timeout\n" @@ -688,6 +650,14 @@ msgstr "" "Није подешена одлазна квота за мрежу „%s“, додељујем основни пропусни опсег " "%llu\n" +#: src/ats/gnunet-ats-solver-eval.c:3552 +msgid "solver to use" +msgstr "решавач за коришћење" + +#: src/ats/gnunet-ats-solver-eval.c:3557 +msgid "experiment to use" +msgstr "експеримент за коришћење" + #: src/ats/gnunet-ats-solver-eval.c:3564 msgid "print logging" msgstr "исписује дневничење" @@ -7131,14 +7101,14 @@ msgstr "# „HELLO“ поруке су примљене" msgid "GNUnet topology control" msgstr "" -#: src/transport/gnunet-communicator-tcp.c:3314 +#: src/transport/gnunet-communicator-tcp.c:3317 #: src/transport/gnunet-communicator-udp.c:3790 #: src/transport/gnunet-service-tng.c:10223 #: src/transport/gnunet-service-transport.c:2627 msgid "Transport service is lacking key configuration settings. Exiting.\n" msgstr "Услузи преноса недостају поставке подешавања кључа. Излазим.\n" -#: src/transport/gnunet-communicator-tcp.c:3652 +#: src/transport/gnunet-communicator-tcp.c:3655 msgid "GNUnet TCP communicator" msgstr "" @@ -9365,6 +9335,29 @@ msgstr "Поставља тунеле путем ВПН-а." msgid "Failed to connect to the namestore!\n" msgstr "Нисам успео да се повежем са смештајем назива!\n" +#~ msgid "Stop logging\n" +#~ msgstr "Заустављам дневничење\n" + +#, c-format +#~ msgid "Start logging `%s'\n" +#~ msgstr "Започињем дневничење „%s“\n" + +#, c-format +#~ msgid "Connected master [%u] with slave [%u]\n" +#~ msgstr "Повезан је надређени [%u] са потчињеним [%u]\n" + +#, c-format +#~ msgid "Failed to connect master peer [%u] with slave [%u]\n" +#~ msgstr "Нисам успео да повежем надређеног парњака [%u] са потчињеним [%u]\n" + +#, c-format +#~ msgid "" +#~ "Master [%u]: sent: %u KiB in %u sec. = %u KiB/s, received: %u KiB in %u " +#~ "sec. = %u KiB/s\n" +#~ msgstr "" +#~ "Надређени [%u]: послао: %u KiB за %u сек. = %u KiB/s, примио: %u KiB за " +#~ "%u сек. = %u KiB/s\n" + #, c-format #~ msgid "Unsupported form value `%s'\n" #~ msgstr "Неподржана вредност облика „%s“\n" diff --git a/po/sv.po b/po/sv.po index 38a46205b..4b538f766 100644 --- a/po/sv.po +++ b/po/sv.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: GNUnet 0.7.0b\n" "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" -"POT-Creation-Date: 2021-08-23 13:27+0200\n" +"POT-Creation-Date: 2021-08-24 15:42+0200\n" "PO-Revision-Date: 2006-01-21 17:16+0100\n" "Last-Translator: Daniel Nylander \n" "Language-Team: Swedish \n" @@ -502,42 +502,6 @@ msgstr "" msgid "Initiating shutdown as requested by client.\n" msgstr "" -#: src/ats-tests/ats-testing-log.c:899 -msgid "Stop logging\n" -msgstr "" - -#: src/ats-tests/ats-testing-log.c:955 -#, fuzzy, c-format -msgid "Start logging `%s'\n" -msgstr "Startade samling \"%s\".\n" - -#: src/ats-tests/ats-testing.c:420 -#, c-format -msgid "Connected master [%u] with slave [%u]\n" -msgstr "" - -#: src/ats-tests/ats-testing.c:427 -#, fuzzy, c-format -msgid "Failed to connect master peer [%u] with slave [%u]\n" -msgstr "Misslyckades att ansluta till gnunetd.\n" - -#: src/ats-tests/gnunet-ats-sim.c:92 -#, c-format -msgid "" -"Master [%u]: sent: %u KiB in %u sec. = %u KiB/s, received: %u KiB in %u sec. " -"= %u KiB/s\n" -msgstr "" - -#: src/ats-tests/gnunet-solver-eval.c:997 src/ats/gnunet-ats-solver-eval.c:3552 -msgid "solver to use" -msgstr "" - -#: src/ats-tests/gnunet-solver-eval.c:1003 -#: src/ats-tests/gnunet-solver-eval.c:1008 -#: src/ats/gnunet-ats-solver-eval.c:3557 -msgid "experiment to use" -msgstr "" - #: src/ats-tool/gnunet-ats.c:299 #, c-format msgid "%u address resolutions had a timeout\n" @@ -680,6 +644,14 @@ msgid "" "%llu\n" msgstr "" +#: src/ats/gnunet-ats-solver-eval.c:3552 +msgid "solver to use" +msgstr "" + +#: src/ats/gnunet-ats-solver-eval.c:3557 +msgid "experiment to use" +msgstr "" + #: src/ats/gnunet-ats-solver-eval.c:3564 #, fuzzy msgid "print logging" @@ -7135,7 +7107,7 @@ msgstr "# krypterade PONG-meddelanden mottagna" msgid "GNUnet topology control" msgstr "" -#: src/transport/gnunet-communicator-tcp.c:3314 +#: src/transport/gnunet-communicator-tcp.c:3317 #: src/transport/gnunet-communicator-udp.c:3790 #: src/transport/gnunet-service-tng.c:10223 #: src/transport/gnunet-service-transport.c:2627 @@ -7143,7 +7115,7 @@ msgstr "" msgid "Transport service is lacking key configuration settings. Exiting.\n" msgstr "GNUnet-konfiguration" -#: src/transport/gnunet-communicator-tcp.c:3652 +#: src/transport/gnunet-communicator-tcp.c:3655 msgid "GNUnet TCP communicator" msgstr "" @@ -9370,6 +9342,14 @@ msgstr "" msgid "Failed to connect to the namestore!\n" msgstr "Misslyckades att ansluta till gnunetd.\n" +#, fuzzy, c-format +#~ msgid "Start logging `%s'\n" +#~ msgstr "Startade samling \"%s\".\n" + +#, fuzzy, c-format +#~ msgid "Failed to connect master peer [%u] with slave [%u]\n" +#~ msgstr "Misslyckades att ansluta till gnunetd.\n" + #, fuzzy, c-format #~ msgid "Unsupported form value `%s'\n" #~ msgstr "Kommando \"%s\" stöds ej. Avbryter.\n" diff --git a/po/vi.po b/po/vi.po index 834ea991c..6ed55456c 100644 --- a/po/vi.po +++ b/po/vi.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: gnunet 0.8.0a\n" "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" -"POT-Creation-Date: 2021-08-23 13:27+0200\n" +"POT-Creation-Date: 2021-08-24 15:42+0200\n" "PO-Revision-Date: 2008-09-10 22:05+0930\n" "Last-Translator: Clytie Siddall \n" "Language-Team: Vietnamese \n" @@ -509,43 +509,6 @@ msgstr "" msgid "Initiating shutdown as requested by client.\n" msgstr "" -#: src/ats-tests/ats-testing-log.c:899 -#, fuzzy -msgid "Stop logging\n" -msgstr "Theo dõi" - -#: src/ats-tests/ats-testing-log.c:955 -#, fuzzy, c-format -msgid "Start logging `%s'\n" -msgstr "Đang bắt đầu tài về « %s »\n" - -#: src/ats-tests/ats-testing.c:420 -#, c-format -msgid "Connected master [%u] with slave [%u]\n" -msgstr "" - -#: src/ats-tests/ats-testing.c:427 -#, fuzzy, c-format -msgid "Failed to connect master peer [%u] with slave [%u]\n" -msgstr "Lỗi kết nối đến gnunetd.\n" - -#: src/ats-tests/gnunet-ats-sim.c:92 -#, c-format -msgid "" -"Master [%u]: sent: %u KiB in %u sec. = %u KiB/s, received: %u KiB in %u sec. " -"= %u KiB/s\n" -msgstr "" - -#: src/ats-tests/gnunet-solver-eval.c:997 src/ats/gnunet-ats-solver-eval.c:3552 -msgid "solver to use" -msgstr "" - -#: src/ats-tests/gnunet-solver-eval.c:1003 -#: src/ats-tests/gnunet-solver-eval.c:1008 -#: src/ats/gnunet-ats-solver-eval.c:3557 -msgid "experiment to use" -msgstr "" - #: src/ats-tool/gnunet-ats.c:299 #, c-format msgid "%u address resolutions had a timeout\n" @@ -689,6 +652,14 @@ msgid "" "%llu\n" msgstr "" +#: src/ats/gnunet-ats-solver-eval.c:3552 +msgid "solver to use" +msgstr "" + +#: src/ats/gnunet-ats-solver-eval.c:3557 +msgid "experiment to use" +msgstr "" + #: src/ats/gnunet-ats-solver-eval.c:3564 #, fuzzy msgid "print logging" @@ -7197,7 +7168,7 @@ msgstr "# các thông báo PONG đã mật mã được nhận" msgid "GNUnet topology control" msgstr "" -#: src/transport/gnunet-communicator-tcp.c:3314 +#: src/transport/gnunet-communicator-tcp.c:3317 #: src/transport/gnunet-communicator-udp.c:3790 #: src/transport/gnunet-service-tng.c:10223 #: src/transport/gnunet-service-transport.c:2627 @@ -7205,7 +7176,7 @@ msgstr "" msgid "Transport service is lacking key configuration settings. Exiting.\n" msgstr "Lưu cấu hình ngay bây giờ không?" -#: src/transport/gnunet-communicator-tcp.c:3652 +#: src/transport/gnunet-communicator-tcp.c:3655 msgid "GNUnet TCP communicator" msgstr "" @@ -9429,6 +9400,18 @@ msgstr "" msgid "Failed to connect to the namestore!\n" msgstr "Không kết nối được đến trình nền gnunetd." +#, fuzzy +#~ msgid "Stop logging\n" +#~ msgstr "Theo dõi" + +#, fuzzy, c-format +#~ msgid "Start logging `%s'\n" +#~ msgstr "Đang bắt đầu tài về « %s »\n" + +#, fuzzy, c-format +#~ msgid "Failed to connect master peer [%u] with slave [%u]\n" +#~ msgstr "Lỗi kết nối đến gnunetd.\n" + #, fuzzy, c-format #~ msgid "Unsupported form value `%s'\n" #~ msgstr "Lệnh không được hỗ trợ « %s ». Đang hủy bỏ.\n" diff --git a/po/zh_CN.po b/po/zh_CN.po index d00694054..46967c20d 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: gnunet-0.8.1\n" "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" -"POT-Creation-Date: 2021-08-23 13:27+0200\n" +"POT-Creation-Date: 2021-08-24 15:42+0200\n" "PO-Revision-Date: 2011-07-09 12:12+0800\n" "Last-Translator: Wylmer Wang \n" "Language-Team: Chinese (simplified) \n" @@ -494,42 +494,6 @@ msgstr "" msgid "Initiating shutdown as requested by client.\n" msgstr "" -#: src/ats-tests/ats-testing-log.c:899 -msgid "Stop logging\n" -msgstr "" - -#: src/ats-tests/ats-testing-log.c:955 -#, fuzzy, c-format -msgid "Start logging `%s'\n" -msgstr "未知的命令“%s”。\n" - -#: src/ats-tests/ats-testing.c:420 -#, c-format -msgid "Connected master [%u] with slave [%u]\n" -msgstr "" - -#: src/ats-tests/ats-testing.c:427 -#, fuzzy, c-format -msgid "Failed to connect master peer [%u] with slave [%u]\n" -msgstr "初始化“%s”服务失败。\n" - -#: src/ats-tests/gnunet-ats-sim.c:92 -#, c-format -msgid "" -"Master [%u]: sent: %u KiB in %u sec. = %u KiB/s, received: %u KiB in %u sec. " -"= %u KiB/s\n" -msgstr "" - -#: src/ats-tests/gnunet-solver-eval.c:997 src/ats/gnunet-ats-solver-eval.c:3552 -msgid "solver to use" -msgstr "" - -#: src/ats-tests/gnunet-solver-eval.c:1003 -#: src/ats-tests/gnunet-solver-eval.c:1008 -#: src/ats/gnunet-ats-solver-eval.c:3557 -msgid "experiment to use" -msgstr "" - #: src/ats-tool/gnunet-ats.c:299 #, c-format msgid "%u address resolutions had a timeout\n" @@ -672,6 +636,14 @@ msgid "" "%llu\n" msgstr "" +#: src/ats/gnunet-ats-solver-eval.c:3552 +msgid "solver to use" +msgstr "" + +#: src/ats/gnunet-ats-solver-eval.c:3557 +msgid "experiment to use" +msgstr "" + #: src/ats/gnunet-ats-solver-eval.c:3564 #, fuzzy msgid "print logging" @@ -6944,7 +6916,7 @@ msgstr "" msgid "GNUnet topology control" msgstr "" -#: src/transport/gnunet-communicator-tcp.c:3314 +#: src/transport/gnunet-communicator-tcp.c:3317 #: src/transport/gnunet-communicator-udp.c:3790 #: src/transport/gnunet-service-tng.c:10223 #: src/transport/gnunet-service-transport.c:2627 @@ -6952,7 +6924,7 @@ msgstr "" msgid "Transport service is lacking key configuration settings. Exiting.\n" msgstr "立即保存配置?" -#: src/transport/gnunet-communicator-tcp.c:3652 +#: src/transport/gnunet-communicator-tcp.c:3655 msgid "GNUnet TCP communicator" msgstr "" @@ -9105,6 +9077,14 @@ msgstr "" msgid "Failed to connect to the namestore!\n" msgstr "初始化“%s”服务失败。\n" +#, fuzzy, c-format +#~ msgid "Start logging `%s'\n" +#~ msgstr "未知的命令“%s”。\n" + +#, fuzzy, c-format +#~ msgid "Failed to connect master peer [%u] with slave [%u]\n" +#~ msgstr "初始化“%s”服务失败。\n" + #, fuzzy, c-format #~ msgid "Unsupported form value `%s'\n" #~ msgstr "未知的命令“%s”。\n" diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am index 6e0f29c4e..038f0cb08 100644 --- a/src/testing/Makefile.am +++ b/src/testing/Makefile.am @@ -150,4 +150,5 @@ test_testing_sharedservices_LDADD = \ EXTRA_DIST = \ test_testing_defaults.conf \ - test_testing_sharedservices.conf + test_testing_sharedservices.conf \ + testing_cmds.h -- cgit v1.2.3 From 45532e7bc19a2a73ad6da6502969c536d6831436 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 25 Aug 2021 12:52:12 +0200 Subject: further simplify libgnunetpq event API and implementation, also trigger events on 'loopback' that are not socket-activated --- src/include/gnunet_pq_lib.h | 13 ------ src/pq/pq.h | 23 ---------- src/pq/pq_event.c | 109 ++++++++++++++++++++++++++------------------ 3 files changed, 65 insertions(+), 80 deletions(-) (limited to 'src') diff --git a/src/include/gnunet_pq_lib.h b/src/include/gnunet_pq_lib.h index ff4498938..fe3fabbea 100644 --- a/src/include/gnunet_pq_lib.h +++ b/src/include/gnunet_pq_lib.h @@ -852,19 +852,6 @@ void GNUNET_PQ_reconnect (struct GNUNET_PQ_Context *db); -/** - * Poll for database events now. Used if the event FD - * is ready and the application wants to trigger applicable - * events. - * Useful if the GNUnet scheduler is NOT to be used for - * such notifications. - * - * @param db database handle - */ -void -GNUNET_PQ_event_do_poll (struct GNUNET_PQ_Context *db); - - /** * Register callback to be invoked on events of type @a es. * diff --git a/src/pq/pq.h b/src/pq/pq.h index 950d38220..d10931d99 100644 --- a/src/pq/pq.h +++ b/src/pq/pq.h @@ -73,11 +73,6 @@ struct GNUNET_PQ_Context * File descriptor wrapper for @e event_task. */ struct GNUNET_NETWORK_Handle *rfd; - - /** - * Is scheduling via the GNUnet scheduler desired? - */ - bool scheduler_on; }; @@ -93,22 +88,4 @@ GNUNET_PQ_event_reconnect_ (struct GNUNET_PQ_Context *db, int fd); -/** - * Run poll event loop using the GNUnet scheduler. - * - * @param db database handle - */ -void -GNUNET_PQ_event_scheduler_start_ (struct GNUNET_PQ_Context *db); - - -/** - * Stop running poll event loop using the GNUnet scheduler. - * - * @param db database handle - */ -void -GNUNET_PQ_event_scheduler_stop_ (struct GNUNET_PQ_Context *db); - - #endif diff --git a/src/pq/pq_event.c b/src/pq/pq_event.c index 3a0bfcde3..79a2e80c6 100644 --- a/src/pq/pq_event.c +++ b/src/pq/pq_event.c @@ -105,6 +105,24 @@ sh_to_channel (struct GNUNET_ShortHashCode *sh, } +/** + * Convert @a sh to a Postgres identifier. + * + * @param identifier to convert + * @param[out] sh set to short hash + * @return #GNUNET_OK on success + */ +static enum GNUNET_GenericReturnValue +channel_to_sh (const char *identifier, + struct GNUNET_ShortHashCode *sh) +{ + return GNUNET_STRINGS_string_to_data (identifier, + strlen (identifier), + sh, + sizeof (*sh)); +} + + /** * Convert @a es to a Postgres identifier. * @@ -167,11 +185,13 @@ do_notify (void *cls, } -void -GNUNET_PQ_event_do_poll (struct GNUNET_PQ_Context *db) +static void +event_do_poll (struct GNUNET_PQ_Context *db) { PGnotify *n; + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "PG poll job active\n"); if (1 != PQconsumeInput (db->conn)) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -193,10 +213,8 @@ GNUNET_PQ_event_do_poll (struct GNUNET_PQ_Context *db) continue; } if (GNUNET_OK != - GNUNET_STRINGS_string_to_data (&n->relname[1], - strlen (&n->relname[1]), - &sh, - sizeof (sh))) + channel_to_sh (&n->relname[1], + &sh)) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Ignoring notification for unsupported channel identifier `%s'\n", @@ -218,9 +236,15 @@ GNUNET_PQ_event_do_poll (struct GNUNET_PQ_Context *db) PQfreemem (n); continue; } - GNUNET_CONTAINER_multishortmap_iterate (db->channel_map, - &do_notify, - &ctx); + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Received notification %s with extra data `%.*s'\n", + n->relname, + (int) ctx.extra_size, + (const char *) ctx.extra); + GNUNET_CONTAINER_multishortmap_get_multiple (db->channel_map, + &sh, + &do_notify, + &ctx); GNUNET_free (ctx.extra); PQfreemem (n); } @@ -238,9 +262,11 @@ do_scheduler_notify (void *cls) { struct GNUNET_PQ_Context *db = cls; - GNUNET_assert (db->scheduler_on); + db->event_task = NULL; GNUNET_assert (NULL != db->rfd); - GNUNET_PQ_event_do_poll (db); + event_do_poll (db); + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Resubscribing\n"); db->event_task = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL, db->rfd, @@ -262,6 +288,9 @@ scheduler_fd_cb (void *cls, { struct GNUNET_PQ_Context *db = cls; + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "New poll FD is %d\n", + fd); if (NULL != db->event_task) { GNUNET_SCHEDULER_cancel (db->event_task); @@ -272,6 +301,9 @@ scheduler_fd_cb (void *cls, return; if (0 == GNUNET_CONTAINER_multishortmap_size (db->channel_map)) return; + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Activating poll job on %d\n", + fd); db->rfd = GNUNET_NETWORK_socket_box_native (fd); db->event_task = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_ZERO, @@ -281,31 +313,6 @@ scheduler_fd_cb (void *cls, } -void -GNUNET_PQ_event_scheduler_start_ (struct GNUNET_PQ_Context *db) -{ - if (db->scheduler_on) - return; - db->scheduler_on = true; - scheduler_fd_cb (db, - PQsocket (db->conn)); -} - - -void -GNUNET_PQ_event_scheduler_stop_ (struct GNUNET_PQ_Context *db) -{ - GNUNET_assert (db->scheduler_on); - GNUNET_free (db->rfd); - db->scheduler_on = false; - if (NULL != db->event_task) - { - GNUNET_SCHEDULER_cancel (db->event_task); - db->event_task = NULL; - } -} - - /** * Helper function to trigger an SQL @a cmd on @a db * @@ -376,8 +383,9 @@ void GNUNET_PQ_event_reconnect_ (struct GNUNET_PQ_Context *db, int fd) { - if (! db->scheduler_on) - return; + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Change in PQ event FD to %d\n", + fd); scheduler_fd_cb (db, fd); GNUNET_CONTAINER_multishortmap_iterate (db->channel_map, @@ -412,7 +420,6 @@ GNUNET_PQ_event_listen (struct GNUNET_PQ_Context *db, void *cb_cls) { struct GNUNET_DB_EventHandler *eh; - bool was_zero; eh = GNUNET_new (struct GNUNET_DB_EventHandler); eh->db = db; @@ -420,14 +427,18 @@ GNUNET_PQ_event_listen (struct GNUNET_PQ_Context *db, &eh->sh); eh->cb = cb; eh->cb_cls = cb_cls; - was_zero = (0 == GNUNET_CONTAINER_multishortmap_size (db->channel_map)); GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multishortmap_put (db->channel_map, &eh->sh, eh, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); - if (was_zero) - GNUNET_PQ_event_scheduler_start_ (db); + if (NULL == db->event_task) + { + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Starting event scheduler\n"); + scheduler_fd_cb (db, + PQsocket (db->conn)); + } manage_subscribe (db, "LISTEN X", eh); @@ -447,13 +458,19 @@ GNUNET_PQ_event_listen_cancel (struct GNUNET_DB_EventHandler *eh) GNUNET_CONTAINER_multishortmap_remove (db->channel_map, &eh->sh, eh)); - manage_subscribe (db, "UNLISTEN X", eh); if (0 == GNUNET_CONTAINER_multishortmap_size (db->channel_map)) { - GNUNET_PQ_event_scheduler_stop_ (db); + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Stopping PQ event scheduler job\n"); + GNUNET_free (db->rfd); + if (NULL != db->event_task) + { + GNUNET_SCHEDULER_cancel (db->event_task); + db->event_task = NULL; + } } if (NULL != eh->timeout_task) { @@ -488,6 +505,9 @@ GNUNET_PQ_event_notify (struct GNUNET_PQ_Context *db, *end = '\0'; end = stpcpy (end, "'"); + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Executing command `%s'\n", + sql); result = PQexec (db->conn, sql); if (PGRES_COMMAND_OK != PQresultStatus (result)) @@ -505,6 +525,7 @@ GNUNET_PQ_event_notify (struct GNUNET_PQ_Context *db, PQerrorMessage (db->conn)); } PQclear (result); + event_do_poll (db); } -- cgit v1.2.3 From b1feb05aa88177b49fd1e0a8905257416fda41f3 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 27 Aug 2021 14:34:57 +0200 Subject: -fix minor memory leak --- src/util/configuration.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src') diff --git a/src/util/configuration.c b/src/util/configuration.c index 1aa52ad76..62c06ae23 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c @@ -2350,7 +2350,6 @@ GNUNET_CONFIGURATION_default_filename (void) if (GNUNET_OK == GNUNET_DISK_file_test_read (cfg_fn)) return cfg_fn; - GNUNET_free (cfg_fn); /* Fall back to /etc/ for the default configuration. @@ -2359,24 +2358,21 @@ GNUNET_CONFIGURATION_default_filename (void) GNUNET_asprintf (&cfg_fn, "/etc/%s", pd->config_file); - if (GNUNET_OK == GNUNET_DISK_file_test_read (cfg_fn)) return cfg_fn; - GNUNET_free (cfg_fn); GNUNET_asprintf (&cfg_fn, "/etc/%s", pd->config_file); - if (GNUNET_OK == GNUNET_DISK_file_test_read (cfg_fn)) return cfg_fn; + GNUNET_free (cfg_fn); GNUNET_asprintf (&cfg_fn, "/etc/%s/%s", pd->project_dirname, pd->config_file); - if (GNUNET_OK == GNUNET_DISK_file_test_read (cfg_fn)) return cfg_fn; -- cgit v1.2.3 From 59a36b88e6d6f0b1cd706ef21771656f9357e9a4 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 27 Aug 2021 15:24:57 +0200 Subject: -indent --- src/json/json.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/json/json.c b/src/json/json.c index 4dabd4d22..51d5c0c72 100644 --- a/src/json/json.c +++ b/src/json/json.c @@ -87,7 +87,8 @@ GNUNET_JSON_parse_free (struct GNUNET_JSON_Specification *spec) { for (unsigned int i = 0; NULL != spec[i].parser; i++) if (NULL != spec[i].cleaner) - spec[i].cleaner (spec[i].cls, &spec[i]); + spec[i].cleaner (spec[i].cls, + &spec[i]); } -- cgit v1.2.3 From 66e906c25407a38fe18a7f6cd14c9f849bd561db Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 28 Aug 2021 12:50:20 +0200 Subject: partial fix for problems raised by Alessio on the ML --- src/include/gnunet_util_lib.h | 2 +- src/util/os_installation.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/include/gnunet_util_lib.h b/src/include/gnunet_util_lib.h index 3acd4cb9b..09e0b3ba8 100644 --- a/src/include/gnunet_util_lib.h +++ b/src/include/gnunet_util_lib.h @@ -58,7 +58,7 @@ extern "C" * THIS release. Otherwise, you are violating the Affero GPL if you make * this service available to anyone but yourself. */ -#define GNUNET_AGPL_URL "https://gnunet.org/git/gnunet.git#" PACKAGE_VERSION +#define GNUNET_AGPL_URL "https://git.gnunet.org/gnunet.git#v" PACKAGE_VERSION #include "gnunet_crypto_lib.h" diff --git a/src/util/os_installation.c b/src/util/os_installation.c index 02d4d439d..f15e1871a 100644 --- a/src/util/os_installation.c +++ b/src/util/os_installation.c @@ -68,7 +68,7 @@ static const struct GNUNET_OS_ProjectData default_pd = { .config_file = "gnunet.conf", .user_config_file = "~/.config/gnunet.conf", .is_gnu = 1, - .gettext_domain = PACKAGE, + .gettext_domain = "gnunet", .gettext_path = NULL, .agpl_url = GNUNET_AGPL_URL, }; -- cgit v1.2.3 From 1757980da5288918a03c16f05526cd3ea7f26e12 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 28 Aug 2021 12:54:32 +0200 Subject: partial fix for problems raised by Alessio on the ML --- src/include/gnunet_common.h | 12 ++++++------ src/include/gnunet_util_lib.h | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index 35389e63e..758a5133d 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h @@ -980,7 +980,7 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind); if (! (cond)) \ { \ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \ - _ ("Assertion failed at %s:%d.\n"), \ + dgettext ("gnunet", "Assertion failed at %s:%d.\n"), \ __FILE__, \ __LINE__); \ } \ @@ -1002,7 +1002,7 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind); if (! (cond)) \ { \ GNUNET_log (GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK, \ - _ ("External protocol violation detected at %s:%d.\n"), \ + dgettext ("gnunet", "External protocol violation detected at %s:%d.\n"), \ __FILE__, \ __LINE__); \ } \ @@ -1019,7 +1019,7 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind); do \ { \ GNUNET_log (level, \ - _ ("`%s' failed at %s:%d with error: %s\n"), \ + dgettext ("gnunet", "`%s' failed at %s:%d with error: %s\n"), \ cmd, \ __FILE__, \ __LINE__, \ @@ -1038,7 +1038,7 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind); { \ GNUNET_log_from (level, \ component, \ - _ ("`%s' failed at %s:%d with error: %s\n"), \ + dgettext ("gnunet", "`%s' failed at %s:%d with error: %s\n"), \ cmd, \ __FILE__, \ __LINE__, \ @@ -1056,7 +1056,7 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind); do \ { \ GNUNET_log (level, \ - _ ("`%s' failed on file `%s' at %s:%d with error: %s\n"), \ + dgettext ("gnunet", "`%s' failed on file `%s' at %s:%d with error: %s\n"), \ cmd, \ filename, \ __FILE__, \ @@ -1076,7 +1076,7 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind); { \ GNUNET_log_from (level, \ component, \ - _ ("`%s' failed on file `%s' at %s:%d with error: %s\n"), \ + dgettext ("gnunet", "`%s' failed on file `%s' at %s:%d with error: %s\n"), \ cmd, \ filename, \ __FILE__, \ diff --git a/src/include/gnunet_util_lib.h b/src/include/gnunet_util_lib.h index 09e0b3ba8..cc4f3a01e 100644 --- a/src/include/gnunet_util_lib.h +++ b/src/include/gnunet_util_lib.h @@ -58,7 +58,8 @@ extern "C" * THIS release. Otherwise, you are violating the Affero GPL if you make * this service available to anyone but yourself. */ -#define GNUNET_AGPL_URL "https://git.gnunet.org/gnunet.git#v" PACKAGE_VERSION +#define GNUNET_AGPL_URL "https://git.gnunet.org/gnunet.git/tag/?h=v" \ + PACKAGE_VERSION #include "gnunet_crypto_lib.h" -- cgit v1.2.3 From b317b3e1114e93f5133429a64de82a4e865939f7 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Sat, 28 Aug 2021 17:46:26 +0200 Subject: use ISO 8609 / RFC 3339 timestamps for logging --- src/util/common_logging.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/util/common_logging.c b/src/util/common_logging.c index 48cc6fe3b..cba37cd2f 100644 --- a/src/util/common_logging.c +++ b/src/util/common_logging.c @@ -1014,8 +1014,10 @@ mylog (enum GNUNET_ErrorType kind, } else { - if (0 == strftime (date2, DATE_STR_SIZE, "%b %d %H:%M:%S-%%06u", tmptr)) + /* RFC 3339 timestamp, with snprintf placeholder for microseconds */ + if (0 == strftime (date2, DATE_STR_SIZE, "%Y-%m-%dT%H:%M:%S.%%06u%z", tmptr)) abort (); + /* Fill in microseconds */ if (0 > snprintf (date, sizeof(date), date2, timeofday.tv_usec)) abort (); } -- cgit v1.2.3 From 2994fa434cb2aa7b987ab347848f895d42e9c9a0 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 28 Aug 2021 21:50:06 +0200 Subject: improve error message and inherit stderr as suggested by Florian --- src/pq/pq_connect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/pq/pq_connect.c b/src/pq/pq_connect.c index 05e787939..a2dce3fb0 100644 --- a/src/pq/pq_connect.c +++ b/src/pq/pq_connect.c @@ -143,7 +143,7 @@ apply_patch (struct GNUNET_PQ_Context *db, "Applying SQL file `%s' on database %s\n", buf, db->config_str); - psql = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_NONE, + psql = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ERR, NULL, NULL, NULL, @@ -172,7 +172,7 @@ apply_patch (struct GNUNET_PQ_Context *db, (0 != code) ) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "Could not run PSQL on file %s: %d\n", + "Could not run PSQL on file %s: psql exit code was %d\n", buf, (int) code); return GNUNET_SYSERR; -- cgit v1.2.3 From 63e3d9645a0f14bd280d939a0802f4b639d4aa93 Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Sun, 29 Aug 2021 17:28:10 +0200 Subject: -remove (invalid) testing zone keys !tarball --- src/namestore/Makefile.am | 4 ---- ...7PTMDSN5KS42GMK2VKVE96BAYDS3QVMAS7SC5208FD6HFTAXE0.zkey | 1 - ...FGWF0JH0C65M6PQW6VSRR6D3NEZVHAQF6NC037J01TETS6CJ30.zkey | Bin 32 -> 0 bytes ...W2Y5A7X59Z8BC2GHSEQ9WGZ5HWVEF25TBFR3Q5QHCERMVM76DG.zkey | 1 - ...Y43VS959JJ41KN2FG8782EJ2N0XDF4J6BWASR1BK5BPPRWQJAG.zkey | 2 -- 5 files changed, 8 deletions(-) delete mode 100644 src/namestore/zonefiles/BW7PTMDSN5KS42GMK2VKVE96BAYDS3QVMAS7SC5208FD6HFTAXE0.zkey delete mode 100644 src/namestore/zonefiles/CNFGWF0JH0C65M6PQW6VSRR6D3NEZVHAQF6NC037J01TETS6CJ30.zkey delete mode 100644 src/namestore/zonefiles/KHW2Y5A7X59Z8BC2GHSEQ9WGZ5HWVEF25TBFR3Q5QHCERMVM76DG.zkey delete mode 100644 src/namestore/zonefiles/TWY43VS959JJ41KN2FG8782EJ2N0XDF4J6BWASR1BK5BPPRWQJAG.zkey (limited to 'src') diff --git a/src/namestore/Makefile.am b/src/namestore/Makefile.am index 61bcfbaf8..18e6a196b 100644 --- a/src/namestore/Makefile.am +++ b/src/namestore/Makefile.am @@ -752,8 +752,4 @@ EXTRA_DIST = \ test_plugin_namestore_postgres.conf \ test_plugin_namestore_flat.conf \ test_hostkey \ - zonefiles/BW7PTMDSN5KS42GMK2VKVE96BAYDS3QVMAS7SC5208FD6HFTAXE0.zkey \ - zonefiles/KHW2Y5A7X59Z8BC2GHSEQ9WGZ5HWVEF25TBFR3Q5QHCERMVM76DG.zkey \ - zonefiles/CNFGWF0JH0C65M6PQW6VSRR6D3NEZVHAQF6NC037J01TETS6CJ30.zkey \ - zonefiles/TWY43VS959JJ41KN2FG8782EJ2N0XDF4J6BWASR1BK5BPPRWQJAG.zkey \ $(check_SCRIPTS) diff --git a/src/namestore/zonefiles/BW7PTMDSN5KS42GMK2VKVE96BAYDS3QVMAS7SC5208FD6HFTAXE0.zkey b/src/namestore/zonefiles/BW7PTMDSN5KS42GMK2VKVE96BAYDS3QVMAS7SC5208FD6HFTAXE0.zkey deleted file mode 100644 index 0d37aefef..000000000 --- a/src/namestore/zonefiles/BW7PTMDSN5KS42GMK2VKVE96BAYDS3QVMAS7SC5208FD6HFTAXE0.zkey +++ /dev/null @@ -1 +0,0 @@ - Q0҆d /#`$f \ No newline at end of file diff --git a/src/namestore/zonefiles/CNFGWF0JH0C65M6PQW6VSRR6D3NEZVHAQF6NC037J01TETS6CJ30.zkey b/src/namestore/zonefiles/CNFGWF0JH0C65M6PQW6VSRR6D3NEZVHAQF6NC037J01TETS6CJ30.zkey deleted file mode 100644 index b5b465ea1..000000000 Binary files a/src/namestore/zonefiles/CNFGWF0JH0C65M6PQW6VSRR6D3NEZVHAQF6NC037J01TETS6CJ30.zkey and /dev/null differ diff --git a/src/namestore/zonefiles/KHW2Y5A7X59Z8BC2GHSEQ9WGZ5HWVEF25TBFR3Q5QHCERMVM76DG.zkey b/src/namestore/zonefiles/KHW2Y5A7X59Z8BC2GHSEQ9WGZ5HWVEF25TBFR3Q5QHCERMVM76DG.zkey deleted file mode 100644 index 7535efb5e..000000000 --- a/src/namestore/zonefiles/KHW2Y5A7X59Z8BC2GHSEQ9WGZ5HWVEF25TBFR3Q5QHCERMVM76DG.zkey +++ /dev/null @@ -1 +0,0 @@ -p8&D6Vv+X{ A \ No newline at end of file diff --git a/src/namestore/zonefiles/TWY43VS959JJ41KN2FG8782EJ2N0XDF4J6BWASR1BK5BPPRWQJAG.zkey b/src/namestore/zonefiles/TWY43VS959JJ41KN2FG8782EJ2N0XDF4J6BWASR1BK5BPPRWQJAG.zkey deleted file mode 100644 index ac3ed96a3..000000000 --- a/src/namestore/zonefiles/TWY43VS959JJ41KN2FG8782EJ2N0XDF4J6BWASR1BK5BPPRWQJAG.zkey +++ /dev/null @@ -1,2 +0,0 @@ -XJM -d胦ӌB=B \ No newline at end of file -- cgit v1.2.3 From 34822f004386e6e727a8a8917f91bce367457b84 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 29 Aug 2021 23:35:56 +0200 Subject: -do load default configuration even if 'gnunet.conf' does not exist --- src/util/configuration.c | 7 ----- src/util/program.c | 72 +++++++++++++++++++++++++----------------------- 2 files changed, 38 insertions(+), 41 deletions(-) (limited to 'src') diff --git a/src/util/configuration.c b/src/util/configuration.c index 62c06ae23..09a3a7d93 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c @@ -2362,13 +2362,6 @@ GNUNET_CONFIGURATION_default_filename (void) return cfg_fn; GNUNET_free (cfg_fn); - GNUNET_asprintf (&cfg_fn, - "/etc/%s", - pd->config_file); - if (GNUNET_OK == GNUNET_DISK_file_test_read (cfg_fn)) - return cfg_fn; - GNUNET_free (cfg_fn); - GNUNET_asprintf (&cfg_fn, "/etc/%s/%s", pd->project_dirname, diff --git a/src/util/program.c b/src/util/program.c index a79e07d19..b9da14572 100644 --- a/src/util/program.c +++ b/src/util/program.c @@ -244,12 +244,23 @@ GNUNET_PROGRAM_run2 (int argc, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Loading configuration from entry point specified as option (%s)\n", cc.cfgfile); - if ((GNUNET_YES != GNUNET_DISK_file_test (cc.cfgfile)) || - (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (cfg, cc.cfgfile))) + if (GNUNET_YES != + GNUNET_DISK_file_test (cc.cfgfile)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - _ ( - "Unreadable or malformed configuration file `%s', exit ...\n"), + _ ("Unreadable configuration file `%s', exiting ...\n"), + cc.cfgfile); + ret = GNUNET_SYSERR; + GNUNET_free (allopts); + GNUNET_free (lpfx); + goto cleanup; + } + if (GNUNET_SYSERR == + GNUNET_CONFIGURATION_load (cfg, + cc.cfgfile)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + _ ("Malformed configuration file `%s', exiting ...\n"), cc.cfgfile); ret = GNUNET_SYSERR; GNUNET_free (allopts); @@ -259,38 +270,31 @@ GNUNET_PROGRAM_run2 (int argc, } else { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Loading configuration default entry point (%s)\n", - cc.cfgfile); - if ((NULL != cfg_fn) && (GNUNET_YES == GNUNET_DISK_file_test (cfg_fn))) + if ( (NULL != cfg_fn) && + (GNUNET_YES != + GNUNET_DISK_file_test (cfg_fn)) ) { - if (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (cfg, cfg_fn)) - { - GNUNET_log ( - GNUNET_ERROR_TYPE_ERROR, - _ ( - "Unreadable or malformed default configuration file `%s', exit ...\n"), - cfg_fn); - ret = GNUNET_SYSERR; - GNUNET_free (allopts); - GNUNET_free (lpfx); - goto cleanup; - } + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + _ ("Unreadable configuration file `%s'. Exiting ...\n"), + cfg_fn); + ret = GNUNET_SYSERR; + GNUNET_free (allopts); + GNUNET_free (lpfx); + goto cleanup; } - else if (NULL != cfg_fn) + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Loading configuration from entry point `%s'\n", + cc.cfgfile); + if (GNUNET_SYSERR == + GNUNET_CONFIGURATION_load (cfg, + cfg_fn)) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Loading configuration without entry point\n"); - GNUNET_free (cfg_fn); - if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, NULL)) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - _ ("Unreadable or malformed configuration, exit ...\n")); - ret = GNUNET_SYSERR; - GNUNET_free (allopts); - GNUNET_free (lpfx); - goto cleanup; - } + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + _ ("Malformed configuration. Exiting ...\n")); + ret = GNUNET_SYSERR; + GNUNET_free (allopts); + GNUNET_free (lpfx); + goto cleanup; } } GNUNET_free (allopts); @@ -346,7 +350,7 @@ GNUNET_PROGRAM_run2 (int argc, cc.task (cc.task_cls, cc.args, cc.cfgfile, cc.cfg); } ret = GNUNET_OK; - cleanup: +cleanup: GNUNET_CONFIGURATION_destroy (cfg); GNUNET_free (cc.cfgfile); GNUNET_free (cfg_fn); -- cgit v1.2.3 From c6cdedd416647bd28ee25d8d83f83a1233db2d5a Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 30 Aug 2021 09:35:00 +0200 Subject: -launch via script --- src/transport/Makefile.am | 6 +++++- src/transport/test_transport_simple_send.sh | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 src/transport/test_transport_simple_send.sh (limited to 'src') diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am index 70687f7b5..61b3bab7c 100644 --- a/src/transport/Makefile.am +++ b/src/transport/Makefile.am @@ -697,7 +697,8 @@ TESTS = \ $(HTTP_API_TIMEOUT_TEST) \ $(HTTPS_API_TIMEOUT_TEST) \ $(WLAN_TIMEOUT_TEST) \ - $(BT_TIMEOUT_TEST) + $(BT_TIMEOUT_TEST) \ + $(check_SCRIPTS) if HAVE_GETOPT_BINARY TESTS += \ test_transport_api_slow_ats @@ -722,6 +723,9 @@ TESTS += \ endif endif +check_SCRIPTS= \ + test_transport_simple_send.sh + test_transport_api_cmd_simple_send_SOURCES = \ test_transport_api_cmd_simple_send.c test_transport_api_cmd_simple_send_LDADD = \ diff --git a/src/transport/test_transport_simple_send.sh b/src/transport/test_transport_simple_send.sh new file mode 100644 index 000000000..25d5b6797 --- /dev/null +++ b/src/transport/test_transport_simple_send.sh @@ -0,0 +1,2 @@ +#!/bin/bash +exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; ./test_transport_simple_send" -- cgit v1.2.3 From 9eb417e72224c874ed1e31b8b0575a8382173537 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 30 Aug 2021 09:35:40 +0200 Subject: exec' --- src/transport/test_transport_simple_send.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 src/transport/test_transport_simple_send.sh (limited to 'src') diff --git a/src/transport/test_transport_simple_send.sh b/src/transport/test_transport_simple_send.sh old mode 100644 new mode 100755 -- cgit v1.2.3 From c66295e27c44c3ad4453f0d7ba9ccd905a6decb8 Mon Sep 17 00:00:00 2001 From: t3sserakt Date: Mon, 30 Aug 2021 15:04:46 +0200 Subject: - introduced nested namespace in test script to get rid of the permission problem, renamed test file. --- src/testing/netjail_core.sh | 11 ++- src/testing/netjail_exec.sh | 2 +- src/transport/Makefile.am | 10 +-- src/transport/test_transport_api_cmd_simple_send.c | 86 ---------------------- 4 files changed, 16 insertions(+), 93 deletions(-) delete mode 100644 src/transport/test_transport_api_cmd_simple_send.c (limited to 'src') diff --git a/src/testing/netjail_core.sh b/src/testing/netjail_core.sh index f49d4b312..cf350d3fa 100755 --- a/src/testing/netjail_core.sh +++ b/src/testing/netjail_core.sh @@ -1,7 +1,7 @@ #!/bin/sh # -JAILOR=${SUDO_USER:?must run in sudo} + # running with `sudo` is required to be # able running the actual commands as the @@ -90,6 +90,7 @@ netjail_node_add_default() { } netjail_node_exec() { + JAILOR=${SUDO_USER:?must run in sudo} NODE=$1 FD_IN=$2 FD_OUT=$3 @@ -99,9 +100,17 @@ netjail_node_exec() { } netjail_node_exec_without_fds() { + JAILOR=${SUDO_USER:?must run in sudo} NODE=$1 shift 1 ip netns exec $NODE sudo -u $JAILOR -- $@ } +netjail_node_exec_without_fds_and_sudo() { + NODE=$1 + shift 1 + + ip netns exec $NODE $@ +} + diff --git a/src/testing/netjail_exec.sh b/src/testing/netjail_exec.sh index c20a8c117..17a7caaac 100755 --- a/src/testing/netjail_exec.sh +++ b/src/testing/netjail_exec.sh @@ -13,4 +13,4 @@ NODE=$(netjail_print_name "N" $N $M) -netjail_node_exec_without_fds $NODE $3 $4 $5 $1 $2 +netjail_node_exec_without_fds_and_sudo $NODE $3 $4 $5 $1 $2 diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am index 61b3bab7c..4ea3b58c4 100644 --- a/src/transport/Makefile.am +++ b/src/transport/Makefile.am @@ -556,7 +556,7 @@ libgnunet_plugin_transport_https_server_la_CFLAGS = \ if HAVE_TESTING check_PROGRAMS = \ - test_transport_api_cmd_simple_send \ + test_transport_simple_send \ test_transport_address_switch_tcp \ test_transport_testing_startstop \ test_transport_testing_restart \ @@ -705,7 +705,7 @@ test_transport_api_slow_ats endif if HAVE_EXPERIMENTAL TESTS += \ - test_transport_api_cmd_simple_send \ + test_transport_simple_send \ test_transport_address_switch_udp \ test_plugin_udp \ test_transport_api_udp \ @@ -726,9 +726,9 @@ endif check_SCRIPTS= \ test_transport_simple_send.sh -test_transport_api_cmd_simple_send_SOURCES = \ - test_transport_api_cmd_simple_send.c -test_transport_api_cmd_simple_send_LDADD = \ +test_transport_simple_send_SOURCES = \ + test_transport_simple_send.c +test_transport_simple_send_LDADD = \ $(top_builddir)/src/testing/libgnunettesting.la \ $(top_builddir)/src/util/libgnunetutil.la \ $(top_builddir)/src/testbed/libgnunettestbed.la \ diff --git a/src/transport/test_transport_api_cmd_simple_send.c b/src/transport/test_transport_api_cmd_simple_send.c deleted file mode 100644 index 27b9f95de..000000000 --- a/src/transport/test_transport_api_cmd_simple_send.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - This file is part of GNUnet - Copyright (C) 2021 GNUnet e.V. - - GNUnet is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - GNUnet 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 - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - - SPDX-License-Identifier: AGPL3.0-or-later - */ - -/** - * @file transport/test_transport_api_cmd_simple_send.c - * @brief Test case executing a script which sends a test message between two peers. - * @author t3sserakt - */ -#include "platform.h" -#include "gnunet_testing_ng_lib.h" -#include "gnunet_util_lib.h" - -#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 120) - -/** - * Return value of the test. - * - */ -static unsigned int rv = 0; - - -/** - * Main function to run the test cases. - * - * @param cls not used. - * - */ -static void -run (void *cls) -{ - struct GNUNET_TESTING_Command commands[] = { - GNUNET_TESTING_cmd_netjail_start ("netjail-start", - "2", - "1"), - GNUNET_TESTING_cmd_netjail_start_testing_system ("netjail-start-testbed ", - "2", - "1", - "libgnunet_test_transport_plugin_cmd_simple_send", - &rv), - GNUNET_TESTING_cmd_stop_testing_system ("stop-testbed", - "netjail-start-testbed ", - "2", - "1"), - GNUNET_TESTING_cmd_netjail_stop ("netjail-stop ", - "2", - "1"), - GNUNET_TESTING_cmd_end () - }; - - GNUNET_TESTING_run (NULL, - commands, - TIMEOUT); -} - - -int -main (int argc, - char *const *argv) -{ - GNUNET_log_setup ("test-netjail", - "DEBUG", - NULL); - GNUNET_SCHEDULER_run (&run, - NULL); - - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Test finished!\n"); - return rv; -} -- cgit v1.2.3 From a2b5de8e03aea9d8664817ba51720ccf27517f4f Mon Sep 17 00:00:00 2001 From: Alessio Vanni Date: Tue, 31 Aug 2021 15:21:20 +0200 Subject: -More _ → dgettext changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/include/gnunet_common.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index 758a5133d..3cff9f482 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h @@ -884,7 +884,7 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind); if (! (cond)) \ { \ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \ - _ ("Assertion failed at %s:%d. Aborting.\n"), \ + dgettext ("gnunet", "Assertion failed at %s:%d. Aborting.\n"), \ __FILE__, \ __LINE__); \ GNUNET_abort_ (); \ @@ -899,7 +899,7 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind); if (! (cond)) \ { \ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \ - _ ("Assertion failed at %s:%d. Aborting.\n"), \ + dgettext ("gnunet", "Assertion failed at %s:%d. Aborting.\n"), \ __FILE__, \ __LINE__); \ GNUNET_abort_ (); \ @@ -917,7 +917,7 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind); if (! (cond)) \ { \ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \ - _ ("Assertion failed at %s:%d. Aborting.\n"), \ + dgettext ("gnunet", "Assertion failed at %s:%d. Aborting.\n"), \ f, \ l); \ GNUNET_abort_ (); \ @@ -939,7 +939,7 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind); { \ GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, \ comp, \ - _ ("Assertion failed at %s:%d. Aborting.\n"), \ + dgettext ("gnunet", "Assertion failed at %s:%d. Aborting.\n"), \ __FILE__, \ __LINE__); \ GNUNET_abort_ (); \ -- cgit v1.2.3 From 25d8a8a26626bf3cf80a85c1ad843e3a6dcf1c8a Mon Sep 17 00:00:00 2001 From: Alessio Vanni Date: Tue, 31 Aug 2021 16:09:03 +0200 Subject: Flip the value of GNUNET_EXTRA_LOGGING given when it's undefined This change has an impact only on those programs where gnunet_config,h is *not* included. GNUnet's configure script always defines this macro with an appropriate value, so it will never use this hardcoded value. By giving it a non-zero value, applications can now make use of the full logging capabilities provided by GNUnet. --- src/include/gnunet_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index 3cff9f482..3ee2a070a 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h @@ -135,7 +135,7 @@ enum GNUNET_GenericReturnValue * tree where gnunet_config.h is unavailable */ #ifndef GNUNET_EXTRA_LOGGING -#define GNUNET_EXTRA_LOGGING 0 +#define GNUNET_EXTRA_LOGGING 1 #endif /** -- cgit v1.2.3 From b4e034d9aa471c6244718914e08be3ee414b18e6 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 5 Sep 2021 16:58:55 +0200 Subject: refactor gnunet-config to make preload hacks obsolete --- src/include/gnunet_configuration_lib.h | 158 ++++++++++++++ src/include/platform.h | 26 +++ src/util/Makefile.am | 1 + src/util/configuration_helper.c | 316 +++++++++++++++++++++++++++ src/util/gnunet-config.c | 386 ++------------------------------- 5 files changed, 518 insertions(+), 369 deletions(-) create mode 100644 src/util/configuration_helper.c (limited to 'src') diff --git a/src/include/gnunet_configuration_lib.h b/src/include/gnunet_configuration_lib.h index 02e656196..46b745541 100644 --- a/src/include/gnunet_configuration_lib.h +++ b/src/include/gnunet_configuration_lib.h @@ -632,6 +632,164 @@ GNUNET_CONFIGURATION_append_value_filename (struct const char *option, const char *value); + +/** + * Closure for #GNUNET_CONFIGURATION_config_tool_run() + * with settings for what should be done with the + * configuration. + */ +struct GNUNET_CONFIGURATION_ConfigSettings +{ + + /** + * Name of the section + */ + char *section; + + /** + * Name of the option + */ + char *option; + + /** + * Value to set + */ + char *value; + + /** + * Backend to check if the respective plugin is + * loadable. NULL if no check is to be performed. + * The value is the "basename" of the plugin to load. + */ + char *backend_check; + + /** + * Treat option as a filename. + */ + int is_filename; + + /** + * Whether to show the sections. + */ + int list_sections; + + /** + * Should we write out the configuration file, even if no value was changed? + */ + int rewrite; + + /** + * Should we give extra diagnostics? + */ + int diagnostics; + + /** + * Should the generated configuration file contain the whole configuration? + */ + int full; + + + /** + * Return value from the operation, to be returned + * from 'main'. + */ + int global_ret; + +}; + + +/** + * Macro that expands to a set of GNUNET-getopt directives + * to initialize a `struct GNUNET_CONFIGURATION_ConfigSettings` + * from the command line. + * + * @param cs configuration settings to initialize + */ +#define GNUNET_CONFIGURATION_CONFIG_OPTIONS(cs) \ + GNUNET_GETOPT_option_exclusive ( \ + GNUNET_GETOPT_option_string ( \ + 'b', \ + "supported-backend", \ + "BACKEND", \ + gettext_noop ( \ + "test if the current installation supports the specified BACKEND"), \ + &(cs)->backend_check)), \ + GNUNET_GETOPT_option_flag ( \ + 'F', \ + "full", \ + gettext_noop ( \ + "write the full configuration file, including default values"), \ + &(cs)->full), \ + GNUNET_GETOPT_option_flag ( \ + 'f', \ + "filename", \ + gettext_noop ("interpret option value as a filename (with $-expansion)"), \ + &(cs)->is_filename), \ + GNUNET_GETOPT_option_string ('o', \ + "option", \ + "OPTION", \ + gettext_noop ("name of the option to access"), \ + &(cs)->option), \ + GNUNET_GETOPT_option_flag ( \ + 'r', \ + "rewrite", \ + gettext_noop ( \ + "rewrite the configuration file, even if nothing changed"), \ + &(cs)->rewrite), \ + GNUNET_GETOPT_option_flag ( \ + 'd', \ + "diagnostics", \ + gettext_noop ( \ + "output extra diagnostics"), \ + &(cs)->diagnostics), \ + GNUNET_GETOPT_option_flag ('S', \ + "list-sections", \ + gettext_noop ( \ + "print available configuration sections"), \ + &(cs)->list_sections), \ + GNUNET_GETOPT_option_string ('s', \ + "section", \ + "SECTION", \ + gettext_noop ( \ + "name of the section to access"), \ + &(cs)->section), \ + GNUNET_GETOPT_option_string ('V', \ + "value", \ + "VALUE", \ + gettext_noop ("value to set"), \ + &(cs)->value) + + +/** + * Free resources assoicated with @a cs. + * + * @param[in] cs settings to free (actual memory + * of @a cs itself is not released) + */ +void +GNUNET_CONFIGURATION_config_settings_free ( + struct GNUNET_CONFIGURATION_ConfigSettings *cs); + + +/** + * Main task to run to perform operations typical for + * gnunet-config as per the configuration settings + * given in @a cls. + * + * @param cls closure with the `struct GNUNET_CONFIGURATION_ConfigSettings` + * @param args remaining command-line arguments + * @param cfgfile name of the configuration file used (for saving, + * can be NULL!) + * @param cfg configuration + */ +void +GNUNET_CONFIGURATION_config_tool_run ( + void *cls, + char *const *args, + const char *cfgfile, + const struct GNUNET_CONFIGURATION_Handle *cfg); + + #if 0 /* keep Emacsens' auto-indent happy */ { #endif diff --git a/src/include/platform.h b/src/include/platform.h index dfa30aeee..b1de45f62 100644 --- a/src/include/platform.h +++ b/src/include/platform.h @@ -252,6 +252,32 @@ atoll (const char *nptr); #define GNUNET_THREAD_LOCAL #endif + +/* LSB-style exit status codes */ +#ifndef EXIT_INVALIDARGUMENT +#define EXIT_INVALIDARGUMENT 2 +#endif + +#ifndef EXIT_NOTIMPLEMENTED +#define EXIT_NOTIMPLEMENTED 3 +#endif + +#ifndef EXIT_NOPERMISSION +#define EXIT_NOPERMISSION 4 +#endif + +#ifndef EXIT_NOTINSTALLED +#define EXIT_NOTINSTALLED 5 +#endif + +#ifndef EXIT_NOTCONFIGURED +#define EXIT_NOTCONFIGURED 6 +#endif + +#ifndef EXIT_NOTRUNNING +#define EXIT_NOTRUNNING 7 +#endif + /** * clang et al do not have such an attribute */ diff --git a/src/util/Makefile.am b/src/util/Makefile.am index 6d5307235..a3a77073e 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am @@ -49,6 +49,7 @@ libgnunetutil_la_SOURCES = \ common_endian.c \ common_logging.c \ configuration.c \ + configuration_helper.c \ consttime_memcmp.c \ container_bloomfilter.c \ container_heap.c \ diff --git a/src/util/configuration_helper.c b/src/util/configuration_helper.c new file mode 100644 index 000000000..eb8b543d1 --- /dev/null +++ b/src/util/configuration_helper.c @@ -0,0 +1,316 @@ +/* + This file is part of GNUnet. + Copyright (C) 2006, 2007, 2008, 2009, 2013, 2020, 2021 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet 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 + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + + SPDX-License-Identifier: AGPL3.0-or-later + */ +/** + * @file src/util/configuration_helper.c + * @brief helper logic for gnunet-config + * @author Christian Grothoff + */ +#include "platform.h" +#include "gnunet_util_lib.h" + +/** + * Print each option in a given section as a filename. + * + * @param cls closure + * @param section name of the section + * @param option name of the option + * @param value value of the option + */ +static void +print_filename_option (void *cls, + const char *section, + const char *option, + const char *value) +{ + const struct GNUNET_CONFIGURATION_Handle *cfg = cls; + + char *value_fn; + char *fn; + + GNUNET_assert (GNUNET_OK == + GNUNET_CONFIGURATION_get_value_filename (cfg, + section, + option, + &value_fn)); + fn = GNUNET_STRINGS_filename_expand (value_fn); + if (NULL == fn) + fn = value_fn; + else + GNUNET_free (value_fn); + fprintf (stdout, + "%s = %s\n", + option, + fn); + GNUNET_free (fn); +} + + +/** + * Print each option in a given section. + * + * @param cls closure + * @param section name of the section + * @param option name of the option + * @param value value of the option + */ +static void +print_option (void *cls, + const char *section, + const char *option, + const char *value) +{ + (void) cls; + (void) section; + + fprintf (stdout, + "%s = %s\n", + option, + value); +} + + +/** + * Print out given section name. + * + * @param cls unused + * @param section a section in the configuration file + */ +static void +print_section_name (void *cls, + const char *section) +{ + (void) cls; + fprintf (stdout, + "%s\n", + section); +} + + +void +GNUNET_CONFIGURATION_config_tool_run ( + void *cls, + char *const *args, + const char *cfgfile, + const struct GNUNET_CONFIGURATION_Handle *cfg) +{ + struct GNUNET_CONFIGURATION_ConfigSettings *cs = cls; + struct GNUNET_CONFIGURATION_Handle *out = NULL; + struct GNUNET_CONFIGURATION_Handle *ncfg = NULL; + + (void) args; + if (NULL != cs->backend_check) + { + char *name; + + GNUNET_asprintf (&name, + "libgnunet_plugin_%s", + cs->backend_check); + cs->global_ret = (GNUNET_OK == + GNUNET_PLUGIN_test (name)) ? 0 : 77; + GNUNET_free (name); + return; + } + + if (cs->diagnostics) + { + /* Re-parse the configuration with diagnostics enabled. */ + ncfg = GNUNET_CONFIGURATION_create (); + GNUNET_CONFIGURATION_enable_diagnostics (ncfg); + GNUNET_CONFIGURATION_load (ncfg, + cfgfile); + cfg = ncfg; + } + + if (cs->full) + cs->rewrite = GNUNET_YES; + if (cs->list_sections) + { + fprintf (stderr, + _ ("The following sections are available:\n")); + GNUNET_CONFIGURATION_iterate_sections (cfg, + &print_section_name, + NULL); + return; + } + if ( (! cs->rewrite) && + (NULL == cs->section) ) + { + char *serialization; + + if (! cs->diagnostics) + { + fprintf (stderr, + _ ("%s, %s or %s argument is required\n"), + "--section", + "--list-sections", + "--diagnostics"); + cs->global_ret = EXIT_INVALIDARGUMENT; + return; + } + serialization = GNUNET_CONFIGURATION_serialize_diagnostics (cfg); + fprintf (stdout, + "%s", + serialization); + GNUNET_free (serialization); + } + else if ( (NULL != cs->section) && + (NULL == cs->value) ) + { + if (NULL == cs->option) + { + GNUNET_CONFIGURATION_iterate_section_values ( + cfg, + cs->section, + cs->is_filename + ? &print_filename_option + : &print_option, + (void *) cfg); + } + else + { + char *value; + + if (cs->is_filename) + { + if (GNUNET_OK != + GNUNET_CONFIGURATION_get_value_filename (cfg, + cs->section, + cs->option, + &value)) + { + GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, + cs->section, + cs->option); + cs->global_ret = EXIT_NOTCONFIGURED; + return; + } + } + else + { + if (GNUNET_OK != + GNUNET_CONFIGURATION_get_value_string (cfg, + cs->section, + cs->option, + &value)) + { + GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, + cs->section, + cs->option); + cs->global_ret = EXIT_NOTCONFIGURED; + return; + } + } + fprintf (stdout, + "%s\n", + value); + GNUNET_free (value); + } + } + else if (NULL != cs->section) + { + if (NULL == cs->option) + { + fprintf (stderr, + _ ("--option argument required to set value\n")); + cs->global_ret = EXIT_INVALIDARGUMENT; + return; + } + out = GNUNET_CONFIGURATION_dup (cfg); + GNUNET_CONFIGURATION_set_value_string (out, + cs->section, + cs->option, + cs->value); + cs->rewrite = GNUNET_YES; + } + if (cs->rewrite) + { + char *cfg_fn = NULL; + + if (NULL == out) + out = GNUNET_CONFIGURATION_dup (cfg); + + if (NULL == cfgfile) + { + const char *xdg = getenv ("XDG_CONFIG_HOME"); + + if (NULL != xdg) + GNUNET_asprintf (&cfg_fn, + "%s%s%s", + xdg, + DIR_SEPARATOR_STR, + GNUNET_OS_project_data_get ()->config_file); + else + cfg_fn = GNUNET_strdup ( + GNUNET_OS_project_data_get ()->user_config_file); + cfgfile = cfg_fn; + } + + if (! cs->full) + { + struct GNUNET_CONFIGURATION_Handle *def; + + def = GNUNET_CONFIGURATION_create (); + if (GNUNET_OK != + GNUNET_CONFIGURATION_load (def, + NULL)) + { + fprintf (stderr, + _ ("failed to load configuration defaults")); + cs->global_ret = 1; + GNUNET_CONFIGURATION_destroy (def); + GNUNET_CONFIGURATION_destroy (out); + GNUNET_free (cfg_fn); + return; + } + if (GNUNET_OK != + GNUNET_CONFIGURATION_write_diffs (def, + out, + cfgfile)) + cs->global_ret = 2; + GNUNET_CONFIGURATION_destroy (def); + } + else + { + if (GNUNET_OK != + GNUNET_CONFIGURATION_write (out, + cfgfile)) + cs->global_ret = 2; + } + GNUNET_free (cfg_fn); + } + if (NULL != out) + GNUNET_CONFIGURATION_destroy (out); + if (NULL != ncfg) + GNUNET_CONFIGURATION_destroy (ncfg); +} + + +void +GNUNET_CONFIGURATION_config_settings_free ( + struct GNUNET_CONFIGURATION_ConfigSettings *cs) +{ + GNUNET_free (cs->option); + GNUNET_free (cs->section); + GNUNET_free (cs->value); + GNUNET_free (cs->backend_check); +} + + +/* end of configuration_helper.c */ diff --git a/src/util/gnunet-config.c b/src/util/gnunet-config.c index 807df0d74..202ef7866 100644 --- a/src/util/gnunet-config.c +++ b/src/util/gnunet-config.c @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - Copyright (C) 2012 GNUnet e.V. + Copyright (C) 2012-2021 GNUnet e.V. GNUnet is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published @@ -27,313 +27,6 @@ #include "gnunet_util_lib.h" -/** - * Name of the section - */ -static char *section; - -/** - * Name of the option - */ -static char *option; - -/** - * Value to set - */ -static char *value; - -/** - * Backend to check if the respective plugin is - * loadable. NULL if no check is to be performed. - * The value is the "basename" of the plugin to load. - */ -static char *backend_check; - -/** - * Treat option as a filename. - */ -static int is_filename; - -/** - * Whether to show the sections. - */ -static int list_sections; - -/** - * Return value from 'main'. - */ -static int global_ret; - -/** - * Should we write out the configuration file, even if no value was changed? - */ -static int rewrite; - -/** - * Should we give extra diagnostics? - */ -static int diagnostics; - - -/** - * Should the generated configuration file contain the whole configuration? - */ -static int full; - - -/** - * Print each option in a given section. - * - * @param cls closure - * @param section name of the section - * @param option name of the option - * @param value value of the option - */ -static void -print_option (void *cls, - const char *section, - const char *option, - const char *value) -{ - const struct GNUNET_CONFIGURATION_Handle *cfg = cls; - - (void) section; - if (is_filename) - { - char *value_fn; - char *fn; - - GNUNET_assert (GNUNET_OK == - GNUNET_CONFIGURATION_get_value_filename (cfg, - section, - option, - &value_fn)); - fn = GNUNET_STRINGS_filename_expand (value_fn); - if (NULL == fn) - fn = value_fn; - else - GNUNET_free (value_fn); - fprintf (stdout, "%s = %s\n", option, fn); - GNUNET_free (fn); - } - else - { - fprintf (stdout, "%s = %s\n", option, value); - } -} - - -/** - * Print out given section name. - * - * @param cls unused - * @param section a section in the configuration file - */ -static void -print_section_name (void *cls, const char *section) -{ - (void) cls; - fprintf (stdout, "%s\n", section); -} - - -/** - * Main function that will be run by the scheduler. - * - * @param cls closure - * @param args remaining command-line arguments - * @param cfgfile name of the configuration file used (for saving, - * can be NULL!) - * @param cfg configuration - */ -static void -run (void *cls, - char *const *args, - const char *cfgfile, - const struct GNUNET_CONFIGURATION_Handle *cfg) -{ - struct GNUNET_CONFIGURATION_Handle *out = NULL; - - (void) cls; - (void) args; - if (NULL != backend_check) - { - char *name; - - GNUNET_asprintf (&name, - "libgnunet_plugin_%s", - backend_check); - global_ret = (GNUNET_OK == - GNUNET_PLUGIN_test (name)) ? 0 : 77; - GNUNET_free (name); - return; - } - - if (diagnostics) - { - struct GNUNET_CONFIGURATION_Handle *ncfg; - /* Re-parse the configuration with diagnostics enabled. */ - ncfg = GNUNET_CONFIGURATION_create (); - GNUNET_CONFIGURATION_enable_diagnostics (ncfg); - GNUNET_CONFIGURATION_load (ncfg, cfgfile); - cfg = ncfg; - } - - if (full) - rewrite = GNUNET_YES; - if (list_sections) - { - fprintf (stderr, - _ ("The following sections are available:\n")); - GNUNET_CONFIGURATION_iterate_sections (cfg, - &print_section_name, - NULL); - return; - } - if ( (! rewrite) && - (NULL == section) ) - { - char *serialization; - - if (! diagnostics) - { - fprintf (stderr, - _ ("%s, %s or %s argument is required\n"), - "--section", - "--list-sections", - "--diagnostics"); - global_ret = 1; - return; - } - serialization = GNUNET_CONFIGURATION_serialize_diagnostics (cfg); - fprintf (stdout, - "%s", - serialization); - GNUNET_free (serialization); - } - else if ( (NULL != section) && - (NULL == value) ) - { - if (NULL == option) - { - GNUNET_CONFIGURATION_iterate_section_values (cfg, - section, - &print_option, - (void *) cfg); - } - else - { - if (is_filename) - { - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_filename (cfg, - section, - option, - &value)) - { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - section, - option); - global_ret = 3; - return; - } - } - else - { - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_string (cfg, - section, - option, - &value)) - { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - section, - option); - global_ret = 3; - return; - } - } - fprintf (stdout, - "%s\n", - value); - } - } - else if (NULL != section) - { - if (NULL == option) - { - fprintf (stderr, - _ ("--option argument required to set value\n")); - global_ret = 1; - return; - } - out = GNUNET_CONFIGURATION_dup (cfg); - GNUNET_CONFIGURATION_set_value_string (out, - section, - option, - value); - rewrite = GNUNET_YES; - } - if (rewrite) - { - char *cfg_fn = NULL; - - if (NULL == out) - out = GNUNET_CONFIGURATION_dup (cfg); - - if (NULL == cfgfile) - { - const char *xdg = getenv ("XDG_CONFIG_HOME"); - if (NULL != xdg) - GNUNET_asprintf (&cfg_fn, - "%s%s%s", - xdg, - DIR_SEPARATOR_STR, - GNUNET_OS_project_data_get ()->config_file); - else - cfg_fn = GNUNET_strdup ( - GNUNET_OS_project_data_get ()->user_config_file); - cfgfile = cfg_fn; - } - - if (! full) - { - struct GNUNET_CONFIGURATION_Handle *def; - - def = GNUNET_CONFIGURATION_create (); - if (GNUNET_OK != - GNUNET_CONFIGURATION_load (def, - NULL)) - { - fprintf (stderr, - _ ("failed to load configuration defaults")); - global_ret = 1; - GNUNET_CONFIGURATION_destroy (def); - GNUNET_CONFIGURATION_destroy (out); - GNUNET_free (cfg_fn); - return; - } - if (GNUNET_OK != - GNUNET_CONFIGURATION_write_diffs (def, - out, - cfgfile)) - global_ret = 2; - GNUNET_CONFIGURATION_destroy (def); - } - else - { - if (GNUNET_OK != - GNUNET_CONFIGURATION_write (out, - cfgfile)) - global_ret = 2; - } - GNUNET_free (cfg_fn); - } - if (NULL != out) - GNUNET_CONFIGURATION_destroy (out); -} - - /** * Program to manipulate configuration files. * @@ -342,82 +35,37 @@ run (void *cls, * @return 0 ok, 1 on error */ int -main (int argc, char *const *argv) +main (int argc, + char *const *argv) { + struct GNUNET_CONFIGURATION_ConfigSettings cs = { + .global_ret = EXIT_SUCCESS + }; struct GNUNET_GETOPT_CommandLineOption options[] = { - GNUNET_GETOPT_option_exclusive ( - GNUNET_GETOPT_option_string ( - 'b', - "supported-backend", - "BACKEND", - gettext_noop ( - "test if the current installation supports the specified BACKEND"), - &backend_check)), - GNUNET_GETOPT_option_flag ( - 'F', - "full", - gettext_noop ( - "write the full configuration file, including default values"), - &full), - GNUNET_GETOPT_option_flag ( - 'f', - "filename", - gettext_noop ("interpret option value as a filename (with $-expansion)"), - &is_filename), - GNUNET_GETOPT_option_string ('o', - "option", - "OPTION", - gettext_noop ("name of the option to access"), - &option), - GNUNET_GETOPT_option_flag ( - 'r', - "rewrite", - gettext_noop ( - "rewrite the configuration file, even if nothing changed"), - &rewrite), - GNUNET_GETOPT_option_flag ( - 'd', - "diagnostics", - gettext_noop ( - "output extra diagnostics"), - &diagnostics), - GNUNET_GETOPT_option_flag ('S', - "list-sections", - gettext_noop ( - "print available configuration sections"), - &list_sections), - GNUNET_GETOPT_option_string ('s', - "section", - "SECTION", - gettext_noop ( - "name of the section to access"), - §ion), - GNUNET_GETOPT_option_string ('V', - "value", - "VALUE", - gettext_noop ("value to set"), - &value), + GNUNET_CONFIGURATION_CONFIG_OPTIONS (&cs), GNUNET_GETOPT_OPTION_END }; - int ret; + enum GNUNET_GenericReturnValue ret; if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) - return 2; - + return EXIT_FAILURE; ret = GNUNET_PROGRAM_run (argc, argv, "gnunet-config [OPTIONS]", gettext_noop ("Manipulate GNUnet configuration files"), options, - &run, - NULL); + &GNUNET_CONFIGURATION_config_tool_run, + &cs); GNUNET_free_nz ((void *) argv); - if (GNUNET_OK == ret) - return global_ret; - return ret; + GNUNET_CONFIGURATION_config_settings_free (&cs); + if (GNUNET_NO == ret) + return 0; + if (GNUNET_SYSERR == ret) + return EXIT_INVALIDARGUMENT; + return cs.global_ret; } -- cgit v1.2.3 From f9f3cbe9fcedfb8ca95275d5e406b1270062d7ea Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 5 Sep 2021 18:27:53 +0200 Subject: make backend-check a gnunet-only gnunet-config option --- src/include/gnunet_configuration_lib.h | 23 +++++--------- src/util/configuration_helper.c | 14 --------- src/util/gnunet-config.c | 57 +++++++++++++++++++++++++++++++++- 3 files changed, 64 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/include/gnunet_configuration_lib.h b/src/include/gnunet_configuration_lib.h index 46b745541..234f66e61 100644 --- a/src/include/gnunet_configuration_lib.h +++ b/src/include/gnunet_configuration_lib.h @@ -641,6 +641,14 @@ GNUNET_CONFIGURATION_append_value_filename (struct struct GNUNET_CONFIGURATION_ConfigSettings { + /** + * Must be set to the API version, i.e. + * #GNUNET_UTIL_VERSION. Used to detect + * which version of the struct the client + * is using. + */ + unsigned int api_version; + /** * Name of the section */ @@ -656,13 +664,6 @@ struct GNUNET_CONFIGURATION_ConfigSettings */ char *value; - /** - * Backend to check if the respective plugin is - * loadable. NULL if no check is to be performed. - * The value is the "basename" of the plugin to load. - */ - char *backend_check; - /** * Treat option as a filename. */ @@ -706,14 +707,6 @@ struct GNUNET_CONFIGURATION_ConfigSettings * @param cs configuration settings to initialize */ #define GNUNET_CONFIGURATION_CONFIG_OPTIONS(cs) \ - GNUNET_GETOPT_option_exclusive ( \ - GNUNET_GETOPT_option_string ( \ - 'b', \ - "supported-backend", \ - "BACKEND", \ - gettext_noop ( \ - "test if the current installation supports the specified BACKEND"), \ - &(cs)->backend_check)), \ GNUNET_GETOPT_option_flag ( \ 'F', \ "full", \ diff --git a/src/util/configuration_helper.c b/src/util/configuration_helper.c index eb8b543d1..8f995ec03 100644 --- a/src/util/configuration_helper.c +++ b/src/util/configuration_helper.c @@ -115,19 +115,6 @@ GNUNET_CONFIGURATION_config_tool_run ( struct GNUNET_CONFIGURATION_Handle *ncfg = NULL; (void) args; - if (NULL != cs->backend_check) - { - char *name; - - GNUNET_asprintf (&name, - "libgnunet_plugin_%s", - cs->backend_check); - cs->global_ret = (GNUNET_OK == - GNUNET_PLUGIN_test (name)) ? 0 : 77; - GNUNET_free (name); - return; - } - if (cs->diagnostics) { /* Re-parse the configuration with diagnostics enabled. */ @@ -309,7 +296,6 @@ GNUNET_CONFIGURATION_config_settings_free ( GNUNET_free (cs->option); GNUNET_free (cs->section); GNUNET_free (cs->value); - GNUNET_free (cs->backend_check); } diff --git a/src/util/gnunet-config.c b/src/util/gnunet-config.c index 202ef7866..797de0b0d 100644 --- a/src/util/gnunet-config.c +++ b/src/util/gnunet-config.c @@ -27,6 +27,52 @@ #include "gnunet_util_lib.h" +/** + * Backend to check if the respective plugin is + * loadable. NULL if no check is to be performed. + * The value is the "basename" of the plugin to load. + */ +static char *backend_check; + + +/** + * Main task to run to perform operations typical for + * gnunet-config as per the configuration settings + * given in @a cls. + * + * @param cls closure with the `struct GNUNET_CONFIGURATION_ConfigSettings` + * @param args remaining command-line arguments + * @param cfgfile name of the configuration file used (for saving, + * can be NULL!) + * @param cfg configuration + */ +static void +run (void *cls, + char *const *args, + const char *cfgfile, + const struct GNUNET_CONFIGURATION_Handle *cfg) +{ + struct GNUNET_CONFIGURATION_ConfigSettings *cs = cls; + + if (NULL != backend_check) + { + char *name; + + GNUNET_asprintf (&name, + "libgnunet_plugin_%s", + backend_check); + cs->global_ret = (GNUNET_OK == + GNUNET_PLUGIN_test (name)) ? 0 : 77; + GNUNET_free (name); + return; + } + GNUNET_CONFIGURATION_config_tool_run (cs, + args, + cfgfile, + cfg); +} + + /** * Program to manipulate configuration files. * @@ -39,9 +85,18 @@ main (int argc, char *const *argv) { struct GNUNET_CONFIGURATION_ConfigSettings cs = { + .api_version = GNUNET_UTIL_VERSION, .global_ret = EXIT_SUCCESS }; struct GNUNET_GETOPT_CommandLineOption options[] = { + GNUNET_GETOPT_option_exclusive ( + GNUNET_GETOPT_option_string ( + 'b', + "supported-backend", + "BACKEND", + gettext_noop ( + "test if the current installation supports the specified BACKEND"), + &backend_check)), GNUNET_CONFIGURATION_CONFIG_OPTIONS (&cs), GNUNET_GETOPT_OPTION_END }; @@ -57,7 +112,7 @@ main (int argc, "gnunet-config [OPTIONS]", gettext_noop ("Manipulate GNUnet configuration files"), options, - &GNUNET_CONFIGURATION_config_tool_run, + &run, &cs); GNUNET_free_nz ((void *) argv); GNUNET_CONFIGURATION_config_settings_free (&cs); -- cgit v1.2.3 From c607a4dbbd25683f1bc857236803a9411b9a9f1f Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 5 Sep 2021 18:36:16 +0200 Subject: -typo --- src/include/gnunet_configuration_lib.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/include/gnunet_configuration_lib.h b/src/include/gnunet_configuration_lib.h index 234f66e61..b0ecc14e1 100644 --- a/src/include/gnunet_configuration_lib.h +++ b/src/include/gnunet_configuration_lib.h @@ -1,4 +1,4 @@ -/* +1/* This file is part of GNUnet. Copyright (C) 2006, 2008, 2009, 2018 GNUnet e.V. @@ -754,7 +754,7 @@ struct GNUNET_CONFIGURATION_ConfigSettings /** - * Free resources assoicated with @a cs. + * Free resources associated with @a cs. * * @param[in] cs settings to free (actual memory * of @a cs itself is not released) -- cgit v1.2.3 From 27953300533740de5996222ddb03b1507602ae62 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 5 Sep 2021 19:02:03 +0200 Subject: -typo --- src/include/gnunet_configuration_lib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/include/gnunet_configuration_lib.h b/src/include/gnunet_configuration_lib.h index b0ecc14e1..570546b68 100644 --- a/src/include/gnunet_configuration_lib.h +++ b/src/include/gnunet_configuration_lib.h @@ -1,4 +1,4 @@ -1/* +/* This file is part of GNUnet. Copyright (C) 2006, 2008, 2009, 2018 GNUnet e.V. -- cgit v1.2.3 From 3da9cbd621a98c885a0c633ddaec0a84aa8a8e66 Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Sun, 5 Sep 2021 22:21:40 +0200 Subject: BUILD: Remove FRAMEWORK_BUILD define --- src/include/platform.h | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src') diff --git a/src/include/platform.h b/src/include/platform.h index b1de45f62..e44f9f51a 100644 --- a/src/include/platform.h +++ b/src/include/platform.h @@ -170,18 +170,12 @@ #include "compat.h" #include -#ifndef FRAMEWORK_BUILD #include "gettext.h" /** * GNU gettext support macro. */ #define _(String) dgettext (PACKAGE, String) #define LIBEXTRACTOR_GETTEXT_DOMAIN "libextractor" -#else -#include "libintlemu.h" -#define _(String) dgettext ("org.gnunet.gnunet", String) -#define LIBEXTRACTOR_GETTEXT_DOMAIN "org.gnunet.libextractor" -#endif #include -- cgit v1.2.3