aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-06-06 00:32:36 +0200
committerChristian Grothoff <christian@grothoff.org>2018-06-06 00:32:36 +0200
commit90e29258a5339d232ea1b22f3f83d61701b52358 (patch)
tree1dcdab00bbbafdc3a30c82c390f66af0d82ecba2
parente13828526819ba1b37877950b8cef75a4c7787b4 (diff)
downloadgnunet-90e29258a5339d232ea1b22f3f83d61701b52358.tar.gz
gnunet-90e29258a5339d232ea1b22f3f83d61701b52358.zip
changes for AGPL handling
-rw-r--r--README16
-rw-r--r--src/include/gnunet_mq_lib.h18
-rw-r--r--src/include/gnunet_protocols.h17
-rw-r--r--src/include/gnunet_util_lib.h8
-rw-r--r--src/util/mq.c37
-rw-r--r--src/util/service.c40
6 files changed, 121 insertions, 15 deletions
diff --git a/README b/README
index 80a87d274..61c54b4f4 100644
--- a/README
+++ b/README
@@ -15,8 +15,11 @@ GNU package (http://www.gnu.org/).
15This is an ALPHA release. There are known and significant bugs as 15This is an ALPHA release. There are known and significant bugs as
16well as many missing features in this release. 16well as many missing features in this release.
17 17
18GNUnet is free software released under the GNU General Public License 18GNUnet is free software released under the GNU Affero General Public
19(v3 or later). For details see the COPYING file in this directory. 19License (v3 or later). For details see the COPYING file in this
20directory. If you fork this software, you MUST adjust GNUNET_AGPL_URL
21in src/include/gnunet_util_lib.h to point to the source code of your
22fork!
20 23
21Additional documentation about GNUnet can be found at 24Additional documentation about GNUnet can be found at
22https://gnunet.org/ and in the doc/ folder. 25https://gnunet.org/ and in the doc/ folder.
@@ -25,16 +28,9 @@ https://gnunet.org/ and in the doc/ folder.
25Dependencies: 28Dependencies:
26============= 29=============
27 30
28Please note that for many of its dependencies GNUnet requires very
29recent versions of the libraries which are often NOT to be found in
30stable distributions in 2014. While using older packages may in some
31cases on some operating systems may seem to work in some limited
32fashion, we are in many cases aware of serious problems with older
33packages. Hence please make sure to use the versions listed below.
34
35These are the direct dependencies for running GNUnet: 31These are the direct dependencies for running GNUnet:
36 32
37- libmicrohttpd >= 0.9.42 33- libmicrohttpd >= 0.9.52
38- libgcrypt >= 1.6 34- libgcrypt >= 1.6
39- libgnurl >= 7.35.0 (available from https://gnunet.org/gnurl) 35- libgnurl >= 7.35.0 (available from https://gnunet.org/gnurl)
40- libunistring >= 0.9.2 36- libunistring >= 0.9.2
diff --git a/src/include/gnunet_mq_lib.h b/src/include/gnunet_mq_lib.h
index fe699c48f..daf1869fb 100644
--- a/src/include/gnunet_mq_lib.h
+++ b/src/include/gnunet_mq_lib.h
@@ -340,6 +340,24 @@ GNUNET_MQ_copy_handlers (const struct GNUNET_MQ_MessageHandler *handlers);
340 340
341 341
342/** 342/**
343 * Copy an array of handlers, appending AGPL handler.
344 *
345 * Useful if the array has been delared in local memory and needs to be
346 * persisted for future use.
347 *
348 * @param handlers Array of handlers to be copied. Can be NULL (nothing done).
349 * @param agpl_handler function to call for AGPL handling
350 * @param agpl_cls closure for @a agpl_handler
351 * @return A newly allocated array of handlers.
352 * Needs to be freed with #GNUNET_free.
353 */
354struct GNUNET_MQ_MessageHandler *
355GNUNET_MQ_copy_handlers2 (const struct GNUNET_MQ_MessageHandler *handlers,
356 GNUNET_MQ_MessageCallback agpl_handler,
357 void *agpl_cls);
358
359
360/**
343 * Count the handlers in a handler array. 361 * Count the handlers in a handler array.
344 * 362 *
345 * @param handlers Array of handlers to be counted. 363 * @param handlers Array of handlers to be counted.
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index 7040f2cbf..60dbeeb78 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2001--2015 GNUnet e.V. 3 Copyright (C) 2001--2018 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -86,6 +86,21 @@ extern "C"
86#define GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE 5 86#define GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE 5
87 87
88/******************************************************************************* 88/*******************************************************************************
89 * AGPL source code download
90 * *****************************************************************************/
91
92/**
93 * Message to request source code link.
94 */
95#define GNUNET_MESSAGE_TYPE_REQUEST_AGPL 6
96
97/**
98 * Source code link.
99 */
100#define GNUNET_MESSAGE_TYPE_RESPONSE_AGPL 7
101
102
103/*******************************************************************************
89 * ARM message types 104 * ARM message types
90 ******************************************************************************/ 105 ******************************************************************************/
91 106
diff --git a/src/include/gnunet_util_lib.h b/src/include/gnunet_util_lib.h
index a9bd6c33f..e82e6caee 100644
--- a/src/include/gnunet_util_lib.h
+++ b/src/include/gnunet_util_lib.h
@@ -52,6 +52,14 @@ extern "C"
52 */ 52 */
53#define GNUNET_MIN_MESSAGE_SIZE sizeof (struct GNUNET_MessageHeader) 53#define GNUNET_MIN_MESSAGE_SIZE sizeof (struct GNUNET_MessageHeader)
54 54
55/**
56 * NOTE: You MUST adjust this URL to point to the location of a
57 * publicly accessible repository (or TGZ) containing the sources of
58 * THIS release. Otherwise, you are violating the Affero GPL if you make
59 * this service available to anyone but yourself.
60 */
61#define GNUNET_AGPL_URL "https://gnunet.org/git/gnunet.git#" PACKAGE_VERSION;
62
55 63
56#include "gnunet_crypto_lib.h" 64#include "gnunet_crypto_lib.h"
57#include "gnunet_bandwidth_lib.h" 65#include "gnunet_bandwidth_lib.h"
diff --git a/src/util/mq.c b/src/util/mq.c
index 81a42e0c6..bf8f95790 100644
--- a/src/util/mq.c
+++ b/src/util/mq.c
@@ -1216,6 +1216,43 @@ GNUNET_MQ_copy_handlers (const struct GNUNET_MQ_MessageHandler *handlers)
1216 1216
1217 1217
1218/** 1218/**
1219 * Copy an array of handlers, appending AGPL handler.
1220 *
1221 * Useful if the array has been delared in local memory and needs to be
1222 * persisted for future use.
1223 *
1224 * @param handlers Array of handlers to be copied. Can be NULL (nothing done).
1225 * @param agpl_handler function to call for AGPL handling
1226 * @param agpl_cls closure for @a agpl_handler
1227 * @return A newly allocated array of handlers.
1228 * Needs to be freed with #GNUNET_free.
1229 */
1230struct GNUNET_MQ_MessageHandler *
1231GNUNET_MQ_copy_handlers2 (const struct GNUNET_MQ_MessageHandler *handlers,
1232 GNUNET_MQ_MessageCallback agpl_handler,
1233 void *agpl_cls)
1234{
1235 struct GNUNET_MQ_MessageHandler *copy;
1236 unsigned int count;
1237
1238 if (NULL == handlers)
1239 return NULL;
1240 count = GNUNET_MQ_count_handlers (handlers);
1241 copy = GNUNET_new_array (count + 2,
1242 struct GNUNET_MQ_MessageHandler);
1243 GNUNET_memcpy (copy,
1244 handlers,
1245 count * sizeof (struct GNUNET_MQ_MessageHandler));
1246 copy[count].mv = NULL;
1247 copy[count].cb = agpl_handler;
1248 copy[count].cls = agpl_cls;
1249 copy[count].type = GNUNET_MESSAGE_TYPE_REQUEST_AGPL;
1250 copy[count].expected_size = sizeof (struct GNUNET_MessageHeader);
1251 return copy;
1252}
1253
1254
1255/**
1219 * Count the handlers in a handler array. 1256 * Count the handlers in a handler array.
1220 * 1257 *
1221 * @param handlers Array of handlers to be counted. 1258 * @param handlers Array of handlers to be counted.
diff --git a/src/util/service.c b/src/util/service.c
index 1156093f4..ae1809950 100644
--- a/src/util/service.c
+++ b/src/util/service.c
@@ -1572,6 +1572,36 @@ teardown_service (struct GNUNET_SERVICE_Handle *sh)
1572 1572
1573 1573
1574/** 1574/**
1575 * Function to return link to AGPL source upon request.
1576 *
1577 * @param cls closure with the identification of the client
1578 * @param msg AGPL request
1579 */
1580static void
1581return_agpl (void *cls,
1582 const struct GNUNET_MessageHeader *msg)
1583{
1584 struct GNUNET_SERVICE_Client *client = cls;
1585 struct GNUNET_MQ_Handle *mq;
1586 struct GNUNET_MQ_Envelope *env;
1587 struct GNUNET_MessageHeader *res;
1588 size_t slen;
1589
1590 slen = strlen (GNUNET_AGPL_URL) + 1;
1591 env = GNUNET_MQ_msg_extra (res,
1592 GNUNET_MESSAGE_TYPE_RESPONSE_AGPL,
1593 slen);
1594 memcpy (&res[1],
1595 GNUNET_AGPL_URL,
1596 slen);
1597 mq = GNUNET_SERVICE_client_get_mq (client);
1598 GNUNET_MQ_send (mq,
1599 env);
1600 GNUNET_SERVICE_client_continue (client);
1601}
1602
1603
1604/**
1575 * Low-level function to start a service if the scheduler 1605 * Low-level function to start a service if the scheduler
1576 * is already running. Should only be used directly in 1606 * is already running. Should only be used directly in
1577 * special cases. 1607 * special cases.
@@ -1623,7 +1653,9 @@ GNUNET_SERVICE_start (const char *service_name,
1623 sh->connect_cb = connect_cb; 1653 sh->connect_cb = connect_cb;
1624 sh->disconnect_cb = disconnect_cb; 1654 sh->disconnect_cb = disconnect_cb;
1625 sh->cb_cls = cls; 1655 sh->cb_cls = cls;
1626 sh->handlers = GNUNET_MQ_copy_handlers (handlers); 1656 sh->handlers = GNUNET_MQ_copy_handlers2 (handlers,
1657 &return_agpl,
1658 NULL);
1627 if (GNUNET_OK != setup_service (sh)) 1659 if (GNUNET_OK != setup_service (sh))
1628 { 1660 {
1629 GNUNET_free_non_null (sh->handlers); 1661 GNUNET_free_non_null (sh->handlers);
@@ -1723,9 +1755,9 @@ GNUNET_SERVICE_run_ (int argc,
1723 struct GNUNET_GETOPT_CommandLineOption service_options[] = { 1755 struct GNUNET_GETOPT_CommandLineOption service_options[] = {
1724 GNUNET_GETOPT_option_cfgfile (&opt_cfg_filename), 1756 GNUNET_GETOPT_option_cfgfile (&opt_cfg_filename),
1725 GNUNET_GETOPT_option_flag ('d', 1757 GNUNET_GETOPT_option_flag ('d',
1726 "daemonize", 1758 "daemonize",
1727 gettext_noop ("do daemonize (detach from terminal)"), 1759 gettext_noop ("do daemonize (detach from terminal)"),
1728 &do_daemonize), 1760 &do_daemonize),
1729 GNUNET_GETOPT_option_help (NULL), 1761 GNUNET_GETOPT_option_help (NULL),
1730 GNUNET_GETOPT_option_loglevel (&loglev), 1762 GNUNET_GETOPT_option_loglevel (&loglev),
1731 GNUNET_GETOPT_option_logfile (&logfile), 1763 GNUNET_GETOPT_option_logfile (&logfile),