aboutsummaryrefslogtreecommitdiff
path: root/src/util/mq.c
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 /src/util/mq.c
parente13828526819ba1b37877950b8cef75a4c7787b4 (diff)
downloadgnunet-90e29258a5339d232ea1b22f3f83d61701b52358.tar.gz
gnunet-90e29258a5339d232ea1b22f3f83d61701b52358.zip
changes for AGPL handling
Diffstat (limited to 'src/util/mq.c')
-rw-r--r--src/util/mq.c37
1 files changed, 37 insertions, 0 deletions
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.