aboutsummaryrefslogtreecommitdiff
path: root/src/psyc/test_psyc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/psyc/test_psyc.c')
-rw-r--r--src/psyc/test_psyc.c54
1 files changed, 23 insertions, 31 deletions
diff --git a/src/psyc/test_psyc.c b/src/psyc/test_psyc.c
index d0380b21b..4aae5e122 100644
--- a/src/psyc/test_psyc.c
+++ b/src/psyc/test_psyc.c
@@ -203,34 +203,29 @@ end ()
203 203
204 204
205void 205void
206master_message_cb (void *cls, uint64_t message_id, uint32_t flags, 206master_message_cb (void *cls, const struct GNUNET_PSYC_MessageHeader *msg)
207 const struct GNUNET_PSYC_MessageHeader *msg)
208{ 207{
209 GNUNET_assert (NULL != msg); 208 GNUNET_assert (NULL != msg);
210 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 209 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
211 "Test #%d: Master got PSYC message fragment of size %u " 210 "Test #%d: Master got PSYC message fragment of size %u "
212 "belonging to message ID %" PRIu64 " with flags %x\n", 211 "belonging to message ID %" PRIu64 " with flags %x\n",
213 test, ntohs (msg->header.size), message_id, flags); 212 test, ntohs (msg->header.size),
213 GNUNET_ntohll (msg->message_id), ntohl (msg->flags));
214 // FIXME 214 // FIXME
215} 215}
216 216
217 217
218void 218void
219master_message_part_cb (void *cls, 219master_message_part_cb (void *cls, const struct GNUNET_PSYC_MessageHeader *msg,
220 const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key, 220 const struct GNUNET_MessageHeader *pmsg)
221 uint64_t message_id, uint32_t flags, uint64_t data_offset,
222 const struct GNUNET_MessageHeader *msg)
223{ 221{
224 if (NULL == msg) 222 GNUNET_assert (NULL != msg && NULL != pmsg);
225 {
226 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
227 "Test #%d: Error while master is receiving part of message #%" PRIu64 ".\n",
228 test, message_id);
229 return;
230 }
231 223
232 uint16_t type = ntohs (msg->type); 224 uint64_t message_id = GNUNET_ntohll (msg->message_id);
233 uint16_t size = ntohs (msg->size); 225 uint32_t flags = ntohl (msg->flags);
226
227 uint16_t type = ntohs (pmsg->type);
228 uint16_t size = ntohs (pmsg->size);
234 229
235 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 230 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
236 "Test #%d: Master got message part of type %u and size %u " 231 "Test #%d: Master got message part of type %u and size %u "
@@ -278,33 +273,30 @@ master_message_part_cb (void *cls,
278 273
279 274
280void 275void
281slave_message_cb (void *cls, uint64_t message_id, uint32_t flags, 276slave_message_cb (void *cls, const struct GNUNET_PSYC_MessageHeader *msg)
282 const struct GNUNET_PSYC_MessageHeader *msg)
283{ 277{
278 GNUNET_assert (NULL != msg);
284 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 279 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
285 "Test #%d: Slave got PSYC message fragment of size %u " 280 "Test #%d: Slave got PSYC message fragment of size %u "
286 "belonging to message ID %" PRIu64 " with flags %x\n", 281 "belonging to message ID %" PRIu64 " with flags %x\n",
287 test, ntohs (msg->header.size), message_id, flags); 282 test, ntohs (msg->header.size),
283 GNUNET_ntohll (msg->message_id), ntohl (msg->flags));
288 // FIXME 284 // FIXME
289} 285}
290 286
291 287
292void 288void
293slave_message_part_cb (void *cls, 289slave_message_part_cb (void *cls,
294 const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key, 290 const struct GNUNET_PSYC_MessageHeader *msg,
295 uint64_t message_id, uint32_t flags, uint64_t data_offset, 291 const struct GNUNET_MessageHeader *pmsg)
296 const struct GNUNET_MessageHeader *msg)
297{ 292{
298 if (NULL == msg) 293 GNUNET_assert (NULL != msg && NULL != pmsg);
299 { 294
300 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 295 uint64_t message_id = GNUNET_ntohll (msg->message_id);
301 "Test #%d: Error while slave is receiving part of message #%" PRIu64 ".\n", 296 uint32_t flags = ntohl (msg->flags);
302 test, message_id);
303 return;
304 }
305 297
306 uint16_t type = ntohs (msg->type); 298 uint16_t type = ntohs (pmsg->type);
307 uint16_t size = ntohs (msg->size); 299 uint16_t size = ntohs (pmsg->size);
308 300
309 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 301 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
310 "Test #%d: Slave got message part of type %u and size %u " 302 "Test #%d: Slave got message part of type %u and size %u "