[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r33950 - in gnunet/src: include multicast psyc psycstore
From: |
gnunet |
Subject: |
[GNUnet-SVN] r33950 - in gnunet/src: include multicast psyc psycstore |
Date: |
Thu, 10 Jul 2014 19:49:53 +0200 |
Author: tg
Date: 2014-07-10 19:49:53 +0200 (Thu, 10 Jul 2014)
New Revision: 33950
Modified:
gnunet/src/include/gnunet_gnsrecord_lib.h
gnunet/src/include/gnunet_multicast_service.h
gnunet/src/include/gnunet_protocols.h
gnunet/src/include/gnunet_psyc_service.h
gnunet/src/include/gnunet_psyc_util_lib.h
gnunet/src/include/gnunet_psycstore_plugin.h
gnunet/src/include/gnunet_psycstore_service.h
gnunet/src/include/gnunet_social_service.h
gnunet/src/multicast/gnunet-service-multicast.c
gnunet/src/multicast/multicast.h
gnunet/src/multicast/multicast_api.c
gnunet/src/psyc/gnunet-service-psyc.c
gnunet/src/psyc/psyc.h
gnunet/src/psyc/psyc_api.c
gnunet/src/psyc/psyc_util_lib.c
gnunet/src/psyc/test_psyc.c
gnunet/src/psycstore/plugin_psycstore_sqlite.c
gnunet/src/psycstore/psycstore.h
gnunet/src/psycstore/psycstore_api.c
Log:
PSYC(store), Multicast: use ECDSA slave/member keys; PSYC: add
GNUNET_PSYC_message_create()
Modified: gnunet/src/include/gnunet_gnsrecord_lib.h
===================================================================
--- gnunet/src/include/gnunet_gnsrecord_lib.h 2014-07-10 10:38:46 UTC (rev
33949)
+++ gnunet/src/include/gnunet_gnsrecord_lib.h 2014-07-10 17:49:53 UTC (rev
33950)
@@ -173,10 +173,32 @@
};
-
GNUNET_NETWORK_STRUCT_BEGIN
+/**
+ * Data stored in a PLACE record.
+ */
+struct GNUNET_GNSRECORD_PlaceData
+{
+ /**
+ * Public key of the place.
+ */
+ struct GNUNET_CRYPTO_EddsaPublicKey place_key;
+ /**
+ * Peer identity of the origin.
+ */
+ struct GNUNET_PeerIdentity origin;
+
+ /**
+ * Number of relays that follow.
+ */
+ uint32_t relay_count GNUNET_PACKED;
+
+ /* Followed by struct GNUNET_PeerIdentity relays[relay_count] */
+};
+
+
/**
* Information we have in an encrypted block with record data (i.e. in the
DHT).
*/
Modified: gnunet/src/include/gnunet_multicast_service.h
===================================================================
--- gnunet/src/include/gnunet_multicast_service.h 2014-07-10 10:38:46 UTC
(rev 33949)
+++ gnunet/src/include/gnunet_multicast_service.h 2014-07-10 17:49:53 UTC
(rev 33950)
@@ -174,14 +174,14 @@
/**
* Public key of the sending member.
*/
- struct GNUNET_CRYPTO_EddsaPublicKey member_key;
+ struct GNUNET_CRYPTO_EcdsaPublicKey member_key;
/**
* ECC signature of the request fragment.
*
* Signature must match the public key of the multicast group.
*/
- struct GNUNET_CRYPTO_EddsaSignature signature;
+ struct GNUNET_CRYPTO_EcdsaSignature signature;
/**
* Purpose for the signature and size of the signed data.
@@ -280,7 +280,7 @@
*/
typedef void
(*GNUNET_MULTICAST_JoinRequestCallback) (void *cls,
- const struct
GNUNET_CRYPTO_EddsaPublicKey *member_key,
+ const struct
GNUNET_CRYPTO_EcdsaPublicKey *member_key,
const struct GNUNET_MessageHeader
*join_msg,
struct GNUNET_MULTICAST_JoinHandle
*jh);
@@ -344,7 +344,7 @@
*/
typedef void
(*GNUNET_MULTICAST_MembershipTestCallback) (void *cls,
- const struct
GNUNET_CRYPTO_EddsaPublicKey *member_key,
+ const struct
GNUNET_CRYPTO_EcdsaPublicKey *member_key,
uint64_t message_id,
uint64_t group_generation,
struct
GNUNET_MULTICAST_MembershipTestHandle *mth);
@@ -430,7 +430,7 @@
*/
typedef void
(*GNUNET_MULTICAST_ReplayFragmentCallback) (void *cls,
- const struct
GNUNET_CRYPTO_EddsaPublicKey *member_key,
+ const struct
GNUNET_CRYPTO_EcdsaPublicKey *member_key,
uint64_t fragment_id,
uint64_t flags,
struct
GNUNET_MULTICAST_ReplayHandle *rh);
@@ -453,7 +453,7 @@
*/
typedef void
(*GNUNET_MULTICAST_ReplayMessageCallback) (void *cls,
- const struct
GNUNET_CRYPTO_EddsaPublicKey *member_key,
+ const struct
GNUNET_CRYPTO_EcdsaPublicKey *member_key,
uint64_t message_id,
uint64_t fragment_offset,
uint64_t flags,
@@ -712,7 +712,7 @@
struct GNUNET_MULTICAST_Member *
GNUNET_MULTICAST_member_join (const struct GNUNET_CONFIGURATION_Handle *cfg,
const struct GNUNET_CRYPTO_EddsaPublicKey
*group_key,
- const struct GNUNET_CRYPTO_EddsaPrivateKey
*member_key,
+ const struct GNUNET_CRYPTO_EcdsaPrivateKey
*member_key,
const struct GNUNET_PeerIdentity *origin,
uint16_t relay_count,
const struct GNUNET_PeerIdentity *relays,
Modified: gnunet/src/include/gnunet_protocols.h
===================================================================
--- gnunet/src/include/gnunet_protocols.h 2014-07-10 10:38:46 UTC (rev
33949)
+++ gnunet/src/include/gnunet_protocols.h 2014-07-10 17:49:53 UTC (rev
33950)
@@ -2180,7 +2180,7 @@
/** Message part: message cancelled */
#define GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_CANCEL 697
-/** S->C: message acknowledgment */
+/** S->C: message acknowledgement */
#define GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_ACK 698
/* 699-700 */
@@ -2479,23 +2479,23 @@
/** S->C: result of an operation */
#define GNUNET_MESSAGE_TYPE_SOCIAL_RESULT_CODE 840
-/** C->S: request to enter a home as the host */
-#define GNUNET_MESSAGE_TYPE_SOCIAL_HOME_ENTER 841
+/** C->S: request to enter a place as the host */
+#define GNUNET_MESSAGE_TYPE_SOCIAL_HOST_ENTER 841
-/** S->C: home enter acknowledgement */
-#define GNUNET_MESSAGE_TYPE_SOCIAL_HOME_ENTER_ACK 842
+/** S->C: host enter acknowledgement */
+#define GNUNET_MESSAGE_TYPE_SOCIAL_HOST_ENTER_ACK 842
/** C->S: request to enter a place as a guest */
-#define GNUNET_MESSAGE_TYPE_SOCIAL_PLACE_ENTER 843
+#define GNUNET_MESSAGE_TYPE_SOCIAL_GUEST_ENTER 843
-/** S->C: guest join acknowledgement */
-#define GNUNET_MESSAGE_TYPE_SOCIAL_PLACE_ENTER_ACK 844
+/** S->C: guest enter acknowledgement */
+#define GNUNET_MESSAGE_TYPE_SOCIAL_GUEST_ENTER_ACK 844
-/** P->S->C: incoming join request from PSYC */
-#define GNUNET_MESSAGE_TYPE_SOCIAL_JOIN_REQUEST 847
+/** P->S->C: incoming entry request from PSYC */
+#define GNUNET_MESSAGE_TYPE_SOCIAL_ENTRY_REQUEST 845
-/** C->S->P: decision about a join request */
-#define GNUNET_MESSAGE_TYPE_SOCIAL_JOIN_DECISION 848
+/** C->S->P: decision about an entry request */
+#define GNUNET_MESSAGE_TYPE_SOCIAL_ENTRY_DECISION 846
/*******************************************************************************
* X-VINE DHT messages
Modified: gnunet/src/include/gnunet_psyc_service.h
===================================================================
--- gnunet/src/include/gnunet_psyc_service.h 2014-07-10 10:38:46 UTC (rev
33949)
+++ gnunet/src/include/gnunet_psyc_service.h 2014-07-10 17:49:53 UTC (rev
33950)
@@ -218,7 +218,7 @@
* Sending slave's public key.
* Not set if the message is from the master.
*/
- struct GNUNET_CRYPTO_EddsaPublicKey slave_key;
+ struct GNUNET_CRYPTO_EcdsaPublicKey slave_key;
/* Followed by concatenated PSYC message parts:
* messages with GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_* types
@@ -279,6 +279,63 @@
/* Followed by NUL-terminated name, then the value. */
};
+
+struct GNUNET_PSYC_CountersResultMessage
+{
+ /**
+ * Type: GNUNET_MESSAGE_TYPE_PSYC_RESULT_COUNTERS
+ */
+ struct GNUNET_MessageHeader header;
+
+ /**
+ * Status code for the operation.
+ */
+ int32_t result_code GNUNET_PACKED;
+
+ /**
+ * Last message ID sent to the channel.
+ */
+ uint64_t max_message_id;
+};
+
+
+struct GNUNET_PSYC_JoinRequestMessage
+{
+ /**
+ * Type: GNUNET_MESSAGE_TYPE_PSYC_MASTER_JOIN_REQUEST
+ */
+ struct GNUNET_MessageHeader header;
+ /**
+ * Public key of the joining slave.
+ */
+ struct GNUNET_CRYPTO_EcdsaPublicKey slave_key;
+
+ /* Followed by struct GNUNET_MessageHeader join_request */
+};
+
+
+struct GNUNET_PSYC_JoinDecisionMessage
+{
+ /**
+ * Type: GNUNET_MESSAGE_TYPE_PSYC_JOIN_DECISION
+ */
+ struct GNUNET_MessageHeader header;
+
+ /**
+ * #GNUNET_YES if the slave was admitted.
+ */
+ int32_t is_admitted;
+
+ /**
+ * Public key of the joining slave.
+ * Only set when the master is sending the decision,
+ * not set when a slave is receiving it.
+ */
+ struct GNUNET_CRYPTO_EcdsaPublicKey slave_key;
+
+ /* Followed by struct GNUNET_MessageHeader join_response */
+};
+
GNUNET_NETWORK_STRUCT_END
@@ -296,6 +353,23 @@
/**
+ * PSYC message part processing states.
+ */
+enum GNUNET_PSYC_MessageState
+{
+ GNUNET_PSYC_MESSAGE_STATE_START = 0,
+ GNUNET_PSYC_MESSAGE_STATE_HEADER = 1,
+ GNUNET_PSYC_MESSAGE_STATE_METHOD = 2,
+ GNUNET_PSYC_MESSAGE_STATE_MODIFIER = 3,
+ GNUNET_PSYC_MESSAGE_STATE_MOD_CONT = 4,
+ GNUNET_PSYC_MESSAGE_STATE_DATA = 5,
+ GNUNET_PSYC_MESSAGE_STATE_END = 6,
+ GNUNET_PSYC_MESSAGE_STATE_CANCEL = 7,
+ GNUNET_PSYC_MESSAGE_STATE_ERROR = 8,
+};
+
+
+/**
* Handle that identifies a join request.
*
* Used to match calls to #GNUNET_PSYC_JoinCallback to the
@@ -335,7 +409,7 @@
typedef void
(*GNUNET_PSYC_JoinRequestCallback) (void *cls,
const struct
- GNUNET_CRYPTO_EddsaPublicKey *slave_key,
+ GNUNET_CRYPTO_EcdsaPublicKey *slave_key,
const struct
GNUNET_PSYC_MessageHeader *join_msg,
struct GNUNET_PSYC_JoinHandle *jh);
@@ -348,9 +422,10 @@
* #GNUNET_PSYC_JoinCallback.
*
* @param jh Join request handle.
- * @param is_admitted #GNUNET_YES if the join is approved,
- * #GNUNET_NO if it is disapproved,
- * #GNUNET_SYSERR if we cannot answer the request.
+ * @param is_admitted
+ * #GNUNET_YES if the join is approved,
+ * #GNUNET_NO if it is disapproved,
+ * #GNUNET_SYSERR if we cannot answer the request.
* @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
@@ -646,7 +721,7 @@
struct GNUNET_PSYC_Slave *
GNUNET_PSYC_slave_join (const struct GNUNET_CONFIGURATION_Handle *cfg,
const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
- const struct GNUNET_CRYPTO_EddsaPrivateKey *slave_key,
+ const struct GNUNET_CRYPTO_EcdsaPrivateKey *slave_key,
const struct GNUNET_PeerIdentity *origin,
uint32_t relay_count,
const struct GNUNET_PeerIdentity *relays,
@@ -654,10 +729,7 @@
GNUNET_PSYC_SlaveConnectCallback slave_connect_cb,
GNUNET_PSYC_JoinDecisionCallback join_decision_cb,
void *cls,
- const char *method_name,
- const struct GNUNET_ENV_Environment *env,
- const void *data,
- uint16_t data_size);
+ const struct GNUNET_MessageHeader *join_msg);
/**
@@ -775,7 +847,7 @@
*/
void
GNUNET_PSYC_channel_slave_add (struct GNUNET_PSYC_Channel *channel,
- const struct GNUNET_CRYPTO_EddsaPublicKey
*slave_key,
+ const struct GNUNET_CRYPTO_EcdsaPublicKey
*slave_key,
uint64_t announced_at,
uint64_t effective_since);
@@ -803,7 +875,7 @@
*/
void
GNUNET_PSYC_channel_slave_remove (struct GNUNET_PSYC_Channel *channel,
- const struct GNUNET_CRYPTO_EddsaPublicKey
+ const struct GNUNET_CRYPTO_EcdsaPublicKey
*slave_key,
uint64_t announced_at);
Modified: gnunet/src/include/gnunet_psyc_util_lib.h
===================================================================
--- gnunet/src/include/gnunet_psyc_util_lib.h 2014-07-10 10:38:46 UTC (rev
33949)
+++ gnunet/src/include/gnunet_psyc_util_lib.h 2014-07-10 17:49:53 UTC (rev
33950)
@@ -40,6 +40,28 @@
#include "gnunet_psyc_service.h"
+/**
+ * Create a PSYC message.
+ *
+ * @param method_name
+ * PSYC method for the message.
+ * @param env
+ * Environment for the message.
+ * @param data
+ * Data payload for the message.
+ * @param data_size
+ * Size of @a data.
+ *
+ * @return Message header with size information,
+ * followed by the message parts.
+ */
+struct GNUNET_MessageHeader *
+GNUNET_PSYC_message_create (const char *method_name,
+ const struct GNUNET_ENV_Environment *env,
+ const void *data,
+ size_t data_size);
+
+
void
GNUNET_PSYC_log_message (enum GNUNET_ErrorType kind,
const struct GNUNET_MessageHeader *msg);
Modified: gnunet/src/include/gnunet_psycstore_plugin.h
===================================================================
--- gnunet/src/include/gnunet_psycstore_plugin.h 2014-07-10 10:38:46 UTC
(rev 33949)
+++ gnunet/src/include/gnunet_psycstore_plugin.h 2014-07-10 17:49:53 UTC
(rev 33950)
@@ -60,7 +60,7 @@
int
(*membership_store) (void *cls,
const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
- const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key,
+ const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key,
int did_join,
uint64_t announced_at,
uint64_t effective_since,
@@ -77,7 +77,7 @@
int
(*membership_test) (void *cls,
const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
- const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key,
+ const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key,
uint64_t message_id);
/**
Modified: gnunet/src/include/gnunet_psycstore_service.h
===================================================================
--- gnunet/src/include/gnunet_psycstore_service.h 2014-07-10 10:38:46 UTC
(rev 33949)
+++ gnunet/src/include/gnunet_psycstore_service.h 2014-07-10 17:49:53 UTC
(rev 33950)
@@ -134,7 +134,7 @@
struct GNUNET_PSYCSTORE_OperationHandle *
GNUNET_PSYCSTORE_membership_store (struct GNUNET_PSYCSTORE_Handle *h,
const struct GNUNET_CRYPTO_EddsaPublicKey
*channel_key,
- const struct GNUNET_CRYPTO_EddsaPublicKey
*slave_key,
+ const struct GNUNET_CRYPTO_EcdsaPublicKey
*slave_key,
int did_join,
uint64_t announced_at,
uint64_t effective_since,
@@ -158,6 +158,7 @@
* @param group_generation Group generation of the fragment of the message to
* test. It has relevance if the message consists of multiple fragments
* with different group generations.
+ * FIXME: not needed if there are no overlapping messages.
* @param rcb Callback to call with the test result.
* @param rcb_cls Closure for the callback.
*
@@ -166,7 +167,7 @@
struct GNUNET_PSYCSTORE_OperationHandle *
GNUNET_PSYCSTORE_membership_test (struct GNUNET_PSYCSTORE_Handle *h,
const struct GNUNET_CRYPTO_EddsaPublicKey
*channel_key,
- const struct GNUNET_CRYPTO_EddsaPublicKey
*slave_key,
+ const struct GNUNET_CRYPTO_EcdsaPublicKey
*slave_key,
uint64_t message_id,
uint64_t group_generation,
GNUNET_PSYCSTORE_ResultCallback rcb,
@@ -178,7 +179,7 @@
*
* @param h Handle for the PSYCstore.
* @param channel_key The channel the message belongs to.
- * @param message Message to store.
+ * @param msg Message to store.
* @param psycstore_flags Flags indicating whether the PSYC message contains
* state modifiers.
* @param rcb Callback to call with the result of the operation.
@@ -189,8 +190,8 @@
struct GNUNET_PSYCSTORE_OperationHandle *
GNUNET_PSYCSTORE_fragment_store (struct GNUNET_PSYCSTORE_Handle *h,
const struct GNUNET_CRYPTO_EddsaPublicKey
*channel_key,
- const struct GNUNET_MULTICAST_MessageHeader
*message,
- uint32_t psycstore_flags,
+ const struct GNUNET_MULTICAST_MessageHeader
*msg,
+ enum GNUNET_PSYCSTORE_MessageFlags
psycstore_flags,
GNUNET_PSYCSTORE_ResultCallback rcb,
void *rcb_cls);
Modified: gnunet/src/include/gnunet_social_service.h
===================================================================
--- gnunet/src/include/gnunet_social_service.h 2014-07-10 10:38:46 UTC (rev
33949)
+++ gnunet/src/include/gnunet_social_service.h 2014-07-10 17:49:53 UTC (rev
33950)
@@ -79,30 +79,38 @@
* This function is called one or more times for each message until all data
* fragments arrive from the network.
*
- * @param cls Closure.
- * @param message_id Message counter, monotonically increasing from 1.
- * @param nym The sender of the message. Can be NULL if the message is not
- * connected to a pseudonym.
- * @param flags OR'ed GNUNET_PSYC_MessageFlags
- * @param method_name Original method name from PSYC (may be more specific
- * than the registered method name due to try-and-slice matching).
- * @param env Environment containing variables for the message and operations
- * on objects of the place, or NULL.
- * Only set for the first call of this function for each @a
message_id,
- * NULL when notifying about further data fragments.
- * @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 end End of message?
- * #GNUNET_NO if there are further fragments,
- * #GNUNET_YES if this is the last fragment,
- * #GNUNET_SYSERR indicates the message was cancelled by the sender.
- *
- * @return #GNUNET_YES the application keeps @a env for further use,
- * #GNUNET_NO @a env is free()'d after the function returns.
+ * @param cls
+ * Closure.
+ * @param message_id
+ * Message counter, monotonically increasing from 1.
+ * @param nym
+ * The sender of the message.
+ * Can be NULL if the message is not connected to a pseudonym.
+ * @param flags
+ * OR'ed GNUNET_PSYC_MessageFlags
+ * @param method_name
+ * Original method name from PSYC.
+ * May be more specific than the registered method name due to
+ * try-and-slice matching.
+ * @param env
+ * Environment with operations and variables for the message.
+ * Only set for the first call of this function for each @a message_id,
+ * NULL when notifying about further data fragments.
+ * It has to be freed using GNUNET_ENV_environment_destroy()
+ * when it is not needed anymore.
+ * @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.
+ * @param end
+ * End of message?
+ * #GNUNET_NO if there are further fragments,
+ * #GNUNET_YES if this is the last fragment,
+ * #GNUNET_SYSERR indicates the message was cancelled by the sender.
*/
-typedef int
+typedef void
(*GNUNET_SOCIAL_MethodCallback) (void *cls,
uint64_t message_id,
uint32_t flags,
@@ -179,17 +187,16 @@
* @param method_name Method name in the entry request.
* @param variable_count Number of elements in the @a variables array.
* @param variables Variables present in the message.
+ * @param data_size Number of bytes in @a data.
* @param data Payload given on enter (e.g. a password).
- * @param data_size Number of bytes in @a data.
*/
typedef void
(*GNUNET_SOCIAL_AnswerDoorCallback) (void *cls,
struct GNUNET_SOCIAL_Nym *nym,
- size_t variable_count,
const char *method_name,
- struct GNUNET_ENV_Modifier *variables,
- const void *data,
- size_t data_size);
+ struct GNUNET_ENV_Environment *env,
+ size_t data_size,
+ const void *data);
/**
@@ -198,7 +205,7 @@
* This is also called if the @a nym was never given permission to enter
* (i.e. the @a nym stopped asking to get in).
*
- * @param cls Closure.
+ * @param cls Closure.
* @param nym Handle for the user who left.
* @param variable_count Number of elements in the @a variables array.
* @param variables Variables present in the message.
@@ -206,35 +213,56 @@
typedef void
(*GNUNET_SOCIAL_FarewellCallback) (void *cls,
struct GNUNET_SOCIAL_Nym *nym,
+ struct GNUNET_ENV_Environment *env,
size_t variable_count,
struct GNUNET_ENV_Modifier *variables);
/**
+ * Function called after the host entered the place.
+ *
+ * @param cls Closure.
+ * @param max_message_id Last message ID sent to the channel.
+ * Or 0 if no messages have been sent to the place yet.
+ */
+typedef void
+(*GNUNET_SOCIAL_HostEnterCallback) (void *cls, uint64_t max_message_id);
+
+
+/**
* Enter a place as host.
*
* A place is created upon first entering, and it is active until permanently
* left using GNUNET_SOCIAL_host_leave().
*
- * @param cfg Configuration to contact the social service.
- * @param place_keyfile File with the private-public key pair of the place,
- * created if the file does not exist; pass NULL for ephemeral places.
- * @param policy Policy specifying entry and history restrictions of the
place.
- * @param ego Identity of the host.
- * @param slicer Slicer to handle incoming messages.
- * @param listener_cb Function to handle new nyms that want to enter.
- * @param farewell_cb Function to handle departing nyms.
- * @param cls Closure for @a listener_cb and @a farewell_cb.
+ * @param cfg
+ * Configuration to contact the social service.
+ * @param ego
+ * Identity of the host.
+ * @param place_key
+ * Private-public key pair of the place.
+ * NULL for ephemeral places.
+ * @param policy
+ * Policy specifying entry and history restrictions for the place.
+ * @param slicer
+ * Slicer to handle incoming messages.
+ * @param answer_door_cb
+ * Function to handle new nyms that want to enter.
+ * @param farewell_cb
+ * Function to handle departing nyms.
+ * @param cls
+ * Closure for the callbacks.
*
* @return Handle for the host.
*/
struct GNUNET_SOCIAL_Host *
GNUNET_SOCIAL_host_enter (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const char *place_keyfile,
+ struct GNUNET_IDENTITY_Ego *ego,
+ const struct GNUNET_CRYPTO_EddsaPrivateKey
*place_key,
enum GNUNET_PSYC_Policy policy,
- struct GNUNET_IDENTITY_Ego *ego,
struct GNUNET_SOCIAL_Slicer *slicer,
- GNUNET_SOCIAL_AnswerDoorCallback listener_cb,
+ GNUNET_SOCIAL_HostEnterCallback enter_cb,
+ GNUNET_SOCIAL_AnswerDoorCallback answer_door_cb,
GNUNET_SOCIAL_FarewellCallback farewell_cb,
void *cls);
@@ -362,22 +390,30 @@
* This function is restricted to the host. Nyms can only send requests
* to the host who can decide to relay it to everyone in the place.
*
- * @param host Host of the place.
- * @param method_name Method to use for the announcement.
- * @param env Environment containing variables for the message and operations
- * on objects of the place. Can be NULL.
- * @param notify Function to call to get the payload of the announcement.
- * @param notify_cls Closure for @a notify.
- * @param flags Flags for this announcement.
+ * @param host
+ * Host of the place.
+ * @param method_name
+ * Method to use for the announcement.
+ * @param env
+ * Environment containing variables for the message and operations
+ * on objects of the place.
+ * Has to remain available until the first call to @a notify_data.
+ * Can be NULL.
+ * @param notify_data
+ * Function to call to get the payload of the announcement.
+ * @param notify_data_cls
+ * Closure for @a notify.
+ * @param flags
+ * Flags for this announcement.
*
- * @return NULL on error (announcement already in progress?).
+ * @return NULL on error (another announcement already in progress?).
*/
struct GNUNET_SOCIAL_Announcement *
GNUNET_SOCIAL_host_announce (struct GNUNET_SOCIAL_Host *host,
const char *method_name,
const struct GNUNET_ENV_Environment *env,
- GNUNET_CONNECTION_TransmitReadyNotify notify,
- void *notify_cls,
+ GNUNET_PSYC_TransmitNotifyData notify_data,
+ void *notify_data_cls,
enum GNUNET_SOCIAL_AnnounceFlags flags);
@@ -416,15 +452,65 @@
/**
+ * Function called after the guest entered the local copy of the place.
+ *
+ * History and object query functions can be used after this call,
+ * but new messages can't be sent or received.
+ *
+ * @param cls
+ * Closure.
+ * @param result
+ * #GNUNET_OK on success, or
+ * #GNUNET_SYSERR on error, e.g. could not connect to the service, or
+ * could not resolve GNS name.
+ * @param max_message_id
+ * Last message ID sent to the place.
+ * Or 0 if no messages have been sent to the place yet.
+ */
+typedef void
+(*GNUNET_SOCIAL_GuestEnterCallback) (void *cls, int result,
+ uint64_t max_message_id);
+
+
+/**
+ * Function called upon a guest receives a decision about entry to the place.
+ *
+ * @param is_admitted
+ * Is the guest admitted to the place?
+ * #GNUNET_YES if admitted,
+ * #GNUNET_NO if refused entry
+ * #GNUNET_SYSERR if the request could not be answered.
+ * @param method_name
+ * Method for the message sent along with the decision.
+ * NULL if no message was sent.
+ * @param env
+ * Environment with variables for the message.
+ * NULL if there are no variables.
+ * It has to be freed using GNUNET_ENV_environment_destroy()
+ * when it is not needed anymore.
+ * @param data_size
+ * Size of @data.
+ * @param data
+ * Payload of the message.
+ */
+typedef int
+(*GNUNET_SOCIAL_EntryDecisionCallback) (void *cls,
+ int is_admitted,
+ const char *method_name,
+ struct GNUNET_ENV_Environment *env,
+ size_t data_size,
+ const void *data);
+
+
+/**
* Request entry to a place as a guest.
*
- * @param cfg Configuration to contact the social service.
+ * @param cfg Configuration to contact the social service.
* @param ego Identity of the guest.
- * @param address GNS name of the place to enter. Either in the form of
- * 'room.friend.gnu', or 'NYMPUBKEY.zkey'. This latter case refers to
- * the 'PLACE' record of the empty label ("+") in the GNS zone with the
- * nym's public key 'NYMPUBKEY', and can be used to request entry to a
- * pseudonym's place directly.
+ * @param crypto_address Public key of the place to enter.
+ * @param origin Peer identity of the origin of the underlying multicast group.
+ * @param relay_count Number of elements in the @a relays array.
+ * @param relays Relays for the underlying multicast group.
* @param method_name Method name for the message.
* @param env Environment containing variables for the message, or NULL.
* @param data Payload for the message to give to the enter callback.
@@ -436,22 +522,30 @@
struct GNUNET_SOCIAL_Guest *
GNUNET_SOCIAL_guest_enter (const struct GNUNET_CONFIGURATION_Handle *cfg,
struct GNUNET_IDENTITY_Ego *ego,
- char *address,
+ struct GNUNET_CRYPTO_EddsaPublicKey *place_key,
+ struct GNUNET_PeerIdentity *origin,
+ uint32_t relay_count,
+ struct GNUNET_PeerIdentity *relays,
const char *method_name,
const struct GNUNET_ENV_Environment *env,
const void *data,
size_t data_size,
- struct GNUNET_SOCIAL_Slicer *slicer);
+ struct GNUNET_SOCIAL_Slicer *slicer,
+ GNUNET_SOCIAL_GuestEnterCallback local_enter_cb,
+ GNUNET_SOCIAL_EntryDecisionCallback
entry_decision_cb,
+ void *cls);
+
/**
- * Request entry to a place as a guest.
+ * Request entry to a place as a guest using a GNS name.
*
- * @param cfg Configuration to contact the social service.
+ * @param cfg Configuration to contact the social service.
* @param ego Identity of the guest.
- * @param crypto_address Public key of the place to enter.
- * @param origin Peer identity of the origin of the underlying multicast group.
- * @param relay_count Number of elements in the @a relays array.
- * @param relays Relays for the underlying multicast group.
+ * @param address GNS name of the place to enter. Either in the form of
+ * 'room.friend.gnu', or 'NYMPUBKEY.zkey'. This latter case refers to
+ * the 'PLACE' record of the empty label ("+") in the GNS zone with the
+ * nym's public key 'NYMPUBKEY', and can be used to request entry to a
+ * pseudonym's place directly.
* @param method_name Method name for the message.
* @param env Environment containing variables for the message, or NULL.
* @param data Payload for the message to give to the enter callback.
@@ -461,17 +555,17 @@
* @return NULL on errors, otherwise handle for the guest.
*/
struct GNUNET_SOCIAL_Guest *
-GNUNET_SOCIAL_guest_enter2 (const struct GNUNET_CONFIGURATION_Handle *cfg,
- struct GNUNET_IDENTITY_Ego *ego,
- struct GNUNET_CRYPTO_EddsaPublicKey
*crypto_address,
- struct GNUNET_PeerIdentity *origin,
- size_t relay_count,
- struct GNUNET_PeerIdentity *relays,
- const char *method_name,
- const struct GNUNET_ENV_Environment *env,
- const void *data,
- size_t data_size,
- struct GNUNET_SOCIAL_Slicer *slicer);
+GNUNET_SOCIAL_guest_enter_by_name (const struct GNUNET_CONFIGURATION_Handle
*cfg,
+ struct GNUNET_IDENTITY_Ego *ego,
+ char *gns_name,
+ const char *method_name,
+ const struct GNUNET_ENV_Environment *env,
+ const void *data,
+ size_t data_size,
+ struct GNUNET_SOCIAL_Slicer *slicer,
+ GNUNET_SOCIAL_GuestEnterCallback
local_enter_cb,
+ GNUNET_SOCIAL_EntryDecisionCallback
entry_decision_cb,
+ void *cls);
/**
@@ -492,22 +586,28 @@
/**
* Talk to the host of the place.
*
- * @param place Place where we want to talk to the host.
- * @param method_name Method to invoke on the host.
- * @param env Environment containing variables for the message, or NULL.
- * @param notify Function to use to get the payload for the method.
- * @param notify_cls Closure for @a notify.
- * @param flags Flags for the message being sent.
+ * @param place
+ * Place where we want to talk to the host.
+ * @param method_name
+ * Method to invoke on the host.
+ * @param env
+ * Environment containing variables for the message, or NULL.
+ * @param notify_data
+ * Function to use to get the payload for the method.
+ * @param notify_data_cls
+ * Closure for @a notify_data.
+ * @param flags
+ * Flags for the message being sent.
*
* @return NULL if we are already trying to talk to the host,
* otherwise handle to cancel the request.
*/
struct GNUNET_SOCIAL_TalkRequest *
-GNUNET_SOCIAL_guest_talk (struct GNUNET_SOCIAL_Place *place,
+GNUNET_SOCIAL_guest_talk (struct GNUNET_SOCIAL_Guest *guest,
const char *method_name,
const struct GNUNET_ENV_Environment *env,
- GNUNET_CONNECTION_TransmitReadyNotify notify,
- void *notify_cls,
+ GNUNET_PSYC_TransmitNotifyData notify_data,
+ void *notify_data_cls,
enum GNUNET_SOCIAL_TalkFlags flags);
@@ -529,7 +629,7 @@
* @param keep_active Keep place active after last application disconnected.
*/
void
-GNUNET_SOCIAL_guest_leave (struct GNUNET_SOCIAL_Place *place, int keep_active);
+GNUNET_SOCIAL_guest_leave (struct GNUNET_SOCIAL_Guest *guest, int keep_active);
/**
@@ -542,7 +642,7 @@
* @return Handle for the place, valid as long as @a guest is valid.
*/
struct GNUNET_SOCIAL_Place *
-GNUNET_SOCIAL_guest_get_place (struct GNUNET_SOCIAL_Host *guest);
+GNUNET_SOCIAL_guest_get_place (struct GNUNET_SOCIAL_Guest *guest);
/**
Modified: gnunet/src/multicast/gnunet-service-multicast.c
===================================================================
--- gnunet/src/multicast/gnunet-service-multicast.c 2014-07-10 10:38:46 UTC
(rev 33949)
+++ gnunet/src/multicast/gnunet-service-multicast.c 2014-07-10 17:49:53 UTC
(rev 33950)
@@ -148,12 +148,12 @@
/**
* Private key of the member.
*/
- struct GNUNET_CRYPTO_EddsaPrivateKey priv_key;
+ struct GNUNET_CRYPTO_EcdsaPrivateKey priv_key;
/**
* Public key of the member.
*/
- struct GNUNET_CRYPTO_EddsaPublicKey pub_key;
+ struct GNUNET_CRYPTO_EcdsaPublicKey pub_key;
/**
* Hash of @a pub_key.
@@ -458,11 +458,12 @@
{
const struct MulticastMemberJoinMessage *
msg = (const struct MulticastMemberJoinMessage *) m;
+ uint16_t msg_size = ntohs (msg->header.size);
- struct GNUNET_CRYPTO_EddsaPublicKey mem_pub_key;
+ struct GNUNET_CRYPTO_EcdsaPublicKey mem_pub_key;
struct GNUNET_HashCode pub_key_hash, mem_pub_key_hash;
- GNUNET_CRYPTO_eddsa_key_get_public (&msg->member_key, &mem_pub_key);
+ GNUNET_CRYPTO_ecdsa_key_get_public (&msg->member_key, &mem_pub_key);
GNUNET_CRYPTO_hash (&mem_pub_key, sizeof (mem_pub_key), &mem_pub_key_hash);
GNUNET_CRYPTO_hash (&msg->group_key, sizeof (msg->group_key), &pub_key_hash);
@@ -532,12 +533,18 @@
struct GNUNET_MessageHeader *join_msg = NULL;
uint16_t join_msg_size = 0;
if (sizeof (*msg) + relay_size + sizeof (struct GNUNET_MessageHeader)
- <= ntohs (msg->header.size))
+ <= msg_size)
{
join_msg = (struct GNUNET_MessageHeader *)
(((char *) &msg[1]) + relay_size);
join_msg_size = ntohs (join_msg->size);
}
+ if (sizeof (*msg) + relay_size + join_msg_size != msg_size)
+ {
+ GNUNET_break (0);
+ GNUNET_SERVER_client_disconnect (client);
+ return;
+ }
struct MulticastJoinRequestMessage *
req = GNUNET_malloc (sizeof (*req) + join_msg_size);
@@ -545,7 +552,7 @@
req->header.type = htons (GNUNET_MESSAGE_TYPE_MULTICAST_JOIN_REQUEST);
req->group_key = grp->pub_key;
req->member_peer = this_peer;
- GNUNET_CRYPTO_eddsa_key_get_public (&mem->priv_key, &req->member_key);
+ GNUNET_CRYPTO_ecdsa_key_get_public (&mem->priv_key, &req->member_key);
if (0 < join_msg_size)
memcpy (&req[1], join_msg, join_msg_size);
@@ -554,7 +561,7 @@
- sizeof (req->signature));
req->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_MULTICAST_REQUEST);
- if (GNUNET_OK != GNUNET_CRYPTO_eddsa_sign (&mem->priv_key, &req->purpose,
+ if (GNUNET_OK != GNUNET_CRYPTO_ecdsa_sign (&mem->priv_key, &req->purpose,
&req->signature))
{
/* FIXME: handle error */
@@ -700,7 +707,7 @@
- sizeof (req->signature));
req->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_MULTICAST_REQUEST);
- if (GNUNET_OK != GNUNET_CRYPTO_eddsa_sign (&mem->priv_key, &req->purpose,
+ if (GNUNET_OK != GNUNET_CRYPTO_ecdsa_sign (&mem->priv_key, &req->purpose,
&req->signature))
{
/* FIXME: handle error */
@@ -721,7 +728,7 @@
/**
- * Core connected.
+ * Connected to core service.
*/
static void
core_connected_cb (void *cls, const struct GNUNET_PeerIdentity *my_identity)
Modified: gnunet/src/multicast/multicast.h
===================================================================
--- gnunet/src/multicast/multicast.h 2014-07-10 10:38:46 UTC (rev 33949)
+++ gnunet/src/multicast/multicast.h 2014-07-10 17:49:53 UTC (rev 33950)
@@ -50,7 +50,7 @@
*
* Signature must match the public key of the joining member.
*/
- struct GNUNET_CRYPTO_EddsaSignature signature;
+ struct GNUNET_CRYPTO_EcdsaSignature signature;
/**
* Purpose for the signature and size of the signed data.
@@ -65,7 +65,7 @@
/**
* Public key of the joining member.
*/
- struct GNUNET_CRYPTO_EddsaPublicKey member_key;
+ struct GNUNET_CRYPTO_EcdsaPublicKey member_key;
/**
* Peer identity of the joining member.
@@ -125,7 +125,7 @@
* C->S: Public key of the member requesting join.
* S->C: Unused.
*/
- struct GNUNET_CRYPTO_EddsaPublicKey member_key;
+ struct GNUNET_CRYPTO_EcdsaPublicKey member_key;
/* Followed by struct MulticastJoinDecisionMessage */
};
@@ -244,12 +244,13 @@
struct GNUNET_CRYPTO_EddsaPublicKey group_key;
- struct GNUNET_CRYPTO_EddsaPrivateKey member_key;
+ struct GNUNET_CRYPTO_EcdsaPrivateKey member_key;
struct GNUNET_PeerIdentity origin;
/* Followed by struct GNUNET_PeerIdentity relays[relay_count] */
- /* Followed by struct GNUNET_MessageHeader join_request */
+
+ /* Followed by struct GNUNET_MessageHeader join_msg */
};
@@ -313,7 +314,7 @@
/**
* Our private key for the group.
*/
- struct GNUNET_CRYPTO_EddsaPrivateKey member_key;
+ struct GNUNET_CRYPTO_EcdsaPrivateKey member_key;
/* followed by 'relay_count' `struct GNUNET_PeerIdentity`s */
Modified: gnunet/src/multicast/multicast_api.c
===================================================================
--- gnunet/src/multicast/multicast_api.c 2014-07-10 10:38:46 UTC (rev
33949)
+++ gnunet/src/multicast/multicast_api.c 2014-07-10 17:49:53 UTC (rev
33950)
@@ -138,7 +138,7 @@
/**
* Public key of the member requesting join.
*/
- struct GNUNET_CRYPTO_EddsaPublicKey member_key;
+ struct GNUNET_CRYPTO_EcdsaPublicKey member_key;
/**
* Peer identity of the member requesting join.
@@ -714,7 +714,7 @@
struct GNUNET_MULTICAST_Member *
GNUNET_MULTICAST_member_join (const struct GNUNET_CONFIGURATION_Handle *cfg,
const struct GNUNET_CRYPTO_EddsaPublicKey
*group_key,
- const struct GNUNET_CRYPTO_EddsaPrivateKey
*member_key,
+ const struct GNUNET_CRYPTO_EcdsaPrivateKey
*member_key,
const struct GNUNET_PeerIdentity *origin,
uint16_t relay_count,
const struct GNUNET_PeerIdentity *relays,
Modified: gnunet/src/psyc/gnunet-service-psyc.c
===================================================================
--- gnunet/src/psyc/gnunet-service-psyc.c 2014-07-10 10:38:46 UTC (rev
33949)
+++ gnunet/src/psyc/gnunet-service-psyc.c 2014-07-10 17:49:53 UTC (rev
33950)
@@ -93,7 +93,7 @@
uint64_t id;
/**
- * Size of @a buf
+ * Size of message.
*/
uint16_t size;
@@ -211,11 +211,6 @@
struct GNUNET_CONTAINER_Heap *recv_msgs;
/**
- * FIXME: needed?
- */
- GNUNET_SCHEDULER_TaskIdentifier tmit_task;
-
- /**
* Public key of the channel.
*/
struct GNUNET_CRYPTO_EddsaPublicKey pub_key;
@@ -264,14 +259,16 @@
uint8_t is_master;
/**
- * Ready to receive messages from client? #GNUNET_YES or #GNUNET_NO
+ * Is this channel ready to receive messages from client?
+ * #GNUNET_YES or #GNUNET_NO
*/
- uint8_t ready;
+ uint8_t is_ready;
/**
- * Is the client disconnected? #GNUNET_YES or #GNUNET_NO
+ * Is the client disconnected?
+ * #GNUNET_YES or #GNUNET_NO
*/
- uint8_t disconnected;
+ uint8_t is_disconnected;
};
@@ -345,12 +342,12 @@
/**
* Private key of the slave.
*/
- struct GNUNET_CRYPTO_EddsaPrivateKey priv_key;
+ struct GNUNET_CRYPTO_EcdsaPrivateKey priv_key;
/**
* Public key of the slave.
*/
- struct GNUNET_CRYPTO_EddsaPublicKey pub_key;
+ struct GNUNET_CRYPTO_EcdsaPublicKey pub_key;
/**
* Hash of @a pub_key.
@@ -390,7 +387,7 @@
/**
* Join decision received from multicast.
*/
- struct SlaveJoinDecision *join_dcsn;
+ struct GNUNET_PSYC_JoinDecisionMessage *join_dcsn;
/**
* Maximum request ID for this channel.
@@ -514,6 +511,7 @@
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"%p User context is NULL in client_disconnect()\n", chn);
+ GNUNET_break (0);
return;
}
@@ -573,7 +571,7 @@
*/
struct JoinMemTestClosure
{
- struct GNUNET_CRYPTO_EddsaPublicKey slave_key;
+ struct GNUNET_CRYPTO_EcdsaPublicKey slave_key;
struct Channel *chn;
struct GNUNET_MULTICAST_JoinHandle *jh;
struct MasterJoinRequest *master_join_req;
@@ -613,7 +611,7 @@
*/
static void
mcast_recv_join_request (void *cls,
- const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key,
+ const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key,
const struct GNUNET_MessageHeader *join_msg,
struct GNUNET_MULTICAST_JoinHandle *jh)
{
@@ -670,7 +668,7 @@
"%p Got join decision: %d\n", slv, is_admitted);
uint16_t join_resp_size = (NULL != join_resp) ? ntohs (join_resp->size) : 0;
- struct SlaveJoinDecision *
+ struct GNUNET_PSYC_JoinDecisionMessage *
dcsn = slv->join_dcsn = GNUNET_malloc (sizeof (*dcsn) + join_resp_size);
dcsn->header.size = htons (sizeof (*dcsn) + join_resp_size);
dcsn->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_JOIN_DECISION);
@@ -682,7 +680,7 @@
if (GNUNET_YES == is_admitted)
{
- chn->ready = GNUNET_YES;
+ chn->is_ready = GNUNET_YES;
}
else
{
@@ -693,7 +691,7 @@
static void
mcast_recv_membership_test (void *cls,
- const struct GNUNET_CRYPTO_EddsaPublicKey
*slave_key,
+ const struct GNUNET_CRYPTO_EcdsaPublicKey
*slave_key,
uint64_t message_id, uint64_t group_generation,
struct GNUNET_MULTICAST_MembershipTestHandle *mth)
{
@@ -703,7 +701,7 @@
static void
mcast_recv_replay_fragment (void *cls,
- const struct GNUNET_CRYPTO_EddsaPublicKey
*slave_key,
+ const struct GNUNET_CRYPTO_EcdsaPublicKey
*slave_key,
uint64_t fragment_id, uint64_t flags,
struct GNUNET_MULTICAST_ReplayHandle *rh)
@@ -714,7 +712,7 @@
static void
mcast_recv_replay_message (void *cls,
- const struct GNUNET_CRYPTO_EddsaPublicKey
*slave_key,
+ const struct GNUNET_CRYPTO_EcdsaPublicKey
*slave_key,
uint64_t message_id,
uint64_t fragment_offset,
uint64_t flags,
@@ -737,7 +735,7 @@
n = ((n << 8) & 0xFF00FF00FF00FF00ULL) | ((n >> 8) &
0x00FF00FF00FF00FFULL);
n = ((n << 16) & 0xFFFF0000FFFF0000ULL) | ((n >> 16) &
0x0000FFFF0000FFFFULL);
- *key = (struct GNUNET_HashCode) {{ 0 }};
+ *key = (struct GNUNET_HashCode) {};
*((uint64_t *) key)
= (n << 32) | (n >> 32);
}
@@ -753,7 +751,7 @@
#if __BYTE_ORDER == __BIG_ENDIAN
hash_key_from_nll (key, n);
#elif __BYTE_ORDER == __LITTLE_ENDIAN
- *key = (struct GNUNET_HashCode) {{ 0 }};
+ *key = (struct GNUNET_HashCode) {};
*((uint64_t *) key) = n;
#else
#error byteorder undefined
@@ -1225,10 +1223,8 @@
/**
* Incoming request fragment from multicast for a master.
*
- * @param cls Master.
- * @param slave_key Sending slave's public key.
- * @param msg The message.
- * @param flags Request flags.
+ * @param cls Master.
+ * @param req The request.
*/
static void
mcast_recv_request (void *cls,
@@ -1295,7 +1291,7 @@
&mcast_recv_replay_message,
&mcast_recv_request,
&mcast_recv_message, chn);
- chn->ready = GNUNET_YES;
+ chn->is_ready = GNUNET_YES;
}
else
{
@@ -1400,7 +1396,7 @@
GNUNET_CONTAINER_multihashmap_put (masters, &chn->pub_key_hash, chn,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
chn->store_op = GNUNET_PSYCSTORE_counters_get (store, &chn->pub_key,
- store_recv_master_counters,
mst);
+ store_recv_master_counters,
mst);
}
else
{
@@ -1440,10 +1436,10 @@
const struct SlaveJoinRequest *req
= (const struct SlaveJoinRequest *) msg;
- struct GNUNET_CRYPTO_EddsaPublicKey slv_pub_key;
+ struct GNUNET_CRYPTO_EcdsaPublicKey slv_pub_key;
struct GNUNET_HashCode pub_key_hash, slv_pub_key_hash;
- GNUNET_CRYPTO_eddsa_key_get_public (&req->slave_key, &slv_pub_key);
+ GNUNET_CRYPTO_ecdsa_key_get_public (&req->slave_key, &slv_pub_key);
GNUNET_CRYPTO_hash (&slv_pub_key, sizeof (slv_pub_key), &slv_pub_key_hash);
GNUNET_CRYPTO_hash (&req->channel_key, sizeof (req->channel_key),
&pub_key_hash);
@@ -1540,7 +1536,7 @@
cli->client = client;
GNUNET_CONTAINER_DLL_insert (chn->clients_head, chn->clients_tail, cli);
- GNUNET_SERVER_client_set_user_context (client, &slv->chn);
+ GNUNET_SERVER_client_set_user_context (client, chn);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
@@ -1578,7 +1574,8 @@
GNUNET_assert (GNUNET_YES == chn->is_master);
struct Master *mst = (struct Master *) chn;
- struct MasterJoinDecision *dcsn = (struct MasterJoinDecision *) msg;
+ struct GNUNET_PSYC_JoinDecisionMessage *
+ dcsn = (struct GNUNET_PSYC_JoinDecisionMessage *) msg;
struct JoinDecisionClosure jcls;
jcls.is_admitted = ntohl (dcsn->is_admitted);
jcls.msg
@@ -1655,19 +1652,15 @@
GNUNET_CONTAINER_DLL_remove (chn->tmit_head, chn->tmit_tail, tmit_msg);
GNUNET_free (tmit_msg);
- if (0 == chn->tmit_task)
+ if (NULL != chn->tmit_head)
{
- if (NULL != chn->tmit_head)
- {
- transmit_message (chn);
- }
- else if (chn->disconnected)
- {
- /* FIXME: handle partial message (when still in_transmit) */
- cleanup_channel (chn);
- }
+ transmit_message (chn);
}
-
+ else if (GNUNET_YES == chn->is_disconnected)
+ {
+ /* FIXME: handle partial message (when still in_transmit) */
+ cleanup_channel (chn);
+ }
return ret;
}
@@ -1712,8 +1705,6 @@
static void
master_transmit_message (struct Master *mst)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%p master_transmit_message()\n", mst);
- mst->chn.tmit_task = 0;
if (NULL == mst->tmit_handle)
{
mst->tmit_handle
@@ -1734,7 +1725,6 @@
static void
slave_transmit_message (struct Slave *slv)
{
- slv->chn.tmit_task = 0;
if (NULL == slv->tmit_handle)
{
slv->tmit_handle
@@ -1830,6 +1820,8 @@
tmit_msg->size = data_size;
tmit_msg->state = chn->tmit_state;
+ /* FIXME: separate queue per message ID */
+
GNUNET_CONTAINER_DLL_insert_tail (chn->tmit_head, chn->tmit_tail, tmit_msg);
chn->is_master
@@ -1877,10 +1869,11 @@
"%p Received message from client.\n", chn);
GNUNET_PSYC_log_message (GNUNET_ERROR_TYPE_DEBUG, msg);
- if (GNUNET_YES != chn->ready)
+ if (GNUNET_YES != chn->is_ready)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "%p Channel is not ready, dropping message from client.\n",
chn);
+ "%p Channel is not ready yet, disconnecting client.\n", chn);
+ GNUNET_break (0);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
Modified: gnunet/src/psyc/psyc.h
===================================================================
--- gnunet/src/psyc/psyc.h 2014-07-10 10:38:46 UTC (rev 33949)
+++ gnunet/src/psyc/psyc.h 2014-07-10 17:49:53 UTC (rev 33950)
@@ -78,9 +78,9 @@
*/
struct GNUNET_MessageHeader header;
+ uint32_t policy GNUNET_PACKED;
+
struct GNUNET_CRYPTO_EddsaPrivateKey channel_key;
-
- uint32_t policy GNUNET_PACKED;
};
@@ -95,15 +95,17 @@
struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
- struct GNUNET_CRYPTO_EddsaPrivateKey slave_key;
+ struct GNUNET_CRYPTO_EcdsaPrivateKey slave_key;
struct GNUNET_PeerIdentity origin;
/* Followed by struct GNUNET_PeerIdentity relays[relay_count] */
+
+ /* Followed by struct GNUNET_MessageHeader join_msg */
};
-struct ChannelSlaveAdd
+struct ChannelSlaveAddRequest
{
/**
* Type: GNUNET_MESSAGE_TYPE_PSYC_CHANNEL_SLAVE_ADD
@@ -112,7 +114,7 @@
uint32_t reserved;
- struct GNUNET_CRYPTO_EddsaPublicKey *slave_key;
+ struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key;
uint64_t announced_at;
@@ -120,7 +122,7 @@
};
-struct ChannelSlaveRemove
+struct ChannelSlaveRemoveRequest
{
/**
* Type: GNUNET_MESSAGE_TYPE_PSYC_CHANNEL_SLAVE_RM
@@ -129,7 +131,7 @@
uint32_t reserved;
- struct GNUNET_CRYPTO_EddsaPublicKey *slave_key;
+ struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key;
uint64_t announced_at;
};
@@ -189,6 +191,7 @@
uint64_t max_message_id;
};
+
/**
* Answer from service to client about last operation.
*/
@@ -236,50 +239,12 @@
/**
* Public key of the joining slave.
*/
- struct GNUNET_CRYPTO_EddsaPublicKey slave_key;
+ struct GNUNET_CRYPTO_EcdsaPublicKey slave_key;
/* Followed by struct GNUNET_MessageHeader join_request */
};
-struct MasterJoinDecision
-{
- /**
- * Type: GNUNET_MESSAGE_TYPE_PSYC_JOIN_DECISION
- */
- struct GNUNET_MessageHeader header;
-
- /**
- * #GNUNET_YES if the slave was admitted.
- */
- int32_t is_admitted;
-
- /**
- * Public key of the joining slave.
- */
- struct GNUNET_CRYPTO_EddsaPublicKey slave_key;
-
- /* Followed by struct GNUNET_MessageHeader join_response */
-};
-
-
-struct SlaveJoinDecision
-{
- /**
- * Type: GNUNET_MESSAGE_TYPE_PSYC_JOIN_DECISION
- */
- struct GNUNET_MessageHeader header;
-
- /**
- * #GNUNET_YES if the slave was admitted.
- */
- int32_t is_admitted;
-
- /* Followed by struct GNUNET_MessageHeader join_response */
-};
-
-
-
GNUNET_NETWORK_STRUCT_END
#endif
Modified: gnunet/src/psyc/psyc_api.c
===================================================================
--- gnunet/src/psyc/psyc_api.c 2014-07-10 10:38:46 UTC (rev 33949)
+++ gnunet/src/psyc/psyc_api.c 2014-07-10 17:49:53 UTC (rev 33950)
@@ -133,7 +133,7 @@
struct GNUNET_PSYC_JoinHandle
{
struct GNUNET_PSYC_Master *mst;
- struct GNUNET_CRYPTO_EddsaPublicKey slave_key;
+ struct GNUNET_CRYPTO_EcdsaPublicKey slave_key;
};
@@ -270,8 +270,8 @@
struct GNUNET_PSYC_Slave *
slv = GNUNET_CLIENT_MANAGER_get_user_context_ (client,
sizeof (struct
GNUNET_PSYC_Channel));
- const struct SlaveJoinDecision *
- dcsn = (const struct SlaveJoinDecision *) msg;
+ const struct GNUNET_PSYC_JoinDecisionMessage *
+ dcsn = (const struct GNUNET_PSYC_JoinDecisionMessage *) msg;
struct GNUNET_PSYC_MessageHeader *pmsg = NULL;
if (ntohs (dcsn->header.size) <= sizeof (*dcsn) + sizeof (*pmsg))
@@ -285,8 +285,6 @@
static struct GNUNET_CLIENT_MANAGER_MessageHandler master_handlers[] =
{
- { &channel_recv_disconnect, NULL, 0, 0, GNUNET_NO },
-
{ &channel_recv_message, NULL,
GNUNET_MESSAGE_TYPE_PSYC_MESSAGE,
sizeof (struct GNUNET_PSYC_MessageHeader), GNUNET_YES },
@@ -303,14 +301,14 @@
GNUNET_MESSAGE_TYPE_PSYC_JOIN_REQUEST,
sizeof (struct MasterJoinRequest), GNUNET_YES },
+ { &channel_recv_disconnect, NULL, 0, 0, GNUNET_NO },
+
{ NULL, NULL, 0, 0, GNUNET_NO }
};
static struct GNUNET_CLIENT_MANAGER_MessageHandler slave_handlers[] =
{
- { &channel_recv_disconnect, NULL, 0, 0, GNUNET_NO },
-
{ &channel_recv_message, NULL,
GNUNET_MESSAGE_TYPE_PSYC_MESSAGE,
sizeof (struct GNUNET_PSYC_MessageHeader), GNUNET_YES },
@@ -325,8 +323,10 @@
{ &slave_recv_join_decision, NULL,
GNUNET_MESSAGE_TYPE_PSYC_JOIN_DECISION,
- sizeof (struct SlaveJoinDecision), GNUNET_YES },
+ sizeof (struct GNUNET_PSYC_JoinDecisionMessage), GNUNET_YES },
+ { &channel_recv_disconnect, NULL, 0, 0, GNUNET_NO },
+
{ NULL, NULL, 0, 0, GNUNET_NO }
};
@@ -442,7 +442,7 @@
const struct GNUNET_PSYC_MessageHeader *join_resp)
{
struct GNUNET_PSYC_Channel *chn = &jh->mst->chn;
- struct MasterJoinDecision *dcsn;
+ struct GNUNET_PSYC_JoinDecisionMessage *dcsn;
uint16_t join_resp_size
= (NULL != join_resp) ? ntohs (join_resp->header.size) : 0;
uint16_t relay_size = relay_count * sizeof (*relays);
@@ -571,7 +571,7 @@
struct GNUNET_PSYC_Slave *
GNUNET_PSYC_slave_join (const struct GNUNET_CONFIGURATION_Handle *cfg,
const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
- const struct GNUNET_CRYPTO_EddsaPrivateKey *slave_key,
+ const struct GNUNET_CRYPTO_EcdsaPrivateKey *slave_key,
const struct GNUNET_PeerIdentity *origin,
uint32_t relay_count,
const struct GNUNET_PeerIdentity *relays,
@@ -579,10 +579,7 @@
GNUNET_PSYC_SlaveConnectCallback connect_cb,
GNUNET_PSYC_JoinDecisionCallback join_decision_cb,
void *cls,
- const char *method_name,
- const struct GNUNET_ENV_Environment *env,
- const void *data,
- uint16_t data_size)
+ const struct GNUNET_MessageHeader *join_msg)
{
struct GNUNET_PSYC_Slave *slv = GNUNET_malloc (sizeof (*slv));
struct GNUNET_PSYC_Channel *chn = &slv->chn;
@@ -725,11 +722,11 @@
*/
void
GNUNET_PSYC_channel_slave_add (struct GNUNET_PSYC_Channel *chn,
- const struct GNUNET_CRYPTO_EddsaPublicKey
*slave_key,
+ const struct GNUNET_CRYPTO_EcdsaPublicKey
*slave_key,
uint64_t announced_at,
uint64_t effective_since)
{
- struct ChannelSlaveAdd *add = GNUNET_malloc (sizeof (*add));
+ struct ChannelSlaveAddRequest *add = GNUNET_malloc (sizeof (*add));
add->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_CHANNEL_SLAVE_ADD);
add->header.size = htons (sizeof (*add));
add->announced_at = GNUNET_htonll (announced_at);
@@ -761,10 +758,10 @@
*/
void
GNUNET_PSYC_channel_slave_remove (struct GNUNET_PSYC_Channel *chn,
- const struct GNUNET_CRYPTO_EddsaPublicKey
*slave_key,
+ const struct GNUNET_CRYPTO_EcdsaPublicKey
*slave_key,
uint64_t announced_at)
{
- struct ChannelSlaveRemove *rm = GNUNET_malloc (sizeof (*rm));
+ struct ChannelSlaveRemoveRequest *rm = GNUNET_malloc (sizeof (*rm));
rm->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_CHANNEL_SLAVE_RM);
rm->header.size = htons (sizeof (*rm));
rm->announced_at = GNUNET_htonll (announced_at);
Modified: gnunet/src/psyc/psyc_util_lib.c
===================================================================
--- gnunet/src/psyc/psyc_util_lib.c 2014-07-10 10:38:46 UTC (rev 33949)
+++ gnunet/src/psyc/psyc_util_lib.c 2014-07-10 17:49:53 UTC (rev 33950)
@@ -34,23 +34,7 @@
#define LOG(kind,...) GNUNET_log_from (kind, "psyc-util",__VA_ARGS__)
-/**
- * Message receive states.
- */
-enum GNUNET_PSYC_MessageState
-{
- GNUNET_PSYC_MESSAGE_STATE_START = 0,
- GNUNET_PSYC_MESSAGE_STATE_HEADER = 1,
- GNUNET_PSYC_MESSAGE_STATE_METHOD = 2,
- GNUNET_PSYC_MESSAGE_STATE_MODIFIER = 3,
- GNUNET_PSYC_MESSAGE_STATE_MOD_CONT = 4,
- GNUNET_PSYC_MESSAGE_STATE_DATA = 5,
- GNUNET_PSYC_MESSAGE_STATE_END = 6,
- GNUNET_PSYC_MESSAGE_STATE_CANCEL = 7,
- GNUNET_PSYC_MESSAGE_STATE_ERROR = 8,
-};
-
struct GNUNET_PSYC_TransmitHandle
{
/**
@@ -142,7 +126,7 @@
/**
* Public key of the slave from which a message is being received.
*/
- struct GNUNET_CRYPTO_EddsaPublicKey slave_key;
+ struct GNUNET_CRYPTO_EcdsaPublicKey slave_key;
/**
* State of the currently being received message from the PSYC service.
@@ -165,7 +149,102 @@
uint32_t mod_value_size;
};
+/**** Messages ****/
+
+/**
+ * Create a PSYC message.
+ *
+ * @param method_name
+ * PSYC method for the message.
+ * @param env
+ * Environment for the message.
+ * @param data
+ * Data payload for the message.
+ * @param data_size
+ * Size of @a data.
+ *
+ * @return Message header with size information,
+ * followed by the message parts.
+ */
+struct GNUNET_MessageHeader *
+GNUNET_PSYC_message_create (const char *method_name,
+ const struct GNUNET_ENV_Environment *env,
+ const void *data,
+ size_t data_size)
+{
+ struct GNUNET_ENV_Modifier *mod = NULL;
+ struct GNUNET_PSYC_MessageMethod *pmeth = NULL;
+ struct GNUNET_PSYC_MessageModifier *pmod = NULL;
+ struct GNUNET_MessageHeader *pmsg = NULL;
+ uint16_t env_size = 0;
+ if (NULL != env)
+ {
+ mod = GNUNET_ENV_environment_head (env);
+ while (NULL != mod)
+ {
+ env_size += sizeof (*pmod) + strlen (mod->name) + 1 + mod->value_size;
+ mod = mod->next;
+ }
+ }
+
+ struct GNUNET_MessageHeader *msg;
+ uint16_t method_name_size = strlen (method_name) + 1;
+ if (method_name_size == 1)
+ return NULL;
+
+ uint16_t msg_size = sizeof (*msg) /* header */
+ + sizeof (*pmeth) + method_name_size /* method */
+ + env_size /* modifiers */
+ + ((0 < data_size) ? sizeof (*pmsg) + data_size : 0)/* data */
+ + sizeof (*pmsg); /* end of message */
+ msg = GNUNET_malloc (msg_size);
+ msg->size = htons (msg_size);
+ msg->type = htons (GNUNET_MESSAGE_TYPE_PSYC_MESSAGE);
+
+ pmeth = (struct GNUNET_PSYC_MessageMethod *) &msg[1];
+ pmeth->header.size = htons (sizeof (*pmeth) + method_name_size);
+ memcpy (pmeth, method_name, method_name_size);
+
+ uint16_t p = sizeof (*msg) + sizeof (*pmeth) + method_name_size;
+ if (NULL != env)
+ {
+ mod = GNUNET_ENV_environment_head (env);
+ while (NULL != mod)
+ {
+ uint16_t mod_name_size = strlen (mod->name) + 1;
+ pmod = (struct GNUNET_PSYC_MessageModifier *) ((char *) msg + p);
+ pmod->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_MODIFIER);
+ pmod->header.size = sizeof (*pmod) + mod_name_size + 1 + mod->value_size;
+ p += pmod->header.size;
+ pmod->header.size = htons (pmod->header.size);
+
+ memcpy (&pmod[1], mod->name, mod_name_size);
+ if (0 < mod->value_size)
+ memcpy ((char *) &pmod[1] + mod_name_size, mod->value,
mod->value_size);
+
+ mod = mod->next;
+ }
+ }
+
+ if (0 < data_size)
+ {
+ pmsg = (struct GNUNET_MessageHeader *) ((char *) msg + p);
+ pmsg->size = sizeof (*pmsg) + data_size;
+ p += pmsg->size;
+ pmsg->size = htons (pmsg->size);
+ pmsg->type = htons (GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_DATA);
+ memcpy (&pmsg[1], data, data_size);
+ }
+
+ pmsg = (struct GNUNET_MessageHeader *) ((char *) msg + p);
+ pmsg->size = htons (sizeof (*pmsg));
+ pmsg->type = htons (GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_END);
+
+ return msg;
+}
+
+
void
GNUNET_PSYC_log_message (enum GNUNET_ErrorType kind,
const struct GNUNET_MessageHeader *msg)
Modified: gnunet/src/psyc/test_psyc.c
===================================================================
--- gnunet/src/psyc/test_psyc.c 2014-07-10 10:38:46 UTC (rev 33949)
+++ gnunet/src/psyc/test_psyc.c 2014-07-10 17:49:53 UTC (rev 33950)
@@ -33,11 +33,12 @@
#include "gnunet_util_lib.h"
#include "gnunet_testing_lib.h"
#include "gnunet_env_lib.h"
+#include "gnunet_psyc_util_lib.h"
#include "gnunet_psyc_service.h"
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
-#define DEBUG_SERVICE 1
+#define DEBUG_SERVICE 0
/**
@@ -56,10 +57,10 @@
static struct GNUNET_PSYC_Slave *slv;
static struct GNUNET_CRYPTO_EddsaPrivateKey *channel_key;
-static struct GNUNET_CRYPTO_EddsaPrivateKey *slave_key;
+static struct GNUNET_CRYPTO_EcdsaPrivateKey *slave_key;
static struct GNUNET_CRYPTO_EddsaPublicKey channel_pub_key;
-static struct GNUNET_CRYPTO_EddsaPublicKey slave_pub_key;
+static struct GNUNET_CRYPTO_EcdsaPublicKey slave_pub_key;
struct GNUNET_PSYC_MasterTransmitHandle *mth;
@@ -414,7 +415,7 @@
static void
-join_request_cb (void *cls, const struct GNUNET_CRYPTO_EddsaPublicKey
*slave_key,
+join_request_cb (void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey
*slave_key,
const struct GNUNET_PSYC_MessageHeader *msg,
struct GNUNET_PSYC_JoinHandle *jh)
{
@@ -449,10 +450,13 @@
"_foo", "bar baz", 7);
GNUNET_ENV_environment_add (env, GNUNET_ENV_OP_ASSIGN,
"_foo_bar", "foo bar baz", 11);
+ struct GNUNET_MessageHeader *
+ join_msg = GNUNET_PSYC_message_create ("_request_join", env, "some data",
9);
+
slv = GNUNET_PSYC_slave_join (cfg, &channel_pub_key, slave_key, &origin,
0, NULL, &slave_message_cb,
&slave_connect_cb, &join_decision_cb, NULL,
- "_request_join", env, "some data", 9);
+ join_msg);
GNUNET_ENV_environment_destroy (env);
}
@@ -539,10 +543,10 @@
end_badly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL);
channel_key = GNUNET_CRYPTO_eddsa_key_create ();
- slave_key = GNUNET_CRYPTO_eddsa_key_create ();
+ slave_key = GNUNET_CRYPTO_ecdsa_key_create ();
GNUNET_CRYPTO_eddsa_key_get_public (channel_key, &channel_pub_key);
- GNUNET_CRYPTO_eddsa_key_get_public (slave_key, &slave_pub_key);
+ GNUNET_CRYPTO_ecdsa_key_get_public (slave_key, &slave_pub_key);
GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Starting master.\n");
mst = GNUNET_PSYC_master_start (cfg, channel_key,
GNUNET_PSYC_CHANNEL_PRIVATE,
Modified: gnunet/src/psycstore/plugin_psycstore_sqlite.c
===================================================================
--- gnunet/src/psycstore/plugin_psycstore_sqlite.c 2014-07-10 10:38:46 UTC
(rev 33949)
+++ gnunet/src/psycstore/plugin_psycstore_sqlite.c 2014-07-10 17:49:53 UTC
(rev 33950)
@@ -750,7 +750,7 @@
static int
slave_key_store (struct Plugin *plugin,
- const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key)
+ const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key)
{
sqlite3_stmt *stmt = plugin->insert_slave_key;
@@ -789,7 +789,7 @@
static int
membership_store (void *cls,
const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
- const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key,
+ const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key,
int did_join,
uint64_t announced_at,
uint64_t effective_since,
@@ -851,7 +851,7 @@
static int
membership_test (void *cls,
const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
- const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key,
+ const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key,
uint64_t message_id)
{
struct Plugin *plugin = cls;
Modified: gnunet/src/psycstore/psycstore.h
===================================================================
--- gnunet/src/psycstore/psycstore.h 2014-07-10 10:38:46 UTC (rev 33949)
+++ gnunet/src/psycstore/psycstore.h 2014-07-10 17:49:53 UTC (rev 33950)
@@ -175,7 +175,7 @@
/**
* Slave's public key.
*/
- struct GNUNET_CRYPTO_EddsaPublicKey slave_key;
+ struct GNUNET_CRYPTO_EcdsaPublicKey slave_key;
uint64_t announced_at GNUNET_PACKED;
uint64_t effective_since GNUNET_PACKED;
@@ -207,7 +207,7 @@
/**
* Slave's public key.
*/
- struct GNUNET_CRYPTO_EddsaPublicKey slave_key;
+ struct GNUNET_CRYPTO_EcdsaPublicKey slave_key;
uint64_t message_id GNUNET_PACKED;
@@ -235,7 +235,12 @@
*/
struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
+ /**
+ * enum GNUNET_PSYCSTORE_MessageFlags
+ */
uint32_t psycstore_flags GNUNET_PACKED;
+
+ /* Followed by fragment */
};
@@ -336,12 +341,14 @@
struct GNUNET_HashCode hash;
};
+
enum StateOpFlags
{
STATE_OP_FIRST = 1 << 0,
STATE_OP_LAST = 1 << 1
};
+
/**
* @see GNUNET_PSYCSTORE_state_modify()
*/
Modified: gnunet/src/psycstore/psycstore_api.c
===================================================================
--- gnunet/src/psycstore/psycstore_api.c 2014-07-10 10:38:46 UTC (rev
33949)
+++ gnunet/src/psycstore/psycstore_api.c 2014-07-10 17:49:53 UTC (rev
33950)
@@ -656,7 +656,7 @@
struct GNUNET_PSYCSTORE_OperationHandle *
GNUNET_PSYCSTORE_membership_store (struct GNUNET_PSYCSTORE_Handle *h,
const struct GNUNET_CRYPTO_EddsaPublicKey
*channel_key,
- const struct GNUNET_CRYPTO_EddsaPublicKey
*slave_key,
+ const struct GNUNET_CRYPTO_EcdsaPublicKey
*slave_key,
int did_join,
uint64_t announced_at,
uint64_t effective_since,
@@ -722,7 +722,7 @@
struct GNUNET_PSYCSTORE_OperationHandle *
GNUNET_PSYCSTORE_membership_test (struct GNUNET_PSYCSTORE_Handle *h,
const struct GNUNET_CRYPTO_EddsaPublicKey
*channel_key,
- const struct GNUNET_CRYPTO_EddsaPublicKey
*slave_key,
+ const struct GNUNET_CRYPTO_EcdsaPublicKey
*slave_key,
uint64_t message_id,
uint64_t group_generation,
GNUNET_PSYCSTORE_ResultCallback rcb,
@@ -770,12 +770,12 @@
struct GNUNET_PSYCSTORE_OperationHandle *
GNUNET_PSYCSTORE_fragment_store (struct GNUNET_PSYCSTORE_Handle *h,
const struct GNUNET_CRYPTO_EddsaPublicKey
*channel_key,
- const struct GNUNET_MULTICAST_MessageHeader
*message,
- uint32_t psycstore_flags,
+ const struct GNUNET_MULTICAST_MessageHeader
*msg,
+ enum GNUNET_PSYCSTORE_MessageFlags
psycstore_flags,
GNUNET_PSYCSTORE_ResultCallback rcb,
void *rcb_cls)
{
- uint16_t size = ntohs (message->header.size);
+ uint16_t size = ntohs (msg->header.size);
struct FragmentStoreRequest *req;
struct GNUNET_PSYCSTORE_OperationHandle *op
= GNUNET_malloc (sizeof (*op) + sizeof (*req) + size);
@@ -789,7 +789,7 @@
req->header.size = htons (sizeof (*req) + size);
req->channel_key = *channel_key;
req->psycstore_flags = htonl (psycstore_flags);
- memcpy (&req[1], message, size);
+ memcpy (&req[1], msg, size);
op->op_id = get_next_op_id (h);
req->op_id = htonl (op->op_id);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r33950 - in gnunet/src: include multicast psyc psycstore,
gnunet <=