aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_multicast_service.h
diff options
context:
space:
mode:
authorGabor X Toth <*@tg-x.net>2013-08-11 23:46:26 +0000
committerGabor X Toth <*@tg-x.net>2013-08-11 23:46:26 +0000
commit5d7126e2dcfe6f8130b8b703f4363bf5d6089272 (patch)
tree32670dd1c1caa21e19306088696eabd4d575b277 /src/include/gnunet_multicast_service.h
parentb0c337c0b91e0301baf7cf07b91611284dcfd315 (diff)
downloadgnunet-5d7126e2dcfe6f8130b8b703f4363bf5d6089272.tar.gz
gnunet-5d7126e2dcfe6f8130b8b703f4363bf5d6089272.zip
social: use full pubkey as place/nym id; multicast/psyc/store: identify members by their pubkey here too
Diffstat (limited to 'src/include/gnunet_multicast_service.h')
-rw-r--r--src/include/gnunet_multicast_service.h183
1 files changed, 106 insertions, 77 deletions
diff --git a/src/include/gnunet_multicast_service.h b/src/include/gnunet_multicast_service.h
index 253c0ffff..16c8ae740 100644
--- a/src/include/gnunet_multicast_service.h
+++ b/src/include/gnunet_multicast_service.h
@@ -172,6 +172,10 @@ struct GNUNET_MULTICAST_MessageHeader
172 172
173 /** 173 /**
174 * Signature of the multicast message fragment. 174 * Signature of the multicast message fragment.
175 *
176 * FIXME: not strictly necessary, the size is already in the MessageHeader
177 * (minus the unsigned fields), and we could implicitly associate
178 * a sig. purpose with the message type in the header.
175 */ 179 */
176 struct GNUNET_CRYPTO_EccSignaturePurpose purpose; 180 struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
177 181
@@ -225,14 +229,19 @@ struct GNUNET_MULTICAST_MessageHeader
225 * messages to update its list of candidates for content distribution. All 229 * messages to update its list of candidates for content distribution. All
226 * other message types are application-specific. 230 * other message types are application-specific.
227 * 231 *
228 * FIXME: Needed? There's no message type argument of origin_to_all(), 232 * FIXME: Needed? The payload could have its own message header already,
229 * PSYC does not need it, but could be added. 233 * multicast does not actually need it.
234 * Also, we have no message type argument for origin_to_all(),
230 */ 235 */
231 struct GNUNET_MessageHeader body; 236 struct GNUNET_MessageHeader body;
232 237
233 /* Followed by message body. */ 238 /* Followed by message body. */
234}; 239};
235 240
241GNUNET_NETWORK_STRUCT_END
242
243
244GNUNET_NETWORK_STRUCT_BEGIN
236 245
237/** 246/**
238 * Header of a request from a member to the origin. 247 * Header of a request from a member to the origin.
@@ -247,24 +256,74 @@ struct GNUNET_MULTICAST_RequestHeader
247 struct GNUNET_MessageHeader header; 256 struct GNUNET_MessageHeader header;
248 257
249 /** 258 /**
250 * Public key of the group. 259 * Public key of the sending member.
260 */
261 struct GNUNET_CRYPTO_EccPublicKey member_key;
262
263 /**
264 * ECC signature of the request fragment.
265 *
266 * Signature must match the public key of the multicast group.
267 */
268 struct GNUNET_CRYPTO_EccSignature signature;
269
270 /**
271 * Number of the request fragment, monotonically increasing.
272 */
273 uint64_t fragment_id GNUNET_PACKED;
274
275 /**
276 * Byte offset of this @e fragment of the @e request.
251 */ 277 */
252 struct GNUNET_CRYPTO_ECCPublicKey pub_key; 278 uint64_t fragment_offset GNUNET_PACKED;
279
280 /**
281 * Number of the request this fragment belongs to.
282 *
283 * Set in GNUNET_MULTICAST_origin_to_all().
284 */
285 uint64_t request_id GNUNET_PACKED;
253 286
254 /** 287 /**
255 * Flags for this request. 288 * Flags for this request.
256 */ 289 */
257 enum GNUNET_MULTICAST_MessageFlags flags GNUNET_PACKED; 290 enum GNUNET_MULTICAST_MessageFlags flags GNUNET_PACKED;
258 291
292 /* Followed by request body. */
293};
294
295GNUNET_NETWORK_STRUCT_END
296
297
298GNUNET_NETWORK_STRUCT_BEGIN
299
300struct GNUNET_MULTICAST_JoinRequest {
259 /** 301 /**
260 * Header for the request body. 302 * Header for the join request.
303 */
304 struct GNUNET_MessageHeader header;
305
306 /**
307 * ECC signature of the rest of the fields of the join request.
261 * 308 *
262 * Two request types are specifically understood by multicast, namely "peer 309 * Signature must match the public key of the joining member.
263 * join", "peer part". Multicast will use those messages to update its list
264 * of candidates for content distribution. All other message types are
265 * application-specific.
266 */ 310 */
267 struct GNUNET_MessageHeader body; 311 struct GNUNET_CRYPTO_EccSignature signature;
312
313 /**
314 * Public key of the target group.
315 */
316 struct GNUNET_CRYPTO_EccPublicKey group_key;
317
318 /**
319 * Public key of the joining member.
320 */
321 struct GNUNET_CRYPTO_EccPublicKey member_key;
322
323 /**
324 * Peer identity of the joining member.
325 */
326 struct GNUNET_PeerIdentity member_peer;
268 327
269 /* Followed by request body. */ 328 /* Followed by request body. */
270}; 329};
@@ -318,17 +377,18 @@ GNUNET_MULTICAST_join_decision (struct GNUNET_MULTICAST_JoinHandle *jh,
318 * with the decision. 377 * with the decision.
319 * 378 *
320 * @param cls Closure. 379 * @param cls Closure.
321 * @param peer Identity of the peer that wants to join. 380 * @param peer Identity of the member that wants to join.
322 * @param join_req Application-dependent join message from the new user 381 * @param join_req Application-dependent join message from the new member
323 * (might, for example, contain a user, 382 * (might, for example, contain a user,
324 * bind user identity/pseudonym to peer identity, application-level 383 * bind user identity/pseudonym to peer identity, application-level
325 * message to origin, etc.). 384 * message to origin, etc.).
326 * @param jh Join handle to pass to GNUNET_MULTICAST_join_decison(). 385 * @param jh Join handle to pass to GNUNET_MULTICAST_join_decison().
327 */ 386 */
328typedef void (*GNUNET_MULTICAST_JoinCallback)(void *cls, 387typedef void
329 const struct GNUNET_PeerIdentity *peer, 388(*GNUNET_MULTICAST_JoinCallback) (void *cls,
330 const struct GNUNET_MessageHeader *join_req, 389 const struct GNUNET_EccPublicKey *member_key,
331 struct GNUNET_MULTICAST_JoinHandle *jh); 390 const struct GNUNET_MessageHeader *join_req,
391 struct GNUNET_MULTICAST_JoinHandle *jh);
332 392
333 393
334/** 394/**
@@ -341,12 +401,12 @@ struct GNUNET_MULTICAST_MembershipTestHandle;
341 * Call informing multicast about the decision taken for membership test. 401 * Call informing multicast about the decision taken for membership test.
342 * 402 *
343 * @param mth Handle that was given for the query. 403 * @param mth Handle that was given for the query.
344 * @param decision #GNUNET_YES if peer was a member, #GNUNET_NO if peer was not a member, 404 * @param result #GNUNET_YES if peer was a member, #GNUNET_NO if peer was not a member,
345 * #GNUNET_SYSERR if we cannot answer the membership test. 405 * #GNUNET_SYSERR if we cannot answer the membership test.
346 */ 406 */
347void 407void
348GNUNET_MULTICAST_membership_test_answer (struct GNUNET_MULTICAST_MembershipTestHandle *mth, 408GNUNET_MULTICAST_membership_test_result (struct GNUNET_MULTICAST_MembershipTestHandle *mth,
349 int decision); 409 int result);
350 410
351 411
352/** 412/**
@@ -356,14 +416,15 @@ GNUNET_MULTICAST_membership_test_answer (struct GNUNET_MULTICAST_MembershipTestH
356 * message can be replayed. 416 * message can be replayed.
357 * 417 *
358 * @param cls Closure. 418 * @param cls Closure.
359 * @param peer Identity of the peer that we want to test. 419 * @param member_id Identity of the member that we want to test.
360 * @param fragment_id Message fragment ID for which we want to do the test. 420 * @param fragment_id Message fragment ID for which we want to do the test.
361 * @param mth Handle to give to GNUNET_MULTICAST_membership_test_answer(). 421 * @param mth Handle to give to GNUNET_MULTICAST_membership_test_answer().
362 */ 422 */
363typedef void (*GNUNET_MULTICAST_MembershipTestCallback)(void *cls, 423typedef void
364 const struct GNUNET_PeerIdentity *peer, 424(*GNUNET_MULTICAST_MembershipTestCallback) (void *cls,
365 uint64_t fragment_id, 425 const struct GNUNET_CRYPTO_EccPublicKey *member_key,
366 struct GNUNET_MULTICAST_MembershipTestHandle *mth); 426 uint64_t fragment_id,
427 struct GNUNET_MULTICAST_MembershipTestHandle *mth);
367 428
368 429
369/** 430/**
@@ -375,10 +436,11 @@ typedef void (*GNUNET_MULTICAST_MembershipTestCallback)(void *cls,
375 * @param req Request to the origin. 436 * @param req Request to the origin.
376 * @param flags Flags for the request. 437 * @param flags Flags for the request.
377 */ 438 */
378typedef void (*GNUNET_MULTICAST_RequestCallback) (void *cls, 439typedef void
379 const struct GNUNET_PeerIdentity *sender, 440(*GNUNET_MULTICAST_RequestCallback) (void *cls,
380 const struct GNUNET_MessageHeader *req, 441 const struct GNUNET_EccPublicKey *member_key,
381 enum GNUNET_MULTICAST_MessageFlags flags); 442 const struct GNUNET_MessageHeader *req,
443 enum GNUNET_MULTICAST_MessageFlags flags);
382 444
383 445
384/** 446/**
@@ -394,8 +456,9 @@ typedef void (*GNUNET_MULTICAST_RequestCallback) (void *cls,
394 * (or we were kicked out, and we should thus call 456 * (or we were kicked out, and we should thus call
395 * GNUNET_MULTICAST_member_part() next) 457 * GNUNET_MULTICAST_member_part() next)
396 */ 458 */
397typedef void (*GNUNET_MULTICAST_MessageCallback) (void *cls, 459typedef void
398 const struct GNUNET_MULTICAST_MessageHeader *msg); 460(*GNUNET_MULTICAST_MessageCallback) (void *cls,
461 const struct GNUNET_MULTICAST_MessageHeader *msg);
399 462
400 463
401/** 464/**
@@ -417,9 +480,10 @@ struct GNUNET_MULTICAST_ReplayHandle;
417 * @param fragment_id Which message fragment should be replayed. 480 * @param fragment_id Which message fragment should be replayed.
418 * @param rh Handle to pass to message transmit function. 481 * @param rh Handle to pass to message transmit function.
419 */ 482 */
420typedef void (*GNUNET_MULTICAST_ReplayCallback) (void *cls, 483typedef void
421 uint64_t fragment_id, 484(*GNUNET_MULTICAST_ReplayCallback) (void *cls,
422 struct GNUNET_MULTICAST_ReplayHandle *rh); 485 uint64_t fragment_id,
486 struct GNUNET_MULTICAST_ReplayHandle *rh);
423 487
424 488
425/** 489/**
@@ -570,7 +634,9 @@ GNUNET_MULTICAST_origin_stop (struct GNUNET_MULTICAST_Origin *origin);
570 * members of the group. 634 * members of the group.
571 * 635 *
572 * @param cfg Configuration to use. 636 * @param cfg Configuration to use.
573 * @param pub_key ECC key that identifies the group. 637 * @param group_key ECC public key that identifies the group to join.
638 * @param member_key ECC key that identifies the member and used to sign
639 * requests sent to the origin.
574 * @param origin Peer ID of the origin to send unicast requsets to. If NULL, 640 * @param origin Peer ID of the origin to send unicast requsets to. If NULL,
575 * unicast requests are sent back via multiple hops on the reverse path 641 * unicast requests are sent back via multiple hops on the reverse path
576 * of multicast messages. 642 * of multicast messages.
@@ -600,7 +666,8 @@ GNUNET_MULTICAST_origin_stop (struct GNUNET_MULTICAST_Origin *origin);
600 */ 666 */
601struct GNUNET_MULTICAST_Member * 667struct GNUNET_MULTICAST_Member *
602GNUNET_MULTICAST_member_join (const struct GNUNET_CONFIGURATION_Handle *cfg, 668GNUNET_MULTICAST_member_join (const struct GNUNET_CONFIGURATION_Handle *cfg,
603 const struct GNUNET_CRYPTO_EccPublicKey *pub_key, 669 const struct GNUNET_CRYPTO_EccPublicKey *group_key,
670 const struct GNUNET_CRYPTO_EccPrivateKey *member_key,
604 const struct GNUNET_PeerIdentity *origin, 671 const struct GNUNET_PeerIdentity *origin,
605 size_t relay_count, 672 size_t relay_count,
606 const struct GNUNET_PeerIdentity *relays, 673 const struct GNUNET_PeerIdentity *relays,
@@ -622,7 +689,7 @@ struct GNUNET_MULTICAST_MemberReplayHandle;
622/** 689/**
623 * Request a message to be replayed. 690 * Request a message to be replayed.
624 * 691 *
625 * Useful if messages below the @e max_known_*_id's given when joining are 692 * Useful if messages below the @e max_known_fragment_id given when joining are
626 * needed and not known to the client. 693 * needed and not known to the client.
627 * 694 *
628 * @param member Membership handle. 695 * @param member Membership handle.
@@ -671,6 +738,7 @@ struct GNUNET_MULTICAST_MemberRequestHandle;
671 * Send a message to the origin of the multicast group. 738 * Send a message to the origin of the multicast group.
672 * 739 *
673 * @param member Membership handle. 740 * @param member Membership handle.
741 * @param message_id Application layer ID for the message. Opaque to multicast.
674 * @param size Number of bytes we want to send to origin. 742 * @param size Number of bytes we want to send to origin.
675 * @param notify Callback to call to get the message. 743 * @param notify Callback to call to get the message.
676 * @param notify_cls Closure for @a notify. 744 * @param notify_cls Closure for @a notify.
@@ -678,6 +746,7 @@ struct GNUNET_MULTICAST_MemberRequestHandle;
678 */ 746 */
679struct GNUNET_MULTICAST_MemberRequestHandle * 747struct GNUNET_MULTICAST_MemberRequestHandle *
680GNUNET_MULTICAST_member_to_origin (struct GNUNET_MULTICAST_Member *member, 748GNUNET_MULTICAST_member_to_origin (struct GNUNET_MULTICAST_Member *member,
749 uint64_t message_id,
681 size_t size, 750 size_t size,
682 GNUNET_CONNECTION_TransmitReadyNotify notify, 751 GNUNET_CONNECTION_TransmitReadyNotify notify,
683 void *notify_cls); 752 void *notify_cls);
@@ -692,46 +761,6 @@ void
692GNUNET_MULTICAST_member_to_origin_cancel (struct GNUNET_MULTICAST_MemberRequestHandle *rh); 761GNUNET_MULTICAST_member_to_origin_cancel (struct GNUNET_MULTICAST_MemberRequestHandle *rh);
693 762
694 763
695/**
696 * Handle to access multicast group operations for both the origin and members.
697 */
698struct GNUNET_MULTICAST_Group;
699
700
701/**
702 * Convert a group @a origin to a @e group handle to access the @e group APIs.
703 *
704 * @param origin Group origin handle.
705 * @return Group handle, valid for as long as @a origin is valid.
706 */
707struct GNUNET_MULTICAST_Group *
708GNUNET_MULTICAST_origin_get_group (struct GNUNET_MULTICAST_Origin *origin);
709
710
711/**
712 * Convert @a member to a @e group handle to access the @e group APIs.
713 *
714 * @param member Member handle.
715 * @return Group handle, valid for as long as @a member is valid.
716 */
717struct GNUNET_MULTICAST_Group *
718GNUNET_MULTICAST_member_get_group (struct GNUNET_MULTICAST_Member *member);
719
720
721/**
722 * Remove a peer from the group.
723 *
724 * After a message was received notifying about a leaving member, remove the
725 * member from the multicast group. Fragments with a greater @a message_id than
726 * the specified one won't be transmitted to the member anymore, but the
727 * transmission of lower or equal ones will still be performed.
728 */
729void
730GNUNET_MULTICAST_group_member_remove (struct GNUNET_MULTICAST_Group *group,
731 const struct GNUNET_PeerIdentity *peer,
732 uint64_t message_id);
733
734
735#if 0 /* keep Emacsens' auto-indent happy */ 764#if 0 /* keep Emacsens' auto-indent happy */
736{ 765{
737#endif 766#endif