summaryrefslogtreecommitdiff
path: root/src/include/gnunet_multicast_service.h
diff options
context:
space:
mode:
authorGabor X Toth <*@tg-x.net>2014-03-06 23:46:45 +0000
committerGabor X Toth <*@tg-x.net>2014-03-06 23:46:45 +0000
commit8a0b8a4604526e5f832c4971f9c3b1b48d79bea4 (patch)
treedfd18a61272a18381fe9ce9b09849a965480a303 /src/include/gnunet_multicast_service.h
parenta21beab58c1d2abc747359a98326f19aaad4e8cd (diff)
downloadgnunet-8a0b8a4604526e5f832c4971f9c3b1b48d79bea4.tar.gz
gnunet-8a0b8a4604526e5f832c4971f9c3b1b48d79bea4.zip
PSYC: implement slave to master requests, tests, fixes, reorg
Multicast lib: handle member to origin requests. Keep track of members and origins and call their callbacks when necessary.
Diffstat (limited to 'src/include/gnunet_multicast_service.h')
-rw-r--r--src/include/gnunet_multicast_service.h62
1 files changed, 58 insertions, 4 deletions
diff --git a/src/include/gnunet_multicast_service.h b/src/include/gnunet_multicast_service.h
index 0abd803a4..aa5597fd3 100644
--- a/src/include/gnunet_multicast_service.h
+++ b/src/include/gnunet_multicast_service.h
@@ -160,8 +160,62 @@ struct GNUNET_MULTICAST_MessageHeader
160 /* Followed by message body. */ 160 /* Followed by message body. */
161}; 161};
162 162
163
164/**
165 * Header of a request from a member to the origin.
166 */
167struct GNUNET_MULTICAST_RequestHeader
168{
169 /**
170 * Header for all requests from a member to the origin.
171 */
172 struct GNUNET_MessageHeader header;
173
174 /**
175 * Public key of the sending member.
176 */
177 struct GNUNET_CRYPTO_EddsaPublicKey member_key;
178
179 /**
180 * ECC signature of the request fragment.
181 *
182 * Signature must match the public key of the multicast group.
183 */
184 struct GNUNET_CRYPTO_EddsaSignature signature;
185
186 /**
187 * Purpose for the signature and size of the signed data.
188 */
189 struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
190
191 /**
192 * Number of the request fragment, monotonically increasing.
193 */
194 uint64_t fragment_id GNUNET_PACKED;
195
196 /**
197 * Byte offset of this @e fragment of the @e request.
198 */
199 uint64_t fragment_offset GNUNET_PACKED;
200
201 /**
202 * Number of the request this fragment belongs to.
203 *
204 * Set in GNUNET_MULTICAST_origin_to_all().
205 */
206 uint64_t request_id GNUNET_PACKED;
207
208 /**
209 * Flags for this request.
210 */
211 enum GNUNET_MULTICAST_MessageFlags flags GNUNET_PACKED;
212
213 /* Followed by request body. */
214};
215
163GNUNET_NETWORK_STRUCT_END 216GNUNET_NETWORK_STRUCT_END
164 217
218
165/** 219/**
166 * Maximum size of a multicast message fragment. 220 * Maximum size of a multicast message fragment.
167 */ 221 */
@@ -492,7 +546,7 @@ GNUNET_MULTICAST_replay_response2 (struct GNUNET_MULTICAST_ReplayHandle *rh,
492 * @param next_fragment_id Next fragment ID to continue counting fragments from 546 * @param next_fragment_id Next fragment ID to continue counting fragments from
493 * when restarting the origin. 1 for a new group. 547 * when restarting the origin. 1 for a new group.
494 * @param join_cb Function called to approve / disapprove joining of a peer. 548 * @param join_cb Function called to approve / disapprove joining of a peer.
495 * @param mem_test_cb Function multicast can use to test group membership. 549 * @param member_test_cb Function multicast can use to test group membership.
496 * @param replay_frag_cb Function that can be called to replay a message fragment. 550 * @param replay_frag_cb Function that can be called to replay a message fragment.
497 * @param replay_msg_cb Function that can be called to replay a message. 551 * @param replay_msg_cb Function that can be called to replay a message.
498 * @param request_cb Function called with message fragments from group members. 552 * @param request_cb Function called with message fragments from group members.
@@ -507,7 +561,7 @@ GNUNET_MULTICAST_origin_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
507 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv_key, 561 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv_key,
508 uint64_t next_fragment_id, 562 uint64_t next_fragment_id,
509 GNUNET_MULTICAST_JoinCallback join_cb, 563 GNUNET_MULTICAST_JoinCallback join_cb,
510 GNUNET_MULTICAST_MembershipTestCallback mem_test_cb, 564 GNUNET_MULTICAST_MembershipTestCallback member_test_cb,
511 GNUNET_MULTICAST_ReplayFragmentCallback replay_frag_cb, 565 GNUNET_MULTICAST_ReplayFragmentCallback replay_frag_cb,
512 GNUNET_MULTICAST_ReplayMessageCallback replay_msg_cb, 566 GNUNET_MULTICAST_ReplayMessageCallback replay_msg_cb,
513 GNUNET_MULTICAST_RequestCallback request_cb, 567 GNUNET_MULTICAST_RequestCallback request_cb,
@@ -756,14 +810,14 @@ struct GNUNET_MULTICAST_MemberRequestHandle;
756 * Send a message to the origin of the multicast group. 810 * Send a message to the origin of the multicast group.
757 * 811 *
758 * @param member Membership handle. 812 * @param member Membership handle.
759 * @param message_id Application layer ID for the message. Opaque to multicast. 813 * @param request_id Application layer ID for the request. Opaque to multicast.
760 * @param notify Callback to call to get the message. 814 * @param notify Callback to call to get the message.
761 * @param notify_cls Closure for @a notify. 815 * @param notify_cls Closure for @a notify.
762 * @return Handle to cancel request, NULL on error (i.e. request already pending). 816 * @return Handle to cancel request, NULL on error (i.e. request already pending).
763 */ 817 */
764struct GNUNET_MULTICAST_MemberRequestHandle * 818struct GNUNET_MULTICAST_MemberRequestHandle *
765GNUNET_MULTICAST_member_to_origin (struct GNUNET_MULTICAST_Member *member, 819GNUNET_MULTICAST_member_to_origin (struct GNUNET_MULTICAST_Member *member,
766 uint64_t message_id, 820 uint64_t request_id,
767 GNUNET_MULTICAST_MemberTransmitNotify notify, 821 GNUNET_MULTICAST_MemberTransmitNotify notify,
768 void *notify_cls); 822 void *notify_cls);
769 823