aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cadet/cadet_api.c31
-rw-r--r--src/include/gnunet_os_lib.h8
-rw-r--r--src/include/gnunet_protocols.h30
-rw-r--r--src/util/os_installation.c1
-rw-r--r--src/util/service.c7
5 files changed, 61 insertions, 16 deletions
diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c
index 68bd4c290..3a75266b7 100644
--- a/src/cadet/cadet_api.c
+++ b/src/cadet/cadet_api.c
@@ -995,6 +995,32 @@ GNUNET_CADET_connect (const struct GNUNET_CONFIGURATION_Handle *cfg)
995 995
996 996
997/** 997/**
998 * Function to return link to AGPL source upon request.
999 *
1000 * @param cls closure with the identification of the client
1001 * @param msg AGPL request
1002 */
1003static void
1004return_agpl (void *cls, const struct GNUNET_MessageHeader *msg)
1005{
1006 struct GNUNET_SERVICE_Client *client = cls;
1007 struct GNUNET_MQ_Handle *mq;
1008 struct GNUNET_MQ_Envelope *env;
1009 struct GNUNET_MessageHeader *res;
1010 size_t slen;
1011 const struct GNUNET_OS_ProjectData *pd = GNUNET_OS_project_data_get ();
1012
1013 (void) msg;
1014 slen = strlen (pd->agpl_url) + 1;
1015 env = GNUNET_MQ_msg_extra (res, GNUNET_MESSAGE_TYPE_RESPONSE_AGPL, slen);
1016 memcpy (&res[1], GNUNET_AGPL_URL, slen);
1017 mq = GNUNET_SERVICE_client_get_mq (client);
1018 GNUNET_MQ_send (mq, env);
1019 GNUNET_SERVICE_client_continue (client);
1020}
1021
1022
1023/**
998 * Open a port to receive incomming MQ-based channels. 1024 * Open a port to receive incomming MQ-based channels.
999 * 1025 *
1000 * @param h CADET handle. 1026 * @param h CADET handle.
@@ -1016,6 +1042,7 @@ GNUNET_CADET_open_port (struct GNUNET_CADET_Handle *h,
1016 const struct GNUNET_MQ_MessageHandler *handlers) 1042 const struct GNUNET_MQ_MessageHandler *handlers)
1017{ 1043{
1018 struct GNUNET_CADET_Port *p; 1044 struct GNUNET_CADET_Port *p;
1045 const struct GNUNET_OS_ProjectData *pd = GNUNET_OS_project_data_get ();
1019 1046
1020 GNUNET_assert (NULL != connects); 1047 GNUNET_assert (NULL != connects);
1021 GNUNET_assert (NULL != disconnects); 1048 GNUNET_assert (NULL != disconnects);
@@ -1039,7 +1066,9 @@ GNUNET_CADET_open_port (struct GNUNET_CADET_Handle *h,
1039 p->cls = connects_cls; 1066 p->cls = connects_cls;
1040 p->window_changes = window_changes; 1067 p->window_changes = window_changes;
1041 p->disconnects = disconnects; 1068 p->disconnects = disconnects;
1042 p->handlers = GNUNET_MQ_copy_handlers (handlers); 1069 p->handlers = (NULL == pd->agpl_url)
1070 ? GNUNET_MQ_copy_handlers (handlers)
1071 : GNUNET_MQ_copy_handlers2 (handlers, &return_agpl, NULL);
1043 1072
1044 GNUNET_assert (GNUNET_OK == open_port_cb (h, &p->id, p)); 1073 GNUNET_assert (GNUNET_OK == open_port_cb (h, &p->id, p));
1045 return p; 1074 return p;
diff --git a/src/include/gnunet_os_lib.h b/src/include/gnunet_os_lib.h
index a6188c1ca..b583cc493 100644
--- a/src/include/gnunet_os_lib.h
+++ b/src/include/gnunet_os_lib.h
@@ -287,6 +287,14 @@ struct GNUNET_OS_ProjectData
287 * If this field is NULL, the path is automatically inferred. 287 * If this field is NULL, the path is automatically inferred.
288 */ 288 */
289 char *gettext_path; 289 char *gettext_path;
290
291 /**
292 * URL pointing to the source code of the application. Required for AGPL.
293 * Setting this to NULL disables the built-in mechanism, but you must
294 * provide it in some other way. If non-NULL, message type 1 and 2 are
295 * reserved.
296 */
297 char *agpl_url;
290}; 298};
291 299
292 300
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index 3b05fb8bb..282bb53d1 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -50,25 +50,29 @@ extern "C" {
50#endif 50#endif
51 51
52/******************************************************************************* 52/*******************************************************************************
53 * UTIL message types 53* Deprecated
54 ******************************************************************************/ 54* *****************************************************************************/
55 55
56/** 56/**
57 * Test if service is online. 57 * Test if service is online.
58 * 58 *
59 * @deprecated! 59 * @deprecated!
60 */ 60 */
61#define GNUNET_MESSAGE_TYPE_TEST 1 61#define GNUNET_MESSAGE_TYPE_TEST 0
62
63/*******************************************************************************
64* AGPL source code download
65* *****************************************************************************/
62 66
63/** 67/**
64 * Dummy messages for testing / benchmarking. 68 * Message to request source code link.
65 */ 69 */
66#define GNUNET_MESSAGE_TYPE_DUMMY 2 70#define GNUNET_MESSAGE_TYPE_REQUEST_AGPL 1
67 71
68/** 72/**
69 * Another dummy messages for testing / benchmarking. 73 * Source code link.
70 */ 74 */
71#define GNUNET_MESSAGE_TYPE_DUMMY2 3 75#define GNUNET_MESSAGE_TYPE_RESPONSE_AGPL 2
72 76
73/******************************************************************************* 77/*******************************************************************************
74 * RESOLVER message types 78 * RESOLVER message types
@@ -85,18 +89,18 @@ extern "C" {
85#define GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE 5 89#define GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE 5
86 90
87/******************************************************************************* 91/*******************************************************************************
88* AGPL source code download 92 * UTIL message types
89* *****************************************************************************/ 93 ******************************************************************************/
90 94
91/** 95/**
92 * Message to request source code link. 96 * Dummy messages for testing / benchmarking.
93 */ 97 */
94#define GNUNET_MESSAGE_TYPE_REQUEST_AGPL 6 98#define GNUNET_MESSAGE_TYPE_DUMMY 6
95 99
96/** 100/**
97 * Source code link. 101 * Another dummy messages for testing / benchmarking.
98 */ 102 */
99#define GNUNET_MESSAGE_TYPE_RESPONSE_AGPL 7 103#define GNUNET_MESSAGE_TYPE_DUMMY2 7
100 104
101 105
102/******************************************************************************* 106/*******************************************************************************
diff --git a/src/util/os_installation.c b/src/util/os_installation.c
index dcd31dc2c..714df6957 100644
--- a/src/util/os_installation.c
+++ b/src/util/os_installation.c
@@ -70,6 +70,7 @@ static const struct GNUNET_OS_ProjectData default_pd = {
70 .is_gnu = 1, 70 .is_gnu = 1,
71 .gettext_domain = PACKAGE, 71 .gettext_domain = PACKAGE,
72 .gettext_path = NULL, 72 .gettext_path = NULL,
73 .agpl_url = GNUNET_AGPL_URL,
73}; 74};
74 75
75/** 76/**
diff --git a/src/util/service.c b/src/util/service.c
index 9dc14eba9..ea078b19b 100644
--- a/src/util/service.c
+++ b/src/util/service.c
@@ -1823,9 +1823,10 @@ return_agpl (void *cls, const struct GNUNET_MessageHeader *msg)
1823 struct GNUNET_MQ_Envelope *env; 1823 struct GNUNET_MQ_Envelope *env;
1824 struct GNUNET_MessageHeader *res; 1824 struct GNUNET_MessageHeader *res;
1825 size_t slen; 1825 size_t slen;
1826 const struct GNUNET_OS_ProjectData *pd = GNUNET_OS_project_data_get ();
1826 1827
1827 (void) msg; 1828 (void) msg;
1828 slen = strlen (GNUNET_AGPL_URL) + 1; 1829 slen = strlen (pd->agpl_url) + 1;
1829 env = GNUNET_MQ_msg_extra (res, GNUNET_MESSAGE_TYPE_RESPONSE_AGPL, slen); 1830 env = GNUNET_MQ_msg_extra (res, GNUNET_MESSAGE_TYPE_RESPONSE_AGPL, slen);
1830 memcpy (&res[1], GNUNET_AGPL_URL, slen); 1831 memcpy (&res[1], GNUNET_AGPL_URL, slen);
1831 mq = GNUNET_SERVICE_client_get_mq (client); 1832 mq = GNUNET_SERVICE_client_get_mq (client);
@@ -2019,7 +2020,9 @@ GNUNET_SERVICE_run_ (int argc,
2019 sh.connect_cb = connect_cb; 2020 sh.connect_cb = connect_cb;
2020 sh.disconnect_cb = disconnect_cb; 2021 sh.disconnect_cb = disconnect_cb;
2021 sh.cb_cls = cls; 2022 sh.cb_cls = cls;
2022 sh.handlers = GNUNET_MQ_copy_handlers (handlers); 2023 sh.handlers = (NULL == pd->agpl_url)
2024 ? GNUNET_MQ_copy_handlers (handlers)
2025 : GNUNET_MQ_copy_handlers2 (handlers, &return_agpl, NULL);
2023 sh.service_name = service_name; 2026 sh.service_name = service_name;
2024 sh.ret = 0; 2027 sh.ret = 0;
2025 /* setup subsystems */ 2028 /* setup subsystems */