aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/psycstore/gnunet-service-psycstore.c48
-rw-r--r--src/psycstore/psycstore.h4
2 files changed, 41 insertions, 11 deletions
diff --git a/src/psycstore/gnunet-service-psycstore.c b/src/psycstore/gnunet-service-psycstore.c
index 1d1103006..573a58d5c 100644
--- a/src/psycstore/gnunet-service-psycstore.c
+++ b/src/psycstore/gnunet-service-psycstore.c
@@ -276,19 +276,39 @@ handle_client_membership_test (void *cls,
276} 276}
277 277
278 278
279static int
280check_client_fragment_store (void *cls,
281 const struct FragmentStoreRequest *req)
282{
283 return GNUNET_OK;
284}
285
286
279static void 287static void
280handle_client_fragment_store (void *cls, 288handle_client_fragment_store (void *cls,
281 const struct FragmentStoreRequest *req) 289 const struct FragmentStoreRequest *req)
282{ 290{
283 struct GNUNET_SERVICE_Client *client = cls; 291 struct GNUNET_SERVICE_Client *client = cls;
284 292
293 const struct GNUNET_MessageHeader *
294 msg = GNUNET_MQ_extract_nested_mh (req);
295 if (NULL == msg
296 || ntohs (msg->size) < sizeof (struct GNUNET_MULTICAST_MessageHeader))
297 {
298 GNUNET_break (0);
299 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
300 _("Dropping invalid fragment\n"));
301 GNUNET_SERVICE_client_drop (client);
302 return;
303 }
304
285 int ret = db->fragment_store (db->cls, &req->channel_key, 305 int ret = db->fragment_store (db->cls, &req->channel_key,
286 (const struct GNUNET_MULTICAST_MessageHeader *) 306 (const struct GNUNET_MULTICAST_MessageHeader *)
287 &req[1], ntohl (req->psycstore_flags)); 307 msg, ntohl (req->psycstore_flags));
288 308
289 if (ret != GNUNET_OK) 309 if (ret != GNUNET_OK)
290 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 310 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
291 _("Failed to store fragment!\n")); 311 _("Failed to store fragment\n"));
292 312
293 send_result_code (client, req->op_id, ret, NULL); 313 send_result_code (client, req->op_id, ret, NULL);
294 GNUNET_SERVICE_client_continue (client); 314 GNUNET_SERVICE_client_continue (client);
@@ -352,6 +372,14 @@ handle_client_fragment_get (void *cls,
352} 372}
353 373
354 374
375static int
376check_client_message_get (void *cls,
377 const struct MessageGetRequest *req)
378{
379 return GNUNET_OK;
380}
381
382
355static void 383static void
356handle_client_message_get (void *cls, 384handle_client_message_get (void *cls,
357 const struct MessageGetRequest *req) 385 const struct MessageGetRequest *req)
@@ -973,7 +1001,7 @@ GNUNET_SERVICE_MAIN
973 GNUNET_MESSAGE_TYPE_PSYCSTORE_MEMBERSHIP_TEST, 1001 GNUNET_MESSAGE_TYPE_PSYCSTORE_MEMBERSHIP_TEST,
974 struct MembershipTestRequest, 1002 struct MembershipTestRequest,
975 NULL), 1003 NULL),
976 GNUNET_MQ_hd_fixed_size (client_fragment_store, 1004 GNUNET_MQ_hd_var_size (client_fragment_store,
977 GNUNET_MESSAGE_TYPE_PSYCSTORE_FRAGMENT_STORE, 1005 GNUNET_MESSAGE_TYPE_PSYCSTORE_FRAGMENT_STORE,
978 struct FragmentStoreRequest, 1006 struct FragmentStoreRequest,
979 NULL), 1007 NULL),
@@ -981,10 +1009,10 @@ GNUNET_SERVICE_MAIN
981 GNUNET_MESSAGE_TYPE_PSYCSTORE_FRAGMENT_GET, 1009 GNUNET_MESSAGE_TYPE_PSYCSTORE_FRAGMENT_GET,
982 struct FragmentGetRequest, 1010 struct FragmentGetRequest,
983 NULL), 1011 NULL),
984 GNUNET_MQ_hd_fixed_size (client_message_get, 1012 GNUNET_MQ_hd_var_size (client_message_get,
985 GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_GET, 1013 GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_GET,
986 struct MessageGetRequest, 1014 struct MessageGetRequest,
987 NULL), 1015 NULL),
988 GNUNET_MQ_hd_fixed_size (client_message_get_fragment, 1016 GNUNET_MQ_hd_fixed_size (client_message_get_fragment,
989 GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_GET_FRAGMENT, 1017 GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_GET_FRAGMENT,
990 struct MessageGetFragmentRequest, 1018 struct MessageGetFragmentRequest,
@@ -994,9 +1022,9 @@ GNUNET_SERVICE_MAIN
994 struct OperationRequest, 1022 struct OperationRequest,
995 NULL), 1023 NULL),
996 GNUNET_MQ_hd_fixed_size (client_state_modify, 1024 GNUNET_MQ_hd_fixed_size (client_state_modify,
997 GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_MODIFY, 1025 GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_MODIFY,
998 struct StateModifyRequest, 1026 struct StateModifyRequest,
999 NULL), 1027 NULL),
1000 GNUNET_MQ_hd_var_size (client_state_sync, 1028 GNUNET_MQ_hd_var_size (client_state_sync,
1001 GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_SYNC, 1029 GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_SYNC,
1002 struct StateSyncRequest, 1030 struct StateSyncRequest,
diff --git a/src/psycstore/psycstore.h b/src/psycstore/psycstore.h
index dc80afd28..402d7d5ea 100644
--- a/src/psycstore/psycstore.h
+++ b/src/psycstore/psycstore.h
@@ -49,7 +49,7 @@ struct OperationResult
49 */ 49 */
50 uint64_t op_id GNUNET_PACKED; 50 uint64_t op_id GNUNET_PACKED;
51 51
52 /** 52 /**lowed by
53 * Status code for the operation. 53 * Status code for the operation.
54 */ 54 */
55 uint64_t result_code GNUNET_PACKED; 55 uint64_t result_code GNUNET_PACKED;
@@ -354,6 +354,8 @@ struct MessageGetRequest
354 * #GNUNET_YES or #GNUNET_NO 354 * #GNUNET_YES or #GNUNET_NO
355 */ 355 */
356 uint8_t do_membership_test; 356 uint8_t do_membership_test;
357
358 /* Followed by method_prefix */
357}; 359};
358 360
359 361