aboutsummaryrefslogtreecommitdiff
path: root/src/util/mq.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-06-24 11:54:36 +0000
committerChristian Grothoff <christian@grothoff.org>2016-06-24 11:54:36 +0000
commiteafc8188ef6584f77dc4dbc6827210f384986e1a (patch)
tree501f87ddd224b0cbd5aaf9008b57005b129cac24 /src/util/mq.c
parent2e95a6961bf57170b215ab28e50dbf2376d46747 (diff)
downloadgnunet-eafc8188ef6584f77dc4dbc6827210f384986e1a.tar.gz
gnunet-eafc8188ef6584f77dc4dbc6827210f384986e1a.zip
update peerinfo API to use MQ
Diffstat (limited to 'src/util/mq.c')
-rw-r--r--src/util/mq.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/util/mq.c b/src/util/mq.c
index b46e36ddf..fb679c18d 100644
--- a/src/util/mq.c
+++ b/src/util/mq.c
@@ -468,7 +468,28 @@ GNUNET_MQ_msg_ (struct GNUNET_MessageHeader **mhp,
468 468
469 469
470/** 470/**
471 * Implementation of the GNUNET_MQ_msg_nested_mh macro. 471 * Create a new envelope by copying an existing message.
472 *
473 * @param hdr header of the message to copy
474 * @return envelope containing @a hdr
475 */
476struct GNUNET_MQ_Envelope *
477GNUNET_MQ_msg_copy (const struct GNUNET_MessageHeader *hdr)
478{
479 struct GNUNET_MQ_Envelope *mqm;
480 uint16_t size = ntohs (hdr->size);
481
482 mqm = GNUNET_malloc (sizeof (*mqm) + size);
483 mqm->mh = (struct GNUNET_MessageHeader *) &mqm[1];
484 memcpy (mqm->mh,
485 hdr,
486 size);
487 return mqm;
488}
489
490
491/**
492 * Implementation of the #GNUNET_MQ_msg_nested_mh macro.
472 * 493 *
473 * @param mhp pointer to the message header pointer that will be changed to allocate at 494 * @param mhp pointer to the message header pointer that will be changed to allocate at
474 * the newly allocated space for the message. 495 * the newly allocated space for the message.