aboutsummaryrefslogtreecommitdiff
path: root/src/social
diff options
context:
space:
mode:
authorGabor X Toth <*@tg-x.net>2016-01-12 23:26:47 +0000
committerGabor X Toth <*@tg-x.net>2016-01-12 23:26:47 +0000
commit50eaf8d7de763d25b7dae7ffdee8d7c6b5fe71ea (patch)
treea8023bdb9c9446a45792d7100303265c78713a50 /src/social
parent3cbdbe18dbd56def00c0014381ff90b4ee664904 (diff)
downloadgnunet-50eaf8d7de763d25b7dae7ffdee8d7c6b5fe71ea.tar.gz
gnunet-50eaf8d7de763d25b7dae7ffdee8d7c6b5fe71ea.zip
psycutil reorg: message, env, slicer
Diffstat (limited to 'src/social')
-rw-r--r--src/social/Makefile.am8
-rw-r--r--src/social/gnunet-service-social.c6
-rw-r--r--src/social/social.h32
-rw-r--r--src/social/social_api.c690
-rw-r--r--src/social/test_social.c127
5 files changed, 141 insertions, 722 deletions
diff --git a/src/social/Makefile.am b/src/social/Makefile.am
index 739385e19..bf1532411 100644
--- a/src/social/Makefile.am
+++ b/src/social/Makefile.am
@@ -24,7 +24,7 @@ libgnunetsocial_la_SOURCES = \
24 social_api.c social.h 24 social_api.c social.h
25libgnunetsocial_la_LIBADD = \ 25libgnunetsocial_la_LIBADD = \
26 $(top_builddir)/src/util/libgnunetutil.la \ 26 $(top_builddir)/src/util/libgnunetutil.la \
27 $(top_builddir)/src/env/libgnunetenv.la \ 27 $(top_builddir)/src/psycutil/libgnunetpsycutil.la \
28 $(GN_LIBINTL) $(XLIB) 28 $(GN_LIBINTL) $(XLIB)
29libgnunetsocial_la_LDFLAGS = \ 29libgnunetsocial_la_LDFLAGS = \
30 $(GN_LIB_LDFLAGS) $(WINFLAGS) \ 30 $(GN_LIB_LDFLAGS) $(WINFLAGS) \
@@ -40,9 +40,8 @@ gnunet_service_social_SOURCES = \
40gnunet_service_social_LDADD = \ 40gnunet_service_social_LDADD = \
41 $(top_builddir)/src/util/libgnunetutil.la \ 41 $(top_builddir)/src/util/libgnunetutil.la \
42 $(top_builddir)/src/statistics/libgnunetstatistics.la \ 42 $(top_builddir)/src/statistics/libgnunetstatistics.la \
43 $(top_builddir)/src/env/libgnunetenv.la \ 43 $(top_builddir)/src/psycutil/libgnunetpsycutil.la \
44 $(top_builddir)/src/psyc/libgnunetpsyc.la \ 44 $(top_builddir)/src/psyc/libgnunetpsyc.la \
45 $(top_builddir)/src/psycstore/libgnunetpsycutil.la \
46 $(top_builddir)/src/core/libgnunetcore.la \ 45 $(top_builddir)/src/core/libgnunetcore.la \
47 $(top_builddir)/src/identity/libgnunetidentity.la \ 46 $(top_builddir)/src/identity/libgnunetidentity.la \
48 $(top_builddir)/src/gns/libgnunetgns.la \ 47 $(top_builddir)/src/gns/libgnunetgns.la \
@@ -66,8 +65,7 @@ test_social_LDADD = \
66 libgnunetsocial.la \ 65 libgnunetsocial.la \
67 $(top_builddir)/src/testing/libgnunettesting.la \ 66 $(top_builddir)/src/testing/libgnunettesting.la \
68 $(top_builddir)/src/util/libgnunetutil.la \ 67 $(top_builddir)/src/util/libgnunetutil.la \
69 $(top_builddir)/src/env/libgnunetenv.la \ 68 $(top_builddir)/src/psycutil/libgnunetpsycutil.la \
70 $(top_builddir)/src/psycstore/libgnunetpsycutil.la \
71 $(top_builddir)/src/core/libgnunetcore.la \ 69 $(top_builddir)/src/core/libgnunetcore.la \
72 $(top_builddir)/src/identity/libgnunetidentity.la 70 $(top_builddir)/src/identity/libgnunetidentity.la
73 71
diff --git a/src/social/gnunet-service-social.c b/src/social/gnunet-service-social.c
index ec4b18d0b..d4dfe9b0f 100644
--- a/src/social/gnunet-service-social.c
+++ b/src/social/gnunet-service-social.c
@@ -734,7 +734,7 @@ psyc_recv_join_dcsn (void *cls,
734void 734void
735psyc_recv_file (struct Place *plc, const struct GNUNET_PSYC_MessageHeader *msg, 735psyc_recv_file (struct Place *plc, const struct GNUNET_PSYC_MessageHeader *msg,
736 uint32_t flags, uint64_t message_id, uint64_t fragment_offset, 736 uint32_t flags, uint64_t message_id, uint64_t fragment_offset,
737 const char *method_name, struct GNUNET_ENV_Environment *env, 737 const char *method_name, struct GNUNET_PSYC_Environment *env,
738 const void *data, uint16_t data_size) 738 const void *data, uint16_t data_size)
739{ 739{
740 if (plc->file_message_id != message_id) 740 if (plc->file_message_id != message_id)
@@ -794,7 +794,7 @@ psyc_recv_message (void *cls,
794 /* process message */ 794 /* process message */
795 /* FIXME: use slicer */ 795 /* FIXME: use slicer */
796 const char *method_name = NULL; 796 const char *method_name = NULL;
797 struct GNUNET_ENV_Environment *env = GNUNET_ENV_environment_create (); 797 struct GNUNET_PSYC_Environment *env = GNUNET_PSYC_env_create ();
798 const void *data = NULL; 798 const void *data = NULL;
799 uint16_t data_size = 0; 799 uint16_t data_size = 0;
800 800
@@ -815,7 +815,7 @@ psyc_recv_message (void *cls,
815 } 815 }
816 } 816 }
817 } 817 }
818 GNUNET_ENV_environment_destroy (env); 818 GNUNET_PSYC_env_destroy (env);
819 819
820 place_send_msg (plc, &msg->header); 820 place_send_msg (plc, &msg->header);
821} 821}
diff --git a/src/social/social.h b/src/social/social.h
index b797a89ac..0980cbf5c 100644
--- a/src/social/social.h
+++ b/src/social/social.h
@@ -80,6 +80,19 @@ struct AppDetachRequest
80}; 80};
81 81
82 82
83struct HostRelayRequest
84{
85 /**
86 * Types:
87 * - GNUNET_MESSAGE_TYPE_SOCIAL_HOST_RELAY_START
88 * - GNUNET_MESSAGE_TYPE_SOCIAL_HOST_RELAY_STOP
89 */
90 struct GNUNET_MessageHeader header;
91
92 /* Followed by char *method_name */
93};
94
95
83struct HostEnterRequest 96struct HostEnterRequest
84{ 97{
85 /** 98 /**
@@ -207,6 +220,7 @@ struct ZoneAddNymRequest
207 /* Followed by const char *name */ 220 /* Followed by const char *name */
208}; 221};
209 222
223
210/**** service -> library ****/ 224/**** service -> library ****/
211 225
212 226
@@ -266,24 +280,6 @@ struct HostEnterAck {
266}; 280};
267 281
268 282
269#if REMOVE
270struct NymEnterRequest
271{
272 /**
273 * Type: GNUNET_MESSAGE_TYPE_SOCIAL_NYM_ENTER
274 */
275 struct GNUNET_MessageHeader header;
276
277 /**
278 * Public key of the joining slave.
279 */
280 struct GNUNET_CRYPTO_EcdsaPublicKey nym_key;
281
282 /* Followed by struct GNUNET_MessageHeader join_request */
283};
284#endif
285
286
287GNUNET_NETWORK_STRUCT_END 283GNUNET_NETWORK_STRUCT_END
288 284
289#endif 285#endif
diff --git a/src/social/social_api.c b/src/social/social_api.c
index 3d5e9853f..3404160a9 100644
--- a/src/social/social_api.c
+++ b/src/social/social_api.c
@@ -19,9 +19,10 @@
19 */ 19 */
20 20
21/** 21/**
22 * @file social/social_api.c
23 * @brief Social service; implements social interactions using the PSYC service.
24 * @author Gabor X Toth 22 * @author Gabor X Toth
23 *
24 * @file
25 * Social service; implements social interactions using the PSYC service.
25 */ 26 */
26 27
27#include <inttypes.h> 28#include <inttypes.h>
@@ -29,7 +30,6 @@
29 30
30#include "platform.h" 31#include "platform.h"
31#include "gnunet_util_lib.h" 32#include "gnunet_util_lib.h"
32#include "gnunet_env_lib.h"
33#include "gnunet_psyc_service.h" 33#include "gnunet_psyc_service.h"
34#include "gnunet_psyc_util_lib.h" 34#include "gnunet_psyc_util_lib.h"
35#include "gnunet_social_service.h" 35#include "gnunet_social_service.h"
@@ -156,7 +156,7 @@ struct GNUNET_SOCIAL_Place
156 /** 156 /**
157 * Slicer for processing incoming methods. 157 * Slicer for processing incoming methods.
158 */ 158 */
159 struct GNUNET_SOCIAL_Slicer *slicer; 159 struct GNUNET_PSYC_Slicer *slicer;
160 160
161 /** 161 /**
162 * Message to send on reconnect. 162 * Message to send on reconnect.
@@ -211,7 +211,7 @@ struct GNUNET_SOCIAL_Host
211 /** 211 /**
212 * Slicer for processing incoming methods. 212 * Slicer for processing incoming methods.
213 */ 213 */
214 struct GNUNET_SOCIAL_Slicer *slicer; 214 struct GNUNET_PSYC_Slicer *slicer;
215 215
216 GNUNET_SOCIAL_HostEnterCallback enter_cb; 216 GNUNET_SOCIAL_HostEnterCallback enter_cb;
217 217
@@ -225,7 +225,7 @@ struct GNUNET_SOCIAL_Host
225 void *cb_cls; 225 void *cb_cls;
226 226
227 struct GNUNET_SOCIAL_Nym *notice_place_leave_nym; 227 struct GNUNET_SOCIAL_Nym *notice_place_leave_nym;
228 struct GNUNET_ENV_Environment *notice_place_leave_env; 228 struct GNUNET_PSYC_Environment *notice_place_leave_env;
229}; 229};
230 230
231 231
@@ -244,7 +244,7 @@ struct GNUNET_SOCIAL_Guest
244 /** 244 /**
245 * Slicer for processing incoming methods. 245 * Slicer for processing incoming methods.
246 */ 246 */
247 struct GNUNET_SOCIAL_Slicer *slicer; 247 struct GNUNET_PSYC_Slicer *slicer;
248 248
249 GNUNET_SOCIAL_GuestEnterCallback enter_cb; 249 GNUNET_SOCIAL_GuestEnterCallback enter_cb;
250 250
@@ -265,120 +265,6 @@ struct GNUNET_CONTAINER_MultiHashMap *nyms;
265 265
266 266
267/** 267/**
268 * Handle for a try-and-slice instance.
269 */
270struct GNUNET_SOCIAL_Slicer
271{
272 /**
273 * Method handlers: method_name -> SlicerMethodCallbacks
274 */
275 struct GNUNET_CONTAINER_MultiHashMap *method_handlers;
276
277 /**
278 * Modifier handlers: modifier name -> SlicerModifierCallbacks
279 */
280 struct GNUNET_CONTAINER_MultiHashMap *modifier_handlers;
281
282 /**
283 * Currently being processed message part.
284 */
285 const struct GNUNET_MessageHeader *msg;
286
287 /**
288 * ID of currently being received message.
289 */
290 uint64_t message_id;
291
292 /**
293 * Method name of currently being received message.
294 */
295 char *method_name;
296
297 /**
298 * Name of currently processed modifier.
299 */
300 char *mod_name;
301
302 /**
303 * Value of currently processed modifier.
304 */
305 char *mod_value;
306
307 /**
308 * Public key of the nym the current message originates from.
309 */
310 struct GNUNET_CRYPTO_EcdsaPublicKey nym_key;
311
312 /**
313 * Size of @a method_name (including terminating \0).
314 */
315 uint16_t method_name_size;
316
317 /**
318 * Size of @a modifier_name (including terminating \0).
319 */
320 uint16_t mod_name_size;
321
322 /**
323 * Size of modifier value fragment.
324 */
325 uint16_t mod_value_size;
326
327 /**
328 * Full size of modifier value.
329 */
330 uint16_t mod_full_value_size;
331
332 /**
333 * Remaining bytes from the value of the current modifier.
334 */
335 uint16_t mod_value_remaining;
336
337 /**
338 * Operator of currently processed modifier.
339 */
340 uint8_t mod_oper;
341};
342
343
344/**
345 * Callbacks for a slicer method handler.
346 */
347struct SlicerMethodCallbacks
348{
349 GNUNET_SOCIAL_MethodCallback method_cb;
350 GNUNET_SOCIAL_ModifierCallback modifier_cb;
351 GNUNET_SOCIAL_DataCallback data_cb;
352 GNUNET_SOCIAL_EndOfMessageCallback eom_cb;
353 void *cls;
354};
355
356
357struct SlicerMethodRemoveClosure
358{
359 struct GNUNET_SOCIAL_Slicer *slicer;
360 struct SlicerMethodCallbacks rm_cbs;
361};
362
363
364/**
365 * Callbacks for a slicer method handler.
366 */
367struct SlicerModifierCallbacks
368{
369 GNUNET_SOCIAL_ModifierCallback modifier_cb;
370 void *cls;
371};
372
373
374struct SlicerModifierRemoveClosure
375{
376 struct GNUNET_SOCIAL_Slicer *slicer;
377 struct SlicerModifierCallbacks rm_cbs;
378};
379
380
381/**
382 * Handle for an announcement request. 268 * Handle for an announcement request.
383 */ 269 */
384struct GNUNET_SOCIAL_Announcement 270struct GNUNET_SOCIAL_Announcement
@@ -535,20 +421,23 @@ host_recv_notice_place_leave_method (void *cls,
535 const struct GNUNET_PSYC_MessageMethod *meth, 421 const struct GNUNET_PSYC_MessageMethod *meth,
536 uint64_t message_id, 422 uint64_t message_id,
537 uint32_t flags, 423 uint32_t flags,
538 const struct GNUNET_SOCIAL_Nym *nym, 424 const struct GNUNET_CRYPTO_EcdsaPublicKey *nym_pub_key,
539 const char *method_name) 425 const char *method_name)
540{ 426{
541 struct GNUNET_SOCIAL_Host *hst = cls; 427 struct GNUNET_SOCIAL_Host *hst = cls;
428
542 if (0 == memcmp (&(struct GNUNET_CRYPTO_EcdsaPublicKey) {}, 429 if (0 == memcmp (&(struct GNUNET_CRYPTO_EcdsaPublicKey) {},
543 &nym->pub_key, sizeof (nym->pub_key))) 430 nym_pub_key, sizeof (*nym_pub_key)))
544 return; 431 return;
545 432
433 struct GNUNET_SOCIAL_Nym *nym = nym_get_or_create (nym_pub_key);
434
546 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 435 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
547 "Host received method for message ID %" PRIu64 " from nym %s: %s\n", 436 "Host received method for message ID %" PRIu64 " from nym %s: %s\n",
548 message_id, GNUNET_h2s (&nym->pub_key_hash), method_name); 437 message_id, GNUNET_h2s (&nym->pub_key_hash), method_name);
549 438
550 hst->notice_place_leave_nym = (struct GNUNET_SOCIAL_Nym *) nym; 439 hst->notice_place_leave_nym = (struct GNUNET_SOCIAL_Nym *) nym;
551 hst->notice_place_leave_env = GNUNET_ENV_environment_create (); 440 hst->notice_place_leave_env = GNUNET_PSYC_env_create ();
552 441
553 char *str = GNUNET_CRYPTO_ecdsa_public_key_to_string (&hst->notice_place_leave_nym->pub_key); 442 char *str = GNUNET_CRYPTO_ecdsa_public_key_to_string (&hst->notice_place_leave_nym->pub_key);
554 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 443 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -561,7 +450,7 @@ static void
561host_recv_notice_place_leave_modifier (void *cls, 450host_recv_notice_place_leave_modifier (void *cls,
562 const struct GNUNET_MessageHeader *msg, 451 const struct GNUNET_MessageHeader *msg,
563 uint64_t message_id, 452 uint64_t message_id,
564 enum GNUNET_ENV_Operator oper, 453 enum GNUNET_PSYC_Operator oper,
565 const char *name, 454 const char *name,
566 const void *value, 455 const void *value,
567 uint16_t value_size, 456 uint16_t value_size,
@@ -581,8 +470,8 @@ host_recv_notice_place_leave_modifier (void *cls,
581 || 0 == memcmp (name, "_nym_", sizeof ("_nym_") - 1)) 470 || 0 == memcmp (name, "_nym_", sizeof ("_nym_") - 1))
582 return; 471 return;
583 472
584 GNUNET_ENV_environment_add (hst->notice_place_leave_env, 473 GNUNET_PSYC_env_add (hst->notice_place_leave_env,
585 GNUNET_ENV_OP_SET, name, value, value_size); 474 GNUNET_PSYC_OP_SET, name, value, value_size);
586} 475}
587 476
588 477
@@ -607,482 +496,19 @@ host_recv_notice_place_leave_eom (void *cls,
607 hst->farewell_cb (hst->cb_cls, hst->notice_place_leave_nym, 496 hst->farewell_cb (hst->cb_cls, hst->notice_place_leave_nym,
608 hst->notice_place_leave_env); 497 hst->notice_place_leave_env);
609 /* announce leaving guest to place */ 498 /* announce leaving guest to place */
610 GNUNET_ENV_environment_add (hst->notice_place_leave_env, GNUNET_ENV_OP_SET, 499 GNUNET_PSYC_env_add (hst->notice_place_leave_env, GNUNET_PSYC_OP_SET,
611 "_nym", hst->notice_place_leave_nym, 500 "_nym", hst->notice_place_leave_nym,
612 sizeof (*hst->notice_place_leave_nym)); 501 sizeof (*hst->notice_place_leave_nym));
613 GNUNET_SOCIAL_host_announce (hst, "_notice_place_leave", 502 GNUNET_SOCIAL_host_announce (hst, "_notice_place_leave",
614 hst->notice_place_leave_env, 503 hst->notice_place_leave_env,
615 NULL, NULL, GNUNET_SOCIAL_ANNOUNCE_NONE); 504 NULL, NULL, GNUNET_SOCIAL_ANNOUNCE_NONE);
616 nym_destroy (hst->notice_place_leave_nym); 505 nym_destroy (hst->notice_place_leave_nym);
617 } 506 }
618 GNUNET_ENV_environment_destroy (hst->notice_place_leave_env); 507 GNUNET_PSYC_env_destroy (hst->notice_place_leave_env);
619 hst->notice_place_leave_env = NULL; 508 hst->notice_place_leave_env = NULL;
620} 509}
621 510
622 511
623/*** SLICER ***/
624
625/**
626 * Call a method handler for an incoming message part.
627 */
628int
629slicer_method_handler_notify (void *cls, const struct GNUNET_HashCode *key,
630 void *value)
631{
632 struct GNUNET_SOCIAL_Slicer *slicer = cls;
633 const struct GNUNET_MessageHeader *msg = slicer->msg;
634 struct SlicerMethodCallbacks *cbs = value;
635 uint16_t ptype = ntohs (msg->type);
636
637 switch (ptype)
638 {
639 case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_METHOD:
640 {
641 if (NULL == cbs->method_cb)
642 break;
643 struct GNUNET_PSYC_MessageMethod *
644 meth = (struct GNUNET_PSYC_MessageMethod *) msg;
645 cbs->method_cb (cbs->cls, meth, slicer->message_id,
646 ntohl (meth->flags),
647 nym_get_or_create (&slicer->nym_key),
648 slicer->method_name);
649 break;
650 }
651
652 case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_MODIFIER:
653 {
654 if (NULL == cbs->modifier_cb)
655 break;
656 struct GNUNET_PSYC_MessageModifier *
657 mod = (struct GNUNET_PSYC_MessageModifier *) msg;
658 cbs->modifier_cb (cbs->cls, &mod->header, slicer->message_id,
659 mod->oper, (const char *) &mod[1],
660 (const void *) &mod[1] + ntohs (mod->name_size),
661 ntohs (mod->header.size) - sizeof (*mod) - ntohs (mod->name_size),
662 ntohs (mod->value_size));
663 break;
664 }
665
666 case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_MOD_CONT:
667 {
668 if (NULL == cbs->modifier_cb)
669 break;
670 cbs->modifier_cb (cbs->cls, msg, slicer->message_id,
671 slicer->mod_oper, slicer->mod_name, &msg[1],
672 ntohs (msg->size) - sizeof (*msg),
673 slicer->mod_full_value_size);
674 break;
675 }
676
677 case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_DATA:
678 {
679 if (NULL == cbs->data_cb)
680 break;
681 uint64_t data_offset = 0; // FIXME
682 cbs->data_cb (cbs->cls, msg, slicer->message_id,
683 data_offset, &msg[1], ntohs (msg->size) - sizeof (*msg));
684 break;
685 }
686
687 case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_END:
688 if (NULL == cbs->eom_cb)
689 break;
690 cbs->eom_cb (cbs->cls, msg, slicer->message_id, GNUNET_NO);
691 break;
692
693 case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_CANCEL:
694 if (NULL == cbs->eom_cb)
695 break;
696 cbs->eom_cb (cbs->cls, msg, slicer->message_id, GNUNET_YES);
697 break;
698 }
699 return GNUNET_YES;
700}
701
702
703/**
704 * Call a method handler for an incoming message part.
705 */
706int
707slicer_modifier_handler_notify (void *cls, const struct GNUNET_HashCode *key,
708 void *value)
709{
710 struct GNUNET_SOCIAL_Slicer *slicer = cls;
711 struct SlicerModifierCallbacks *cbs = value;
712
713 cbs->modifier_cb (cbs->cls, slicer->msg, slicer->message_id, slicer->mod_oper,
714 slicer->mod_name, slicer->mod_value,
715 slicer->mod_value_size, slicer->mod_full_value_size);
716 return GNUNET_YES;
717}
718
719
720/**
721 * Process an incoming message part and call matching handlers.
722 *
723 * @param cls
724 * Closure.
725 * @param message_id
726 * ID of the message.
727 * @param flags
728 * Flags for the message.
729 * @see enum GNUNET_PSYC_MessageFlags
730 * @param msg
731 * The message part. as it arrived from the network.
732 */
733static void
734slicer_message (void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key,
735 uint64_t message_id, uint32_t flags, uint64_t fragment_offset,
736 const struct GNUNET_MessageHeader *msg)
737{
738 struct GNUNET_SOCIAL_Slicer *slicer = cls;
739 slicer->nym_key = *slave_key;
740
741 uint16_t ptype = ntohs (msg->type);
742 if (GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_METHOD == ptype)
743 {
744 struct GNUNET_PSYC_MessageMethod *
745 meth = (struct GNUNET_PSYC_MessageMethod *) msg;
746 slicer->method_name_size = ntohs (meth->header.size) - sizeof (*meth);
747 slicer->method_name = GNUNET_malloc (slicer->method_name_size);
748 memcpy (slicer->method_name, &meth[1], slicer->method_name_size);
749 slicer->message_id = message_id;
750 }
751 else
752 {
753 GNUNET_assert (message_id == slicer->message_id);
754 }
755
756 char *nym_str = GNUNET_CRYPTO_ecdsa_public_key_to_string (slave_key);
757 LOG (GNUNET_ERROR_TYPE_DEBUG,
758 "Slicer received message of type %u and size %u, "
759 "with ID %" PRIu64 " and method %s from %s\n",
760 ptype, ntohs (msg->size), message_id, slicer->method_name, nym_str);
761 GNUNET_free (nym_str);
762
763 slicer->msg = msg;
764
765 /* try-and-slice modifier */
766
767 switch (ptype)
768 {
769 case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_MODIFIER:
770 {
771 struct GNUNET_PSYC_MessageModifier *
772 mod = (struct GNUNET_PSYC_MessageModifier *) msg;
773 slicer->mod_oper = mod->oper;
774 slicer->mod_name_size = ntohs (mod->name_size);
775 slicer->mod_name = GNUNET_malloc (slicer->mod_name_size);
776 memcpy (slicer->mod_name, &mod[1], slicer->mod_name_size);
777 slicer->mod_value = (char *) &mod[1] + slicer->mod_name_size;
778 slicer->mod_full_value_size = ntohs (mod->value_size);
779 slicer->mod_value_remaining = slicer->mod_full_value_size;
780 slicer->mod_value_size
781 = ntohs (mod->header.size) - sizeof (*mod) - slicer->mod_name_size;
782 }
783 case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_MOD_CONT:
784 if (ptype == GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_MOD_CONT)
785 {
786 slicer->mod_value = (char *) &msg[1];
787 slicer->mod_value_size = ntohs (msg->size) - sizeof (*msg);
788 }
789 slicer->mod_value_remaining -= slicer->mod_value_size;
790 char *name = GNUNET_malloc (slicer->mod_name_size);
791 memcpy (name, slicer->mod_name, slicer->mod_name_size);
792 do
793 {
794 struct GNUNET_HashCode key;
795 uint16_t name_len = strlen (name);
796 GNUNET_CRYPTO_hash (name, name_len, &key);
797 GNUNET_CONTAINER_multihashmap_get_multiple (slicer->modifier_handlers, &key,
798 slicer_modifier_handler_notify,
799 slicer);
800 char *p = strrchr (name, '_');
801 if (NULL == p)
802 break;
803 *p = '\0';
804 } while (1);
805 GNUNET_free (name);
806 }
807
808 /* try-and-slice method */
809
810 char *name = GNUNET_malloc (slicer->method_name_size);
811 memcpy (name, slicer->method_name, slicer->method_name_size);
812 do
813 {
814 struct GNUNET_HashCode key;
815 uint16_t name_len = strlen (name);
816 GNUNET_CRYPTO_hash (name, name_len, &key);
817 GNUNET_CONTAINER_multihashmap_get_multiple (slicer->method_handlers, &key,
818 slicer_method_handler_notify,
819 slicer);
820 char *p = strrchr (name, '_');
821 if (NULL == p)
822 break;
823 *p = '\0';
824 } while (1);
825 GNUNET_free (name);
826
827 if (GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_END <= ptype)
828 GNUNET_free (slicer->method_name);
829
830 if (0 == slicer->mod_value_remaining && NULL != slicer->mod_name)
831 {
832 GNUNET_free (slicer->mod_name);
833 slicer->mod_name = NULL;
834 slicer->mod_name_size = 0;
835 slicer->mod_value_size = 0;
836 slicer->mod_full_value_size = 0;
837 slicer->mod_oper = 0;
838 }
839
840 slicer->msg = NULL;
841}
842
843
844/**
845 * Create a try-and-slice instance.
846 *
847 * A slicer processes incoming messages and notifies callbacks about matching
848 * methods or modifiers encountered.
849 *
850 * @return A new try-and-slice construct.
851 */
852struct GNUNET_SOCIAL_Slicer *
853GNUNET_SOCIAL_slicer_create (void)
854{
855 struct GNUNET_SOCIAL_Slicer *slicer = GNUNET_malloc (sizeof (*slicer));
856 slicer->method_handlers = GNUNET_CONTAINER_multihashmap_create (1, GNUNET_NO);
857 slicer->modifier_handlers = GNUNET_CONTAINER_multihashmap_create (1, GNUNET_NO);
858 return slicer;
859}
860
861
862/**
863 * Add a method to the try-and-slice instance.
864 *
865 * The callbacks are called for messages with a matching @a method_name prefix.
866 *
867 * @param slicer
868 * The try-and-slice instance to extend.
869 * @param method_name
870 * Name of the given method, use empty string to match all.
871 * @param method_cb
872 * Method handler invoked upon a matching message.
873 * @param modifier_cb
874 * Modifier handler, invoked after @a method_cb
875 * for each modifier in the message.
876 * @param data_cb
877 * Data handler, invoked after @a modifier_cb for each data fragment.
878 * @param eom_cb
879 * Invoked upon reaching the end of a matching message.
880 * @param cls
881 * Closure for the callbacks.
882 */
883void
884GNUNET_SOCIAL_slicer_method_add (struct GNUNET_SOCIAL_Slicer *slicer,
885 const char *method_name,
886 GNUNET_SOCIAL_MethodCallback method_cb,
887 GNUNET_SOCIAL_ModifierCallback modifier_cb,
888 GNUNET_SOCIAL_DataCallback data_cb,
889 GNUNET_SOCIAL_EndOfMessageCallback eom_cb,
890 void *cls)
891{
892 struct GNUNET_HashCode key;
893 GNUNET_CRYPTO_hash (method_name, strlen (method_name), &key);
894
895 struct SlicerMethodCallbacks *cbs = GNUNET_malloc (sizeof (*cbs));
896 cbs->method_cb = method_cb;
897 cbs->modifier_cb = modifier_cb;
898 cbs->data_cb = data_cb;
899 cbs->eom_cb = eom_cb;
900 cbs->cls = cls;
901
902 GNUNET_CONTAINER_multihashmap_put (slicer->method_handlers, &key, cbs,
903 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
904}
905
906
907int
908slicer_method_remove (void *cls, const struct GNUNET_HashCode *key, void *value)
909{
910 struct SlicerMethodRemoveClosure *rm_cls = cls;
911 struct GNUNET_SOCIAL_Slicer *slicer = rm_cls->slicer;
912 struct SlicerMethodCallbacks *rm_cbs = &rm_cls->rm_cbs;
913 struct SlicerMethodCallbacks *cbs = value;
914
915 if (cbs->method_cb == rm_cbs->method_cb
916 && cbs->modifier_cb == rm_cbs->modifier_cb
917 && cbs->data_cb == rm_cbs->data_cb
918 && cbs->eom_cb == rm_cbs->eom_cb)
919 {
920 GNUNET_CONTAINER_multihashmap_remove (slicer->method_handlers, key, cbs);
921 GNUNET_free (cbs);
922 return GNUNET_NO;
923 }
924 return GNUNET_YES;
925}
926
927
928/**
929 * Remove a registered method from the try-and-slice instance.
930 *
931 * Removes one matching handler registered with the given
932 * @a method_name and callbacks.
933 *
934 * @param slicer
935 * The try-and-slice instance.
936 * @param method_name
937 * Name of the method to remove.
938 * @param method_cb
939 * Method handler.
940 * @param modifier_cb
941 * Modifier handler.
942 * @param data_cb
943 * Data handler.
944 * @param eom_cb
945 * End of message handler.
946 *
947 * @return #GNUNET_OK if a method handler was removed,
948 * #GNUNET_NO if no handler matched the given method name and callbacks.
949 */
950int
951GNUNET_SOCIAL_slicer_method_remove (struct GNUNET_SOCIAL_Slicer *slicer,
952 const char *method_name,
953 GNUNET_SOCIAL_MethodCallback method_cb,
954 GNUNET_SOCIAL_ModifierCallback modifier_cb,
955 GNUNET_SOCIAL_DataCallback data_cb,
956 GNUNET_SOCIAL_EndOfMessageCallback eom_cb)
957{
958 struct GNUNET_HashCode key;
959 GNUNET_CRYPTO_hash (method_name, strlen (method_name), &key);
960
961 struct SlicerMethodRemoveClosure rm_cls;
962 rm_cls.slicer = slicer;
963 struct SlicerMethodCallbacks *rm_cbs = &rm_cls.rm_cbs;
964 rm_cbs->method_cb = method_cb;
965 rm_cbs->modifier_cb = modifier_cb;
966 rm_cbs->data_cb = data_cb;
967 rm_cbs->eom_cb = eom_cb;
968
969 return
970 (GNUNET_SYSERR
971 == GNUNET_CONTAINER_multihashmap_get_multiple (slicer->method_handlers, &key,
972 slicer_method_remove,
973 &rm_cls))
974 ? GNUNET_NO
975 : GNUNET_OK;
976}
977
978
979/**
980 * Watch a place for changed objects.
981 *
982 * @param slicer
983 * The try-and-slice instance.
984 * @param object_filter
985 * Object prefix to match.
986 * @param modifier_cb
987 * Function to call when encountering a state modifier.
988 * @param cls
989 * Closure for callback.
990 */
991void
992GNUNET_SOCIAL_slicer_modifier_add (struct GNUNET_SOCIAL_Slicer *slicer,
993 const char *object_filter,
994 GNUNET_SOCIAL_ModifierCallback modifier_cb,
995 void *cls)
996{
997 struct SlicerModifierCallbacks *cbs = GNUNET_malloc (sizeof *cbs);
998 cbs->modifier_cb = modifier_cb;
999 cbs->cls = cls;
1000
1001 struct GNUNET_HashCode key;
1002 GNUNET_CRYPTO_hash (object_filter, strlen (object_filter), &key);
1003 GNUNET_CONTAINER_multihashmap_put (slicer->modifier_handlers, &key, cbs,
1004 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
1005}
1006
1007
1008int
1009slicer_modifier_remove (void *cls, const struct GNUNET_HashCode *key, void *value)
1010{
1011 struct SlicerModifierRemoveClosure *rm_cls = cls;
1012 struct GNUNET_SOCIAL_Slicer *slicer = rm_cls->slicer;
1013 struct SlicerModifierCallbacks *rm_cbs = &rm_cls->rm_cbs;
1014 struct SlicerModifierCallbacks *cbs = value;
1015
1016 if (cbs->modifier_cb == rm_cbs->modifier_cb)
1017 {
1018 GNUNET_CONTAINER_multihashmap_remove (slicer->modifier_handlers, key, cbs);
1019 GNUNET_free (cbs);
1020 return GNUNET_NO;
1021 }
1022 return GNUNET_YES;
1023}
1024
1025
1026/**
1027 * Remove a registered modifier from the try-and-slice instance.
1028 *
1029 * Removes one matching handler registered with the given
1030 * @a object_filter and @a modifier_cb.
1031 *
1032 * @param slicer
1033 * The try-and-slice instance.
1034 * @param object_filter
1035 * Object prefix to match.
1036 * @param modifier_cb
1037 * Function to call when encountering a state modifier changes.
1038 */
1039int
1040GNUNET_SOCIAL_slicer_modifier_remove (struct GNUNET_SOCIAL_Slicer *slicer,
1041 const char *object_filter,
1042 GNUNET_SOCIAL_ModifierCallback modifier_cb)
1043{
1044 struct GNUNET_HashCode key;
1045 GNUNET_CRYPTO_hash (object_filter, strlen (object_filter), &key);
1046
1047 struct SlicerModifierRemoveClosure rm_cls;
1048 rm_cls.slicer = slicer;
1049 struct SlicerModifierCallbacks *rm_cbs = &rm_cls.rm_cbs;
1050 rm_cbs->modifier_cb = modifier_cb;
1051
1052 return
1053 (GNUNET_SYSERR
1054 == GNUNET_CONTAINER_multihashmap_get_multiple (slicer->modifier_handlers, &key,
1055 slicer_modifier_remove,
1056 &rm_cls))
1057 ? GNUNET_NO
1058 : GNUNET_OK;
1059 }
1060
1061
1062int
1063slicer_method_free (void *cls, const struct GNUNET_HashCode *key, void *value)
1064{
1065 struct SlicerMethodCallbacks *cbs = value;
1066 GNUNET_free (cbs);
1067 return GNUNET_YES;
1068}
1069
1070
1071/**
1072 * Destroy a given try-and-slice instance.
1073 *
1074 * @param slicer
1075 * Slicer to destroy
1076 */
1077void
1078GNUNET_SOCIAL_slicer_destroy (struct GNUNET_SOCIAL_Slicer *slicer)
1079{
1080 GNUNET_CONTAINER_multihashmap_iterate (slicer->method_handlers,
1081 slicer_method_free, NULL);
1082 GNUNET_CONTAINER_multihashmap_destroy (slicer->method_handlers);
1083 GNUNET_free (slicer);
1084}
1085
1086/*** CLIENT ***/ 512/*** CLIENT ***/
1087 513
1088 514
@@ -1405,7 +831,7 @@ host_recv_enter_request (void *cls,
1405 return; 831 return;
1406 832
1407 const char *method_name = NULL; 833 const char *method_name = NULL;
1408 struct GNUNET_ENV_Environment *env = NULL; 834 struct GNUNET_PSYC_Environment *env = NULL;
1409 struct GNUNET_PSYC_MessageHeader *entry_pmsg = NULL; 835 struct GNUNET_PSYC_MessageHeader *entry_pmsg = NULL;
1410 const void *data = NULL; 836 const void *data = NULL;
1411 uint16_t data_size = 0; 837 uint16_t data_size = 0;
@@ -1423,7 +849,7 @@ host_recv_enter_request (void *cls,
1423 "Received join_msg of type %u and size %u.\n", 849 "Received join_msg of type %u and size %u.\n",
1424 ntohs (join_msg->header.type), ntohs (join_msg->header.size)); 850 ntohs (join_msg->header.type), ntohs (join_msg->header.size));
1425 851
1426 env = GNUNET_ENV_environment_create (); 852 env = GNUNET_PSYC_env_create ();
1427 entry_pmsg = GNUNET_PSYC_message_header_create_from_psyc (join_msg); 853 entry_pmsg = GNUNET_PSYC_message_header_create_from_psyc (join_msg);
1428 if (GNUNET_OK != GNUNET_PSYC_message_parse (entry_pmsg, &method_name, env, 854 if (GNUNET_OK != GNUNET_PSYC_message_parse (entry_pmsg, &method_name, env,
1429 &data, &data_size)) 855 &data, &data_size))
@@ -1444,7 +870,7 @@ host_recv_enter_request (void *cls,
1444 } while (0); 870 } while (0);
1445 871
1446 if (NULL != env) 872 if (NULL != env)
1447 GNUNET_ENV_environment_destroy (env); 873 GNUNET_PSYC_env_destroy (env);
1448 if (NULL != entry_pmsg) 874 if (NULL != entry_pmsg)
1449 GNUNET_free (entry_pmsg); 875 GNUNET_free (entry_pmsg);
1450} 876}
@@ -1693,7 +1119,7 @@ host_cleanup (void *cls)
1693 } 1119 }
1694 if (NULL != hst->slicer) 1120 if (NULL != hst->slicer)
1695 { 1121 {
1696 GNUNET_SOCIAL_slicer_destroy (hst->slicer); 1122 GNUNET_PSYC_slicer_destroy (hst->slicer);
1697 hst->slicer = NULL; 1123 hst->slicer = NULL;
1698 } 1124 }
1699 GNUNET_free (hst); 1125 GNUNET_free (hst);
@@ -1743,7 +1169,7 @@ struct GNUNET_SOCIAL_Host *
1743GNUNET_SOCIAL_host_enter (const struct GNUNET_SOCIAL_App *app, 1169GNUNET_SOCIAL_host_enter (const struct GNUNET_SOCIAL_App *app,
1744 const struct GNUNET_SOCIAL_Ego *ego, 1170 const struct GNUNET_SOCIAL_Ego *ego,
1745 enum GNUNET_PSYC_Policy policy, 1171 enum GNUNET_PSYC_Policy policy,
1746 struct GNUNET_SOCIAL_Slicer *slicer, 1172 struct GNUNET_PSYC_Slicer *slicer,
1747 GNUNET_SOCIAL_HostEnterCallback enter_cb, 1173 GNUNET_SOCIAL_HostEnterCallback enter_cb,
1748 GNUNET_SOCIAL_AnswerDoorCallback answer_door_cb, 1174 GNUNET_SOCIAL_AnswerDoorCallback answer_door_cb,
1749 GNUNET_SOCIAL_FarewellCallback farewell_cb, 1175 GNUNET_SOCIAL_FarewellCallback farewell_cb,
@@ -1765,14 +1191,14 @@ GNUNET_SOCIAL_host_enter (const struct GNUNET_SOCIAL_App *app,
1765 GNUNET_CLIENT_MANAGER_set_user_context_ (plc->client, hst, sizeof (*plc)); 1191 GNUNET_CLIENT_MANAGER_set_user_context_ (plc->client, hst, sizeof (*plc));
1766 1192
1767 plc->tmit = GNUNET_PSYC_transmit_create (plc->client); 1193 plc->tmit = GNUNET_PSYC_transmit_create (plc->client);
1768 plc->recv = GNUNET_PSYC_receive_create (NULL, slicer_message, plc->slicer); 1194 plc->recv = GNUNET_PSYC_receive_create (NULL, GNUNET_PSYC_slicer_message, plc->slicer);
1769 1195
1770 hst->slicer = GNUNET_SOCIAL_slicer_create (); 1196 hst->slicer = GNUNET_PSYC_slicer_create ();
1771 GNUNET_SOCIAL_slicer_method_add (hst->slicer, "_notice_place_leave", 1197 GNUNET_PSYC_slicer_method_add (hst->slicer, "_notice_place_leave",
1772 host_recv_notice_place_leave_method, 1198 host_recv_notice_place_leave_method,
1773 host_recv_notice_place_leave_modifier, 1199 host_recv_notice_place_leave_modifier,
1774 NULL, host_recv_notice_place_leave_eom, hst); 1200 NULL, host_recv_notice_place_leave_eom, hst);
1775 hst->recv = GNUNET_PSYC_receive_create (NULL, slicer_message, hst->slicer); 1201 hst->recv = GNUNET_PSYC_receive_create (NULL, GNUNET_PSYC_slicer_message, hst->slicer);
1776 1202
1777 uint16_t app_id_size = strlen (app->id) + 1; 1203 uint16_t app_id_size = strlen (app->id) + 1;
1778 struct HostEnterRequest *hreq = GNUNET_malloc (sizeof (*hreq) + app_id_size); 1204 struct HostEnterRequest *hreq = GNUNET_malloc (sizeof (*hreq) + app_id_size);
@@ -1810,7 +1236,7 @@ GNUNET_SOCIAL_host_enter (const struct GNUNET_SOCIAL_App *app,
1810 */ 1236 */
1811 struct GNUNET_SOCIAL_Host * 1237 struct GNUNET_SOCIAL_Host *
1812GNUNET_SOCIAL_host_enter_reconnect (struct GNUNET_SOCIAL_HostConnection *hconn, 1238GNUNET_SOCIAL_host_enter_reconnect (struct GNUNET_SOCIAL_HostConnection *hconn,
1813 struct GNUNET_SOCIAL_Slicer *slicer, 1239 struct GNUNET_PSYC_Slicer *slicer,
1814 GNUNET_SOCIAL_HostEnterCallback enter_cb, 1240 GNUNET_SOCIAL_HostEnterCallback enter_cb,
1815 GNUNET_SOCIAL_AnswerDoorCallback answer_door_cb, 1241 GNUNET_SOCIAL_AnswerDoorCallback answer_door_cb,
1816 GNUNET_SOCIAL_FarewellCallback farewell_cb, 1242 GNUNET_SOCIAL_FarewellCallback farewell_cb,
@@ -1837,14 +1263,14 @@ GNUNET_SOCIAL_host_enter_reconnect (struct GNUNET_SOCIAL_HostConnection *hconn,
1837 GNUNET_CLIENT_MANAGER_set_user_context_ (plc->client, hst, sizeof (*plc)); 1263 GNUNET_CLIENT_MANAGER_set_user_context_ (plc->client, hst, sizeof (*plc));
1838 1264
1839 plc->tmit = GNUNET_PSYC_transmit_create (plc->client); 1265 plc->tmit = GNUNET_PSYC_transmit_create (plc->client);
1840 plc->recv = GNUNET_PSYC_receive_create (NULL, slicer_message, plc->slicer); 1266 plc->recv = GNUNET_PSYC_receive_create (NULL, GNUNET_PSYC_slicer_message, plc->slicer);
1841 1267
1842 hst->slicer = GNUNET_SOCIAL_slicer_create (); 1268 hst->slicer = GNUNET_PSYC_slicer_create ();
1843 GNUNET_SOCIAL_slicer_method_add (hst->slicer, "_notice_place_leave", 1269 GNUNET_PSYC_slicer_method_add (hst->slicer, "_notice_place_leave",
1844 host_recv_notice_place_leave_method, 1270 host_recv_notice_place_leave_method,
1845 host_recv_notice_place_leave_modifier, 1271 host_recv_notice_place_leave_modifier,
1846 NULL, host_recv_notice_place_leave_eom, hst); 1272 NULL, host_recv_notice_place_leave_eom, hst);
1847 hst->recv = GNUNET_PSYC_receive_create (NULL, slicer_message, hst->slicer); 1273 hst->recv = GNUNET_PSYC_receive_create (NULL, GNUNET_PSYC_slicer_message, hst->slicer);
1848 1274
1849 hreq->header.size = htons (sizeof (*hreq) + app_id_size); 1275 hreq->header.size = htons (sizeof (*hreq) + app_id_size);
1850 hreq->header.type = htons (GNUNET_MESSAGE_TYPE_SOCIAL_HOST_ENTER); 1276 hreq->header.type = htons (GNUNET_MESSAGE_TYPE_SOCIAL_HOST_ENTER);
@@ -1926,12 +1352,12 @@ GNUNET_SOCIAL_host_entry_decision (struct GNUNET_SOCIAL_Host *hst,
1926void 1352void
1927GNUNET_SOCIAL_host_eject (struct GNUNET_SOCIAL_Host *hst, 1353GNUNET_SOCIAL_host_eject (struct GNUNET_SOCIAL_Host *hst,
1928 const struct GNUNET_SOCIAL_Nym *nym, 1354 const struct GNUNET_SOCIAL_Nym *nym,
1929 struct GNUNET_ENV_Environment *env) 1355 struct GNUNET_PSYC_Environment *env)
1930{ 1356{
1931 if (NULL == env) 1357 if (NULL == env)
1932 env = GNUNET_ENV_environment_create (); 1358 env = GNUNET_PSYC_env_create ();
1933 GNUNET_ENV_environment_add (env, GNUNET_ENV_OP_SET, 1359 GNUNET_PSYC_env_add (env, GNUNET_PSYC_OP_SET,
1934 "_nym", &nym->pub_key, sizeof (nym->pub_key)); 1360 "_nym", &nym->pub_key, sizeof (nym->pub_key));
1935 GNUNET_SOCIAL_host_announce (hst, "_notice_place_leave", env, NULL, NULL, 1361 GNUNET_SOCIAL_host_announce (hst, "_notice_place_leave", env, NULL, NULL,
1936 GNUNET_SOCIAL_ANNOUNCE_NONE); 1362 GNUNET_SOCIAL_ANNOUNCE_NONE);
1937} 1363}
@@ -2033,7 +1459,7 @@ GNUNET_SOCIAL_nym_get_pub_key_hash (const struct GNUNET_SOCIAL_Nym *nym)
2033struct GNUNET_SOCIAL_Announcement * 1459struct GNUNET_SOCIAL_Announcement *
2034GNUNET_SOCIAL_host_announce (struct GNUNET_SOCIAL_Host *hst, 1460GNUNET_SOCIAL_host_announce (struct GNUNET_SOCIAL_Host *hst,
2035 const char *method_name, 1461 const char *method_name,
2036 const struct GNUNET_ENV_Environment *env, 1462 const struct GNUNET_PSYC_Environment *env,
2037 GNUNET_PSYC_TransmitNotifyData notify_data, 1463 GNUNET_PSYC_TransmitNotifyData notify_data,
2038 void *notify_data_cls, 1464 void *notify_data_cls,
2039 enum GNUNET_SOCIAL_AnnounceFlags flags) 1465 enum GNUNET_SOCIAL_AnnounceFlags flags)
@@ -2152,7 +1578,7 @@ GNUNET_SOCIAL_host_disconnect (struct GNUNET_SOCIAL_Host *hst,
2152 */ 1578 */
2153void 1579void
2154GNUNET_SOCIAL_host_leave (struct GNUNET_SOCIAL_Host *hst, 1580GNUNET_SOCIAL_host_leave (struct GNUNET_SOCIAL_Host *hst,
2155 const struct GNUNET_ENV_Environment *env, 1581 const struct GNUNET_PSYC_Environment *env,
2156 GNUNET_ContinuationCallback disconnect_cb, 1582 GNUNET_ContinuationCallback disconnect_cb,
2157 void *cls) 1583 void *cls)
2158{ 1584{
@@ -2242,7 +1668,7 @@ GNUNET_SOCIAL_guest_enter (const struct GNUNET_SOCIAL_App *app,
2242 uint32_t relay_count, 1668 uint32_t relay_count,
2243 const struct GNUNET_PeerIdentity *relays, 1669 const struct GNUNET_PeerIdentity *relays,
2244 const struct GNUNET_PSYC_Message *entry_msg, 1670 const struct GNUNET_PSYC_Message *entry_msg,
2245 struct GNUNET_SOCIAL_Slicer *slicer, 1671 struct GNUNET_PSYC_Slicer *slicer,
2246 GNUNET_SOCIAL_GuestEnterCallback local_enter_cb, 1672 GNUNET_SOCIAL_GuestEnterCallback local_enter_cb,
2247 GNUNET_SOCIAL_EntryDecisionCallback entry_dcsn_cb, 1673 GNUNET_SOCIAL_EntryDecisionCallback entry_dcsn_cb,
2248 void *cls) 1674 void *cls)
@@ -2264,7 +1690,7 @@ GNUNET_SOCIAL_guest_enter (const struct GNUNET_SOCIAL_App *app,
2264 GNUNET_CLIENT_MANAGER_set_user_context_ (plc->client, gst, sizeof (*plc)); 1690 GNUNET_CLIENT_MANAGER_set_user_context_ (plc->client, gst, sizeof (*plc));
2265 1691
2266 plc->tmit = GNUNET_PSYC_transmit_create (plc->client); 1692 plc->tmit = GNUNET_PSYC_transmit_create (plc->client);
2267 plc->recv = GNUNET_PSYC_receive_create (NULL, slicer_message, plc->slicer); 1693 plc->recv = GNUNET_PSYC_receive_create (NULL, GNUNET_PSYC_slicer_message, plc->slicer);
2268 1694
2269 struct GuestEnterRequest * 1695 struct GuestEnterRequest *
2270 greq = guest_enter_request_create (app->id, &ego->pub_key, &plc->pub_key, 1696 greq = guest_enter_request_create (app->id, &ego->pub_key, &plc->pub_key,
@@ -2307,7 +1733,7 @@ GNUNET_SOCIAL_guest_enter_by_name (const struct GNUNET_SOCIAL_App *app,
2307 const char *gns_name, 1733 const char *gns_name,
2308 const char *password, 1734 const char *password,
2309 const struct GNUNET_PSYC_Message *join_msg, 1735 const struct GNUNET_PSYC_Message *join_msg,
2310 struct GNUNET_SOCIAL_Slicer *slicer, 1736 struct GNUNET_PSYC_Slicer *slicer,
2311 GNUNET_SOCIAL_GuestEnterCallback local_enter_cb, 1737 GNUNET_SOCIAL_GuestEnterCallback local_enter_cb,
2312 GNUNET_SOCIAL_EntryDecisionCallback entry_decision_cb, 1738 GNUNET_SOCIAL_EntryDecisionCallback entry_decision_cb,
2313 void *cls) 1739 void *cls)
@@ -2356,7 +1782,7 @@ GNUNET_SOCIAL_guest_enter_by_name (const struct GNUNET_SOCIAL_App *app,
2356 GNUNET_CLIENT_MANAGER_set_user_context_ (plc->client, gst, sizeof (*plc)); 1782 GNUNET_CLIENT_MANAGER_set_user_context_ (plc->client, gst, sizeof (*plc));
2357 1783
2358 plc->tmit = GNUNET_PSYC_transmit_create (plc->client); 1784 plc->tmit = GNUNET_PSYC_transmit_create (plc->client);
2359 plc->recv = GNUNET_PSYC_receive_create (NULL, slicer_message, plc->slicer); 1785 plc->recv = GNUNET_PSYC_receive_create (NULL, GNUNET_PSYC_slicer_message, plc->slicer);
2360 1786
2361 plc->connect_msg = &greq->header; 1787 plc->connect_msg = &greq->header;
2362 place_send_connect_msg (plc); 1788 place_send_connect_msg (plc);
@@ -2385,7 +1811,7 @@ GNUNET_SOCIAL_guest_enter_by_name (const struct GNUNET_SOCIAL_App *app,
2385struct GNUNET_SOCIAL_Guest * 1811struct GNUNET_SOCIAL_Guest *
2386GNUNET_SOCIAL_guest_enter_reconnect (struct GNUNET_SOCIAL_GuestConnection *gconn, 1812GNUNET_SOCIAL_guest_enter_reconnect (struct GNUNET_SOCIAL_GuestConnection *gconn,
2387 enum GNUNET_PSYC_SlaveJoinFlags flags, 1813 enum GNUNET_PSYC_SlaveJoinFlags flags,
2388 struct GNUNET_SOCIAL_Slicer *slicer, 1814 struct GNUNET_PSYC_Slicer *slicer,
2389 GNUNET_SOCIAL_GuestEnterCallback local_enter_cb, 1815 GNUNET_SOCIAL_GuestEnterCallback local_enter_cb,
2390 void *cls) 1816 void *cls)
2391{ 1817{
@@ -2416,7 +1842,7 @@ GNUNET_SOCIAL_guest_enter_reconnect (struct GNUNET_SOCIAL_GuestConnection *gconn
2416 GNUNET_CLIENT_MANAGER_set_user_context_ (plc->client, gst, sizeof (*plc)); 1842 GNUNET_CLIENT_MANAGER_set_user_context_ (plc->client, gst, sizeof (*plc));
2417 1843
2418 plc->tmit = GNUNET_PSYC_transmit_create (plc->client); 1844 plc->tmit = GNUNET_PSYC_transmit_create (plc->client);
2419 plc->recv = GNUNET_PSYC_receive_create (NULL, slicer_message, plc->slicer); 1845 plc->recv = GNUNET_PSYC_receive_create (NULL, GNUNET_PSYC_slicer_message, plc->slicer);
2420 1846
2421 plc->connect_msg = &greq->header; 1847 plc->connect_msg = &greq->header;
2422 place_send_connect_msg (plc); 1848 place_send_connect_msg (plc);
@@ -2448,7 +1874,7 @@ GNUNET_SOCIAL_guest_enter_reconnect (struct GNUNET_SOCIAL_GuestConnection *gconn
2448struct GNUNET_SOCIAL_TalkRequest * 1874struct GNUNET_SOCIAL_TalkRequest *
2449GNUNET_SOCIAL_guest_talk (struct GNUNET_SOCIAL_Guest *gst, 1875GNUNET_SOCIAL_guest_talk (struct GNUNET_SOCIAL_Guest *gst,
2450 const char *method_name, 1876 const char *method_name,
2451 const struct GNUNET_ENV_Environment *env, 1877 const struct GNUNET_PSYC_Environment *env,
2452 GNUNET_PSYC_TransmitNotifyData notify_data, 1878 GNUNET_PSYC_TransmitNotifyData notify_data,
2453 void *notify_data_cls, 1879 void *notify_data_cls,
2454 enum GNUNET_SOCIAL_TalkFlags flags) 1880 enum GNUNET_SOCIAL_TalkFlags flags)
@@ -2526,7 +1952,7 @@ GNUNET_SOCIAL_guest_disconnect (struct GNUNET_SOCIAL_Guest *gst,
2526 */ 1952 */
2527void 1953void
2528GNUNET_SOCIAL_guest_leave (struct GNUNET_SOCIAL_Guest *gst, 1954GNUNET_SOCIAL_guest_leave (struct GNUNET_SOCIAL_Guest *gst,
2529 struct GNUNET_ENV_Environment *env, 1955 struct GNUNET_PSYC_Environment *env,
2530 GNUNET_ContinuationCallback disconnect_cb, 1956 GNUNET_ContinuationCallback disconnect_cb,
2531 void *cls) 1957 void *cls)
2532{ 1958{
@@ -2575,14 +2001,14 @@ place_history_replay (struct GNUNET_SOCIAL_Place *plc,
2575 uint64_t message_limit, 2001 uint64_t message_limit,
2576 const char *method_prefix, 2002 const char *method_prefix,
2577 uint32_t flags, 2003 uint32_t flags,
2578 struct GNUNET_SOCIAL_Slicer *slicer, 2004 struct GNUNET_PSYC_Slicer *slicer,
2579 GNUNET_ResultCallback result_cb, 2005 GNUNET_ResultCallback result_cb,
2580 void *cls) 2006 void *cls)
2581{ 2007{
2582 struct GNUNET_PSYC_HistoryRequestMessage *req; 2008 struct GNUNET_PSYC_HistoryRequestMessage *req;
2583 struct GNUNET_SOCIAL_HistoryRequest *hist = GNUNET_malloc (sizeof (*hist)); 2009 struct GNUNET_SOCIAL_HistoryRequest *hist = GNUNET_malloc (sizeof (*hist));
2584 hist->plc = plc; 2010 hist->plc = plc;
2585 hist->recv = GNUNET_PSYC_receive_create (NULL, slicer_message, slicer); 2011 hist->recv = GNUNET_PSYC_receive_create (NULL, GNUNET_PSYC_slicer_message, slicer);
2586 hist->result_cb = result_cb; 2012 hist->result_cb = result_cb;
2587 hist->cls = cls; 2013 hist->cls = cls;
2588 hist->op_id = GNUNET_CLIENT_MANAGER_op_add (plc->client, 2014 hist->op_id = GNUNET_CLIENT_MANAGER_op_add (plc->client,
@@ -2638,7 +2064,7 @@ GNUNET_SOCIAL_place_history_replay (struct GNUNET_SOCIAL_Place *plc,
2638 uint64_t end_message_id, 2064 uint64_t end_message_id,
2639 const char *method_prefix, 2065 const char *method_prefix,
2640 uint32_t flags, 2066 uint32_t flags,
2641 struct GNUNET_SOCIAL_Slicer *slicer, 2067 struct GNUNET_PSYC_Slicer *slicer,
2642 GNUNET_ResultCallback result_cb, 2068 GNUNET_ResultCallback result_cb,
2643 void *cls) 2069 void *cls)
2644{ 2070{
@@ -2674,7 +2100,7 @@ GNUNET_SOCIAL_place_history_replay_latest (struct GNUNET_SOCIAL_Place *plc,
2674 uint64_t message_limit, 2100 uint64_t message_limit,
2675 const char *method_prefix, 2101 const char *method_prefix,
2676 uint32_t flags, 2102 uint32_t flags,
2677 struct GNUNET_SOCIAL_Slicer *slicer, 2103 struct GNUNET_PSYC_Slicer *slicer,
2678 GNUNET_ResultCallback result_cb, 2104 GNUNET_ResultCallback result_cb,
2679 void *cls) 2105 void *cls)
2680{ 2106{
diff --git a/src/social/test_social.c b/src/social/test_social.c
index 1fb9cc568..925fff03e 100644
--- a/src/social/test_social.c
+++ b/src/social/test_social.c
@@ -30,7 +30,6 @@
30#include "gnunet_common.h" 30#include "gnunet_common.h"
31#include "gnunet_util_lib.h" 31#include "gnunet_util_lib.h"
32#include "gnunet_testing_lib.h" 32#include "gnunet_testing_lib.h"
33#include "gnunet_env_lib.h"
34#include "gnunet_psyc_util_lib.h" 33#include "gnunet_psyc_util_lib.h"
35#include "gnunet_social_service.h" 34#include "gnunet_social_service.h"
36#include "gnunet_core_service.h" 35#include "gnunet_core_service.h"
@@ -75,8 +74,8 @@ struct GNUNET_HashCode place_pub_hash;
75struct GNUNET_CRYPTO_EcdsaPublicKey guest_pub_key; 74struct GNUNET_CRYPTO_EcdsaPublicKey guest_pub_key;
76struct GNUNET_CRYPTO_EcdsaPublicKey host_pub_key; 75struct GNUNET_CRYPTO_EcdsaPublicKey host_pub_key;
77 76
78struct GNUNET_SOCIAL_Slicer *host_slicer; 77struct GNUNET_PSYC_Slicer *host_slicer;
79struct GNUNET_SOCIAL_Slicer *guest_slicer; 78struct GNUNET_PSYC_Slicer *guest_slicer;
80 79
81struct GNUNET_SOCIAL_Host *hst; 80struct GNUNET_SOCIAL_Host *hst;
82struct GNUNET_SOCIAL_Guest *gst; 81struct GNUNET_SOCIAL_Guest *gst;
@@ -90,7 +89,7 @@ struct GuestEnterMessage
90{ 89{
91 struct GNUNET_PSYC_Message *msg; 90 struct GNUNET_PSYC_Message *msg;
92 const char *method_name; 91 const char *method_name;
93 struct GNUNET_ENV_Environment *env; 92 struct GNUNET_PSYC_Environment *env;
94 void *data; 93 void *data;
95 uint16_t data_size; 94 uint16_t data_size;
96} guest_enter_msg; 95} guest_enter_msg;
@@ -99,7 +98,7 @@ struct TransmitClosure
99{ 98{
100 struct GNUNET_SOCIAL_Announcement *host_ann; 99 struct GNUNET_SOCIAL_Announcement *host_ann;
101 struct GNUNET_SOCIAL_TalkRequest *guest_talk; 100 struct GNUNET_SOCIAL_TalkRequest *guest_talk;
102 struct GNUNET_ENV_Environment *env; 101 struct GNUNET_PSYC_Environment *env;
103 char *data[16]; 102 char *data[16];
104 uint8_t data_delay[16]; 103 uint8_t data_delay[16];
105 uint8_t data_count; 104 uint8_t data_count;
@@ -156,7 +155,7 @@ static void
156host_answer_door (void *cls, 155host_answer_door (void *cls,
157 struct GNUNET_SOCIAL_Nym *nym, 156 struct GNUNET_SOCIAL_Nym *nym,
158 const char *method_name, 157 const char *method_name,
159 struct GNUNET_ENV_Environment *env, 158 struct GNUNET_PSYC_Environment *env,
160 size_t data_size, 159 size_t data_size,
161 const void *data); 160 const void *data);
162 161
@@ -199,13 +198,13 @@ cleanup ()
199 198
200 if (NULL != guest_slicer) 199 if (NULL != guest_slicer)
201 { 200 {
202 GNUNET_SOCIAL_slicer_destroy (guest_slicer); 201 GNUNET_PSYC_slicer_destroy (guest_slicer);
203 guest_slicer = NULL; 202 guest_slicer = NULL;
204 } 203 }
205 204
206 if (NULL != host_slicer) 205 if (NULL != host_slicer)
207 { 206 {
208 GNUNET_SOCIAL_slicer_destroy (host_slicer); 207 GNUNET_PSYC_slicer_destroy (host_slicer);
209 host_slicer = NULL; 208 host_slicer = NULL;
210 } 209 }
211 210
@@ -292,7 +291,7 @@ notify_data (void *cls, uint16_t *data_size, void *data)
292 struct TransmitClosure *tmit = cls; 291 struct TransmitClosure *tmit = cls;
293 if (NULL != tmit->env) 292 if (NULL != tmit->env)
294 { 293 {
295 GNUNET_ENV_environment_destroy (tmit->env); 294 GNUNET_PSYC_env_destroy (tmit->env);
296 tmit->env = NULL; 295 tmit->env = NULL;
297 } 296 }
298 if (0 == tmit->data_count) 297 if (0 == tmit->data_count)
@@ -355,7 +354,7 @@ schedule_host_leave (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
355static void 354static void
356host_farewell2 (void *cls, 355host_farewell2 (void *cls,
357 const struct GNUNET_SOCIAL_Nym *nym, 356 const struct GNUNET_SOCIAL_Nym *nym,
358 struct GNUNET_ENV_Environment *env) 357 struct GNUNET_PSYC_Environment *env)
359{ 358{
360 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 359 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
361 "Nym left the place again.\n"); 360 "Nym left the place again.\n");
@@ -526,7 +525,7 @@ zone_add_place ()
526static void 525static void
527host_farewell (void *cls, 526host_farewell (void *cls,
528 const struct GNUNET_SOCIAL_Nym *nym, 527 const struct GNUNET_SOCIAL_Nym *nym,
529 struct GNUNET_ENV_Environment *env) 528 struct GNUNET_PSYC_Environment *env)
530{ 529{
531 const struct GNUNET_CRYPTO_EcdsaPublicKey * 530 const struct GNUNET_CRYPTO_EcdsaPublicKey *
532 nym_key = GNUNET_SOCIAL_nym_get_pub_key (nym); 531 nym_key = GNUNET_SOCIAL_nym_get_pub_key (nym);
@@ -536,7 +535,7 @@ host_farewell (void *cls,
536 "Farewell: nym %s (%s) has left the place.\n", 535 "Farewell: nym %s (%s) has left the place.\n",
537 GNUNET_h2s (GNUNET_SOCIAL_nym_get_pub_key_hash (nym)), str); 536 GNUNET_h2s (GNUNET_SOCIAL_nym_get_pub_key_hash (nym)), str);
538 GNUNET_free (str); 537 GNUNET_free (str);
539 GNUNET_assert (1 == GNUNET_ENV_environment_get_count (env)); 538 GNUNET_assert (1 == GNUNET_PSYC_env_get_count (env));
540 if (0 != memcmp (&guest_pub_key, nym_key, sizeof (*nym_key))) 539 if (0 != memcmp (&guest_pub_key, nym_key, sizeof (*nym_key)))
541 { 540 {
542 str = GNUNET_CRYPTO_ecdsa_public_key_to_string (&guest_pub_key); 541 str = GNUNET_CRYPTO_ecdsa_public_key_to_string (&guest_pub_key);
@@ -565,11 +564,11 @@ guest_leave()
565 else 564 else
566 test = TEST_GUEST_LEAVE2; 565 test = TEST_GUEST_LEAVE2;
567 566
568 struct GNUNET_ENV_Environment *env = GNUNET_ENV_environment_create (); 567 struct GNUNET_PSYC_Environment *env = GNUNET_PSYC_env_create ();
569 GNUNET_ENV_environment_add (env, GNUNET_ENV_OP_SET, 568 GNUNET_PSYC_env_add (env, GNUNET_PSYC_OP_SET,
570 "_message", DATA2ARG ("Leaving.")); 569 "_message", DATA2ARG ("Leaving."));
571 GNUNET_SOCIAL_guest_leave (gst, env, &guest_left, NULL); 570 GNUNET_SOCIAL_guest_leave (gst, env, &guest_left, NULL);
572 GNUNET_ENV_environment_destroy (env); 571 GNUNET_PSYC_env_destroy (env);
573 gst = NULL; 572 gst = NULL;
574 gst_plc = NULL; 573 gst_plc = NULL;
575} 574}
@@ -723,7 +722,7 @@ guest_recv_method (void *cls,
723 const struct GNUNET_PSYC_MessageMethod *meth, 722 const struct GNUNET_PSYC_MessageMethod *meth,
724 uint64_t message_id, 723 uint64_t message_id,
725 uint32_t flags, 724 uint32_t flags,
726 const struct GNUNET_SOCIAL_Nym *nym, 725 const struct GNUNET_CRYPTO_EcdsaPublicKey *nym_pub_key,
727 const char *method_name) 726 const char *method_name)
728{ 727{
729 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 728 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -738,7 +737,7 @@ static void
738guest_recv_modifier (void *cls, 737guest_recv_modifier (void *cls,
739 const struct GNUNET_MessageHeader *msg, 738 const struct GNUNET_MessageHeader *msg,
740 uint64_t message_id, 739 uint64_t message_id,
741 enum GNUNET_ENV_Operator oper, 740 enum GNUNET_PSYC_Operator oper,
742 const char *name, 741 const char *name,
743 const void *value, 742 const void *value,
744 uint16_t value_size, 743 uint16_t value_size,
@@ -755,7 +754,7 @@ static void
755guest_recv_mod_foo_bar (void *cls, 754guest_recv_mod_foo_bar (void *cls,
756 const struct GNUNET_MessageHeader *msg, 755 const struct GNUNET_MessageHeader *msg,
757 uint64_t message_id, 756 uint64_t message_id,
758 enum GNUNET_ENV_Operator oper, 757 enum GNUNET_PSYC_Operator oper,
759 const char *name, 758 const char *name,
760 const void *value, 759 const void *value,
761 uint16_t value_size, 760 uint16_t value_size,
@@ -833,7 +832,7 @@ host_recv_method (void *cls,
833 const struct GNUNET_PSYC_MessageMethod *meth, 832 const struct GNUNET_PSYC_MessageMethod *meth,
834 uint64_t message_id, 833 uint64_t message_id,
835 uint32_t flags, 834 uint32_t flags,
836 const struct GNUNET_SOCIAL_Nym *nym, 835 const struct GNUNET_CRYPTO_EcdsaPublicKey *nym_pub_key,
837 const char *method_name) 836 const char *method_name)
838{ 837{
839 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 838 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -848,7 +847,7 @@ static void
848host_recv_modifier (void *cls, 847host_recv_modifier (void *cls,
849 const struct GNUNET_MessageHeader *msg, 848 const struct GNUNET_MessageHeader *msg,
850 uint64_t message_id, 849 uint64_t message_id,
851 enum GNUNET_ENV_Operator oper, 850 enum GNUNET_PSYC_Operator oper,
852 const char *name, 851 const char *name,
853 const void *value, 852 const void *value,
854 uint16_t value_size, 853 uint16_t value_size,
@@ -924,11 +923,11 @@ guest_talk ()
924 test = TEST_GUEST_TALK; 923 test = TEST_GUEST_TALK;
925 924
926 tmit = (struct TransmitClosure) {}; 925 tmit = (struct TransmitClosure) {};
927 tmit.env = GNUNET_ENV_environment_create (); 926 tmit.env = GNUNET_PSYC_env_create ();
928 GNUNET_ENV_environment_add (tmit.env, GNUNET_ENV_OP_ASSIGN, 927 GNUNET_PSYC_env_add (tmit.env, GNUNET_PSYC_OP_ASSIGN,
929 "_bar_foo", DATA2ARG ("one two three")); 928 "_bar_foo", DATA2ARG ("one two three"));
930 GNUNET_ENV_environment_add (tmit.env, GNUNET_ENV_OP_ASSIGN, 929 GNUNET_PSYC_env_add (tmit.env, GNUNET_PSYC_OP_ASSIGN,
931 "_bar_baz", DATA2ARG ("four five")); 930 "_bar_baz", DATA2ARG ("four five"));
932 tmit.data[0] = "zzz xxx yyy"; 931 tmit.data[0] = "zzz xxx yyy";
933 tmit.data[1] = "zyx wvu tsr qpo"; 932 tmit.data[1] = "zyx wvu tsr qpo";
934 tmit.data_delay[1] = 1; 933 tmit.data_delay[1] = 1;
@@ -951,13 +950,13 @@ host_announce ()
951 "Test #%u: Host announcement.\n", test); 950 "Test #%u: Host announcement.\n", test);
952 951
953 tmit = (struct TransmitClosure) {}; 952 tmit = (struct TransmitClosure) {};
954 tmit.env = GNUNET_ENV_environment_create (); 953 tmit.env = GNUNET_PSYC_env_create ();
955 GNUNET_ENV_environment_add (tmit.env, GNUNET_ENV_OP_ASSIGN, 954 GNUNET_PSYC_env_add (tmit.env, GNUNET_PSYC_OP_ASSIGN,
956 "_foo", DATA2ARG ("bar baz")); 955 "_foo", DATA2ARG ("bar baz"));
957 GNUNET_ENV_environment_add (tmit.env, GNUNET_ENV_OP_ASSIGN, 956 GNUNET_PSYC_env_add (tmit.env, GNUNET_PSYC_OP_ASSIGN,
958 "_foo_bar", DATA2ARG ("foo bar")); 957 "_foo_bar", DATA2ARG ("foo bar"));
959 GNUNET_ENV_environment_add (tmit.env, GNUNET_ENV_OP_ASSIGN, 958 GNUNET_PSYC_env_add (tmit.env, GNUNET_PSYC_OP_ASSIGN,
960 "_foo_bar_baz", DATA2ARG ("foo bar baz")); 959 "_foo_bar_baz", DATA2ARG ("foo bar baz"));
961 tmit.data[0] = "aaa bbb ccc"; 960 tmit.data[0] = "aaa bbb ccc";
962 tmit.data[1] = "abc def ghi jkl"; 961 tmit.data[1] = "abc def ghi jkl";
963 tmit.data_delay[1] = 1; 962 tmit.data_delay[1] = 1;
@@ -976,8 +975,8 @@ static void
976host_announce2 () 975host_announce2 ()
977{ 976{
978 GNUNET_assert (2 == mod_foo_bar_rcls.n); 977 GNUNET_assert (2 == mod_foo_bar_rcls.n);
979 GNUNET_SOCIAL_slicer_modifier_remove (guest_slicer, "_foo_bar", 978 GNUNET_PSYC_slicer_modifier_remove (guest_slicer, "_foo_bar",
980 guest_recv_mod_foo_bar); 979 guest_recv_mod_foo_bar);
981 980
982 test = TEST_HOST_ANNOUNCE2; 981 test = TEST_HOST_ANNOUNCE2;
983 982
@@ -985,13 +984,13 @@ host_announce2 ()
985 "Test #%u: Host announcement 2.\n", test); 984 "Test #%u: Host announcement 2.\n", test);
986 985
987 tmit = (struct TransmitClosure) {}; 986 tmit = (struct TransmitClosure) {};
988 tmit.env = GNUNET_ENV_environment_create (); 987 tmit.env = GNUNET_PSYC_env_create ();
989 GNUNET_ENV_environment_add (tmit.env, GNUNET_ENV_OP_ASSIGN, 988 GNUNET_PSYC_env_add (tmit.env, GNUNET_PSYC_OP_ASSIGN,
990 "_foo2", DATA2ARG ("BAR BAZ")); 989 "_foo2", DATA2ARG ("BAR BAZ"));
991 GNUNET_ENV_environment_add (tmit.env, GNUNET_ENV_OP_ASSIGN, 990 GNUNET_PSYC_env_add (tmit.env, GNUNET_PSYC_OP_ASSIGN,
992 "_foo2_bar", DATA2ARG ("FOO BAR")); 991 "_foo2_bar", DATA2ARG ("FOO BAR"));
993 GNUNET_ENV_environment_add (tmit.env, GNUNET_ENV_OP_ASSIGN, 992 GNUNET_PSYC_env_add (tmit.env, GNUNET_PSYC_OP_ASSIGN,
994 "_foo2_bar", DATA2ARG ("FOO BAR BAZ")); 993 "_foo2_bar", DATA2ARG ("FOO BAR BAZ"));
995 tmit.data[0] = "AAA BBB CCC"; 994 tmit.data[0] = "AAA BBB CCC";
996 tmit.data[1] = "ABC DEF GHI JKL"; 995 tmit.data[1] = "ABC DEF GHI JKL";
997 tmit.data[2] = "TESTING ONE TWO THREE"; 996 tmit.data[2] = "TESTING ONE TWO THREE";
@@ -1015,7 +1014,7 @@ guest_recv_entry_decision (void *cls,
1015 1014
1016 if (NULL != entry_msg) 1015 if (NULL != entry_msg)
1017 { 1016 {
1018 struct GNUNET_ENV_Environment *env = GNUNET_ENV_environment_create (); 1017 struct GNUNET_PSYC_Environment *env = GNUNET_PSYC_env_create ();
1019 const char *method_name = NULL; 1018 const char *method_name = NULL;
1020 const void *data = NULL; 1019 const void *data = NULL;
1021 uint16_t data_size = 0; 1020 uint16_t data_size = 0;
@@ -1057,7 +1056,7 @@ static void
1057host_answer_door (void *cls, 1056host_answer_door (void *cls,
1058 struct GNUNET_SOCIAL_Nym *nym, 1057 struct GNUNET_SOCIAL_Nym *nym,
1059 const char *method_name, 1058 const char *method_name,
1060 struct GNUNET_ENV_Environment *env, 1059 struct GNUNET_PSYC_Environment *env,
1061 size_t data_size, 1060 size_t data_size,
1062 const void *data) 1061 const void *data)
1063{ 1062{
@@ -1113,11 +1112,11 @@ guest_enter ()
1113 struct GuestEnterMessage *emsg = &guest_enter_msg; 1112 struct GuestEnterMessage *emsg = &guest_enter_msg;
1114 1113
1115 emsg->method_name = "_request_enter"; 1114 emsg->method_name = "_request_enter";
1116 emsg->env = GNUNET_ENV_environment_create (); 1115 emsg->env = GNUNET_PSYC_env_create ();
1117 GNUNET_ENV_environment_add (emsg->env, GNUNET_ENV_OP_ASSIGN, 1116 GNUNET_PSYC_env_add (emsg->env, GNUNET_PSYC_OP_ASSIGN,
1118 "_abc", "abc def", 7); 1117 "_abc", "abc def", 7);
1119 GNUNET_ENV_environment_add (emsg->env, GNUNET_ENV_OP_ASSIGN, 1118 GNUNET_PSYC_env_add (emsg->env, GNUNET_PSYC_OP_ASSIGN,
1120 "_abc_def", "abc def ghi", 11); 1119 "_abc_def", "abc def ghi", 11);
1121 emsg->data = "let me in"; 1120 emsg->data = "let me in";
1122 emsg->data_size = strlen (emsg->data) + 1; 1121 emsg->data_size = strlen (emsg->data) + 1;
1123 emsg->msg = GNUNET_PSYC_message_create (emsg->method_name, emsg->env, 1122 emsg->msg = GNUNET_PSYC_message_create (emsg->method_name, emsg->env,
@@ -1142,11 +1141,11 @@ guest_enter_by_name ()
1142 struct GuestEnterMessage *emsg = &guest_enter_msg; 1141 struct GuestEnterMessage *emsg = &guest_enter_msg;
1143 1142
1144 emsg->method_name = "_request_enter"; 1143 emsg->method_name = "_request_enter";
1145 emsg->env = GNUNET_ENV_environment_create (); 1144 emsg->env = GNUNET_PSYC_env_create ();
1146 GNUNET_ENV_environment_add (emsg->env, GNUNET_ENV_OP_ASSIGN, 1145 GNUNET_PSYC_env_add (emsg->env, GNUNET_PSYC_OP_ASSIGN,
1147 "_abc", "abc def", 7); 1146 "_abc", "abc def", 7);
1148 GNUNET_ENV_environment_add (emsg->env, GNUNET_ENV_OP_ASSIGN, 1147 GNUNET_PSYC_env_add (emsg->env, GNUNET_PSYC_OP_ASSIGN,
1149 "_abc_def", "abc def ghi", 11); 1148 "_abc_def", "abc def ghi", 11);
1150 emsg->data = "let me in"; 1149 emsg->data = "let me in";
1151 emsg->data_size = strlen (emsg->data) + 1; 1150 emsg->data_size = strlen (emsg->data) + 1;
1152 emsg->msg = GNUNET_PSYC_message_create (emsg->method_name, emsg->env, 1151 emsg->msg = GNUNET_PSYC_message_create (emsg->method_name, emsg->env,
@@ -1175,12 +1174,12 @@ guest_init ()
1175{ 1174{
1176 guest_pub_key = *(GNUNET_SOCIAL_ego_get_pub_key (guest_ego)); 1175 guest_pub_key = *(GNUNET_SOCIAL_ego_get_pub_key (guest_ego));
1177 1176
1178 guest_slicer = GNUNET_SOCIAL_slicer_create (); 1177 guest_slicer = GNUNET_PSYC_slicer_create ();
1179 GNUNET_SOCIAL_slicer_method_add (guest_slicer, "", 1178 GNUNET_PSYC_slicer_method_add (guest_slicer, "",
1180 guest_recv_method, guest_recv_modifier, 1179 guest_recv_method, guest_recv_modifier,
1181 guest_recv_data, guest_recv_eom, NULL); 1180 guest_recv_data, guest_recv_eom, NULL);
1182 GNUNET_SOCIAL_slicer_modifier_add (guest_slicer, "_foo_bar", 1181 GNUNET_PSYC_slicer_modifier_add (guest_slicer, "_foo_bar",
1183 guest_recv_mod_foo_bar, &mod_foo_bar_rcls); 1182 guest_recv_mod_foo_bar, &mod_foo_bar_rcls);
1184 test = TEST_HOST_ANSWER_DOOR_ADMIT; 1183 test = TEST_HOST_ANSWER_DOOR_ADMIT;
1185 1184
1186 GNUNET_SOCIAL_zone_add_nym (app, guest_ego, "host", &host_pub_key, 1185 GNUNET_SOCIAL_zone_add_nym (app, guest_ego, "host", &host_pub_key,
@@ -1224,10 +1223,10 @@ host_entered (void *cls, int result,
1224static void 1223static void
1225host_enter () 1224host_enter ()
1226{ 1225{
1227 host_slicer = GNUNET_SOCIAL_slicer_create (); 1226 host_slicer = GNUNET_PSYC_slicer_create ();
1228 GNUNET_SOCIAL_slicer_method_add (host_slicer, "", 1227 GNUNET_PSYC_slicer_method_add (host_slicer, "",
1229 &host_recv_method, &host_recv_modifier, 1228 &host_recv_method, &host_recv_modifier,
1230 &host_recv_data, &host_recv_eom, NULL); 1229 &host_recv_data, &host_recv_eom, NULL);
1231 1230
1232 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Entering to place as host.\n"); 1231 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Entering to place as host.\n");
1233 test = TEST_HOST_ENTER; 1232 test = TEST_HOST_ENTER;