aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabor X Toth <*@tg-x.net>2013-07-15 07:25:09 +0000
committerGabor X Toth <*@tg-x.net>2013-07-15 07:25:09 +0000
commit00c2318820ac3ee2ea06c173c3fce994bc29eb4e (patch)
treed825e66cde2d0efdc4491033c32e096937bd9d58 /src
parentb6791ebdaa0d5299be3cc9fb5fbdcd5356ededf0 (diff)
downloadgnunet-00c2318820ac3ee2ea06c173c3fce994bc29eb4e.tar.gz
gnunet-00c2318820ac3ee2ea06c173c3fce994bc29eb4e.zip
multicast: message fragmentation
Diffstat (limited to 'src')
-rw-r--r--src/include/gnunet_multicast_service.h143
-rw-r--r--src/include/gnunet_psyc_service.h31
-rw-r--r--src/include/gnunet_psycstore_service.h56
-rw-r--r--src/include/gnunet_social_service.h8
4 files changed, 162 insertions, 76 deletions
diff --git a/src/include/gnunet_multicast_service.h b/src/include/gnunet_multicast_service.h
index df677784a..5803f551e 100644
--- a/src/include/gnunet_multicast_service.h
+++ b/src/include/gnunet_multicast_service.h
@@ -94,26 +94,46 @@ enum GNUNET_MULTICAST_JoinPolicy
94 94
95}; 95};
96 96
97enum GNUNET_MULTICAST_MessageFlags
98{
99 /**
100 * First fragment of a message.
101 */
102 GNUNET_MULTICAST_MESSAGE_FIRST_FRAGMENT = 1 << 0,
103
104 /**
105 * Last fragment of a message.
106 */
107 GNUNET_MULTICAST_MESSAGE_LAST_FRAGMENT = 1 << 1,
108
109 /**
110 * OR'ed flags if message is not fragmented.
111 */
112 GNUNET_MULTICAST_MESSAGE_NOT_FRAGMENTED
113 = GNUNET_MULTICAST_MESSAGE_FIRST_FRAGMENT
114 | GNUNET_MULTICAST_MESSAGE_LAST_FRAGMENT
115};
116
97 117
98GNUNET_NETWORK_STRUCT_BEGIN 118GNUNET_NETWORK_STRUCT_BEGIN
99 119
100/** 120/**
101 * Header of a multicast message. 121 * Header of a multicast message fragment.
102 * 122 *
103 * This format is public as the replay mechanism must replay messages using the 123 * This format is public as the replay mechanism must replay message fragments using the
104 * same format. This is needed as we want to integrity-check messages within 124 * same format. This is needed as we want to integrity-check message fragments within
105 * the multicast layer to avoid multicasting mal-formed messages. 125 * the multicast layer to avoid multicasting mal-formed messages.
106 */ 126 */
107struct GNUNET_MULTICAST_MessageHeader 127struct GNUNET_MULTICAST_MessageHeader
108{ 128{
109 129
110 /** 130 /**
111 * Header for all multicast messages from the origin. 131 * Header for all multicast message fragments from the origin.
112 */ 132 */
113 struct GNUNET_MessageHeader header; 133 struct GNUNET_MessageHeader header;
114 134
115 /** 135 /**
116 * Number of hops this message has taken since the origin. 136 * Number of hops this message fragment has taken since the origin.
117 * 137 *
118 * Helpful to determine shortest paths to the origin for responses among 138 * Helpful to determine shortest paths to the origin for responses among
119 * honest peers; updated at each hop and thus not signed and not secure. 139 * honest peers; updated at each hop and thus not signed and not secure.
@@ -121,23 +141,33 @@ struct GNUNET_MULTICAST_MessageHeader
121 uint32_t hop_counter GNUNET_PACKED; 141 uint32_t hop_counter GNUNET_PACKED;
122 142
123 /** 143 /**
124 * ECC signature of the message. 144 * ECC signature of the message fragment.
125 * 145 *
126 * Signature must match the public key of the multicast group. 146 * Signature must match the public key of the multicast group.
127 */ 147 */
128 struct GNUNET_CRYPTO_EccSignature signature; 148 struct GNUNET_CRYPTO_EccSignature signature;
129 149
130 /** 150 /**
131 * Signature of the multicast message. 151 * Signature of the multicast message fragment.
132 */ 152 */
133 struct GNUNET_CRYPTO_EccSignaturePurpose purpose; 153 struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
134 154
135 /** 155 /**
136 * Number of the message, monotonically increasing. 156 * Number of the message fragment, monotonically increasing.
157 */
158 uint64_t fragment_id GNUNET_PACKED;
159
160 /**
161 * Number of the message this fragment belongs to.
137 */ 162 */
138 uint64_t message_id GNUNET_PACKED; 163 uint64_t message_id GNUNET_PACKED;
139 164
140 /** 165 /**
166 * Byte offset of this @e fragment of the @e message.
167 */
168 uint64_t fragment_offset GNUNET_PACKED;
169
170 /**
141 * Counter that monotonically increases whenever a member parts the group. 171 * Counter that monotonically increases whenever a member parts the group.
142 * 172 *
143 * It has significance in case of replay requests: when a member has missed 173 * It has significance in case of replay requests: when a member has missed
@@ -148,12 +178,12 @@ struct GNUNET_MULTICAST_MessageHeader
148 uint64_t group_generation GNUNET_PACKED; 178 uint64_t group_generation GNUNET_PACKED;
149 179
150 /** 180 /**
151 * Difference between the current @a message_id and the @a message_id of the 181 * Difference between the current @a fragment_id and the @a fragment_id of the
152 * preceeding non-transient message. 182 * preceeding non-transient message.
153 * 183 *
154 * Zero for transient messages, @c UINT64_MAX for the first message, or any 184 * Zero for transient messages, @c UINT64_MAX for the first message, or any
155 * other message creating a full state reset by the origin. By subtracting 185 * other message creating a full state reset by the origin. By subtracting
156 * @a state_delta from @a message_id, it is possible to calculate the message 186 * @a state_delta from @a fragment_id, it is possible to calculate the message
157 * ID of the preceeding non-transient message and thus quickly traverse all 187 * ID of the preceeding non-transient message and thus quickly traverse all
158 * state changes up to the last full state reset by the origin. This is 188 * state changes up to the last full state reset by the origin. This is
159 * useful as it allows joining clients to quickly reassemble the state while 189 * useful as it allows joining clients to quickly reassemble the state while
@@ -170,6 +200,11 @@ struct GNUNET_MULTICAST_MessageHeader
170 */ 200 */
171 uint64_t state_delta GNUNET_PACKED; 201 uint64_t state_delta GNUNET_PACKED;
172 202
203 /**
204 * Flags for this message.
205 */
206 enum GNUNET_MULTICAST_MessageFlags flags GNUNET_PACKED;
207
173 /** 208 /**
174 * Header for the message body. 209 * Header for the message body.
175 * 210 *
@@ -180,7 +215,44 @@ struct GNUNET_MULTICAST_MessageHeader
180 */ 215 */
181 struct GNUNET_MessageHeader body; 216 struct GNUNET_MessageHeader body;
182 217
183 /* followed by message body */ 218 /* Followed by message body. */
219};
220
221GNUNET_NETWORK_STRUCT_END
222
223GNUNET_NETWORK_STRUCT_BEGIN
224
225/**
226 * Header of a request from a member to the origin.
227 *
228 * This format is public as the replay mechanism must replay message fragments using the
229 * same format. This is needed as we want to integrity-check message fragments within
230 * the multicast layer to avoid multicasting mal-formed messages.
231 */
232struct GNUNET_MULTICAST_RequestHeader
233{
234
235 /**
236 * Header for all requests from a member to the origin.
237 */
238 struct GNUNET_MessageHeader header;
239
240 /**
241 * Flags for this request.
242 */
243 enum GNUNET_MULTICAST_MessageFlags flags GNUNET_PACKED;
244
245 /**
246 * Header for the request body.
247 *
248 * Two request types are specifically understood by multicast, namely "peer
249 * join", "peer part". Multicast will use those messages to update its list
250 * of candidates for content distribution. All other message types are
251 * application-specific.
252 */
253 struct GNUNET_MessageHeader body;
254
255 /* Followed by request body. */
184}; 256};
185 257
186GNUNET_NETWORK_STRUCT_END 258GNUNET_NETWORK_STRUCT_END
@@ -304,32 +376,30 @@ GNUNET_MULTICAST_membership_test_answer (struct GNUNET_MULTICAST_MembershipTestH
304 * 376 *
305 * @param cls Closure. 377 * @param cls Closure.
306 * @param peer Identity of the peer that we want to test. 378 * @param peer Identity of the peer that we want to test.
307 * @param message_id Message ID for which we want to do the test. 379 * @param fragment_id Message fragment ID for which we want to do the test.
308 * @param mth Handle to give to GNUNET_MULTICAST_membership_test_answer(). 380 * @param mth Handle to give to GNUNET_MULTICAST_membership_test_answer().
309 */ 381 */
310typedef void (*GNUNET_MULTICAST_MembershipTestCallback)(void *cls, 382typedef void (*GNUNET_MULTICAST_MembershipTestCallback)(void *cls,
311 const struct GNUNET_PeerIdentity *peer, 383 const struct GNUNET_PeerIdentity *peer,
312 uint64_t message_id, 384 uint64_t fragment_id,
313 struct GNUNET_MULTICAST_MembershipTestHandle *mth); 385 struct GNUNET_MULTICAST_MembershipTestHandle *mth);
314 386
315 387
316/** 388/**
317 * Function called whenever a group member has transmitted a message 389 * Function called whenever a group member has transmitted a request
318 * to the origin (other than joining or leaving). 390 * to the origin (other than joining or leaving).
319 * 391 *
320 * @param cls Closure (set from GNUNET_MULTICAST_origin_start). 392 * @param cls Closure (set from GNUNET_MULTICAST_origin_start).
321 * @param sender Identity of the sender. 393 * @param sender Identity of the sender.
322 * @param request_id Unique counter for the request from this sender to this origin. FIXME: needed? 394 * @param req Request to the origin.
323 * @param msg Message to the origin.
324 */ 395 */
325typedef void (*GNUNET_MULTICAST_RequestCallback) (void *cls, 396typedef void (*GNUNET_MULTICAST_RequestCallback) (void *cls,
326 const struct GNUNET_PeerIdentity *sender, 397 const struct GNUNET_PeerIdentity *sender,
327 uint64_t request_id, 398 const struct GNUNET_MULTICAST_RequestHeader *req);
328 const struct GNUNET_MessageHeader *msg);
329 399
330 400
331/** 401/**
332 * Function called whenever a group member is receiving a message from 402 * Function called whenever a group member is receiving a message fragment from
333 * the origin. 403 * the origin.
334 * 404 *
335 * If admission to the group is denied, this function is called once with the 405 * If admission to the group is denied, this function is called once with the
@@ -337,14 +407,11 @@ typedef void (*GNUNET_MULTICAST_RequestCallback) (void *cls,
337 * then a second time with NULL to indicate that the connection failed for good. 407 * then a second time with NULL to indicate that the connection failed for good.
338 * 408 *
339 * @param cls Closure (set from GNUNET_MULTICAST_member_join()) 409 * @param cls Closure (set from GNUNET_MULTICAST_member_join())
340 * @param message_id Unique number of the message, 0 for response to join request,
341 * normal message IDs in either direction start at 1.
342 * @param msg Message from the origin, NULL if the origin shut down 410 * @param msg Message from the origin, NULL if the origin shut down
343 * (or we were kicked out, and we should thus call 411 * (or we were kicked out, and we should thus call
344 * GNUNET_MULTICAST_member_part() next) 412 * GNUNET_MULTICAST_member_part() next)
345 */ 413 */
346typedef void (*GNUNET_MULTICAST_MessageCallback) (void *cls, 414typedef void (*GNUNET_MULTICAST_MessageCallback) (void *cls,
347 uint64_t message_id,
348 const struct GNUNET_MULTICAST_MessageHeader *msg); 415 const struct GNUNET_MULTICAST_MessageHeader *msg);
349 416
350 417
@@ -364,11 +431,11 @@ struct GNUNET_MULTICAST_ReplayHandle;
364 * 431 *
365 * @param cls Closure (set from GNUNET_MULTICAST_origin_start() 432 * @param cls Closure (set from GNUNET_MULTICAST_origin_start()
366 * or GNUNET_MULTICAST_member_join()). 433 * or GNUNET_MULTICAST_member_join()).
367 * @param message_id Which message should be replayed. 434 * @param fragment_id Which message fragment should be replayed.
368 * @param rh Handle to pass to message transmit function. 435 * @param rh Handle to pass to message transmit function.
369 */ 436 */
370typedef void (*GNUNET_MULTICAST_ReplayCallback) (void *cls, 437typedef void (*GNUNET_MULTICAST_ReplayCallback) (void *cls,
371 uint64_t message_id, 438 uint64_t fragment_id,
372 struct GNUNET_MULTICAST_ReplayHandle *rh); 439 struct GNUNET_MULTICAST_ReplayHandle *rh);
373 440
374 441
@@ -384,12 +451,12 @@ enum GNUNET_MULTICAST_ReplayErrorCode
384 GNUNET_MULTICAST_REC_OK = 0, 451 GNUNET_MULTICAST_REC_OK = 0,
385 452
386 /** 453 /**
387 * Message has been discarded (likely transient message that was too old). 454 * Message fragment has been discarded (likely transient message that was too old).
388 */ 455 */
389 GNUNET_MULTICAST_REC_TRANSIENT_LOST = 1, 456 GNUNET_MULTICAST_REC_TRANSIENT_LOST = 1,
390 457
391 /** 458 /**
392 * Message ID counter was larger than the highest counter this 459 * Fragment ID counter was larger than the highest counter this
393 * replay function has ever encountered; thus it is likely the 460 * replay function has ever encountered; thus it is likely the
394 * origin never sent it and we're at the HEAD of the multicast 461 * origin never sent it and we're at the HEAD of the multicast
395 * stream as far as this node is concerned. 462 * stream as far as this node is concerned.
@@ -408,7 +475,7 @@ enum GNUNET_MULTICAST_ReplayErrorCode
408 * Replay a message from the multicast group. 475 * Replay a message from the multicast group.
409 * 476 *
410 * @param rh Replay handle identifying which replay operation was requested. 477 * @param rh Replay handle identifying which replay operation was requested.
411 * @param msg Replayed message, NULL if unknown/error. 478 * @param msg Replayed message fragment, NULL if unknown/error.
412 * @param ec Error code. 479 * @param ec Error code.
413 */ 480 */
414void 481void
@@ -509,15 +576,14 @@ GNUNET_MULTICAST_origin_end (struct GNUNET_MULTICAST_Origin *origin);
509 * members of the group. 576 * members of the group.
510 * 577 *
511 * @param cfg Configuration to use. 578 * @param cfg Configuration to use.
512 * @param cls Closure for callbacks.
513 * @param pub_key ECC key that identifies the group. 579 * @param pub_key ECC key that identifies the group.
514 * @param origin Peer identity of the origin. 580 * @param origin Peer identity of the origin.
515 * @param max_known_message_id Largest known message ID to the replay service; 581 * @param max_known_fragment_id Largest known message fragment ID to the replay
516 * all messages with IDs larger than this ID will be replayed if 582 service; all messages with IDs larger than this ID will be replayed if
517 * possible (lower IDs will be considered known and thus only 583 * possible (lower IDs will be considered known and thus only
518 * be replayed upon explicit request). 584 * be replayed upon explicit request).
519 * @param max_known_state_message_id Largest known message ID with a non-zero 585 * @param max_known_state_fragment_id Largest known message fragment ID with a
520 * value for the @e state_delta; state messages with 586 non-zero value for the @e state_delta; state messages with
521 * larger IDs than this value will be replayed with high priority 587 * larger IDs than this value will be replayed with high priority
522 * (lower IDs will be considered known and thus only 588 * (lower IDs will be considered known and thus only
523 * be replayed upon explicit request). 589 * be replayed upon explicit request).
@@ -525,9 +591,10 @@ GNUNET_MULTICAST_origin_end (struct GNUNET_MULTICAST_Origin *origin);
525 * this peer already knows from this group; NULL if this 591 * this peer already knows from this group; NULL if this
526 * client is unable to support replay. 592 * client is unable to support replay.
527 * @param test_cb Function multicast can use to test group membership. 593 * @param test_cb Function multicast can use to test group membership.
528 * @param message_cb Function to be called for all messages we 594 * @param message_cb Function to be called for all message fragments we
529 * receive from the group, excluding those our @a replay_cb 595 * receive from the group, excluding those our @a replay_cb
530 * already has. 596 * already has.
597 * @param cls Closure for callbacks.
531 * @param join_req Application-dependent join message to be passed to origin 598 * @param join_req Application-dependent join message to be passed to origin
532 * (might, for example, contain a user 599 * (might, for example, contain a user
533 * bind user identity/pseudonym to peer identity, application-level 600 * bind user identity/pseudonym to peer identity, application-level
@@ -536,14 +603,14 @@ GNUNET_MULTICAST_origin_end (struct GNUNET_MULTICAST_Origin *origin);
536 */ 603 */
537struct GNUNET_MULTICAST_Member * 604struct GNUNET_MULTICAST_Member *
538GNUNET_MULTICAST_member_join (const struct GNUNET_CONFIGURATION_Handle *cfg, 605GNUNET_MULTICAST_member_join (const struct GNUNET_CONFIGURATION_Handle *cfg,
539 void *cls,
540 const struct GNUNET_CRYPTO_EccPublicKey *pub_key, 606 const struct GNUNET_CRYPTO_EccPublicKey *pub_key,
541 const struct GNUNET_PeerIdentity *origin, 607 const struct GNUNET_PeerIdentity *origin,
542 uint64_t max_known_message_id, 608 uint64_t max_known_fragment_id,
543 uint64_t max_known_state_message_id, 609 uint64_t max_known_state_fragment_id,
544 GNUNET_MULTICAST_ReplayCallback replay_cb, 610 GNUNET_MULTICAST_ReplayCallback replay_cb,
545 GNUNET_MULITCAST_MembershipTestCallback test_cb, 611 GNUNET_MULITCAST_MembershipTestCallback test_cb,
546 GNUNET_MULTICAST_MessageCallback message_cb, 612 GNUNET_MULTICAST_MessageCallback message_cb,
613 void *cls,
547 const struct GNUNET_MessageHeader *join_req); 614 const struct GNUNET_MessageHeader *join_req);
548 615
549 616
@@ -560,14 +627,14 @@ struct GNUNET_MULTICAST_MemberReplayHandle;
560 * needed and not known to the client. 627 * needed and not known to the client.
561 * 628 *
562 * @param member Membership handle. 629 * @param member Membership handle.
563 * @param message_id ID of a message that this client would like to see replayed. 630 * @param fragment_id ID of a message fragment that this client would like to see replayed.
564 * @param message_cb Function to be called for the replayed message. 631 * @param message_cb Function to be called for the replayed message.
565 * @param message_cb_cls Closure for @a message_cb. 632 * @param message_cb_cls Closure for @a message_cb.
566 * @return Replay request handle, NULL on error. 633 * @return Replay request handle, NULL on error.
567 */ 634 */
568struct GNUNET_MULTICAST_MemberReplayHandle * 635struct GNUNET_MULTICAST_MemberReplayHandle *
569GNUNET_MULTICAST_member_request_replay (struct GNUNET_MULTICAST_Member *member, 636GNUNET_MULTICAST_member_request_replay (struct GNUNET_MULTICAST_Member *member,
570 uint64_t message_id, 637 uint64_t fragment_id,
571 GNUNET_MULTICAST_MessageCallback message_cb, 638 GNUNET_MULTICAST_MessageCallback message_cb,
572 void *message_cb_cls); 639 void *message_cb_cls);
573 640
diff --git a/src/include/gnunet_psyc_service.h b/src/include/gnunet_psyc_service.h
index e6d47dc4e..e23eef669 100644
--- a/src/include/gnunet_psyc_service.h
+++ b/src/include/gnunet_psyc_service.h
@@ -101,25 +101,22 @@ extern "C"
101#define GNUNET_PSYC_VERSION 0x00000000 101#define GNUNET_PSYC_VERSION 0x00000000
102 102
103 103
104/** 104enum GNUNET_PSYC_MessageFlags
105 * Information flags for data fragments set via PSYC.
106 */
107enum GNUNET_PSYC_FragmentStatus
108{ 105{
109 /** 106 /**
110 * This is the first part of data for the given method call. 107 * First fragment of a message.
111 */ 108 */
112 GNUNET_PSYC_FS_FIRST = 1, 109 GNUNET_PSYC_MESSAGE_FIRST_FRAGMENT = GNUNET_MULTICAST_MESSAGE_FIRST_FRAGMENT,
113 110
114 /** 111 /**
115 * This is the last part of data for the given method call. 112 * Last fragment of a message.
116 */ 113 */
117 GNUNET_PSYC_FS_LAST = 2, 114 GNUNET_PSYC_MESSAGE_LAST_FRAGMENT = GNUNET_MULTICAST_MESSAGE_LAST_FRAGMENT,
118 115
119 /** 116 /**
120 * OR'ed flags if payload is not fragmented. 117 * OR'ed flags if message is not fragmented.
121 */ 118 */
122 GNUNET_PSYC_FS_NOT_FRAGMENTED = (GNUNET_PSYC_FS_FIRST | GNUNET_PSYC_FS_LAST) 119 GNUNET_PSYC_MESSAGE_NOT_FRAGMENTED = GNUNET_MULTICAST_MESSAGE_NOT_FRAGMENTED
123}; 120};
124 121
125 122
@@ -157,7 +154,7 @@ struct GNUNET_PSYC_PartHandle;
157 * FIXME: no try-and-slice for methods defined here. 154 * FIXME: no try-and-slice for methods defined here.
158 * @param header_length Number of modifiers in header. 155 * @param header_length Number of modifiers in header.
159 * @param header Modifiers present in the message. 156 * @param header Modifiers present in the message.
160 * @param data_off Byte offset of @a data in the overall data of the method. 157 * @param data_offset Byte offset of @a data in the overall data of the method.
161 * @param data_size Number of bytes in @a data. 158 * @param data_size Number of bytes in @a data.
162 * @param data Data stream given to the method (might not be zero-terminated 159 * @param data Data stream given to the method (might not be zero-terminated
163 * if data is binary). 160 * if data is binary).
@@ -168,10 +165,12 @@ typedef int (*GNUNET_PSYC_Method)(void *cls,
168 uint64_t message_id, 165 uint64_t message_id,
169 uint64_t group_generation, 166 uint64_t group_generation,
170 const char *method_name, 167 const char *method_name,
171 uint64_t data_off, 168 size_t header_length,
169 GNUNET_PSYC_Modifier *header,
170 uint64_t data_offset,
172 size_t data_size, 171 size_t data_size,
173 const void *data, 172 const void *data,
174 enum GNUNET_PSYC_FragmentStatus frag); 173 enum GNUNET_PSYC_MessageFlags flags);
175 174
176 175
177/** 176/**
diff --git a/src/include/gnunet_psycstore_service.h b/src/include/gnunet_psycstore_service.h
index 46034dae6..8b84340fe 100644
--- a/src/include/gnunet_psycstore_service.h
+++ b/src/include/gnunet_psycstore_service.h
@@ -111,7 +111,7 @@ GNUNET_PSYCSTORE_membership_store (struct GNUNET_PSYCSTORE_Handle *h,
111 111
112 112
113/** 113/**
114 * Test if a peer was a member of the channel when the message with the 114 * Test if a peer was a member of the channel when the message fragment with the
115 * specified ID was sent to the channel. 115 * specified ID was sent to the channel.
116 * 116 *
117 * This is useful in case of retransmissions to check if the peer was authorized 117 * This is useful in case of retransmissions to check if the peer was authorized
@@ -119,7 +119,7 @@ GNUNET_PSYCSTORE_membership_store (struct GNUNET_PSYCSTORE_Handle *h,
119 * 119 *
120 * @param h Handle for the PSYCstore. 120 * @param h Handle for the PSYCstore.
121 * @param channel_id The channel we are interested in. 121 * @param channel_id The channel we are interested in.
122 * @param message_id Message ID to check. 122 * @param fragment_id Message fragment ID to check.
123 * @param peer Peer whose membership to check. 123 * @param peer Peer whose membership to check.
124 * @param ccb Callback to call with the test result. 124 * @param ccb Callback to call with the test result.
125 * @param ccb_cls Closure for the callback. 125 * @param ccb_cls Closure for the callback.
@@ -129,14 +129,14 @@ GNUNET_PSYCSTORE_membership_store (struct GNUNET_PSYCSTORE_Handle *h,
129struct GNUNET_PSYCSTORE_OperationHandle * 129struct GNUNET_PSYCSTORE_OperationHandle *
130GNUNET_PSYCSTORE_membership_test (struct GNUNET_PSYCSTORE_Handle *h, 130GNUNET_PSYCSTORE_membership_test (struct GNUNET_PSYCSTORE_Handle *h,
131 const struct GNUNET_HashCode *channel_id, 131 const struct GNUNET_HashCode *channel_id,
132 uint64_t message_id, 132 uint64_t fragment_id,
133 const struct GNUNET_PeerIdentity *peer, 133 const struct GNUNET_PeerIdentity *peer,
134 GNUNET_PSYCSTORE_ContinuationCallback ccb, 134 GNUNET_PSYCSTORE_ContinuationCallback ccb,
135 void *ccb_cls); 135 void *ccb_cls);
136 136
137 137
138/** 138/**
139 * Store a message sent to a channel. 139 * Store a message fragment sent to a channel.
140 * 140 *
141 * @param h Handle for the PSYCstore. 141 * @param h Handle for the PSYCstore.
142 * @param channel_id The channel the message belongs to. 142 * @param channel_id The channel the message belongs to.
@@ -147,23 +147,43 @@ GNUNET_PSYCSTORE_membership_test (struct GNUNET_PSYCSTORE_Handle *h,
147 * @return Handle that can be used to cancel the operation. 147 * @return Handle that can be used to cancel the operation.
148 */ 148 */
149struct GNUNET_PSYCSTORE_OperationHandle * 149struct GNUNET_PSYCSTORE_OperationHandle *
150GNUNET_PSYCSTORE_message_store (struct GNUNET_PSYCSTORE_Handle *h, 150GNUNET_PSYCSTORE_fragment_store (struct GNUNET_PSYCSTORE_Handle *h,
151 const struct GNUNET_HashCode *channel_id, 151 const struct GNUNET_HashCode *channel_id,
152 const struct GNUNET_MULTICAST_MessageHeader *message, 152 const struct GNUNET_MULTICAST_MessageHeader *message,
153 GNUNET_PSYCSTORE_ContinuationCallback ccb, 153 GNUNET_PSYCSTORE_ContinuationCallback ccb,
154 void *ccb_cls); 154 void *ccb_cls);
155 155
156 156
157/** 157/**
158 * Function called with the result of a GNUNET_PSYCSTORE_message_get() call. 158 * Function called with one message fragment, as the result of a
159 * GNUNET_PSYCSTORE_fragment_get() or GNUNET_PSYCSTORE_message_get() call.
159 * 160 *
160 * @param cls Closure. 161 * @param cls Closure.
161 * @param message_id ID of the message. 162 * @param message The retrieved message fragment.
162 * @param message The retrieved message. 163 * @param flags Message flags indicating fragmentation status.
164 */
165typedef void (*GNUNET_PSYCSTORE_FragmentResultCallback)(void *cls,
166 const struct GNUNET_MULTICAST_MessageHeader *message,
167 enum GNUNET_PSYC_MessageFlags flags);
168
169
170/**
171 * Retrieve a message fragment by fragment ID.
172 *
173 * @param h Handle for the PSYCstore.
174 * @param channel_id The channel we are interested in.
175 * @param fragment_id Fragment ID to check. Use 0 to get the latest message fragment.
176 * @param rcb Callback to call with the result of the operation.
177 * @param rcb_cls Closure for the callback.
178 *
179 * @return Handle that can be used to cancel the operation.
163 */ 180 */
164typedef void (*GNUNET_PSYCSTORE_MessageResultCallback)(void *cls, 181struct GNUNET_PSYCSTORE_OperationHandle *
165 uint64_t message_id, 182GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h,
166 const struct GNUNET_MULTICAST_MessageHeader *message); 183 const struct GNUNET_HashCode *channel_id,
184 uint64_t message_id,
185 GNUNET_PSYCSTORE_FragmentResultCallback rcb,
186 void *rcb_cls);
167 187
168 188
169/** 189/**
@@ -181,7 +201,7 @@ struct GNUNET_PSYCSTORE_OperationHandle *
181GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h, 201GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h,
182 const struct GNUNET_HashCode *channel_id, 202 const struct GNUNET_HashCode *channel_id,
183 uint64_t message_id, 203 uint64_t message_id,
184 GNUNET_PSYCSTORE_MessageResultCallback rcb, 204 GNUNET_PSYCSTORE_FragmentResultCallback rcb,
185 void *rcb_cls); 205 void *rcb_cls);
186 206
187 207
@@ -191,7 +211,7 @@ GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h,
191 * @param h Handle for the PSYCstore. 211 * @param h Handle for the PSYCstore.
192 * @param channel_id The channel we are interested in. 212 * @param channel_id The channel we are interested in.
193 * @param name Name of variable. 213 * @param name Name of variable.
194 * @param size Size of @a value. 214 * @param value_size Size of @a value.
195 * @param value Value of variable. 215 * @param value Value of variable.
196 * @param ccb Callback to call with the result of the operation. 216 * @param ccb Callback to call with the result of the operation.
197 * @param ccb_cls Closure for the callback. 217 * @param ccb_cls Closure for the callback.
@@ -202,7 +222,7 @@ struct GNUNET_PSYCSTORE_OperationHandle *
202GNUNET_PSYCSTORE_state_set (struct GNUNET_PSYCSTORE_Handle *h, 222GNUNET_PSYCSTORE_state_set (struct GNUNET_PSYCSTORE_Handle *h,
203 const struct GNUNET_HashCode *channel_id, 223 const struct GNUNET_HashCode *channel_id,
204 const char *name, 224 const char *name,
205 size_t size, 225 size_t value_size,
206 const void *value, 226 const void *value,
207 GNUNET_PSYCSTORE_ContinuationCallback ccb, 227 GNUNET_PSYCSTORE_ContinuationCallback ccb,
208 void *ccb_cls); 228 void *ccb_cls);
diff --git a/src/include/gnunet_social_service.h b/src/include/gnunet_social_service.h
index 1d2b2096c..d4d9c437c 100644
--- a/src/include/gnunet_social_service.h
+++ b/src/include/gnunet_social_service.h
@@ -86,21 +86,21 @@ struct GNUNET_SOCIAL_Slicer;
86 * this channel). 86 * this channel).
87 * @param header_length Number of modifiers in header. 87 * @param header_length Number of modifiers in header.
88 * @param header Modifiers present in the message. 88 * @param header Modifiers present in the message.
89 * @param data_off Byte offset of @a data in the overall data of the method. 89 * @param data_offset Byte offset of @a data in the overall data of the method.
90 * @param data_size Number of bytes in @a data. 90 * @param data_size Number of bytes in @a data.
91 * @param data Data stream given to the method (might not be zero-terminated 91 * @param data Data stream given to the method (might not be zero-terminated
92 * if data is binary). 92 * if data is binary).
93 * @param frag Fragmentation status for the data. 93 * @param flags Message flags indicating fragmentation status.
94 */ 94 */
95typedef int (*GNUNET_SOCIAL_Method)(void *cls, 95typedef int (*GNUNET_SOCIAL_Method)(void *cls,
96 const char *full_method_name, 96 const char *full_method_name,
97 uint64_t message_id, 97 uint64_t message_id,
98 size_t header_length, 98 size_t header_length,
99 GNUNET_PSYC_Modifier *header, 99 GNUNET_PSYC_Modifier *header,
100 uint64_t data_off, 100 uint64_t data_offset,
101 size_t data_size, 101 size_t data_size,
102 const void *data, 102 const void *data,
103 enum GNUNET_PSYC_FragmentStatus frag); 103 enum GNUNET_PSYC_MessageFlags flags);
104 104
105 105
106/** 106/**