diff options
author | Gabor X Toth <*@tg-x.net> | 2013-08-11 23:46:26 +0000 |
---|---|---|
committer | Gabor X Toth <*@tg-x.net> | 2013-08-11 23:46:26 +0000 |
commit | 5d7126e2dcfe6f8130b8b703f4363bf5d6089272 (patch) | |
tree | 32670dd1c1caa21e19306088696eabd4d575b277 /src | |
parent | b0c337c0b91e0301baf7cf07b91611284dcfd315 (diff) | |
download | gnunet-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')
-rw-r--r-- | src/include/gnunet_env_lib.h | 15 | ||||
-rw-r--r-- | src/include/gnunet_multicast_service.h | 183 | ||||
-rw-r--r-- | src/include/gnunet_psyc_service.h | 141 | ||||
-rw-r--r-- | src/include/gnunet_psycstore_service.h | 78 | ||||
-rw-r--r-- | src/include/gnunet_social_service.h | 31 |
5 files changed, 246 insertions, 202 deletions
diff --git a/src/include/gnunet_env_lib.h b/src/include/gnunet_env_lib.h index b441c0252..bde21eaac 100644 --- a/src/include/gnunet_env_lib.h +++ b/src/include/gnunet_env_lib.h | |||
@@ -20,8 +20,8 @@ | |||
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file include/gnunet_env_lib.h | 22 | * @file include/gnunet_env_lib.h |
23 | * @brief Library providing operations for the @e environment of PSYC and Social messages, | 23 | * @brief Library providing operations for the @e environment of |
24 | * and for (de)serializing variable values. | 24 | * PSYC and Social messages, and for (de)serializing variable values. |
25 | * @author Gabor X Toth | 25 | * @author Gabor X Toth |
26 | */ | 26 | */ |
27 | 27 | ||
@@ -144,28 +144,31 @@ GNUNET_ENV_environment_operation (struct GNUNET_ENV_Environment *env, | |||
144 | /** | 144 | /** |
145 | * Get all modifiers in the environment. | 145 | * Get all modifiers in the environment. |
146 | * | 146 | * |
147 | * FIXME: use an iterator instead, as we'll likely use a SList to store the | ||
148 | * modifiers in the environment. | ||
149 | * | ||
147 | * @param env The environment. | 150 | * @param env The environment. |
148 | * @param[out] modifiers_length Set to the number of returned modifiers. | 151 | * @param[out] modifier_count Set to the number of returned modifiers. |
149 | * | 152 | * |
150 | * @return Array of modifiers. | 153 | * @return Array of modifiers. |
151 | */ | 154 | */ |
152 | const struct GNUNET_ENV_Modifier * | 155 | const struct GNUNET_ENV_Modifier * |
153 | GNUNET_ENV_environment_get_modifiers (const struct GNUNET_ENV_Environment *env, | 156 | GNUNET_ENV_environment_get_modifiers (const struct GNUNET_ENV_Environment *env, |
154 | size_t *modifiers_length); | 157 | size_t *modifier_count); |
155 | 158 | ||
156 | 159 | ||
157 | /** | 160 | /** |
158 | * Add list of modifiers to the environment. | 161 | * Add list of modifiers to the environment. |
159 | * | 162 | * |
160 | * @param env The environment. | 163 | * @param env The environment. |
161 | * @param modifiers_length Number of @a modifiers. | 164 | * @param modifier_count Number of @a modifiers. |
162 | * @param modifiers Array of modifiers to add. | 165 | * @param modifiers Array of modifiers to add. |
163 | * | 166 | * |
164 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error. | 167 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error. |
165 | */ | 168 | */ |
166 | int | 169 | int |
167 | GNUNET_ENV_environment_set_modifiers (const struct GNUNET_ENV_Environment *env, | 170 | GNUNET_ENV_environment_set_modifiers (const struct GNUNET_ENV_Environment *env, |
168 | size_t modifiers_length, | 171 | size_t modifier_count, |
169 | const struct GNUNET_ENV_Modifier *modifiers); | 172 | const struct GNUNET_ENV_Modifier *modifiers); |
170 | 173 | ||
171 | 174 | ||
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 | ||
241 | GNUNET_NETWORK_STRUCT_END | ||
242 | |||
243 | |||
244 | GNUNET_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 | |||
295 | GNUNET_NETWORK_STRUCT_END | ||
296 | |||
297 | |||
298 | GNUNET_NETWORK_STRUCT_BEGIN | ||
299 | |||
300 | struct 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 | */ |
328 | typedef void (*GNUNET_MULTICAST_JoinCallback)(void *cls, | 387 | typedef 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 | */ |
347 | void | 407 | void |
348 | GNUNET_MULTICAST_membership_test_answer (struct GNUNET_MULTICAST_MembershipTestHandle *mth, | 408 | GNUNET_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 | */ |
363 | typedef void (*GNUNET_MULTICAST_MembershipTestCallback)(void *cls, | 423 | typedef 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 | */ |
378 | typedef void (*GNUNET_MULTICAST_RequestCallback) (void *cls, | 439 | typedef 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 | */ |
397 | typedef void (*GNUNET_MULTICAST_MessageCallback) (void *cls, | 459 | typedef 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 | */ |
420 | typedef void (*GNUNET_MULTICAST_ReplayCallback) (void *cls, | 483 | typedef 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 | */ |
601 | struct GNUNET_MULTICAST_Member * | 667 | struct GNUNET_MULTICAST_Member * |
602 | GNUNET_MULTICAST_member_join (const struct GNUNET_CONFIGURATION_Handle *cfg, | 668 | GNUNET_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 | */ |
679 | struct GNUNET_MULTICAST_MemberRequestHandle * | 747 | struct GNUNET_MULTICAST_MemberRequestHandle * |
680 | GNUNET_MULTICAST_member_to_origin (struct GNUNET_MULTICAST_Member *member, | 748 | GNUNET_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 | |||
692 | GNUNET_MULTICAST_member_to_origin_cancel (struct GNUNET_MULTICAST_MemberRequestHandle *rh); | 761 | GNUNET_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 | */ | ||
698 | struct 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 | */ | ||
707 | struct GNUNET_MULTICAST_Group * | ||
708 | GNUNET_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 | */ | ||
717 | struct GNUNET_MULTICAST_Group * | ||
718 | GNUNET_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 | */ | ||
729 | void | ||
730 | GNUNET_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 |
diff --git a/src/include/gnunet_psyc_service.h b/src/include/gnunet_psyc_service.h index 399f2cad2..569342107 100644 --- a/src/include/gnunet_psyc_service.h +++ b/src/include/gnunet_psyc_service.h | |||
@@ -136,54 +136,55 @@ struct GNUNET_PSYC_JoinHandle; | |||
136 | * to a @e method. | 136 | * to a @e method. |
137 | * | 137 | * |
138 | * @param cls Closure. | 138 | * @param cls Closure. |
139 | * @param sender Who transmitted the message (master, except for messages | 139 | * @param slave_key Who transmitted the message. |
140 | * from one of the slaves to the master). | 140 | * - NULL for multicast messages from the master. |
141 | * @param message_id Unique message counter for this message; | 141 | * - The hash of the sending slave's public key for unicast requests from |
142 | * (unique only in combination with the given sender for | 142 | * one of the slaves to the master. |
143 | * this channel). | 143 | * @param message_id Unique message counter for this message. |
144 | * @param method_name Original method name from PSYC (may be more | 144 | * Unique only in combination with the given sender for this channel. |
145 | * specific than the registered method name due to try-and-slice matching). | 145 | * @param method_name Method name from PSYC. |
146 | * FIXME: no try-and-slice for methods defined here. | 146 | * @param modifier_count Number of elements in the @a modifiers array. |
147 | * @param header_length Number of modifiers in header. | 147 | * @param modifiers State modifiers and transient variables for the message. |
148 | * @param header Modifiers present in the message. FIXME: use environment instead? | ||
149 | * @param data_offset Byte offset of @a data in the overall data of the method. | 148 | * @param data_offset Byte offset of @a data in the overall data of the method. |
150 | * @param data_size Number of bytes in @a data. | 149 | * @param data_size Number of bytes in @a data. |
151 | * @param data Data stream given to the method (might not be zero-terminated | 150 | * @param data Data stream given to the method (might not be zero-terminated |
152 | * if data is binary). | 151 | * if data is binary). |
153 | * @param frag Fragmentation status for the data. | 152 | * @param frag Fragmentation status for the data. |
154 | */ | 153 | */ |
155 | typedef int (*GNUNET_PSYC_Method)(void *cls, | 154 | typedef int |
156 | const struct GNUNET_PeerIdentity *sender, | 155 | (*GNUNET_PSYC_Method) (void *cls, |
157 | uint64_t message_id, | 156 | const struct GNUNET_CRYPTO_EccPublicKey *slave_key, |
158 | const char *method_name, | 157 | uint64_t message_id, |
159 | size_t header_length, | 158 | const char *method_name, |
160 | GNUNET_PSYC_Modifier *header, | 159 | size_t modifier_count, |
161 | uint64_t data_offset, | 160 | const GNUNET_ENV_Modifier *modifiers, |
162 | size_t data_size, | 161 | uint64_t data_offset, |
163 | const void *data, | 162 | size_t data_size, |
164 | enum GNUNET_PSYC_MessageFlags flags); | 163 | const void *data, |
164 | enum GNUNET_PSYC_MessageFlags flags); | ||
165 | 165 | ||
166 | 166 | ||
167 | /** | 167 | /** |
168 | * Method called from PSYC upon receiving a join request. | 168 | * Method called from PSYC upon receiving a join request. |
169 | * | 169 | * |
170 | * @param cls Closure. | 170 | * @param cls Closure. |
171 | * @param peer Peer requesting to join. | 171 | * @param slave requesting to join. |
172 | * @param method_name Method name in the join request. | 172 | * @param method_name Method name in the join request. |
173 | * @param header_length Number of modifiers in header. | 173 | * @param variable_count Number of elements in the @a variables array. |
174 | * @param header Modifiers present in the message. | 174 | * @param variables Transient variables for the join request. |
175 | * @param data_size Number of bytes in @a data. | 175 | * @param data_size Number of bytes in @a data. |
176 | * @param data Data stream given to the method (might not be zero-terminated | 176 | * @param data Data stream given to the method (might not be zero-terminated |
177 | * if data is binary). | 177 | * if data is binary). |
178 | */ | 178 | */ |
179 | typedef int (*GNUNET_PSYC_JoinCallback)(void *cls, | 179 | typedef int |
180 | const struct GNUNET_PeerIdentity *peer, | 180 | (*GNUNET_PSYC_JoinCallback) (void *cls, |
181 | const char *method_name, | 181 | const struct GNUNET_CRYPTO_EccPublicKey *slave_key, |
182 | size_t header_length, | 182 | const char *method_name, |
183 | GNUNET_PSYC_Modifier *header, | 183 | size_t variable_count, |
184 | size_t data_size, | 184 | const GNUNET_ENV_Modifier *variables, |
185 | const void *data, | 185 | size_t data_size, |
186 | struct GNUNET_PSYC_JoinHandle *jh); | 186 | const void *data, |
187 | struct GNUNET_PSYC_JoinHandle *jh); | ||
187 | 188 | ||
188 | 189 | ||
189 | /** | 190 | /** |
@@ -194,7 +195,7 @@ typedef int (*GNUNET_PSYC_JoinCallback)(void *cls, | |||
194 | * | 195 | * |
195 | * @param jh Join request handle. | 196 | * @param jh Join request handle. |
196 | * @param is_admitted #GNUNET_YES if joining is approved, | 197 | * @param is_admitted #GNUNET_YES if joining is approved, |
197 | * #GNUNET_NO if it is disapproved | 198 | * #GNUNET_NO if it is disapproved. |
198 | * @param relay_count Number of relays given. | 199 | * @param relay_count Number of relays given. |
199 | * @param relays Array of suggested peers that might be useful relays to use | 200 | * @param relays Array of suggested peers that might be useful relays to use |
200 | * when joining the multicast group (essentially a list of peers that | 201 | * when joining the multicast group (essentially a list of peers that |
@@ -238,7 +239,7 @@ struct GNUNET_PSYC_Master; | |||
238 | * inform PSYC about the meaning of the respective events. | 239 | * inform PSYC about the meaning of the respective events. |
239 | * | 240 | * |
240 | * @param cfg Configuration to use (to connect to PSYC service). | 241 | * @param cfg Configuration to use (to connect to PSYC service). |
241 | * @param priv_key ECC key that will be used to sign messages for this | 242 | * @param channel_key ECC key that will be used to sign messages for this |
242 | * PSYC session. The public key is used to identify the PSYC channel. | 243 | * PSYC session. The public key is used to identify the PSYC channel. |
243 | * Note that end-users will usually not use the private key directly, but | 244 | * Note that end-users will usually not use the private key directly, but |
244 | * rather look it up in GADS for places managed by other users, or select | 245 | * rather look it up in GADS for places managed by other users, or select |
@@ -247,14 +248,14 @@ struct GNUNET_PSYC_Master; | |||
247 | * one in the future. | 248 | * one in the future. |
248 | * @param policy Group policy specifying join and history restrictions. | 249 | * @param policy Group policy specifying join and history restrictions. |
249 | * Used to automate group management decisions. | 250 | * Used to automate group management decisions. |
250 | * @param method Function to invoke on messages received from members. | 251 | * @param method Function to invoke on messages received from slaves. |
251 | * @param join_cb Function to invoke when a peer wants to join. | 252 | * @param join_cb Function to invoke when a peer wants to join. |
252 | * @param cls Closure for @a method and @a join_cb. | 253 | * @param cls Closure for @a method and @a join_cb. |
253 | * @return Handle for the channel master, NULL on error. | 254 | * @return Handle for the channel master, NULL on error. |
254 | */ | 255 | */ |
255 | struct GNUNET_PSYC_Master * | 256 | struct GNUNET_PSYC_Master * |
256 | GNUNET_PSYC_master_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | 257 | GNUNET_PSYC_master_start (const struct GNUNET_CONFIGURATION_Handle *cfg, |
257 | const struct GNUNET_CRYPTO_EccPrivateKey *priv_key, | 258 | const struct GNUNET_CRYPTO_EccPrivateKey *channel_key, |
258 | enum GNUNET_MULTICAST_GroupPolicy policy, | 259 | enum GNUNET_MULTICAST_GroupPolicy policy, |
259 | GNUNET_PSYC_Method method, | 260 | GNUNET_PSYC_Method method, |
260 | GNUNET_PSYC_JoinCallback join_cb, | 261 | GNUNET_PSYC_JoinCallback join_cb, |
@@ -279,10 +280,11 @@ GNUNET_PSYC_master_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
279 | * (should be used if @a *data_size was not big enough to take all the data) | 280 | * (should be used if @a *data_size was not big enough to take all the data) |
280 | * #GNUNET_YES if this completes the transmission (all data supplied) | 281 | * #GNUNET_YES if this completes the transmission (all data supplied) |
281 | */ | 282 | */ |
282 | typedef int (*GNUNET_PSYC_MasterReadyNotify)(void *cls, | 283 | typedef int |
283 | uint64_t message_id, | 284 | (*GNUNET_PSYC_MasterReadyNotify)(void *cls, |
284 | size_t *data_size, | 285 | uint64_t message_id, |
285 | void *data); | 286 | size_t *data_size, |
287 | void *data); | ||
286 | 288 | ||
287 | 289 | ||
288 | /** | 290 | /** |
@@ -327,7 +329,7 @@ GNUNET_PSYC_master_transmit_cancel (struct GNUNET_PSYC_MasterTransmitHandle *th) | |||
327 | * | 329 | * |
328 | * @param master PSYC channel master to stop. | 330 | * @param master PSYC channel master to stop. |
329 | */ | 331 | */ |
330 | tvoid | 332 | void |
331 | GNUNET_PSYC_master_stop (struct GNUNET_PSYC_Master *master); | 333 | GNUNET_PSYC_master_stop (struct GNUNET_PSYC_Master *master); |
332 | 334 | ||
333 | 335 | ||
@@ -348,8 +350,14 @@ struct GNUNET_PSYC_Slave; | |||
348 | * and disapproval is simply being ignored). | 350 | * and disapproval is simply being ignored). |
349 | * | 351 | * |
350 | * @param cfg Configuration to use. | 352 | * @param cfg Configuration to use. |
351 | * @param pub_key ECC key that identifies the channel we wish to join. | 353 | * @param channel_key ECC public key that identifies the channel we wish to join. |
354 | * @param slave_key ECC private-public key pair that identifies the slave, and | ||
355 | * used by multicast to sign the join request and subsequent unicast | ||
356 | * requests sent to the master. | ||
352 | * @param origin Peer identity of the origin. | 357 | * @param origin Peer identity of the origin. |
358 | * @param relay_count Number of peers in the @a relays array. | ||
359 | * @param relays Peer identities of members of the multicast group, which serve | ||
360 | * as relays and used to join the group at. | ||
353 | * @param method Function to invoke on messages received from the channel, | 361 | * @param method Function to invoke on messages received from the channel, |
354 | * typically at least contains functions for @e join and @e part. | 362 | * typically at least contains functions for @e join and @e part. |
355 | * @param join_cb Function to invoke when a peer wants to join. | 363 | * @param join_cb Function to invoke when a peer wants to join. |
@@ -362,8 +370,11 @@ struct GNUNET_PSYC_Slave; | |||
362 | */ | 370 | */ |
363 | struct GNUNET_PSYC_Slave * | 371 | struct GNUNET_PSYC_Slave * |
364 | GNUNET_PSYC_slave_join (const struct GNUNET_CONFIGURATION_Handle *cfg, | 372 | GNUNET_PSYC_slave_join (const struct GNUNET_CONFIGURATION_Handle *cfg, |
365 | const struct GNUNET_CRYPTO_EccPublicKey *pub_key, | 373 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, |
374 | const struct GNUNET_CRYPTO_EccPrivateKey *slave_key, | ||
366 | const struct GNUNET_PeerIdentity *origin, | 375 | const struct GNUNET_PeerIdentity *origin, |
376 | size_t relay_count, | ||
377 | const struct GNUNET_PeerIdentity *relays, | ||
367 | GNUNET_PSYC_Method method, | 378 | GNUNET_PSYC_Method method, |
368 | GNUNET_PSYC_JoinCallback join_cb, | 379 | GNUNET_PSYC_JoinCallback join_cb, |
369 | void *cls, | 380 | void *cls, |
@@ -401,9 +412,10 @@ GNUNET_PSYC_slave_part (struct GNUNET_PSYC_Slave *slave); | |||
401 | * #GNUNET_NO on success, if more data is to be transmitted later. | 412 | * #GNUNET_NO on success, if more data is to be transmitted later. |
402 | * #GNUNET_YES if this completes the transmission (all data supplied). | 413 | * #GNUNET_YES if this completes the transmission (all data supplied). |
403 | */ | 414 | */ |
404 | typedef int (*GNUNET_PSYC_SlaveReadyNotify)(void *cls, | 415 | typedef int |
405 | size_t *data_size, | 416 | (*GNUNET_PSYC_SlaveReadyNotify) (void *cls, |
406 | char *data); | 417 | size_t *data_size, |
418 | char *data); | ||
407 | 419 | ||
408 | 420 | ||
409 | /** | 421 | /** |
@@ -466,10 +478,10 @@ GNUNET_PSYC_slave_get_channel (struct GNUNET_PSYC_Slave *slave); | |||
466 | 478 | ||
467 | 479 | ||
468 | /** | 480 | /** |
469 | * Add a member to the channel. | 481 | * Add a slave to the channel's membership list. |
470 | * | 482 | * |
471 | * Note that this will NOT generate any PSYC traffic, it will merely update the | 483 | * Note that this will NOT generate any PSYC traffic, it will merely update the |
472 | * local data base to modify how we react to <em>membership test</em> queries. | 484 | * local database to modify how we react to <em>membership test</em> queries. |
473 | * The channel master still needs to explicitly transmit a @e join message to | 485 | * The channel master still needs to explicitly transmit a @e join message to |
474 | * notify other channel members and they then also must still call this function | 486 | * notify other channel members and they then also must still call this function |
475 | * in their respective methods handling the @e join message. This way, how @e | 487 | * in their respective methods handling the @e join message. This way, how @e |
@@ -477,25 +489,25 @@ GNUNET_PSYC_slave_get_channel (struct GNUNET_PSYC_Slave *slave); | |||
477 | * application; for example, there might be a @e part_all method to kick out | 489 | * application; for example, there might be a @e part_all method to kick out |
478 | * everyone. | 490 | * everyone. |
479 | * | 491 | * |
480 | * Note that channel members are explicitly trusted to execute such methods | 492 | * Note that channel slaves are explicitly trusted to execute such methods |
481 | * correctly; not doing so correctly will result in either denying members | 493 | * correctly; not doing so correctly will result in either denying other slaves |
482 | * access or offering access to channel data to non-members. | 494 | * access or offering access to channel data to non-members. |
483 | * | 495 | * |
484 | * @param channel Channel handle. | 496 | * @param channel Channel handle. |
485 | * @param member Which peer to add. | 497 | * @param slave_key Identity of channel slave to add. |
486 | * @param message_id Message ID for the message that changed the membership. | 498 | * @param message_id Message ID for the message that changed the membership. |
487 | */ | 499 | */ |
488 | void | 500 | void |
489 | GNUNET_PSYC_channel_member_add (struct GNUNET_PSYC_Channel *channel, | 501 | GNUNET_PSYC_channel_slave_add (struct GNUNET_PSYC_Channel *channel, |
490 | const struct GNUNET_PeerIdentity *member, | 502 | const struct GNUNET_CRYPTO_EccPublicKey *slave_key, |
491 | uint64_t message_id); | 503 | uint64_t message_id); |
492 | 504 | ||
493 | 505 | ||
494 | /** | 506 | /** |
495 | * Remove a member from the channel. | 507 | * Remove a slave from the channel's membership list. |
496 | * | 508 | * |
497 | * Note that this will NOT generate any PSYC traffic, it will merely update the | 509 | * Note that this will NOT generate any PSYC traffic, it will merely update the |
498 | * local data base to modify how we react to <em>membership test</em> queries. | 510 | * local database to modify how we react to <em>membership test</em> queries. |
499 | * The channel master still needs to explicitly transmit a @e part message to | 511 | * The channel master still needs to explicitly transmit a @e part message to |
500 | * notify other channel members and they then also must still call this function | 512 | * notify other channel members and they then also must still call this function |
501 | * in their respective methods handling the @e part message. This way, how | 513 | * in their respective methods handling the @e part message. This way, how |
@@ -509,13 +521,13 @@ GNUNET_PSYC_channel_member_add (struct GNUNET_PSYC_Channel *channel, | |||
509 | * non-members. | 521 | * non-members. |
510 | * | 522 | * |
511 | * @param channel Channel handle. | 523 | * @param channel Channel handle. |
512 | * @param member Which peer to remove. | 524 | * @param slave_key Identity of channel slave to remove. |
513 | * @param message_id Message ID for the message that changed the membership. | 525 | * @param message_id Message ID for the message that changed the membership. |
514 | */ | 526 | */ |
515 | void | 527 | void |
516 | GNUNET_PSYC_channel_member_remove (struct GNUNET_PSYC_Channel *channel, | 528 | GNUNET_PSYC_channel_slave_remove (struct GNUNET_PSYC_Channel *channel, |
517 | const struct GNUNET_PeerIdentity *member, | 529 | const struct GNUNET_CRYPTO_EccPublicKey *slave_key, |
518 | uint64_t message_id); | 530 | uint64_t message_id); |
519 | 531 | ||
520 | 532 | ||
521 | /** | 533 | /** |
@@ -526,10 +538,11 @@ GNUNET_PSYC_channel_member_remove (struct GNUNET_PSYC_Channel *channel, | |||
526 | * @param value Value of the state variable. | 538 | * @param value Value of the state variable. |
527 | * @param value_size Number of bytes in @a value. | 539 | * @param value_size Number of bytes in @a value. |
528 | */ | 540 | */ |
529 | typedef void (*GNUNET_PSYC_StateCallback)(void *cls, | 541 | typedef void |
530 | const char *name, | 542 | (*GNUNET_PSYC_StateCallback) (void *cls, |
531 | size_t value_size, | 543 | const char *name, |
532 | const void *value); | 544 | size_t value_size, |
545 | const void *value); | ||
533 | 546 | ||
534 | 547 | ||
535 | /** | 548 | /** |
@@ -626,7 +639,7 @@ GNUNET_PSYC_channel_state_get_all (struct GNUNET_PSYC_Channel *channel, | |||
626 | * needed as variables might contain binary data and | 639 | * needed as variables might contain binary data and |
627 | * might also not be 0-terminated; set to 0 on errors. | 640 | * might also not be 0-terminated; set to 0 on errors. |
628 | * @return NULL on error (no matching state or variable), pointer | 641 | * @return NULL on error (no matching state or variable), pointer |
629 | to the respective value otherwise. | 642 | * to the respective value otherwise. |
630 | */ | 643 | */ |
631 | const void * | 644 | const void * |
632 | GNUNET_PSYC_channel_state_get (struct GNUNET_PSYC_Channel *channel, | 645 | GNUNET_PSYC_channel_state_get (struct GNUNET_PSYC_Channel *channel, |
diff --git a/src/include/gnunet_psycstore_service.h b/src/include/gnunet_psycstore_service.h index 864b95105..f243fdc70 100644 --- a/src/include/gnunet_psycstore_service.h +++ b/src/include/gnunet_psycstore_service.h | |||
@@ -77,36 +77,36 @@ struct GNUNET_PSYCSTORE_OperationHandle; | |||
77 | 77 | ||
78 | /** | 78 | /** |
79 | * Function called with the result of an asynchronous operation. | 79 | * Function called with the result of an asynchronous operation. |
80 | ; * | 80 | * |
81 | * @param result #GNUNET_SYSERR on error, | 81 | * @param result #GNUNET_SYSERR on error, |
82 | * #GNUNET_YES on success or if the peer was a member, | 82 | * #GNUNET_YES on success or if the peer was a member, |
83 | * #GNUNET_NO if the peer was not a member | 83 | * #GNUNET_NO if the peer was not a member |
84 | */ | 84 | */ |
85 | typedef void (*GNUNET_PSYCSTORE_ContinuationCallback)(void *cls, | 85 | typedef void (*GNUNET_PSYCSTORE_ResultCallback)(void *cls, |
86 | int result); | 86 | int result); |
87 | 87 | ||
88 | /** | 88 | /** |
89 | * Store join/leave events for a PSYC channel in order to be able to answer | 89 | * Store join/leave events for a PSYC channel in order to be able to answer |
90 | * membership test queries later. | 90 | * membership test queries later. |
91 | * | 91 | * |
92 | * @param h Handle for the PSYCstore. | 92 | * @param h Handle for the PSYCstore. |
93 | * @param channel_id ID of the channel where the event happened. | 93 | * @param channel_key The channel where the event happened. |
94 | * @param slave_key Public key of joining/leaving slave. | ||
94 | * @param message_id ID of the message in which this event was announced. | 95 | * @param message_id ID of the message in which this event was announced. |
95 | * @param peer Identity of joining/leaving peer. | ||
96 | * @param did_join #GNUNET_YES on join, #GNUNET_NO on leave. | 96 | * @param did_join #GNUNET_YES on join, #GNUNET_NO on leave. |
97 | * @param ccb Callback to call with the result of the storage operation. | 97 | * @param rcb Callback to call with the result of the storage operation. |
98 | * @param ccb_cls Closure for the callback. | 98 | * @param rcb_cls Closure for the callback. |
99 | * | 99 | * |
100 | * @return Operation handle that can be used to cancel the operation. | 100 | * @return Operation handle that can be used to cancel the operation. |
101 | */ | 101 | */ |
102 | struct GNUNET_PSYCSTORE_OperationHandle * | 102 | struct GNUNET_PSYCSTORE_OperationHandle * |
103 | GNUNET_PSYCSTORE_membership_store (struct GNUNET_PSYCSTORE_Handle *h, | 103 | GNUNET_PSYCSTORE_membership_store (struct GNUNET_PSYCSTORE_Handle *h, |
104 | const struct GNUNET_HashCode *channel_id, | 104 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, |
105 | const struct GNUNET_CRYPTO_EccPublicKey *slave_key, | ||
105 | uint64_t message_id, | 106 | uint64_t message_id, |
106 | const struct GNUNET_PeerIdentity *peer, | ||
107 | int did_join, | 107 | int did_join, |
108 | GNUNET_PSYCSTORE_ContinuationCallback ccb, | 108 | GNUNET_PSYCSTORE_ResultCallback rcb, |
109 | void *ccb_cls); | 109 | void *rcb_cls); |
110 | 110 | ||
111 | 111 | ||
112 | /** | 112 | /** |
@@ -117,40 +117,40 @@ GNUNET_PSYCSTORE_membership_store (struct GNUNET_PSYCSTORE_Handle *h, | |||
117 | * to see the requested message. | 117 | * to see the requested message. |
118 | * | 118 | * |
119 | * @param h Handle for the PSYCstore. | 119 | * @param h Handle for the PSYCstore. |
120 | * @param channel_id The channel we are interested in. | 120 | * @param channel_key The channel we are interested in. |
121 | * @param slave_key Public key of slave whose membership to check. | ||
121 | * @param fragment_id Message fragment ID to check. | 122 | * @param fragment_id Message fragment ID to check. |
122 | * @param peer Peer whose membership to check. | 123 | * @param rcb Callback to call with the test result. |
123 | * @param ccb Callback to call with the test result. | 124 | * @param rcb_cls Closure for the callback. |
124 | * @param ccb_cls Closure for the callback. | ||
125 | * | 125 | * |
126 | * @return Operation handle that can be used to cancel the operation. | 126 | * @return Operation handle that can be used to cancel the operation. |
127 | */ | 127 | */ |
128 | struct GNUNET_PSYCSTORE_OperationHandle * | 128 | struct GNUNET_PSYCSTORE_OperationHandle * |
129 | GNUNET_PSYCSTORE_membership_test (struct GNUNET_PSYCSTORE_Handle *h, | 129 | GNUNET_PSYCSTORE_membership_test (struct GNUNET_PSYCSTORE_Handle *h, |
130 | const struct GNUNET_HashCode *channel_id, | 130 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, |
131 | const struct GNUNET_CRYPTO_EccPublicKey *slave_key, | ||
131 | uint64_t fragment_id, | 132 | uint64_t fragment_id, |
132 | const struct GNUNET_PeerIdentity *peer, | 133 | GNUNET_PSYCSTORE_ResultCallback rcb, |
133 | GNUNET_PSYCSTORE_ContinuationCallback ccb, | 134 | void *rcb_cls); |
134 | void *ccb_cls); | ||
135 | 135 | ||
136 | 136 | ||
137 | /** | 137 | /** |
138 | * Store a message fragment sent to a channel. | 138 | * Store a message fragment sent to a channel. |
139 | * | 139 | * |
140 | * @param h Handle for the PSYCstore. | 140 | * @param h Handle for the PSYCstore. |
141 | * @param channel_id The channel the message belongs to. | 141 | * @param channel_key The channel the message belongs to. |
142 | * @param message Message to store. | 142 | * @param message Message to store. |
143 | * @param ccb Callback to call with the result of the operation. | 143 | * @param rcb Callback to call with the result of the operation. |
144 | * @param ccb_cls Closure for the callback. | 144 | * @param rcb_cls Closure for the callback. |
145 | * | 145 | * |
146 | * @return Handle that can be used to cancel the operation. | 146 | * @return Handle that can be used to cancel the operation. |
147 | */ | 147 | */ |
148 | struct GNUNET_PSYCSTORE_OperationHandle * | 148 | struct GNUNET_PSYCSTORE_OperationHandle * |
149 | GNUNET_PSYCSTORE_fragment_store (struct GNUNET_PSYCSTORE_Handle *h, | 149 | GNUNET_PSYCSTORE_fragment_store (struct GNUNET_PSYCSTORE_Handle *h, |
150 | const struct GNUNET_HashCode *channel_id, | 150 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, |
151 | const struct GNUNET_MULTICAST_MessageHeader *message, | 151 | const struct GNUNET_MULTICAST_MessageHeader *message, |
152 | GNUNET_PSYCSTORE_ContinuationCallback ccb, | 152 | GNUNET_PSYCSTORE_ResultCallback rcb, |
153 | void *ccb_cls); | 153 | void *rcb_cls); |
154 | 154 | ||
155 | 155 | ||
156 | /** | 156 | /** |
@@ -170,7 +170,7 @@ typedef void (*GNUNET_PSYCSTORE_FragmentResultCallback)(void *cls, | |||
170 | * Retrieve a message fragment by fragment ID. | 170 | * Retrieve a message fragment by fragment ID. |
171 | * | 171 | * |
172 | * @param h Handle for the PSYCstore. | 172 | * @param h Handle for the PSYCstore. |
173 | * @param channel_id The channel we are interested in. | 173 | * @param channel_key The channel we are interested in. |
174 | * @param fragment_id Fragment ID to check. Use 0 to get the latest message fragment. | 174 | * @param fragment_id Fragment ID to check. Use 0 to get the latest message fragment. |
175 | * @param rcb Callback to call with the result of the operation. | 175 | * @param rcb Callback to call with the result of the operation. |
176 | * @param rcb_cls Closure for the callback. | 176 | * @param rcb_cls Closure for the callback. |
@@ -179,7 +179,7 @@ typedef void (*GNUNET_PSYCSTORE_FragmentResultCallback)(void *cls, | |||
179 | */ | 179 | */ |
180 | struct GNUNET_PSYCSTORE_OperationHandle * | 180 | struct GNUNET_PSYCSTORE_OperationHandle * |
181 | GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h, | 181 | GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h, |
182 | const struct GNUNET_HashCode *channel_id, | 182 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, |
183 | uint64_t fragment_id, | 183 | uint64_t fragment_id, |
184 | GNUNET_PSYCSTORE_FragmentResultCallback rcb, | 184 | GNUNET_PSYCSTORE_FragmentResultCallback rcb, |
185 | void *rcb_cls); | 185 | void *rcb_cls); |
@@ -189,7 +189,7 @@ GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h, | |||
189 | * Retrieve a message by ID. | 189 | * Retrieve a message by ID. |
190 | * | 190 | * |
191 | * @param h Handle for the PSYCstore. | 191 | * @param h Handle for the PSYCstore. |
192 | * @param channel_id The channel we are interested in. | 192 | * @param channel_key The channel we are interested in. |
193 | * @param message_id Message ID to check. Use 0 to get the latest message. | 193 | * @param message_id Message ID to check. Use 0 to get the latest message. |
194 | * @param rcb Callback to call with the result of the operation. | 194 | * @param rcb Callback to call with the result of the operation. |
195 | * @param rcb_cls Closure for the callback. | 195 | * @param rcb_cls Closure for the callback. |
@@ -198,7 +198,7 @@ GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h, | |||
198 | */ | 198 | */ |
199 | struct GNUNET_PSYCSTORE_OperationHandle * | 199 | struct GNUNET_PSYCSTORE_OperationHandle * |
200 | GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h, | 200 | GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h, |
201 | const struct GNUNET_HashCode *channel_id, | 201 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, |
202 | uint64_t message_id, | 202 | uint64_t message_id, |
203 | GNUNET_PSYCSTORE_FragmentResultCallback rcb, | 203 | GNUNET_PSYCSTORE_FragmentResultCallback rcb, |
204 | void *rcb_cls); | 204 | void *rcb_cls); |
@@ -213,27 +213,27 @@ GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h, | |||
213 | * operations before the current one. | 213 | * operations before the current one. |
214 | * | 214 | * |
215 | * @param h Handle for the PSYCstore. | 215 | * @param h Handle for the PSYCstore. |
216 | * @param channel_id The channel we are interested in. | 216 | * @param channel_key The channel we are interested in. |
217 | * @param message_id ID of the message that contains this state modifier. | 217 | * @param message_id ID of the message that contains this state modifier. |
218 | * @param oper Operation to perform. | 218 | * @param oper Operation to perform. |
219 | * @param name Name of variable. | 219 | * @param name Name of variable. |
220 | * @param value_size Size of @a value. | 220 | * @param value_size Size of @a value. |
221 | * @param value Value of variable. | 221 | * @param value Value of variable. |
222 | * @param ccb Callback to call with the result of the operation. | 222 | * @param rcb Callback to call with the result of the operation. |
223 | * @param ccb_cls Closure for the callback. | 223 | * @param rcb_cls Closure for the callback. |
224 | * | 224 | * |
225 | * @return Handle that can be used to cancel the operation. | 225 | * @return Handle that can be used to cancel the operation. |
226 | */ | 226 | */ |
227 | struct GNUNET_PSYCSTORE_OperationHandle * | 227 | struct GNUNET_PSYCSTORE_OperationHandle * |
228 | GNUNET_PSYCSTORE_state_modify (struct GNUNET_PSYCSTORE_Handle *h, | 228 | GNUNET_PSYCSTORE_state_modify (struct GNUNET_PSYCSTORE_Handle *h, |
229 | const struct GNUNET_HashCode *channel_id, | 229 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, |
230 | uint64_t message_id, | 230 | uint64_t message_id, |
231 | enum GNUNET_ENV_Operator *oper, | 231 | enum GNUNET_ENV_Operator *oper, |
232 | const char *name, | 232 | const char *name, |
233 | size_t value_size, | 233 | size_t value_size, |
234 | const void *value, | 234 | const void *value, |
235 | GNUNET_PSYCSTORE_ContinuationCallback ccb, | 235 | GNUNET_PSYCSTORE_ResultCallback rcb, |
236 | void *ccb_cls); | 236 | void *rcb_cls); |
237 | 237 | ||
238 | 238 | ||
239 | /** | 239 | /** |
@@ -255,7 +255,7 @@ typedef void (*GNUNET_PSYCSTORE_StateResultCallback)(void *cls, | |||
255 | * Retrieve the given state variable for a channel. | 255 | * Retrieve the given state variable for a channel. |
256 | * | 256 | * |
257 | * @param h Handle for the PSYCstore. | 257 | * @param h Handle for the PSYCstore. |
258 | * @param channel_id The channel we are interested in. | 258 | * @param channel_key The channel we are interested in. |
259 | * @param name Name of variable to get. | 259 | * @param name Name of variable to get. |
260 | * @param rcb Callback to call with the result. | 260 | * @param rcb Callback to call with the result. |
261 | * @param rcb_cls Closure for the callback. | 261 | * @param rcb_cls Closure for the callback. |
@@ -264,7 +264,7 @@ typedef void (*GNUNET_PSYCSTORE_StateResultCallback)(void *cls, | |||
264 | */ | 264 | */ |
265 | struct GNUNET_PSYCSTORE_OperationHandle * | 265 | struct GNUNET_PSYCSTORE_OperationHandle * |
266 | GNUNET_PSYCSTORE_state_get (struct GNUNET_PSYCSTORE_Handle *h, | 266 | GNUNET_PSYCSTORE_state_get (struct GNUNET_PSYCSTORE_Handle *h, |
267 | const struct GNUNET_HashCode *channel_id, | 267 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, |
268 | const char *name, | 268 | const char *name, |
269 | GNUNET_PSYCSTORE_StateResultCallback rcb, | 269 | GNUNET_PSYCSTORE_StateResultCallback rcb, |
270 | void *rcb_cls); | 270 | void *rcb_cls); |
@@ -274,7 +274,7 @@ GNUNET_PSYCSTORE_state_get (struct GNUNET_PSYCSTORE_Handle *h, | |||
274 | * Retrieve all state variables for a channel. | 274 | * Retrieve all state variables for a channel. |
275 | * | 275 | * |
276 | * @param h Handle for the PSYCstore. | 276 | * @param h Handle for the PSYCstore. |
277 | * @param channel_id The channel we are interested in. | 277 | * @param channel_key The channel we are interested in. |
278 | * @param rcb Callback to call with the result. | 278 | * @param rcb Callback to call with the result. |
279 | * @param rcb_cls Closure for the callback. | 279 | * @param rcb_cls Closure for the callback. |
280 | * | 280 | * |
@@ -282,7 +282,7 @@ GNUNET_PSYCSTORE_state_get (struct GNUNET_PSYCSTORE_Handle *h, | |||
282 | */ | 282 | */ |
283 | struct GNUNET_PSYCSTORE_OperationHandle * | 283 | struct GNUNET_PSYCSTORE_OperationHandle * |
284 | GNUNET_PSYCSTORE_state_get_all (struct GNUNET_PSYCSTORE_Handle *h, | 284 | GNUNET_PSYCSTORE_state_get_all (struct GNUNET_PSYCSTORE_Handle *h, |
285 | const struct GNUNET_HashCode *channel_id, | 285 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, |
286 | GNUNET_PSYCSTORE_StateResultCallback rcb, | 286 | GNUNET_PSYCSTORE_StateResultCallback rcb, |
287 | void *rcb_cls); | 287 | void *rcb_cls); |
288 | 288 | ||
diff --git a/src/include/gnunet_social_service.h b/src/include/gnunet_social_service.h index cacbb85e3..c248eb81f 100644 --- a/src/include/gnunet_social_service.h +++ b/src/include/gnunet_social_service.h | |||
@@ -225,7 +225,7 @@ typedef void (*GNUNET_SOCIAL_FarewellCallback)(void *cls, | |||
225 | * GNUNET_SOCIAL_home_leave(). | 225 | * GNUNET_SOCIAL_home_leave(). |
226 | * | 226 | * |
227 | * @param cfg Configuration to contact the social service. | 227 | * @param cfg Configuration to contact the social service. |
228 | * @param home_keyfile File with the private key for the home, | 228 | * @param home_keyfile File with the private-public key pair of the home, |
229 | * created if the file does not exist; pass NULL for ephemeral homes. | 229 | * created if the file does not exist; pass NULL for ephemeral homes. |
230 | * @param policy Policy specifying entry and history restrictions of the home. | 230 | * @param policy Policy specifying entry and history restrictions of the home. |
231 | * @param ego Owner of the home (host). | 231 | * @param ego Owner of the home (host). |
@@ -295,29 +295,27 @@ GNUNET_SOCIAL_home_reject_entry (struct GNUNET_SOCIAL_Home *home, | |||
295 | 295 | ||
296 | 296 | ||
297 | /** | 297 | /** |
298 | * Get the identity of a user. | 298 | * Get the public key of a nym. |
299 | * | 299 | * |
300 | * Suitable, for example, to be used with GNUNET_NAMESTORE_zone_to_name(). | 300 | * Suitable, for example, to be used with GNUNET_NAMESTORE_zone_to_name(). |
301 | * | 301 | * |
302 | * @param nym Pseudonym to map to a cryptographic identifier. | 302 | * @param nym Pseudonym to map to a cryptographic identifier. |
303 | * @param[out] identity Set to the identity of the nym (short hash of the public key). | 303 | * @param[out] identity Set to the public key of the nym. |
304 | */ | 304 | */ |
305 | void | 305 | void |
306 | GNUNET_SOCIAL_nym_get_identity (struct GNUNET_SOCIAL_Nym *nym, | 306 | GNUNET_SOCIAL_nym_get_key (struct GNUNET_SOCIAL_Nym *nym, |
307 | struct GNUNET_CRYPTO_ShortHashCode *identity); | 307 | struct GNUNET_CRYPTO_EccPublicKey *nym_key); |
308 | 308 | ||
309 | 309 | ||
310 | /** | 310 | /** |
311 | * Obtain the (cryptographic, binary) address for the home. | 311 | * Obtain the private-public key pair of the home. |
312 | * | 312 | * |
313 | * @param home Home to get the (public) address from. | 313 | * @param home Home to get the key of. |
314 | * @param[out] crypto_address Address suitable for storing in GADS, i.e. in | 314 | * @param[out] home_key Set to the private-public key pair of the home. The public part is suitable for storing in GADS within a "PLACE" record, along with peer IDs to join at. |
315 | * 'HEX.place' or within the respective GADS record type ("PLACE") | ||
316 | */ | 315 | */ |
317 | void | 316 | void |
318 | GNUNET_SOCIAL_home_get_address (struct GNUNET_SOCIAL_Home *home, | 317 | GNUNET_SOCIAL_home_get_key (struct GNUNET_SOCIAL_Home *home, |
319 | struct GNUNET_HashCode *crypto_address); | 318 | struct GNUNET_CRYPTO_EccPrivateKey *home_key); |
320 | |||
321 | 319 | ||
322 | 320 | ||
323 | /** | 321 | /** |
@@ -409,9 +407,10 @@ GNUNET_SOCIAL_home_leave (struct GNUNET_SOCIAL_Home *home); | |||
409 | * @param cfg Configuration to contact the social service. | 407 | * @param cfg Configuration to contact the social service. |
410 | * @param ego Owner of the home (host). | 408 | * @param ego Owner of the home (host). |
411 | * @param address GADS name of the place to enter. Either in the form of | 409 | * @param address GADS name of the place to enter. Either in the form of |
412 | * 'room.friend.gads', or 'HEX.zkey'. This latter case refers to the | 410 | * 'room.friend.gads', or 'NYMPUBKEY.zkey'. This latter case refers to |
413 | * 'PLACE' record in the GADS zone with the public key 'HEX', and can be | 411 | * the 'PLACE' record of the empty label ("+") in the GADS zone with the |
414 | * used to request entry to a pseudonym's place directly. | 412 | * nym's public key 'NYMPUBKEY', and can be used to request entry to a |
413 | * pseudonym's place directly. | ||
415 | * @param env Environment containing variables for the message, or NULL. | 414 | * @param env Environment containing variables for the message, or NULL. |
416 | * @param data_size Number of bytes in @a data. | 415 | * @param data_size Number of bytes in @a data. |
417 | * @param data Payload for the message to give to the enter callback. | 416 | * @param data Payload for the message to give to the enter callback. |
@@ -443,7 +442,7 @@ GNUNET_SOCIAL_place_enter (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
443 | struct GNUNET_SOCIAL_Place * | 442 | struct GNUNET_SOCIAL_Place * |
444 | GNUNET_SOCIAL_place_enter2 (const struct GNUNET_CONFIGURATION_Handle *cfg, | 443 | GNUNET_SOCIAL_place_enter2 (const struct GNUNET_CONFIGURATION_Handle *cfg, |
445 | struct GNUNET_SOCIAL_Ego *ego, | 444 | struct GNUNET_SOCIAL_Ego *ego, |
446 | struct GNUNET_HashCode *crypto_address, | 445 | struct GNUNET_CRYPTO_EccPublicKey *crypto_address, |
447 | struct GNUNET_PeerIdentity *peer, | 446 | struct GNUNET_PeerIdentity *peer, |
448 | struct GNUNET_SOCIAL_Slicer *slicer, | 447 | struct GNUNET_SOCIAL_Slicer *slicer, |
449 | const struct GNUNET_ENV_Environment *env, | 448 | const struct GNUNET_ENV_Environment *env, |