aboutsummaryrefslogtreecommitdiff
path: root/src/psycutil
diff options
context:
space:
mode:
authorGabor X Toth <*@tg-x.net>2016-01-26 20:37:09 +0000
committerGabor X Toth <*@tg-x.net>2016-01-26 20:37:09 +0000
commit0841876fb932574a6c9ebaf2adbb64f1ffc06899 (patch)
tree568f136b839efc1ee71099cbab57f84c2428aed5 /src/psycutil
parent0d2019bb407ef15f2376963b43169e145a338219 (diff)
psycutil: slicer callback args
Diffstat (limited to 'src/psycutil')
-rw-r--r--src/psycutil/psyc_message.c4
-rw-r--r--src/psycutil/psyc_slicer.c30
2 files changed, 26 insertions, 8 deletions
diff --git a/src/psycutil/psyc_message.c b/src/psycutil/psyc_message.c
index 62a5b8f142..f75a809efa 100644
--- a/src/psycutil/psyc_message.c
+++ b/src/psycutil/psyc_message.c
@@ -1101,7 +1101,7 @@ GNUNET_PSYC_receive_message (struct GNUNET_PSYC_ReceiveHandle *recv,
if (NULL != recv->message_part_cb)
recv->message_part_cb (recv->cb_cls, &recv->slave_pub_key,
recv->message_id, recv->flags,
- 0, // FIXME: data_offset
+ GNUNET_ntohll (msg->fragment_offset),
pmsg);
switch (ptype)
@@ -1181,7 +1181,7 @@ struct ParseMessageClosure
static void
parse_message_part_cb (void *cls,
const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_pub_key,
- uint64_t message_id, uint32_t flags, uint64_t data_offset,
+ uint64_t message_id, uint32_t flags, uint64_t fragment_offset,
const struct GNUNET_MessageHeader *msg)
{
struct ParseMessageClosure *pmc = cls;
diff --git a/src/psycutil/psyc_slicer.c b/src/psycutil/psyc_slicer.c
index 7586b39707..735eb1511f 100644
--- a/src/psycutil/psyc_slicer.c
+++ b/src/psycutil/psyc_slicer.c
@@ -65,6 +65,16 @@ struct GNUNET_PSYC_Slicer
uint64_t message_id;
/**
+ * Fragment offset of currently being received message.
+ */
+ uint64_t fragment_offset;
+
+ /**
+ * Flags of currently being received message.
+ */
+ uint32_t flags;
+
+ /**
* Method name of currently being received message.
*/
char *method_name;
@@ -174,6 +184,7 @@ slicer_method_handler_notify (void *cls, const struct GNUNET_HashCode *key,
struct GNUNET_PSYC_MessageMethod *
meth = (struct GNUNET_PSYC_MessageMethod *) msg;
cbs->method_cb (cbs->cls, meth, slicer->message_id,
+ slicer->flags, slicer->fragment_offset,
ntohl (meth->flags),
&slicer->nym_pub_key,
slicer->method_name);
@@ -187,6 +198,7 @@ slicer_method_handler_notify (void *cls, const struct GNUNET_HashCode *key,
struct GNUNET_PSYC_MessageModifier *
mod = (struct GNUNET_PSYC_MessageModifier *) msg;
cbs->modifier_cb (cbs->cls, &mod->header, slicer->message_id,
+ slicer->flags, slicer->fragment_offset,
mod->oper, (const char *) &mod[1],
(const void *) &mod[1] + ntohs (mod->name_size),
ntohs (mod->header.size) - sizeof (*mod) - ntohs (mod->name_size),
@@ -199,6 +211,7 @@ slicer_method_handler_notify (void *cls, const struct GNUNET_HashCode *key,
if (NULL == cbs->modifier_cb)
break;
cbs->modifier_cb (cbs->cls, msg, slicer->message_id,
+ slicer->flags, slicer->fragment_offset,
slicer->mod_oper, slicer->mod_name, &msg[1],
ntohs (msg->size) - sizeof (*msg),
slicer->mod_full_value_size);
@@ -209,22 +222,24 @@ slicer_method_handler_notify (void *cls, const struct GNUNET_HashCode *key,
{
if (NULL == cbs->data_cb)
break;
- uint64_t data_offset = 0; // FIXME
cbs->data_cb (cbs->cls, msg, slicer->message_id,
- data_offset, &msg[1], ntohs (msg->size) - sizeof (*msg));
+ slicer->flags, slicer->fragment_offset,
+ &msg[1], ntohs (msg->size) - sizeof (*msg));
break;
}
case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_END:
if (NULL == cbs->eom_cb)
break;
- cbs->eom_cb (cbs->cls, msg, slicer->message_id, GNUNET_NO);
+ cbs->eom_cb (cbs->cls, msg, slicer->message_id,
+ slicer->flags, slicer->fragment_offset, GNUNET_NO);
break;
case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_CANCEL:
if (NULL == cbs->eom_cb)
break;
- cbs->eom_cb (cbs->cls, msg, slicer->message_id, GNUNET_YES);
+ cbs->eom_cb (cbs->cls, msg, slicer->message_id,
+ slicer->flags, slicer->fragment_offset, GNUNET_YES);
break;
}
return GNUNET_YES;
@@ -241,8 +256,9 @@ slicer_modifier_handler_notify (void *cls, const struct GNUNET_HashCode *key,
struct GNUNET_PSYC_Slicer *slicer = cls;
struct SlicerModifierCallbacks *cbs = value;
- cbs->modifier_cb (cbs->cls, slicer->msg, slicer->message_id, slicer->mod_oper,
- slicer->mod_name, slicer->mod_value,
+ cbs->modifier_cb (cbs->cls, slicer->msg,
+ slicer->message_id, slicer->flags, slicer->fragment_offset,
+ slicer->mod_oper, slicer->mod_name, slicer->mod_value,
slicer->mod_value_size, slicer->mod_full_value_size);
return GNUNET_YES;
}
@@ -296,6 +312,8 @@ GNUNET_PSYC_slicer_message_part (struct GNUNET_PSYC_Slicer *slicer,
slicer->method_name = GNUNET_malloc (slicer->method_name_size);
memcpy (slicer->method_name, &meth[1], slicer->method_name_size);
slicer->message_id = message_id;
+ slicer->flags = flags;
+ slicer->fragment_offset = fragment_offset;
}
else
{