diff options
Diffstat (limited to 'src/social/gnunet-service-social.c')
-rw-r--r-- | src/social/gnunet-service-social.c | 379 |
1 files changed, 299 insertions, 80 deletions
diff --git a/src/social/gnunet-service-social.c b/src/social/gnunet-service-social.c index d4dfe9b0f..f3eacd6f9 100644 --- a/src/social/gnunet-service-social.c +++ b/src/social/gnunet-service-social.c | |||
@@ -229,10 +229,10 @@ struct Place | |||
229 | */ | 229 | */ |
230 | struct GNUNET_HashCode ego_pub_hash; | 230 | struct GNUNET_HashCode ego_pub_hash; |
231 | 231 | ||
232 | uint64_t file_message_id; | 232 | /** |
233 | uint64_t file_fragment_offset; | 233 | * Slicer for processing incoming messages. |
234 | uint64_t file_size; | 234 | */ |
235 | uint64_t file_offset; | 235 | struct GNUNET_PSYC_Slicer *slicer; |
236 | 236 | ||
237 | /** | 237 | /** |
238 | * Last message ID received for the place. | 238 | * Last message ID received for the place. |
@@ -241,6 +241,16 @@ struct Place | |||
241 | uint64_t max_message_id; | 241 | uint64_t max_message_id; |
242 | 242 | ||
243 | /** | 243 | /** |
244 | * Offset where the file is currently being written. | ||
245 | */ | ||
246 | uint64_t file_offset; | ||
247 | |||
248 | /** | ||
249 | * Whether or not to save the file (#GNUNET_YES or #GNUNET_NO) | ||
250 | */ | ||
251 | uint8_t file_save; | ||
252 | |||
253 | /** | ||
244 | * Is this a host (#GNUNET_YES), or guest (#GNUNET_NO)? | 254 | * Is this a host (#GNUNET_YES), or guest (#GNUNET_NO)? |
245 | */ | 255 | */ |
246 | uint8_t is_host; | 256 | uint8_t is_host; |
@@ -509,6 +519,8 @@ cleanup_place (struct Place *plc) | |||
509 | (GNUNET_YES == plc->is_host) | 519 | (GNUNET_YES == plc->is_host) |
510 | ? cleanup_host ((struct Host *) plc) | 520 | ? cleanup_host ((struct Host *) plc) |
511 | : cleanup_guest ((struct Guest *) plc); | 521 | : cleanup_guest ((struct Guest *) plc); |
522 | |||
523 | GNUNET_PSYC_slicer_destroy (plc->slicer); | ||
512 | GNUNET_free (plc); | 524 | GNUNET_free (plc); |
513 | } | 525 | } |
514 | 526 | ||
@@ -728,34 +740,132 @@ psyc_recv_join_dcsn (void *cls, | |||
728 | place_send_msg (&gst->plc, &dcsn->header); | 740 | place_send_msg (&gst->plc, &dcsn->header); |
729 | } | 741 | } |
730 | 742 | ||
743 | |||
731 | /** | 744 | /** |
732 | * Save _file data to disk. | 745 | * Called when a PSYC master or slave receives a message. |
733 | */ | 746 | */ |
734 | void | 747 | static void |
735 | psyc_recv_file (struct Place *plc, const struct GNUNET_PSYC_MessageHeader *msg, | 748 | psyc_recv_message (void *cls, |
736 | uint32_t flags, uint64_t message_id, uint64_t fragment_offset, | 749 | uint64_t message_id, |
737 | const char *method_name, struct GNUNET_PSYC_Environment *env, | 750 | uint32_t flags, |
738 | const void *data, uint16_t data_size) | 751 | const struct GNUNET_PSYC_MessageHeader *msg) |
752 | { | ||
753 | struct Place *plc = cls; | ||
754 | |||
755 | char *str = GNUNET_CRYPTO_ecdsa_public_key_to_string (&msg->slave_pub_key); | ||
756 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
757 | "%p Received PSYC message of size %u from %s.\n", | ||
758 | plc, ntohs (msg->header.size), str); | ||
759 | GNUNET_free (str); | ||
760 | |||
761 | GNUNET_PSYC_slicer_message (plc->slicer, msg); | ||
762 | |||
763 | place_send_msg (plc, &msg->header); | ||
764 | } | ||
765 | |||
766 | |||
767 | static void | ||
768 | place_recv_relay_method (void *cls, | ||
769 | const struct GNUNET_PSYC_MessageMethod *meth, | ||
770 | uint64_t message_id, | ||
771 | uint32_t flags, | ||
772 | const struct GNUNET_CRYPTO_EcdsaPublicKey *nym_pub_key, | ||
773 | const char *method_name) | ||
774 | { | ||
775 | struct Host *hst = cls; | ||
776 | struct Place *plc = &hst->plc; | ||
777 | |||
778 | // FIXME: relay message | ||
779 | } | ||
780 | |||
781 | |||
782 | static void | ||
783 | place_recv_relay_modifier (void *cls, | ||
784 | const struct GNUNET_MessageHeader *msg, | ||
785 | uint64_t message_id, | ||
786 | enum GNUNET_PSYC_Operator oper, | ||
787 | const char *name, | ||
788 | const void *value, | ||
789 | uint16_t value_size, | ||
790 | uint16_t full_value_size) | ||
739 | { | 791 | { |
740 | if (plc->file_message_id != message_id) | ||
741 | { | ||
742 | if (0 != fragment_offset) | ||
743 | { | ||
744 | /* unexpected message ID */ | ||
745 | GNUNET_break (0); | ||
746 | return; | ||
747 | } | ||
748 | 792 | ||
749 | /* new file */ | 793 | } |
750 | plc->file_offset = 0; | 794 | |
795 | |||
796 | static void | ||
797 | place_recv_relay_eom (void *cls, | ||
798 | const struct GNUNET_MessageHeader *msg, | ||
799 | uint64_t message_id, | ||
800 | uint8_t cancelled) | ||
801 | { | ||
802 | |||
803 | } | ||
804 | |||
805 | |||
806 | static void | ||
807 | place_recv_relay_data (void *cls, | ||
808 | const struct GNUNET_MessageHeader *msg, | ||
809 | uint64_t message_id, | ||
810 | uint64_t data_offset, | ||
811 | const void *data, | ||
812 | uint16_t data_size) | ||
813 | { | ||
814 | |||
815 | } | ||
816 | |||
817 | |||
818 | static void | ||
819 | place_recv_save_method (void *cls, | ||
820 | const struct GNUNET_PSYC_MessageMethod *meth, | ||
821 | uint64_t message_id, | ||
822 | uint32_t flags, | ||
823 | const struct GNUNET_CRYPTO_EcdsaPublicKey *nym_pub_key, | ||
824 | const char *method_name) | ||
825 | { | ||
826 | struct Place *plc = cls; | ||
827 | plc->file_offset = 0; | ||
828 | plc->file_save = GNUNET_NO; | ||
829 | |||
830 | struct GNUNET_CRYPTO_HashAsciiEncoded place_pub_hash_ascii; | ||
831 | memcpy (&place_pub_hash_ascii.encoding, | ||
832 | GNUNET_h2s_full (&plc->pub_key_hash), sizeof (place_pub_hash_ascii)); | ||
833 | |||
834 | char *filename = NULL; | ||
835 | GNUNET_asprintf (&filename, "%s%c%s%c%s%c%.part" PRIu64, | ||
836 | dir_social, DIR_SEPARATOR, | ||
837 | "files", DIR_SEPARATOR, | ||
838 | place_pub_hash_ascii.encoding, DIR_SEPARATOR, | ||
839 | message_id); | ||
840 | |||
841 | /* save if does not already exist */ | ||
842 | if (GNUNET_NO == GNUNET_DISK_file_test (filename)) | ||
843 | { | ||
844 | plc->file_save = GNUNET_YES; | ||
751 | } | 845 | } |
752 | 846 | ||
847 | GNUNET_free (filename); | ||
848 | } | ||
849 | |||
850 | |||
851 | static void | ||
852 | place_recv_save_data (void *cls, | ||
853 | const struct GNUNET_MessageHeader *msg, | ||
854 | uint64_t message_id, | ||
855 | uint64_t data_offset, | ||
856 | const void *data, | ||
857 | uint16_t data_size) | ||
858 | { | ||
859 | struct Place *plc = cls; | ||
860 | if (GNUNET_YES != plc->file_save) | ||
861 | return; | ||
862 | |||
753 | struct GNUNET_CRYPTO_HashAsciiEncoded place_pub_hash_ascii; | 863 | struct GNUNET_CRYPTO_HashAsciiEncoded place_pub_hash_ascii; |
754 | memcpy (&place_pub_hash_ascii.encoding, | 864 | memcpy (&place_pub_hash_ascii.encoding, |
755 | GNUNET_h2s_full (&plc->pub_key_hash), sizeof (place_pub_hash_ascii)); | 865 | GNUNET_h2s_full (&plc->pub_key_hash), sizeof (place_pub_hash_ascii)); |
756 | 866 | ||
757 | char *filename = NULL; | 867 | char *filename = NULL; |
758 | GNUNET_asprintf (&filename, "%s%c%s%c%s%c%" PRIu64, | 868 | GNUNET_asprintf (&filename, "%s%c%s%c%s%c%.part" PRIu64, |
759 | dir_social, DIR_SEPARATOR, | 869 | dir_social, DIR_SEPARATOR, |
760 | "files", DIR_SEPARATOR, | 870 | "files", DIR_SEPARATOR, |
761 | place_pub_hash_ascii.encoding, DIR_SEPARATOR, | 871 | place_pub_hash_ascii.encoding, DIR_SEPARATOR, |
@@ -774,50 +884,38 @@ psyc_recv_file (struct Place *plc, const struct GNUNET_PSYC_MessageHeader *msg, | |||
774 | } | 884 | } |
775 | 885 | ||
776 | 886 | ||
777 | /** | ||
778 | * Called when a PSYC master or slave receives a message. | ||
779 | */ | ||
780 | static void | 887 | static void |
781 | psyc_recv_message (void *cls, | 888 | place_recv_save_eom (void *cls, |
782 | uint64_t message_id, | 889 | const struct GNUNET_MessageHeader *msg, |
783 | uint32_t flags, | 890 | uint64_t message_id, |
784 | const struct GNUNET_PSYC_MessageHeader *msg) | 891 | uint8_t cancelled) |
785 | { | 892 | { |
786 | struct Place *plc = cls; | 893 | struct Place *plc = cls; |
894 | if (GNUNET_YES != plc->file_save) | ||
895 | return; | ||
787 | 896 | ||
788 | char *str = GNUNET_CRYPTO_ecdsa_public_key_to_string (&msg->slave_key); | 897 | struct GNUNET_CRYPTO_HashAsciiEncoded place_pub_hash_ascii; |
789 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 898 | memcpy (&place_pub_hash_ascii.encoding, |
790 | "%p Received PSYC message of size %u from %s.\n", | 899 | GNUNET_h2s_full (&plc->pub_key_hash), sizeof (place_pub_hash_ascii)); |
791 | plc, ntohs (msg->header.size), str); | ||
792 | GNUNET_free (str); | ||
793 | 900 | ||
794 | /* process message */ | 901 | char *fn_part = NULL; |
795 | /* FIXME: use slicer */ | 902 | GNUNET_asprintf (&fn_part, "%s%c%s%c%s%c%.part" PRIu64, |
796 | const char *method_name = NULL; | 903 | dir_social, DIR_SEPARATOR, |
797 | struct GNUNET_PSYC_Environment *env = GNUNET_PSYC_env_create (); | 904 | "files", DIR_SEPARATOR, |
798 | const void *data = NULL; | 905 | place_pub_hash_ascii.encoding, DIR_SEPARATOR, |
799 | uint16_t data_size = 0; | 906 | message_id); |
800 | 907 | ||
801 | if (GNUNET_SYSERR == GNUNET_PSYC_message_parse (msg, &method_name, env, &data, &data_size)) | 908 | char *fn = NULL; |
802 | { | 909 | GNUNET_asprintf (&fn, "%s%c%s%c%s%c%" PRIu64, |
803 | GNUNET_break (0); | 910 | dir_social, DIR_SEPARATOR, |
804 | } | 911 | "files", DIR_SEPARATOR, |
805 | else | 912 | place_pub_hash_ascii.encoding, DIR_SEPARATOR, |
806 | { | 913 | message_id); |
807 | char *method_found = strstr (method_name, "_file"); | ||
808 | if (method_name == method_found) | ||
809 | { | ||
810 | method_found += strlen ("_file"); | ||
811 | if (('\0' == *method_found) || ('_' == *method_found)) | ||
812 | { | ||
813 | psyc_recv_file (plc, msg, flags, message_id, GNUNET_ntohll (msg->fragment_offset), | ||
814 | method_name, env, data, data_size); | ||
815 | } | ||
816 | } | ||
817 | } | ||
818 | GNUNET_PSYC_env_destroy (env); | ||
819 | 914 | ||
820 | place_send_msg (plc, &msg->header); | 915 | rename (fn_part, fn); |
916 | |||
917 | GNUNET_free (fn); | ||
918 | GNUNET_free (fn_part); | ||
821 | } | 919 | } |
822 | 920 | ||
823 | 921 | ||
@@ -1118,6 +1216,7 @@ host_enter (const struct HostEnterRequest *hreq, struct Host **ret_hst) | |||
1118 | plc->is_host = GNUNET_YES; | 1216 | plc->is_host = GNUNET_YES; |
1119 | plc->pub_key = hreq->place_pub_key; | 1217 | plc->pub_key = hreq->place_pub_key; |
1120 | plc->pub_key_hash = place_pub_hash; | 1218 | plc->pub_key_hash = place_pub_hash; |
1219 | plc->slicer = GNUNET_PSYC_slicer_create (); | ||
1121 | 1220 | ||
1122 | GNUNET_CONTAINER_multihashmap_put (hosts, &plc->pub_key_hash, plc, | 1221 | GNUNET_CONTAINER_multihashmap_put (hosts, &plc->pub_key_hash, plc, |
1123 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 1222 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
@@ -1125,7 +1224,7 @@ host_enter (const struct HostEnterRequest *hreq, struct Host **ret_hst) | |||
1125 | &psyc_master_started, | 1224 | &psyc_master_started, |
1126 | &psyc_recv_join_request, | 1225 | &psyc_recv_join_request, |
1127 | &psyc_recv_message, NULL, hst); | 1226 | &psyc_recv_message, NULL, hst); |
1128 | hst->plc.channel = GNUNET_PSYC_master_get_channel (hst->master); | 1227 | plc->channel = GNUNET_PSYC_master_get_channel (hst->master); |
1129 | ret = GNUNET_YES; | 1228 | ret = GNUNET_YES; |
1130 | } | 1229 | } |
1131 | 1230 | ||
@@ -1135,6 +1234,115 @@ host_enter (const struct HostEnterRequest *hreq, struct Host **ret_hst) | |||
1135 | } | 1234 | } |
1136 | 1235 | ||
1137 | 1236 | ||
1237 | const struct MsgProcRequest * | ||
1238 | relay_req_parse (const struct GNUNET_MessageHeader *msg, | ||
1239 | uint32_t *flags, | ||
1240 | const char **method_prefix, | ||
1241 | struct GNUNET_HashCode *method_hash) | ||
1242 | { | ||
1243 | const struct MsgProcRequest *mpreq = (const struct MsgProcRequest *) msg; | ||
1244 | uint8_t method_size = ntohs (mpreq->header.size) - sizeof (*mpreq); | ||
1245 | uint16_t offset = GNUNET_STRINGS_buffer_tokenize ((const char *) &mpreq[1], | ||
1246 | method_size, 1, method_prefix); | ||
1247 | |||
1248 | if (0 == offset || offset != method_size || *method_prefix == NULL) | ||
1249 | { | ||
1250 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1251 | "offset = %u, method_size = %u, method_name = %s\n", | ||
1252 | offset, method_size, *method_prefix); | ||
1253 | return NULL; | ||
1254 | } | ||
1255 | |||
1256 | GNUNET_CRYPTO_hash (*method_prefix, method_size, method_hash); | ||
1257 | *flags = ntohl (mpreq->flags); | ||
1258 | return mpreq; | ||
1259 | } | ||
1260 | |||
1261 | |||
1262 | /** | ||
1263 | * Handle a client setting message proccesing flags for a method prefix. | ||
1264 | */ | ||
1265 | static void | ||
1266 | client_recv_msg_proc_set (void *cls, struct GNUNET_SERVER_Client *client, | ||
1267 | const struct GNUNET_MessageHeader *msg) | ||
1268 | { | ||
1269 | struct Client * | ||
1270 | ctx = GNUNET_SERVER_client_get_user_context (client, struct Client); | ||
1271 | GNUNET_assert (NULL != ctx); | ||
1272 | struct Place *plc = ctx->plc; | ||
1273 | |||
1274 | const char *method_prefix = NULL; | ||
1275 | uint32_t flags = 0; | ||
1276 | struct GNUNET_HashCode method_hash; | ||
1277 | const struct MsgProcRequest * | ||
1278 | mpreq = relay_req_parse (msg, &flags, &method_prefix, &method_hash); | ||
1279 | |||
1280 | if (NULL == mpreq) { | ||
1281 | GNUNET_break (0); | ||
1282 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | ||
1283 | return; | ||
1284 | } | ||
1285 | |||
1286 | GNUNET_PSYC_slicer_method_remove (plc->slicer, method_prefix, | ||
1287 | place_recv_relay_method, | ||
1288 | place_recv_relay_modifier, | ||
1289 | place_recv_relay_data, | ||
1290 | place_recv_relay_eom); | ||
1291 | GNUNET_PSYC_slicer_method_remove (plc->slicer, method_prefix, | ||
1292 | place_recv_save_method, | ||
1293 | NULL, | ||
1294 | place_recv_save_data, | ||
1295 | place_recv_save_eom); | ||
1296 | |||
1297 | if (flags & GNUNET_SOCIAL_MSG_PROC_RELAY) | ||
1298 | { | ||
1299 | GNUNET_PSYC_slicer_method_add (plc->slicer, method_prefix, | ||
1300 | place_recv_relay_method, | ||
1301 | place_recv_relay_modifier, | ||
1302 | place_recv_relay_data, | ||
1303 | place_recv_relay_eom, | ||
1304 | plc); | ||
1305 | } | ||
1306 | if (flags & GNUNET_SOCIAL_MSG_PROC_SAVE) | ||
1307 | { | ||
1308 | GNUNET_PSYC_slicer_method_add (plc->slicer, method_prefix, | ||
1309 | place_recv_save_method, | ||
1310 | NULL, | ||
1311 | place_recv_save_data, | ||
1312 | place_recv_save_eom, | ||
1313 | plc); | ||
1314 | } | ||
1315 | |||
1316 | /** @todo Save flags to be able to resume relaying/saving after restart */ | ||
1317 | |||
1318 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | ||
1319 | } | ||
1320 | |||
1321 | |||
1322 | /** | ||
1323 | * Handle a connecting client requesting to clear all relay rules. | ||
1324 | */ | ||
1325 | static void | ||
1326 | client_recv_msg_proc_clear (void *cls, struct GNUNET_SERVER_Client *client, | ||
1327 | const struct GNUNET_MessageHeader *msg) | ||
1328 | { | ||
1329 | struct Client * | ||
1330 | ctx = GNUNET_SERVER_client_get_user_context (client, struct Client); | ||
1331 | GNUNET_assert (NULL != ctx); | ||
1332 | struct Place *plc = ctx->plc; | ||
1333 | if (GNUNET_YES != plc->is_host) { | ||
1334 | GNUNET_break (0); | ||
1335 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | ||
1336 | return; | ||
1337 | } | ||
1338 | struct Host *hst = (struct Host *) plc; | ||
1339 | |||
1340 | GNUNET_PSYC_slicer_clear (plc->slicer); | ||
1341 | |||
1342 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | ||
1343 | } | ||
1344 | |||
1345 | |||
1138 | /** | 1346 | /** |
1139 | * Handle a connecting client entering a place as host. | 1347 | * Handle a connecting client entering a place as host. |
1140 | */ | 1348 | */ |
@@ -1320,6 +1528,7 @@ guest_enter (const struct GuestEnterRequest *greq, struct Guest **ret_gst) | |||
1320 | plc->ego_pub_key = ego_pub_key; | 1528 | plc->ego_pub_key = ego_pub_key; |
1321 | plc->ego_pub_hash = ego_pub_hash; | 1529 | plc->ego_pub_hash = ego_pub_hash; |
1322 | plc->ego_key = ego->key; | 1530 | plc->ego_key = ego->key; |
1531 | plc->slicer = GNUNET_PSYC_slicer_create (); | ||
1323 | 1532 | ||
1324 | if (NULL == plc_gst) | 1533 | if (NULL == plc_gst) |
1325 | { | 1534 | { |
@@ -1339,7 +1548,7 @@ guest_enter (const struct GuestEnterRequest *greq, struct Guest **ret_gst) | |||
1339 | &psyc_slave_connected, | 1548 | &psyc_slave_connected, |
1340 | &psyc_recv_join_dcsn, | 1549 | &psyc_recv_join_dcsn, |
1341 | gst, join_msg); | 1550 | gst, join_msg); |
1342 | gst->plc.channel = GNUNET_PSYC_slave_get_channel (gst->slave); | 1551 | plc->channel = GNUNET_PSYC_slave_get_channel (gst->slave); |
1343 | ret = GNUNET_YES; | 1552 | ret = GNUNET_YES; |
1344 | } | 1553 | } |
1345 | 1554 | ||
@@ -1805,7 +2014,11 @@ client_recv_join_decision (void *cls, struct GNUNET_SERVER_Client *client, | |||
1805 | ctx = GNUNET_SERVER_client_get_user_context (client, struct Client); | 2014 | ctx = GNUNET_SERVER_client_get_user_context (client, struct Client); |
1806 | GNUNET_assert (NULL != ctx); | 2015 | GNUNET_assert (NULL != ctx); |
1807 | struct Place *plc = ctx->plc; | 2016 | struct Place *plc = ctx->plc; |
1808 | GNUNET_assert (GNUNET_YES == plc->is_host); | 2017 | if (GNUNET_YES != plc->is_host) { |
2018 | GNUNET_break (0); | ||
2019 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | ||
2020 | return; | ||
2021 | } | ||
1809 | struct Host *hst = (struct Host *) plc; | 2022 | struct Host *hst = (struct Host *) plc; |
1810 | 2023 | ||
1811 | struct GNUNET_PSYC_JoinDecisionMessage * | 2024 | struct GNUNET_PSYC_JoinDecisionMessage * |
@@ -1817,20 +2030,20 @@ client_recv_join_decision (void *cls, struct GNUNET_SERVER_Client *client, | |||
1817 | ? (struct GNUNET_PSYC_Message *) &dcsn[1] | 2030 | ? (struct GNUNET_PSYC_Message *) &dcsn[1] |
1818 | : NULL; | 2031 | : NULL; |
1819 | 2032 | ||
1820 | struct GNUNET_HashCode slave_key_hash; | 2033 | struct GNUNET_HashCode slave_pub_hash; |
1821 | GNUNET_CRYPTO_hash (&dcsn->slave_key, sizeof (dcsn->slave_key), | 2034 | GNUNET_CRYPTO_hash (&dcsn->slave_pub_key, sizeof (dcsn->slave_pub_key), |
1822 | &slave_key_hash); | 2035 | &slave_pub_hash); |
1823 | 2036 | ||
1824 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2037 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1825 | "%p Got join decision (%d) from client for place %s..\n", | 2038 | "%p Got join decision (%d) from client for place %s..\n", |
1826 | hst, jcls.is_admitted, GNUNET_h2s (&plc->pub_key_hash)); | 2039 | hst, jcls.is_admitted, GNUNET_h2s (&plc->pub_key_hash)); |
1827 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2040 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1828 | "%p ..and slave %s.\n", | 2041 | "%p ..and slave %s.\n", |
1829 | hst, GNUNET_h2s (&slave_key_hash)); | 2042 | hst, GNUNET_h2s (&slave_pub_hash)); |
1830 | 2043 | ||
1831 | GNUNET_CONTAINER_multihashmap_get_multiple (hst->join_reqs, &slave_key_hash, | 2044 | GNUNET_CONTAINER_multihashmap_get_multiple (hst->join_reqs, &slave_pub_hash, |
1832 | &psyc_send_join_decision, &jcls); | 2045 | &psyc_send_join_decision, &jcls); |
1833 | GNUNET_CONTAINER_multihashmap_remove_all (hst->join_reqs, &slave_key_hash); | 2046 | GNUNET_CONTAINER_multihashmap_remove_all (hst->join_reqs, &slave_pub_hash); |
1834 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 2047 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
1835 | } | 2048 | } |
1836 | 2049 | ||
@@ -2832,45 +3045,51 @@ client_recv_zone_add_nym (void *cls, struct GNUNET_SERVER_Client *client, | |||
2832 | 3045 | ||
2833 | 3046 | ||
2834 | static const struct GNUNET_SERVER_MessageHandler handlers[] = { | 3047 | static const struct GNUNET_SERVER_MessageHandler handlers[] = { |
2835 | { &client_recv_host_enter, NULL, | 3048 | { client_recv_host_enter, NULL, |
2836 | GNUNET_MESSAGE_TYPE_SOCIAL_HOST_ENTER, 0 }, | 3049 | GNUNET_MESSAGE_TYPE_SOCIAL_HOST_ENTER, 0 }, |
2837 | 3050 | ||
2838 | { &client_recv_guest_enter, NULL, | 3051 | { client_recv_guest_enter, NULL, |
2839 | GNUNET_MESSAGE_TYPE_SOCIAL_GUEST_ENTER, 0 }, | 3052 | GNUNET_MESSAGE_TYPE_SOCIAL_GUEST_ENTER, 0 }, |
2840 | 3053 | ||
2841 | { &client_recv_guest_enter_by_name, NULL, | 3054 | { client_recv_guest_enter_by_name, NULL, |
2842 | GNUNET_MESSAGE_TYPE_SOCIAL_GUEST_ENTER_BY_NAME, 0 }, | 3055 | GNUNET_MESSAGE_TYPE_SOCIAL_GUEST_ENTER_BY_NAME, 0 }, |
2843 | 3056 | ||
2844 | { &client_recv_join_decision, NULL, | 3057 | { client_recv_join_decision, NULL, |
2845 | GNUNET_MESSAGE_TYPE_PSYC_JOIN_DECISION, 0 }, | 3058 | GNUNET_MESSAGE_TYPE_PSYC_JOIN_DECISION, 0 }, |
2846 | 3059 | ||
2847 | { &client_recv_psyc_message, NULL, | 3060 | { client_recv_psyc_message, NULL, |
2848 | GNUNET_MESSAGE_TYPE_PSYC_MESSAGE, 0 }, | 3061 | GNUNET_MESSAGE_TYPE_PSYC_MESSAGE, 0 }, |
2849 | 3062 | ||
2850 | { &client_recv_history_replay, NULL, | 3063 | { client_recv_history_replay, NULL, |
2851 | GNUNET_MESSAGE_TYPE_PSYC_HISTORY_REPLAY, 0 }, | 3064 | GNUNET_MESSAGE_TYPE_PSYC_HISTORY_REPLAY, 0 }, |
2852 | 3065 | ||
2853 | { &client_recv_state_get, NULL, | 3066 | { client_recv_state_get, NULL, |
2854 | GNUNET_MESSAGE_TYPE_PSYC_STATE_GET, 0 }, | 3067 | GNUNET_MESSAGE_TYPE_PSYC_STATE_GET, 0 }, |
2855 | 3068 | ||
2856 | { &client_recv_state_get, NULL, | 3069 | { client_recv_state_get, NULL, |
2857 | GNUNET_MESSAGE_TYPE_PSYC_STATE_GET_PREFIX, 0 }, | 3070 | GNUNET_MESSAGE_TYPE_PSYC_STATE_GET_PREFIX, 0 }, |
2858 | 3071 | ||
2859 | { &client_recv_zone_add_place, NULL, | 3072 | { client_recv_zone_add_place, NULL, |
2860 | GNUNET_MESSAGE_TYPE_SOCIAL_ZONE_ADD_PLACE, 0 }, | 3073 | GNUNET_MESSAGE_TYPE_SOCIAL_ZONE_ADD_PLACE, 0 }, |
2861 | 3074 | ||
2862 | { &client_recv_zone_add_nym, NULL, | 3075 | { client_recv_zone_add_nym, NULL, |
2863 | GNUNET_MESSAGE_TYPE_SOCIAL_ZONE_ADD_NYM, 0 }, | 3076 | GNUNET_MESSAGE_TYPE_SOCIAL_ZONE_ADD_NYM, 0 }, |
2864 | 3077 | ||
2865 | { &client_recv_app_connect, NULL, | 3078 | { client_recv_app_connect, NULL, |
2866 | GNUNET_MESSAGE_TYPE_SOCIAL_APP_CONNECT, 0 }, | 3079 | GNUNET_MESSAGE_TYPE_SOCIAL_APP_CONNECT, 0 }, |
2867 | 3080 | ||
2868 | { &client_recv_app_detach, NULL, | 3081 | { client_recv_app_detach, NULL, |
2869 | GNUNET_MESSAGE_TYPE_SOCIAL_APP_DETACH, 0 }, | 3082 | GNUNET_MESSAGE_TYPE_SOCIAL_APP_DETACH, 0 }, |
2870 | 3083 | ||
2871 | { &client_recv_place_leave, NULL, | 3084 | { client_recv_place_leave, NULL, |
2872 | GNUNET_MESSAGE_TYPE_SOCIAL_PLACE_LEAVE, 0 }, | 3085 | GNUNET_MESSAGE_TYPE_SOCIAL_PLACE_LEAVE, 0 }, |
2873 | 3086 | ||
3087 | { client_recv_msg_proc_set, NULL, | ||
3088 | GNUNET_MESSAGE_TYPE_SOCIAL_MSG_PROC_SET, 0 }, | ||
3089 | |||
3090 | { client_recv_msg_proc_clear, NULL, | ||
3091 | GNUNET_MESSAGE_TYPE_SOCIAL_MSG_PROC_CLEAR, 0 }, | ||
3092 | |||
2874 | { NULL, NULL, 0, 0 } | 3093 | { NULL, NULL, 0, 0 } |
2875 | }; | 3094 | }; |
2876 | 3095 | ||