From 5d7126e2dcfe6f8130b8b703f4363bf5d6089272 Mon Sep 17 00:00:00 2001 From: Gabor X Toth <*@tg-x.net> Date: Sun, 11 Aug 2013 23:46:26 +0000 Subject: [PATCH] social: use full pubkey as place/nym id; multicast/psyc/store: identify members by their pubkey here too --- src/include/gnunet_env_lib.h | 15 +- src/include/gnunet_multicast_service.h | 183 ++++++++++++++----------- src/include/gnunet_psyc_service.h | 141 ++++++++++--------- src/include/gnunet_psycstore_service.h | 78 +++++------ 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 @@ /** * @file include/gnunet_env_lib.h - * @brief Library providing operations for the @e environment of PSYC and Social messages, - * and for (de)serializing variable values. + * @brief Library providing operations for the @e environment of + * PSYC and Social messages, and for (de)serializing variable values. * @author Gabor X Toth */ @@ -144,28 +144,31 @@ GNUNET_ENV_environment_operation (struct GNUNET_ENV_Environment *env, /** * Get all modifiers in the environment. * + * FIXME: use an iterator instead, as we'll likely use a SList to store the + * modifiers in the environment. + * * @param env The environment. - * @param[out] modifiers_length Set to the number of returned modifiers. + * @param[out] modifier_count Set to the number of returned modifiers. * * @return Array of modifiers. */ const struct GNUNET_ENV_Modifier * GNUNET_ENV_environment_get_modifiers (const struct GNUNET_ENV_Environment *env, - size_t *modifiers_length); + size_t *modifier_count); /** * Add list of modifiers to the environment. * * @param env The environment. - * @param modifiers_length Number of @a modifiers. + * @param modifier_count Number of @a modifiers. * @param modifiers Array of modifiers to add. * * @return #GNUNET_OK on success, #GNUNET_SYSERR on error. */ int GNUNET_ENV_environment_set_modifiers (const struct GNUNET_ENV_Environment *env, - size_t modifiers_length, + size_t modifier_count, const struct GNUNET_ENV_Modifier *modifiers); 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 /** * Signature of the multicast message fragment. + * + * FIXME: not strictly necessary, the size is already in the MessageHeader + * (minus the unsigned fields), and we could implicitly associate + * a sig. purpose with the message type in the header. */ struct GNUNET_CRYPTO_EccSignaturePurpose purpose; @@ -225,14 +229,19 @@ struct GNUNET_MULTICAST_MessageHeader * messages to update its list of candidates for content distribution. All * other message types are application-specific. * - * FIXME: Needed? There's no message type argument of origin_to_all(), - * PSYC does not need it, but could be added. + * FIXME: Needed? The payload could have its own message header already, + * multicast does not actually need it. + * Also, we have no message type argument for origin_to_all(), */ struct GNUNET_MessageHeader body; /* Followed by message body. */ }; +GNUNET_NETWORK_STRUCT_END + + +GNUNET_NETWORK_STRUCT_BEGIN /** * Header of a request from a member to the origin. @@ -247,24 +256,74 @@ struct GNUNET_MULTICAST_RequestHeader struct GNUNET_MessageHeader header; /** - * Public key of the group. + * Public key of the sending member. + */ + struct GNUNET_CRYPTO_EccPublicKey member_key; + + /** + * ECC signature of the request fragment. + * + * Signature must match the public key of the multicast group. + */ + struct GNUNET_CRYPTO_EccSignature signature; + + /** + * Number of the request fragment, monotonically increasing. + */ + uint64_t fragment_id GNUNET_PACKED; + + /** + * Byte offset of this @e fragment of the @e request. */ - struct GNUNET_CRYPTO_ECCPublicKey pub_key; + uint64_t fragment_offset GNUNET_PACKED; + + /** + * Number of the request this fragment belongs to. + * + * Set in GNUNET_MULTICAST_origin_to_all(). + */ + uint64_t request_id GNUNET_PACKED; /** * Flags for this request. */ enum GNUNET_MULTICAST_MessageFlags flags GNUNET_PACKED; + /* Followed by request body. */ +}; + +GNUNET_NETWORK_STRUCT_END + + +GNUNET_NETWORK_STRUCT_BEGIN + +struct GNUNET_MULTICAST_JoinRequest { /** - * Header for the request body. + * Header for the join request. + */ + struct GNUNET_MessageHeader header; + + /** + * ECC signature of the rest of the fields of the join request. * - * Two request types are specifically understood by multicast, namely "peer - * join", "peer part". Multicast will use those messages to update its list - * of candidates for content distribution. All other message types are - * application-specific. + * Signature must match the public key of the joining member. */ - struct GNUNET_MessageHeader body; + struct GNUNET_CRYPTO_EccSignature signature; + + /** + * Public key of the target group. + */ + struct GNUNET_CRYPTO_EccPublicKey group_key; + + /** + * Public key of the joining member. + */ + struct GNUNET_CRYPTO_EccPublicKey member_key; + + /** + * Peer identity of the joining member. + */ + struct GNUNET_PeerIdentity member_peer; /* Followed by request body. */ }; @@ -318,17 +377,18 @@ GNUNET_MULTICAST_join_decision (struct GNUNET_MULTICAST_JoinHandle *jh, * with the decision. * * @param cls Closure. - * @param peer Identity of the peer that wants to join. - * @param join_req Application-dependent join message from the new user + * @param peer Identity of the member that wants to join. + * @param join_req Application-dependent join message from the new member * (might, for example, contain a user, * bind user identity/pseudonym to peer identity, application-level * message to origin, etc.). * @param jh Join handle to pass to GNUNET_MULTICAST_join_decison(). */ -typedef void (*GNUNET_MULTICAST_JoinCallback)(void *cls, - const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_MessageHeader *join_req, - struct GNUNET_MULTICAST_JoinHandle *jh); +typedef void +(*GNUNET_MULTICAST_JoinCallback) (void *cls, + const struct GNUNET_EccPublicKey *member_key, + const struct GNUNET_MessageHeader *join_req, + struct GNUNET_MULTICAST_JoinHandle *jh); /** @@ -341,12 +401,12 @@ struct GNUNET_MULTICAST_MembershipTestHandle; * Call informing multicast about the decision taken for membership test. * * @param mth Handle that was given for the query. - * @param decision #GNUNET_YES if peer was a member, #GNUNET_NO if peer was not a member, - * #GNUNET_SYSERR if we cannot answer the membership test. + * @param result #GNUNET_YES if peer was a member, #GNUNET_NO if peer was not a member, + * #GNUNET_SYSERR if we cannot answer the membership test. */ void -GNUNET_MULTICAST_membership_test_answer (struct GNUNET_MULTICAST_MembershipTestHandle *mth, - int decision); +GNUNET_MULTICAST_membership_test_result (struct GNUNET_MULTICAST_MembershipTestHandle *mth, + int result); /** @@ -356,14 +416,15 @@ GNUNET_MULTICAST_membership_test_answer (struct GNUNET_MULTICAST_MembershipTestH * message can be replayed. * * @param cls Closure. - * @param peer Identity of the peer that we want to test. + * @param member_id Identity of the member that we want to test. * @param fragment_id Message fragment ID for which we want to do the test. * @param mth Handle to give to GNUNET_MULTICAST_membership_test_answer(). */ -typedef void (*GNUNET_MULTICAST_MembershipTestCallback)(void *cls, - const struct GNUNET_PeerIdentity *peer, - uint64_t fragment_id, - struct GNUNET_MULTICAST_MembershipTestHandle *mth); +typedef void +(*GNUNET_MULTICAST_MembershipTestCallback) (void *cls, + const struct GNUNET_CRYPTO_EccPublicKey *member_key, + uint64_t fragment_id, + struct GNUNET_MULTICAST_MembershipTestHandle *mth); /** @@ -375,10 +436,11 @@ typedef void (*GNUNET_MULTICAST_MembershipTestCallback)(void *cls, * @param req Request to the origin. * @param flags Flags for the request. */ -typedef void (*GNUNET_MULTICAST_RequestCallback) (void *cls, - const struct GNUNET_PeerIdentity *sender, - const struct GNUNET_MessageHeader *req, - enum GNUNET_MULTICAST_MessageFlags flags); +typedef void +(*GNUNET_MULTICAST_RequestCallback) (void *cls, + const struct GNUNET_EccPublicKey *member_key, + const struct GNUNET_MessageHeader *req, + enum GNUNET_MULTICAST_MessageFlags flags); /** @@ -394,8 +456,9 @@ typedef void (*GNUNET_MULTICAST_RequestCallback) (void *cls, * (or we were kicked out, and we should thus call * GNUNET_MULTICAST_member_part() next) */ -typedef void (*GNUNET_MULTICAST_MessageCallback) (void *cls, - const struct GNUNET_MULTICAST_MessageHeader *msg); +typedef void +(*GNUNET_MULTICAST_MessageCallback) (void *cls, + const struct GNUNET_MULTICAST_MessageHeader *msg); /** @@ -417,9 +480,10 @@ struct GNUNET_MULTICAST_ReplayHandle; * @param fragment_id Which message fragment should be replayed. * @param rh Handle to pass to message transmit function. */ -typedef void (*GNUNET_MULTICAST_ReplayCallback) (void *cls, - uint64_t fragment_id, - struct GNUNET_MULTICAST_ReplayHandle *rh); +typedef void +(*GNUNET_MULTICAST_ReplayCallback) (void *cls, + uint64_t fragment_id, + struct GNUNET_MULTICAST_ReplayHandle *rh); /** @@ -570,7 +634,9 @@ GNUNET_MULTICAST_origin_stop (struct GNUNET_MULTICAST_Origin *origin); * members of the group. * * @param cfg Configuration to use. - * @param pub_key ECC key that identifies the group. + * @param group_key ECC public key that identifies the group to join. + * @param member_key ECC key that identifies the member and used to sign + * requests sent to the origin. * @param origin Peer ID of the origin to send unicast requsets to. If NULL, * unicast requests are sent back via multiple hops on the reverse path * of multicast messages. @@ -600,7 +666,8 @@ GNUNET_MULTICAST_origin_stop (struct GNUNET_MULTICAST_Origin *origin); */ struct GNUNET_MULTICAST_Member * GNUNET_MULTICAST_member_join (const struct GNUNET_CONFIGURATION_Handle *cfg, - const struct GNUNET_CRYPTO_EccPublicKey *pub_key, + const struct GNUNET_CRYPTO_EccPublicKey *group_key, + const struct GNUNET_CRYPTO_EccPrivateKey *member_key, const struct GNUNET_PeerIdentity *origin, size_t relay_count, const struct GNUNET_PeerIdentity *relays, @@ -622,7 +689,7 @@ struct GNUNET_MULTICAST_MemberReplayHandle; /** * Request a message to be replayed. * - * Useful if messages below the @e max_known_*_id's given when joining are + * Useful if messages below the @e max_known_fragment_id given when joining are * needed and not known to the client. * * @param member Membership handle. @@ -671,6 +738,7 @@ struct GNUNET_MULTICAST_MemberRequestHandle; * Send a message to the origin of the multicast group. * * @param member Membership handle. + * @param message_id Application layer ID for the message. Opaque to multicast. * @param size Number of bytes we want to send to origin. * @param notify Callback to call to get the message. * @param notify_cls Closure for @a notify. @@ -678,6 +746,7 @@ struct GNUNET_MULTICAST_MemberRequestHandle; */ struct GNUNET_MULTICAST_MemberRequestHandle * GNUNET_MULTICAST_member_to_origin (struct GNUNET_MULTICAST_Member *member, + uint64_t message_id, size_t size, GNUNET_CONNECTION_TransmitReadyNotify notify, void *notify_cls); @@ -692,46 +761,6 @@ void GNUNET_MULTICAST_member_to_origin_cancel (struct GNUNET_MULTICAST_MemberRequestHandle *rh); -/** - * Handle to access multicast group operations for both the origin and members. - */ -struct GNUNET_MULTICAST_Group; - - -/** - * Convert a group @a origin to a @e group handle to access the @e group APIs. - * - * @param origin Group origin handle. - * @return Group handle, valid for as long as @a origin is valid. - */ -struct GNUNET_MULTICAST_Group * -GNUNET_MULTICAST_origin_get_group (struct GNUNET_MULTICAST_Origin *origin); - - -/** - * Convert @a member to a @e group handle to access the @e group APIs. - * - * @param member Member handle. - * @return Group handle, valid for as long as @a member is valid. - */ -struct GNUNET_MULTICAST_Group * -GNUNET_MULTICAST_member_get_group (struct GNUNET_MULTICAST_Member *member); - - -/** - * Remove a peer from the group. - * - * After a message was received notifying about a leaving member, remove the - * member from the multicast group. Fragments with a greater @a message_id than - * the specified one won't be transmitted to the member anymore, but the - * transmission of lower or equal ones will still be performed. - */ -void -GNUNET_MULTICAST_group_member_remove (struct GNUNET_MULTICAST_Group *group, - const struct GNUNET_PeerIdentity *peer, - uint64_t message_id); - - #if 0 /* keep Emacsens' auto-indent happy */ { #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; * to a @e method. * * @param cls Closure. - * @param sender Who transmitted the message (master, except for messages - * from one of the slaves to the master). - * @param message_id Unique message counter for this message; - * (unique only in combination with the given sender for - * this channel). - * @param method_name Original method name from PSYC (may be more - * specific than the registered method name due to try-and-slice matching). - * FIXME: no try-and-slice for methods defined here. - * @param header_length Number of modifiers in header. - * @param header Modifiers present in the message. FIXME: use environment instead? + * @param slave_key Who transmitted the message. + * - NULL for multicast messages from the master. + * - The hash of the sending slave's public key for unicast requests from + * one of the slaves to the master. + * @param message_id Unique message counter for this message. + * Unique only in combination with the given sender for this channel. + * @param method_name Method name from PSYC. + * @param modifier_count Number of elements in the @a modifiers array. + * @param modifiers State modifiers and transient variables for the message. * @param data_offset Byte offset of @a data in the overall data of the method. * @param data_size Number of bytes in @a data. * @param data Data stream given to the method (might not be zero-terminated * if data is binary). * @param frag Fragmentation status for the data. */ -typedef int (*GNUNET_PSYC_Method)(void *cls, - const struct GNUNET_PeerIdentity *sender, - uint64_t message_id, - const char *method_name, - size_t header_length, - GNUNET_PSYC_Modifier *header, - uint64_t data_offset, - size_t data_size, - const void *data, - enum GNUNET_PSYC_MessageFlags flags); +typedef int +(*GNUNET_PSYC_Method) (void *cls, + const struct GNUNET_CRYPTO_EccPublicKey *slave_key, + uint64_t message_id, + const char *method_name, + size_t modifier_count, + const GNUNET_ENV_Modifier *modifiers, + uint64_t data_offset, + size_t data_size, + const void *data, + enum GNUNET_PSYC_MessageFlags flags); /** * Method called from PSYC upon receiving a join request. * * @param cls Closure. - * @param peer Peer requesting to join. + * @param slave requesting to join. * @param method_name Method name in the join request. - * @param header_length Number of modifiers in header. - * @param header Modifiers present in the message. + * @param variable_count Number of elements in the @a variables array. + * @param variables Transient variables for the join request. * @param data_size Number of bytes in @a data. * @param data Data stream given to the method (might not be zero-terminated * if data is binary). */ -typedef int (*GNUNET_PSYC_JoinCallback)(void *cls, - const struct GNUNET_PeerIdentity *peer, - const char *method_name, - size_t header_length, - GNUNET_PSYC_Modifier *header, - size_t data_size, - const void *data, - struct GNUNET_PSYC_JoinHandle *jh); +typedef int +(*GNUNET_PSYC_JoinCallback) (void *cls, + const struct GNUNET_CRYPTO_EccPublicKey *slave_key, + const char *method_name, + size_t variable_count, + const GNUNET_ENV_Modifier *variables, + size_t data_size, + const void *data, + struct GNUNET_PSYC_JoinHandle *jh); /** @@ -194,7 +195,7 @@ typedef int (*GNUNET_PSYC_JoinCallback)(void *cls, * * @param jh Join request handle. * @param is_admitted #GNUNET_YES if joining is approved, - * #GNUNET_NO if it is disapproved + * #GNUNET_NO if it is disapproved. * @param relay_count Number of relays given. * @param relays Array of suggested peers that might be useful relays to use * when joining the multicast group (essentially a list of peers that @@ -238,7 +239,7 @@ struct GNUNET_PSYC_Master; * inform PSYC about the meaning of the respective events. * * @param cfg Configuration to use (to connect to PSYC service). - * @param priv_key ECC key that will be used to sign messages for this + * @param channel_key ECC key that will be used to sign messages for this * PSYC session. The public key is used to identify the PSYC channel. * Note that end-users will usually not use the private key directly, but * rather look it up in GADS for places managed by other users, or select @@ -247,14 +248,14 @@ struct GNUNET_PSYC_Master; * one in the future. * @param policy Group policy specifying join and history restrictions. * Used to automate group management decisions. - * @param method Function to invoke on messages received from members. + * @param method Function to invoke on messages received from slaves. * @param join_cb Function to invoke when a peer wants to join. * @param cls Closure for @a method and @a join_cb. * @return Handle for the channel master, NULL on error. */ struct GNUNET_PSYC_Master * GNUNET_PSYC_master_start (const struct GNUNET_CONFIGURATION_Handle *cfg, - const struct GNUNET_CRYPTO_EccPrivateKey *priv_key, + const struct GNUNET_CRYPTO_EccPrivateKey *channel_key, enum GNUNET_MULTICAST_GroupPolicy policy, GNUNET_PSYC_Method method, GNUNET_PSYC_JoinCallback join_cb, @@ -279,10 +280,11 @@ GNUNET_PSYC_master_start (const struct GNUNET_CONFIGURATION_Handle *cfg, * (should be used if @a *data_size was not big enough to take all the data) * #GNUNET_YES if this completes the transmission (all data supplied) */ -typedef int (*GNUNET_PSYC_MasterReadyNotify)(void *cls, - uint64_t message_id, - size_t *data_size, - void *data); +typedef int +(*GNUNET_PSYC_MasterReadyNotify)(void *cls, + uint64_t message_id, + size_t *data_size, + void *data); /** @@ -327,7 +329,7 @@ GNUNET_PSYC_master_transmit_cancel (struct GNUNET_PSYC_MasterTransmitHandle *th) * * @param master PSYC channel master to stop. */ -tvoid +void GNUNET_PSYC_master_stop (struct GNUNET_PSYC_Master *master); @@ -348,8 +350,14 @@ struct GNUNET_PSYC_Slave; * and disapproval is simply being ignored). * * @param cfg Configuration to use. - * @param pub_key ECC key that identifies the channel we wish to join. + * @param channel_key ECC public key that identifies the channel we wish to join. + * @param slave_key ECC private-public key pair that identifies the slave, and + * used by multicast to sign the join request and subsequent unicast + * requests sent to the master. * @param origin Peer identity of the origin. + * @param relay_count Number of peers in the @a relays array. + * @param relays Peer identities of members of the multicast group, which serve + * as relays and used to join the group at. * @param method Function to invoke on messages received from the channel, * typically at least contains functions for @e join and @e part. * @param join_cb Function to invoke when a peer wants to join. @@ -362,8 +370,11 @@ struct GNUNET_PSYC_Slave; */ struct GNUNET_PSYC_Slave * GNUNET_PSYC_slave_join (const struct GNUNET_CONFIGURATION_Handle *cfg, - const struct GNUNET_CRYPTO_EccPublicKey *pub_key, + const struct GNUNET_CRYPTO_EccPublicKey *channel_key, + const struct GNUNET_CRYPTO_EccPrivateKey *slave_key, const struct GNUNET_PeerIdentity *origin, + size_t relay_count, + const struct GNUNET_PeerIdentity *relays, GNUNET_PSYC_Method method, GNUNET_PSYC_JoinCallback join_cb, void *cls, @@ -401,9 +412,10 @@ GNUNET_PSYC_slave_part (struct GNUNET_PSYC_Slave *slave); * #GNUNET_NO on success, if more data is to be transmitted later. * #GNUNET_YES if this completes the transmission (all data supplied). */ -typedef int (*GNUNET_PSYC_SlaveReadyNotify)(void *cls, - size_t *data_size, - char *data); +typedef int +(*GNUNET_PSYC_SlaveReadyNotify) (void *cls, + size_t *data_size, + char *data); /** @@ -466,10 +478,10 @@ GNUNET_PSYC_slave_get_channel (struct GNUNET_PSYC_Slave *slave); /** - * Add a member to the channel. + * Add a slave to the channel's membership list. * * Note that this will NOT generate any PSYC traffic, it will merely update the - * local data base to modify how we react to membership test queries. + * local database to modify how we react to membership test queries. * The channel master still needs to explicitly transmit a @e join message to * notify other channel members and they then also must still call this function * 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); * application; for example, there might be a @e part_all method to kick out * everyone. * - * Note that channel members are explicitly trusted to execute such methods - * correctly; not doing so correctly will result in either denying members + * Note that channel slaves are explicitly trusted to execute such methods + * correctly; not doing so correctly will result in either denying other slaves * access or offering access to channel data to non-members. * * @param channel Channel handle. - * @param member Which peer to add. + * @param slave_key Identity of channel slave to add. * @param message_id Message ID for the message that changed the membership. */ void -GNUNET_PSYC_channel_member_add (struct GNUNET_PSYC_Channel *channel, - const struct GNUNET_PeerIdentity *member, - uint64_t message_id); +GNUNET_PSYC_channel_slave_add (struct GNUNET_PSYC_Channel *channel, + const struct GNUNET_CRYPTO_EccPublicKey *slave_key, + uint64_t message_id); /** - * Remove a member from the channel. + * Remove a slave from the channel's membership list. * * Note that this will NOT generate any PSYC traffic, it will merely update the - * local data base to modify how we react to membership test queries. + * local database to modify how we react to membership test queries. * The channel master still needs to explicitly transmit a @e part message to * notify other channel members and they then also must still call this function * 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, * non-members. * * @param channel Channel handle. - * @param member Which peer to remove. + * @param slave_key Identity of channel slave to remove. * @param message_id Message ID for the message that changed the membership. */ void -GNUNET_PSYC_channel_member_remove (struct GNUNET_PSYC_Channel *channel, - const struct GNUNET_PeerIdentity *member, - uint64_t message_id); +GNUNET_PSYC_channel_slave_remove (struct GNUNET_PSYC_Channel *channel, + const struct GNUNET_CRYPTO_EccPublicKey *slave_key, + uint64_t message_id); /** @@ -526,10 +538,11 @@ GNUNET_PSYC_channel_member_remove (struct GNUNET_PSYC_Channel *channel, * @param value Value of the state variable. * @param value_size Number of bytes in @a value. */ -typedef void (*GNUNET_PSYC_StateCallback)(void *cls, - const char *name, - size_t value_size, - const void *value); +typedef void +(*GNUNET_PSYC_StateCallback) (void *cls, + const char *name, + size_t value_size, + const void *value); /** @@ -626,7 +639,7 @@ GNUNET_PSYC_channel_state_get_all (struct GNUNET_PSYC_Channel *channel, * needed as variables might contain binary data and * might also not be 0-terminated; set to 0 on errors. * @return NULL on error (no matching state or variable), pointer - to the respective value otherwise. + * to the respective value otherwise. */ const void * 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; /** * Function called with the result of an asynchronous operation. -; * + * * @param result #GNUNET_SYSERR on error, * #GNUNET_YES on success or if the peer was a member, * #GNUNET_NO if the peer was not a member */ -typedef void (*GNUNET_PSYCSTORE_ContinuationCallback)(void *cls, - int result); +typedef void (*GNUNET_PSYCSTORE_ResultCallback)(void *cls, + int result); /** * Store join/leave events for a PSYC channel in order to be able to answer * membership test queries later. * * @param h Handle for the PSYCstore. - * @param channel_id ID of the channel where the event happened. + * @param channel_key The channel where the event happened. + * @param slave_key Public key of joining/leaving slave. * @param message_id ID of the message in which this event was announced. - * @param peer Identity of joining/leaving peer. * @param did_join #GNUNET_YES on join, #GNUNET_NO on leave. - * @param ccb Callback to call with the result of the storage operation. - * @param ccb_cls Closure for the callback. + * @param rcb Callback to call with the result of the storage operation. + * @param rcb_cls Closure for the callback. * * @return Operation handle that can be used to cancel the operation. */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_membership_store (struct GNUNET_PSYCSTORE_Handle *h, - const struct GNUNET_HashCode *channel_id, + const struct GNUNET_CRYPTO_EccPublicKey *channel_key, + const struct GNUNET_CRYPTO_EccPublicKey *slave_key, uint64_t message_id, - const struct GNUNET_PeerIdentity *peer, int did_join, - GNUNET_PSYCSTORE_ContinuationCallback ccb, - void *ccb_cls); + GNUNET_PSYCSTORE_ResultCallback rcb, + void *rcb_cls); /** @@ -117,40 +117,40 @@ GNUNET_PSYCSTORE_membership_store (struct GNUNET_PSYCSTORE_Handle *h, * to see the requested message. * * @param h Handle for the PSYCstore. - * @param channel_id The channel we are interested in. + * @param channel_key The channel we are interested in. + * @param slave_key Public key of slave whose membership to check. * @param fragment_id Message fragment ID to check. - * @param peer Peer whose membership to check. - * @param ccb Callback to call with the test result. - * @param ccb_cls Closure for the callback. + * @param rcb Callback to call with the test result. + * @param rcb_cls Closure for the callback. * * @return Operation handle that can be used to cancel the operation. */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_membership_test (struct GNUNET_PSYCSTORE_Handle *h, - const struct GNUNET_HashCode *channel_id, + const struct GNUNET_CRYPTO_EccPublicKey *channel_key, + const struct GNUNET_CRYPTO_EccPublicKey *slave_key, uint64_t fragment_id, - const struct GNUNET_PeerIdentity *peer, - GNUNET_PSYCSTORE_ContinuationCallback ccb, - void *ccb_cls); + GNUNET_PSYCSTORE_ResultCallback rcb, + void *rcb_cls); /** * Store a message fragment sent to a channel. * * @param h Handle for the PSYCstore. - * @param channel_id The channel the message belongs to. + * @param channel_key The channel the message belongs to. * @param message Message to store. - * @param ccb Callback to call with the result of the operation. - * @param ccb_cls Closure for the callback. + * @param rcb Callback to call with the result of the operation. + * @param rcb_cls Closure for the callback. * * @return Handle that can be used to cancel the operation. */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_fragment_store (struct GNUNET_PSYCSTORE_Handle *h, - const struct GNUNET_HashCode *channel_id, + const struct GNUNET_CRYPTO_EccPublicKey *channel_key, const struct GNUNET_MULTICAST_MessageHeader *message, - GNUNET_PSYCSTORE_ContinuationCallback ccb, - void *ccb_cls); + GNUNET_PSYCSTORE_ResultCallback rcb, + void *rcb_cls); /** @@ -170,7 +170,7 @@ typedef void (*GNUNET_PSYCSTORE_FragmentResultCallback)(void *cls, * Retrieve a message fragment by fragment ID. * * @param h Handle for the PSYCstore. - * @param channel_id The channel we are interested in. + * @param channel_key The channel we are interested in. * @param fragment_id Fragment ID to check. Use 0 to get the latest message fragment. * @param rcb Callback to call with the result of the operation. * @param rcb_cls Closure for the callback. @@ -179,7 +179,7 @@ typedef void (*GNUNET_PSYCSTORE_FragmentResultCallback)(void *cls, */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h, - const struct GNUNET_HashCode *channel_id, + const struct GNUNET_CRYPTO_EccPublicKey *channel_key, uint64_t fragment_id, GNUNET_PSYCSTORE_FragmentResultCallback rcb, void *rcb_cls); @@ -189,7 +189,7 @@ GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h, * Retrieve a message by ID. * * @param h Handle for the PSYCstore. - * @param channel_id The channel we are interested in. + * @param channel_key The channel we are interested in. * @param message_id Message ID to check. Use 0 to get the latest message. * @param rcb Callback to call with the result of the operation. * @param rcb_cls Closure for the callback. @@ -198,7 +198,7 @@ GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h, */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h, - const struct GNUNET_HashCode *channel_id, + const struct GNUNET_CRYPTO_EccPublicKey *channel_key, uint64_t message_id, GNUNET_PSYCSTORE_FragmentResultCallback rcb, void *rcb_cls); @@ -213,27 +213,27 @@ GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h, * operations before the current one. * * @param h Handle for the PSYCstore. - * @param channel_id The channel we are interested in. + * @param channel_key The channel we are interested in. * @param message_id ID of the message that contains this state modifier. * @param oper Operation to perform. * @param name Name of variable. * @param value_size Size of @a value. * @param value Value of variable. - * @param ccb Callback to call with the result of the operation. - * @param ccb_cls Closure for the callback. + * @param rcb Callback to call with the result of the operation. + * @param rcb_cls Closure for the callback. * * @return Handle that can be used to cancel the operation. */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_state_modify (struct GNUNET_PSYCSTORE_Handle *h, - const struct GNUNET_HashCode *channel_id, + const struct GNUNET_CRYPTO_EccPublicKey *channel_key, uint64_t message_id, enum GNUNET_ENV_Operator *oper, const char *name, size_t value_size, const void *value, - GNUNET_PSYCSTORE_ContinuationCallback ccb, - void *ccb_cls); + GNUNET_PSYCSTORE_ResultCallback rcb, + void *rcb_cls); /** @@ -255,7 +255,7 @@ typedef void (*GNUNET_PSYCSTORE_StateResultCallback)(void *cls, * Retrieve the given state variable for a channel. * * @param h Handle for the PSYCstore. - * @param channel_id The channel we are interested in. + * @param channel_key The channel we are interested in. * @param name Name of variable to get. * @param rcb Callback to call with the result. * @param rcb_cls Closure for the callback. @@ -264,7 +264,7 @@ typedef void (*GNUNET_PSYCSTORE_StateResultCallback)(void *cls, */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_state_get (struct GNUNET_PSYCSTORE_Handle *h, - const struct GNUNET_HashCode *channel_id, + const struct GNUNET_CRYPTO_EccPublicKey *channel_key, const char *name, GNUNET_PSYCSTORE_StateResultCallback rcb, void *rcb_cls); @@ -274,7 +274,7 @@ GNUNET_PSYCSTORE_state_get (struct GNUNET_PSYCSTORE_Handle *h, * Retrieve all state variables for a channel. * * @param h Handle for the PSYCstore. - * @param channel_id The channel we are interested in. + * @param channel_key The channel we are interested in. * @param rcb Callback to call with the result. * @param rcb_cls Closure for the callback. * @@ -282,7 +282,7 @@ GNUNET_PSYCSTORE_state_get (struct GNUNET_PSYCSTORE_Handle *h, */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_state_get_all (struct GNUNET_PSYCSTORE_Handle *h, - const struct GNUNET_HashCode *channel_id, + const struct GNUNET_CRYPTO_EccPublicKey *channel_key, GNUNET_PSYCSTORE_StateResultCallback rcb, void *rcb_cls); 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, * GNUNET_SOCIAL_home_leave(). * * @param cfg Configuration to contact the social service. - * @param home_keyfile File with the private key for the home, + * @param home_keyfile File with the private-public key pair of the home, * created if the file does not exist; pass NULL for ephemeral homes. * @param policy Policy specifying entry and history restrictions of the home. * @param ego Owner of the home (host). @@ -295,29 +295,27 @@ GNUNET_SOCIAL_home_reject_entry (struct GNUNET_SOCIAL_Home *home, /** - * Get the identity of a user. + * Get the public key of a nym. * * Suitable, for example, to be used with GNUNET_NAMESTORE_zone_to_name(). * * @param nym Pseudonym to map to a cryptographic identifier. - * @param[out] identity Set to the identity of the nym (short hash of the public key). + * @param[out] identity Set to the public key of the nym. */ void -GNUNET_SOCIAL_nym_get_identity (struct GNUNET_SOCIAL_Nym *nym, - struct GNUNET_CRYPTO_ShortHashCode *identity); +GNUNET_SOCIAL_nym_get_key (struct GNUNET_SOCIAL_Nym *nym, + struct GNUNET_CRYPTO_EccPublicKey *nym_key); /** - * Obtain the (cryptographic, binary) address for the home. + * Obtain the private-public key pair of the home. * - * @param home Home to get the (public) address from. - * @param[out] crypto_address Address suitable for storing in GADS, i.e. in - * 'HEX.place' or within the respective GADS record type ("PLACE") + * @param home Home to get the key of. + * @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. */ void -GNUNET_SOCIAL_home_get_address (struct GNUNET_SOCIAL_Home *home, - struct GNUNET_HashCode *crypto_address); - +GNUNET_SOCIAL_home_get_key (struct GNUNET_SOCIAL_Home *home, + struct GNUNET_CRYPTO_EccPrivateKey *home_key); /** @@ -409,9 +407,10 @@ GNUNET_SOCIAL_home_leave (struct GNUNET_SOCIAL_Home *home); * @param cfg Configuration to contact the social service. * @param ego Owner of the home (host). * @param address GADS name of the place to enter. Either in the form of - * 'room.friend.gads', or 'HEX.zkey'. This latter case refers to the - * 'PLACE' record in the GADS zone with the public key 'HEX', and can be - * used to request entry to a pseudonym's place directly. + * 'room.friend.gads', or 'NYMPUBKEY.zkey'. This latter case refers to + * the 'PLACE' record of the empty label ("+") in the GADS zone with the + * nym's public key 'NYMPUBKEY', and can be used to request entry to a + * pseudonym's place directly. * @param env Environment containing variables for the message, or NULL. * @param data_size Number of bytes in @a data. * @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, struct GNUNET_SOCIAL_Place * GNUNET_SOCIAL_place_enter2 (const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_SOCIAL_Ego *ego, - struct GNUNET_HashCode *crypto_address, + struct GNUNET_CRYPTO_EccPublicKey *crypto_address, struct GNUNET_PeerIdentity *peer, struct GNUNET_SOCIAL_Slicer *slicer, const struct GNUNET_ENV_Environment *env, -- 2.25.1