diff options
Diffstat (limited to 'src/namestore')
29 files changed, 381 insertions, 370 deletions
diff --git a/src/namestore/gnunet-namestore-fcfsd.c b/src/namestore/gnunet-namestore-fcfsd.c index 903253b1ae..f4cdf26b47 100644 --- a/src/namestore/gnunet-namestore-fcfsd.c +++ b/src/namestore/gnunet-namestore-fcfsd.c @@ -2,20 +2,18 @@ This file is part of GNUnet. Copyright (C) 2012-2014 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + 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 <http://www.gnu.org/licenses/>. */ /** * @file gnunet-namestore-fcfsd.c @@ -161,11 +159,6 @@ struct Request struct ZoneinfoRequest { /** - * Connection - */ - struct MHD_Connection *connection; - - /** * List iterator */ struct GNUNET_NAMESTORE_ZoneIterator *list_it; @@ -212,6 +205,16 @@ static struct GNUNET_CRYPTO_EcdsaPrivateKey fcfs_zone_pkey; static struct GNUNET_IDENTITY_Handle *identity; /** + * Zoneinfo page we currently use. + */ +static struct MHD_Response *info_page; + +/** + * Task that runs #update_zoneinfo_page peridicially. + */ +static struct GNUNET_SCHEDULER_Task *uzp_task; + +/** * Request for our ego. */ static struct GNUNET_IDENTITY_Operation *id_op; @@ -221,6 +224,11 @@ static struct GNUNET_IDENTITY_Operation *id_op; */ static unsigned long long port; +/** + * Name of the zone we manage. + */ +static char *zone; + /** * Task run whenever HTTP server operations are pending. @@ -247,25 +255,25 @@ run_httpd_now () /** + * Create fresh version of zone information. + */ +static void +update_zoneinfo_page (void *cls); + + +/** * Function called on error in zone iteration. */ static void zone_iteration_error (void *cls) { struct ZoneinfoRequest *zr = cls; - struct MHD_Response *response; zr->list_it = NULL; - response = MHD_create_response_from_buffer (strlen ("internal error"), - (void *) "internal error", - MHD_RESPMEM_PERSISTENT); - MHD_queue_response (zr->connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - response); - MHD_destroy_response (response); GNUNET_free (zr->zoneinfo); - GNUNET_free (zr); - run_httpd_now (); + GNUNET_SCHEDULER_cancel (uzp_task); + uzp_task = GNUNET_SCHEDULER_add_now (&update_zoneinfo_page, + NULL); } @@ -292,13 +300,9 @@ zone_iteration_end (void *cls) MHD_add_response_header (response, MHD_HTTP_HEADER_CONTENT_TYPE, MIME_HTML); - MHD_queue_response (zr->connection, - MHD_HTTP_OK, - response); - MHD_destroy_response (response); + MHD_destroy_response (info_page); + info_page = response; GNUNET_free (zr->zoneinfo); - GNUNET_free (zr); - run_httpd_now (); } @@ -373,27 +377,41 @@ iterate_cb (void *cls, * Handler that returns FCFS zoneinfo page. * * @param connection connection to use - * @return MHD_YES on success */ -static int +static int serve_zoneinfo_page (struct MHD_Connection *connection) { - struct ZoneinfoRequest *zr; - - zr = GNUNET_new (struct ZoneinfoRequest); - zr->zoneinfo = GNUNET_malloc (DEFAULT_ZONEINFO_BUFSIZE); - zr->buf_len = DEFAULT_ZONEINFO_BUFSIZE; - zr->connection = connection; - zr->write_offset = 0; - zr->list_it = GNUNET_NAMESTORE_zone_iteration_start (ns, - &fcfs_zone_pkey, - &zone_iteration_error, - zr, - &iterate_cb, - zr, - &zone_iteration_end, - zr); - return MHD_YES; + return MHD_queue_response (connection, + MHD_HTTP_OK, + info_page); +} + + +/** + * Create fresh version of zone information. + */ +static void +update_zoneinfo_page (void *cls) +{ + static struct ZoneinfoRequest zr; + + (void) cls; + uzp_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, + &update_zoneinfo_page, + NULL); + if (NULL != zr.list_it) + return; + zr.zoneinfo = GNUNET_malloc (DEFAULT_ZONEINFO_BUFSIZE); + zr.buf_len = DEFAULT_ZONEINFO_BUFSIZE; + zr.write_offset = 0; + zr.list_it = GNUNET_NAMESTORE_zone_iteration_start (ns, + &fcfs_zone_pkey, + &zone_iteration_error, + &zr, + &iterate_cb, + &zr, + &zone_iteration_end, + &zr); } @@ -401,7 +419,7 @@ serve_zoneinfo_page (struct MHD_Connection *connection) * Handler that returns a simple static HTTP page. * * @param connection connection to use - * @return MHD_YES on success + * @return #MHD_YES on success */ static int serve_main_page (struct MHD_Connection *connection) @@ -634,14 +652,14 @@ lookup_block_error (void *cls) * and continue to process the result. * * @param cls the 'struct Request' we are processing - * @param zone private key of the zone; NULL on disconnect + * @param zonekey private key of the zone; NULL on disconnect * @param label label of the records; NULL on disconnect * @param rd_count number of entries in @a rd array, 0 if label was deleted * @param rd array of records with data to store */ static void lookup_block_processor (void *cls, - const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zonekey, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd) @@ -650,7 +668,7 @@ lookup_block_processor (void *cls, (void) label; (void) rd; - (void) zone; + (void) zonekey; request->qe = NULL; if (0 == rd_count) { @@ -703,8 +721,8 @@ lookup_block_processor (void *cls, * @a upload_data provided; the method must update this * value to the number of bytes NOT processed; * @param ptr pointer to location where we store the 'struct Request' - * @return MHD_YES if the connection was handled successfully, - * MHD_NO if the socket must be closed due to a serious + * @return #MHD_YES if the connection was handled successfully, + * #MHD_NO if the socket must be closed due to a serious * error while handling the request */ static int @@ -959,6 +977,11 @@ do_shutdown (void *cls) GNUNET_SCHEDULER_cancel (httpd_task); httpd_task = NULL; } + if (NULL != uzp_task) + { + GNUNET_SCHEDULER_cancel (uzp_task); + uzp_task = NULL; + } if (NULL != ns) { GNUNET_NAMESTORE_disconnect (ns); @@ -1011,12 +1034,16 @@ identity_cb (void *cls, (void) cls; (void) ctx; - (void) name; - id_op = NULL; + if (NULL == name) + return; + if (0 != strcmp (name, + zone)) + return; if (NULL == ego) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("No ego configured for `fcfsd` subsystem\n")); + GNUNET_SCHEDULER_shutdown (); return; } fcfs_zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (ego); @@ -1041,6 +1068,7 @@ identity_cb (void *cls, while (NULL == httpd); if (NULL == httpd) { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Failed to start HTTP server\n")); GNUNET_SCHEDULER_shutdown (); @@ -1085,16 +1113,18 @@ run (void *cls, return; } identity = GNUNET_IDENTITY_connect (cfg, - NULL, NULL); + &identity_cb, + NULL); if (NULL == identity) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Failed to connect to identity\n")); return; } - id_op = GNUNET_IDENTITY_get (identity, "fcfsd", - &identity_cb, NULL); - GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); + uzp_task = GNUNET_SCHEDULER_add_now (&update_zoneinfo_page, + NULL); + GNUNET_SCHEDULER_add_shutdown (&do_shutdown, + NULL); } @@ -1109,7 +1139,13 @@ int main (int argc, char *const *argv) { - static const struct GNUNET_GETOPT_CommandLineOption options[] = { + struct GNUNET_GETOPT_CommandLineOption options[] = { + GNUNET_GETOPT_option_mandatory + (GNUNET_GETOPT_option_string ('z', + "zone", + "EGO", + gettext_noop ("name of the zone that is to be managed by FCFSD"), + &zone)), GNUNET_GETOPT_OPTION_END }; int ret; diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c index 83a7ee3494..6ffd99773c 100644 --- a/src/namestore/gnunet-namestore.c +++ b/src/namestore/gnunet-namestore.c @@ -2,20 +2,18 @@ This file is part of GNUnet. Copyright (C) 2012, 2013, 2014 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + 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 <http://www.gnu.org/licenses/>. */ /** * @file gnunet-namestore.c diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index 2044010df8..2d60205526 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c @@ -2,20 +2,18 @@ This file is part of GNUnet. Copyright (C) 2012, 2013, 2014, 2018 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + 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 <http://www.gnu.org/licenses/>. */ /** diff --git a/src/namestore/gnunet-zoneimport.c b/src/namestore/gnunet-zoneimport.c index 44c9fe89e1..6c89cdb05c 100644 --- a/src/namestore/gnunet-zoneimport.c +++ b/src/namestore/gnunet-zoneimport.c @@ -2,20 +2,18 @@ This file is part of GNUnet Copyright (C) 2018 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + 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 <http://www.gnu.org/licenses/>. */ /** * @file src/namestore/gnunet-zoneimport.c diff --git a/src/namestore/namestore.h b/src/namestore/namestore.h index 679ca3d3de..e6f5ae8484 100644 --- a/src/namestore/namestore.h +++ b/src/namestore/namestore.h @@ -2,20 +2,18 @@ This file is part of GNUnet. Copyright (C) 2011-2013 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + 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 <http://www.gnu.org/licenses/>. */ /** diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c index f2aaa43c8a..55745d83d8 100644 --- a/src/namestore/namestore_api.c +++ b/src/namestore/namestore_api.c @@ -2,20 +2,18 @@ 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 General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + 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 <http://www.gnu.org/licenses/>. */ /** diff --git a/src/namestore/namestore_api_monitor.c b/src/namestore/namestore_api_monitor.c index 16780ad0c9..6c441d786e 100644 --- a/src/namestore/namestore_api_monitor.c +++ b/src/namestore/namestore_api_monitor.c @@ -2,20 +2,18 @@ This file is part of GNUnet. Copyright (C) 2013, 2016, 2018 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + 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 <http://www.gnu.org/licenses/>. */ /** * @file namestore/namestore_api_monitor.c diff --git a/src/namestore/perf_namestore_api_zone_iteration.c b/src/namestore/perf_namestore_api_zone_iteration.c index 55d6fafa0d..03f53e63bb 100644 --- a/src/namestore/perf_namestore_api_zone_iteration.c +++ b/src/namestore/perf_namestore_api_zone_iteration.c @@ -2,20 +2,18 @@ This file is part of GNUnet. Copyright (C) 2013, 2018 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + 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 <http://www.gnu.org/licenses/>. */ /** * @file namestore/perf_namestore_api_zone_iteration.c @@ -26,6 +24,9 @@ #include "gnunet_namestore_service.h" #include "gnunet_testing_lib.h" #include "namestore.h" +#include "gnunet_dnsparser_lib.h" + +#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT /** * A #BENCHMARK_SIZE of 1000 takes less than a minute on a reasonably @@ -141,7 +142,7 @@ create_record (unsigned int count) rd = GNUNET_malloc (count + sizeof (struct GNUNET_GNSRECORD_Data)); rd->expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us; - rd->record_type = count; + rd->record_type = TEST_RECORD_TYPE; rd->data_size = count; rd->data = (void *) &rd[1]; rd->flags = 0; diff --git a/src/namestore/plugin_namestore_flat.c b/src/namestore/plugin_namestore_flat.c index 95edb9d879..33c48b2449 100644 --- a/src/namestore/plugin_namestore_flat.c +++ b/src/namestore/plugin_namestore_flat.c @@ -2,20 +2,18 @@ * This file is part of GNUnet * Copyright (C) 2009-2015, 2018 GNUnet e.V. * - * GNUnet is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 3, or (at your - * option) any later version. + * 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 - * General Public License for more details. + * Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with GNUnet; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /** diff --git a/src/namestore/plugin_namestore_postgres.c b/src/namestore/plugin_namestore_postgres.c index 09fdd760f6..7c6acc91b1 100644 --- a/src/namestore/plugin_namestore_postgres.c +++ b/src/namestore/plugin_namestore_postgres.c @@ -2,20 +2,18 @@ * This file is part of GNUnet * Copyright (C) 2009-2013, 2016-2018 GNUnet e.V. * - * GNUnet is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 3, or (at your - * option) any later version. + * 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 - * General Public License for more details. + * Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with GNUnet; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /** diff --git a/src/namestore/plugin_namestore_sqlite.c b/src/namestore/plugin_namestore_sqlite.c index 81391ce8a1..6960e5d127 100644 --- a/src/namestore/plugin_namestore_sqlite.c +++ b/src/namestore/plugin_namestore_sqlite.c @@ -2,20 +2,18 @@ * This file is part of GNUnet * Copyright (C) 2009-2017 GNUnet e.V. * - * GNUnet is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 3, or (at your - * option) any later version. + * 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 - * General Public License for more details. + * Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with GNUnet; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /** diff --git a/src/namestore/plugin_rest_namestore.c b/src/namestore/plugin_rest_namestore.c index fd1528a1de..ec44046e0c 100644 --- a/src/namestore/plugin_rest_namestore.c +++ b/src/namestore/plugin_rest_namestore.c @@ -2,20 +2,18 @@ This file is part of GNUnet. Copyright (C) 2012-2015 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + 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 <http://www.gnu.org/licenses/>. */ /** * @author Martin Schanzenbach diff --git a/src/namestore/test_namestore_api_lookup_nick.c b/src/namestore/test_namestore_api_lookup_nick.c index b9ae93bf2b..1a5a09e47d 100644 --- a/src/namestore/test_namestore_api_lookup_nick.c +++ b/src/namestore/test_namestore_api_lookup_nick.c @@ -2,20 +2,18 @@ This file is part of GNUnet. Copyright (C) 2012 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + 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 <http://www.gnu.org/licenses/>. */ /** * @file namestore/test_namestore_api_lookup_nick.c @@ -24,8 +22,9 @@ #include "platform.h" #include "gnunet_namestore_service.h" #include "gnunet_testing_lib.h" +#include "gnunet_dnsparser_lib.h" -#define TEST_RECORD_TYPE 1234 +#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT #define TEST_RECORD_DATALEN 123 diff --git a/src/namestore/test_namestore_api_lookup_private.c b/src/namestore/test_namestore_api_lookup_private.c index 689e73a2e9..024adaa431 100644 --- a/src/namestore/test_namestore_api_lookup_private.c +++ b/src/namestore/test_namestore_api_lookup_private.c @@ -2,20 +2,18 @@ This file is part of GNUnet. Copyright (C) 2012 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + 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 <http://www.gnu.org/licenses/>. */ /** * @file namestore/test_namestore_api_store.c @@ -24,8 +22,9 @@ #include "platform.h" #include "gnunet_namestore_service.h" #include "gnunet_testing_lib.h" +#include "gnunet_dnsparser_lib.h" -#define TEST_RECORD_TYPE 1234 +#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT #define TEST_RECORD_DATALEN 123 diff --git a/src/namestore/test_namestore_api_lookup_public.c b/src/namestore/test_namestore_api_lookup_public.c index 28a68daf9c..63cd7662e2 100644 --- a/src/namestore/test_namestore_api_lookup_public.c +++ b/src/namestore/test_namestore_api_lookup_public.c @@ -2,20 +2,18 @@ This file is part of GNUnet. Copyright (C) 2012 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + 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 <http://www.gnu.org/licenses/>. */ /** * @file namestore/test_namestore_api.c @@ -25,8 +23,9 @@ #include "gnunet_namecache_service.h" #include "gnunet_namestore_service.h" #include "gnunet_testing_lib.h" +#include "gnunet_dnsparser_lib.h" -#define TEST_RECORD_TYPE 1234 +#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT #define TEST_RECORD_DATALEN 123 diff --git a/src/namestore/test_namestore_api_lookup_shadow.c b/src/namestore/test_namestore_api_lookup_shadow.c index 39ce4e564f..ecfd03735a 100644 --- a/src/namestore/test_namestore_api_lookup_shadow.c +++ b/src/namestore/test_namestore_api_lookup_shadow.c @@ -2,20 +2,18 @@ This file is part of GNUnet. Copyright (C) 2012 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + 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 <http://www.gnu.org/licenses/>. */ /** * @file namestore/test_namestore_api_lookup_shadow.c @@ -27,8 +25,9 @@ #include "gnunet_namecache_service.h" #include "gnunet_namestore_service.h" #include "gnunet_testing_lib.h" +#include "gnunet_dnsparser_lib.h" -#define TEST_RECORD_TYPE 1234 +#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT #define TEST_RECORD_DATALEN 123 diff --git a/src/namestore/test_namestore_api_lookup_shadow_filter.c b/src/namestore/test_namestore_api_lookup_shadow_filter.c index 09fd8ce073..b751ff703a 100644 --- a/src/namestore/test_namestore_api_lookup_shadow_filter.c +++ b/src/namestore/test_namestore_api_lookup_shadow_filter.c @@ -2,20 +2,18 @@ This file is part of GNUnet. Copyright (C) 2012 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + 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 <http://www.gnu.org/licenses/>. */ /** * @file namestore/test_namestore_api_lookup_shadow_filter.c @@ -28,9 +26,11 @@ #include "gnunet_namecache_service.h" #include "gnunet_namestore_service.h" #include "gnunet_testing_lib.h" +#include "gnunet_dnsparser_lib.h" + +#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT #define TEST_NAME "dummy.dummy.gnunet" -#define TEST_RECORD_TYPE 1234 #define TEST_RECORD_DATALEN 123 #define TEST_RECORD_DATA 'a' #define TEST_SHADOW_RECORD_DATA 'b' diff --git a/src/namestore/test_namestore_api_monitoring.c b/src/namestore/test_namestore_api_monitoring.c index de202d5355..1051e3248d 100644 --- a/src/namestore/test_namestore_api_monitoring.c +++ b/src/namestore/test_namestore_api_monitoring.c @@ -2,20 +2,18 @@ This file is part of GNUnet. Copyright (C) 2013, 2018 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + 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 <http://www.gnu.org/licenses/>. */ /** * @file namestore/test_namestore_api_monitoring.c @@ -25,6 +23,10 @@ #include "gnunet_namestore_service.h" #include "gnunet_testing_lib.h" #include "namestore.h" +#include "gnunet_dnsparser_lib.h" + +#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT + #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 100) @@ -244,14 +246,14 @@ put_cont (void *cls, static struct GNUNET_GNSRECORD_Data * create_record (unsigned int count) { - unsigned int c; - struct GNUNET_GNSRECORD_Data * rd; + struct GNUNET_GNSRECORD_Data *rd; - rd = GNUNET_malloc (count * sizeof (struct GNUNET_GNSRECORD_Data)); - for (c = 0; c < count; c++) + rd = GNUNET_new_array (count, + struct GNUNET_GNSRECORD_Data); + for (unsigned int c = 0; c < count; c++) { rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us; - rd[c].record_type = 1111; + rd[c].record_type = TEST_RECORD_TYPE; rd[c].data_size = 50; rd[c].data = GNUNET_malloc(50); rd[c].flags = 0; diff --git a/src/namestore/test_namestore_api_monitoring_existing.c b/src/namestore/test_namestore_api_monitoring_existing.c index 449b36d65d..9c8ddf7ade 100644 --- a/src/namestore/test_namestore_api_monitoring_existing.c +++ b/src/namestore/test_namestore_api_monitoring_existing.c @@ -2,20 +2,18 @@ This file is part of GNUnet. Copyright (C) 2013, 2018 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + 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 <http://www.gnu.org/licenses/>. */ /** * @file namestore/test_namestore_api_monitoring_existing.c @@ -25,6 +23,9 @@ #include "gnunet_namestore_service.h" #include "gnunet_testing_lib.h" #include "namestore.h" +#include "gnunet_dnsparser_lib.h" + +#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) @@ -292,7 +293,7 @@ create_record (unsigned int count) for (unsigned int c = 0; c < count; c++) { rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us; - rd[c].record_type = 1111; + rd[c].record_type = TEST_RECORD_TYPE; rd[c].data_size = 50; rd[c].data = GNUNET_malloc(50); rd[c].flags = 0; diff --git a/src/namestore/test_namestore_api_remove.c b/src/namestore/test_namestore_api_remove.c index c9e2802bd7..7d993d4d94 100644 --- a/src/namestore/test_namestore_api_remove.c +++ b/src/namestore/test_namestore_api_remove.c @@ -2,20 +2,18 @@ This file is part of GNUnet. Copyright (C) 2013 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + 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 <http://www.gnu.org/licenses/>. */ /** * @file namestore/test_namestore_api.c @@ -24,8 +22,9 @@ #include "platform.h" #include "gnunet_namestore_service.h" #include "gnunet_testing_lib.h" +#include "gnunet_dnsparser_lib.h" -#define TEST_RECORD_TYPE 1234 +#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT #define TEST_RECORD_DATALEN 123 diff --git a/src/namestore/test_namestore_api_remove_not_existing_record.c b/src/namestore/test_namestore_api_remove_not_existing_record.c index d0438a7e13..a5bd6c8c2e 100644 --- a/src/namestore/test_namestore_api_remove_not_existing_record.c +++ b/src/namestore/test_namestore_api_remove_not_existing_record.c @@ -2,20 +2,18 @@ This file is part of GNUnet. Copyright (C) 2013 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + 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 <http://www.gnu.org/licenses/>. */ /** * @file namestore/test_namestore_api_remove_not_existing_record.c diff --git a/src/namestore/test_namestore_api_store.c b/src/namestore/test_namestore_api_store.c index 4abcfa4d33..61b5347817 100644 --- a/src/namestore/test_namestore_api_store.c +++ b/src/namestore/test_namestore_api_store.c @@ -2,20 +2,18 @@ This file is part of GNUnet. Copyright (C) 2012 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + 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 <http://www.gnu.org/licenses/>. */ /** * @file namestore/test_namestore_api_store.c @@ -24,8 +22,9 @@ #include "platform.h" #include "gnunet_namestore_service.h" #include "gnunet_testing_lib.h" +#include "gnunet_dnsparser_lib.h" -#define TEST_RECORD_TYPE 1234 +#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT #define TEST_RECORD_DATALEN 123 diff --git a/src/namestore/test_namestore_api_store_update.c b/src/namestore/test_namestore_api_store_update.c index 7b13cd9c58..bd62fdd4c0 100644 --- a/src/namestore/test_namestore_api_store_update.c +++ b/src/namestore/test_namestore_api_store_update.c @@ -2,20 +2,18 @@ This file is part of GNUnet. Copyright (C) 2012, 2013, 2018 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + 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 <http://www.gnu.org/licenses/>. */ /** * @file namestore/test_namestore_api_store_update.c @@ -27,15 +25,14 @@ #include "gnunet_namecache_service.h" #include "gnunet_namestore_service.h" #include "gnunet_testing_lib.h" +#include "gnunet_dnsparser_lib.h" -#define TEST_RECORD_TYPE 1234 +#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT #define TEST_RECORD_DATALEN 123 #define TEST_RECORD_DATA 'a' -#define TEST_RECORD_TYPE2 4321 - #define TEST_RECORD_DATALEN2 234 #define TEST_RECORD_DATA2 'b' @@ -149,7 +146,7 @@ rd_decrypt_cb (void *cls, rd_new.flags = GNUNET_GNSRECORD_RF_NONE; rd_new.expiration_time = GNUNET_TIME_absolute_get().abs_value_us + 1000000000; - rd_new.record_type = TEST_RECORD_TYPE2; + rd_new.record_type = TEST_RECORD_TYPE; rd_new.data_size = TEST_RECORD_DATALEN2; rd_new.data = GNUNET_malloc (TEST_RECORD_DATALEN2); memset ((char *) rd_new.data, @@ -172,7 +169,7 @@ rd_decrypt_cb (void *cls, memset (rd_cmp_data, TEST_RECORD_DATA2, TEST_RECORD_DATALEN2); - GNUNET_assert (TEST_RECORD_TYPE2 == rd[0].record_type); + GNUNET_assert (TEST_RECORD_TYPE == rd[0].record_type); GNUNET_assert (TEST_RECORD_DATALEN2 == rd[0].data_size); GNUNET_assert (0 == memcmp (&rd_cmp_data, rd[0].data, diff --git a/src/namestore/test_namestore_api_zone_iteration.c b/src/namestore/test_namestore_api_zone_iteration.c index 68c3de9b83..af263c816b 100644 --- a/src/namestore/test_namestore_api_zone_iteration.c +++ b/src/namestore/test_namestore_api_zone_iteration.c @@ -2,20 +2,18 @@ This file is part of GNUnet. Copyright (C) 2013, 2018 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + 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 <http://www.gnu.org/licenses/>. */ /** * @file namestore/test_namestore_api_zone_iteration.c @@ -25,6 +23,9 @@ #include "gnunet_namestore_service.h" #include "gnunet_testing_lib.h" #include "namestore.h" +#include "gnunet_dnsparser_lib.h" + +#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 100) @@ -322,7 +323,7 @@ create_record (unsigned int count) for (unsigned int c = 0; c < count; c++) { rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us; - rd[c].record_type = 1111; + rd[c].record_type = TEST_RECORD_TYPE; rd[c].data_size = 50; rd[c].data = GNUNET_malloc(50); rd[c].flags = 0; diff --git a/src/namestore/test_namestore_api_zone_iteration_nick.c b/src/namestore/test_namestore_api_zone_iteration_nick.c index d950b7e693..efaadff559 100644 --- a/src/namestore/test_namestore_api_zone_iteration_nick.c +++ b/src/namestore/test_namestore_api_zone_iteration_nick.c @@ -2,20 +2,18 @@ This file is part of GNUnet. Copyright (C) 2013 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + 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 <http://www.gnu.org/licenses/>. */ /** * @file namestore/test_namestore_api_zone_iteration.c @@ -25,6 +23,9 @@ #include "gnunet_namestore_service.h" #include "gnunet_testing_lib.h" #include "namestore.h" +#include "gnunet_dnsparser_lib.h" + +#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT #define ZONE_NICK_1 "nick1" #define ZONE_NICK_2 "nick2" @@ -322,7 +323,7 @@ create_record (unsigned int count) for (unsigned int c = 0; c < count; c++) { rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us; - rd[c].record_type = 1111; + rd[c].record_type = TEST_RECORD_TYPE; rd[c].data_size = 50; rd[c].data = GNUNET_malloc(50); rd[c].flags = 0; diff --git a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c index 0b137cc629..303a7648a4 100644 --- a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c +++ b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c @@ -2,20 +2,18 @@ This file is part of GNUnet. Copyright (C) 2013 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + 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 <http://www.gnu.org/licenses/>. */ /** * @file namestore/test_namestore_api_zone_iteration_specific_zone.c @@ -26,6 +24,9 @@ #include "gnunet_namestore_service.h" #include "gnunet_testing_lib.h" #include "namestore.h" +#include "gnunet_dnsparser_lib.h" + +#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 100) @@ -299,7 +300,7 @@ create_record (unsigned int count) for (unsigned int c = 0; c < count; c++) { rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us; - rd[c].record_type = 1111; + rd[c].record_type = TEST_RECORD_TYPE; rd[c].data_size = 50; rd[c].data = GNUNET_malloc(50); rd[c].flags = 0; diff --git a/src/namestore/test_namestore_api_zone_iteration_stop.c b/src/namestore/test_namestore_api_zone_iteration_stop.c index c7358fc6ea..eb7ad4305c 100644 --- a/src/namestore/test_namestore_api_zone_iteration_stop.c +++ b/src/namestore/test_namestore_api_zone_iteration_stop.c @@ -2,20 +2,18 @@ This file is part of GNUnet. Copyright (C) 2009 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + 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 <http://www.gnu.org/licenses/>. */ /** * @file namestore/test_namestore_api_zone_iteration.c @@ -25,7 +23,9 @@ #include "gnunet_namestore_service.h" #include "gnunet_testing_lib.h" #include "namestore.h" +#include "gnunet_dnsparser_lib.h" +#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 100) #define WAIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 2) @@ -349,14 +349,14 @@ put_cont (void *cls, int32_t success, const char *emsg) static struct GNUNET_GNSRECORD_Data * create_record (unsigned int count) { - unsigned int c; - struct GNUNET_GNSRECORD_Data * rd; + struct GNUNET_GNSRECORD_Data *rd; - rd = GNUNET_malloc (count * sizeof (struct GNUNET_GNSRECORD_Data)); - for (c = 0; c < count; c++) + rd = GNUNET_new_array (count, + struct GNUNET_GNSRECORD_Data); + for (unsigned int c = 0; c < count; c++) { rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us; - rd[c].record_type = 1111; + rd[c].record_type = TEST_RECORD_TYPE; rd[c].data_size = 50; rd[c].data = GNUNET_malloc(50); rd[c].flags = 0; diff --git a/src/namestore/test_namestore_api_zone_to_name.c b/src/namestore/test_namestore_api_zone_to_name.c index 292d8f7019..e689455b0b 100644 --- a/src/namestore/test_namestore_api_zone_to_name.c +++ b/src/namestore/test_namestore_api_zone_to_name.c @@ -2,20 +2,18 @@ This file is part of GNUnet. Copyright (C) 2009 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + 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 <http://www.gnu.org/licenses/>. */ /** * @file namestore/test_namestore_api_zone_to_name.c @@ -25,10 +23,11 @@ #include "gnunet_namestore_service.h" #include "gnunet_testing_lib.h" #include "namestore.h" +#include "gnunet_dnsparser_lib.h" -#define RECORDS 5 +#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT -#define TEST_RECORD_TYPE 1234 +#define RECORDS 5 #define TEST_RECORD_DATALEN 123 diff --git a/src/namestore/test_plugin_namestore.c b/src/namestore/test_plugin_namestore.c index 8732acbcb2..9d21ad16a4 100644 --- a/src/namestore/test_plugin_namestore.c +++ b/src/namestore/test_plugin_namestore.c @@ -2,20 +2,18 @@ This file is part of GNUnet. Copyright (C) 2012 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + 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 <http://www.gnu.org/licenses/>. */ /* * @file namestore/test_plugin_namestore.c @@ -26,7 +24,9 @@ #include "gnunet_util_lib.h" #include "gnunet_namestore_plugin.h" #include "gnunet_testing_lib.h" +#include "gnunet_dnsparser_lib.h" +#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT static int ok; @@ -110,7 +110,7 @@ test_record (void *cls, { GNUNET_assert (rd[i].data_size == id % 10); GNUNET_assert (0 == memcmp ("Hello World", rd[i].data, id % 10)); - GNUNET_assert (rd[i].record_type == 1 + (id % 13)); + GNUNET_assert (rd[i].record_type == TEST_RECORD_TYPE); GNUNET_assert (rd[i].flags == 0); } memset (&tzone_private_key, @@ -154,7 +154,7 @@ put_record (struct GNUNET_NAMESTORE_PluginFunctions *nsp, rd[i].data = "Hello World"; rd[i].data_size = id % 10; rd[i].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES).abs_value_us; - rd[i].record_type = 1 + (id % 13); + rd[i].record_type = TEST_RECORD_TYPE; rd[i].flags = 0; } memset (&zone_private_key, (id % 241), sizeof (zone_private_key)); |